libtool-patches
[Top][All Lists]
Advanced

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

Re: osf5.1 + cc + -pthread


From: Albert Chin
Subject: Re: osf5.1 + cc + -pthread
Date: Fri, 14 Jan 2005 12:28:02 -0600
User-agent: Mutt/1.5.6i

On Fri, Jan 14, 2005 at 04:20:08PM +0100, Ralf Wildenhues wrote:
> > Albert Chin wrote:
> > |
> > | Patch below. Unlike the previous patch, we don't exclude based on $LD
> > | but include based on $CC.
> > 
> > Albert's patch:
> > Index: ltmain.in
> > ===================================================================
> > RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
> > retrieving revision 1.334.2.42
> > diff -u -3 -p -r1.334.2.42 ltmain.in
> > - --- ltmain.in     9 Dec 2004 18:00:47 -0000       1.334.2.42
> > +++ ltmain.in       11 Dec 2004 22:19:00 -0000
> > @@ -1033,6 +1042,7 @@ EOF
> > ~     finalize_shlibpath=
> > ~     convenience=
> > ~     old_convenience=
> > +    add_to_deplibs=
> > ~     deplibs=
> > ~     old_deplibs=
> > ~     compiler_flags=
> > @@ -1498,7 +1508,7 @@ EOF
> > ~   ;;
> > 
> > ~      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
> > - - deplibs="$deplibs $arg"
> > +   add_to_deplibs="$add_to_deplibs $arg"
> > ~   continue
> > ~   ;;
> > 
> > @@ -1888,6 +1898,25 @@ EOF
> > ~     *) linkmode=prog ;; # Anything else should be a program.
> > ~     esac
> > 
> > +    # arguments we can add to $deplibs except when creating a
> > +    # libtool library where the compiler driver is different
> > +    # from the linker driver.
> > +    if test "X$add_to_deplibs" != "X"; then
> > +      if test "$linkmode" = "lib"; then
> > +   case "`eval $echo $archive_cmds`" in
> > +   "$CC"*)
> 
> I don't like the eval here.
> Can't we do like in the other patch and match against
>    *"\$CC"*
> ?  Note also the * before $CC because I see not reason
> to restrict ourselves unnecessarily to the beginning here.

Yep.

> > +     for deplib in $add_to_deplibs; do
> > +       deplibs="$deplibs $deplib"
> > +     done
> 
> I fail to see the difference of these three lines and
>   deplips="$deplibs $add_to_deplibs"
> other than whitespace normalization
> (which should be unnecessary in this case),
> plus the latter is much shorter.

Yep.

> > +     ;;
> > +   esac
> > +      else
> > +   for deplib in $add_to_deplibs; do
> > +    deplibs="$deplibs $deplib"
> > +   done
> 
> Same here.
> 
> > +      fi
> > +    fi
> > +
> > ~     case $host in
> > ~     *cygwin* | *mingw* | *pw32*)
> > ~       # don't eliminate duplications in $postdeps and $predeps
> 
> ...
>
> Other than that, after my proposed changes:
> - both patches have around the same size,
> - I like the "inclusion because of $CC" argument
> - but Albert's patch messes up the order of the arguments.
>   IIRC that's done anyway, right?

Yes, we mess up the argument order. However, it doesn't matter for
what we're doing. And, libtool has bigger problems wrt preserving the
original argument ordering.

Updated patch below. The reason I came up with add_to_deplibs is so we
could use it elsewhere in the command-line parsing. However, I've yet
to see another case where it would be applicable.

Either of the patches is ok by me. I just feel safer with the
"inclusion because of $CC" argument.

-- 
albert chin (address@hidden)

-- snip snip
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.46
diff -u -3 -p -r1.334.2.46 ltmain.in
--- ltmain.in   28 Dec 2004 12:53:35 -0000      1.334.2.46
+++ ltmain.in   14 Jan 2005 18:23:21 -0000
@@ -1045,6 +1086,7 @@ EOF
     finalize_shlibpath=
     convenience=
     old_convenience=
+    add_to_deplibs=
     deplibs=
     old_deplibs=
     compiler_flags=
@@ -1510,7 +1552,7 @@ EOF
        ;;
 
      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
-       deplibs="$deplibs $arg"
+       add_to_deplibs="$add_to_deplibs $arg"
        continue
        ;;
 
@@ -1900,6 +1942,21 @@ EOF
     *) linkmode=prog ;; # Anything else should be a program.
     esac
 
+    # arguments we can add to $deplibs except when creating a
+    # libtool library where the compiler driver is different
+    # from the linker driver.
+    if test "X$add_to_deplibs" != "X"; then
+      if test "$linkmode" = "lib"; then
+       case "$archive_cmds" in
+       *"\$CC"*)
+         deplibs="$deplibs $add_to_deplibs"
+         ;;
+       esac
+      else
+        deplibs="$deplibs $add_to_deplibs"
+      fi
+    fi
+
     case $host in
     *cygwin* | *mingw* | *pw32*)
       # don't eliminate duplications in $postdeps and $predeps




reply via email to

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