Skip to content
Snippets Groups Projects
Select Git revision
  • e3a3979eba816d3a24d28b1556cb34c7c815ca9d
  • master default
  • uop
  • rework_pac
  • aux_vars_fix
  • created_preprocessor_repo
6 results

ax_cxx_compile_stdcxx.m4

Blame
  • Forked from Dynare / preprocessor
    Source project has a limited visibility.
    ax_cxx_compile_stdcxx.m4 18.91 KiB
    # ===========================================================================
    #  https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
    # ===========================================================================
    #
    # SYNOPSIS
    #
    #   AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
    #
    # DESCRIPTION
    #
    #   Check for baseline language coverage in the compiler for the specified
    #   version of the C++ standard.  If necessary, add switches to CXX and
    #   CXXCPP to enable support.  VERSION may be '11' (for the C++11 standard)
    #   or '14' (for the C++14 standard).
    #
    #   The second 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 extended mode.
    #
    #   The third argument, if specified 'mandatory' or if left unspecified,
    #   indicates that baseline support for the specified C++ standard is
    #   required and that the macro should error out if no mode with that
    #   support is found.  If specified 'optional', then configuration proceeds
    #   regardless, after defining HAVE_CXX${VERSION} if and only if a
    #   supporting mode is found.
    #
    # LICENSE
    #
    #   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
    #   Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
    #   Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
    #   Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
    #   Copyright (c) 2015 Paul Norman <penorman@mac.com>
    #   Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
    #   Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
    #   Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.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 11
    
    dnl  This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
    dnl  (serial version number 13).
    
    AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
      m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
            [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
            [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
            [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
      m4_if([$2], [], [],
            [$2], [ext], [],
            [$2], [noext], [],
            [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
      m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
            [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
            [$3], [optional], [ax_cxx_compile_cxx$1_required=false],
            [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
      AC_LANG_PUSH([C++])dnl
      ac_success=no
    
      m4_if([$2], [noext], [], [dnl
      if test x$ac_success = xno; then
        for alternative in ${ax_cxx_compile_alternatives}; do
          switch="-std=gnu++${alternative}"
          cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
          AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,