build: don't let environment settings perturb build
authorJim Meyering <meyering@vm.meyering.net.localdomain>
Thu, 15 Oct 2009 18:54:02 +0000 (20:54 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 15 Oct 2009 19:03:40 +0000 (21:03 +0200)
Setting the envvars, LIB_FDATASYNC, LIB_XATTR or LIB_CRYPT
could cause a configure-time and/or build-time malfunction.
Typically, a configure-time function-in-library test is performed
via code like this:

  LIB_VAR=
  AC_SUBST([LIB_VAR])
  prefix_saved_LIBS=$LIBS
    AC_SEARCH_LIBS([FUNC], [LIB_NAME],
                   [test "$ac_cv_search_FUNC" = "none required" ||
                    LIB_VAR=$ac_cv_search_FUNC])
  LIBS=$prefix_saved_LIBS

However, in each of the files affected by this change, the LIB_VAR=
initialization was omitted.  Thus, when set in the environment, its
value would propagate into generated Makefiles when FUNC is not found
in LIB_NAME.
* m4/jm-macros.m4 (coreutils_MACROS): Initialize AC_SUBST'd var
* m4/lib-check.m4 (cu_LIB_CHECK): Likewise.
* m4/xattr.m4 (gl_FUNC_XATTR): Likewise.

m4/jm-macros.m4
m4/lib-check.m4
m4/xattr.m4

index 8339404..f42f67c 100644 (file)
@@ -94,6 +94,7 @@ AC_DEFUN([coreutils_MACROS],
 
   # for dd.c and shred.c
   coreutils_saved_libs=$LIBS
+    LIB_FDATASYNC=
     AC_SEARCH_LIBS([fdatasync], [rt posix4],
                    [test "$ac_cv_search_fdatasync" = "none required" ||
                     LIB_FDATASYNC=$ac_cv_search_fdatasync])
index e169fa1..7bbdb20 100644 (file)
@@ -51,6 +51,7 @@ $ac_includes_default
 
   # SCO-ODT-3.0 is reported to need -lufc for crypt.
   # NetBSD needs -lcrypt for crypt.
+  LIB_CRYPT=
   cu_saved_libs="$LIBS"
   AC_SEARCH_LIBS([crypt], [ufc crypt],
                  [test "$ac_cv_search_crypt" = "none required" ||
index 878e86b..d340417 100644 (file)
@@ -25,6 +25,7 @@ AC_DEFUN([gl_FUNC_XATTR],
     fi
     AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
                        [Define if you want extended attribute support.])
+    LIB_XATTR=
     xattr_saved_LIBS=$LIBS
     AC_SEARCH_LIBS([attr_copy_file], [attr],
                    [test "$ac_cv_search_attr_copy_file" = "none required" ||