When a variable HAVE_FOO is initialized to 1 and set to 0 in a different .m4 file, we have to ensure that the assignment to 1 is done before the assignment to 0, not afterwards.
Checking the results of $ grep -n 'HAVE_.*=0' \ $(for f in $(grep -l 'HAVE_.*=0' *.m4) ; do \ if fgrep -l 'DEFAULTS])' $f > /dev/null ; then :; else echo $f;fi; \ done) I found 4 violations of this rule. This fixes them. 2011-10-09 Bruno Haible <br...@clisp.org> Ensure that HAVE_* variables are set to 1 before they are set to 0. * m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Require gl_DIRENT_H_DEFAULTS. * m4/inet_ntop.m4 (gl_FUNC_INET_NTOP): Require gl_ARPA_INET_H_DEFAULTS. * m4/inet_pton.m4 (gl_FUNC_INET_PTON): Likewise. * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Require gl_SIGNAL_H_DEFAULTS. --- m4/fdopendir.m4.orig Sun Oct 9 15:03:44 2011 +++ m4/fdopendir.m4 Sun Oct 9 15:00:23 2011 @@ -1,4 +1,4 @@ -# serial 8 +# serial 9 # See if we need to provide fdopendir. dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. @@ -10,7 +10,10 @@ AC_DEFUN([gl_FUNC_FDOPENDIR], [ + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + dnl FreeBSD 7.3 has the function, but failed to declare it. AC_CHECK_DECLS([fdopendir], [], [HAVE_DECL_FDOPENDIR=0], [[ #include <dirent.h> --- m4/inet_ntop.m4.orig Sun Oct 9 15:03:44 2011 +++ m4/inet_ntop.m4 Sun Oct 9 14:59:06 2011 @@ -1,4 +1,4 @@ -# inet_ntop.m4 serial 18 +# inet_ntop.m4 serial 19 dnl Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,6 +6,8 @@ AC_DEFUN([gl_FUNC_INET_NTOP], [ + AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) + dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) --- m4/inet_pton.m4.orig Sun Oct 9 15:03:44 2011 +++ m4/inet_pton.m4 Sun Oct 9 14:58:16 2011 @@ -1,4 +1,4 @@ -# inet_pton.m4 serial 16 +# inet_pton.m4 serial 17 dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,6 +6,8 @@ AC_DEFUN([gl_FUNC_INET_PTON], [ + AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) + dnl Persuade Solaris <arpa/inet.h> to declare inet_pton. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) --- m4/pthread_sigmask.m4.orig Sun Oct 9 15:03:44 2011 +++ m4/pthread_sigmask.m4 Sun Oct 9 14:54:38 2011 @@ -1,4 +1,4 @@ -# pthread_sigmask.m4 serial 12 +# pthread_sigmask.m4 serial 13 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,6 +6,8 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], [ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([pthread_sigmask]) LIB_PTHREAD_SIGMASK= -- In memoriam Oskar Schindler <http://en.wikipedia.org/wiki/Oskar_Schindler> <http://www.shoah.dk/Courage/Schindler.htm>