diff options
author | Daiki Ueno <ueno@gnu.org> | 2014-03-27 18:20:52 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2014-03-27 18:21:14 +0900 |
commit | 58cccf8252d95e12bbfc795445ae3a1c4ada57be (patch) | |
tree | 155a032c67de2cb3be5381407c584fb8ca4f9fc8 | |
parent | 640988014681be0179cb7f4022cc0d5f51db2ba4 (diff) | |
download | external_gettext-58cccf8252d95e12bbfc795445ae3a1c4ada57be.zip external_gettext-58cccf8252d95e12bbfc795445ae3a1c4ada57be.tar.gz external_gettext-58cccf8252d95e12bbfc795445ae3a1c4ada57be.tar.bz2 |
autopoint: Use SED-based trace for non-standard Autoconf macros
-rw-r--r-- | gettext-tools/misc/ChangeLog | 9 | ||||
-rw-r--r-- | gettext-tools/misc/autopoint.in | 35 | ||||
-rw-r--r-- | gettext-tools/misc/gettextize.in | 31 |
3 files changed, 63 insertions, 12 deletions
diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog index 308a8af..ba769c1 100644 --- a/gettext-tools/misc/ChangeLog +++ b/gettext-tools/misc/ChangeLog @@ -1,3 +1,12 @@ +2014-03-27 Daiki Ueno <ueno@gnu.org> + + autopoint: Use SED-based trace for non-standard Autoconf macros + Reported by Sean McGovern in <https://savannah.gnu.org/bugs/?41913>. + * autopoint.in (func_trace_sed): New function; use it to trace + AM_GNU_GETTEXT and AM_GNU_GETTEXT_VERSION. + * gettextize.in (func_trace_sed): New function; use it to trace + AM_GNU_GETTEXT. + 2014-03-26 Daiki Ueno <ueno@gnu.org> * autopoint.in: Allow user to specify the directory in which diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in index 68ec39c..240c509 100644 --- a/gettext-tools/misc/autopoint.in +++ b/gettext-tools/misc/autopoint.in @@ -136,8 +136,8 @@ if test "@RELOCATABLE@" = yes; then gettext_dir=`echo "$gettext_dir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'` fi -# func_trace macro -# traces an Autoconf macro call and outputs the arguments to stdout. +# func_trace macro configure.ac +# traces a standard Autoconf macro call and outputs the arguments to stdout. func_trace () { echo '\ @@ -149,14 +149,35 @@ m4_undefine([m4_errprintn]) m4_undefine([m4_exit]) m4_undefine([m4_include]) m4_undefine([m4_esyscmd]) -dnl macros which needs to be traced without aclocal.m4 -m4_define([AM_GNU_GETTEXT], []) -m4_define([AM_GNU_GETTEXT_VERSION], []) ' \ | ${AUTOM4TE:-autom4te} --no-cache --language=Autoconf-without-aclocal-m4 \ --trace="$1":\$% - "$2" 2>/dev/null } +# func_trace_sed macro configure.ac +# traces a non-standard Autoconf macro call and outputs the arguments to stdout. +func_trace_sed () +{ + # Otherwise, manually extract macro calls in configure.ac with + # sed. This is less reliable than the above way and does not + # support multiple calls. + sed_extract_arguments=' +s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,; +/'"$1"'(/ { + ta + :a + s/)/)/ + tb + s/\\$// + N + ba + :b + s,^.*'"$1"'([[ ]*\([^]"$`\\)]*\).*$,\1,p +} +d' + sed -e "$sed_extract_arguments" "$2" +} + # func_usage # outputs to stdout the --help usage message. func_usage () @@ -277,7 +298,7 @@ fi # Check whether the -V option and the version number in configure.in match. # At least one of the two must be given. If both are given, they must agree. -xver=`func_trace AM_GNU_GETTEXT_VERSION "$configure_in"` +xver=`func_trace_sed AM_GNU_GETTEXT_VERSION "$configure_in"` if test -z "$xver" && test -f intl/VERSION; then xver=`cat intl/VERSION | LC_ALL=C sed -n -e 's/^.*gettext-\([-+_.0-9A-Za-z]*\).*$/\1/p'` fi @@ -355,7 +376,7 @@ fi # Check whether to omit the intl/ directory. omitintl= -xargs=`func_trace AM_GNU_GETTEXT "$configure_in"` +xargs=`func_trace_sed AM_GNU_GETTEXT "$configure_in"` save_IFS="$IFS"; IFS=: for arg in $xargs; do if test 'external' = "$arg"; then diff --git a/gettext-tools/misc/gettextize.in b/gettext-tools/misc/gettextize.in index 390c37e..19c6467 100644 --- a/gettext-tools/misc/gettextize.in +++ b/gettext-tools/misc/gettextize.in @@ -136,7 +136,7 @@ if test "@RELOCATABLE@" = yes; then gettext_dir=`echo "$gettext_dir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'` fi -# func_trace macro +# func_trace macro configure.ac # traces an Autoconf macro call and outputs the arguments to stdout. func_trace () { @@ -149,14 +149,35 @@ m4_undefine([m4_errprintn]) m4_undefine([m4_exit]) m4_undefine([m4_include]) m4_undefine([m4_esyscmd]) -dnl macros which needs to be traced without aclocal.m4 -m4_define([AM_GNU_GETTEXT], []) -m4_define([AM_GNU_GETTEXT_VERSION], []) ' \ | ${AUTOM4TE:-autom4te} --no-cache --language=Autoconf-without-aclocal-m4 \ --trace="$1":\$% - "$2" 2>/dev/null } +# func_trace_sed macro configure.ac +# traces a non-standard Autoconf macro call and outputs the arguments to stdout. +func_trace_sed () +{ + # Otherwise, manually extract macro calls in configure.ac with + # sed. This is less reliable than the above way and does not + # support multiple calls. + sed_extract_arguments=' +s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,; +/'"$1"'(/ { + ta + :a + s/)/)/ + tb + s/\\$// + N + ba + :b + s,^.*'"$1"'([[ ]*\([^]"$`\\)]*\).*$,\1,p +} +d' + sed -e "$sed_extract_arguments" "$2" +} + # func_usage # outputs to stdout the --help usage message. func_usage () @@ -676,7 +697,7 @@ else echo "Not copying intl/ directory." # Tell the user what to put into configure.ac, if it is not already there. external= - xargs=`func_trace AM_GNU_GETTEXT "$srcdir/$configure_in"` + xargs=`func_trace_sed AM_GNU_GETTEXT "$srcdir/$configure_in"` save_IFS="$IFS"; IFS=: for arg in $xargs; do if test 'external' = "$arg"; then |