diff options
author | Björn Jacke <bj@sernet.de> | 2010-07-20 13:39:59 +0200 |
---|---|---|
committer | Björn Jacke <bj@sernet.de> | 2010-07-20 13:46:42 +0200 |
commit | 2a8399f7ce676e7e4fa70e8f8f04ba2876350695 (patch) | |
tree | 68956deae5be7304803f48dddfda163619647138 /source3/configure.in | |
parent | 09944302a195a3571dde29e3f77134a7542e1077 (diff) | |
download | samba-2a8399f7ce676e7e4fa70e8f8f04ba2876350695.tar.gz samba-2a8399f7ce676e7e4fa70e8f8f04ba2876350695.tar.xz samba-2a8399f7ce676e7e4fa70e8f8f04ba2876350695.zip |
s3: check for explicit external lib bug in ld's as-needed code
Second part of fix for bug #7561
Based on test provided by Olaf Flebbe.
Diffstat (limited to 'source3/configure.in')
-rw-r--r-- | source3/configure.in | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source3/configure.in b/source3/configure.in index 058283a4e1e..541dbe9e276 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -1818,6 +1818,40 @@ if test "x$enable_as_needed" != xno; then done fi +if test x$ld_as_needed_flag_found = xyes ; then +# check if ld has bug described in https://bugzilla.samba.org/show_bug.cgi?id=7209#c17 + AC_MSG_CHECKING([if $LD_AS_NEEDED_FLAG has explicit external libs bug]) +cat > conftest_shb.c <<END +void b() {} +END +cat > conftest_sha.c <<END +extern void b(); +void a() { + b(); +} +END +cat > conftest.c <<END +extern void a(); +int main() { + a(); +} +END + + AC_TRY_COMMAND([$CC $CPPFLAGS $CFLAGS $PICFLAG -c -o conftest_sha.o conftest_sha.c 1>&AS_MESSAGE_LOG_FD 2>&1]) + AC_TRY_COMMAND([$CC $CPPFLAGS $CFLAGS $PICFLAG -c -o conftest_shb.o conftest_shb.c 1>&AS_MESSAGE_LOG_FD 2>&1]) + TESTCMD="`eval echo \"$SHLD $LDSHFLAGS $PICFLAG\"`" + AC_TRY_COMMAND([$TESTCMD -o libconftest_shb.$SHLIBEXT conftest_shb.o 1>&AS_MESSAGE_LOG_FD 2>&1]) + AC_TRY_COMMAND([$TESTCMD -o libconftest_sha.$SHLIBEXT conftest_sha.o 1>&AS_MESSAGE_LOG_FD 2>&1]) + if AC_TRY_COMMAND([$CC -o conftest conftest.c $LDFLAGS -L. -lconftest_sha -lconftest_shb 1>&AS_MESSAGE_LOG_FD 2>&1]) + then + AC_MSG_RESULT([no]) + else + ld_as_needed_flag_found=no + LDFLAGS="$saved_before_as_needed_ldflags" + AC_MSG_RESULT([yes]) + fi + rm conftest* libconftest* +fi # check if we have to disable LD_AS_NEEDED_FLAG: # On some systems for a veriety of reasons linking with |