Hi, for a project I needed to select C++98. When using g++, this is done by adding compiler flag "-std=c++98". I liked to have a compiler check whether this option works. A web search revealed that this seems not to be intended for maximum portability; language should not be limited. A similar thread appeared here for C, but I think the portability argument is wrong. If the source code is written for C++98, C++98 compiler must be used (only because standards are mostly backward-compatible, this is not a daily major issue). Similar with C vs. C++. If someone has no C++ compiler, he cannot compile the C++ sources. /bin/cat is maximum portable but supports only the empty subset of needed features :-) so in short, I think the requirement is right. For C++-98 sources, a C++-98 compiler must be used. Theoretically it should be "at least", but probably there are possibilities to write code that behaves differently when using e.g. c++11, so packages may require /exactly/ c++98, I think. The package developer needs it to avoid to accidentally use newer features. Cool would be to couple this to a debug/release mode (but AFAIK this is not a autoconf concept at all). How do I configure C++98? I tried to temporarily set CXXFLAGS and call AC_COMPILE_IFELSE, but this looks so ugly and is so complex that I think it cannot be right. Also, my guesswork relies on the assumption that any compiler that does not moan about "-std=c++98", understands it in the intended way. Here, it should be obvious, but what's with generic options like "-g", could be something different on exotic compilers. autoconf detects the gcc (and I think it sets a variable to use the result), but not g++. I could assume that c++ is g++ if gcc is present, but that's still an assumption. I'm also not sure whether I should I set CXXFLAGS or CPPFLAGS? I also wanted to support --enable-debug, but I didn't find how to do that. Is there no standard option or mechanism? For example, I like -DNDEBUG if --disable-debug etc, but -D may be compiler specific, config.h may be too late - so what is adviced? I include my guesswork script for "-std=c++98 auto detection" in the hope to get criticism. Thank you for reading this long question! Regards, Steffen AC_INIT([test], [1.0], [steffen.dettmer@xxxxxxxxx], [test], []) AC_PREREQ([2.59]) AC_CONFIG_MACRO_DIR([m4]) AM_PATH_CPPUNIT() LT_INIT AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign]) AC_PROG_CXX CPPFLAGS='-I$(top_srcdir)/src' dnl A function to check if compiler accepts option "-std=c++98" (g++) AC_DEFUN([AC_STD_CHECK_STD], [ AC_MSG_CHECKING([Compiler flag to use 1998 ISO C++ standard plus amendments]) dnl The 1998 ISO C++ standard plus amendments AC_SUBST(CXX_ISOCXX98) CXX_ISOCXX98=-std=c++98 AC_LANG_PUSH(C++) ac_std_cxx_flags="$CXXFLAGS" ="$CXX_ISOCXX98 $CXXFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [ac_std_check_std_result='yes'], [ac_std_check_std_result='no'; CXX_ISOCXX98=""]) AC_MSG_RESULT([$ac_std_check_std_result]) CXXFLAGS="$ac_std_cxx_flags" AC_LANG_POP() ]) AC_STD_CHECK_STD dnl for the needed files, Makefile.am has a "maude_CXXFLAGS" AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf