summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-05-02 17:14:01 -0300
committershennetsind <ind@henn.et>2013-05-02 17:14:01 -0300
commita2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d (patch)
tree710a44f94cceff2f0198211d21ddfbe99b66f02c /configure.in
parent219a4f5267b33349649f952266532a132a48c2a3 (diff)
downloadhercules-a2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d.tar.gz
hercules-a2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d.tar.bz2
hercules-a2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d.tar.xz
hercules-a2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d.zip
Introducing Hercules Plugin Mananger
http://hercules.ws/board/topic/549-introducing-hercules-plugin-manager/ Signed-off-by: shennetsind <ind@henn.et>
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