From: Daiki Ueno Date: Mon, 12 Aug 2013 14:19:55 +0000 (+0200) Subject: autopoint: make macro trace in autom4te robuster X-Git-Tag: v0.18.3.1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32e194b4dc739f6ac492370f0d1e1699d65cca04;p=thirdparty%2Fgettext.git autopoint: make macro trace in autom4te robuster --- diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog index bd4de9adc..ea9134c2a 100644 --- a/gettext-tools/misc/ChangeLog +++ b/gettext-tools/misc/ChangeLog @@ -1,3 +1,12 @@ +2013-08-12 Daiki Ueno + + autopoint: make macro trace in autom4te robuster + * autopoint.in (func_trace): Ignore M4sugar macros which may abort + autom4te and read gettext.m4 to trace AM_GNU_GETTEXT_* macros. + * gettextize.in (func_trace): New function ported from autopoint.in. + Reported by Sami Kerola in + . + 2013-07-21 Daiki Ueno * autopoint.in (omitintl): Don't set it 'no' when no diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in index 1ea960a7c..51f85511b 100644 --- a/gettext-tools/misc/autopoint.in +++ b/gettext-tools/misc/autopoint.in @@ -140,32 +140,19 @@ fi # traces an Autoconf macro call and outputs the arguments to stdout. func_trace () { - case "$1" in - AC_*) - # For Autoconf standard macros, autom4te --trace can be used. - autom4te --no-cache --language=Autoconf-without-aclocal-m4 --trace="$1":\$% "$configure_in" - ;; - *) - # 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" "$configure_in" - ;; - esac + echo '\ +dnl ignore M4sugar macros which may abort autom4te +m4_undefine([m4_assert]) +m4_undefine([m4_fatal]) +m4_undefine([m4_warn]) +m4_undefine([m4_errprintn]) +m4_undefine([m4_exit]) +dnl macros which needs to be traced without aclocal.m4 +m4_define([AM_GNU_GETTEXT], []) +m4_define([AM_GNU_GETTEXT_VERSION], []) +' \ + | autom4te --no-cache --language=Autoconf-without-aclocal-m4 \ + --trace="$1":\$% - "$2" } # func_usage @@ -288,7 +275,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` +xver=`func_trace 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 @@ -326,15 +313,15 @@ case "$ver" in esac # Check in which directory config.rpath, mkinstalldirs etc. belong. -auxdir=`func_trace AC_CONFIG_AUX_DIR` +auxdir=`func_trace AC_CONFIG_AUX_DIR "$configure_in"` if test -n "$auxdir"; then auxdir="$auxdir/" fi # Check in which directory the *.m4 macros belong. -macrodirs=`func_trace AC_CONFIG_MACRO_DIR_TRACE` +macrodirs=`func_trace AC_CONFIG_MACRO_DIR_TRACE "$configure_in"` if test -z "$macrodirs"; then - macrodirs=`func_trace AC_CONFIG_MACRO_DIR` + macrodirs=`func_trace AC_CONFIG_MACRO_DIR "$configure_in"` fi for arg in $macrodirs; do m4dir="$arg" @@ -362,7 +349,7 @@ fi # Check whether to omit the intl/ directory. omitintl= -xargs=`func_trace AM_GNU_GETTEXT` +xargs=`func_trace AM_GNU_GETTEXT "$configure_in"` for arg in $xargs; do if test 'external' = "$arg"; then omitintl=yes @@ -371,7 +358,7 @@ for arg in $xargs; do done # Check in which directory or directories the po/* infrastructure belongs. -configfiles=`func_trace AC_CONFIG_FILES` +configfiles=`func_trace AC_CONFIG_FILES "$configure_in"` # PO directories have a Makefile.in generated from Makefile.in.in. # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO diff --git a/gettext-tools/misc/gettextize.in b/gettext-tools/misc/gettextize.in index 63190428a..6278a3d90 100644 --- a/gettext-tools/misc/gettextize.in +++ b/gettext-tools/misc/gettextize.in @@ -30,8 +30,6 @@ prefix="@prefix@" datarootdir="@datarootdir@" gettext_dir="@datadir@/gettext" -autom4te="autom4te --no-cache --language=Autoconf-without-aclocal-m4" - # func_tmpdir # creates a temporary directory. # Sets variable @@ -138,6 +136,25 @@ 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 () +{ + echo '\ +dnl ignore M4sugar macros which may abort autom4te +m4_undefine([m4_assert]) +m4_undefine([m4_fatal]) +m4_undefine([m4_warn]) +m4_undefine([m4_errprintn]) +m4_undefine([m4_exit]) +dnl macros which needs to be traced without aclocal.m4 +m4_define([AM_GNU_GETTEXT], []) +m4_define([AM_GNU_GETTEXT_VERSION], []) +' \ + | autom4te --no-cache --language=Autoconf-without-aclocal-m4 \ + --trace="$1":\$% - "$2" +} + # func_usage # outputs to stdout the --help usage message. func_usage () @@ -311,15 +328,15 @@ if test $force -eq 0; then fi # Check in which directory config.rpath etc. belong. -auxdir=`$autom4te --trace=AC_CONFIG_AUX_DIR:\$% "$configure_in"` +auxdir=`func_trace AC_CONFIG_AUX_DIR "$configure_in"` if test -n "$auxdir"; then auxdir="$auxdir/" fi # Check in which directory gettext.m4 etc. belong. -macrodirs=`$autom4te --trace=AC_CONFIG_MACRO_DIR_TRACE:\$% "$configure_in"` +macrodirs=`func_trace AC_CONFIG_MACRO_DIR_TRACE "$configure_in"` if test -z "$macrodirs"; then - macrodirs=`$autom4te --trace=AC_CONFIG_MACRO_DIR:\$% "$configure_in"` + macrodirs=`func_trace AC_CONFIG_MACRO_DIR "$configure_in"` fi for arg in $macrodirs; do m4dir="$arg" @@ -656,9 +673,15 @@ if test -n "$intldir"; then else echo "Not copying intl/ directory." # Tell the user what to put into configure.ac, if it is not already there. - if grep '^AM_GNU_GETTEXT([[]\?external[]]\?[ ]*[,)]' "$srcdir/$configure_in" > /dev/null; then - : - else + external= + xargs=`func_trace AM_GNU_GETTEXT "$srcdir/$configure_in"` + for arg in $xargs; do + if test 'external' = "$arg"; then + external=yes + break + fi + done + if test -z "$external"; then please="$please Please use AM_GNU_GETTEXT([external]) in order to cause autoconfiguration to look for an external libintl.