[PATCH] Fix libnl/libnl-3 logic in configure script

"Ryan O'Hara" <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <[email protected]>
This patch causes the configure script to prefer libnl-3 over
libnl(1). The configure script will first check for libnl-3 and
libnl-genl-3. If both are found, use them. If not, check for
libnl(1). This is useful when building on systems that have both
libnl-3 and libnl(1) installed. It also fixes some redundant libraries
in LIBS.
---
 configure.in | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/configure.in b/configure.in
index 3daf3ee..7f3eef1 100644
--- a/configure.in
+++ b/configure.in
@@ -55,30 +55,30 @@ dnl ----[ Checks for libraries ]----
 AC_CHECK_LIB(crypt, crypt,,AC_MSG_ERROR([crypt() function is required]))
 AC_CHECK_LIB(crypto, MD5_Init,,AC_MSG_ERROR([OpenSSL libraries are required]))
 AC_CHECK_LIB(ssl, SSL_CTX_new,,AC_MSG_ERROR([OpenSSL libraries are required]))
-AC_CHECK_LIB(nl, nl_socket_modify_cb,
+
+AC_CHECK_LIB(nl-3, nl_socket_alloc,
   [
-    USE_NL="LIBIPVS_USE_NL"
-    CFLAGS="$CFLAGS -DFALLBACK_LIBNL1"
-    LIBS="$LIBS -lnl"
+    AC_CHECK_LIB(nl-genl-3, genl_connect,
+      [
+        USE_NL="LIBIPVS_USE_NL"
+        CFLAGS="$CFLAGS $(pkg-config libnl-genl-3.0)"
+	LIBS="$LIBS $(pkg-config --libs libnl-genl-3.0)"
+      ],
+      [
+        AC_MSG_ERROR([libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3.])
+      ]),
   ],
-  [AC_CHECK_LIB(nl-3, nl_socket_alloc,
+  AC_CHECK_LIB(nl, nl_socket_modify_cb,
     [
       USE_NL="LIBIPVS_USE_NL"
-      CFLAGS="$CFLAGS $(pkg-config --libs --cflags libnl-3.0)"
-      LIBS="$LIBS -lnl-3"
-      AC_CHECK_LIB(nl-genl-3, genl_connect,
-       [
-         LIBS="$LIBS -lnl-3 -lnl-genl-3"
-       ],
-       [
-         AC_MSG_ERROR([libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3.])
-       ])
+      CFLAGS="$CFLAGS -DFALLBACK_LIBNL1"
+      LIBS="$LIBS $(pkg-config --libs libnl-1)"
     ],
-    [
+    [                                                                                           
       USE_NL="LIBIPVS_DONTUSE_NL"
       AC_MSG_WARN([keepalived will be built without libnl support.])
     ])
-  ])
+])
 
 dnl ----[ Kernel version check ]----
 CPPFLAGS="$CPPFLAGS -I$kernelinc"
-- 
1.8.1.4


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.