From: Gary V. Vaughan Date: Fri, 19 Oct 2012 05:09:37 +0000 (+0700) Subject: bootstrap: extract *first* ACLOCAL_AMFLAGS -I argument. X-Git-Tag: v2.4.2.418~110 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=670283ee701b1e8b781e8250ccf4911443e683eb;p=thirdparty%2Flibtool.git bootstrap: extract *first* ACLOCAL_AMFLAGS -I argument. * bootstrap (func_require_macro_dir): .* is greedy, so _G_sed_scan as it was will always return the last -I argument, which is wrong. Move to a shell loop to ensure we always get the first -I argument if any. (code from libtoolize.in). Signed-off-by: Gary V. Vaughan --- diff --git a/bootstrap b/bootstrap index cdcdf4ce9..3eff64055 100755 --- a/bootstrap +++ b/bootstrap @@ -1492,10 +1492,15 @@ func_require_macro_dir () test -n "$macro_dir" || { $require_aclocal_amflags - _G_sed_scan='s|^.*-I[ ]*\([^ ]*\) .*|\1|' - - # Trailing space in echo is required by the sed script. - macro_dir=`echo "$aclocal_amflags " |$SED "$_G_sed_scan"` + # Take the argument following the first '-I', if any. + _G_minus_I_seen=false + for _G_arg in $aclocal_amflags; do + case $_G_minus_I_seen,$_G_arg in + :,*) macro_dir=$_G_arg; break ;; + *,-I) _G_minus_I_seen=: ;; + *,-I*) macro_dir=`expr x$_G_arg : 'x-I\(.*\)$'`; break ;; + esac + done } func_verbose "macro_dir='$macro_dir'"