s3:build: unify linking of libwbclient with a @LIBWBCLIENT_TARGET@
[ira/wip.git] / source3 / configure.in
index 12808eb6f56802220020fc1418e9f74894a7cc5f..bfa8250a319995179dd10befbb6a83896c443de4 100644 (file)
@@ -116,6 +116,7 @@ AC_SUBST(LIBWBCLIENT_SHARED_TARGET)
 AC_SUBST(LIBWBCLIENT_SHARED)
 AC_SUBST(LIBWBCLIENT_STATIC_TARGET)
 AC_SUBST(LIBWBCLIENT_STATIC)
+AC_SUBST(LIBWBCLIENT_TARGET)
 AC_SUBST(LIBWBCLIENT_SOVER)
 AC_SUBST(LIBWBCLIENT)
 AC_SUBST(WINBIND_LIBS)
@@ -152,12 +153,12 @@ AC_SUBST(NSCD_LIBS)
 # do this here since AC_CACHE_CHECK apparently sets the CFLAGS to "-g -O2"
 # if it has no value.  This prevent *very* large debug binaries from occurring
 # by default.
-if test "x$CFLAGS" = x; then
-  CFLAGS="-O"
-fi
 if test "x$debug" = "xyes" ; then
        CFLAGS="${CFLAGS} -g"
 fi
+if test "x$CFLAGS" = x; then
+  CFLAGS="-O"
+fi
 
 m4_include(../lib/socket_wrapper/config.m4)
 m4_include(../lib/nss_wrapper/config.m4)
@@ -788,6 +789,7 @@ if test x$enable_cups != xno; then
                        x"$ac_cv_header_cups_language_h" = xyes; then
                        AC_DEFINE(HAVE_CUPS,1,[Whether we have CUPS])
                        samba_cv_HAVE_CUPS=yes
+                       AC_CHECK_LIB_EXT(cups, PRINT_LIBS, httpConnectEncrypt)
                else
                        AC_MSG_WARN([cups-config around but cups-devel not installed])
                        CFLAGS=$ac_save_CFLAGS
@@ -5860,12 +5862,15 @@ else
                ## Only worry about libwbclient if we have shared
                # library support
                LIBWBCLIENT_SHARED=$LIBWBCLIENT_SHARED_TARGET
+               LIBWBCLIENT_TARGET=$LIBWBCLIENT_SHARED_TARGET
                LIBWBCLIENT=libwbclient
                INSTALL_LIBWBCLIENT=installlibwbclient
                UNINSTALL_LIBWBCLIENT=uninstalllibwbclient
                WINBIND_LIBS="-lwbclient"
        else
                LIBWBCLIENT_STATIC=$LIBWBCLIENT_STATIC_TARGET
+               LIBWBCLIENT_TARGET=$LIBWBCLIENT_STATIC_TARGET
+               WINBIND_LIBS=$LIBWBCLIENT_STATIC_TARGET
        fi
 fi
 
@@ -5973,10 +5978,10 @@ AC_SUBST(FLAGS1)
 # Check if user wants DNS service discovery support
 
 AC_ARG_ENABLE(dnssd,
-[AS_HELP_STRING([--enable-dnssd], [Enable DNS service discovery support (default=auto)])])
+[AS_HELP_STRING([--enable-dnssd], [Enable DNS service discovery support (default=no)])])
 
 AC_SUBST(DNSSD_LIBS)
-if test x"$enable_dnssd" != x"no"; then
+if test x"$enable_dnssd" == x"yes"; then
     have_dnssd_support=yes
 
     AC_CHECK_HEADERS(dns_sd.h)
@@ -6004,6 +6009,42 @@ if test x"$enable_dnssd" != x"no"; then
 
 fi
 
+#################################################
+# Check if user wants avahi support
+
+AC_ARG_ENABLE(avahi,
+[AS_HELP_STRING([--enable-avahi], [Enable Avahi support (default=auto)])])
+
+AC_SUBST(AVAHI_LIBS)
+if test x"$enable_avahi" != x"no"; then
+    have_avahi_support=yes
+
+    AC_CHECK_HEADERS(avahi-common/watch.h)
+    if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
+       have_avahi_support=no
+    fi
+
+    AC_CHECK_HEADERS(avahi-client/client.h)
+    if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
+       have_avahi_support=no
+    fi
+
+    AC_CHECK_LIB_EXT(avahi-client, AVAHI_LIBS, avahi_client_new)
+    if test x"$ac_cv_lib_ext_avahi_client_avahi_client_new" != x"yes"; then
+       have_avahi_support=no
+    fi
+
+    if test x"$have_avahi_support" = x"yes"; then
+       AC_DEFINE(WITH_AVAHI_SUPPORT, 1,
+               [Whether to enable avahi support])
+       AC_SUBST(AVAHI_OBJ, "lib/avahi.o smbd/avahi_register.o")
+    else
+       if test x"$enable_avahi" = x"yes"; then
+           AC_MSG_ERROR(avahi support not available)
+       fi
+    fi
+fi
+
 #################################################
 # Check to see if we should use the included iniparser