Author: jpeach
Date: 2006-12-31 06:53:11 +0000 (Sun, 31 Dec 2006)
New Revision: 20429

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20429

Log:
Restructure the libuuid API tests to handle the case where libuuid
is (effectively) in libc. Convert AC_LIBTESTFUNC to use the mystically
undocumented m4_ifval, which fixes some quoting problems when
providing shell code for the if-true and if-false branches.

Modified:
   branches/SAMBA_3_0/source/aclocal.m4
   branches/SAMBA_3_0/source/configure.in


Changeset:
Modified: branches/SAMBA_3_0/source/aclocal.m4
===================================================================
--- branches/SAMBA_3_0/source/aclocal.m4        2006-12-31 06:50:44 UTC (rev 
20428)
+++ branches/SAMBA_3_0/source/aclocal.m4        2006-12-31 06:53:11 UTC (rev 
20429)
@@ -61,55 +61,59 @@
 dnl
 dnl On success, the default actions ensure that HAVE_FOO is defined. The lib
 dnl is always added to $LIBS if it was found to be necessary. The caller
-dnl can use SMB_LIB_REMOVE to strp this if necessary.
+dnl can use SMB_REMOVE_LIB to strp this if necessary.
 AC_DEFUN([AC_LIBTESTFUNC],
 [
   AC_CHECK_FUNCS($2,
       [
         # $2 was found in libc or existing $LIBS
-       ifelse($3, [],
+       m4_ifval([$3],
            [
+               $3
+           ],
+           [
                AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
                    [Whether $2 is available])
-           ],
-           [
-               $3
            ])
       ],
       [
         # $2 was not found, try adding lib$1
        case " $LIBS " in
           *\ -l$1\ *)
-           ifelse($4, [],
+           m4_ifval([$4],
                [
+                   $4
+               ],
+               [
                    # $2 was not found and we already had lib$1
                    # nothing to do here by default
                    true
-               ],
-               [ $4 ])
+               ])
            ;;
           *)
            # $2 was not found, try adding lib$1
            AC_CHECK_LIB($1, $2,
              [
                LIBS="-l$1 $LIBS"
-               ifelse($3, [],
+               m4_ifval([$3],
                    [
+                       $3
+                   ],
+                   [
                        AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
                            [Whether $2 is available])
-                   ],
-                   [
-                       $3
                    ])
              ],
              [
-               ifelse($4, [],
+               m4_ifval([$4],
                    [
+                       $4
+                   ],
+                   [
                        # $2 was not found in lib$1
                        # nothing to do here by default
                        true
-                   ],
-                   [ $4 ])
+                   ])
              ])
          ;;
         esac
@@ -543,9 +547,9 @@
 
 dnl SMB_REMOVE_LIB(lib)
 dnl Remove the given library from $LIBS
-AC_DEFUN([SMB_REMOVELIB],
+AC_DEFUN([SMB_REMOVE_LIB],
 [
-    LIBS=`echo $LIBS | sed -es/-l$1//g`
+    LIBS=`echo $LIBS | sed '-es/-l$1//g'`
 ])
 
 dnl SMB_CHECK_DMAPI([actions if true], [actions if false])

Modified: branches/SAMBA_3_0/source/configure.in
===================================================================
--- branches/SAMBA_3_0/source/configure.in      2006-12-31 06:50:44 UTC (rev 
20428)
+++ branches/SAMBA_3_0/source/configure.in      2006-12-31 06:53:11 UTC (rev 
20429)
@@ -3959,29 +3959,33 @@
 fi
 
 if test x"$with_dnsupdate_support" != x"no"; then
-  ac_save_LIBS=$LIBS
 
   ########################################################
-  # now see if we can find the uuid libs in standard paths
-  AC_CHECK_LIB_EXT(uuid, UUID_LIBS, uuid_generate)
+  # Now see if we can find the uuid libs in standard paths
+  # On some systems, the uuid API is in libc, so we have to
+  # be careful not to insert a spurious -luuid.
+  
+  UUID_LIBS=""
+  AC_LIBTESTFUNC(uuid, uuid_generate,
+         [
+           case " $LIBS " in
+               *\ -luuid\ *)
+               UUID_LIBS="-luuid"
+               SMB_REMOVE_LIB(uuid)
+               ;;
+           esac
 
-  LIBS="$LIBS $UUID_LIBS"
-  
-  if test x"$ac_cv_lib_ext_uuid_uuid_generate" = x"yes"; then
-    with_dnsupdate_support=yes
-    AC_DEFINE(WITH_DNS_UPDATES,1,[Whether to enable DNS Update support])
-    AC_MSG_CHECKING(whether UUID support is used)
-    AC_MSG_RESULT(yes)
-  else
-    if test x"$with_dnsupdate_support" = x"yes"; then
-       AC_MSG_ERROR(libuuid is needed to enable DNS Updates support)
-    else
-       AC_MSG_WARN(libuuid is needed to enable DNS Updates support)
-    fi
-    UUID_LIBS=""
-    with_dnsupdate_support=no
-  fi
-  LIBS=$ac_save_LIBS
+           with_dnsupdate_support=yes
+           AC_DEFINE(WITH_DNS_UPDATES,1,[Whether to enable DNS Update support])
+       ],
+       [
+           if test x"$with_dnsupdate_support" = x"yes"; then
+               AC_MSG_ERROR(libuuid is needed to enable DNS Updates support)
+           else
+               AC_MSG_WARN(libuuid is needed to enable DNS Updates support)
+           fi
+           with_dnsupdate_support=no
+       ])
 fi
 
 #################################################
@@ -6044,13 +6048,13 @@
 AC_MSG_RESULT([Using libraries:])
 AC_MSG_RESULT([    LIBS = $LIBS])
 if test x"$with_ads_support" != x"no"; then
-   AC_MSG_RESULT([    KRB5_LIBS = $KRB5_LIBS])
+    AC_MSG_RESULT([    KRB5_LIBS = $KRB5_LIBS])
 fi
 if test x"$with_ldap_support" != x"no"; then
-   AC_MSG_RESULT([    LDAP_LIBS = $LDAP_LIBS])
+    AC_MSG_RESULT([    LDAP_LIBS = $LDAP_LIBS])
 fi
 if test x"$with_dnsupdate_support" != x"no"; then
-       AC_MSG_RESULT([   UUID_LIBS = $UUID_LIBS])
+    AC_MSG_RESULT([    UUID_LIBS = $UUID_LIBS])
 fi
 AC_MSG_RESULT([    AUTH_LIBS = $AUTH_LIBS])
 

Reply via email to