-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have noticed that gcc 3.4.4 (the current version on cygwin) issues a warning even though no -W options were specified, when a declaration conflicts with a gcc builtin. This behavior is currently tickled by the implementation of AC_LANG_CALL, and it inhibits autoconf's ability to test function linkage when the user happens to add -Werror to their CFLAGS:
$ cat conftest.c /* confdefs.h. */ #define PACKAGE_NAME "" #define PACKAGE_TARNAME "" #define PACKAGE_VERSION "" #define PACKAGE_STRING "" #define PACKAGE_BUGREPORT "" /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char printf (); int main () { return printf (); ; return 0; } $ gcc -o conftest conftest.c conftest.c:15: warning: conflicting types for built-in function 'printf' This also gives a false negative in the testsuite: './testsuite -k AC_TRY_LINK_FUNC CFLAGS=-Werror' fails because it generated the above conftest.c, and the warning was turned into an error by my choice of CFLAGS, in spite of the comment issued by AC_LANG_CALL that the char return type works around gcc builtins. There are other failures triggered by running ./testsuite with CFLAGS=-Werror, and I am slowly seeing whether they are worth tackling. Meanwhile, it pointed out a doc bug related to AC_TRY_LINK_FUNC; patch attached. Currently, to force a package to have a warning-free compile, I like to do './configure; make CFLAGS=-Werror', but I have to remember to set CFLAGS for every subsequent make rerun. But it would be nicer if I could do './configure CFLAGS=-Werror; make', and have make pick up the configured flags. At this point, I wonder whether it would be worth teaching autoconf about gcc's -w flag (and comparable flags for other compilers, if they are known), then using that flag during configuration to override the user's CFLAGS warning settings to avoid the false negatives triggered by various tests when warnings are present, while still allowing the user to specify their desired level of warnings during compilation. 2006-03-08 Eric Blake <[EMAIL PROTECTED]> * doc/autoconf.texi (Obsolete Macros): Fix wording of AC_TRY_LINK_FUNC. - -- Life is short - so eat dessert first! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEDuPn84KuGfSFAYARAgZaAJ4ipzqNjejC96zsDwKKK0b/bFZQlQCdF8Jp Tz9rlhcM1uhVgmmi6x7LKQU= =LGux -----END PGP SIGNATURE-----
Index: doc/autoconf.texi =================================================================== RCS file: /sources/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.957 diff -u -p -r1.957 autoconf.texi --- doc/autoconf.texi 6 Mar 2006 22:34:34 -0000 1.957 +++ doc/autoconf.texi 8 Mar 2006 13:31:11 -0000 @@ -15405,9 +15405,8 @@ and compilation flags are determined by @defmac AC_TRY_LINK_FUNC (@var{function}, @ovar{action-if-found}, @ovar{action-if-not-found}) @acindex{TRY_LINK_FUNC} This macro is equivalent to [EMAIL PROTECTED]([AC_LANG_CALL([EMAIL PROTECTED], [EMAIL PROTECTED])], [EMAIL PROTECTED], [EMAIL PROTECTED])}. [EMAIL PROTECTED]([AC_LANG_CALL([], [EMAIL PROTECTED])], [EMAIL PROTECTED], [EMAIL PROTECTED])}. @end defmac @defmac AC_TRY_RUN (@var{program}, @ovar{action-if-true}, @ovar{action-if-false}, @ovar{action-if-cross-compiling})