configure: use pkgconfig to detect samba
authorNatanael Copa <ncopa@alpinelinux.org>
Fri, 1 Nov 2013 08:25:22 +0000 (09:25 +0100)
committerwsnipex <wsnipex@a1.net>
Fri, 1 Nov 2013 08:32:35 +0000 (09:32 +0100)
Recent Samba versions require pkg-config. We try that first but fall
back to old behaviour if smbclient.pc is missing.

This solves also an 'issue' with samba4 that correctly detects the
libsmbclient in the link test in configure, but fails to compile later
due to missing headers.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
configure.in

index fa872e8..2743bd2 100644 (file)
@@ -1522,9 +1522,12 @@ fi
 
 # samba
 if test "x$use_samba" != "xno"; then
-  AC_CHECK_LIB([smbclient], [main],,
-    use_samba=no;AC_MSG_ERROR($missing_library))
-    USE_LIBSMBCLIENT=0
+  PKG_CHECK_MODULES([SAMBA], [smbclient],
+    [INCLUDES="$INCLUDES $SAMBA_CFLAGS"; LIBS="$LIBS $SAMBA_LIBS"],
+    [AC_CHECK_LIB([smbclient], [main],,
+      use_samba=no;AC_MSG_ERROR($missing_library))
+      USE_LIBSMBCLIENT=0
+    ])
 else
   AC_MSG_RESULT($samba_disabled)
   USE_LIBSMBCLIENT=0