cvsdist 7c113d
diff -u autoconf-2.13/acgeneral.m4~ autoconf-2.13/acgeneral.m4
cvsdist 7c113d
--- autoconf-2.13/acgeneral.m4~	Wed May 15 14:47:12 2002
cvsdist 7c113d
+++ autoconf-2.13/acgeneral.m4	Wed May 15 14:47:12 2002
cvsdist 7c113d
@@ -2156,20 +2156,38 @@
cvsdist 7c113d
 dnl AC_OUTPUT_MAKE_DEFS()
cvsdist 7c113d
 define(AC_OUTPUT_MAKE_DEFS,
cvsdist 7c113d
 [# Transform confdefs.h into DEFS.
cvsdist 7c113d
-dnl Using a here document instead of a string reduces the quoting nightmare.
cvsdist 7c113d
 # Protect against shell expansion while executing Makefile rules.
cvsdist 7c113d
 # Protect against Makefile macro expansion.
cvsdist 7c113d
-cat > conftest.defs <<\EOF
cvsdist 7c113d
-changequote(<<, >>)dnl
cvsdist 7c113d
-s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
cvsdist 7c113d
-s%[ 	`~<<#>>$^&*(){}\\|;'"<>?]%\\&%g
cvsdist 7c113d
-s%\[%\\&%g
cvsdist 7c113d
-s%\]%\\&%g
cvsdist 7c113d
-s%\$%$$%g
cvsdist 7c113d
-changequote([, ])dnl
cvsdist 7c113d
-EOF
cvsdist 7c113d
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
cvsdist 7c113d
-rm -f conftest.defs
cvsdist 7c113d
+#
cvsdist 7c113d
+# If the first sed substitution is executed (which looks for macros that
cvsdist 7c113d
+# take arguments), then we branch to the quote section.  Otherwise,
cvsdist 7c113d
+# look for a macro that doesn't take arguments.
cvsdist 7c113d
+cat >confdef2opt.sed <<\_ACEOF
cvsdist 7c113d
+changequote(<<, >>)dnl
cvsdist 7c113d
+t clear
cvsdist 7c113d
+: clear
cvsdist 7c113d
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	(][^ 	(]*([^)]*)\)[ 	]*\(.*\),-D\1=\2,g
cvsdist 7c113d
+t quote
cvsdist 7c113d
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	][^ 	]*\)[ 	]*\(.*\),-D\1=\2,g
cvsdist 7c113d
+t quote
cvsdist 7c113d
+d
cvsdist 7c113d
+: quote
cvsdist 7c113d
+s,[ 	`~#$^&*(){}\\|;'"<>?],\\&,g
cvsdist 7c113d
+s,\[,\\&,g
cvsdist 7c113d
+s,\],\\&,g
cvsdist 7c113d
+s,\$,$$,g
cvsdist 7c113d
+p
cvsdist 7c113d
+changequote([, ])dnl
cvsdist 7c113d
+_ACEOF
cvsdist 7c113d
+# We use echo to avoid assuming a particular line-breaking character.
cvsdist 7c113d
+# The extra dot is to prevent the shell from consuming trailing
cvsdist 7c113d
+# line-breaks from the sub-command output.  A line-break within
cvsdist 7c113d
+# single-quotes doesn't work because, if this script is created in a
cvsdist 7c113d
+# platform that uses two characters for line-breaks (e.g., DOS), tr
cvsdist 7c113d
+# would break.
cvsdist 7c113d
+ac_LF_and_DOT=`echo; echo .`
cvsdist 7c113d
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
cvsdist 7c113d
+rm -f confdef2opt.sed
cvsdist 7c113d
 ])
cvsdist 7c113d
 
cvsdist 7c113d
 dnl Do the variable substitutions to create the Makefiles or whatever.