Commit 19927b35 authored by balaji's avatar balaji
Browse files

Updated the default compilation options to be not added into mpicc and family.

parent 81e22283
......@@ -1319,45 +1319,29 @@ if test -z "$saveCFLAGS" -a -n "$CFLAGS" ; then
CFLAGS=$saveCFLAGS
fi
MPI_DEFAULT_COPTS="-O2"
if test "$compiler_optimizations" == "yes"; then
AC_MSG_CHECKING([whether $CC accepts -O2])
AC_MSG_CHECKING([whether $CC accepts default optimizations])
rm -f conftest.c
cat > conftest.c <<EOF
#include <stdio.h>
int main() { return 0; }
EOF
pac_tmp_compile_stderr_opt="$CC $CFLAGS -O2 -o conftest conftest.c 2> pac_tmp_compile_stderr_opt.out > /dev/null"
pac_tmp_compile_stderr_opt="$CC $CFLAGS ${MPI_DEFAULT_COPTS} -o conftest conftest.c 2> pac_tmp_compile_stderr_opt.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr_opt)
pac_tmp_compile_stderr="$CC $CFLAGS -o conftest conftest.c 2> pac_tmp_compile_stderr.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr)
pac_tmp_compile_stdout_opt="$CC $CFLAGS -O2 -o conftest conftest.c 2> /dev/null > pac_tmp_compile_stdout_opt.out"
pac_tmp_compile_stdout_opt="$CC $CFLAGS ${MPI_DEFAULT_COPTS} -o conftest conftest.c 2> /dev/null > pac_tmp_compile_stdout_opt.out"
AC_TRY_EVAL(pac_tmp_compile_stdout_opt)
pac_tmp_compile_stdout="$CC $CFLAGS -o conftest conftest.c 2> /dev/null > pac_tmp_compile_stdout.out"
AC_TRY_EVAL(pac_tmp_compile_stdout)
if test "`diff pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out`" != "" -o \
"`diff pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out`" != "" ; then
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether $CC accepts -xO2])
pac_tmp_compile_stderr_opt="$CC $CFLAGS -xO2 -o conftest conftest.c 2> pac_tmp_compile_stderr_opt.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr_opt)
pac_tmp_compile_stderr="$CC $CFLAGS -o conftest conftest.c 2> pac_tmp_compile_stderr.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr)
pac_tmp_compile_stdout_opt="$CC $CFLAGS -xO2 -o conftest conftest.c 2> /dev/null > pac_tmp_compile_stdout_opt.out"
AC_TRY_EVAL(pac_tmp_compile_stdout_opt)
pac_tmp_compile_stdout="$CC $CFLAGS -o conftest conftest.c 2> /dev/null > pac_tmp_compile_stdout.out"
AC_TRY_EVAL(pac_tmp_compile_stdout)
if test "`diff pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out`" != "" -o \
"`diff pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out`" != "" ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([Compiler does not accept -O2 or -xO2 optimization])
else
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -xO2"
fi
AC_MSG_WARN([Compiler does not accept default optimizations])
MPI_DEFAULT_COPTS=""
else
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -O2"
fi
rm -f pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out
rm -f conftest*
......@@ -1465,46 +1449,30 @@ elif test "$enable_f77" = "yes" ; then
FFLAGS=$saveFFLAGS
fi
MPI_DEFAULT_FOPTS="-O2"
if test "$enable_f77" = yes ; then
if test "$compiler_optimizations" == "yes"; then
AC_MSG_CHECKING([whether $F77 accepts -O2])
AC_MSG_CHECKING([whether $F77 accepts default optimizations])
rm -f conftest.f
cat > conftest.f <<EOF
program main
end
EOF
pac_tmp_compile_stderr_opt="$F77 $FFLAGS -O2 -o conftest conftest.f 2> pac_tmp_compile_stderr_opt.out > /dev/null"
pac_tmp_compile_stderr_opt="$F77 $FFLAGS ${MPI_DEFAULT_FOPTS} -o conftest conftest.f 2> pac_tmp_compile_stderr_opt.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr_opt)
pac_tmp_compile_stderr="$F77 $FFLAGS -o conftest conftest.f 2> pac_tmp_compile_stderr.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr)
pac_tmp_compile_stdout_opt="$F77 $FFLAGS -O2 -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout_opt.out"
pac_tmp_compile_stdout_opt="$F77 $FFLAGS ${MPI_DEFAULT_FOPTS} -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout_opt.out"
AC_TRY_EVAL(pac_tmp_compile_stdout_opt)
pac_tmp_compile_stdout="$F77 $FFLAGS -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout.out"
AC_TRY_EVAL(pac_tmp_compile_stdout)
if test "`diff pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out`" != "" -o \
"`diff pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out`" != "" ; then
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether $F77 accepts -xO2])
pac_tmp_compile_stderr_opt="$F77 $FFLAGS -xO2 -o conftest conftest.f 2> pac_tmp_compile_stderr_opt.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr_opt)
pac_tmp_compile_stderr="$F77 $FFLAGS -o conftest conftest.f 2> pac_tmp_compile_stderr.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr)
pac_tmp_compile_stdout_opt="$F77 $FFLAGS -xO2 -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout_opt.out"
AC_TRY_EVAL(pac_tmp_compile_stdout_opt)
pac_tmp_compile_stdout="$F77 $FFLAGS -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout.out"
AC_TRY_EVAL(pac_tmp_compile_stdout)
if test "`diff pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out`" != "" -o \
"`diff pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out`" != "" ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([Compiler does not accept -O2 or -xO2 optimization])
else
AC_MSG_RESULT(yes)
FFLAGS="$FFLAGS -xO2"
fi
AC_MSG_WARN([Compiler does not accept default optimizations])
MPI_DEFAULT_FOPTS=""
else
AC_MSG_RESULT(yes)
FFLAGS="$FFLAGS -O2"
fi
rm -f pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out
rm -f conftest*
......@@ -1612,46 +1580,30 @@ if test "$enable_f90" = "yes" -a "$enable_f77" != "yes" ; then
enable_f77=yes
fi
MPI_DEFAULT_F90OPTS="-O2"
if test "$enable_f90" = yes ; then
if test "$compiler_optimizations" == "yes"; then
AC_MSG_CHECKING([whether $F90 accepts -O2])
AC_MSG_CHECKING([whether $F90 accepts default optimizations])
rm -f conftest.f
cat > conftest.f <<EOF
program main
end
EOF
pac_tmp_compile_stderr_opt="$F90 $F90FLAGS -O2 -o conftest conftest.f 2> pac_tmp_compile_stderr_opt.out > /dev/null"
pac_tmp_compile_stderr_opt="$F90 $F90FLAGS ${MPI_DEFAULT_F90OPTS} -o conftest conftest.f 2> pac_tmp_compile_stderr_opt.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr_opt)
pac_tmp_compile_stderr="$F90 $F90FLAGS -o conftest conftest.f 2> pac_tmp_compile_stderr.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr)
pac_tmp_compile_stdout_opt="$F90 $F90FLAGS -O2 -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout_opt.out"
pac_tmp_compile_stdout_opt="$F90 $F90FLAGS ${MPI_DEFAULT_F90OPTS} -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout_opt.out"
AC_TRY_EVAL(pac_tmp_compile_stdout_opt)
pac_tmp_compile_stdout="$F90 $F90FLAGS -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout.out"
AC_TRY_EVAL(pac_tmp_compile_stdout)
if test "`diff pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out`" != "" -o \
"`diff pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out`" != "" ; then
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether $F90 accepts -xO2])
pac_tmp_compile_stderr_opt="$F90 $F90FLAGS -xO2 -o conftest conftest.f 2> pac_tmp_compile_stderr_opt.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr_opt)
pac_tmp_compile_stderr="$F90 $F90FLAGS -o conftest conftest.f 2> pac_tmp_compile_stderr.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr)
pac_tmp_compile_stdout_opt="$F90 $F90FLAGS -xO2 -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout_opt.out"
AC_TRY_EVAL(pac_tmp_compile_stdout_opt)
pac_tmp_compile_stdout="$F90 $F90FLAGS -o conftest conftest.f 2> /dev/null > pac_tmp_compile_stdout.out"
AC_TRY_EVAL(pac_tmp_compile_stdout)
if test "`diff pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out`" != "" -o \
"`diff pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out`" != "" ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([Compiler does not accept -O2 or -xO2 optimization])
else
AC_MSG_RESULT(yes)
F90FLAGS="$F90FLAGS -xO2"
fi
AC_MSG_WARN([Compiler does not accept default optimizations])
MPI_DEFAULT_F90OPTS=""
else
AC_MSG_RESULT(yes)
F90FLAGS="$F90FLAGS -O2"
fi
rm -f pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out
rm -f conftest*
......@@ -2287,46 +2239,30 @@ int main() {
fi
MPI_DEFAULT_CXXOPTS="-O2"
if test "$enable_cxx" = yes; then
if test "$compiler_optimizations" == "yes"; then
AC_MSG_CHECKING([whether $CXX accepts -O2])
AC_MSG_CHECKING([whether $CXX accepts default optimizations])
rm -f conftest.cpp
cat > conftest.cpp <<EOF
#include <iostream>
int main() { return 0; }
EOF
pac_tmp_compile_stderr_opt="$CXX $CXXFLAGS -O2 -o conftest conftest.cpp 2> pac_tmp_compile_stderr_opt.out > /dev/null"
pac_tmp_compile_stderr_opt="$CXX $CXXFLAGS ${MPI_DEFAULT_CXXOPTS} -o conftest conftest.cpp 2> pac_tmp_compile_stderr_opt.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr_opt)
pac_tmp_compile_stderr="$CXX $CXXFLAGS -o conftest conftest.cpp 2> pac_tmp_compile_stderr.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr)
pac_tmp_compile_stdout_opt="$CXX $CXXFLAGS -O2 -o conftest conftest.cpp 2> /dev/null > pac_tmp_compile_stdout_opt.out"
pac_tmp_compile_stdout_opt="$CXX $CXXFLAGS ${MPI_DEFAULT_CXXOPTS} -o conftest conftest.cpp 2> /dev/null > pac_tmp_compile_stdout_opt.out"
AC_TRY_EVAL(pac_tmp_compile_stdout_opt)
pac_tmp_compile_stdout="$CXX $CXXFLAGS -o conftest conftest.cpp 2> /dev/null > pac_tmp_compile_stdout.out"
AC_TRY_EVAL(pac_tmp_compile_stdout)
if test "`diff pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out`" != "" -o \
"`diff pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out`" != "" ; then
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether $CXX accepts -xO2])
pac_tmp_compile_stderr_opt="$CXX $CXXFLAGS -xO2 -o conftest conftest.cpp 2> pac_tmp_compile_stderr_opt.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr_opt)
pac_tmp_compile_stderr="$CXX $CXXFLAGS -o conftest conftest.cpp 2> pac_tmp_compile_stderr.out > /dev/null"
AC_TRY_EVAL(pac_tmp_compile_stderr)
pac_tmp_compile_stdout_opt="$CXX $CXXFLAGS -xO2 -o conftest conftest.cpp 2> /dev/null > pac_tmp_compile_stdout_opt.out"
AC_TRY_EVAL(pac_tmp_compile_stdout_opt)
pac_tmp_compile_stdout="$CXX $CXXFLAGS -o conftest conftest.cpp 2> /dev/null > pac_tmp_compile_stdout.out"
AC_TRY_EVAL(pac_tmp_compile_stdout)
if test "`diff pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out`" != "" -o \
"`diff pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out`" != "" ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([Compiler does not accept -O2 or -xO2 optimization])
else
AC_MSG_RESULT(yes)
CXXFLAGS="$CXXFLAGS -xO2"
fi
AC_MSG_WARN([Compiler does not accept default optimizations])
MPI_DEFAULT_CXXOPTS=""
else
AC_MSG_RESULT(yes)
CXXFLAGS="$CXXFLAGS -O2"
fi
rm -f pac_tmp_compile_stderr_opt.out pac_tmp_compile_stderr.out pac_tmp_compile_stdout_opt.out pac_tmp_compile_stdout.out
rm -f conftest*
......@@ -5688,18 +5624,34 @@ AC_OUTPUT_COMMANDS([chmod a+x test/commands/cmdtests])
# reason, the user needs different flags in the compilation scripts,
# they can override the choice in CFLAGS etc. by setting MPI_CFLAGS.
#
if test -z "$MPI_CFLAGS" -a -n "$CFLAGS" ; then
if test "$MPI_CFLAGS" = "MPI_FLAGS_EMPTY" ; then
MPI_CFLAGS=""
elif test -z "$MPI_CFLAGS" -a -n "$CFLAGS" ; then
MPI_CFLAGS="$CFLAGS"
fi
if test -z "$MPI_CXXFLAGS" -a -n "$CXXFLAGS" ; then
CFLAGS="$CFLAGS $MPI_DEFAULT_COPTS"
if test "MPI_CXXFLAGS" = "MPI_FLAGS_EMPTY" ; then
MPI_CXXFLAGS=""
elif test -z "$MPI_CXXFLAGS" -a -n "$CXXFLAGS" ; then
MPI_CXXFLAGS="$CXXFLAGS"
fi
if test -z "$MPI_FFLAGS" -a -n "$FFLAGS" ; then
CXXFLAGS="$CXXFLAGS $MPI_DEFAULT_CXXOPTS"
if test "MPI_FFLAGS" = "MPI_FLAGS_EMPTY" ; then
MPI_FFLAGS=""
elif test -z "$MPI_FFLAGS" -a -n "$FFLAGS" ; then
MPI_FFLAGS="$FFLAGS"
fi
if test -z "$MPI_F90FLAGS" -a -n "$F90FLAGS" ; then
FFLAGS="$FFLAGS $MPI_DEFAULT_FOPTS"
if test "MPI_F90FLAGS" = "MPI_FLAGS_EMPTY" ; then
MPI_F90FLAGS=""
elif test -z "$MPI_F90FLAGS" -a -n "$F90FLAGS" ; then
MPI_F90FLAGS="$F90FLAGS"
fi
F90FLAGS="$F90FLAGS $MPI_DEFAULT_F90OPTS"
export MPI_CFLAGS
export MPI_FFLAGS
export MPI_CXXFLAGS
......
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