properly when $1 is not a literal.
Fixes PR Autoconf/187, reported by Bram Moolenaar.
/*--------------------------.
| 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).
+2001-06-06 Akim Demaille <akim@epita.fr>
+
+ * 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 <akim@epita.fr>
Invoking AC_COPYRIGHT before AC_INIT fails.
- 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.
\f
* Major changes in Autoconf 2.50
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
# 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.
# 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"
# 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.
# 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"
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.