summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in121
1 files changed, 81 insertions, 40 deletions
diff --git a/configure.in b/configure.in
index d9353f51c..486390eaa 100644
--- a/configure.in
+++ b/configure.in
@@ -550,6 +550,7 @@ CFLAGS="$OLD_CFLAGS"
AC_MSG_CHECKING([how to make shared objects])
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
@@ -566,6 +567,7 @@ AC_LINK_IFELSE(
])],
[
compiler_shared_objects="-shared"
+ compiler_supports_shared_objects="yes"
]
)
# BeOS specific
@@ -581,72 +583,111 @@ AC_LINK_IFELSE(
])],
[
compiler_shared_objects="-nostart"
+ compiler_supports_shared_objects="yes"
]
)
-my_shared_test_flags=""
CFLAGS="$OLD_CFLAGS"
if test "$compiler_supports_shared_objects" = "no" ; then
AC_MSG_RESULT([not supported])
AC_MSG_NOTICE([compiler is unable to generate shared objects, disabled plugins (optional)])
WITH_PLUGINS="no"
else
- AC_MSG_RESULT([$compiler_shared_objects])
+ AC_MSG_RESULT([$compiler_shared_objects $compiler_supports_shared_objects])
SOFLAGS="$SOFLAGS $compiler_shared_objects"
AC_SUBST([SOFLAGS])
-#
-# shared objects need position independent code; some platforms emit
-# it always, others need -fPIC
-#
-AC_MSG_CHECKING([whether $CC needs -fPIC for shared objects])
-OLD_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $SOFLAGS"
-WITH_PLUGINS="yes"
-AC_LINK_IFELSE(
- [AC_LANG_SOURCE([
- int bar = 0;
-
- int foo(void)
- {
- return bar;
- }
- ])],
- [
- AC_MSG_RESULT([no])
- CFLAGS="$OLD_CFLAGS"
- ],
- [
- if test "$compiler_supports_pic" = "yes" ; then
- # Verify if -shared really fails due to lack of -fPIC or something else
- CFLAGS="$CFLAGS -fPIC"
+ #
+ # On certain platforms, undefined references on shared libraries won't be checked
+ # unless explicitly required with the --no-undefined linker option
+ #
+ AC_MSG_CHECKING([whether $CC needs -Wl,--no-undefined to check for undefined references in shared objects])
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$SOFLAGS"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
+ void foo(void) {
+ foobar();
+ }
+ ])],
+ [
+ CFLAGS="$SOFLAGS -Wl,--no-undefined"
AC_LINK_IFELSE(
[AC_LANG_SOURCE([
int bar = 0;
- int foo(void)
- {
+ int foo(void) {
return bar;
}
])],
[
AC_MSG_RESULT([yes])
- CFLAGS="$OLD_CFLAGS -fPIC"
+ SOFLAGS="$SOFLAGS -Wl,--no-undefined"
],
[
- AC_MSG_RESULT([no, but fails for another reason])
- AC_MSG_ERROR([compiler is unable to compile shared objects for an unhandled reason, please report this with attached config.log... stopping])
+ AC_MSG_RESULT([unsupported (undefined references check will be ignored)])
]
)
- else
- # Disable compilation of plugins (optional), so 'make all' does not fail
- AC_MSG_RESULT([yes, but unsupported])
- AC_MSG_NOTICE([compiler is unable to generate position independent code, disabled plugins (optional)])
- WITH_PLUGINS="no"
- fi
- ]
-)
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ]
+ )
+ CFLAGS="$OLD_CFLAGS"
+
+ #
+ # shared objects need position independent code; some platforms emit
+ # it always, others need -fPIC
+ #
+ AC_MSG_CHECKING([whether $CC needs -fPIC for shared objects])
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $SOFLAGS"
+ WITH_PLUGINS="yes"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
+ int bar = 0;
+
+ int foo(void)
+ {
+ return bar;
+ }
+ ])],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ],
+ [
+ if test "$compiler_supports_pic" = "yes" ; then
+ # Verify if -shared really fails due to lack of -fPIC or something else
+ CFLAGS="$CFLAGS -fPIC"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
+ int bar = 0;
+
+ int foo(void)
+ {
+ return bar;
+ }
+ ])],
+ [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$OLD_CFLAGS -fPIC"
+ ],
+ [
+ AC_MSG_RESULT([no, but fails for another reason])
+ AC_MSG_ERROR([compiler is unable to compile shared objects for an unhandled reason, please report this with attached config.log... stopping])
+ ]
+ )
+ else
+ # Disable compilation of plugins (optional), so 'make all' does not fail
+ AC_MSG_RESULT([yes, but unsupported])
+ AC_MSG_NOTICE([compiler is unable to generate position independent code, disabled plugins (optional)])
+ WITH_PLUGINS="no"
+ fi
+ ]
+ )
fi
+my_shared_test_flags=""
AC_SUBST([WITH_PLUGINS])