Modify autoconf macro to be more flexible about how it is used - sets CXX11FLAGS, HAVE_CXX11_COMPILER and option to not error out
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13866 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
81d0168e51
commit
77ccb6f21c
1 changed files with 19 additions and 5 deletions
|
|
@ -4,15 +4,18 @@
|
||||||
#
|
#
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
#
|
#
|
||||||
# AX_CXX_COMPILE_STDCXX_11([ext|noext])
|
# AX_CXX_COMPILE_STDCXX_11([ext|noext], [nostop])
|
||||||
#
|
#
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
#
|
#
|
||||||
# Check for baseline language coverage in the compiler for the C++11
|
# Check for baseline language coverage in the compiler for the C++11
|
||||||
# standard; if necessary, add switches to CXXFLAGS to enable support.
|
# standard; if necessary, add switches to CXXFLAGS to enable support.
|
||||||
# Errors out if no mode that supports C++11 baseline syntax can be found.
|
# CXX11FLAGS will also contain any necessary switches to enable support.
|
||||||
# The argument, if specified, indicates whether you insist on an extended
|
# HAVE_CXX11_COMPILER will additionally be set to yes if there is support.
|
||||||
# mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -std=c++11).
|
# If the second argument is not specified, errors out if no mode that
|
||||||
|
# supports C++11 baseline syntax can be found. The first argument, if
|
||||||
|
# specified, indicates whether you insist on an extended mode
|
||||||
|
# (e.g. -std=gnu++11) or a strict conformance mode (e.g. -std=c++11).
|
||||||
# If neither is specified, you get whatever works, with preference for an
|
# If neither is specified, you get whatever works, with preference for an
|
||||||
# extended mode.
|
# extended mode.
|
||||||
#
|
#
|
||||||
|
|
@ -20,6 +23,7 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||||
|
# Copyright (c) 2012 William Fulton <wsf@fultondesigns.co.uk>
|
||||||
#
|
#
|
||||||
# Copying and distribution of this file, with or without modification, are
|
# Copying and distribution of this file, with or without modification, are
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
# permitted in any medium without royalty provided the copyright notice
|
||||||
|
|
@ -50,8 +54,12 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
|
||||||
[$1], [ext], [],
|
[$1], [ext], [],
|
||||||
[$1], [noext], [],
|
[$1], [noext], [],
|
||||||
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
|
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
|
||||||
|
m4_if([$2], [], [],
|
||||||
|
[$2], [nostop], [],
|
||||||
|
[m4_fatal([invalid argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl
|
||||||
AC_LANG_ASSERT([C++])dnl
|
AC_LANG_ASSERT([C++])dnl
|
||||||
ac_success=no
|
ac_success=no
|
||||||
|
CXX11FLAGS=
|
||||||
AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
|
AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
|
||||||
ax_cv_cxx_compile_cxx11,
|
ax_cv_cxx_compile_cxx11,
|
||||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||||
|
|
@ -75,6 +83,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
|
||||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
CXXFLAGS="$ac_save_CXXFLAGS"])
|
||||||
if eval test x\$$cachevar = xyes; then
|
if eval test x\$$cachevar = xyes; then
|
||||||
CXXFLAGS="$CXXFLAGS $switch"
|
CXXFLAGS="$CXXFLAGS $switch"
|
||||||
|
CXX11FLAGS=$switch
|
||||||
ac_success=yes
|
ac_success=yes
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
@ -95,6 +104,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
|
||||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
CXXFLAGS="$ac_save_CXXFLAGS"])
|
||||||
if eval test x\$$cachevar = xyes; then
|
if eval test x\$$cachevar = xyes; then
|
||||||
CXXFLAGS="$CXXFLAGS $switch"
|
CXXFLAGS="$CXXFLAGS $switch"
|
||||||
|
CXX11FLAGS=$switch
|
||||||
ac_success=yes
|
ac_success=yes
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
@ -102,6 +112,10 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
|
||||||
fi])
|
fi])
|
||||||
|
|
||||||
if test x$ac_success = xno; then
|
if test x$ac_success = xno; then
|
||||||
|
if test x$2 != xnostop; then
|
||||||
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
|
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
HAVE_CXX11_COMPILER=yes
|
||||||
|
fi
|
||||||
])
|
])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue