Changeset 3937


Ignore:
Timestamp:
Jul 16, 2020, 2:48:10 PM (11 months ago)
Author:
Peter
Message:

refs #949. New macro YAT_CXX11 that tests if compiler is CXX compliant by using the underlying AX_CXX_COMPILE_STDCXX_11 macro

Location:
trunk/m4
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/m4/yat_cxx11.m4

    r3792 r3937  
    11## $Id$
    22#
    3 # serial 5  (yat 0.16)
     3# serial 6  (yat 0.18)
    44#
    55# see http://www.gnu.org/software/automake/manual/automake.html#Serials
     
    77# SYNOPSIS
    88#
     9#   YAT_CXX11([search], [action-if-found], [action-if-not-found])
    910#   YAT_CXX_ATOMIC([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
    1011#   YAT_CXX_RVALUE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
     
    1314# DESCRIPTION
    1415#
    15 #   Test whether $CXX supports rvalues and other cxx11 features
     16#   Test whether $CXX supports cxx11 features
    1617#
    1718# LAST MODIFICATION
     
    2122# COPYLEFT
    2223#
    23 #   Copyright (C) 2017, 2018, 2019 Peter Johansson
     24#   Copyright (C) 2017, 2018, 2019, 2020 Peter Johansson
    2425#
    2526#   This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3839#   along with yat. If not, see <http://www.gnu.org/licenses/>.
    3940#
     41
     42# YAT_CXX11([search], [action-if-found], [action-if-not-found])
     43#
     44# Test whether $CXX is a C++11 compliant compiler. If not and search
     45# is 'yes', then search different switches to $CXX to see if
     46# compliance can be turned on. If a C++11 compliant compiler is found,
     47# AC_DEFINE HAVE_CXX11, set shell variable HAVE_CXX11 to 1 and
     48# AC_SUBST it. Otherwise set HAVE_CXX11 to 0 and execute
     49# action-if-not-found.
     50AC_DEFUN([YAT_CXX11], [
     51
     52AC_MSG_CHECKING([whether $CXX supports C++11 features])
     53AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_11])], [
     54    AC_MSG_RESULT([yes])
     55    HAVE_CXX11=1
     56    AC_DEFINE([HAVE_CXX11], [1], [define if the compiler supports C++11 syntax])
     57  ], [
     58    AC_MSG_RESULT([no])
     59    HAVE_CXX11=0
     60    AS_IF([test x"$1" = x"yes"], [
     61      # This macro sets HAVE_CXX11=1 if successful and AC_DEFINE
     62      AX_CXX_COMPILE_STDCXX_11([noext], [optional])
     63    ])
     64  ])
     65AC_SUBST([HAVE_CXX11])
     66# ACTION
     67AS_VAR_IF([HAVE_CXX11], [1], [$2], [$3])
     68
     69]) # end of YAT_CXX11
     70
    4071
    4172# YAT_CXX_ATOMIC([action-if-found], [action-if-not-found], [search-options])
Note: See TracChangeset for help on using the changeset viewer.