Subject: Re: bug#9696: 24.0.50; configure misses func_gl_gnulib_m4code_pathmax

From: Paul Eggert <[email-masked]>
Date: Fri, 07 Oct 2011 14:24:58 -0700

On 10/07/11 12:52, Glenn Morris wrote:

> If this is a bug, it is introduced by
> http://lists.gnu.org/archive/html/emacs-diffs/2011-09/msg00317.html

Yes, thanks, that's indeed a bug in gnulib-tool.
I fixed it in gnulib
<http://lists.gnu.org/archive/html/bug-gnulib/2011-10/msg00105.html>
<http://lists.gnu.org/archive/html/bug-gnulib/2011-10/msg00106.html>
and propagated the change into the Emacs trunk as bzr 106019.

Peter, if you do a "bzr up" followed by "./autogen.sh",
that should fix the problem; if it doesn't, please let us know.

Here's the change I committed to the trunk.

Merge from gnulib, fixing some 'configure' typos (Bug#9696).
* lib/signal.in.h, lib/sigprocmask.c, m4/gl-comp.m4:
* m4/gnulib-common.m4: Merge from gnulib.
Without this, 'configure' would say "func_gl_gnulib_m4code_pathmax:
command not found" on powerpc-apple-darwin9.8.0.
=== modified file 'lib/signal.in.h'
--- lib/signal.in.h	2011-09-26 21:30:18 +0000
+++ lib/signal.in.h	2011-10-07 21:06:40 +0000
@@ -178,6 +178,10 @@
 #if @GNULIB_SIGPROCMASK@
 # if !@HAVE_POSIX_SIGNALBLOCKING@

+#  ifndef GNULIB_defined_signal_blocking
+#   define GNULIB_defined_signal_blocking 1
+#  endif
+
 /* Maximum signal number + 1.  */
 #  ifndef NSIG
 #   define NSIG 32
@@ -303,18 +307,10 @@
 # endif
 _GL_CXXALIASWARN (signal);

-/* Raise signal SIG.  */
 # if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef raise
-#   define raise rpl_raise
-#  endif
-_GL_FUNCDECL_RPL (raise, int, (int sig));
-_GL_CXXALIAS_RPL (raise, int, (int sig));
-# else
-_GL_CXXALIAS_SYS (raise, int, (int sig));
+/* Raise signal SIGPIPE.  */
+_GL_EXTERN_C int _gl_raise_SIGPIPE (void);
 # endif
-_GL_CXXALIASWARN (raise);

 #elif defined GNULIB_POSIXCHECK
 # undef sigaddset

=== modified file 'lib/sigprocmask.c'
--- lib/sigprocmask.c	2011-09-26 21:30:18 +0000
+++ lib/sigprocmask.c	2011-10-07 21:06:40 +0000
@@ -330,27 +330,19 @@
 }

 #if GNULIB_defined_SIGPIPE
-/* Raise the signal SIG.  */
+/* Raise the signal SIGPIPE.  */
 int
-rpl_raise (int sig)
-# undef raise
+_gl_raise_SIGPIPE (void)
 {
-  switch (sig)
+  if (blocked_set & (1U << SIGPIPE))
+    pending_array[SIGPIPE] = 1;
+  else
     {
-    case SIGPIPE:
-      if (blocked_set & (1U << sig))
-        pending_array[sig] = 1;
-      else
-        {
-          handler_t handler = SIGPIPE_handler;
-          if (handler == SIG_DFL)
-            exit (128 + SIGPIPE);
-          else if (handler != SIG_IGN)
-            (*handler) (sig);
-        }
-      return 0;
-    default: /* System defined signal */
-      return raise (sig);
+      handler_t handler = SIGPIPE_handler;
+      if (handler == SIG_DFL)
+        exit (128 + SIGPIPE);
+      else if (handler != SIG_IGN)
+        (*handler) (SIGPIPE);
     }
 }
 #endif

=== modified file 'm4/gl-comp.m4'
--- m4/gl-comp.m4	2011-09-26 21:30:18 +0000
+++ m4/gl-comp.m4	2011-10-07 21:06:50 +0000
@@ -79,9 +79,9 @@
   # Code from module stdarg:
   dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
   dnl for the builtin va_copy to work.  With Autoconf 2.60 or later,
-  dnl AC_PROG_CC_STDC arranges for this.  With older Autoconf AC_PROG_CC_STDC
+  dnl gl_PROG_CC_C99 arranges for this.  With older Autoconf gl_PROG_CC_C99
   dnl shouldn't hurt, though installers are on their own to set c99 mode.
-  AC_REQUIRE([AC_PROG_CC_STDC])
+  gl_PROG_CC_C99
   # Code from module stdbool:
   # Code from module stddef:
   # Code from module stdint:
@@ -246,12 +246,6 @@
 fi
 gl_SIGNAL_MODULE_INDICATOR([sigprocmask])
       gl_gnulib_enabled_sigprocmask=true
-      if $condition; then
-        func_gl_gnulib_m4code_raise
-      fi
-      if $condition; then
-        func_gl_gnulib_m4code_f691f076f650964c9f5598c3ee487616
-      fi
     fi
   }
   func_gl_gnulib_m4code_stat ()
@@ -264,13 +258,10 @@
 fi
 gl_SYS_STAT_MODULE_INDICATOR([stat])
       gl_gnulib_enabled_stat=true
-      if $condition; then
+      if test $REPLACE_STAT = 1; then
         func_gl_gnulib_m4code_dosname
       fi
-      if $condition; then
-        func_gl_gnulib_m4code_pathmax
-      fi
-      if $condition; then
+      if test $REPLACE_STAT = 1; then
         func_gl_gnulib_m4code_verify
       fi
     fi
@@ -305,12 +296,6 @@
       gl_gnulib_enabled_verify=true
     fi
   }
-  if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
-    func_gl_gnulib_m4code_f691f076f650964c9f5598c3ee487616
-  fi
-  if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
-    func_gl_gnulib_m4code_676220fa4366efa9bdbfccf11a857c07
-  fi
   if test $REPLACE_GETOPT = 1; then
     func_gl_gnulib_m4code_be453cec5eecf5731a274f2de7f2db36
   fi

=== modified file 'm4/gnulib-common.m4'
--- m4/gnulib-common.m4	2011-09-03 23:08:32 +0000
+++ m4/gnulib-common.m4	2011-10-07 21:06:50 +0000
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 30
+# gnulib-common.m4 serial 31
 dnl Copyright (C) 2007-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,
@@ -211,6 +211,29 @@
 [m4_define([AS_VAR_IF],
 [AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])

+# gl_PROG_CC_C99
+# Modifies the value of the shell variable CC in an attempt to make $CC
+# understand ISO C99 source code.
+# This is like AC_PROG_CC_C99, except that
+# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60,
+# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC
+#   <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00367.html>,
+#   but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99
+#   <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00441.html>.
+# Remaining problems:
+# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options
+#   to CC twice
+#   <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>.
+# - AC_PROG_CC_STDC is likely to change when C1X is an ISO standard.
+AC_DEFUN([gl_PROG_CC_C99],
+[
+  dnl Change that version number to the minimum Autoconf version that supports
+  dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls.
+  m4_version_prereq([9.0],
+    [AC_REQUIRE([AC_PROG_CC_C99])],
+    [AC_REQUIRE([AC_PROG_CC_STDC])])
+])
+
 # gl_PROG_AR_RANLIB
 # Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler.
 # The user can set the variables AR, ARFLAGS, RANLIB if he wants to override