Changeset 02bc3c for util/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
  • util/configure.ac

    r79290f r02bc3c  
    44AC_PREREQ(2.59)
    55AC_INIT(PCP_Utilities, 1.0, heber@ins.uni-bonn.de)
    6 AC_CONFIG_SRCDIR([CreateGaAs.c])
     6AC_CONFIG_SRCDIR([src/CreateGaAs.c])
    77AC_CONFIG_HEADER([config.h])
    88
     
    1010
    1111# Checks for programs.
     12AC_PROG_CC
     13AC_PROG_CXX
     14AC_PATH_PROG([PERL],[perl])
    1215AC_PROG_AWK
    13 AC_PROG_CXX
    14 AC_PROG_CC
    15 AC_PATH_PROG([PERL],[perl])
    1616AM_MISSING_PROG([DOXYGEN], [doxygen])
    1717
    18 # Checks for libraries.
    19 AC_CHECK_LIB(m, sqrt, ,AC_MSG_ERROR([compatible libc math library not found]))
     18AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[debugging level of compiler. Argument is yes or debugging level. (default is no)]),
     19              [enable_debugging=$enableval], [enable_debugging=no])
     20AC_ARG_ENABLE([optimization],AS_HELP_STRING([--enable-optimization],[Optimization level of compiler. Argument is yes or optimization. (default is 2)]),
     21              [enable_optimization=$enableval], [enable_optimization=2])
     22AC_ARG_ENABLE([warnings], AS_HELP_STRING([--enable-warnings],[Output compiler warnings, argument is none, some or full (default is some).]),
     23              [enable_warnings=$enableval], [enable_warnings=some])
     24AC_SET_COMPILER_FLAGS([$enable_optimization], [$enable_debugging], [$enable_warnings])
    2025
    2126# Checks for header files.
     
    2732AC_TYPE_SIZE_T
    2833
    29 # debugging info
    30 AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Output debugging information, argument is yes or debugging level (default is no).]),
    31               [enable_debug=$enableval], [enable_debug=no])
    32 if ! test x"$enable_debug" = xno; then
    33         if test x"${enable_debug}" = xyes; then
    34                 CFLAGS="$CFLAGS -g3"
    35                 CXXFLAGS="$CXXFLAGS -g3"
    36         else
    37                 CFLAGS="$CFLAGS -g${enable_debug}"
    38                 CXXFLAGS="$CXXFLAGS -g${enable_debug}"
    39         fi
    40         dnl enable all warnings
    41         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"
    42         CXXFLAGS="$CXXFLAGS -Wall -W -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -Wredundant-decls -Wmissing-noreturn -Wformat-security -Wmissing-format-attribute -Winit-self"
    43   AC_DEFINE(HAVE_DEBUG,1, ["Output debugging info"])
    44   AC_SUBST(HAVE_DEBUG)
    45 else
    46         dnl even without debugging we want some minimal info of something's utterly wrong
    47         CFLAGS="$CFLAGS -Wall"
    48         CXXFLAGS="$CXXFLAGS -Wall"
    49 fi
    50 
    51 # optimization level
    52 AC_ARG_ENABLE([optimization],AS_HELP_STRING([--enable-optimization],[Optimization level of compiler. Argument is yes or debugging level. (default is 2)]),
    53               [enable_optimization=$enableval], [enable_optimization=yes])
    54 if test ! x"$enable_optimization" = xno; then
    55         if test x"$enable_debug" = xno; then
    56                 if test x"${enable_optimization}" = xyes; then
    57                         CFLAGS="-O2"
    58                         CXXFLAGS="-O2"
    59                 else
    60                         CFLAGS="-O${enable_optimization}"
    61                         CXXFLAGS="-O${enable_optimization}"
    62                 fi
    63 #       else
    64 #               AC_MSG_WARN(["Already specified --enable-debug!"])
    65         fi
    66 fi
    67 
    6834# Checks for library functions.
    6935AC_FUNC_MALLOC
    7036AC_FUNC_REALLOC
     37AC_CHECK_LIB(m, sqrt, ,AC_MSG_ERROR([compatible libc math library not found]))
    7138# check for GNU Scientific Library
    72 #AC_CHECK_LIB(m,main)
    7339AC_SEARCH_LIBS(cblas_sdot, blas cblas gslblas gslcblas)
    7440AC_CHECK_LIB(gsl,main)
     41
     42AC_MSG_NOTICE(["CFLAGS: $CFLAGS, CXXFLAGS: $CXXFLAGS, LDFLAGS: $LDFLAGS, CC: $CC, CXX:, $CXX, MPICC: $MPICC, MPILIBS: $MPILIBS, LIBS: $LIBS"])
    7543
    7644# test suite
     
    8048
    8149AC_CHECK_FUNCS([pow sqrt strchr strrchr strstr])
    82 AC_CONFIG_FILES([Makefile doc/Makefile])
    83 AC_CONFIG_FILES([CreateFromXYZ.sh dynamicANOVA.sh Nanotubes.pl ReSequenceDX.pl])
     50AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile])
     51AC_CONFIG_FILES([src/CreateFromXYZ.sh src/dynamicANOVA.sh src/Nanotubes.pl src/ReSequenceDX.pl])
    8452AC_OUTPUT
Note: See TracChangeset for help on using the changeset viewer.