# # add_file "m4/prog_cxx_warnings.m4" # # patch "Makefile.am" # from [48577e71107e5e2bef13349eaef8bd22778ec676] # to [5f90663376031daaec9ea531de77309097820a25] # # patch "configure.ac" # from [3c5b1e038f4c1436c9d021905bb86fbc48772349] # to [4cd637ba337c35746c0e0ff4716cf00d5e669dbd] # # patch "m4/prog_cxx_warnings.m4" # from [] # to [139fc00ee4d586ee79176dab19b0fc9e1338b83f] # ======================================================================== --- Makefile.am 48577e71107e5e2bef13349eaef8bd22778ec676 +++ Makefile.am 5f90663376031daaec9ea531de77309097820a25 @@ -416,7 +416,7 @@ CLEANFILES = $(BUILT_SOURCES_CLEAN) $(EPS_FIGURES) txt2c: txt2c.cc Makefile - $(CXX) -o $@ $< + $(CXX) $(CXXFLAGS) -o $@ $< chmod 0755 address@hidden(EXEEXT) apidocs: ======================================================================== --- configure.ac 3c5b1e038f4c1436c9d021905bb86fbc48772349 +++ configure.ac 4cd637ba337c35746c0e0ff4716cf00d5e669dbd @@ -27,6 +27,8 @@ AC_PROG_RANLIB AC_LANG(C++) +AC_PROG_CXX_WARNINGS + AC_CXX_GNUCXX_HASHMAP AC_CXX_STLPORT_HASHMAP ======================================================================== --- m4/prog_cxx_warnings.m4 +++ m4/prog_cxx_warnings.m4 139fc00ee4d586ee79176dab19b0fc9e1338b83f @@ -0,0 +1,148 @@ +dnl @synopsis AC_PROG_CXX_WARNINGS([ANSI]) +dnl +dnl Enables a reasonable set of warnings for the C compiler. +dnl Optionally, if the first argument is nonempty, turns on flags which +dnl enforce and/or enable proper ANSI C if such are known with the +dnl compiler used. +dnl +dnl Currently this macro knows about GCC, Solaris C compiler, Digital +dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C +dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos +dnl 10.0.0.8) C compiler. +dnl +dnl for C++, some of them might not work, esp. because I didn't adapt +dnl the strings to compare compiler type. known to work are: +dnl GCC, Sun Studio +dnl +dnl based on VL_PROG_CC_WARNINGS by Ville Laurikari +dnl +dnl WORK IN PROGRESS: please don't release separately yet. +dnl patches welcome! +dnl +dnl @category Cxx +dnl @author Patrick Mauritz +dnl @version 2005-08-15 +dnl @license AllPermissive + +AC_DEFUN([AC_PROG_CXX_WARNINGS], [ + ansi=$1 + if test -z "$ansi"; then + msg="for C++ compiler warning flags" + else + msg="for C++ compiler warning and ANSI conformance flags" + fi + AC_CACHE_CHECK($msg, ac_cv_prog_cxx_warnings, [ + if test -n "$CXX"; then + cat > conftest.c <&1 | grep -i "WorkShop" > /dev/null 2>&1 && + $CXX -c -v -Xc conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cxx_warnings="-v" + else + ac_cv_prog_cxx_warnings="-v -Xc" + fi + + dnl Solaris C compiler (Studio) + dnl has warnings by default. not sure if additional warnings (+w) + dnl are really useful + elif $CXX -V 2>&1 | grep -i "SUN C++ 5" > /dev/null 2>&1 && + $CXX -c -v -Xc conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cxx_warnings="" + else + ac_cv_prog_cxx_warnings="" + fi + + dnl Digital Unix C compiler + elif $CXX -V 2>&1 | grep -i "Digital UNIX Compiler" > /dev/null 2>&1 && + $CXX -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cxx_warnings="-verbose -w0 -warnprotos" + else + ac_cv_prog_cxx_warnings="-verbose -w0 -warnprotos -std1" + fi + + dnl C for AIX Compiler + elif $CXX 2>&1 | grep -i "C for AIX Compiler" > /dev/null 2>&1 && + $CXX -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cxx_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" + else + ac_cv_prog_cxx_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi" + fi + + dnl IRIX C compiler + elif $CXX -version 2>&1 | grep -i "MIPSpro Compilers" > /dev/null 2>&1 && + $CXX -c -fullwarn -ansi -ansiE conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cxx_warnings="-fullwarn" + else + ac_cv_prog_cxx_warnings="-fullwarn -ansi -ansiE" + fi + + dnl HP-UX C compiler + elif what $CXX 2>&1 | grep -i "HP C Compiler" > /dev/null 2>&1 && + $CXX -c -Aa +w1 conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cxx_warnings="+w1" + else + ac_cv_prog_cxx_warnings="+w1 -Aa" + fi + + dnl The NEC SX-5 (Super-UX 10) C compiler + elif $CXX -V 2>&1 | grep "/SX" > /dev/null 2>&1 && + $CXX -c -pvctl[,]fullmsg -Xc conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cxx_warnings="-pvctl[,]fullmsg" + else + ac_cv_prog_cxx_warnings="-pvctl[,]fullmsg -Xc" + fi + + dnl The Cray C compiler (Unicos) + elif $CXX -V 2>&1 | grep -i "Cray" > /dev/null 2>&1 && + $CXX -c -h msglevel 2 conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cxx_warnings="-h msglevel 2" + else + ac_cv_prog_cxx_warnings="-h msglevel 2 -h conform" + fi + + fi + rm -f conftest.* + fi + if test -n "$ac_cv_prog_cxx_warnings"; then + CXXFLAGS="$CXXFLAGS $ac_cv_prog_cxx_warnings" + else + ac_cv_prog_cxx_warnings="unknown" + fi + ]) +])dnl