Skip to content

Commit

Permalink
autoconf: Fix C++17 detection not working on Ubuntu 16.04.
Browse files Browse the repository at this point in the history
And probably many other distributions.

Until now, ./configure would fail silently printing a warning

    ./configure: line 4621: AX_CXX_COMPILE_STDCXX_17: command not found

and then continuing, later failing with a C++ #error saying that some C++11
feature isn't supported (it didn't even get to the C++17 features).

This is because older distributions don't come with the
`AX_CXX_COMPILE_STDCXX_17` m4 macro.

This commit vendors that macro accordingly.

Now ./configure complains correctly:

    configure: error: *** A compiler with support for C++17 language features is required.

On Ubuntu 16.04, ./configure completes if a newer compiler is used, e.g. with
gcc-7 from https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
using:

    ./bootstrap.sh
    ./configure CXX=g++-7 --disable-doc-gen --with-boost=$(nix-build --no-link '<nixpkgs>' -A boost.dev)
  • Loading branch information
nh2 committed Jul 3, 2019
1 parent 1f97b16 commit 57daa86
Show file tree
Hide file tree
Showing 4 changed files with 989 additions and 2 deletions.
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AC_INIT(nix, m4_esyscmd([bash -c "echo -n $(cat ./.version)$VERSION_SUFFIX"]))
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_SRCDIR(README.md)
AC_CONFIG_AUX_DIR(config)

Expand Down Expand Up @@ -62,7 +63,7 @@ CXXFLAGS=
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AX_CXX_COMPILE_STDCXX_17
AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])

AC_CHECK_TOOL([AR], [ar])

Expand Down
2 changes: 1 addition & 1 deletion doc/manual/installation/prerequisites-source.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<listitem><para>Bash Shell. The <literal>./configure</literal> script
relies on bashisms, so Bash is required.</para></listitem>

<listitem><para>A version of GCC or Clang that supports C++14.</para></listitem>
<listitem><para>A version of GCC or Clang that supports C++17.</para></listitem>

<listitem><para><command>pkg-config</command> to locate
dependencies. If your distribution does not provide it, you can get
Expand Down
Loading

0 comments on commit 57daa86

Please sign in to comment.