forked from NOAA-GFDL/FRE-NCtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
215 lines (185 loc) · 6.8 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#***********************************************************************
# GNU Lesser General Public License
#
# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools).
#
# FRE-NCTools is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with FRE-NCTools (LICENSE.md). If not, see
# <http://www.gnu.org/licenses/>.
#***********************************************************************
# Prelude
AC_PREREQ([2.63])
AC_INIT(
[FRE NC Tools],
[2023.01],
[fre-nctools],
[https://github.com/NOAA-GFDL/FRE-NCtools])
# Place the git description informatin in the configure script
m4_define([git_revision],
[m4_esyscmd_s([git describe --always --dirty 2> /dev/null || echo "unknown version"])])
AC_REVISION([$git_revision])
m4_define([git_hashval],
[m4_esyscmd_s([git rev-parse HEAD 2> /dev/null || echo "unknown githash"])])
AC_REVISION([$git_hashval])
AC_CONFIG_SRCDIR([postprocessing/land_utils/combine-ncc.F90])
AC_CONFIG_MACRO_DIR([m4])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AM_INIT_AUTOMAKE([foreign -Wall -Werror -Woverride tar-ustar])
AM_EXTRA_RECURSIVE_TARGETS([docs install-docs])
# Check for programs
AC_PROG_RANLIB
AM_PROG_AR
AC_ARG_ENABLE([quad-precision],
[AS_HELP_STRING([--enable-quad-precision],
[build using higher (quad) precision])],
[],
[enable_quad_precision=no])
AC_PROG_CC([icc gcc])
AM_PROG_CC_C_O
## When autoconf v2.70 is more available, this can be replaced with:
##AC_C__GENERIC
GX_C__GENERIC
AS_IF([test $gx_cv_c__Generic = no],
AC_MSG_ERROR([The C compiler does not support the generic selection C-11 standard. Please use a C-11 compliant compiler.])
)
AC_PROG_FC([ifort gfortran])
AC_PROG_FC_C_O
AC_FC_SRCEXT([f90])
AC_FC_SRCEXT([F90])
AC_FC_LINE_LENGTH([unlimited])
AC_FC_FREEFORM()
AC_FC_MODULE_EXTENSION()
GX_FC_DEFAULT_REAL_KIND8_FLAG()
GX_FC_DEFAULT_REAL_KIND4_FLAG()
AC_SEARCH_LIBS([ceil],[m])
# Check for the MPI compilers
# Default MPI build is off
build_mpi=no
LX_FIND_MPI()
AS_IF([test x"$with_mpi" = x"yes"],
[if test x"$have_C_mpi" = x"yes"; then
build_mpi="yes"
fi])
AM_CONDITIONAL([WITH_MPI], [test x"$build_mpi" = x"yes"])
AM_CONDITIONAL([WITH_MPI_TESTS], [test x"$build_mpi" = x"yes" -a -z "$SKIP_MPI_TEST"])
AC_CHECK_FUNCS(gettid, [], [])
# Check if Fortran compiler has Cray pointer support
GX_FC_CRAY_POINTER_FLAG()
# Add Cray Pointer support flag
if test ! -z "$FC_CRAY_POINTER_FLAG"; then
FCFLAGS="$FCFLAGS $FC_CRAY_POINTER_FLAG"
fi
AC_CHECK_PROGS(ASCIIDOC, [asciidoc])
if test -n "$ASCIIDOC"; then
AC_MSG_CHECKING([for asciidoc version])
asciidoc_version=`$ASCIIDOC --version 2>/dev/null`
case "${asciidoc_version}" in
asciidoc' '8*)
AC_MSG_RESULT([${asciidoc_version}])
;;
*)
AC_MSG_RESULT([${asciidoc_version} (unknown)])
;;
esac
fi
AM_CONDITIONAL([WITH_ASCIIDOC], [test -n "$ASCIIDOC"])
AC_CHECK_PROGS(BATS, [bats])
AC_CHECK_PROGS(PROVE, [prove])
AM_CONDITIONAL([WITH_CHECK_PROGS], [test -n "$PROVE" -a -n "$BATS"])
# Check for library
AX_LIB_NETCDF()
if test "$with_netcdf" = "no"; then
AC_MSG_ERROR([Unable to find NetCDF c library.])
fi
AC_LANG_PUSH([Fortran])
AX_LIB_NETCDFF()
if test "$with_netcdf_fortran" = "no"; then
AC_MSG_ERROR([Unable to find NetCDF Fortran library.])
fi
AC_LANG_POP([Fortran])
# Check if Linux sched_getaffinity is available
AC_CHECK_FUNCS([sched_getaffinity], [], [])
# Check for typedefs, structures, and compiler characteristics
# Check if the C compiler supports a working `long double` with more range
# or precision than `double`.
AS_IF([test ${enable_quad_precision:-no} = yes], [
AC_TYPE_LONG_DOUBLE_WIDER
AS_IF([test $ac_cv_type_long_double_wider = no],
[AC_MSG_ERROR([system does not support quad precision. Try setting --enable-mixed-precision=no])
])
])
# Check for library functions
# Check if Test25-input link points to an existing directory
AM_CONDITIONAL([HAVE_TEST25_INPUT], [test -e ${srcdir}/t/Test25-input/grid_spec.nc])
# Other defs
AC_DEFINE([GIT_REVISION], "git_revision",
[Holds the 'git describe' information if configure ran within a git working directory])
AC_DEFINE([GIT_HEADHASH], "git_hashval",
[Holds the 'git rev-parse HEAD' information if configure ran within a git working directory])
#Code for setting rpath based ncview's configure.in code.
echo "ac_computer_gnu: $ac_compiler_gnu"
if test x$ac_compiler_gnu = xyes; then
RPATH_FLAGS=""
for word in $NETCDF_LDFLAGS; do
if test `expr $word : -L/` -eq 3; then
RPDIR=${word:2}
RPATH_FLAGS="$RPATH_FLAGS -Wl,-rpath,$RPDIR"
fi
done
for word in $NETCDF_FCLDFLAGS; do
if test `expr $word : -L/` -eq 3; then
RPDIR=${word:2}
RPATH_FLAGS="$RPATH_FLAGS -Wl,-rpath,$RPDIR"
fi
done
AC_SUBST(RPATH_FLAGS)
fi
# Output files
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile
postprocessing/combine_restarts/Makefile
postprocessing/iceberg_comb/Makefile
postprocessing/land_utils/Makefile
postprocessing/list_ncvars/Makefile
postprocessing/mppnccombine/Makefile
postprocessing/plevel/Makefile
postprocessing/split_ncvars/Makefile
postprocessing/timavg/Makefile
tools/libfrencutils/Makefile
tools/check_mask/Makefile
tools/cubic_utils/Makefile
tools/fregrid/Makefile
tools/make_coupler_mosaic/Makefile
tools/make_hgrid/Makefile
tools/make_land_domain/Makefile
tools/make_quick_mosaic/Makefile
tools/make_regional_mosaic/Makefile
tools/make_solo_mosaic/Makefile
tools/make_topog/Makefile
tools/make_vgrid/Makefile
tools/mppncscatter/Makefile
tools/ncexists/Makefile
tools/nc_null_check/Makefile
tools/remap_land/Makefile
tools/river_regrid/Makefile
tools/runoff_regrid/Makefile
tools/transfer_to_mosaic_grid/Makefile
t/Makefile
tools/simple_hydrog/Makefile
tools/simple_hydrog/postp/Makefile
tools/simple_hydrog/lakes/Makefile
tools/simple_hydrog/rmvpr/Makefile
tools/simple_hydrog/libfmslite/Makefile
])
AC_OUTPUT