summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure.ac110
1 files changed, 57 insertions, 53 deletions
diff --git a/configure.ac b/configure.ac
index 406fc3688..e7c32e112 100755
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,58 @@ AC_INIT([ManaPlus], [1.7.3.4], [akaras@inbox.ru], [manaplus])
AM_INIT_AUTOMAKE([1.9])
AC_LANG_CPLUSPLUS
+AC_DEFUN([AC_CHECK_CXX_FLAG],
+ [
+ AC_MSG_CHECKING([whether $CC supports $1])
+ OLD_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -Werror $1"
+ test_flag=no
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([int foo;])],
+ [
+ AC_MSG_RESULT([yes])
+ test_flag=yes
+ ],
+ [
+ AC_MSG_RESULT([no])
+ test_flag=no
+ ]
+ CXXFLAGS="$OLD_CXXFLAGS"
+ )
+ AM_CONDITIONAL($2, test x$test_flag = xtrue)
+ ]
+)
+
+AC_DEFUN([AC_CHECK_LD_FLAG],
+ [
+ AC_MSG_CHECKING([whether $LD supports $1])
+ OLD_CXXFLAGS="$CXXFLAGS"
+ OLD_LDFLAGS="$LDFLAGS"
+ CXXFLAGS=""
+ LDFLAGS="$LDFLAGS $1"
+ test_flag=no
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
+ int main(int argc, char **argv)
+ {
+ return 0;
+ }
+ ])],
+ [
+ AC_MSG_RESULT([yes])
+ test_flag=yes
+ ],
+ [
+ AC_MSG_RESULT([no])
+ test_flag=no
+ ]
+ CXXFLAGS="$OLD_CXXFLAGS"
+ LDFLAGS="$OLD_LDFLAGS"
+ )
+ AM_CONDITIONAL($2, test x$test_flag = xyes)
+ ]
+)
+
# Enable -Werror
AC_ARG_ENABLE(werror,
[ --enable-werror Fail build if warning present],
@@ -456,8 +508,11 @@ if test "x$with_librt" == "xno"; then
else
if test "x$applebuild_enabled" == "xfalse"; then
if test "x$androidbuild_enabled" == "xfalse"; then
- AC_CHECK_LIB(rt, shm_open, ,
- AC_MSG_ERROR([ *** Unable to find librt library]))
+ AC_CHECK_LD_FLAG(-lrt, USE_LIBRT)
+ if test "x$test_flag" == "xyes"; then
+ AC_CHECK_LIB(rt, shm_open, ,
+ AC_MSG_ERROR([ *** Unable to find librt library]))
+ fi
fi
fi
without_librt=no
@@ -580,57 +635,6 @@ if test "x$naclbuild_enabled" == "xtrue"; then
AC_CHECK_SDL()
fi
-AC_DEFUN([AC_CHECK_CXX_FLAG],
- [
- AC_MSG_CHECKING([whether $CC supports $1])
- OLD_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS -Werror $1"
- test_flag=no
- AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE([int foo;])],
- [
- AC_MSG_RESULT([yes])
- test_flag=yes
- ],
- [
- AC_MSG_RESULT([no])
- test_flag=no
- ]
- CXXFLAGS="$OLD_CXXFLAGS"
- )
- AM_CONDITIONAL($2, test x$test_flag = xtrue)
- ]
-)
-
-AC_DEFUN([AC_CHECK_LD_FLAG],
- [
- AC_MSG_CHECKING([whether $LD supports $1])
- OLD_CXXFLAGS="$CXXFLAGS"
- OLD_LDFLAGS="$LDFLAGS"
- CXXFLAGS=""
- LDFLAGS="$LDFLAGS $1"
- test_flag=no
- AC_LINK_IFELSE(
- [AC_LANG_SOURCE([
- int main(int argc, char **argv)
- {
- return 0;
- }
- ])],
- [
- AC_MSG_RESULT([yes])
- test_flag=yes
- ],
- [
- AC_MSG_RESULT([no])
- test_flag=no
- ]
- CXXFLAGS="$OLD_CXXFLAGS"
- LDFLAGS="$OLD_LDFLAGS"
- )
- AM_CONDITIONAL($2, test x$test_flag = xyes)
- ]
-)
AC_CHECK_LD_FLAG(-rdynamic, HAVE_RDYNAMIC)