diff options
author | Haru <haru@dotalux.com> | 2013-10-07 20:28:10 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-10-07 20:36:15 +0200 |
commit | 7af7a4c14ee2f8455fef66ad638d0954410dea4e (patch) | |
tree | 3ee468cd2a81a2d7fb3dbf05af76842a3c8b3876 /configure | |
parent | 95caa2458c92c04c479e0dce18aaeb1e8846c214 (diff) | |
download | hercules-7af7a4c14ee2f8455fef66ad638d0954410dea4e.tar.gz hercules-7af7a4c14ee2f8455fef66ad638d0954410dea4e.tar.bz2 hercules-7af7a4c14ee2f8455fef66ad638d0954410dea4e.tar.xz hercules-7af7a4c14ee2f8455fef66ad638d0954410dea4e.zip |
Ensured explicit check for undefined references on shared objects
- On certain platforms, shared objects will be built without linker
errors even if they have undefined references (but they'll fail to
load if those references can't be found at runtime).
- This resolves issues with plugins that on linux seem to compile, but
won't load (or will lead completely unpredictable results) because
they use symbols that may not exist. Special thanks to oss10110 for
bringing it up.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 138 |
1 files changed, 99 insertions, 39 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in c1dca64. +# From configure.in 95caa24. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -5003,6 +5003,7 @@ CFLAGS="$OLD_CFLAGS" $as_echo_n "checking how to make shared objects... " >&6; } OLD_CFLAGS="$CFLAGS" compiler_shared_objects="" +compiler_supports_shared_objects="no" if test "$compiler_supports_pic" = "yes" ; then my_shared_test_flags="$CFLAGS -fPIC" fi @@ -5022,6 +5023,7 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : compiler_shared_objects="-shared" + compiler_supports_shared_objects="yes" fi @@ -5043,12 +5045,12 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : compiler_shared_objects="-nostart" + compiler_supports_shared_objects="yes" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -my_shared_test_flags="" CFLAGS="$OLD_CFLAGS" if test "$compiler_supports_shared_objects" = "no" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5 @@ -5057,77 +5059,134 @@ $as_echo "not supported" >&6; } $as_echo "$as_me: compiler is unable to generate shared objects, disabled plugins (optional)" >&6;} WITH_PLUGINS="no" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $compiler_shared_objects" >&5 -$as_echo "$compiler_shared_objects" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $compiler_shared_objects $compiler_supports_shared_objects" >&5 +$as_echo "$compiler_shared_objects $compiler_supports_shared_objects" >&6; } SOFLAGS="$SOFLAGS $compiler_shared_objects" -# -# shared objects need position independent code; some platforms emit -# it always, others need -fPIC -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -fPIC for shared objects" >&5 + # + # On certain platforms, undefined references on shared libraries won't be checked + # unless explicitly required with the --no-undefined linker option + # + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -Wl,--no-undefined to check for undefined references in shared objects" >&5 +$as_echo_n "checking whether $CC needs -Wl,--no-undefined to check for undefined references in shared objects... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$SOFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + void foo(void) { + foobar(); + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + CFLAGS="$SOFLAGS -Wl,--no-undefined" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int bar = 0; + + int foo(void) { + return bar; + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SOFLAGS="$SOFLAGS -Wl,--no-undefined" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported (undefined references check will be ignored)" >&5 +$as_echo "unsupported (undefined references check will be ignored)" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$OLD_CFLAGS" + + # + # shared objects need position independent code; some platforms emit + # it always, others need -fPIC + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -fPIC for shared objects" >&5 $as_echo_n "checking whether $CC needs -fPIC for shared objects... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS $SOFLAGS" -WITH_PLUGINS="yes" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $SOFLAGS" + WITH_PLUGINS="yes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - int bar = 0; + int bar = 0; - int foo(void) - { - return bar; - } + int foo(void) + { + return bar; + } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" else - if test "$compiler_supports_pic" = "yes" ; then - # Verify if -shared really fails due to lack of -fPIC or something else - CFLAGS="$CFLAGS -fPIC" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$compiler_supports_pic" = "yes" ; then + # Verify if -shared really fails due to lack of -fPIC or something else + CFLAGS="$CFLAGS -fPIC" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - int bar = 0; + int bar = 0; - int foo(void) - { - return bar; - } + int foo(void) + { + return bar; + } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -fPIC" + CFLAGS="$OLD_CFLAGS -fPIC" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, but fails for another reason" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, but fails for another reason" >&5 $as_echo "no, but fails for another reason" >&6; } - as_fn_error $? "compiler is unable to compile shared objects for an unhandled reason, please report this with attached config.log... stopping" "$LINENO" 5 + as_fn_error $? "compiler is unable to compile shared objects for an unhandled reason, please report this with attached config.log... stopping" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - else - # Disable compilation of plugins (optional), so 'make all' does not fail - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, but unsupported" >&5 + else + # Disable compilation of plugins (optional), so 'make all' does not fail + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, but unsupported" >&5 $as_echo "yes, but unsupported" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: compiler is unable to generate position independent code, disabled plugins (optional)" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler is unable to generate position independent code, disabled plugins (optional)" >&5 $as_echo "$as_me: compiler is unable to generate position independent code, disabled plugins (optional)" >&6;} - WITH_PLUGINS="no" - fi + WITH_PLUGINS="no" + fi fi @@ -5135,6 +5194,7 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi +my_shared_test_flags="" |