Changeset 90


Ignore:
Timestamp:
Jul 10, 2006 2:45:54 PM (13 years ago)
Author:
andreasw
Message:

fix from Lou: run_autotools reads m4 subdir; changed debug flags and define handling

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/coin.m4

    r87 r90  
    287287###########################################################################
    288288
    289 # enable the configure flag --enable-debug and set the variable
    290 # coin_debug_compile to true or false
    291 # This is used by COIN_PROG_CXX, COIN_PROG_CC and COIN_PROG_F77
    292 # to determine the compilation flags.
    293 # It defines the #define macro COIN_DEBUG if it is chosen, and the makefile
    294 # conditional COIN_DEBUG is defined
     289# enable the configure flags --enable-debug and --enable-debug-prjct
     290# (where prcjt is the name of the project in lower case) and set the
     291# variable coin_debug_compile to true or false This is used by
     292# COIN_PROG_CXX, COIN_PROG_CC and COIN_PROG_F77 to determine the
     293# compilation flags.  This macro also makes the switches
     294# --with-prjct-verbosity and --with-prjct-checklevel available, which
     295# define the preprocessor macros COIN_PRJCT_VERBOSITY and
     296# COIN_PRJCT_CHECKLEVEL to the specified value (default is 0).
     297#
     298# The project specific flags are only made available, if one gives the
     299# name of the project as first argument to this macro.
    295300
    296301AC_DEFUN([AC_COIN_DEBUG_COMPILE],
     
    303308AC_ARG_ENABLE([debug],
    304309[AC_HELP_STRING([--enable-debug],
    305                 [compile with debug options and runtime tests])],
    306                 [case "${enableval}" in
    307                    yes) coin_debug_compile=true
    308                      AC_DEFINE([COIN_DEBUG],[1],
    309                                [If defined, debug sanity checks are performed during runtime])
    310                      enable_shared=no
    311                      ;;
    312                    no)  coin_debug_compile=false
    313                      ;;
    314                     *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
    315                      ;;
    316                  esac],
    317                 [coin_debug_compile=false])
     310                [compile all projects with debug options tests])],
     311[case "${enableval}" in
     312   yes) coin_debug_compile=true
     313        enable_shared=no
     314        ;;
     315   no)  coin_debug_compile=false
     316        ;;
     317   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
     318        ;;
     319esac],
     320[coin_debug_compile=false])
     321
     322m4_ifvaln([$1],
     323[AC_ARG_ENABLE(debug-m4_tolower($1),
     324 [AC_HELP_STRING([--enable-debug-m4_tolower($1)],
     325                 [compile this project ($1) with debug options])],
     326 [case "${enableval}" in
     327    yes) coin_debug_compile=true
     328         enable_shared=no
     329         ;;
     330    no)  coin_debug_compile=false
     331         ;;
     332    *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-m4_tolower($1))
     333         ;;
     334 esac],[:])
     335]) # m4_ifvaln([$1],
    318336
    319337if test $coin_debug_compile = true; then
     
    323341fi
    324342
    325 AM_CONDITIONAL([COIN_DEBUG],[test "$coin_debug_compile" = true])
     343m4_ifvaln([$1],
     344[AC_ARG_WITH(m4_tolower($1)-verbosity,
     345             AC_HELP_STRING([--with-m4_tolower($1)-verbosity],
     346                            [specify the debug verbosity level for project $1]),
     347             [m4_tolower(coin_$1_verbosity)=$withval],
     348             [m4_tolower(coin_$1_verbosity)=0])
     349 AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_VERBOSITY),
     350                    m4_tolower($coin_$1_verbosity),
     351                    [Define to the debug verbosity level (0 is no output)])
     352
     353 AC_ARG_WITH(m4_tolower($1)-checklevel,
     354             AC_HELP_STRING([--with-m4_tolower($1)-checklevel],
     355                            [specify the sanity check level for project $1]),
     356             [m4_tolower(coin_$1_checklevel)=$withval],
     357             [m4_tolower(coin_$1_checklevel)=0])
     358 AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_CHECKLEVEL),
     359                    m4_tolower($coin_$1_checklevel),
     360                    [Define to the debug sanity check level (0 is no test)])
     361
     362# We use the following variable to have a string with the upper case
     363# version of the project name
     364COIN_PRJCT=m4_toupper($1)
     365
     366]) # m4_ifvaln([$1],
     367 
    326368]) # AC_COIN_DEBUG_COMPILE
    327369
     
    357399
    358400AC_ARG_VAR(CXXDEFS,[Additional -D flags to be used when compiling C++ code.])
     401AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options])
     402AC_ARG_VAR(DBG_CXXFLAGS,[Debug C++ compiler options])
     403AC_ARG_VAR(OPT_CXXFLAGS,[Optimize C++ compiler options])
    359404
    360405coin_has_cxx=yes
     
    365410             comps="g++ cl" ;;
    366411  *-darwin*) comps="g++ c++ CC" ;;
    367           *) comps="xlC aCC CC g++ c++ pgCC icpc" ;;
     412          *) comps="xlC aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;;
    368413esac
    369414
    370415# We delete the cached value, since the test might not have been
    371416# performed with out choise of compilers earlier
    372 ac_cv_prog_CXX=
     417$as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; }
    373418AC_PROG_CXX([$comps])
    374419CXXFLAGS="$save_cxxflags"
    375420
    376 AC_CACHE_CHECK([for C++ compiler options],[coin_cv_cxxflags],
    377 [if test x"$CXXFLAGS" = x; then
     421# Check if a project specific CXXFLAGS variable has been set
     422if test x$COIN_PRJCT != x; then
     423  eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set}
     424  if test x$coin_tmp = xset; then
     425    eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS}
     426  fi
     427fi
     428
     429if test x"$CXXFLAGS" = x; then
    378430
    379431# ToDo decide whether we want -DNDEBUG for optimization
     
    463515  fi
    464516
     517  if test -z "$coin_opt_cxxflags"; then
     518    # Try if -O option works if nothing else is set
     519    CXXFLAGS=-O
     520    AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"])
     521  fi
     522
     523  if test x${DBG_CXXFLAGS+set} != xset; then
     524    DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags"
     525  fi
     526  if test x${OPT_CXXFLAGS+set} != xset; then
     527    OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags"
     528  fi
     529
     530  DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
     531  OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
     532
    465533  if test "$coin_debug_compile" = "true"; then
    466     CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $CXXDEFS $coin_warn_cxxflags"
     534    CXXFLAGS="$DBG_CXXFLAGS"
    467535  else
    468     if test -z "$coin_opt_cxxflags"; then
    469       # Try if -O option works if nothing else is set
    470       CXXFLAGS="-O"
    471       AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"])
    472     fi
    473     CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $CXXDEFS $coin_warn_cxxflags"
    474   fi
    475 fi
    476 
    477 # Check if user wants to have additional CXXFLAGS options
    478 AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options])
    479 if test x"$ADD_CXXFLAGS" != x; then
    480   CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS"
     536    CXXFLAGS="$OPT_CXXFLAGS"
     537  fi
     538else
     539  CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
     540  if test x${DBG_CXXFLAGS+set} != xset; then
     541    DBG_CXXFLAGS="$CXXFLAGS"
     542  fi
     543  if test x${OPT_CXXFLAGS+set} != xset; then
     544    OPT_CXXFLAGS="$CXXFLAGS"
     545  fi
    481546fi
    482547
    483548# Try if CXXFLAGS works
     549save_CXXFLAGS="$CXXFLAGS"
    484550AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
    485551if test -z "$CXXFLAGS"; then
    486   AC_MSG_WARN([The flags CXXFLAGS="$CXXFLAGS" do not work.  I will now just try '-O', but you might want to set CXXFLAGS manually.])
     552  AC_MSG_WARN([The flags CXXFLAGS="$save_CXXFLAGS" do not work.  I will now just try '-O', but you might want to set CXXFLAGS manually.])
    487553  CXXFLAGS='-O'
    488554  AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
     
    491557  fi
    492558fi
    493 coin_cv_cxxflags="$CXXFLAGS"
    494 ]) # AC_CACHE_CHECK([for C++ compiler options CXXFLAGS]
    495 CXXFLAGS="$coin_cv_cxxflags"
     559
     560AC_MSG_NOTICE([C++ compiler options are: $CXXFLAGS])
    496561
    497562AC_ARG_VAR(MPICXX,[C++ MPI Compiler])
     
    639704
    640705AC_ARG_VAR(CDEFS,[Additional -D flags to be used when compiling C code.])
     706AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options])
     707AC_ARG_VAR(DBG_CFLAGS,[Debug C compiler options])
     708AC_ARG_VAR(OPT_CFLAGS,[Optimize C compiler options])
    641709
    642710coin_has_cc=yes
     
    647715             comps="gcc cl" ;;
    648716  *-linux-*) comps="xlc gcc cc pgcc icc" ;;
    649   *)         comps="xlc cc gcc pgcc icc" ;;
     717  *)         comps="xlc_r xlc cc gcc pgcc icc" ;;
    650718esac
    651719
    652720# We delete the cached value, since the test might not have been
    653721# performed with out choise of compilers earlier
    654 ac_cv_prog_CC=
     722$as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; }
    655723AC_PROG_CC([$comps])
    656724CFLAGS="$save_cflags"
    657725
    658 AC_CACHE_CHECK([for C compiler options],[coin_cv_cflags],
    659 [if test x"$CFLAGS" = x; then
     726# Check if a project specific CFLAGS variable has been set
     727if test x$COIN_PRJCT != x; then
     728  eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set}
     729  if test x$coin_tmp = xset; then
     730    eval CFLAGS=\${${COIN_PRJCT}_CFLAGS}
     731  fi
     732fi
     733
     734if test x"$CFLAGS" = x; then
    660735
    661736  coin_add_cflags=
     
    743818  fi
    744819
     820  if test -z "$coin_opt_cflags"; then
     821    # Try if -O option works if nothing else is set
     822    CFLAGS="-O"
     823    AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"])
     824  fi
     825
     826  if test x${DBG_CFLAGS+set} != xset; then
     827    DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags"
     828  fi
     829  if test x${OPT_CFLAGS+set} != xset; then
     830    OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags"
     831  fi
     832
     833  DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS"
     834  OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS"
     835
    745836  if test "$coin_debug_compile" = "true"; then
    746     CFLAGS="$coin_dbg_cflags $coin_add_cflags $CDEFS $coin_warn_cflags"
     837    CFLAGS="$DBG_CFLAGS"
    747838  else
    748     if test -z "$coin_opt_cflags"; then
    749       # Try if -O option works if nothing else is set
    750       CFLAGS="-O"
    751       AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"],[])
    752     fi
    753     CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $CDEFS $coin_warn_cflags"
     839    CFLAGS="$OPT_CFLAGS"
     840  fi
     841else
     842  CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS"
     843  if test x${DBG_CFLAGS+set} != xset; then
     844    DBG_CFLAGS="$CFLAGS"
     845  fi
     846  if test x${OPT_CFLAGS+set} != xset; then
     847    OPT_CFLAGS="$CFLAGS"
    754848  fi
    755849fi
     
    762856
    763857# Try if CFLAGS works
     858save_CFLAGS="$CFLAGS"
    764859AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
    765860if test -z "$CFLAGS"; then
    766   AC_MSG_WARN([The value CFLAGS="$CFLAGS" do not work.  I will now just try '-O', but you might want to set CFLAGS manually.])
     861  AC_MSG_WARN([The value CFLAGS="$save_CFLAGS" do not work.  I will now just try '-O', but you might want to set CFLAGS manually.])
    767862  CFLAGS='-O'
    768863  AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
     
    771866  fi
    772867fi
    773 coin_cv_cflags="$CFLAGS"
    774 ]) # AC_CACHE_CHECK([for C compiler options CXXFLAGS]
    775 CFLAGS="$coin_cv_cflags"
     868
     869AC_MSG_NOTICE([C compiler options are: $CFLAGS])
    776870
    777871AC_ARG_VAR(MPICC,[C MPI Compiler])
     
    804898AC_LANG_PUSH([Fortran 77])
    805899
     900AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options])
     901AC_ARG_VAR(DBG_FFLAGS,[Debug Fortran compiler options])
     902AC_ARG_VAR(OPT_FFLAGS,[Optimize Fortran compiler options])
     903
    806904coin_has_f77=yes
    807905
     
    809907case $build in
    810908  *-cygwin* | *-mingw*)
    811              comps="gfortran g77 ifort" ;;
    812   *)         comps="xlf fort77 gfortran f77 g77 pgf90 pgf77 ifort ifc" ;;
     909             comps="gfortran g77 ifort fl32" ;;
     910  *)         comps="xlf fort77 gfortran f77 g77 pgf90 pgf77 ifort ifc frt af77" ;;
    813911esac
    814912
    815913# We delete the cached value, since the test might not have been
    816914# performed with out choise of compilers earlier
    817 ac_cv_prog_F77=
     915$as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; }
    818916AC_PROG_F77($comps)
    819917FFLAGS="$save_fflags"
    820918
    821 AC_CACHE_CHECK([for Fortran compiler options],[coin_cv_fflags],
    822 [if test x"$FFLAGS" = x; then
     919# Check if a project specific FFLAGS variable has been set
     920if test x$COIN_PRJCT != x; then
     921  eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set}
     922  if test x$coin_tmp = xset; then
     923    eval FFLAGS=\${${COIN_PRJCT}_FFLAGS}
     924  fi
     925fi
     926
     927if test x"$FFLAGS" = x; then
    823928
    824929  coin_add_fflags=
     
    8971002  fi
    8981003
    899   if test "$coin_debug_compile" = true; then
    900     FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags"
     1004  if test -z "$coin_opt_fflags"; then
     1005    # Try if -O option works if nothing else is set
     1006    FFLAGS=-O
     1007    AC_TRY_LINK([],[      integer i], [coin_opt_fflags="-O"])
     1008  fi
     1009
     1010  if test x${DBG_FFLAGS+set} != xset; then
     1011    DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags"
     1012  fi
     1013  if test x${OPT_FFLAGS+set} != xset; then
     1014    OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags -DNDEBUG $coin_warn_fflags"
     1015  fi
     1016
     1017  DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS"
     1018  OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS"
     1019
     1020  if test "$coin_debug_compile" = "true"; then
     1021    FFLAGS="$DBG_FFLAGS"
    9011022  else
    902     if test -z "$coin_opt_fflags"; then
    903       # Try if -O option works if nothing else is set
    904       FFLAGS=-O
    905       AC_TRY_LINK([],[      integer i],
    906                   [coin_opt_fflags="-O"])
    907     fi
    908     FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags"
    909   fi
    910 fi
    911 
    912 # Check if user wants to have additional FFLAGS options
    913 AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options])
    914 if test x"$ADD_FFLAGS" != x; then
     1023    FFLAGS="$OPT_FFLAGS"
     1024  fi
     1025else
    9151026  FFLAGS="$FFLAGS $ADD_FFLAGS"
     1027  if test x${DBG_FFLAGS+set} != xset; then
     1028    DBG_FFLAGS="$FFLAGS"
     1029  fi
     1030  if test x${OPT_FFLAGS+set} != xset; then
     1031    OPT_FFLAGS="$FFLAGS"
     1032  fi
    9161033fi
    9171034
     
    9261043  fi
    9271044fi
    928 coin_cv_fflags="$FFLAGS"
    929 ]) # AC_CACHE_CHECK([for Fortran compiler options FFLAGS]
    930 FFLAGS="$coin_cv_fflags"
     1045
     1046AC_MSG_NOTICE([Fortran compiler options are: $FFLAGS])
    9311047
    9321048AC_ARG_VAR(MPIF77,[Fortran MPI Compiler])
  • trunk/run_autotools

    r37 r90  
    8484     cat $AUTOTOOLS_DIR/share/aclocal/libtool.m4 $toolsdir/coin.m4> acinclude.m4
    8585     echo running aclocal in $dir
    86      aclocal
     86     if test -d m4; then
     87       aclocal -I m4
     88     else
     89       aclocal
     90     fi
    8791     if grep AC_CONFIG_HEADER configure.ac >/dev/null 2>&1; then
    8892       echo running autoheader in $dir
Note: See TracChangeset for help on using the changeset viewer.