Where do I put additional autotool macros?
emsr's answer to this question: How can I specify that I want C++0x in Makefile.am? is the solution to a problem I have. No I have a new one:
I put the macro definition into m4/check.m4 and change my configure.ac accordingly:
AC_INIT([CppSs], [0.1], [email@example.com]) m4_include([m4/check.m4]) LT_INIT AC_CONFIG_SRCDIR([src/main.cc]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile src/Makefile]) AC_CONFIG_MACRO_DIR([m4]) # Checks for programs. AC_PROG_CXX AC_PROG_CC # ... # Check for C++0x features AC_COMPILE_STDCXX_OX AC_HEADER_STDCXX_11 AC_OUTPUT
Now when I run autoreconf -v I get these messages (tried -fiv also):
configure.ac:43: warning: AC_COMPILE_STDCXX_11 is m4_require'd but not m4_defun'd ../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from... ../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from... ../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from... m4/cppss. m4:90: AC_HEADER_STDCXX_11 is expanded from...
... ./configure: line 16234: AC_COMPILE_STDCXX_OX: command not found ./configure: line 16235: AC_COMPILE_STDCXX_11: command not found ...
What am I missing?
I solved it myself... It was a mixture of several typos (0 instead of O and alike) and mistakes in the order of putting the macros in the configure.ac. Also, I found out, that if it's just a few macros, it's easier to put them in a file called acinclude.m4 in the same directory as configure.ac and get rid of the
And there is an error in the libstdc++ manual in the part at the bottom of the page where the c++11 features are checked, as (at least in gcc) there is no compiler option -std=c++11. It should be -std=c++0x.