* Ralf Wildenhues wrote on Thu, Apr 07, 2005 at 12:40:30PM CEST:
> 
> But when a libtoolized package is configured as
>   configure CC='distcc xlc' ..
> Libtool's tests break down[1].

FYI: Applied the following patches to all branches.  Added purify for
convenience, and simplified the sed script, now that we do the word
splitting by hand.  Added workaround for empty $CC.

Regards,
Ralf

2005-04-15  Ralf Wildenhues  <[EMAIL PROTECTED]>

        * m4/libtool.m4 (_LT_CC_BASENAME): New macro to figure out $cc_basename.
        Skip ccache, distcc, purify, cmdline options, `$host_alias-' prefix.
        (_LT_SETUP, _LT_LANG_CXX_CONFIG, _LT_LANG_F77_CONFIG,
        _LT_LANG_GCJ_CONFIG, _LT_LANG_RC_CONFIG): Use.
        * NEWS, TODO: Update.
2005-04-15  Ralf Wildenhues  <[EMAIL PROTECTED]>

        * m4/libtool.m4 (_LT_CC_BASENAME): New macro to figure out $cc_basename.
        Skip ccache, distcc, purify, cmdline options, `$host_alias-' prefix.
        (_LT_SETUP, _LT_LANG_CXX_CONFIG, _LT_LANG_F77_CONFIG,
        _LT_LANG_GCJ_CONFIG, _LT_LANG_RC_CONFIG): Use.
        * NEWS, TODO: Update.

Index: NEWS
===================================================================
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.179
diff -u -r1.179 NEWS
--- NEWS        12 Mar 2005 08:49:02 -0000      1.179
+++ NEWS        15 Apr 2005 13:33:29 -0000
@@ -10,6 +10,7 @@
 * Support (mostly) for DragonFly BSD.
 * Allow shell special characters like `$' in source file names, but not
   in object names, to enhance GCJ support.
+* Detection of compiler wrappers like distcc/ccache and $host_alias prefix.
 
 New in 1.9h: 2004-??-??; CVS version 1.9g, Libtool team:
 * Libtool versions can now be parallel installed, except that only one
Index: TODO
===================================================================
RCS file: /cvsroot/libtool/libtool/TODO,v
retrieving revision 1.64
diff -u -r1.64 TODO
--- TODO        21 Mar 2005 08:02:55 -0000      1.64
+++ TODO        15 Apr 2005 13:33:29 -0000
@@ -118,8 +118,6 @@
     - cross compile
     - dirs with ~
     - multiple input files
-    - look at the wrapper-in-wrapper problem: `libtool' vs.
-        distcc, ccache, mpicc.
 
 2.3. libtool
 ------------
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.181
diff -u -r1.181 libtool.m4
--- m4/libtool.m4       12 Apr 2005 17:28:48 -0000      1.181
+++ m4/libtool.m4       15 Apr 2005 13:33:29 -0000
@@ -90,6 +90,20 @@
 dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
 
 
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    ccache | *[[\\/]]ccache | distcc | *[[\\/]]distcc | purify | 
*[[\\/]]purify | \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
 # _LT_SETUP
 # ---------
 m4_defun([_LT_SETUP],
@@ -193,8 +207,7 @@
 test -z "$LD" && LD=ld
 test -z "$ac_objext" && ac_objext=o
 
-cc_basename=`$ECHO "X$compiler" \
-    | $Xsed -e 's%.*/%%;s%^[   ]*\([^  ]*\).*$%\1%'`
+_LT_CC_BASENAME([$compiler])
 
 # Only perform the check for file, if the check method requires it
 test -z "$MAGIC_CMD" && MAGIC_CMD=file
@@ -4701,8 +4714,7 @@
   CC=${CXX-"c++"}
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
-  cc_basename=`$ECHO "X$compiler" \
-      | $Xsed -e 's%.*/%%;s%^[         ]*\([^  ]*\).*$%\1%'`
+  _LT_CC_BASENAME([$compiler])
 
   if test -n "$compiler"; then
     # We don't want -fno-exception when compiling C++ code, so set the
@@ -5828,8 +5840,7 @@
   CC=${F77-"f77"}
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
-  cc_basename=`$ECHO "X$compiler" \
-      | $Xsed -e 's%.*/%%;s%^[         ]*\([^  ]*\).*$%\1%'`
+  _LT_CC_BASENAME([$compiler])
 
   if test -n "$compiler"; then
     AC_MSG_CHECKING([if libtool supports shared libraries])
@@ -5917,8 +5928,7 @@
 CC=${GCJ-"gcj"}
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
-cc_basename=`$ECHO "X$compiler" \
-    | $Xsed -e 's%.*/%%;s%^[   ]*\([^  ]*\).*$%\1%'`
+_LT_CC_BASENAME([$compiler])
 
 # GCJ did not exist at the time GCC didn't implicitly link libc in.
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
@@ -5975,8 +5985,7 @@
 CC=${RC-"windres"}
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
-cc_basename=`$ECHO "X$compiler" \
-    | $Xsed -e 's%.*/%%;s%^[   ]*\([^  ]*\).*$%\1%'`
+_LT_CC_BASENAME([$compiler])
 _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
 
 if test -n "$compiler"; then
2005-04-15  Ralf Wildenhues  <[EMAIL PROTECTED]>

        * libtool.m4 (_LT_CC_BASENAME): New macro to figure out $cc_basename.
        Skip ccache, distcc, purify, cmdline options, `$host_alias-' prefix.
        (AC_LIBTOOL_SETUP, AC_LIBTOOL_LANG_CXX_CONFIG,
        AC_LIBTOOL_LANG_F77_CONFIG,  AC_LIBTOOL_LANG_GCJ_CONFIG,
        AC_LIBTOOL_LANG_RC_CONFIG, AC_LIBTOOL_PROG_LD_SHLIBS): Use.
        * NEWS: Update.

Index: NEWS
===================================================================
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.109.2.27
diff -u -r1.109.2.27 NEWS
--- NEWS        15 Mar 2005 14:51:57 -0000      1.109.2.27
+++ NEWS        15 Apr 2005 13:34:18 -0000
@@ -3,6 +3,7 @@
 New in 1.5.15a: 2005-??-??; CVS version 1.5.15a, Libtool team:
 * Allow shell special characters like `$' in source file names, but not
   in object names, to enhance GCJ support.
+* Detection of compiler wrappers like distcc/ccache and $host_alias prefix.
 * Bug Fixes.
 
 New in 1.5.14: 2005-02-12; CVS version 1.5.13a, Libtool team:
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v
retrieving revision 1.314.2.79
diff -u -r1.314.2.79 libtool.m4
--- libtool.m4  12 Apr 2005 17:29:33 -0000      1.314.2.79
+++ libtool.m4  15 Apr 2005 13:34:18 -0000
@@ -185,8 +185,7 @@
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
 
-cc_basename=`$echo "X$compiler" \
-     | $Xsed -e 's%.*/%%;s%^[  ]*\([^  ]*\).*$%\1%'`
+_LT_CC_BASENAME([$compiler])
 
 # Only perform the check for file, if the check method requires it
 case $deplibs_check_method in
@@ -233,6 +232,20 @@
 ])# _LT_AC_SYS_COMPILER
 
 
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    ccache | *[[\\/]]ccache | distcc | *[[\\/]]distcc | purify | 
*[[\\/]]purify | \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
 # _LT_AC_SYS_LIBPATH_AIX
 # ----------------------
 # Links a minimal program and checks the executable
