From 2d437590196e3c6880ca5c06029fcd73f0e16442 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 15 Oct 2009 21:04:51 +0200 Subject: [PATCH] don't let environment settings perturb build Setting the envvars, LIB_CLOCK_GETTIME, LIB_EACCESS or LIB_NANOSLEEP 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/clock_time.m4 (gl_CLOCK_TIME): Initialize AC_SUBST'd var. * m4/euidaccess.m4 (gl_PREREQ_EUIDACCESS): Likewise. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Likewise. --- ChangeLog | 24 ++++++++++++++++++++++++ m4/clock_time.m4 | 1 + m4/euidaccess.m4 | 1 + m4/nanosleep.m4 | 3 ++- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e19038b3d..1e4340546 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2009-10-15 Jim Meyering + + don't let environment settings perturb build + Setting the envvars, LIB_CLOCK_GETTIME, LIB_EACCESS or LIB_NANOSLEEP + 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/clock_time.m4 (gl_CLOCK_TIME): Initialize AC_SUBST'd var. + * m4/euidaccess.m4 (gl_PREREQ_EUIDACCESS): Likewise. + * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Likewise. + 2009-10-14 Eric Blake fchdir: avoid infinite recursion in mingw diff --git a/m4/clock_time.m4 b/m4/clock_time.m4 index d191072f5..d67f3df56 100644 --- a/m4/clock_time.m4 +++ b/m4/clock_time.m4 @@ -20,6 +20,7 @@ AC_DEFUN([gl_CLOCK_TIME], # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all* # programs in the package would end up linked with that potentially-shared # library, inducing unnecessary run-time overhead. + LIB_CLOCK_GETTIME= gl_saved_libs=$LIBS AC_SEARCH_LIBS([clock_gettime], [rt posix4], [test "$ac_cv_search_clock_gettime" = "none required" || diff --git a/m4/euidaccess.m4 b/m4/euidaccess.m4 index f1a175cdc..5e8adace3 100644 --- a/m4/euidaccess.m4 +++ b/m4/euidaccess.m4 @@ -42,6 +42,7 @@ AC_DEFUN([gl_PREREQ_EUIDACCESS], [ # Save and restore LIBS so -lgen isn't added to it. Otherwise, *all* # programs in the package would end up linked with that potentially-shared # library, inducing unnecessary run-time overhead. + LIB_EACCESS= gl_saved_libs=$LIBS AC_SEARCH_LIBS([eaccess], [gen], [test "$ac_cv_search_eaccess" = "none required" || diff --git a/m4/nanosleep.m4 b/m4/nanosleep.m4 index 7f08744ac..663fedf12 100644 --- a/m4/nanosleep.m4 +++ b/m4/nanosleep.m4 @@ -24,9 +24,10 @@ AC_DEFUN([gl_FUNC_NANOSLEEP], # Solaris 2.5.1 needs -lposix4 to get the nanosleep function. # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. + LIB_NANOSLEEP= AC_SEARCH_LIBS([nanosleep], [rt posix4], [test "$ac_cv_search_nanosleep" = "none required" || - LIB_NANOSLEEP=$ac_cv_search_nanosleep]) + LIB_NANOSLEEP=$ac_cv_search_nanosleep]) AC_REQUIRE([gl_MULTIARCH]) if test $APPLE_UNIVERSAL_BUILD = 1; then -- 2.11.0