[patch] configure.in bug setting authlibs

Green, Paul Paul.Green at stratus.com
Fri Feb 21 17:40:37 GMT 2003


AC_SEARCH_LIBS and AC_CHECK_LIB are used to find a function and then add its
library to the LIBS variable.  The macros can deal with the fact that the
function might be missing, in a library, or available but not in any
library.  The configure script, in both head and 3.0, uses these macros to
find the "crypt" function.  In addition, configure uses the "true" clause to
set AUTHLIBS to hold the name of the library containing "crypt".  However,
it slips up and assumes that crypt, if found, must be in a library. On my
system, crypt is available but not in any library.  Thus, configure
mistakenly sets AUTHLIBS=-lcrypt, but I don't have libcrypt.a, and so I die.

The attached patch corrects this, and removes what I think is a redundant
call to AC_SEARCH_LIBS.  I did an extensive analysis, and AFAICT this patch
will work properly in all cases (with or without pam).  But I would
appreciate another set of eyes looking it over.  

Secondly, AC_SEARCH_LIBS and AC_CHECK_LIB are careful to prepend any new
library to the LIBS variable, whereas the old code dealing with AUTHLIBS
appends newly-discovered libraries. I changed the AUTHLIBS reference to
prepend as well. This may not matter now, but it seems good practice.

I have tested this patch on Stratus VOS and on Sun Solaris. On the Sun, I
tested it --with-pam and --without-pam. It behaved as I expected and desired
in all cases.  I'd be grateful if it could be applied to HEAD and 3_0.


 <<pg.samba.030220.txt>> 
Thanks
PG
--
Stratus Technologies
111 Powdermill Road
Maynard, MA 01754-3409 U.S.A.

Paul Green
Senior Technical Consultant
TEL +1 (978) 461-7557
FAX +1 (978) 461-3610

-------------- next part --------------
diff -urp old/samba/source/configure.in new/samba/source/configure.in
--- old/samba/source/configure.in	Wed Feb 19 10:55:02 2003
+++ new/samba/source/configure.in	Thu Feb 20 07:27:19 2003
@@ -727,11 +727,6 @@ fi
 AC_FUNC_MEMCMP
 
 ###############################################
-# test for where we get crypt() from
-AC_SEARCH_LIBS(crypt, [crypt], [AUTHLIBS="$AUTHLIBS -lcrypt";
-	AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
-
-###############################################
 # Readline included by default unless explicitly asked not to
 test "${with_readline+set}" != "set" && with_readline=yes
 
@@ -2408,15 +2403,10 @@ AC_ARG_WITH(pam_smbpass,
 
 
 ###############################################
-# test for where we get crypt() from, but only
-# if not using PAM
-if test x"$with_pam_for_crypt" = x"no"; then
-AC_CHECK_FUNCS(crypt)
-if test x"$ac_cv_func_crypt" = x"no"; then
-    AC_CHECK_LIB(crypt, crypt, [AUTHLIBS="$AUTHLIBS -lcrypt";
-	AC_DEFINE(HAVE_CRYPT,1,[Whether crypt() is available])])
-fi
-fi
+# test for where we get crypt() from
+AC_SEARCH_LIBS(crypt, [crypt],
+  [test "$ac_cv_search_crypt" = "none required" || AUTHLIBS="-lcrypt $AUTHLIBS"
+  AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
 
 ##
 ## moved after the check for -lcrypt in order to


More information about the samba-technical mailing list