Commit fa77e14c authored by Ron Rahaman's avatar Ron Rahaman
Browse files

Implemented debug and optimization flags

parent aeca694c
......@@ -11,6 +11,14 @@ AC_INIT([Nek5000], [1.0], [nek5000-users@lists.mcs.anl.gov])
# COMMAND-LINE OPTS
###############################################################################
AC_ARG_ENABLE([debug],
[AC_HELP_STRING([--disable-debug]), [compile without debug flags (-g) @<:@default: enabled@:>@]],
[debug="$enableval"], [debug="yes"])
AC_ARG_ENABLE([opt],
[AC_HELP_STRING([--enable-opt]), [compile with optimization flags (-O3) @<:@default: disabled@:>@]],
[opt="$enableval"], [opt="no"])
AC_ARG_ENABLE([mpi],
[AS_HELP_STRING([--disable-mpi], [compile without mpi @<:@default: enabled@:>@])],
[mpi=${enableval}], [mpi=yes])
......@@ -70,12 +78,15 @@ AC_ARG_ENABLE([extbar],
###############################################################################
# C compiler checks
AC_PROG_CC
AC_PROG_CC_C_O
: ${CFLAGS=""} # Do not use autconf's default "-g -O2"
AC_PROG_CC # Validate C Compiler
AC_PROG_CC_C_O # Necessary for automake
AC_CHECK_SIZEOF([int *]) # Get sizeof int*, set SIZEOF_INT_P. If SIZEOF_INT_P == 8, then Nek needs -DPTRSIZE8
AC_CHECK_SIZEOF([long int]) # Get sizeof long int, set SIZEOF_LONG_INT
# F77 compiler checks
# Fortran compiler checks
: ${FFLAGS="$FFLAGS"} # Do not use autconf's default "-g -O2"
: ${FCFLAGS="$FCFLAGS"} # Do not use autconf's default "-g -O2"
AC_PROG_F77 # Validate F77 compiler
AC_PROG_F77_C_O # Necessary for automake
AC_F77_LIBRARY_LDFLAGS # Determine -l and -L flags, append to $FLIBS
......@@ -91,8 +102,9 @@ FC="$old_fc"
# FIND F77 FLAG FOR DEFAULT 8-BYTE FLOATS
###############################################################################
real8_fflags=""
AC_LANG_PUSH([Fortran 77])
old_fflags="$FFLAGS"
real8_fflags=""
for flag in dnl
"-r8 -fpconstant" dnl Intel
"-r8" dnl PGI, some others
......@@ -100,7 +112,6 @@ for flag in dnl
"-qrealsize=8 -qdpc=e" dnl IBM
"-s default64"; dnl Cray
do
old_fflags="$FFLAGS"
FFLAGS="$flag"
AC_MSG_CHECKING([if Fortran 77 compiler accepts $flag])
AC_COMPILE_IFELSE(
......@@ -122,6 +133,24 @@ fi
# SET NEK's PREPROCESSOR MACROS
###############################################################################
# Enable debug flags
if test "x$debug" = "xyes"; then
CFLAGS="-g $CFLAGS"
FFLAGS="-g $FFLAGS"
FCFLAGS="-g $FCFLAGS"
fi
# Enable optimization flags
if test "x$opt" = "xyes" || "x$bgq" = "xyes"; then
CFLAGS="-O3 $CFLAGS"
FFLAGS="-O3 $FFLAGS"
FCFLAGS="-O3 $FCFLAGS"
else
CFLAGS="-O2 $CFLAGS"
FFLAGS="-O2 $FFLAGS"
FCFLAGS="-O2 $FCFLAGS"
fi
# Check if pointer size == 8
if test "$ac_cv_sizeof_int_p" -eq 8; then
AC_DEFINE([PTRSIZE8], 1, [If sizeof *int is 8])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment