dnl @synopsis AC_COMPILE_WARNINGS dnl dnl Set the maximum warning verbosity according to compiler used. dnl Currently supports g++ and gcc. dnl This macro must be put after AC_PROG_CC and AC_PROG_CXX in dnl configure.in dnl dnl @author Loic Dachary dnl AC_DEFUN([AC_COMPILE_WARNINGS], [AC_MSG_CHECKING(maximum warning verbosity option) if test -n "$CXX" then if test "$GXX" = "yes" then ac_compile_warnings_opt='-Wall -Wextra -Werror -fstrict-aliasing -Wshadow' fi CXXFLAGS="$CXXFLAGS $ac_compile_warnings_opt" ac_compile_warnings_msg="$ac_compile_warnings_opt for C++" AC_MSG_RESULT($ac_compile_warnings_msg) fi if test -n "$CC" then if test "$GCC" = "yes" then ac_compile_warnings_opt='-Wall -Wextra -Werror -fstrict-aliasing -Wshadow' fi CFLAGS="$CFLAGS $ac_compile_warnings_opt" ac_compile_warnings_msg="$ac_compile_warnings_opt for C" AC_MSG_RESULT($ac_compile_warnings_msg) fi unset ac_compile_warnings_msg unset ac_compile_warnings_opt ]) dnl Copyright (C) 2001 Lorenzo Bettini dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl @synopsis AC_NONGNU_FLAGS dnl dnl check if the non-GNU C compiler accepts -Aa (HP-UX) AC_DEFUN([AC_NONGNU_FLAGS], [ if test -z "$GCC"; then AC_CC_AA_FLAG if test $ac_cv_cc_aa_flag = yes; then CFLAGS="$CFLAGS -Aa" fi fi ]) dnl @synopsis AC_CC_AA_FLAG dnl dnl check if the C compiler accepts -Aa (HP-UX) AC_DEFUN([AC_CC_AA_FLAG], [AC_CACHE_CHECK(whether ${CC-cc} accepts -Aa, ac_cv_cc_aa_flag, [echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -Aa -c conftest.c 2>&1`"; then ac_cv_cc_aa_flag=yes else ac_cv_cc_aa_flag=no fi rm -f conftest* ])]) dnl @synopsis AC_CXX_NAMESPACES dnl dnl If the compiler can prevent names clashes using namespaces, define dnl HAVE_NAMESPACES. dnl dnl @author Luc Maisonobe dnl AC_DEFUN([AC_CXX_NAMESPACES], [AC_CACHE_CHECK(whether the compiler implements namespaces, ac_cv_cxx_namespaces, [AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], [using namespace Outer::Inner; return i;], ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_namespaces" = yes; then AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) fi ]) dnl @synopsis AC_CXX_HAVE_STL dnl dnl If the compiler supports the Standard Template Library, define HAVE_STL. dnl dnl @author Luc Maisonobe dnl AC_DEFUN([AC_CXX_HAVE_STL], [AC_CACHE_CHECK(whether the compiler supports Standard Template Library, ac_cv_cxx_have_stl, [AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include #include #ifdef HAVE_NAMESPACES using namespace std; #endif],[list x; x.push_back(5); list::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;], ac_cv_cxx_have_stl=yes, ac_cv_cxx_have_stl=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_have_stl" = yes; then AC_DEFINE(HAVE_STL,,[define if the compiler supports Standard Template Library]) fi ]) dnl @synopsis AC_CXX_HAVE_SSTREAM dnl dnl If the C++ library has a working stringstream, define HAVE_SSTREAM. dnl dnl @author Ben Stanley dnl AC_DEFUN([AC_CXX_HAVE_SSTREAM], [AC_CACHE_CHECK(whether the compiler has stringstream, ac_cv_cxx_have_sstream, [AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include #ifdef HAVE_NAMESPACES using namespace std; #endif],[stringstream message; message << "Hello"; return 0;], ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_have_sstream" = yes; then AC_DEFINE(HAVE_SSTREAM,,[define if the compiler has stringstream]) fi ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/adl_func_getopt_long.html dnl AC_PREREQ(2.49) AC_DEFUN([adl_FUNC_GETOPT_LONG], [# clean out junk possibly left behind by a previous configuration rm -f lib/getopt.h # Check for getopt_long support AC_CHECK_HEADERS([getopt.h]) AC_CHECK_FUNCS([getopt_long],, [# FreeBSD has a gnugetopt library for this AC_CHECK_LIB([gnugetopt],[getopt_long],[AC_DEFINE([HAVE_GETOPT_LONG])], [# use the GNU replacement AC_LIBOBJ(getopt) AC_LIBOBJ(getopt1) AC_CONFIG_LINKS([src/getopt.h:src/gnugetopt.h])])])]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_c_long_long.html dnl AC_DEFUN([AC_C_LONG_LONG], [AC_CACHE_CHECK(for long long int, ac_cv_c_long_long, [if test "$GCC" = yes; then ac_cv_c_long_long=yes else AC_TRY_COMPILE(,[long long int i;], ac_cv_c_long_long=yes, ac_cv_c_long_long=no) fi]) if test $ac_cv_c_long_long = yes; then AC_DEFINE(HAVE_LONG_LONG) fi ])