<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40268 >

 $subject

 I took diff between S2_1 and S2_2 configure.ac and backported changes
that fix bugs, even if minor ones. This is mainly for keeping S2_1 and
S2_2 & TRUNK build similar enough that same test build system can take
care of all these branches.


 - ML

diff -Nurd -X.diff_ignore freeciv/configure.ac freeciv/configure.ac
--- freeciv/configure.ac        2008-05-06 02:52:10.000000000 +0300
+++ freeciv/configure.ac        2008-06-12 00:15:51.000000000 +0300
@@ -219,7 +219,7 @@
 
   if test "$IS_BETA_VERSION" = "1" || test "$IS_DEVEL_VERSION" = "1"; then
     AC_MSG_CHECKING(for GNU xgettext version >= 0.10.36)
-    xgettext_version=`$XGETTEXT --version 2>&1 | grep GNU | sed 's/"/ /g'`
+    xgettext_version=`$XGETTEXT --version 2>&1 | grep GNU | head -n 1 | sed 
's/"/ /g'`
     AC_TRY_RUN([
 #include <stdio.h>
 
@@ -254,7 +254,7 @@
     )
 
     AC_MSG_CHECKING(for GNU msgfmt version >= 0.10.35)
-    msgfmt_version=`$MSGFMT --version 2>&1 | grep GNU | sed 's/"/ /g'`
+    msgfmt_version=`$MSGFMT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ 
/g'`
     AC_TRY_RUN([
 #include <stdio.h>
 
@@ -293,15 +293,13 @@
   fi
 fi
 
-EXTRA_GCC_DEBUG_CFLAGS=""
-EXTRA_GCC_DEBUG_CXXFLAGS=""
-
-if test -n "$GCC"; then
-   EXTRA_GCC_DEBUG_CFLAGS="$CFLAGS"
-   EXTRA_GCC_DEBUG_CXXFLAGS="$CXXFLAGS"
-   CFLAGS="-Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes 
-Wmissing-declarations"
-   CXXFLAGS="-Wall -Wpointer-arith -Wcast-align"
-fi
+dnl Set debug flags supported by compiler
+EXTRA_DEBUG_CFLAGS=""
+EXTRA_DEBUG_CXXFLAGS=""
+FC_C_FLAGS([-Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes 
-Wmissing-declarations],
+ [], [EXTRA_DEBUG_CFLAGS])
+FC_CXX_FLAGS([-Wall -Wpointer-arith -Wcast-align],
+ [], [EXTRA_DEBUG_CXXFLAGS])
 
 FC_DEBUG
 AC_C99_VARIADIC_MACROS
@@ -458,6 +456,7 @@
 
     if test "x$found_client" = "xyes"; then
       client=stub
+      CLIENT_LIBS="-lm"
     elif test "$client" = "stub"; then
       AC_MSG_ERROR(specified client 'stub' not configurable)
     fi
@@ -648,7 +647,7 @@
 dnl commonly used _() and N_() macros to work, there should be somewhere
 dnl in that 'po/Makefile' a call to xgettext with "--keyword=_" and
 dnl "--keyword=N_" as arguments.  To support Q_() and PL_(),
-dnl the following simply dnl replaces instances of 
+dnl the following simply replaces instances of 
 dnl "--keyword=N_" with "--keyword=N_ --keyword=Q_ --keyword=PL_:1,2"
 dnl in the 'po/Makefile' file.
 AC_CONFIG_COMMANDS([fc_default-1],[[if test -f po/Makefile ; then
@@ -704,10 +703,8 @@
      fi
    fi]],[[]])
 
-if test -n "$GCC"; then
-  CFLAGS="$EXTRA_GCC_DEBUG_CFLAGS $CFLAGS"
-  CXXFLAGS="$EXTRA_GCC_DEBUG_CXXFLAGS $CXXFLAGS"
-fi
+CFLAGS="$EXTRA_GCC_DEBUG_CFLAGS $CFLAGS"
+CXXFLAGS="$EXTRA_GCC_DEBUG_CXXFLAGS $CXXFLAGS"
 
 dnl Rebuild 'configure' whenever version.in changes, if maintainer mode 
enabled.
 AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES 
\$(top_srcdir)/version.in"])
diff -Nurd -X.diff_ignore freeciv/m4/compiler.m4 freeciv/m4/compiler.m4
--- freeciv/m4/compiler.m4      1970-01-01 02:00:00.000000000 +0200
+++ freeciv/m4/compiler.m4      2008-06-12 00:12:20.000000000 +0300
@@ -0,0 +1,68 @@
+# Macros to check compiler options
+#
+
+# Helper function that adds flags (words) to variable listing them.
+# Makes sure there is no extra spaces even in any situation
+#
+# $1 - Name of the target variable
+# $2 - Flags to add
+#
+AC_DEFUN([FC_ADD_WORDS_TO_VAR],
+[
+old_value="`eval echo '$'$1`"
+if test "x$old_value" = "x" ; then
+  $1="$2"
+elif test "x$2" != "x" ; then
+  $1="$old_value $2"
+fi
+])
+
+# Check if compiler supports given commandline parameter in language specific
+# variable. If it does, it will be concatenated to variable. If several
+# parameters are given, they are tested, and added to target variable,
+# one at a time.
+#
+# $1 - Language
+# $2 - Language specific variable
+# $3 - Parameters to test
+# $4 - Additional parameters
+# $5 - Variable where to add
+#
+
+AC_DEFUN([FC_COMPILER_FLAGS],
+[
+AC_LANG_PUSH([$1])
+
+flags_save="`eval echo '$'$2`"
+accepted_flags=""
+
+for flag in $3
+do
+  $2="$flags_save $accepted_flags $flag $4"
+  AC_COMPILE_IFELSE([int a;],
+                    [FC_ADD_WORDS_TO_VAR([accepted_flags], [$flag])])
+done
+FC_ADD_WORDS_TO_VAR([$5], [$accepted_flags])
+
+$2="$flags_save"
+
+AC_LANG_POP([$1])
+])
+
+# Commandling flag tests for C and C++
+#
+#
+# $1 - Parameters to test
+# $2 - Additional parameters
+# $3 - Variable where to add
+
+AC_DEFUN([FC_C_FLAGS],
+[
+FC_COMPILER_FLAGS([C], [CFLAGS], [$1], [$2], [$3])
+])
+
+
+AC_DEFUN([FC_CXX_FLAGS],
+[
+FC_COMPILER_FLAGS([C++], [CXXFLAGS], [$1], [$2], [$3])
+])
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to