Quantcast

Cache variable name for AC_CHECK_LIBS

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cache variable name for AC_CHECK_LIBS

Bert Wesarg-2
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

_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Loading...