]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
{f77-name-mangling} (AC_OUTPUT_MAKE_DEFS): Change sed regexps to
authorMatthew D. Langston <langston@SLAC.Stanford.EDU>
Wed, 2 Jun 1999 12:46:59 +0000 (12:46 +0000)
committerMatthew D. Langston <langston@SLAC.Stanford.EDU>
Wed, 2 Jun 1999 12:46:59 +0000 (12:46 +0000)
recognize CPP macros that take arguments.  Reported, and based on a
patch, by Steven G. Johnson <stevenj@alum.mit.edu>.
(AC_OUTPUT_HEADER): Likewise.

acgeneral.m4
lib/autoconf/general.m4

index 4e0eaedb961d4c6af5c229e19b34ab893e62e335..abeeb539b36f065fc4b4d23ab44210355dd71c08 100644 (file)
@@ -2147,9 +2147,16 @@ define(AC_OUTPUT_MAKE_DEFS,
 dnl Using a here document instead of a string reduces the quoting nightmare.
 # Protect against shell expansion while executing Makefile rules.
 # Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the cleanup section.  Otherwise,
+# look for a macro that doesn't take arguments.
 cat > conftest.defs <<\EOF
 changequote(<<, >>)dnl
-s%<<#define>> \([^     ][^     ]*\) *\(.*\)%-D\1=\2%g
+s%^[   ]*<<#>>[        ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\)%-D\1=\2%g
+t cleanup
+s%^[   ]*<<#>>[        ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)%-D\2=\3%g
+: cleanup
 s%[    `~<<#>>$^&*(){}\\|;'"<>?]%\\&%g
 s%\[%\\&%g
 s%\]%\\&%g
@@ -2359,7 +2366,10 @@ cat > conftest.hdr <<\EOF
 changequote(<<, >>)dnl
 s/[\\&%]/\\&/g
 s%[\\$`]%\\&%g
-s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%^[   ]*<<#>>[        ]*define[       ][      ]*\(\([^        (][^    (]*\)([^)]*)\)[         ]*\(.*$\)%${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD}%gp
+t cleanup
+s%^[   ]*<<#>>[        ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*$\)% ${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+: cleanup
 s%ac_d%ac_u%gp
 s%ac_u%ac_e%gp
 changequote([, ])dnl
index 4e0eaedb961d4c6af5c229e19b34ab893e62e335..abeeb539b36f065fc4b4d23ab44210355dd71c08 100644 (file)
@@ -2147,9 +2147,16 @@ define(AC_OUTPUT_MAKE_DEFS,
 dnl Using a here document instead of a string reduces the quoting nightmare.
 # Protect against shell expansion while executing Makefile rules.
 # Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the cleanup section.  Otherwise,
+# look for a macro that doesn't take arguments.
 cat > conftest.defs <<\EOF
 changequote(<<, >>)dnl
-s%<<#define>> \([^     ][^     ]*\) *\(.*\)%-D\1=\2%g
+s%^[   ]*<<#>>[        ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\)%-D\1=\2%g
+t cleanup
+s%^[   ]*<<#>>[        ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)%-D\2=\3%g
+: cleanup
 s%[    `~<<#>>$^&*(){}\\|;'"<>?]%\\&%g
 s%\[%\\&%g
 s%\]%\\&%g
@@ -2359,7 +2366,10 @@ cat > conftest.hdr <<\EOF
 changequote(<<, >>)dnl
 s/[\\&%]/\\&/g
 s%[\\$`]%\\&%g
-s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%^[   ]*<<#>>[        ]*define[       ][      ]*\(\([^        (][^    (]*\)([^)]*)\)[         ]*\(.*$\)%${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD}%gp
+t cleanup
+s%^[   ]*<<#>>[        ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*$\)% ${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+: cleanup
 s%ac_d%ac_u%gp
 s%ac_u%ac_e%gp
 changequote([, ])dnl