summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-03-20 11:09:57 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-03-20 11:09:57 +0000
commita1542fae523a304cb0d67c2b29b9a31703487628 (patch)
treedd6853cb3c15dd51c37c60cf040da376a28ffe9a
parent80ea72ef5feaca9c9b0368ad3f65e527ce653165 (diff)
downloadhercules-a1542fae523a304cb0d67c2b29b9a31703487628.tar.gz
hercules-a1542fae523a304cb0d67c2b29b9a31703487628.tar.bz2
hercules-a1542fae523a304cb0d67c2b29b9a31703487628.tar.xz
hercules-a1542fae523a304cb0d67c2b29b9a31703487628.zip
* Updates the to configure script.
- Added check, whether or not '-Wno-pointer-sign' can actually be used (caused warnings with g++). - Math library is no longer considered required, when math functions are available without it (made configure fail on platforms, where no separate math library is present). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14749 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt4
-rwxr-xr-xconfigure135
-rw-r--r--configure.in21
3 files changed, 141 insertions, 19 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 7cbdfd9f4..6d7f77baa 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,5 +1,9 @@
Date Added
+2011/03/20
+ * Updates the to configure script. [Ai4rei]
+ - Added check, whether or not '-Wno-pointer-sign' can actually be used (caused warnings with g++).
+ - Math library is no longer considered required, when math functions are available without it (made configure fail on platforms, where no separate math library is present).
2011/03/19
* Removed leftovers of old charcommand config (follow-up to r13403). [Gepard]
* Added check to ensure character `rename` status will be saved if changed. [Gepard]
diff --git a/configure b/configure
index 0412b30eb..5da692cf7 100755
--- a/configure
+++ b/configure
@@ -3196,8 +3196,57 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- echo "$as_me:$LINENO: result: yes" >&5
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ echo "$as_me:$LINENO: checking whether $CC can actually use -Wno-pointer-sign" >&5
+echo $ECHO_N "checking whether $CC can actually use -Wno-pointer-sign... $ECHO_C" >&6
+ # This option causes warnings in C++ mode
+ # Note: -Werror must be before -Wno-pointer-sign, otherwise it does not do anything
+ CFLAGS="$OLD_CFLAGS -Werror -Wno-pointer-sign"
+ cat >conftest.$ac_ext <<_ACEOF
+int foo;
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
+ CFLAGS="$OLD_CFLAGS -Wno-pointer-sign"
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
@@ -4702,14 +4751,13 @@ fi
#
# math library (required)
#
-
-echo "$as_me:$LINENO: checking for sqrt in -lm" >&5
-echo $ECHO_N "checking for sqrt in -lm... $ECHO_C" >&6
-if test "${ac_cv_lib_m_sqrt+set}" = set; then
+echo "$as_me:$LINENO: checking for library containing sqrt" >&5
+echo $ECHO_N "checking for library containing sqrt... $ECHO_C" >&6
+if test "${ac_cv_search_sqrt+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm $LIBS"
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search_sqrt=no
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -4754,25 +4802,78 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_m_sqrt=yes
+ ac_cv_search_sqrt="none required"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_m_sqrt=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5
-echo "${ECHO_T}$ac_cv_lib_m_sqrt" >&6
-if test $ac_cv_lib_m_sqrt = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
+if test "$ac_cv_search_sqrt" = no; then
+ for ac_lib in m; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
- LIBS="-lm $LIBS"
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char sqrt ();
+int
+main ()
+{
+sqrt ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_sqrt="-l$ac_lib"
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_sqrt" >&5
+echo "${ECHO_T}$ac_cv_search_sqrt" >&6
+if test "$ac_cv_search_sqrt" != no; then
+ test "$ac_cv_search_sqrt" = "none required" || LIBS="$ac_cv_search_sqrt $LIBS"
else
{ { echo "$as_me:$LINENO: error: math library not found... stopping" >&5
diff --git a/configure.in b/configure.in
index afc35ee3a..c659ad142 100644
--- a/configure.in
+++ b/configure.in
@@ -318,7 +318,24 @@ OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_COMPILE_IFELSE(
[int foo;],
- [AC_MSG_RESULT([yes])],
+ [
+ AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([whether $CC can actually use -Wno-pointer-sign])
+ # This option causes warnings in C++ mode
+ # Note: -Werror must be before -Wno-pointer-sign, otherwise it does not do anything
+ CFLAGS="$OLD_CFLAGS -Werror -Wno-pointer-sign"
+ AC_COMPILE_IFELSE(
+ [int foo;],
+ [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$OLD_CFLAGS -Wno-pointer-sign"
+ ],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ]
+ )
+ ],
[
AC_MSG_RESULT([no])
CFLAGS="$OLD_CFLAGS"
@@ -555,7 +572,7 @@ AC_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR([zlib header not found, please speci
#
# math library (required)
#
-AC_CHECK_LIB([m], [sqrt], [], [AC_MSG_ERROR([math library not found... stopping])])
+AC_SEARCH_LIBS([sqrt], [m], [], [AC_MSG_ERROR([math library not found... stopping])])
#