]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in (tagname): Use `case' instead of `grep' to infer it.
authorAlexandre Oliva <oliva@lsd.ic.unicamp.br>
Wed, 26 Jul 2000 04:31:03 +0000 (04:31 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Wed, 26 Jul 2000 04:31:03 +0000 (04:31 +0000)
Match even when there are changes in white-space.
(link): Accumulate base_compile so that -L flags that are part of
$CC aren't retained.

ChangeLog
ltmain.in

index 027656e1dbf79079c05489b30c7cbade0a52081a..15e761309393a549ba754b26efe8ff524c94ed93 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-07-26  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
+
+       * ltmain.in (tagname): Use `case' instead of `grep' to infer it.
+       Match even when there are changes in white-space.
+       (link): Accumulate base_compile so that -L flags that are part of
+       $CC aren't retained.
+
 2000-07-24  Mocha  <netbsd_alpha@yahoo.com>
 
        * ltconfig.in (NetBSD, deplibs_check_method): Use file_magic.
index 2522df7e486f39e7ab93100cbae0f77f50189e90..6ad0e697060f6cd73e1e94a13e11c33c8451880c 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -478,30 +478,44 @@ if test -z "$show_help"; then
     # if one wasn't chosen via the "--tag" command line option.
     # Only attempt this if the compiler in the base compile
     # command doesn't match the default compiler.
-    if test -n "$available_tags" && test -z "$tagname" && echo $base_compile | grep -v "^[ ]*[^ ]*$CC" > /dev/null; then
-      for z in $available_tags; do
-        if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
-         # Evaluate the configuration.
-         eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
-          if echo $base_compile | grep "^[ ]*[^ ]*$CC" > /dev/null; then
-            # The compiler in the base compile command matches
-            # the one in the tagged configuration.
-            # Assume this is the tagged configuration we want.
-            tagname=$z
-            break
+    if test -n "$available_tags" && test -z "$tagname"; then
+      case $base_compile in
+      "$CC "*) ;;
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when ltconfig was run.
+      "`$echo X$CC | $Xsed` "*) ;;
+      *)
+        for z in $available_tags; do
+          if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
+           # Evaluate the configuration.
+           eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
+            case $base_compile in
+           "$CC "*)
+              # The compiler in the base compile command matches
+              # the one in the tagged configuration.
+              # Assume this is the tagged configuration we want.
+              tagname=$z
+              break
+              ;;
+           "`$echo X$CC | $Xsed` "*)
+             tagname=$z
+             break
+             ;;
+           esac
           fi
+        done
+        # If $tagname still isn't set, then no tagged configuration
+        # was found and let the user know that the "--tag" command
+        # line option must be used.
+        if test -z "$tagname"; then
+          echo "$modename: unable to infer tagged configuration"
+          echo "$modename: specify a tag with \`--tag'" 1>&2
+         exit 1
+#        else
+#          echo "$modename: using $tagname tagged configuration"
         fi
-      done
-      # If $tagname still isn't set, then no tagged configuration
-      # was found and let the user know that the "--tag" command
-      # line option must be used.
-      if test -z "$tagname"; then
-        echo "$modename: unable to infer tagged configuration"
-        echo "$modename: specify a tag with \`--tag'" 1>&2
-       exit 1
-#      else
-#        echo "$modename: using $tagname tagged configuration"
-      fi
+       ;;
+      esac
     fi
 
     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
@@ -783,6 +797,7 @@ EOF
       ;;
     esac
     libtool_args="$nonopt"
+    base_compile="$nonopt"
     compile_command="$nonopt"
     finalize_command="$nonopt"
 
@@ -856,6 +871,7 @@ EOF
     # Go through the arguments, transforming them on the way.
     while test $# -gt 0; do
       arg="$1"
+      base_compile="$base_compile $arg"
       shift
       case "$arg" in
       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
@@ -1381,32 +1397,44 @@ EOF
     # if one wasn't chosen via the "--tag" command line option.
     # Only attempt this if the compiler in the base link
     # command doesn't match the default compiler.
-    if test -n "$available_tags" \
-       && test -z "$tagname" \
-       && echo $compile_command | grep -v "^[ ]*[^ ]*$CC" > /dev/null; then
-      for z in $available_tags; do
-        if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
-         # Evaluate the configuration.
-         eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
-          if echo $compile_command | grep "^[ ]*[^ ]*$CC" > /dev/null; then
-            # The compiler in $compile_command matches
-            # the one in the tagged configuration.
-            # Assume this is the tagged configuration we want.
-            tagname=$z
-            break
+    if test -n "$available_tags" && test -z "$tagname"; then
+      case $base_compile in
+      "$CC "*) ;;
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when ltconfig was run.
+      "`$echo X$CC | $Xsed` "*) ;;
+      *)
+        for z in $available_tags; do
+          if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
+           # Evaluate the configuration.
+           eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
+            case $base_compile in
+           "$CC "*)
+              # The compiler in $compile_command matches
+              # the one in the tagged configuration.
+              # Assume this is the tagged configuration we want.
+              tagname=$z
+              break
+             ;;
+           "`$echo X$CC | $Xsed` "*)
+             tagname=$z
+             break
+             ;;
+           esac
           fi
+        done
+        # If $tagname still isn't set, then no tagged configuration
+        # was found and let the user know that the "--tag" command
+        # line option must be used.
+        if test -z "$tagname"; then
+          echo "$modename: unable to infer tagged configuration"
+          echo "$modename: specify a tag with \`--tag'" 1>&2
+         exit 1
+#       else
+#         echo "$modename: using $tagname tagged configuration"
         fi
-      done
-      # If $tagname still isn't set, then no tagged configuration
-      # was found and let the user know that the "--tag" command
-      # line option must be used.
-      if test -z "$tagname"; then
-        echo "$modename: unable to infer tagged configuration"
-        echo "$modename: specify a tag with \`--tag'" 1>&2
-       exit 1
-#     else
-#       echo "$modename: using $tagname tagged configuration"
-      fi
+       ;;
+      esac
     fi
 
     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then