-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
427 lines (388 loc) · 11.8 KB
/
configure.in
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
bg
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src)
PC_OS
AC_DEFINE(GRADS_VERSION, "2.1.a2.oga.1", [GrADS version])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_FC
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_SUBST(INSTALL)
AC_SUBST(INSTALL_PROGRAM)
if test -z "$INSTALL"
then
INSTALL=cp
INSTALL_PROGRAM=cp
else
INSTALL_PROGRAM="$INSTALL"
fi
dnl ----------------------------------------------------------------------
dnl Check if DRS is enabled
dnl
AC_MSG_CHECKING(if DRS is enabled)
AC_ARG_ENABLE(drs,
[ --enable-drs Compile the DRS interface [default=yes]],
ENABLE_DRS=$enableval,
ENABLE_DRS=yes)
if test "X$ENABLE_DRS" = "Xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
LIBS=
fi
AC_SUBST(ENABLE_DRS)
dnl ----------------------------------------------------------------------
dnl Check if HDF is enabled
dnl
AC_MSG_CHECKING(if HDF is enabled)
AC_ARG_ENABLE(hdf,
[ --enable-hdf Compile the HDF interface [default=yes]],
ENABLE_HDF=$enableval,
ENABLE_HDF=yes)
if test "X$ENABLE_HDF" = "Xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(ENABLE_HDF)
dnl ----------------------------------------------------------------------
dnl Check if GRIB2 is enabled
dnl
dnl ----------------------------------------------------------------------
dnl Checks for GRIB-2 header file.
dnl
dnl get location of GRIB-2 C header from --with-grib2inc=value
dnl
PC_CHECK_C_HEADER(GRIB2INC,/usr/local/include,[grib2inc],grib2.h, dnl
[--with-grib2inc=DIR grib2.h is in DIR (default [GRIB2INC])])
AC_MSG_CHECKING(if GRIB2 is enabled)
AC_ARG_ENABLE(grib2,
[ --enable-grib2 Compile GRIB-2 support [default=no]],
ENABLE_GRIB2=$enableval,
ENABLE_GRIB2=no)
HAVE_PNG="yes"
case "${OS}" in
darwin*)
if test -z "/usr/X11R6/include"; then
PNG_VERSION="15"
else
HAVE_PNG="no"
PNG_VERSION=""
fi
;;
*)
PNG_VERSION=""
;;
esac
if test "X$ENABLE_GRIB2" = "Xyes"; then
AC_MSG_RESULT(yes)
GRIB2OPTS="-DGRIB2"
AC_ARG_WITH([grib2lib],
[AS_HELP_STRING([--with-grib2lib],[path where to look for libgrib2c])],
[],
[with_grib2lib=no])
if test ${with_grib2lib} = "no" ; then
if test "${EXTERNALS+set}" = set; then
GRIB2LIB="-L${EXTERNALS}/lib"
else
GRIB2LIB="-L${prefix}/Externals/lib"
fi
else
GRIB2LIB="-L"${with_grib2lib}
fi
if test ${HAVE_PNG} = "yes"; then
AC_ARG_WITH([pnglib],
[AS_HELP_STRING([--with-pnglib],[path where to look for libpng])],
[],
[with_pnglib=no])
if test ${with_pnglib} = "no" ; then
if test "${EXTERNALS+set}" = set; then
PNGLIB="-L${EXTERNALS}/lib"
else
PNGLIB="-L${prefix}/Externals/lib"
fi
else
PNGLIB="-L"${with_pnglib}
fi
AC_CHECK_LIB([png${PNG_VERSION}],[png_error],[PNGLIBOK="yes"],[PNGLIBOK="no"],[${GRIB2LIB} ${PNGLIB}])
if test ${PNGLIBOK} = "no" ; then
AC_MSG_ERROR("[Could not find a working libpng${PNG_VERSION}]")
fi
fi
AC_ARG_WITH([jasperlib],
[AS_HELP_STRING([--with-jasperlib],[path where to look for libjasper])],
[],
[with_jasperlib=no])
if test ${with_jasperlib} = "no" ; then
if test "${EXTERNALS+set}" = set; then
JASPERLIB="-L${EXTERNALS}/lib"
else
JASPERLIB="-L${prefix}/Externals/lib"
fi
else
JASPERLIB="-L"${with_jasperlib}
fi
AC_CHECK_LIB([jasper],[jas_init],[JASPERLIBOK="yes"],[JASPERLIBOK="no"],[${GRIB2LIB} ${JASPERLIB} -ljpeg -lm ])
if test ${JASPERLIBOK} = "no" ; then
AC_MSG_ERROR("[Could not find a working libjasper]")
fi
AC_ARG_WITH([grib2lib],
[AS_HELP_STRING([--with-grib2lib],[path where to look for libgrib2c])],
[],
[with_grib2lib=no])
if test ${with_grib2lib} = "no" ; then
if test "${EXTERNALS+set}" = set; then
GRIB2LIB="-L${EXTERNALS}/lib -lgrib2c "${PNGLIB}" -lpng${PNG_VERSION} "${JASPERLIB}" -ljasper -lm"
else
GRIB2LIB="-L${prefix}/Externals/lib -lgrib2c "${PNGLIB}" -lpng${PNG_VERSION} "${JASPERLIB}" -ljasper -lm"
fi
else
GRIB2LIB="-L"${with_grib2lib}" -lgrib2c "${PNGLIB}" -lpng${PNG_VERSION} "${JASPERLIB}" -ljasper -lm"
fi
AC_CHECK_LIB([grib2c],[g2_getfld],[GRIB2LIBOK="yes"],[GRIB2LIBOK="no"],[${GRIB2LIB}])
if test ${GRIB2LIBOK} = "no" ; then
AC_MSG_ERROR("[Could not find a working libgrib2c]")
fi
dnl in this case we also need jasper
else
AC_MSG_RESULT(no)
GRIB2OPTS=""
GRIB2LIB=""
fi
AC_SUBST(GRIB2LIB)
AC_SUBST(ENABLE_GRIB2)
AC_SUBST(GRIB2OPTS)
dnl ----------------------------------------------------------------------
dnl Check if OpenDAP is enabled
dnl
AC_MSG_CHECKING(if OpenDAP is enabled)
AC_ARG_ENABLE(dap,
[ --enable-dap Compile with the OpenDAP interface [default=no]],
ENABLE_DAP=$enableval,
ENABLE_DAP=no)
if test "X$ENABLE_DAP" = "Xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(ENABLE_DAP)
dnl ----------------------------------------------------------------------
dnl Check if PP is enabled
dnl
AC_MSG_CHECKING(if PP is enabled)
AC_ARG_ENABLE(pp,
[ --enable-pp Compile the PP interface [default=yes]],
ENABLE_PP=$enableval,
ENABLE_PP=yes)
if test "X$ENABLE_PP" = "Xyes"; then
AC_MSG_RESULT(yes)
PPOPTS="-DHAVE_PP"
else
AC_MSG_RESULT(no)
PPOPTS=""
fi
AC_SUBST(ENABLE_PP)
AC_SUBST(PPOPTS)
dnl ----------------------------------------------------------------------
dnl Check if QL is enabled
dnl
AC_MSG_CHECKING(if QL is enabled)
AC_ARG_ENABLE(ql,
[ --enable-ql Compile the QL interface [default=yes]],
ENABLE_QL=$enableval,
ENABLE_QL=yes)
if test "X$ENABLE_QL" = "Xyes"; then
AC_MSG_RESULT(yes); \
QLOPTS="-DHAVE_QL"
else
AC_MSG_RESULT(no); \
QLOPTS=""
fi
AC_SUBST(ENABLE_QL)
AC_SUBST(QLOPTS)
dnl ----------------------------------------------------------------------
dnl Checks for header files.
dnl
dnl get location of netCDF, HDF, and DRS C header from --with-ncinc=value
dnl
PC_CHECK_C_HEADER(NCINC,/usr/local/include,[ncinc],netcdf.h, dnl
[--with-ncinc=DIR netcdf.h is in DIR (default [NCINC])])
dnl ----------------------------------------------------------------------
dnl
dnl Only look for hdfi.h on OSF
dnl
if test "X$ENABLE_HDF" = "Xyes"; then
case $OS in
osf*)
HDF_HEADER_OPTIONS="hdfi.h"
;;
*)
HDF_HEADER_OPTIONS="hdf.h"
;;
esac
PC_CHECK_C_HEADER(HDFINC,/usr/local/include,[hdfinc],$HDF_HEADER_OPTIONS, dnl
[--with-hdfinc=DIR hdf.h is in DIR (default [HDFINC])])
fi
dnl ----------------------------------------------------------------------
if test "X$ENABLE_DRS" = "Xyes"; then
PC_CHECK_C_HEADER(DRSINC,/usr/local/include,[drsinc],drscdf.h, dnl
[--with-drsinc=DIR drscdf.h is in DIR (default [DRSINC])])
fi
dnl ----------------------------------------------------------------------
dnl
dnl get location of netCDF, and DRS FORTRAN header from --with-ncincf=value
dnl FORTRAN header for HDF cannot be used at this time. The -DHAVE_NETCDF
dnl compile option, cancels the HDF FORTRAN interface.
dnl
PC_CHECK_FORT_HEADER(NCINCF,$NCINC,[ncincf],netcdf.inc, dnl
[--with-ncincf=DIR netcdf.inc is in DIR (default [NCINCF])])
dnl ----------------------------------------------------------------------
if test "X$ENABLE_DRS" = "Xyes"; then
PC_CHECK_FORT_HEADER(DRSINCF,$DRSINC,[drsincf],drsdef.h, dnl
[--with-drsincf=DIR drsdef.h is in DIR (default [DRSINCF])])
fi
dnl ----------------------------------------------------------------------
dnl Checks for libraries.
dnl
dnl set $(NCLIB) from --with-nclib=value
dnl
dnl
dnl netCDF, HDF require libnsl on Solaris
dnl
if test "X$ENABLE_HDF" = "Xyes"; then
case "${OS}$OS_MAJOR" in
sunos5*)
HDF_LIB_OPTIONS="mfhdf -ldf -ljpeg -lz -lnetcdf -lnsl"
;;
irix6*)
HDF_LIB_OPTIONS="mfhdf -ldf -ljpeg -lz"
;;
linux*)
HDF_LIB_OPTIONS="mfhdf -ldf -ljpeg -lz -lm"
;;
Windows_NT*)
HDF_LIB_OPTIONS="mfhdf -ldf -ljpeg -lz -lm"
;;
*)
HDF_LIB_OPTIONS="mfhdf -ldf -ljpeg -lz"
;;
esac
PC_CHECK_ARG_LIB(HDFLIB,/usr/local/lib,[hdflib],$HDF_LIB_OPTIONS,SDstart,HDFOPTS,hdf,libmfhdf.a, dnl
[--with-hdflib=DIR libmfhdf.a is in DIR (default [HDFLIB])])
fi
dnl
dnl DAP requires additional libraries
dnl
dnl DAP_LIB_OPTIONS="netcdf -lhdf5_hl -lhdf5 -lm -lz"
if test "X$ENABLE_DAP" = "Xyes"; then
dnl case "${OS}$OS_MAJOR" in
dnl darwin*)
dnl DAP_LIB_OPTIONS="nc-dap -ldap -lstdc++ -lcurl -lz -lssl -lpthread -lxml2"
dnl ;;
dnl *)
dnl DAP_LIB_OPTIONS="nc-dap -ldap -lstdc++ -lcurl -lz -lssl -lpthread -lxml2"
dnl ;;
dnl esac
AC_ARG_WITH([nclib], [--with-nclib=DIR libnetcdf.a is in DIR (default [NCLIB])],[NCLIB=$withval])
NC_LIB_OPTIONS="netcdf $(${NCLIB}/../bin/nc-config --libs)"
dnl PC_CHECK_ARG_LIB(DAPLIB,/usr/local/lib,[daplib],$DAP_LIB_OPTIONS,SDstart,DAPOPTS,dap,libnc-dap.a, dnl
dnl [--with-dap=DIR libnc-dap.a is in DIR (default [DAPLIB])])
else
dnl ----------------------------------------------------------------------
AC_ARG_WITH([hdf5lib], [--with-hdf5lib=DIR libhdf5.a is in DIR (default [HDF5LIB])],[HDF5LIB=$withval])
case "${OS}$OS_MAJOR" in
sunos5*)
NC_LIB_OPTIONS="netcdf -L$HDF5LIB -lhdf5_hl -lhdf5 -lnsl -lm"
;;
linux*)
NC_LIB_OPTIONS="netcdf -L$HDF5LIB -lhdf5_hl -lhdf5 -lm -lz"
;;
*)
NC_LIB_OPTIONS="netcdf -L$HDF5LIB -lhdf5_hl -lhdf5 -lm -lz"
;;
esac
fi
PC_CHECK_ARG_LIB(NCLIB,/usr/local/lib,[nclib],$NC_LIB_OPTIONS,ncopen,NCOPTS,netcdf,libnetcdf.a, dnl
[--with-nclib=DIR libnetcdf.a is in DIR (default [NCLIB])])
dnl ----------------------------------------------------------------------
if test "X$ENABLE_DRS" = "Xyes"; then
PC_CHECK_FORT_LIB(DRSLIB,/usr/local/lib,[drslib],drs,Aslun,DRSOPTS,drs,libdrs.a, dnl
[--with-drslib=DIR libdrs.a is in DIR (default [DRSLIB])])
fi
dnl ----------------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
dnl ----------------------------------------------------------------------
dnl Set flags for CDMS compilation and linking
AC_SYS_LARGEFILE
GRADS_CRAY=0
GRADS_BYTEORDER=1
GRADS_IEEE2CRAY_OBJECT=
case $OS in
aix)
PC_ENSURE(CPPFLAGS, -Dextname)dnl
PC_ENSURE(FFLAGS, -qextname)dnl
;;
hpux*)
dnl
dnl Note: underscores are added in fcddrs.h for HP,
dnl so don't use FORTRAN +ppu option
dnl
PC_ENSURE(CPPFLAGS, -Dextname)dnl
;;
irix6*)
PC_ENSURE(CFLAGS, -n32)dnl
;;
osf*)
dnl
dnl Don't add -std to CFLAGS, since
dnl f77 chokes on it
dnl
GRADS_BYTEORDER=0
PC_ENSURE(CFLAGS, [-Olimit 1000])dnl
if test "$CC" = cc; then
CC="cc -std"
fi
;;
linux)
GRADS_BYTEORDER=0
dnl PC_ENSURE(CPPFLAGS, -DBYTESWAP -DAbsoftUNIXFortran -D__linux_absoft) dnl
PC_ENSURE(CPPFLAGS, -DBYTESWAP -DpgiFortran) dnl
;;
Windows_NT*)
GRADS_BYTEORDER=0
dnl PC_ENSURE(CPPFLAGS, -DBYTESWAP -DAbsoftUNIXFortran -D__linux_absoft) dnl
PC_ENSURE(CPPFLAGS, -DBYTESWAP -DpgiFortran) dnl
;;
*ultrix)
GRADS_BYTEORDER=0
;;
unicos)
GRADS_CRAY=1
PC_ENSURE(CPPFLAGS, -DCRAY) dnl
dnl GRADS_IEEE2CRAY_OBJECT=ieee2cray.o
;;
darwin*)
GRADS_BYTEORDER=0
;;
esac
AC_SUBST(GRADS_BYTEORDER)dnl
AC_SUBST(GRADS_CRAY)dnl
AC_SUBST(GRADS_IEEE2CRAY_OBJECT)dnl
echo "==================================================================="
echo "NCLIB = $NCLIB"
echo "NC_LIB_OPTIONS = $NC_LIB_OPTIONS"
echo "==================================================================="
dnl ----------------------------------------------------------------------
AC_OUTPUT( dnl
Makefile dnl
src/cddrs/Makefile dnl
src/cddrs/test/Makefile dnl
src/cdunif/Makefile dnl
src/cdunif/cdunifpp/Makefile dnl
src/cdunif/test/Makefile dnl
src/db_util/Makefile dnl
src/api/Makefile dnl
src/api/test/Makefile
)