Commit 491a8cf5 authored by vijaysm's avatar vijaysm
Browse files

Update flags specific for BG/Q (Mira) to make sure configuration works out of the box.

parent ac03b1a8
# Original source:
# https://github.com/mpip/pfft/blob/master/m4/ac_fc_pp_define.m4
# This macro has been submitted for inclusion into the Autoconf 2.69 tree.
# Use the upstream version when it is defined.
m4_version_prereq([2.69], [],
[
# AC_FC_PP_DEFINE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
# -------------------------------------------------------------------
# Find a flag to specify defines for preprocessed Fortran. Not all
# Fortran compilers use -D. Substitutes FC_DEFINE with the result and
# calls ACTION-IF-SUCCESS (defaults to nothing) if successful, and
# ACTION-IF-FAILURE (defaults to failing with an error message) if not.
#
# Known flags:
# IBM: -WF,-D
# Lahey/Fujitsu: -Wp,-D older versions???
# f2c: -D or -Wc,-D
# others: -D
AC_DEFUN([AC_FC_PP_DEFINE],
[AC_LANG_PUSH([Fortran])dnl
ac_fc_pp_define_srcext_save=$ac_fc_srcext
AC_FC_SRCEXT([F])
AC_CACHE_CHECK([how to define symbols for preprocessed Fortran],
[ac_cv_fc_pp_define],
[ac_fc_pp_define_srcext_save=$ac_fc_srcext
ac_cv_fc_pp_define=unknown
ac_fc_pp_define_FCFLAGS_save=$FCFLAGS
for ac_flag in -D -WF,-D -Wp,-D -Wc,-D
do
FCFLAGS="$ac_fc_pp_define_FCFLAGS_save ${ac_flag}FOOBAR ${ac_flag}ZORK=42"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
#ifndef FOOBAR
choke me
#endif
#if ZORK != 42
choke me
#endif]])],
[ac_cv_fc_pp_define=$ac_flag; break])
done
FCFLAGS=$ac_fc_pp_define_FCFLAGS_save
])
ac_fc_srcext=$ac_fc_pp_define_srcext_save
if test "x$ac_cv_fc_pp_define" = xunknown; then
FC_DEFINE=
m4_default([$2],
[AC_MSG_ERROR([Fortran does not allow to define preprocessor symbols], 77)])
else
FC_DEFINE=$ac_cv_fc_pp_define
$1
fi
AC_SUBST([FC_DEFINE])dnl
AC_LANG_POP([Fortran])dnl
])
])dnl m4_version_prereq([2.69])
# This macro has been submitted for inclusion into the Autoconf 2.69 tree.
# Use the upstream version when it is defined.
m4_version_prereq([2.69], [],
[
# AC_FC_PP_SRCEXT(EXT, [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
# --------------------------------------------------------------
# Like AC_FC_SRCEXT, set the source-code extension used in Fortran (FC) tests
# to EXT (which defaults to f). Also, look for any necessary additional
# FCFLAGS needed to allow this extension for preprocessed Fortran, and store
# them in the output variable FCFLAGS_<EXT> (e.g. FCFLAGS_f90 for EXT=f90).
# If successful, call ACTION-IF-SUCCESS. If unable to compile preprocessed
# source code with EXT, call ACTION-IF-FAILURE, which defaults to failing with
# an error message.
#
# Some compilers allow preprocessing with either a Fortran preprocessor or
# with the C preprocessor (cpp). Prefer the Fortran preprocessor, to deal
# correctly with continuation lines, `//' (not a comment), and preserve white
# space (for fixed form).
#
# (The flags for the current source-code extension, if any, are stored in
# $ac_fcflags_srcext and used automatically in subsequent autoconf tests.)
#
# For ordinary extensions like f90, etcetera, the modified FCFLAGS
# are needed for IBM's xlf*. Also, for Intel's ifort compiler, the
# $FCFLAGS_<EXT> variable *must* go immediately before the source file on the
# command line, unlike other $FCFLAGS. Ugh.
#
# gfortran 4.4.3 does not fail upon nonexistent header file, nor upon
# the standard Autoconf fail string `choke me'. Go figure.
#
# Known extensions that enable preprocessing by default, and flags to force it:
# GNU: .F .F90 .F95 .F03 .F08, -cpp for most others,
# -x f77-cpp-input for .f77 .F77; -x f95-cpp-input for gfortran < 4.4
# SGI: .F .F90, -ftpp or -cpp for .f .f90
# SUN: .F .F95, -fpp for others; -xpp={fpp,cpp} for preprocessor selection
# IBM: .F .F77 .F90 .F95 .F03, -qsuffix=cpp=EXT for extension .EXT to invoke cpp
# -WF,-qnofpp -WF,-qfpp=comment:linecont:nocomment:nolinecont
# -WF,-qlanglvl=classic or not -qnoescape (trigraph problems)
# HP: .F, +cpp={yes|no|default} use cpp, -cpp
# PGI: -Mpreprocess
# Absoft: .F .FOR .F90 .F95, -cpp for others
# Cray: .F .F90 .FTN, -e Z for others
# Intel: .F .F90, -fpp for others, but except for .f and .f90, -Tf may also be
# needed right before the source file name
# PathScale: .F .F90 .F95, -ftpp or -cpp for .f .f90 .f95
# Lahey: .F .FOR .F90 .F95, -Cpp
AC_DEFUN([AC_FC_PP_SRCEXT],
[AC_LANG_PUSH(Fortran)dnl
AC_CACHE_CHECK([for Fortran flag to compile preprocessed .$1 files],
ac_cv_fc_pp_srcext_$1,
[ac_ext=$1
# Also adjust FCFLAGS_SRCEXT, for compatibility with Autoconf 2.59.
ac_FCFLAGS_SRCEXT_save=$FCFLAGS_SRCEXT
ac_fcflags_pp_srcext_save=$ac_fcflags_srcext
ac_fcflags_srcext=
FCFLAGS_SRCEXT=
ac_cv_fc_pp_srcext_$1=unknown
case $ac_ext in #(
[[fF]]77) ac_try=f77-cpp-input;; #(
*) ac_try=f95-cpp-input;;
esac
for ac_flag in none -ftpp -fpp -Tf "-fpp -Tf" -xpp=fpp -Mpreprocess "-e Z" \
-cpp -xpp=cpp -qsuffix=cpp=$1 "-x $ac_try" +cpp -Cpp; do
if test "x$ac_flag" != xnone; then
ac_fcflags_srcext=$ac_flag
FCFLAGS_SRCEXT=$ac_flag
fi
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
#if 0
#include <ac_nonexistent.h>
this is not correct fortran
#endif]])],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
#if 1
#include <ac_nonexistent.h>
this is not correct fortran
#endif]])],
[],
[ac_cv_fc_pp_srcext_$1=$ac_flag; break])])
done
rm -f conftest.$ac_objext conftest.$1
ac_fcflags_srcext=$ac_fcflags_pp_srcext_save
FCFLAGS_SRCEXT=$ac_FCFLAGS_SRCEXT_save=
])
if test "x$ac_cv_fc_pp_srcext_$1" = xunknown; then
m4_default([$3],
[AC_MSG_ERROR([Fortran could not compile preprocessed .$1 files])])
else
ac_fc_srcext=$1
if test "x$ac_cv_fc_pp_srcext_$1" = xnone; then
ac_fcflags_srcext=""
FCFLAGS_SRCEXT=
FCFLAGS_[]$1[]=""
else
ac_fcflags_srcext=$ac_cv_fc_pp_srcext_$1
FCFLAGS_SRCEXT=$ac_cv_fc_pp_srcext_$1
FCFLAGS_[]$1[]=$ac_cv_fc_pp_srcext_$1
fi
AC_SUBST(FCFLAGS_[]$1)
$2
fi
AC_LANG_POP(Fortran)dnl
])# AC_FC_PP_SRCEXT
])dnl m4_version_prereq([2.69])
......@@ -139,6 +139,8 @@ fi
FATHOM_SET_MPI_COMPILER([F77],[$F77_LIST],[$COMPILERPATHS])
AC_PROG_FC
AC_PROG_F77
AC_FC_PP_DEFINE
AC_FC_PP_SRCEXT
fi
]) # FATHOM_CHECK_COMPILERS
......@@ -638,13 +640,14 @@ case "$cxx_compiler:$host_cpu" in
VisualAge:*)
FATHOM_CXX_32BIT=-q32
FATHOM_CXX_64BIT=-q64
FATHOM_CXX_SPECIAL="$EXTRA_BG_FLAGS -qrtti=all -qminimaltoc -qpic=large -qmaxmem=-1"
FATHOM_CXX_SPECIAL="$EXTRA_BG_FLAGS -qminimaltoc -qpic=large -qmaxmem=-1 -qlanglvl=variadictemplates"
AR="ar"
NM="nm -B -X 32_64"
;;
VisualAge8:*)
FATHOM_CXX_32BIT=-q32
FATHOM_CXX_64BIT=-q64
FATHOM_CXX_SPECIAL="$EXTRA_BG_FLAGS -qminimaltoc -qpic=large -qmaxmem=-1 -qlanglvl=variadictemplates"
NM="nm -B -X 32_64"
;;
MIPSpro:mips)
......@@ -756,49 +759,57 @@ case "$cc_compiler:$host_cpu" in
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
FATHOM_CC_SPECIAL="$EXTRA_GNU_FLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_FLAGS"
;;
GNU:powerpc*)
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
FATHOM_CC_SPECIAL="$EXTRA_GNU_FLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_FLAGS"
;;
GNU:i?86|GNU:x86_64)
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
FATHOM_CC_SPECIAL="$EXTRA_GNU_FLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_FLAGS"
;;
Intel:*)
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
FATHOM_CC_SPECIAL="$EXTRA_INTEL_FLAGS -wd981 -wd279 -wd1418 -wd383 -wd1572"
FATHOM_FC_SPECIAL="$EXTRA_INTEL_FLAGS -wd981 -wd279 -wd1418 -wd383 -wd1572"
;;
GNU:mips*)
FATHOM_CC_32BIT="-mips32 -mabi=32"
FATHOM_CC_64BIT="-mips64 -mabi=64"
FATHOM_CC_SPECIAL="$EXTRA_GNU_FLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_FLAGS"
;;
GNU:*)
FATHOM_CC_SPECIAL="$EXTRA_GNU_FLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_FLAGS"
;;
VisualAge:*)
case "$target_vendor" in
bgp)
FATHOM_CC_32BIT=-q32
FATHOM_CC_64BIT=-q64
AR="ar"
NM="nm -B"
FATHOM_CC_64BIT=-q64
AR="ar"
NM="nm -B"
;;
bgq)
FATHOM_CC_32BIT=-q32
FATHOM_CC_64BIT=-q64
FATHOM_CC_SPECIAL="$EXTRA_BG_FLAGS -qarch=qp -qpic=large -qmaxmem=-1 -qminimaltoc"
FATHOM_CXX_SPECIAL="$EXTRA_BG_FLAGS -qarch=qp -qpic=large -qmaxmem=-1 -qminimaltoc"
FATHOM_CC_SPECIAL="$EXTRA_BG_FLAGS -qmaxmem=-1 -qminimaltoc"
FATHOM_FC_SPECIAL="$EXTRA_BG_FLAGS -qnoescape -WF,-C! -qddim -qalias=intptr"
AR="ar"
NM="nm -B"
;;
*)
FATHOM_CC_32BIT=-q32
FATHOM_CC_64BIT=-q64
FATHOM_CC_SPECIAL="$EXTRA_BG_FLAGS -qmaxmem=-1 -qminimaltoc"
FATHOM_FC_SPECIAL="$EXTRA_BG_FLAGS -qnoescape -WF,-C! -qddim -qalias=intptr"
AR="ar"
NM="nm -B -X 32_64"
;;
......@@ -808,12 +819,15 @@ case "$cc_compiler:$host_cpu" in
FATHOM_CC_32BIT=-n32
FATHOM_CC_64BIT=-64
FATHOM_CC_SPECIAL=-LANG:std
FATHOM_FC_SPECIAL=-LANG:std
;;
MIPSpro:*)
FATHOM_CC_SPECIAL=-LANG:std
FATHOM_FC_SPECIAL=-LANG:std
;;
Clang:*)
FATHOM_CC_SPECIAL="$EXTRA_GNU_FLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_FLAGS"
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
;;
......@@ -830,7 +844,6 @@ case "$cc_compiler:$host_cpu" in
esac
AC_MSG_RESULT([$cc_compiler:$host_cpu])
FATHOM_FC_SPECIAL="$FATHOM_CC_SPECIAL"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
]) # end FATHOM_CC_FLAGS
......
......@@ -34,7 +34,7 @@ AC_SUBST(ENABLE_FORTRAN)
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-fortran=$ENABLE_FORTRAN"
EXTRA_GNU_FLAGS='-Wall -pipe -pedantic -Wno-long-long -Wextra -Wcast-align -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -Wno-variadic-macros'
EXTRA_INTEL_FLAGS='-Wall'
EXTRA_BG_FLAGS=''
EXTRA_BG_FLAGS='-qarch=auto -qtune=auto -qpic=large'
# Find out the appropriate compiler based on user options
FATHOM_CHECK_COMPILERS([yes],[yes],[$ENABLE_FORTRAN])
......
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