bug-autoconf
[Top][All Lists]
Advanced

[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:

AC_INIT
funcs="asprintf atexit vfprintf"
AC_REPLACE_FUNCS($funcs)
AC_OUTPUT

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
_ACEOF
$as_echo "#define \`\$as_echo \"HAVE_\$ac_func\" | \$as_tr_cpp\` 1" >>confdefs.h

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

fi
done

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(], [)
 ])],
 [AC_CHECK_FUNCS([$1],
-  [_AH_CHECK_FUNC([$ac_func])AC_DEFINE(AS_TR_CPP([HAVE_$ac_func]))],
+  [_AH_CHECK_FUNC([$ac_func])],
   [_AC_LIBOBJ([$ac_func])])])])





reply via email to

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