summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorjaBote <j@bot.e>2013-05-03 01:45:50 +0200
committerjaBote <j@bot.e>2013-05-03 01:45:50 +0200
commit1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b (patch)
treec8825cc2dc141d91fe1fcc52739a0e79a89c80e9 /configure.in
parentf41dea469a52213acfde4f4ea5e8d7bbbd869bed (diff)
parent274bfc3b06616ea03c467d8eed23fae61c72fe18 (diff)
downloadhercules-1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b.tar.gz
hercules-1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b.tar.bz2
hercules-1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b.tar.xz
hercules-1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in106
1 files changed, 105 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index 5444be663..f52fcf00b 100644
--- a/configure.in
+++ b/configure.in
@@ -8,7 +8,7 @@ AC_CONFIG_SRCDIR([src/common/cbasetypes.h])
AC_CONFIG_FILES([Makefile src/common/Makefile])
AC_CONFIG_FILES([3rdparty/mt19937ar/Makefile 3rdparty/libconfig/Makefile])
AC_CONFIG_FILES([src/char/Makefile src/login/Makefile])
-AC_CONFIG_FILES([src/map/Makefile src/tool/Makefile])
+AC_CONFIG_FILES([src/map/Makefile src/plugins/Makefile src/tool/Makefile])
AC_CONFIG_FILES([src/test/Makefile])
AC_GNU_SOURCE
@@ -521,6 +521,110 @@ AC_COMPILE_IFELSE(
)
CFLAGS="$OLD_CFLAGS"
+#
+# option for shared objects
+#
+AC_MSG_CHECKING([how to make shared objects])
+OLD_CFLAGS="$CFLAGS"
+compiler_shared_objects=""
+if test "$compiler_supports_pic" = "yes" ; then
+ my_shared_test_flags="$CFLAGS -fPIC"
+fi
+# default
+CFLAGS="$my_shared_test_flags -shared"
+AC_LINK_IFELSE(
+ [[
+ int bar = 0;
+
+ int foo(void)
+ {
+ return bar;
+ }
+ ]],
+ [
+ compiler_shared_objects="-shared"
+ ]
+)
+# BeOS specific
+CFLAGS="$my_shared_test_flags -nostart"
+AC_LINK_IFELSE(
+ [[
+ int bar = 0;
+
+ int foo(void)
+ {
+ return bar;
+ }
+ ]],
+ [
+ compiler_shared_objects="-nostart"
+ ]
+)
+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])
+ SOFLAGS="$SOFLAGS $compiler_shared_objects"
+
+#
+# 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(
+ [[
+ 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(
+ [[
+ 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
+AC_SUBST([WITH_PLUGINS])
+
#
# -O2 implies -fstrict-aliasing, but the code is not safe for that