build: use our own version of ax_check_link_flag

The message on configure is misleading:

    checking whether the linker accepts -std=c++11... yes
    checking whether the linker accepts -std=c++14... yes
    checking whether the linker accepts -std=c++17... no

It is the compiler that we check, not just the linker.

* m4/ax_check_link_flag.m4: Remove.
* m4/bison-check-compiler-flag.m4: New.
* m4/bison-cxx-std.m4: Use it.
This commit is contained in:
Akim Demaille
2018-09-23 08:57:13 +02:00
parent e40a3eed34
commit 5649888686
3 changed files with 49 additions and 57 deletions

View File

@@ -116,7 +116,7 @@ AC_DEFUN([BISON_CXX_COMPILE_STDCXX_11],
AC_LANG_PUSH([C++])
for f in '-std=c++11' '-std=c++11 -stdlib=libc++'
do
AX_CHECK_LINK_FLAG([$f],
BISON_CHECK_COMPILER_FLAG([$f],
[AC_SUBST([CXX11_CXXFLAGS], [$f]) break],
[], [],
[_BISON_CXX_COMPILE_STDCXX_11_testbody])
@@ -130,7 +130,7 @@ AC_DEFUN([BISON_CXX_COMPILE_STDCXX_14],
AC_LANG_PUSH([C++])
for f in '-std=c++14' '-std=c++14 -stdlib=libc++'
do
AX_CHECK_LINK_FLAG([$f],
BISON_CHECK_COMPILER_FLAG([$f],
[AC_SUBST([CXX14_CXXFLAGS], [$f]) break],
[], [],
[_BISON_CXX_COMPILE_STDCXX_14_testbody])
@@ -144,7 +144,7 @@ AC_DEFUN([BISON_CXX_COMPILE_STDCXX_17],
AC_LANG_PUSH([C++])
for f in '-std=c++17' '-std=c++17 -stdlib=libc++'
do
AX_CHECK_LINK_FLAG([$f],
BISON_CHECK_COMPILER_FLAG([$f],
[AC_SUBST([CXX17_CXXFLAGS], [$f]) break],
[], [],
[_BISON_CXX_COMPILE_STDCXX_17_testbody])
@@ -158,7 +158,7 @@ AC_DEFUN([BISON_CXX_COMPILE_STDCXX_2A],
AC_LANG_PUSH([C++])
for f in '-std=c++2a' '-std=c++2a -stdlib=libc++'
do
AX_CHECK_LINK_FLAG([$f],
BISON_CHECK_COMPILER_FLAG([$f],
[AC_SUBST([CXX2A_CXXFLAGS], [$f]) break],
[], [],
[_BISON_CXX_COMPILE_STDCXX_2A_testbody])