mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-01-18 14:16:00 +08:00
Use darwin's -force_load flag if available for whole_archive_flag_spec
* libltdl/m4/libtool.m4 (_LT_REQUIRED_DARWIN_CHECKS): Check for -force_load and use it if there. * tests/darwin.at: Add a simple test.
This commit is contained in:
parent
2eb8c3e51f
commit
4ad8b63bd1
@ -1,3 +1,10 @@
|
||||
2009-09-07 Peter O'Gorman <peter@pogma.com
|
||||
|
||||
Use darwin's -force_load flag if available for whole_archive_flag_spec
|
||||
* libltdl/m4/libtool.m4 (_LT_REQUIRED_DARWIN_CHECKS): Check for
|
||||
-force_load and use it if there.
|
||||
* tests/darwin.at: Add a simple test.
|
||||
|
||||
2009-09-06 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
Testsuite keyword 'interactive' and check-* rules.
|
||||
|
31
libltdl/m4/libtool.m4
vendored
31
libltdl/m4/libtool.m4
vendored
@ -971,6 +971,29 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
|
||||
[lt_cv_ld_exported_symbols_list=no])
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
])
|
||||
AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
|
||||
[lt_cv_ld_force_load=no
|
||||
cat > conftest.c << _LT_EOF
|
||||
int forced_loaded() { return 2;}
|
||||
_LT_EOF
|
||||
echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
|
||||
$LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
|
||||
echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
|
||||
$AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
|
||||
cat > conftest.c << _LT_EOF
|
||||
int main() { return 0;}
|
||||
_LT_EOF
|
||||
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
|
||||
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
|
||||
_lt_result=$?
|
||||
if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
|
||||
lt_cv_ld_force_load=yes
|
||||
else
|
||||
cat conftest.err >&AS_MESSAGE_LOG_FD
|
||||
fi
|
||||
rm -f conftest.err conftest.a conftest conftest.c
|
||||
rm -rf conftest.dSYM
|
||||
])
|
||||
case $host_os in
|
||||
rhapsody* | darwin1.[[012]])
|
||||
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
|
||||
@ -998,7 +1021,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
|
||||
else
|
||||
_lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
|
||||
fi
|
||||
if test "$DSYMUTIL" != ":"; then
|
||||
if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
|
||||
_lt_dsymutil='~$DSYMUTIL $lib || :'
|
||||
else
|
||||
_lt_dsymutil=
|
||||
@ -1018,7 +1041,11 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
|
||||
_LT_TAGVAR(hardcode_direct, $1)=no
|
||||
_LT_TAGVAR(hardcode_automatic, $1)=yes
|
||||
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
|
||||
_LT_TAGVAR(whole_archive_flag_spec, $1)=''
|
||||
if test "$lt_cv_ld_force_load" = "yes"; then
|
||||
_LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
|
||||
else
|
||||
_LT_TAGVAR(whole_archive_flag_spec, $1)=''
|
||||
fi
|
||||
_LT_TAGVAR(link_all_deplibs, $1)=yes
|
||||
_LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
|
||||
case $cc_basename in
|
||||
|
@ -148,3 +148,59 @@ AT_CHECK([$LIBTOOL --dry-run --mode=link $CC $CFLAGS $LDFLAGS ]dnl
|
||||
AT_CHECK([grep stamp $lockfile], [], [ignore])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([darwin gdb debug information])
|
||||
|
||||
AT_CHECK([gdb --version || (exit 77)],[ignore],[ignore],[ignore])
|
||||
|
||||
AT_DATA([foo.c], [[
|
||||
int foo (void) { return 0; }
|
||||
]])
|
||||
|
||||
AT_DATA([bar.c], [[
|
||||
extern int foo (void);
|
||||
int bar (void) { return foo (); }
|
||||
]])
|
||||
|
||||
AT_DATA([main.c], [[
|
||||
extern int bar(void);
|
||||
|
||||
int main() { return bar();}
|
||||
]])
|
||||
|
||||
AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c bar.c],
|
||||
[], [ignore], [ignore])
|
||||
AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c foo.c],
|
||||
[], [ignore], [ignore])
|
||||
AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c main.c],
|
||||
[], [ignore], [ignore])
|
||||
|
||||
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libfoo.la foo.lo],
|
||||
[], [ignore], [ignore])
|
||||
|
||||
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS ]dnl
|
||||
[ -o libbar.la bar.lo -rpath /foo libfoo.la ],
|
||||
[], [ignore], [ignore])
|
||||
|
||||
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS ]dnl
|
||||
[ -o main main.lo libbar.la],[], [ignore], [ignore])
|
||||
AT_CHECK([echo quit | $LIBTOOL --mode=execute gdb main 2>err1],
|
||||
[ignore], [ignore], [stderr])
|
||||
|
||||
AT_CHECK([grep 'Could not find object file' stderr],[1],[ignore],[ignore])
|
||||
|
||||
AT_XFAIL_IF([
|
||||
eval "`$LIBTOOL --config | $EGREP '^(whole_archive_flag_spec)='`"
|
||||
case $whole_archive_flag_spec:$host_os in
|
||||
:darwin*) : ;;
|
||||
*) false ;;
|
||||
esac ])
|
||||
|
||||
# Remove any dSYM bundle
|
||||
rm -rf .libs/*.dSYM
|
||||
|
||||
AT_CHECK([echo quit | $LIBTOOL --mode=execute gdb main],
|
||||
[ignore], [ignore], [stderr])
|
||||
AT_CHECK([grep 'Could not find object file' stderr],[1],[ignore],[ignore])
|
||||
|
||||
AT_CLEANUP
|
||||
|
Loading…
Reference in New Issue
Block a user