s3: fall back to cups-config for underlinked libs
authorBjörn Jacke <bj@sernet.de>
Thu, 12 Aug 2010 14:18:45 +0000 (16:18 +0200)
committerBjörn Jacke <bj@sernet.de>
Thu, 12 Aug 2010 14:30:35 +0000 (16:30 +0200)
some OpenBSD systems have underlinked cups libraries. If linking against cups
alone fails, try to link against all the cups-config --libs cruft, which we
usually don't want. (bugzila #7244)

source3/configure.in

index 4b92cd677e49547b8984710ff7432593fb6faf41..0023fe2a692d730bbfbeb629bea0b0440d9e4c1e 100644 (file)
@@ -813,15 +813,21 @@ if test x$enable_cups != xno; then
 
         if test "x$CUPS_CONFIG" != x; then
 
-               ac_save_CFLAGS=$CFLAGS
                ac_save_LDFLAGS=$LDFLAGS
                ac_save_PRINT_LIBS=$PRINT_LIBS
-               CFLAGS="$CFLAGS `$CUPS_CONFIG --cflags`"
-               LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`"
-               PRINT_LIBS="$PRINT_LIBS -lcups"
                AC_CHECK_HEADERS(cups/cups.h cups/language.h)
+
                if test x"$ac_cv_header_cups_cups_h" = xyes -a \
                        x"$ac_cv_header_cups_language_h" = xyes; then
+                       # try linking with -lcups alone first. That should work unless libcups is
+                       # underlinked. With cups-config --libs we pull in unwanted and unneeded
+                       # dendencies including thread libraries - use cups-config only if really
+                       # required. 
+                       AC_CHECK_LIB_EXT(cups, ac_save_PRINT_LIBS , httpConnect,
+                               [PRINT_LIBS"$ac_save_PRINT_LIBS -lcups"],
+                               [AC_MSG_WARN([your cups library doesn't link with -lcups alone, it might be underlinked.]) ;
+                                PRINT_LIBS="$ac_save_PRINT_LIBS `$CUPS_CONFIG --libs`"])
+
                        AC_DEFINE(HAVE_CUPS,1,[Whether we have CUPS])
                        samba_cv_HAVE_CUPS=yes
                        AC_CHECK_LIB_EXT(cups, PRINT_LIBS, httpConnectEncrypt)