[Top][All Lists]

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

AC_REPLACE_FUNCS generates faulty checks

From: Timo Kamph
Subject: AC_REPLACE_FUNCS generates faulty checks
Date: Wed, 29 Jun 2011 14:29:11 +0200
User-agent: Internet Messaging Program (IMP) H3 (4.3.9)

Checks generated from the AC_REPLACE_FUNCS macro fail for every function except the first one. This bug is in the released autoconf-2.68 as well as in the current git tree. The following small configure.ac file demonstrates the issue:

funcs="asprintf atexit vfprintf"

Executing the resulting configure script results in:

checking for asprintf... yes
checking for atexit... no
checking for vfprintf... no

even if all three functions are available. The failures are caused by this strange define in the check's C-code:

#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1

This is the part of the autoconf generated configure script that generates this faulty C-code:

for ac_func in $funcs
do :
  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
$as_echo "#define \`\$as_echo \"HAVE_\$ac_func\" | \$as_tr_cpp\` 1" >>confdefs.h

  case " $LIBOBJS " in
  *" $ac_func.$ac_objext "* ) ;;
  *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext"


The strange define comes from the line after the _ACEOF. The following patch fixes the issue for me. Please review and consider it for inclusion in autoconf-2.69.

diff -Nur autoconf-2.68.orig/lib/autoconf/functions.m4 autoconf-2.68/lib/autoconf/functions.m4 --- autoconf-2.68.orig/lib/autoconf/functions.m4 2010-09-22 23:52:19.000000000 +0200 +++ autoconf-2.68/lib/autoconf/functions.m4 2011-06-28 18:19:48.848343002 +0200
@@ -138,7 +138,7 @@
 [m4_map_args_w([$1], [_AC_REPLACE_FUNC(], [)
-  [_AH_CHECK_FUNC([$ac_func])AC_DEFINE(AS_TR_CPP([HAVE_$ac_func]))],
+  [_AH_CHECK_FUNC([$ac_func])],

reply via email to

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