Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use C++11 features with Autoconf? [duplicate]

I have a project configured via Autoconf, and I want to start using C++11 features in this project. How to have the "-std=gnu++0x" switch always enabled and support for the features checked while configuring?

like image 200
lvella Avatar asked Nov 02 '11 22:11

lvella


2 Answers

Have you checked ax_cxx_compile_stdcxx_11 ?

I think this is exactly what you want.

There is a big macro library on gnu website.

like image 175
Geoffroy Avatar answered Sep 21 '22 16:09

Geoffroy


You can do this with something like AX_CHECK_COMPILE_FLAG, e.g.:

AX_CHECK_COMPILE_FLAG([-std=c++0x], [
                        CXXFLAGS="$CXXFLAGS -std=c++0x"])

(You need to be careful here that AC_LANG is C++, not C at the point this is called because it's possible to use gcc for C and something else for C++ or vice versa).

like image 40
Flexo Avatar answered Sep 17 '22 16:09

Flexo