[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cc_basename: support distcc/ccache and cross-compilers better
From: |
Ralf Wildenhues |
Subject: |
cc_basename: support distcc/ccache and cross-compilers better |
Date: |
Thu, 7 Apr 2005 12:40:30 +0200 |
User-agent: |
Mutt/1.4.1i |
Libtool does fine when the user installs distcc or ccache so they are
symlinked as the respective compiler name. Like
/usr/local/bin/g++ -> path/to/distcc
(distcc knows about the path to the real compiler if configured like
this).
But when a libtoolized package is configured as
configure CC='distcc xlc' ..
Libtool's tests break down[1]. Our special with_gcc test saves all people
with gcc, but in general we need to detect cc_basename better.
The biggest problem is again detection of distcc/ccache specific flags
which have options.
As another point, we might want to remove `$host_alias-' from the
beginning of $cc_basename, to enable more reliable detection of non-gcc
cross toolchains. (Note we don't need to allow leading `-' anyway, so
the sed stripping is ok in the trivial case.) This saves us from
mistaking a $host_alias- prefix as a proper compiler name. I don't know
of existing name clashes, but as host aliases bear no standardization
whatsoever, it seems a good bet to me.
To clean up, all cc_basename calculations sould be moved to a common
place. Even if the named tools don't work for all tags[2], this setup
seems quite safe to me.
So, how do you like this patch (against HEAD)? Planning to backport to
all branches.
Regards,
Ralf
[1] Not too sure how useful such a configuration is, speedwise, in the
first place. Work on efficiency is orthogonal to this question.
[2] I actually don't know whether distcc/ccache work for e.g. java,
or with all kinds of compilers.
* m4/libtool.m4 (_LT_CC_BASENAME): New macro to figure out
$cc_basename. Skip ccache, distcc, command line options,
and `$host_alias-' prefix.
(_LT_SETUP, _LT_LANG_CXX_CONFIG, _LT_LANG_F77_CONFIG,
_LT_LANG_GCJ_CONFIG, _LT_LANG_RC_CONFIG): Use.
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.179
diff -u -r1.179 libtool.m4
--- m4/libtool.m4 7 Apr 2005 06:29:55 -0000 1.179
+++ m4/libtool.m4 7 Apr 2005 09:34:54 -0000
@@ -89,6 +89,18 @@
dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+# _LT_CC_BASENAME
+# ---------------
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1; do
+ case $cc_temp in
+ ccache | *[[\\/]]ccache | distcc | *[[\\/]]distcc | \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "X$cc_temp" \
+ | $Xsed -e 's%.*/%%;s%^[ ]*\([^ ]*\).*$%\1%' -e "s%^$host_alias-%%"`
+])
# _LT_SETUP
# ---------
@@ -193,8 +205,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
@@ -4700,8 +4711,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
@@ -5804,8 +5814,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])
@@ -5893,8 +5902,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
@@ -5951,8 +5959,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
- cc_basename: support distcc/ccache and cross-compilers better,
Ralf Wildenhues <=