+2007-10-11 Eric Blake <ebb9@byu.net>
+
+ Config header generation followup.
+ * lib/autoconf/general.m4 (_AC_DEFINE_Q): Check for raw newlines,
+ which won't work with the preprocessor nor with the awk
+ implementation.
+ * tests/torture.at (Define a newline): Test raw newline detection,
+ removing the XFAIL.
+ * doc/autoconf.texi (Defining Symbols): Document recent change to
+ allow backslash-newline.
+ * THANKS: Update.
+
2007-10-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4: Put function braces in separate line.
Erez Zadok ezk@cs.columbia.edu
Eric Backus ericb@lsid.hp.com
Eric Blake ebb9@byu.net
+Eric Lemings lemings@roguewave.com
Eric Mumpower nocturne@mit.edu
Eric Paire ?
Eric Sunshine sunshine@sunshineco.com
backslash-newlines, universal character names, or non-@acronym{ASCII}
characters.
-@var{value} should not contain literal newlines, and if you are not
-using @code{AC_CONFIG_HEADERS} it should not contain any @samp{#}
-characters, as @command{make} tends to eat them. To use a shell variable,
-use @code{AC_DEFINE_UNQUOTED} instead.
+@var{value} may contain backslash-escaped newlines, which will be
+preserved if you use @code{AC_CONFIG_HEADERS} but flattened if passed
+via @code{@@DEFS@@} (with no effect on the compilation, since the
+preprocessor sees only one line in the first place). @var{value} should
+not contain raw newlines. If you are not using
+@code{AC_CONFIG_HEADERS}, @var{value} should not contain any @samp{#}
+characters, as @command{make} tends to eat them. To use a shell
+variable, use @code{AC_DEFINE_UNQUOTED} instead.
+
@var{description} is only useful if you are using
@code{AC_CONFIG_HEADERS}. In this case, @var{description} is put into
the generated @file{config.h.in} as the comment before the macro define.
[m4_pushdef([AC_name], m4_if(m4_index([$2], [(]), [-1], [[[$2]]],
[m4_bpatsubst([[[$2]]], [(.*)])]))dnl
AC_DEFINE_TRACE(AC_name)dnl
+m4_cond([m4_index([$3], [
+])], [-1], [],
+ [AS_LITERAL_IF([$3], [m4_bregexp([[$3]], [[^\\]
+], [-])])], [], [],
+ [m4_warn([syntax], [AC_DEFINE]m4_ifval([$1], [], [[_UNQUOTED]])dnl
+[: `$3' is not a valid preprocessor define value])])dnl
m4_ifval([$4], [AH_TEMPLATE(AC_name, [$4])])dnl
m4_popdef([AC_name])dnl
cat >>confdefs.h <<$1_ACEOF
## ------------------ ##
AT_SETUP([Define a newline])
-AT_XFAIL_IF(:)
AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
two], [This spans two lines.])
]])
-AT_CHECK_AUTOCONF
-AT_CHECK_AUTOHEADER
+AT_CHECK_AUTOCONF([], [], [],
+[[configure.ac:5: warning: AC_DEFINE: `one
+configure.ac:5: two' is not a valid preprocessor define value
+]])
+AT_CHECK_AUTOHEADER([], [], [],
+[[configure.ac:5: warning: AC_DEFINE: `one
+configure.ac:5: two' is not a valid preprocessor define value
+]])
AT_CHECK_CONFIGURE
AT_CHECK_DEFINES([[#define foo one
-two
]])
+
+AT_CONFIGURE_AC([[AC_DEFINE_UNQUOTED([foo], [one
+two], [This spans two lines.])
+]])
+AT_CHECK_AUTOCONF([], [], [],
+[[configure.ac:5: warning: AC_DEFINE_UNQUOTED: `one
+configure.ac:5: two' is not a valid preprocessor define value
+]])
+AT_CHECK_AUTOHEADER([], [], [],
+[[configure.ac:5: warning: AC_DEFINE_UNQUOTED: `one
+configure.ac:5: two' is not a valid preprocessor define value
+]])
+AT_CHECK_CONFIGURE
+AT_CHECK_DEFINES([[#define foo one
+]])
+
AT_CLEANUP