From 6fcbecee4965c48c3df9712a24b8e5bbaeb01c49 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 26 Jul 2000 04:31:03 +0000 Subject: [PATCH] * 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. --- ChangeLog | 7 ++++ ltmain.in | 120 +++++++++++++++++++++++++++++++++--------------------- 2 files changed, 81 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 027656e1d..15e761309 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-07-26 Alexandre Oliva + + * 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 * ltconfig.in (NetBSD, deplibs_check_method): Use file_magic. diff --git a/ltmain.in b/ltmain.in index 2522df7e4..6ad0e6970 100644 --- 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 -- 2.47.3