autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cache variable name for AC_CHECK_LIBS


From: Bert Wesarg
Subject: Cache variable name for AC_CHECK_LIBS
Date: Mon, 25 Apr 2016 20:48:20 +0200

Dear Autotconf developers,

I just realized, that the cache variable name for AC_CHECK_LIBS does
not conform to the documented one if AS_LITERAL_WORD_IF fails for the
library name. I.e., One uses AC_CHECK_LIBS with a variable name for
its first argument:

libname=foo
AC_CHECK_LIBS([$libname], [init_foo])

The full part in AC_CHECK_LIBS is this:

AS_LITERAL_WORD_IF([$1],
          [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])],
          [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl

The second AS_VAR_PUSHDEF now expands to this:

as_ac_Lib=`$as_echo "ac_cv_lib_$libname''_init_foo" | $as_tr_sh`

Which results in the value of $as_ac_Lib

ac_cv_lib_foo___init_foo

Though the expected and documented variable name is

ac_cv_lib_foo_init_foo

The reason for the different name is the use of the two single-quotes
in the AS_VAR_PUSHDEF call, which is there to ensure, that the passed
'$lib' value stopped before the '_'. But as the whole variable is
passed in double-quotes to '$as_echo' the two single-quotes survive
the echo and will than be translated to underscores by '$as_tr_sh'.

Any advice on how to fix this in Autoconf?

Best,
Bert



reply via email to

[Prev in Thread] Current Thread [Next in Thread]