Changeset 02bc3c for pcp/configure.ac


Ignore:
Timestamp:
Jun 7, 2008, 1:16:19 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
1f4209
Parents:
79290f
Message:

new aclocal macro with controles all the enable-debug/optimization/warning in a unified manner and still keeps packages independent of each other.

Note that Ralf suggested specifying optimizations in CFLAGS directly, due to the load of activateable warnings, i saw it rather fit to make such a configure option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pcp/configure.ac

    r79290f r02bc3c  
    1212AC_CANONICAL_HOST
    1313
     14if test x"$CFLAGS" = x; then
     15        CFLAGS_empty=1
     16else
     17        CFLAGS_empty=0
     18fi
     19if test x"$CXXFLAGS" = x; then
     20        CXXFLAGS_empty=1
     21else
     22        CXXFLAGS_empty=0
     23fi
     24
    1425# Checks for programs.
    1526AC_PROG_CC
     
    1829AC_PATH_PROG([TAR],[tar])
    1930AM_MISSING_PROG([DOXYGEN], [doxygen])
     31
     32# Resetting C(XX)FLAGS again
     33if test $CFLAGS_empty -eq 1; then
     34        CFLAGS=""
     35fi
     36if test $CXXFLAGS_empty -eq 1; then
     37        CXXFLAGS=""
     38fi
     39
    2040
    2141dnl Check for MPI-Routines
     
    4363                AC_ARG_VAR([MPICXX],[necessary comnpiler for MPI CPP code])
    4464                #AM_CONDITIONAL([MPIVER], [test x"$enable_mpi" = xyes])
    45                 AC_MSG_WARN(["MPICC: $MPICC, MPILIBS: $MPILIBS, MPIVER: $MPIVER, CC: $CC"])
     65                AC_MSG_NOTICE(["MPICC: $MPICC, MPILIBS: $MPILIBS, MPIVER: $MPIVER, CC: $CC"])
    4666                # if CC not set, set to MPICC
    4767                if ! test x"$MPICC" = x; then
     
    6181        AC_MSG_NOTICE([$disabled_msg])
    6282fi
     83
     84AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[debugging level of compiler. Argument is yes or debugging level. (default is no)]),
     85              [enable_debugging=$enableval], [enable_debugging=no])
     86AC_ARG_ENABLE([optimization],AS_HELP_STRING([--enable-optimization],[Optimization level of compiler. Argument is yes or optimization. (default is 2)]),
     87              [enable_optimization=$enableval], [enable_optimization=2])
     88AC_ARG_ENABLE([warnings], AS_HELP_STRING([--enable-warnings],[Output compiler warnings, argument is none, some or full (default is some).]),
     89              [enable_warnings=$enableval], [enable_warnings=some])
     90AC_SET_COMPILER_FLAGS([$enable_optimization], [$enable_debugging], [$enable_warnings])
    6391
    6492# Checks for typedefs, structures, and compiler characteristics.
     
    93121              [enable_fftw3=$enableval], [enable_fftw3=maybe])
    94122             
    95 # debugging info
    96 AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Output debugging information, argument is yes or debugging level (default is no).]),
    97               [enable_debug=$enableval], [enable_debug=no])
    98 if ! test x"$enable_debug" = xno; then
    99         if test x"${enable_debug}" = xyes; then
    100                 CFLAGS="$CFLAGS -g3"
    101                 CXXFLAGS="$CXXFLAGS -g3"
    102         else
    103                 CFLAGS="$CFLAGS -g${enable_debug}"
    104                 CXXFLAGS="$CXXFLAGS -g${enable_debug}"
    105         fi
    106         dnl enable all warnings
    107         CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -Wredundant-decls -Wnested-externs -Wmissing-noreturn -Wformat-security -Wmissing-format-attribute -Winit-self"
    108         CXXFLAGS="$CXXFLAGS -Wall -W -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -Wredundant-decls -Wmissing-noreturn -Wformat-security -Wmissing-format-attribute -Winit-self"
    109   AC_DEFINE(HAVE_DEBUG,1, ["Output debugging info"])
    110   AC_SUBST(HAVE_DEBUG)
    111 else
    112         dnl even without debugging we want some minimal info of something's utterly wrong
    113         CFLAGS="$CFLAGS -Wall"
    114         CXXFLAGS="$CXXFLAGS -Wall"
    115 fi
    116 
    117 # optimization level
    118 AC_ARG_ENABLE([optimization],AS_HELP_STRING([--enable-optimization],[Optimization level of compiler. Argument is yes or debugging level. (default is 2)]),
    119               [enable_optimization=$enableval], [enable_optimization=yes])
    120 if ! test x"$enable_optimization" = xno; then
    121         if test x"$enable_debug" = xno; then
    122                 if test x"${enable_optimization}" = xyes; then
    123                         CFLAGS="$CFLAGS -O2"
    124                         CXXFLAGS="$CXXFLAGS -O2"
    125                 else
    126                         CFLAGS="$CFLAGS -O${enable_optimization}"
    127                         CXXFLAGS="$CXXFLAGS -O${enable_optimization}"
    128                 fi
    129         #else
    130                 #AC_MSG_WARN(["Already specified --enable-debug!"])
    131         fi
    132 fi
    133 
    134123# Checks for header files.
    135124AC_HEADER_STDC
     
    179168# check for GNU Scientific Library
    180169#AC_CHECK_LIB(m,main)
     170AC_CHECK_HEADERS([gsl/gsl_blas.h])
    181171AC_SEARCH_LIBS(cblas_sdot, blas cblas gslblas gslcblas)
    182172AC_CHECK_LIB(gsl, main)
     
    199189fi
    200190
     191AC_MSG_NOTICE(["CFLAGS: $CFLAGS, CXXFLAGS: $CXXFLAGS, LDFLAGS: $LDFLAGS, CC: $CC, CXX:, $CXX, MPICC: $MPICC, MPILIBS: $MPILIBS, LIBS: $LIBS"])
     192
    201193# test suite
    202194AC_CONFIG_TESTDIR(tests)
Note: See TracChangeset for help on using the changeset viewer.