Author: cazfi
Date: Mon Nov 17 06:22:36 2014
New Revision: 27056

URL: http://svn.gna.org/viewcvs/freeciv?rev=27056&view=rev
Log:
Added configure check for C++11 nullptr and provide fallback definition if
it's not available.

See patch #5127

Added:
    branches/S2_5/m4/c++11.m4
Modified:
    branches/S2_5/Makefile.am
    branches/S2_5/configure.ac

Modified: branches/S2_5/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/Makefile.am?rev=27056&r1=27055&r2=27056&view=diff
==============================================================================
--- branches/S2_5/Makefile.am   (original)
+++ branches/S2_5/Makefile.am   Mon Nov 17 06:22:36 2014
@@ -58,6 +58,7 @@
                bootstrap/mkinstalldirs         \
                m4/ac_path_lib.m4               \
                m4/c99.m4                       \
+               m4/c++11.m4                     \
                m4/codeset.m4                   \
                m4/compiler.m4                  \
                m4/debug.m4                     \

Modified: branches/S2_5/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/configure.ac?rev=27056&r1=27055&r2=27056&view=diff
==============================================================================
--- branches/S2_5/configure.ac  (original)
+++ branches/S2_5/configure.ac  Mon Nov 17 06:22:36 2014
@@ -617,6 +617,8 @@
 AC_C99_VARIABLE_ARRAYS
 AC_C99_INITIALIZERS
 AC_C99_STDINT_H
+
+FC_CXX11_NULLPTR
 
 dnl BeOS-specific settings
 if test x`$UNAME -s` = xBeOS ; then

Added: branches/S2_5/m4/c++11.m4
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/m4/c%2B%2B11.m4?rev=27056&view=auto
==============================================================================
--- branches/S2_5/m4/c++11.m4   (added)
+++ branches/S2_5/m4/c++11.m4   Mon Nov 17 06:22:36 2014
@@ -0,0 +1,18 @@
+# Check for the presence of C++11 features.
+
+# Check for C++11 nullptr, and define nullptr as '0' if it's missing
+#
+AC_DEFUN([FC_CXX11_NULLPTR],
+[
+  if test "x$cxx_works" = "xyes" ; then
+    AC_CACHE_CHECK([for C++11 nullptr], [ac_cv_cxx11_nullptr],
+     [AC_LANG_PUSH([C++])
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+]], [[ int *var = nullptr; ]])],
+[ac_cv_cxx11_nullptr=yes], [ac_cv_cxx11_nullptr=no])
+      AC_LANG_POP([C++])])
+    if test "x${ac_cv_cxx11_nullptr}" != "xyes" ; then
+      AC_DEFINE([nullptr], [0], [Fallback since C++11 nullptr not available])
+    fi
+  fi
+])


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to