Hi,
  some macros take a list as an argument.  It improves readability to
put the items on individual lines:

AC_CONFIG_FILES([dir1/Makefile
  dir2/Makefile
  dir3/Makefile
])
AC_CHECK_HEADERS([foo.h
  bar.h
  baz.h
])
AC_CHECK_FUNCS([foo
  bar
  baz
])

While the first macro call in the example works, the other two don't.

Would you accept the attached patch, which "fixes" this?

I verified that it passes the testsuite.

Have a nice day,
        Stepan Kasal

PS:
Here is my personal experience, which motivated me to submit this
patch:
When I stumbled over the problem, I tried:
        funcs="foo
          bar
          baz"
        AC_CHECK_FUNCS([$foo])
But this is wrong, as it hides the list from autoheader.
So I invented things like:
        AC_CHECK_FUNCS([foo]dnl
                [bar]dnl
                [baz])
and spent some time inventing the right explanatory comment for
this...
I eventually found somewhere the usual workaround:
        AC_CHECK_FUNCS([foo \
          bar \
          baz])
But I spent a few hours with this silly issue.
I believe that the suggested patch can save other people this
frustration.

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.
        * 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   11 May 2007 14:14:10 -0000
@@ -87,7 +87,8 @@
 # ---------------------------------------------------------------------
 AC_DEFUN([AC_CHECK_FUNCS],
 [_AH_CHECK_FUNCS([$1])dnl
-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     11 May 2007 14:14:11 -0000
@@ -194,7 +194,8 @@
 # ----------------------------------------------------------
 AC_DEFUN([AC_CHECK_HEADERS],
 [AH_CHECK_HEADERS([$1])dnl
-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  11 May 2007 14:14:12 -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