]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
bootstrap: extract *first* ACLOCAL_AMFLAGS -I argument.
authorGary V. Vaughan <gary@gnu.org>
Fri, 19 Oct 2012 05:09:37 +0000 (12:09 +0700)
committerGary V. Vaughan <gary@gnu.org>
Fri, 19 Oct 2012 07:24:21 +0000 (14:24 +0700)
* 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 <gary@gnu.org>
bootstrap

index cdcdf4ce928259389fd68f23ccbfe26fa1fb89ed..3eff64055f9ffba9d1ba6816fda1b42194b8995b 100755 (executable)
--- 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'"