Hi Richard,

* Richard Purdie wrote on Tue, Apr 22, 2008 at 12:29:50PM CEST:
> 
> I've noticed another problem with two packages in poky, prelink and
> libvorbis. Both packages have areas where LDFLAGS="-all-static" is used.
> 
> The problem comes about since Poky sets CC to "ccache gcc", then libtool
> puts the -static flag between ccache and gcc.

Thanks for the bug report, and especially for providing an example to
reproduce it!

> libtool: link: ccache -static gcc -O20 -ffast-math -D_REENTRANT -fsigned-char 
> -DUSE_MEMORY_H -o decoder_example decoder_example.o  ../lib/.libs/libvorbis.a 
> -lm /usr/lib/libogg.a

Confirmed.  Fixed as below, committed, put you in THANKS.

Cheers,
Ralf

2008-04-22  Ralf Wildenhues  <[EMAIL PROTECTED]>

        Fix regression over 1.5.26 with ccache $CC -all-static.
        * libltdl/config/ltmain.m4sh (func_mode_link): Add
        $link_static_flag to compile_command and link_command only
        later, instead of right after a possible compiler wrapper.
        * tests/static.at (ccache -all-static): New test.
        * THANKS: Update.
        Report by Richard Purdie.

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index ff1e50d..ac334dc 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -3160,9 +3160,6 @@ func_mode_link ()
          fi
          if test -n "$link_static_flag"; then
            dlopen_self=$dlopen_self_static
-           # See comment for -static flag below, for more details.
-           func_append compile_command " $link_static_flag"
-           func_append finalize_command " $link_static_flag"
          fi
          prefer_static_libs=yes
          ;;
@@ -3450,7 +3447,11 @@ func_mode_link ()
 
       case $arg in
       -all-static)
-       # The effects of -all-static are defined in a previous loop.
+       if test -n "$link_static_flag"; then
+         # See comment for -static flag below, for more details.
+         func_append compile_command " $link_static_flag"
+         func_append finalize_command " $link_static_flag"
+       fi
        continue
        ;;
 
diff --git a/tests/static.at b/tests/static.at
index 74b1c63..1a51d0d 100644
--- a/tests/static.at
+++ b/tests/static.at
@@ -352,3 +352,26 @@ for withdep in no yes; do
 done
 
 AT_CLEANUP
+
+
+AT_SETUP([ccache -all-static])
+
+AT_DATA([ccache],
+[[#! /bin/sh
+# poor man's ccache clone
+case $1 in
+-*) echo "bogus argument: $1" >&2; exit 1 ;;
+esac
+exec "$@"
+]])
+chmod +x ./ccache
+
+AT_DATA([a.c],
+[[int main(void) { return 0; }
+]])
+
+AT_CHECK([$CC $CPPFLAGS $CFLAGS -c a.c], [], [ignore])
+AT_CHECK([$LIBTOOL --mode=link --tag=CC ./ccache $CC $CFLAGS $LDFLAGS 
-all-static a.$OBJEXT -o a],
+        [], [ignore])
+
+AT_CLEANUP


Reply via email to