Re-running ./configure (e.g. to change --disable options) in a build directory seems to cause builds to fail with these errors:
lib/username.o(.text+0x654): In function `user_in_netgroup_list': : undefined reference to `yp_get_default_domain' lib/access.o(.text+0x163): In function `string_match': : undefined reference to `yp_get_default_domain' smbd/password.o(.text+0x1e9e): In function `check_user_equiv': : undefined reference to `yp_get_default_domain' This happens when I just do "make clean" in between builds. Tim says the workaround is to remove config.cache, but there are already too many parrots under that carpet. I thought I'd see what was really wrong. The problem seems to be in the yp_get_default_domain detection: the first time configure is run, it detects that it needs -lnsl, but when the cache is present it gets it wrong. Basically the fix is to follow the Autoconf manual and check for the library before checking for the function. This patch is for HEAD, but should apply without too much fuss to APPL_HEAD or 2.2. Index: configure.in =================================================================== RCS file: /data/cvs/samba/source/configure.in,v retrieving revision 1.384 diff -u -u -p -r1.384 configure.in --- configure.in 13 Jan 2003 04:57:21 -0000 1.384 +++ configure.in 13 Jan 2003 05:34:36 -0000 @@ -509,11 +509,7 @@ fi ############################################ # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code -AC_CHECK_FUNCS(dlopen) -if test x"$ac_cv_func_dlopen" = x"no"; then - AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"; - AC_DEFINE(HAVE_DLOPEN,1,[Whether we have dlopen()])]) -fi +AC_SEARCH_LIBS(dlopen, [dl]) # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then ############################################ @@ -616,12 +612,8 @@ AC_FUNC_MEMCMP ############################################### # test for where we get crypt() from -AC_CHECK_FUNCS(crypt) -if test x"$ac_cv_func_crypt" = x"no"; then - AC_CHECK_LIB(crypt, crypt, [AUTHLIBS="$AUTHLIBS -lcrypt"; +AC_SEARCH_LIBS(crypt, [crypt], [AUTHLIBS="$AUTHLIBS -lcrypt"; AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])]) -fi - ############################################### # Readline included by default unless explicitly asked not to @@ -730,11 +722,8 @@ fi ############################################### # test for where we get yp_get_default_domain() from +AC_SEARCH_LIBS(yp_get_default_domain, [nsl]) AC_CHECK_FUNCS(yp_get_default_domain) -if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then - AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl"; - AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN,1,[Whether the system has yp_get_default_domain()])]) -fi # Check if we have execl, if not we need to compile smbrun. AC_CHECK_FUNCS(execl) -- Martin