summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-08-13 02:26:29 +0200
committerHaru <haru@dotalux.com>2015-08-13 16:27:30 +0200
commitc116380dee8f0c65fa5d31fbd184c5aa6367ae55 (patch)
tree14b008af20f50bd2660870fb7eafcc3f335e46e7
parent1dd61c6732394219fdbe9abed2af5c785a0309b0 (diff)
downloadhercules-c116380dee8f0c65fa5d31fbd184c5aa6367ae55.tar.gz
hercules-c116380dee8f0c65fa5d31fbd184c5aa6367ae55.tar.bz2
hercules-c116380dee8f0c65fa5d31fbd184c5aa6367ae55.tar.xz
hercules-c116380dee8f0c65fa5d31fbd184c5aa6367ae55.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>
-rwxr-xr-xconfigure87
-rw-r--r--configure.in63
2 files changed, 10 insertions, 140 deletions
diff --git a/configure b/configure
index 2500494c9..78b1b46ea 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in 08e100e.
+# From configure.in c5ff5bc.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -636,8 +636,8 @@ MYSQL_VERSION
HAVE_MYSQL
MYSQL_CONFIG_HOME
DLLEXT
-WITH_PLUGINS
SOFLAGS
+WITH_PLUGINS
AR
SET_MAKE
EGREP
@@ -6820,13 +6820,12 @@ if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- compiler_supports_pic="yes"
+ SOFLAGS="$SOFLAGS -fPIC"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- compiler_supports_pic="no"
fi
@@ -6841,9 +6840,7 @@ $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
+my_shared_test_flags="$CFLAGS $SOFLAGS"
# default
CFLAGS="$my_shared_test_flags -shared"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -6899,7 +6896,7 @@ else
{ $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"
-
+ WITH_PLUGINS="yes"
#
# On certain platforms, undefined references on shared libraries won't be checked
@@ -6956,84 +6953,12 @@ 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
-/* 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: no" >&5
-$as_echo "no" >&6; }
- 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
-/* 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; }
- CFLAGS="$OLD_CFLAGS -fPIC"
-
-else
-
- { $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
-
-
-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
-$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: compiler is unable to generate position independent code, disabled plugins (optional)" >&6;}
- WITH_PLUGINS="no"
- fi
-
-
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-
fi
my_shared_test_flags=""
+
#
# -O2 implies -fstrict-aliasing, but the code is not safe for that
#
diff --git a/configure.in b/configure.in
index 8567c6bcb..1bcdf5625 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])
#