Hello Paul,

On Fri, May 11, 2007 at 10:07:18AM -0700, Paul Eggert wrote:
> Stepan Kasal <[EMAIL PROTECTED]> writes:
> > +ac_list="$1"
> > +for ac_func in $ac_list
> 
> While I agree we have a problem, I'm not sure I like this solution.
> It's incompatible, as it will reject things like
> AC_CHECK_HEADERS("file-1.h" "file-2.h").o

but this construct works only for project which do not use
autoheader.

With autoheader you get
        /* Define to 1 if you have the <"file-1.h"> header file. */
        #undef HAVE__FILE_1_H_
Even with AC_CHECK_HEADERS([file-1.h \ file-2.h]) you get
        /* Define to 1 if you have the <\> header file. */
        #undef HAVE__

Note that the backslashes in calls like
        AC_CHECK_HEADERS([file-1.h \
          file-2.h])
work only because AH_CHECK_HEADERS calls m4_foreach_w and it calls
m4_normalize, which removes \<NL>.


OTOH, it is easy to fix this--by using the old construct only if the
prameter does not contain a quote, see the attached patch.


Which of the two patches, if any, can I commit?

Stepan
2007-05-11  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Assign $1 to
        shell variable ac_list, to allow for multiline parameter.
        But fall back to the old version if a quote is used.
        * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Likewise.
        * tests/semantics.at (multiline AC_CHECK_FUNCS): New.
        (multiline AC_CHECK_HEADERS): New.
        (multiline AC_CHECK_FUNCS (backslash)): New.
        (multiline AC_CHECK_HEADERS (backslash)): New.

Index: lib/autoconf/functions.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/functions.m4,v
retrieving revision 1.119
diff -u -r1.119 functions.m4
--- lib/autoconf/functions.m4   22 Dec 2006 08:42:17 -0000      1.119
+++ lib/autoconf/functions.m4   14 May 2007 15:26:45 -0000
@@ -87,7 +87,9 @@
 # ---------------------------------------------------------------------
 AC_DEFUN([AC_CHECK_FUNCS],
 [_AH_CHECK_FUNCS([$1])dnl
-for ac_func in $1
+m4_bmatch([$1], [["']],
+  [for ac_func in $1],
+  [ac_list="$1"; for ac_func in $ac_list])
 do
 AC_CHECK_FUNC($ac_func,
              [AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$ac_func])]) $2],
Index: lib/autoconf/headers.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/headers.m4,v
retrieving revision 1.55
diff -u -r1.55 headers.m4
--- lib/autoconf/headers.m4     28 Nov 2006 00:26:45 -0000      1.55
+++ lib/autoconf/headers.m4     14 May 2007 15:26:46 -0000
@@ -194,7 +194,9 @@
 # ----------------------------------------------------------
 AC_DEFUN([AC_CHECK_HEADERS],
 [AH_CHECK_HEADERS([$1])dnl
-for ac_header in $1
+m4_bmatch([$1], [["']], 
+  [for ac_header in $1],
+  [ac_list="$1"; for ac_header in $ac_list])
 do
 AC_CHECK_HEADER($ac_header,
                [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$ac_header)) $2],
Index: tests/semantics.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/semantics.at,v
retrieving revision 1.61
diff -u -r1.61 semantics.at
--- tests/semantics.at  13 Apr 2007 07:52:58 -0000      1.61
+++ tests/semantics.at  14 May 2007 15:26:46 -0000
@@ -135,6 +135,46 @@
 ])])
 
 
+# multiline AC_CHECK_FUNCS
+# -------------------------
+# The new convenient syntax.
+#
+AT_SETUP([multiline AC_CHECK_FUNCS])
+AT_CONFIGURE_AC(
+[[AC_CHECK_FUNCS([
+       printf
+       autoconf_ftnirp
+  ])
+]])
+AT_CHECK_AUTOCONF([-W obsolete])
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_FTNIRP */
+#define HAVE_PRINTF 1
+])
+AT_CLEANUP
+
+
+# multiline AC_CHECK_FUNCS (backslash)
+# ------------------------------------
+# The old way.
+#
+AT_SETUP([multiline AC_CHECK_FUNCS (backslash)])
+AT_CONFIGURE_AC(
+[[AC_CHECK_FUNCS([printf \
+                 autoconf_ftnirp])
+]])
+AT_CHECK_AUTOCONF([-W obsolete])
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_FTNIRP */
+#define HAVE_PRINTF 1
+])
+AT_CLEANUP
+
+
 # AC_REPLACE_FUNCS
 # ----------------
 # Check that it performs the correct actions: autoconf_ftnirp.c must
@@ -238,6 +278,46 @@
 AT_CLEANUP([header1.h header2.h header3.h])
 
 
+# multiline AC_CHECK_HEADERS
+# ---------------------------
+# The new convenient syntax.
+#
+AT_SETUP([multiline AC_CHECK_HEADERS])
+AT_CONFIGURE_AC(
+[[AC_CHECK_HEADERS([
+       stdio.h
+       autoconf_io.h
+  ])
+]])
+AT_CHECK_AUTOCONF([-W obsolete])
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_IO_H */
+#define HAVE_STDIO_H 1
+])
+AT_CLEANUP
+
+
+# multiline AC_CHECK_HEADERS (backslash)
+# --------------------------------------
+# The old way.
+#
+AT_SETUP([multiline AC_CHECK_HEADERS (backslash)])
+AT_CONFIGURE_AC(
+[[AC_CHECK_HEADERS([stdio.h \
+                   autoconf_io.h])
+]])
+AT_CHECK_AUTOCONF([-W obsolete])
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_IO_H */
+#define HAVE_STDIO_H 1
+])
+AT_CLEANUP
+
+
 # AC_CHECK_MEMBERS
 # ----------------
 # Check that it performs the correct actions.

Reply via email to