* Giuseppe Scrivano had this to say on [13 Feb 2010, 22:44:04 +0100]: > Hello, > > this trivial patch fixes ./configure CFLAGS="-Wall -Werror".
Hi. Thanks for the patch! It looks like when we configure with -Wall -Werror, even with your patch, the configure gets some incorrect results, e.g. in my system, it fails to find _exit, strftime, vsnprintf etc. It'd be good to catch those cases too. Also, I think it makes more sense to include the appropriate headers, rather than declaring externs, e.g.: @@ -47,7 +47,15 @@ AC_PROG_GCC_TRADITIONAL AC_ISC_POSIX AC_USE_SYSTEM_EXTENSIONS -AC_TRY_RUN(main(){exit(0);},,[ +AC_TRY_RUN([ +#include <stdlib.h> + +int main() +{ + exit(0); + return 0; +} +],,[ if test $CC != cc ; then AC_NOTE(Your $CC failed - restarting with CC=cc) AC_NOTE() instead of: @@ -47,7 +47,7 @@ AC_PROG_GCC_TRADITIONAL AC_ISC_POSIX AC_USE_SYSTEM_EXTENSIONS -AC_TRY_RUN(main(){exit(0);},,[ +AC_TRY_RUN(extern void exit (int);int main(){exit(0);return 0;},,[ if test $CC != cc ; then AC_NOTE(Your $CC failed - restarting with CC=cc) AC_NOTE() Or, perhaps we should just make sure that we remove -Wall -Werror from CFLAGS when running ./configure, to keep things simple? Also, I am very interested in the patch attached at https://savannah.gnu.org/bugs/?27318. However, I haven't had the time to test it out. Some help on that would be really appreciated! Cheers, Sadrul > Cheers, > Giuseppe > > >From 2323115d8b432eb85d5341da6664215ad75cda9a Mon Sep 17 00:00:00 2001 > From: Giuseppe Scrivano <gscriv...@gnu.org> > Date: Sat, 13 Feb 2010 22:38:59 +0100 > Subject: [PATCH] Fix configure when CFLAGS="-Wall -Werror" is specified. > > --- > src/configure.in | 68 ++++++++++++++++++++++++++++++++++++++++++----------- > 1 files changed, 54 insertions(+), 14 deletions(-) > > diff --git a/src/configure.in b/src/configure.in > index 8c5762c..b1ed5d9 100644 > --- a/src/configure.in > +++ b/src/configure.in > @@ -47,7 +47,7 @@ AC_PROG_GCC_TRADITIONAL > AC_ISC_POSIX > AC_USE_SYSTEM_EXTENSIONS > > -AC_TRY_RUN(main(){exit(0);},,[ > +AC_TRY_RUN(extern void exit (int);int main(){exit(0);return 0;},,[ > if test $CC != cc ; then > AC_NOTE(Your $CC failed - restarting with CC=cc) > AC_NOTE() > @@ -57,7 +57,7 @@ exec $0 $configure_args > fi > ]) > > -AC_TRY_RUN(main(){exit(0);},, > +AC_TRY_RUN(extern void exit (int);int main(){exit(0); return 0;},, > exec 5>&2 > eval $ac_link > AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;) > @@ -289,11 +289,11 @@ dnl **** select() **** > dnl > > AC_CHECKING(select) > -AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, > -LIBS="$LIBS -lnet -lnsl" > +AC_CHECK_FUNCS([select],, > +[LIBS="$LIBS -lnet -lnsl" > AC_CHECKING(select with $LIBS) > -AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, > -AC_MSG_ERROR(!!! no select - no screen)) > +AC_CHECK_FUNCS([select],, > +AC_MSG_ERROR(!!! no select - no screen))] > ) > dnl > dnl **** FIFO tests **** > @@ -320,7 +320,8 @@ AC_TRY_RUN([ > #endif > > char *fin = "/tmp/conftest$$"; > - > +extern void exit (int); > +int > main() > { > struct stat stb; > @@ -363,6 +364,7 @@ main() > if (select(1, &f, 0, 0, 0) == -1) > exit(1); > exit(0); > + return 0; > } > ], AC_NOTE(- your fifos are usable) fifo=1, > AC_NOTE(- your fifos are not usable)) > @@ -388,9 +390,10 @@ AC_TRY_RUN([ > #ifndef S_IFIFO > #define S_IFIFO 0010000 > #endif > - > +extern void exit (int); > char *fin = "/tmp/conftest$$"; > > +int > main() > { > struct timeval tv; > @@ -411,6 +414,7 @@ main() > if (select(1, &f, 0, 0, &tv)) > exit(1); > exit(0); > + return 0; > } > ], AC_NOTE(- your implementation is ok), > AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1) > @@ -438,8 +442,11 @@ AC_TRY_RUN([ > #include <sys/socket.h> > #include <sys/un.h> > > +extern void exit (int); > + > char *son = "/tmp/conftest$$"; > > +int > main() > { > int s1, s2, l; > @@ -473,6 +480,7 @@ main() > if (select(1, &f, 0, 0, 0) == -1) > exit(1); > exit(0); > + return 0; > } > ], AC_NOTE(- your sockets are usable) sock=1, > AC_NOTE(- your sockets are not usable)) > @@ -493,8 +501,11 @@ AC_TRY_RUN([ > #include <sys/socket.h> > #include <sys/un.h> > > +extern void exit (int); > + > char *son = "/tmp/conftest$$"; > > +int > main() > { > int s; > @@ -511,6 +522,7 @@ main() > exit(1); > close(s); > exit(0); > + return 0; > } > ],AC_NOTE(- you are normal), > AC_NOTE(- unix domain sockets are not kept in the filesystem) > @@ -561,6 +573,8 @@ AC_TRY_RUN([ > > char *nam = "/tmp/conftest$$"; > > +extern void exit (int); > + > #ifdef NAMEDPIPE > > #ifndef O_NONBLOCK > @@ -570,7 +584,10 @@ char *nam = "/tmp/conftest$$"; > #define S_IFIFO 0010000 > #endif > > +extern void exit (int); > + > > +int > main() > { > fd_set f; > @@ -639,6 +656,7 @@ main() > if (select(1, &f, &f, 0, 0) != 2) > exit(1); > exit(0); > + return 0; > } > ],AC_NOTE(- select is ok), > AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN)) > @@ -655,27 +673,31 @@ AC_TRY_LINK(,[ > #ifdef __hpux > __sorry_hpux_libcurses_is_totally_broken_in_10_10(); > #else > +extern void tgetent (char*, char*); > tgetent((char *)0, (char *)0); > #endif > ],, > LIBS="-ltermcap $olibs" > AC_CHECKING(libtermcap) > -AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, > +AC_TRY_LINK(,extern void tgetent (char*, char*); tgetent((char *)0, (char > *)0);,, > LIBS="-ltermlib $olibs" > AC_CHECKING(libtermlib) > -AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, > +AC_TRY_LINK(,extern void tgetent (char*, char*); tgetent((char *)0, (char > *)0);,, > LIBS="-lncursesw $olibs" > AC_CHECKING(libncursesw) > -AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, > +AC_TRY_LINK(,extern void tgetent (char*, char*); tgetent((char *)0, (char > *)0);,, > LIBS="-lncurses $olibs" > AC_CHECKING(libncurses) > -AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, > +AC_TRY_LINK(,extern void tgetent (char*, char*); tgetent((char *)0, (char > *)0);,, > AC_MSG_ERROR(!!! no tgetent - no screen))))))) > > AC_TRY_RUN([ > +extern void exit (int); > +int > main() > { > - exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); > + exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); > + return 0; > }], AC_NOTE(- you use the termcap database), > AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO)) > AC_CHECKING(ospeed) > @@ -745,6 +767,9 @@ AC_TRY_RUN([ > #include <sys/types.h> > #include <sys/stat.h> > #include <stdio.h> > +extern void exit (int); > + > +int > main() > { > struct stat sb; > @@ -768,6 +793,7 @@ main() > fprintf(fp, "%d\n", sb.st_gid); > fclose(fp); > exit(0); > + return 0; > } > ],[ > if test -f conftest_grp; then > @@ -940,6 +966,9 @@ $nlist64 > > struct nlist nl[2]; > > +extern void exit (int); > + > +int > main() > { > #if !defined(_AUX_SOURCE) && !defined(AUX) > @@ -955,6 +984,7 @@ main() > if (nl[0].n_value == 0) > exit(1); > exit(0); > + return 0; > } > ],avensym=$av;break) > if test "$av" = _Loadavg; then > @@ -1077,6 +1107,7 @@ hand() > got++; > } > > +int > main() > { > /* on hpux we use sigvec to get bsd signals */ > @@ -1088,6 +1119,7 @@ main() > exit(1); > #endif > exit(0); > + return 0; > } > ],,AC_DEFINE(SYSVSIGS)) > > @@ -1158,6 +1190,9 @@ AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, > NULL);],AC_DEFINE(HAVE_FDWALK)) > > AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments) > AC_TRY_RUN([ > +extern void exit (int); > + > +int > main() { > char buf[10]; > strcpy(buf, "abcdefghi"); > @@ -1169,10 +1204,12 @@ main() { > if (strncmp(buf, "cdedef", 6)) > exit(1); > exit(0); /* libc version works properly. */ > + return 0; > }], AC_DEFINE(USEBCOPY)) > > AC_TRY_RUN([ > #define bcopy(s,d,l) memmove(d,s,l) > +int > main() { > char buf[10]; > strcpy(buf, "abcdefghi"); > @@ -1184,11 +1221,13 @@ main() { > if (strncmp(buf, "cdedef", 6)) > exit(1); > exit(0); /* libc version works properly. */ > + return 0; > }], AC_DEFINE(USEMEMMOVE)) > > > AC_TRY_RUN([ > #define bcopy(s,d,l) memcpy(d,s,l) > +int > main() { > char buf[10]; > strcpy(buf, "abcdefghi"); > @@ -1200,6 +1239,7 @@ main() { > if (strncmp(buf, "cdedef", 6)) > exit(1); > exit(0); /* libc version works properly. */ > + return 0; > }], AC_DEFINE(USEMEMCPY)) > > AC_SYS_LONG_FILE_NAMES > @@ -1286,7 +1326,7 @@ fi > dnl Ptx bug workaround -- insert -lc after -ltermcap > test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq" > > -AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal > error. Sorry.)) > +AC_TRY_RUN(extern void exit (int);int main(){exit(0); return > 0;},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.)) > > AC_OUTPUT(Makefile doc/Makefile, [[ > # a hook for preserving undef directive in config.h > -- > 1.6.6.1 >