mirror of
https://github.com/tstack/lnav.git
synced 2024-10-04 00:31:31 +03:00
[build] fix for autoconf screwing up the c++ flags
This commit is contained in:
parent
03a17ef226
commit
4194f12a34
@ -29,8 +29,7 @@ AS_CASE([x$srcdir],
|
|||||||
|
|
||||||
AC_SUBST(abssrcdir)
|
AC_SUBST(abssrcdir)
|
||||||
|
|
||||||
AC_PROG_CXX
|
CXX=`echo $CXX | sed -e 's/-std=gnu++11//g'`
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS -D_ISOC99_SOURCE -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -DUSE_OS_TZDB=1 -DHAS_REMOTE_API=0"
|
CPPFLAGS="$CPPFLAGS -D_ISOC99_SOURCE -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -DUSE_OS_TZDB=1 -DHAS_REMOTE_API=0"
|
||||||
|
|
||||||
AC_ARG_ENABLE([debug],
|
AC_ARG_ENABLE([debug],
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
#
|
#
|
||||||
# Check for baseline language coverage in the compiler for the specified
|
# Check for baseline language coverage in the compiler for the specified
|
||||||
# version of the C++ standard. If necessary, add switches to CXX and
|
# 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)
|
# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for
|
||||||
# or '14' (for the C++14 standard).
|
# the respective C++ standard version.
|
||||||
#
|
#
|
||||||
# The second argument, if specified, indicates whether you insist on an
|
# 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.
|
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
||||||
@ -36,13 +36,14 @@
|
|||||||
# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
|
# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
|
||||||
# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
|
# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
|
||||||
# Copyright (c) 2020 Jason Merrill <jason@redhat.com>
|
# Copyright (c) 2020 Jason Merrill <jason@redhat.com>
|
||||||
|
# Copyright (c) 2021 Jörn Heusipp <osmanx@problemloesungsmaschine.de>
|
||||||
#
|
#
|
||||||
# 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
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
# warranty.
|
# warranty.
|
||||||
|
|
||||||
#serial 12
|
#serial 18
|
||||||
|
|
||||||
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
|
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
|
||||||
dnl (serial version number 13).
|
dnl (serial version number 13).
|
||||||
@ -51,6 +52,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
|
|||||||
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
|
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
|
||||||
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
|
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
|
||||||
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
|
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
|
||||||
|
[$1], [20], [ax_cxx_compile_alternatives="20"],
|
||||||
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
|
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
|
||||||
m4_if([$2], [], [],
|
m4_if([$2], [], [],
|
||||||
[$2], [ext], [],
|
[$2], [ext], [],
|
||||||
@ -102,9 +104,18 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
|
|||||||
dnl HP's aCC needs +std=c++11 according to:
|
dnl HP's aCC needs +std=c++11 according to:
|
||||||
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
|
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
|
||||||
dnl Cray's crayCC needs "-h std=c++11"
|
dnl Cray's crayCC needs "-h std=c++11"
|
||||||
|
dnl MSVC needs -std:c++NN for C++17 and later (default is C++14)
|
||||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||||
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
|
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do
|
||||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
if test x"$switch" = xMSVC; then
|
||||||
|
dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide
|
||||||
|
dnl with -std=c++17. We suffix the cache variable name with _MSVC to
|
||||||
|
dnl avoid this.
|
||||||
|
switch=-std:c++${alternative}
|
||||||
|
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC])
|
||||||
|
else
|
||||||
|
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
||||||
|
fi
|
||||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
||||||
$cachevar,
|
$cachevar,
|
||||||
[ac_save_CXX="$CXX"
|
[ac_save_CXX="$CXX"
|
||||||
@ -151,7 +162,6 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
|
|||||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
dnl Test body for checking C++14 support
|
dnl Test body for checking C++14 support
|
||||||
|
|
||||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
|
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
|
||||||
@ -159,12 +169,24 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
|
|||||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||||
)
|
)
|
||||||
|
|
||||||
|
dnl Test body for checking C++17 support
|
||||||
|
|
||||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
|
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
|
||||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
|
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
|
||||||
)
|
)
|
||||||
|
|
||||||
|
dnl Test body for checking C++20 support
|
||||||
|
|
||||||
|
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20],
|
||||||
|
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||||
|
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||||
|
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
|
||||||
|
_AX_CXX_COMPILE_STDCXX_testbody_new_in_20
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
dnl Tests for new features in C++11
|
dnl Tests for new features in C++11
|
||||||
|
|
||||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
|
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
|
||||||
@ -176,7 +198,11 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
|
|||||||
|
|
||||||
#error "This is not a C++ compiler"
|
#error "This is not a C++ compiler"
|
||||||
|
|
||||||
#elif __cplusplus < 201103L
|
// MSVC always sets __cplusplus to 199711L in older versions; newer versions
|
||||||
|
// only set it correctly if /Zc:__cplusplus is specified as well as a
|
||||||
|
// /std:c++NN switch:
|
||||||
|
// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
|
||||||
|
#elif __cplusplus < 201103L && !defined _MSC_VER
|
||||||
|
|
||||||
#error "This is not a C++11 compiler"
|
#error "This is not a C++11 compiler"
|
||||||
|
|
||||||
@ -467,7 +493,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
|
|||||||
|
|
||||||
#error "This is not a C++ compiler"
|
#error "This is not a C++ compiler"
|
||||||
|
|
||||||
#elif __cplusplus < 201402L
|
#elif __cplusplus < 201402L && !defined _MSC_VER
|
||||||
|
|
||||||
#error "This is not a C++14 compiler"
|
#error "This is not a C++14 compiler"
|
||||||
|
|
||||||
@ -591,7 +617,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
|
|||||||
|
|
||||||
#error "This is not a C++ compiler"
|
#error "This is not a C++ compiler"
|
||||||
|
|
||||||
#elif __cplusplus < 201703L
|
#elif __cplusplus < 201703L && !defined _MSC_VER
|
||||||
|
|
||||||
#error "This is not a C++17 compiler"
|
#error "This is not a C++17 compiler"
|
||||||
|
|
||||||
@ -957,6 +983,36 @@ namespace cxx17
|
|||||||
|
|
||||||
} // namespace cxx17
|
} // namespace cxx17
|
||||||
|
|
||||||
#endif // __cplusplus < 201703L
|
#endif // __cplusplus < 201703L && !defined _MSC_VER
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
dnl Tests for new features in C++20
|
||||||
|
|
||||||
|
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
|
||||||
|
#error "This is not a C++ compiler"
|
||||||
|
|
||||||
|
#elif __cplusplus < 202002L && !defined _MSC_VER
|
||||||
|
|
||||||
|
#error "This is not a C++20 compiler"
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <version>
|
||||||
|
|
||||||
|
namespace cxx20
|
||||||
|
{
|
||||||
|
|
||||||
|
// As C++20 supports feature test macros in the standard, there is no
|
||||||
|
// immediate need to actually test for feature availability on the
|
||||||
|
// Autoconf side.
|
||||||
|
|
||||||
|
} // namespace cxx20
|
||||||
|
|
||||||
|
#endif // __cplusplus < 202002L && !defined _MSC_VER
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
Loading…
Reference in New Issue
Block a user