From: Akim Demaille Date: Wed, 6 Jun 2001 15:03:29 +0000 (+0000) Subject: * acgeneral.m4 (AC_CHECK_LIB): Fix the cache var name to work X-Git-Tag: AUTOCONF-2.50a~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb1bba338d716b149a7aafb4d5210393a01efd4d;p=thirdparty%2Fautoconf.git * acgeneral.m4 (AC_CHECK_LIB): Fix the cache var name to work properly when $1 is not a literal. Fixes PR Autoconf/187, reported by Bram Moolenaar. --- diff --git a/BUGS b/BUGS index 6be4c71bf..9f531d92a 100644 --- a/BUGS +++ b/BUGS @@ -18,9 +18,3 @@ address them. /*--------------------------. | Good for production use. | `--------------------------*/ - -* Important bugs - -** AC_CHECK_LIB -Does not work properly when given variables instead of literals, e.g., -AC_CHECK_LIB($foo, $bar). diff --git a/ChangeLog b/ChangeLog index 3b9b2db82..278a1cba5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-06-06 Akim Demaille + + * acgeneral.m4 (AC_CHECK_LIB): Fix the cache var name to work + properly when $1 is not a literal. + Fixes PR Autoconf/187, reported by Bram Moolenaar. + 2001-06-06 Akim Demaille Invoking AC_COPYRIGHT before AC_INIT fails. diff --git a/NEWS b/NEWS index f2a4e471c..10fdd6ba7 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ Now include stdint.h. - Mostly in the test suite. - Invocation of GNU M4 now robust to POSIXLY_CORRECT. - configure accepts --prefix='' again. +- AC_CHECK_LIB works properly when its first argument is not a + literal. * Major changes in Autoconf 2.50 diff --git a/THANKS b/THANKS index 5707edda4..bf34dc94e 100644 --- a/THANKS +++ b/THANKS @@ -18,6 +18,7 @@ Ben Elliston bje@redhat.com Bill Sommerfeld sommerfeld@apollo.hp.com Bob Friesenhahn bfriesen@simple.dallas.tx.us Bob Wilson bwilson@tensilica.com +Bram Moolenaar bram@vim.org Bruno Haible haible@ilog.fr Carl Edman cedman@princeton.edu Chad R. Larson chad@anasazi.com diff --git a/acgeneral.m4 b/acgeneral.m4 index 1ad2e7b1f..6820acded 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2523,6 +2523,11 @@ AS_IF([test "$ac_cv_search_$1" != no], # just for library $1. Separate tests with the same $1 and different $2s # may have different results. # +# Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2]) +# is asking for troubles, since AC_CHECK_LIB($lib, fun) would give +# ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence +# the AS_LITERAL_IF indirection. +# # FIXME: This macro is extremely suspicious. It DEFINEs unconditionnally, # whatever the FUNCTION, in addition to not being a *S macro. Note # that the cache does depend upon the function we are looking for. @@ -2534,7 +2539,9 @@ AS_IF([test "$ac_cv_search_$1" != no], # freedom. AC_DEFUN([AC_CHECK_LIB], [m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl -AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])dnl +AS_LITERAL_IF([$1], + [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])], + [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl AC_CACHE_CHECK([for $2 in -l$1], ac_Lib, [ac_check_lib_save_LIBS=$LIBS LIBS="-l$1 $5 $LIBS" diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 1ad2e7b1f..6820acded 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2523,6 +2523,11 @@ AS_IF([test "$ac_cv_search_$1" != no], # just for library $1. Separate tests with the same $1 and different $2s # may have different results. # +# Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2]) +# is asking for troubles, since AC_CHECK_LIB($lib, fun) would give +# ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence +# the AS_LITERAL_IF indirection. +# # FIXME: This macro is extremely suspicious. It DEFINEs unconditionnally, # whatever the FUNCTION, in addition to not being a *S macro. Note # that the cache does depend upon the function we are looking for. @@ -2534,7 +2539,9 @@ AS_IF([test "$ac_cv_search_$1" != no], # freedom. AC_DEFUN([AC_CHECK_LIB], [m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl -AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])dnl +AS_LITERAL_IF([$1], + [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])], + [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl AC_CACHE_CHECK([for $2 in -l$1], ac_Lib, [ac_check_lib_save_LIBS=$LIBS LIBS="-l$1 $5 $LIBS" diff --git a/tests/suite.at b/tests/suite.at index be1375541..495c91398 100644 --- a/tests/suite.at +++ b/tests/suite.at @@ -39,7 +39,6 @@ m4_include([torture.at]) m4_include([compile.at]) # Checking that AC_CHECK_FOO macros work properly. -AT_BANNER([FIXME: AC_CHECK_TYPE is a known failure.]) m4_include([semantics.at]) # Blind testing the macros.