Blob Blame Raw
From 82d369758beba0c62f4e7d9d77b57784b38f6f9d Mon Sep 17 00:00:00 2001
From: Alexander Larsson <alexl@redhat.com>
Date: Wed, 17 Oct 2012 08:52:56 +0000
Subject: Find libsmbclient with samba 4

Samba 4 put libsmbclient.h in a subdir and added a smbclient.pc
file to let us find it. Use it if it exists, falling back on
the old code.
---
diff --git a/configure.ac b/configure.ac
index 4062a93..e3dde83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -496,28 +496,31 @@ AM_CONDITIONAL(HAVE_BLURAY, [test "$msg_bluray" = "yes"])
 dnl ==========================================================================
 dnl Samba 3.0
 
+dnl Samba 4 ships a pc file and requires a non-default include subdir, so pick it up:
+PKG_CHECK_MODULES(SMBCLIENT, smbclient, samba_default_cflags="$SMBCLIENT_CFLAGS",samba_default_cflags=-I/usr/include)
+
 AC_ARG_ENABLE(samba, AS_HELP_STRING([--disable-samba],[build without samba support]))
 msg_samba="no"
 if test "x$enable_samba" != "xno"; then
   AC_ARG_WITH(samba-includes, AS_HELP_STRING([--with-samba-includes=PREFIX],[Location of samba includes.]),
-	      with_samba_includes="$withval", with_samba_includes="/usr/include")
+	      with_samba_includes="-I$withval", with_samba_includes=${samba_default_cflags})
   have_samba_includes="no"
-  if test "x${with_samba_includes}" != "xno"; then
+  if test "x${with_samba_includes}" != "x-Ino"; then
 	CPPFLAGS_save="$CPPFLAGS"
 
-	CPPFLAGS="$CPPFLAGS -I$with_samba_includes"
+	CPPFLAGS="$CPPFLAGS $with_samba_includes"
 	AC_CHECK_HEADER(libsmbclient.h, [ samba_includes="yes" ])
 	CPPFLAGS="$CPPFLAGS_save"
 	
 	if test "x{samba_includes}" != "xno" -a "x${samba_includes}" != "x"; then
 		have_samba_includes="yes"
 		if test "${with_samba_includes}" != "/usr/include" ; then
-			SAMBA_CFLAGS="-I$with_samba_includes"
+			SAMBA_CFLAGS="$with_samba_includes"
 		else
 			SAMBA_CFLAGS=""
 		fi
 		
-		CPPFLAGS="$CPPFLAGS -I$with_samba_includes"
+		CPPFLAGS="$CPPFLAGS $with_samba_includes"
 		AC_CHECK_MEMBER(SMBCCTX.flags,
 				[AC_DEFINE(HAVE_SAMBA_FLAGS,, [Defined if flags available in SMBCCTXT])],,
 				[#include <libsmbclient.h>])
--
cgit v0.9.0.2