-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
137 lines (118 loc) · 3.92 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
dnl initialize autoconf
AC_INIT([mpi-serial], [2.5.0], [https://github.com/ESMCI/mpi-serial])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([mpi.h])
dnl specify config header file
AC_CONFIG_HEADERS([config.h])
dnl find c compiler, and fort compiler
AC_PROG_CC
AC_PROG_FC
# ARCHIVE COMMAND SIMILAR ACROSS ALL PLATFORMS
AC_ARG_VAR(AR,Archive Command)
if test -z "$AR"; then
AR=ar
fi
# RANLIB
AC_ARG_VAR(RANLIB,Archive index update command)
if test -z "$RANLIB"; then
# Necessary on Darwin to deal with common symbols (particularly when
# using ifort).
if test "$SYSDEF"x = DARWINx; then
RANLIB="ranlib -c"
else
AC_PROG_RANLIB
fi
fi
dnl determine fortran name-mangling
dnl result functions end up in config.h
AC_FC_WRAPPERS
dnl to determine type of integer needed for fortran
AC_CHECK_SIZEOF(long)
dnl these are to specify the possible arguments to configure.
AC_ARG_ENABLE([test-internal],
[ --enable-test-internal Specify internal test as opposed to full suite test]
,AC_DEFINE([TEST_INTERNAL],[],
[Perform tests on data copies internally instead of using MPI_Send]))
AC_ARG_ENABLE([info],[ --enable-info Print extra debugging info],
AC_DEFINE([INFO],[],[Print extra debug info]))
AC_ARG_ENABLE([fort-real],
[ --enable-fort-real=SIZE Specify Fortran real size],
AC_DEFINE_UNQUOTED([CONFIG_FORT_REAL],[$enable_fort_real],
[User-set Fortran real size]))
AC_ARG_ENABLE([fort-double],
[ --enable-fort-double=SIZE Specify Fortran double size],
AC_DEFINE_UNQUOTED([CONFIG_FORT_DOUBLE],[$enable_fort_double],
[User-set Fortran double size]))
AC_ARG_ENABLE([type-checking],
[ --enable-type-checking Perform type checking during communications],
AC_DEFINE([TYPE_CHECKING],[],[Perform type checking during communications]))
# Determine flag for fortran module include path
# taken from the MCT configure
AC_ARG_VAR(INCLUDEFLAG,Fortran compiler flag for specifying module search path)
if echo $ac_fc_version_output | grep -i absoft >/dev/null 2>&1; then
echo "Fortran Compiler is Absoft"
if test -z "$INCLUDEFLAG"; then
INCLUDEFLAG="-p"
fi
elif echo $ac_fc_version_output | grep -i workshop >/dev/null 2>&1; then
echo "Fortran Compiler is Workshop"
if test -z "$INCLUDEFLAG"; then
INCLUDEFLAG="-M"
fi
elif echo $ac_fc_version_output | grep -i pgf >/dev/null 2>&1; then
echo "Fortran Compiler is Portland Group"
LIBS="$LIBS -pgf90libs"
elif echo $ac_fc_version_output | grep -i nag >/dev/null 2>&1; then
echo "Fortran Compiler is NAG"
CPRDEF="NAG"
if test -z "$FCFLAGS"; then
FCFLAGS="-mismatch"
fi
fi
# Test to see if fortran compiler supports the flag
# -fallow-argument-mismatch flag introduced in gfortran 10.
#
# Also allow support for NAG compiler using the -mismatch_all flag.
#
# See https://github.com/Unidata/netcdf-fortran/issues/212
# See https://github.com/Unidata/netcdf-fortran/issues/218
ac_save_FCFLAGS="$FCFLAGS"
AC_MSG_CHECKING([if Fortran compiler supports allow-mismatch flag])
cat <<EOF >conftest.f90
Program test
USE ISO_C_BINDING, ONLY: C_PTRDIFF_T
End Program
EOF
doit='$FC -c ${FCFLAGS} ${FCFLAGS_f90} -fallow-argument-mismatch conftest.f90'
if AC_TRY_EVAL(doit); then
nf_allow_mismatch=yes
FCFLAGS="${FCFLAGS} -fallow-argument-mismatch"
else
nf_allow_mismatch=no
fi
AC_MSG_RESULT([$nf_allow_mismatch])
# End testing of gfortan allow-mismatch flags.
AC_MSG_CHECKING([if Fortran compiler supports mismatch_all flag])
cat <<EOF >conftest.f90
Program test
USE ISO_C_BINDING, ONLY: C_PTRDIFF_T
End Program
EOF
doit='$FC -c ${FCFLAGS} ${FCFLAGS_f90} -mismatch_all conftest.f90'
if AC_TRY_EVAL(doit); then
nf_mismatch_all=yes
FCFLAGS="${FCFLAGS} -mismatch_all"
else
nf_mismatch_all=no
fi
AC_MSG_RESULT([$nf_mismatch_all])
#end testing of NAG mismatch_all flag.
##
# End mismatch checks
##
# INCLUDE FLAG IF NOT ALREADY SET IS MOST LIKELY -I
if test -z "$INCLUDEFLAG"; then
INCLUDEFLAG="-I"
fi
AC_CONFIG_FILES([Makefile tests/Makefile])
AC_OUTPUT