@@ -2670,8 +2683,7 @@
 CC=${CXX-"c++"}
 compiler=$CC
 _LT_AC_TAGVAR(compiler, $1)=$CC
-cc_basename=`$echo "X$compiler" \
-     | $Xsed -e 's%.*/%%;s%^[  ]*\([^  ]*\).*$%\1%'`
+_LT_CC_BASENAME([$compiler])
 
 # We don't want -fno-exception wen compiling C++ code, so set the
 # no_builtin_flag separately
@@ -3736,8 +3748,7 @@
 CC=${F77-"f77"}
 compiler=$CC
 _LT_AC_TAGVAR(compiler, $1)=$CC
-cc_basename=`$echo "X$compiler" \
-     | $Xsed -e 's%.*/%%;s%^[  ]*\([^  ]*\).*$%\1%'`
+_LT_CC_BASENAME([$compiler])
 
 AC_MSG_CHECKING([if libtool supports shared libraries])
 AC_MSG_RESULT([$can_build_shared])
@@ -3817,8 +3828,7 @@
 CC=${GCJ-"gcj"}
 compiler=$CC
 _LT_AC_TAGVAR(compiler, $1)=$CC
-cc_basename=`$echo "X$compiler" \
-     | $Xsed -e 's%.*/%%;s%^[  ]*\([^  ]*\).*$%\1%'`
+_LT_CC_BASENAME([$compiler])
 
 # GCJ did not exist at the time GCC didn't implicitly link libc in.
 _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
@@ -3874,8 +3884,7 @@
 CC=${RC-"windres"}
 compiler=$CC
 _LT_AC_TAGVAR(compiler, $1)=$CC
-cc_basename=`$echo "X$compiler" \
-     | $Xsed -e 's%.*/%%;s%^[  ]*\([^  ]*\).*$%\1%'`
+_LT_CC_BASENAME([$compiler])
 _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
 
 AC_LIBTOOL_CONFIG($1)
@@ -5151,8 +5160,7 @@
   # preloaded symbol tables.
   extract_expsyms_cmds=
   # Just being paranoid about ensuring that cc_basename is set.
-  cc_basename=`$echo "X$compiler" \
-      | $Xsed -e 's%.*/%%;s%^[         ]*\([^  ]*\).*$%\1%'`
+  _LT_CC_BASENAME([$compiler])
   case $host_os in
   cygwin* | mingw* | pw32*)
     # FIXME: the MSVC++ port hasn't been tested in a loooong time

Reply via email to