summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-08-13 02:26:29 +0200
committerHaru <haru@dotalux.com>2015-08-15 00:51:38 +0200
commit747d3b7d5c6056470b1c9d3f41e09e0ed92af6d6 (patch)
treeec45417b86dc54dcdbdfa75cb9be38af3621114c /configure.in
parent6795414243a08d47bc111e23c9c0f09218260ccf (diff)
downloadhercules-747d3b7d5c6056470b1c9d3f41e09e0ed92af6d6.tar.gz
hercules-747d3b7d5c6056470b1c9d3f41e09e0ed92af6d6.tar.bz2
hercules-747d3b7d5c6056470b1c9d3f41e09e0ed92af6d6.tar.xz
hercules-747d3b7d5c6056470b1c9d3f41e09e0ed92af6d6.zip
Improved plugin compile flag detection by the configuration script
- This fixes plugin compilation on FreeBSD and Debian failing due to a missing -fPIC, in combination with some upcoming changes. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in63
1 files changed, 4 insertions, 59 deletions
diff --git a/configure.in b/configure.in
index 9beefb246..2f859e3ac 100644
--- a/configure.in
+++ b/configure.in
@@ -832,11 +832,10 @@ AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([int foo;])],
[
AC_MSG_RESULT([yes])
- compiler_supports_pic="yes"
+ SOFLAGS="$SOFLAGS -fPIC"
],
[
AC_MSG_RESULT([no])
- compiler_supports_pic="no"
]
)
CFLAGS="$OLD_CFLAGS"
@@ -848,9 +847,7 @@ 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
+my_shared_test_flags="$CFLAGS $SOFLAGS"
# default
CFLAGS="$my_shared_test_flags -shared"
AC_LINK_IFELSE(
@@ -891,7 +888,7 @@ if test "$compiler_supports_shared_objects" = "no" ; then
else
AC_MSG_RESULT([$compiler_shared_objects $compiler_supports_shared_objects])
SOFLAGS="$SOFLAGS $compiler_shared_objects"
- AC_SUBST([SOFLAGS])
+ WITH_PLUGINS="yes"
#
# On certain platforms, undefined references on shared libraries won't be checked
@@ -930,62 +927,10 @@ else
]
)
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])
+AC_SUBST([SOFLAGS])
#