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