[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: linking a shared library with -pthread omits -pthread on the link l
From: |
Albert Chin |
Subject: |
Re: linking a shared library with -pthread omits -pthread on the link line. |
Date: |
Sat, 14 Dec 2002 14:50:09 -0600 |
User-agent: |
Mutt/1.4i |
On Sat, Dec 14, 2002 at 05:26:22PM -0000, Max Bowsher wrote:
> Howard Chu <address@hidden> wrote:
>
> >> I'm trying to use CC="gcc -mno-cygwin" CXX="gcc -mno-cygwin",
> >> obviously
> >> expecting that the -mno-cygwin is appended to *every*
> >> invocation of gcc.
> >> Now, this works for CXX (The variable CC in the tagged config
> >> CXX gets the
> >> value from the environment. In addition, LTCC gets the value
> >> of CC from the
> >> environment in every tag. *But* CC in the untagged C config drops
> >> the -mno-cygwin.
> >>
> >> I kludged it by doing this to libtool.m4:
> >> @@ -2295,6 +2296,9 @@
> >>
> >> _LT_AC_SYS_COMPILER
> >>
> >> +# Allow CC to be a program name with arguments.
> >> +_LT_AC_TAGVAR(compiler, $1)="$CC"
> >> +
> >> #
> >> # Check for any special shared library compilation flags.
> >> #
> >>
> >> But that was more by random guess than a through understanding of the
> >> implications of my change.
> >
> > This is also something we reported 2 or 3 years ago and finally gave
> > up on. We went with suggesting that people just create a wrapper
> > shell script for gcc that carries the correct options:
> >
> > http://www.openldap.org/faq/data/cache/301.html
> >
> > At the bottom of the page...
> > ( mgcc:
> > #! /bin/sh
> > gcc -mno-cygwin $*
> > )
>
> Wait a minute! It *works* for CXX, so why can't it be made to work for CC as
> well?
Because it's different! Actually, it works for everything *except* the
C tag. The reason is because we do this:
set dummy $CC
compiler=$2
Obviously, if CC="gcc -mno-cygwin", then $2=gcc. The correct solution
is:
set dummy "$CC"
compiler=$2
Now, all non-C tags do:
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_AC_SYS_COMPILER
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
CC=${CXX-"c++"}
set dummy $CC
compiler="[$]2"
_LT_AC_TAGVAR(compiler, $1)=$CC
cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
The reason it works for non-C tags is the overriding of $compiler
with:
_LT_AC_TAGVAR(compiler, $1)=$CC
What's the advantage of:
set dummy "$CC"
compiler=$2
to:
compiler=$CC
The latter is essentially what the non-C tags are doing. So, I
recommend the patch below.
--
albert chin (address@hidden)
-- snip snip
2002-12-14 Albert Chin-A-Young (address@hidden)
* libtool.m4: Correctly set $CC in libtool. Previously
used:
set dummy $CC
compiler="[$]2"
but if CC contains a program name with arguments, then
CC will be the program name only. Rather than:
set dummy "$CC"
compiler="[$]2"
we just:
compiler=$CC
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.280
diff -u -3 -p -r1.280 libtool.m4
--- libtool.m4 11 Dec 2002 19:44:59 -0000 1.280
+++ libtool.m4 14 Dec 2002 20:10:30 -0000
@@ -241,8 +241,7 @@ AC_DEFUN([_LT_AC_SYS_COMPILER],
LTCC=${LTCC-"$CC"}
# Allow CC to be a program name with arguments.
-set dummy $CC
-compiler="[$]2"
+compiler=$CC
])# _LT_AC_SYS_COMPILER
@@ -2507,8 +2526,7 @@ _LT_AC_SYS_COMPILER
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
CC=${CXX-"c++"}
-set dummy $CC
-compiler="[$]2"
+compiler=$CC
_LT_AC_TAGVAR(compiler, $1)=$CC
cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
@@ -3399,8 +3451,7 @@ _LT_AC_SYS_COMPILER
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
CC=${F77-"f77"}
-set dummy $CC
-compiler="[$]2"
+compiler=$CC
_LT_AC_TAGVAR(compiler, $1)=$CC
cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
@@ -3479,8 +3530,7 @@ _LT_AC_SYS_COMPILER
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
CC=${GCJ-"gcj"}
-set dummy $CC
-compiler="[$]2"
+compiler=$CC
_LT_AC_TAGVAR(compiler, $1)=$CC
# GCJ did not exist at the time GCC didn't implicitly link libc in.
@@ -3535,8 +3585,7 @@ _LT_AC_SYS_COMPILER
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
CC=${RC-"windres"}
-set dummy $CC
-compiler="[$]2"
+compiler=$CC
_LT_AC_TAGVAR(compiler, $1)=$CC
_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
- linking a shared library with -pthread omits -pthread on the link line., Sebastian Wilhelmi, 2002/12/10
- Re: linking a shared library with -pthread omits -pthread on the link line., Albert Chin, 2002/12/13
- Re: linking a shared library with -pthread omits -pthread on the link line., Bob Friesenhahn, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Albert Chin, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Max Bowsher, 2002/12/14
- RE: linking a shared library with -pthread omits -pthread on the link line., Howard Chu, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Max Bowsher, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line.,
Albert Chin <=
- Re: linking a shared library with -pthread omits -pthread on the link line., Ossama Othman, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Albert Chin, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Bob Friesenhahn, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Albert Chin, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Bob Friesenhahn, 2002/12/15
- Re: linking a shared library with -pthread omits -pthread on the link line., Albert Chin, 2002/12/15
- Re: linking a shared library with -pthread omits -pthread on the link line., Max Bowsher, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Bob Friesenhahn, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Bob Friesenhahn, 2002/12/14
- Re: linking a shared library with -pthread omits -pthread on the link line., Albert Chin, 2002/12/14