libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CC can be a program name *with arguments*


From: Ralf Wildenhues
Subject: Re: CC can be a program name *with arguments*
Date: Mon, 21 Mar 2005 14:26:50 +0100
User-agent: Mutt/1.4.1i

To finish this up for now..

* Gary V. Vaughan wrote on Tue, Mar 01, 2005 at 03:43:04PM CET:
> Ralf Wildenhues wrote:
> > I want, in a libtoolized project,
> >   ../configure CC='pgcc-78.9 -foo-option'
> > to succeed in choosing Portland compiler options.  No multiple compilers
> > involved here.
> 
> Ah yes.  Thinko.  Currently we should recommend:
> 
>   ../configure CC='/opt/pgcc-78.9/bin/pgcc -foo-option'
> 
> But, I agree that supporting multiple compilers in users' PATH is also
> a nice feature.  Like you said, "let's do both!" :-)  We'll need an
> entry in sh.test to spot switches missing the '*' inside 'case $cc_basename'
> to save us forgetting in the future as part of the patch too.

*snip*
> Be liberal in what input you accept... besides, plenty of our concatenation
> loops leave a leading space, so it won't hurt to get into the habit of
> taking leading whitespace into account.
> 
> I forgot the path stripping too, gah!  Let me try again:
> 
>   cc_basename=`$echo X"$compiler" \
>           | $Xsed -e 's%.*/%%;s%^[    ]*\([^  ]*\).*$%\1%'`

OK to apply the patch below (HEAD, branch-2-0)?
The sh.test test is by no means perfect (it will miss errors on lines
with more than one pattern), but better than nothing, and seems to be
portable.

Regards,
Ralf

2005-05-21  Gary V. Vaughan  <address@hidden>,
            Ralf Wildenhues  <address@hidden>

        * m4/libtool.m4 (_LT_SETUP, _LT_LANG_CXX_CONFIG, * _LT_LANG_F77_CONFIG):
        For matching compiler names: Pick only first word, allow leading white
        space..
        * tests/sh.test: ..and test for missing `*' at end of patterns.

Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.173
diff -u -r1.173 libtool.m4
--- m4/libtool.m4       20 Mar 2005 07:15:21 -0000      1.173
+++ m4/libtool.m4       21 Mar 2005 11:22:29 -0000
@@ -193,7 +193,8 @@
 test -z "$LD" && LD=ld
 test -z "$ac_objext" && ac_objext=o
 
-cc_basename=`$ECHO X"$compiler" | $Xsed -e 's%^.*/%%'`
+cc_basename=`$ECHO "X$compiler" \
+    | $Xsed -e 's%.*/%%;s%^[   ]*\([^  ]*\).*$%\1%'`
 
 # Only perform the check for file, if the check method requires it
 test -z "$MAGIC_CMD" && MAGIC_CMD=file
@@ -4681,7 +4682,8 @@
   CC=${CXX-"c++"}
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
-  cc_basename=`$ECHO X"$compiler" | $Xsed -e 's%^.*/%%'`
+  cc_basename=`$ECHO "X$compiler" \
+      | $Xsed -e 's%.*/%%;s%^[         ]*\([^  ]*\).*$%\1%'`
 
   if test -n "$compiler"; then
     # We don't want -fno-exception when compiling C++ code, so set the
@@ -5784,7 +5786,8 @@
   CC=${F77-"f77"}
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
-  cc_basename=`$ECHO X"$compiler" | $Xsed -e 's%^.*/%%'`
+  cc_basename=`$ECHO "X$compiler" \
+      | $Xsed -e 's%.*/%%;s%^[         ]*\([^  ]*\).*$%\1%'`
 
   if test -n "$compiler"; then
     AC_MSG_CHECKING([if libtool supports shared libraries])
cvs diff: Diffing mail
cvs diff: Diffing tests
Index: tests/sh.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/sh.test,v
retrieving revision 1.24
diff -u -r1.24 sh.test
--- tests/sh.test       2 Feb 2005 12:16:45 -0000       1.24
+++ tests/sh.test       21 Mar 2005 11:22:29 -0000
@@ -105,4 +105,14 @@
   fi
 done
 
+for s in "$srcdir/../m4/libtool.m4"
+do
+  if $SED -n '/case \$cc_basename in/,/esac/ {
+             /^[       ]*[a-zA-Z][a-zA-Z0-9+]*[^*][    ]*)/p
+             };'  $s | $EGREP .; then
+    echo "\$cc_basename matches should include a trailing \`*' in $s."
+    status=$EXIT_FAILURE
+  fi
+done
+
 exit $status




reply via email to

[Prev in Thread] Current Thread [Next in Thread]