[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bzflag-commits
Subject:    SF.net SVN: bzflag:[22783] trunk/bzflag
From:       bullet_catcher () users ! sourceforge ! net
Date:       2013-05-29 18:19:56
Message-ID: E1Uhkye-0007Yx-23 () sfs-ml-4 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 22783
          http://sourceforge.net/p/bzflag/code/22783
Author:   bullet_catcher
Date:     2013-05-29 18:19:55 +0000 (Wed, 29 May 2013)
Log Message:
-----------
Add a GNU extension for autoconf to test for C++0x support, and use it to select the \
required compiler option. Abort the configure script if no c++ compiler is found or \
if we don't know how to get C++0x support from it.

Modified Paths:
--------------
    trunk/bzflag/configure.ac
    trunk/bzflag/m4/Makefile.am

Added Paths:
-----------
    trunk/bzflag/m4/ax_cxx_compile_stdcxx_0x.m4

Modified: trunk/bzflag/configure.ac
===================================================================
--- trunk/bzflag/configure.ac	2013-05-29 16:46:11 UTC (rev 22782)
+++ trunk/bzflag/configure.ac	2013-05-29 18:19:55 UTC (rev 22783)
@@ -208,6 +208,19 @@
 AC_PROG_MAKE_SET
 AM_PROG_MKDIR_P
 AC_PROG_CXX
+if test -z "$CXX"; then
+    AC_MSG_ERROR([A c++ compiler is required to build BZFlag])
+fi
+AX_CXX_COMPILE_STDCXX_0X
+if test "x$ax_cv_cxx_compile_cxx0x_native" != xyes; then
+    if test "x$ax_cv_cxx_compile_cxx0x_cxx" = xyes; then
+	CXXFLAGS="$CXXFLAGS -std=c++0x"
+    elif test "x$ax_cv_cxx_compile_cxx0x_gxx" = xyes; then
+	CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+    else
+	AC_MSG_ERROR([A c++ compiler with C++0x support is required to build BZFlag])
+    fi
+fi
 AC_PROG_CC
 AC_PROG_LN_S
 AC_CHECK_PROG(AR, ar, ar)
@@ -744,7 +757,7 @@
 
 if test x$enable_debug = xyes ; then
     CONF_CFLAGS="$CONF_CFLAGS -Werror -g -O0"
-    CONF_CXXFLAGS="-std=c++0x $CONF_CXXFLAGS -Werror -g -O0"
+    CONF_CXXFLAGS="$CONF_CXXFLAGS -Werror -g -O0"
     # revert automatic setting of CFLAGS and CXXFLAGS to prevent
     # override of "-g -O0" put into CONF_CFLAGS and CONF_CXXFLAGS above
     CFLAGS="$user_CFLAGS"
@@ -754,7 +767,7 @@
     if test "$GCC" = yes ; then
 	OPTIMIZE="-fexpensive-optimizations"
 	CONF_CFLAGS="$CONF_CFLAGS $OPTIMIZE"
-	CONF_CXXFLAGS="-std=c++0x $CONF_CXXFLAGS $OPTIMIZE"
+	CONF_CXXFLAGS="$CONF_CXXFLAGS $OPTIMIZE"
     fi
     AC_DEFINE(NDEBUG, 1, [Debugging disabled])
 fi

Modified: trunk/bzflag/m4/Makefile.am
===================================================================
--- trunk/bzflag/m4/Makefile.am	2013-05-29 16:46:11 UTC (rev 22782)
+++ trunk/bzflag/m4/Makefile.am	2013-05-29 18:19:55 UTC (rev 22783)
@@ -1,4 +1,5 @@
 EXTRA_DIST = \
+	ax_cxx_compile_stdcxx_0x.m4 \
 	cache.m4 \
 	curses.m4 \
 	isnan.m4 \

Added: trunk/bzflag/m4/ax_cxx_compile_stdcxx_0x.m4
===================================================================
--- trunk/bzflag/m4/ax_cxx_compile_stdcxx_0x.m4	                        (rev 0)
+++ trunk/bzflag/m4/ax_cxx_compile_stdcxx_0x.m4	2013-05-29 18:19:55 UTC (rev 22783)
@@ -0,0 +1,107 @@
+# ============================================================================
+#  http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_0x.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+#   AX_CXX_COMPILE_STDCXX_0X
+#
+# DESCRIPTION
+#
+#   Check for baseline language coverage in the compiler for the C++0x
+#   standard.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 7
+
+AU_ALIAS([AC_CXX_COMPILE_STDCXX_0X], [AX_CXX_COMPILE_STDCXX_0X])
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_0X], [
+  AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
+  ax_cv_cxx_compile_cxx0x_native,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);],,
+  ax_cv_cxx_compile_cxx0x_native=yes, ax_cv_cxx_compile_cxx0x_native=no)
+  AC_LANG_RESTORE
+  ])
+
+  AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
+  ax_cv_cxx_compile_cxx0x_cxx,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=c++0x"
+  AC_TRY_COMPILE([
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);],,
+  ax_cv_cxx_compile_cxx0x_cxx=yes, ax_cv_cxx_compile_cxx0x_cxx=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+
+  AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
+  ax_cv_cxx_compile_cxx0x_gxx,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+  AC_TRY_COMPILE([
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);],,
+  ax_cv_cxx_compile_cxx0x_gxx=yes, ax_cv_cxx_compile_cxx0x_gxx=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+
+  if test "$ax_cv_cxx_compile_cxx0x_native" = yes ||
+     test "$ax_cv_cxx_compile_cxx0x_cxx" = yes ||
+     test "$ax_cv_cxx_compile_cxx0x_gxx" = yes; then
+    AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
+  fi
+])


Property changes on: trunk/bzflag/m4/ax_cxx_compile_stdcxx_0x.m4
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
BZFlag-commits mailing list
BZFlag-commits@lists.SourceForge.net
https://lists.SourceForge.net/lists/listinfo/bzflag-commits
irc: #BZFlag @ irc.freenode.net


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic