Thursday, March 20, 2014

Autoconf Macros to Check for C++11 Features in the Header

C++11 introduces a lot of improvements and new features to the C++ language and the C++ Standard Library. Compilers and libraries are still implementing such features and it is likely your toolchain is still missing some piece, even though the ones I am using (GCC and CLang) are catching up quickly.

While on the one hand the GNU Build System is mostly used to build C projects and an historical lack of C++ macros is suffered, on the other hand there were no C++11 specific macro to check for library compliance.

For this reason, I began writing my own set of macros some weeks ago starting from what I needed at the time: C++11 features in the <functional> header. So far, I have written the following macros which cover all the new C++11 features in that header:

All the macros except AX_CXX_HAVE_PLACEHOLDERS were submitted to the GNU Autoconf Archive some weeks ago and are already available for use: just follow the link on the macro name, download the m4 file and use it. I submitted AX_CXX_HAVE_PLACEHOLDERS this morning and I expect it to be available shortly: I will update this post as soon as this macro has been accepted.

For those who want to contribute to this set of macros, you can check out their GitHub repository.

No comments: