On 29 Feb 2000 out of nowhere Ian Lance Taylor spoke:
~ :
~ :I don't know what sort of playing around you were doing.
here's exact piece which I made based on the macro you suggested:
AC_DEFUN(SN_CHECK_DECL,[
AC_MSG_CHECKING([whether $1 must be declared])
AC_CACHE_VAL(sn_cv_decl_needed_$1,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
],
[char *(*pfn) = (char *(*)) $1],
eval "sn_cv_decl_needed_$1=no",eval "sn_cv_decl_needed_$1=yes")])
if eval "test \"`echo '$sn_cv_decl_needed_'$1`\" != no"; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
ifelse([$3], , ,[$3])
fi
])dnl
AC_DEFUN(SN_CHECK_DECLS,
[for sn_decl in $1
do
SN_CHECK_DECL($sn_decl,
[
AC_DEFINE_UNQUOTED([NEED_DECL_]translit($sn_decl, [a-z], [A-Z]), 1,
[you have this cuz autoheader breaks things abit])
$2], $3)dnl
done
])
SN_CHECK_DECLS(printf fprintf syslog puts putc fputs fputc fopen \
....
vsnprintf strtoul)
and it was breaking in:
eval "sn_cv_decl_needed_$1=no",eval "sn_cv_decl_needed_$1=yes")])
(it had extra spaces before sn_cv_decl_needed_$1, so configure was giving
`sn_cv_decl_needed_symbol=no: command not found')
if eval "test \"`echo '$sn_cv_decl_needed_'$1`\" != no"; then
and here, if I placed just $sn_cv_decl_needed_$1 !=no, it always was true
because $sn_decl_needed_$1 was equal to "$sn_decl_needed_" (which was
empty) and $1 which was symbol itself.
~ : When used in
~ :BFD, where it is an AC_DEFUN, the $1 is replaced at the m4 level, so
~ :the shell never sees it.
that is what I would expect it too. Maybe m4/autoconf versions differ.
>From what I have seen in configure, these things were not replaced but
rather passed as shell variables.
~ :Perhaps the same issue arises with autoheader. At least for me,
~ :autoheader works fine, and I get entries like this:
~ : /* Define if malloc is not declared in system header files. */
~ : #undef NEED_DECLARATION_MALLOC
yes. if replacement takes place when m4 preprocesses it, it should work.
oddly in my case it didnt.
~ :In any case, you may want to just pick up the macro that Akim
~ :mentioned that is in the current sources, and use that until the next
~ :autoconf release comes out.
well, the problem here is that we have a few developers working on the
project (cvs), so if I upgrade and use these macros, the other developers
wouldn't be able to generate configure scripts until they upgrade. it
would make a good sence to upgrade in long run anyway, but it would take
some time, so I placed the macro (shown up above) as temporal solution
until everyone in our team would upgrade his autoconf package.
--
Key fingerprint = 4422 16FC 3C7D E10A B044 CA4F 2BE0 3943 9758 9324
http://www.kalug.lug.net/fygrave/