1# -*- Autoconf -*- 2# This is part of Unidata's netCDF package. Copyright 2011-2019, see 3# the COPYRIGHT file for more information. 4 5# Ed Hartnett, Russ Rew, Dennis Heimbigner, Ward Fisher 6 7# Running autoconf on this file will trigger a warning if 8# autoconf is not at least the specified version. 9AC_PREREQ([2.59]) 10 11# Initialize with name, version, and support email address. 12AC_INIT([netCDF-Fortran], [4.5.3], [support-netcdf@unidata.ucar.edu]) 13 14# Create the VERSION file, which contains the package version from 15# AC_INIT. 16echo -n AC_PACKAGE_VERSION>VERSION 17AC_SUBST(PACKAGE_VERSION) 18AC_MSG_NOTICE([netCDF-Fortran AC_PACKAGE_VERSION]) 19 20# Configuration Date 21if test "x$SOURCE_DATE_EPOCH" != "x" ; then 22 AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date -u -d "${SOURCE_DATE_EPOCH}"`" 23else 24 AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date`" 25fi 26 27# Keep libtool macros in an m4 directory. 28AC_CONFIG_MACRO_DIR([m4]) 29 30# Find out about the host we're building on. 31AC_CANONICAL_HOST 32 33# Find out about the target we're building for. 34AC_CANONICAL_TARGET 35 36# This call is required by automake. 37AM_INIT_AUTOMAKE([1.13 foreign dist-zip subdir-objects]) 38AM_MAINTAINER_MODE() 39 40AC_MSG_NOTICE([checking user options]) 41 42AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ 43#include <netcdf_meta.h> 44#if !defined(NC_RELAX_COORD_BOUND) || NC_RELAX_COORD_BOUND == 0 45 choke me 46#endif]])], [nc_relax_coord_bound=yes], [nc_relax_coord_bound=no]) 47if test "x$nc_relax_coord_bound" = xyes; then 48 AC_DEFINE([NF_RELAX_COORD_BOUND], [1], [Enable a more relaxed boundary error check NF_EINVALCOORDS]) 49fi 50 51AC_MSG_CHECKING([if netCDF was built with CDF5]) 52AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ 53#include <netcdf_meta.h> 54#if !defined(NC_HAS_CDF5) || NC_HAS_CDF5 == 0 55 choke me 56#endif]])], [nc_has_cdf5=yes], [nc_has_cdf5=no]) 57if test "x$nc_has_cdf5" = xyes; then 58 AC_DEFINE([ENABLE_CDF5], [1], [Enable CDF-5 file format]) 59fi 60AC_MSG_RESULT([$nc_has_cdf5]) 61 62AC_MSG_CHECKING([if netCDF was built with pnetcdf]) 63AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ 64#include <netcdf_meta.h> 65#if !defined(NC_HAS_PNETCDF) || NC_HAS_PNETCDF == 0 66 choke me 67#endif]])], [nc_has_pnetcdf=yes], [nc_has_pnetcdf=no]) 68if test "x$nc_has_pnetcdf" = xyes; then 69 AC_DEFINE([NF_HAS_PNETCDF], [1], [Enable parallel I/O support via PnetCDF]) 70fi 71AC_MSG_RESULT([$nc_has_pnetcdf]) 72 73AC_MSG_CHECKING([if netCDF was built with HDF5 parallel I/O features]) 74AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ 75#include <netcdf_meta.h> 76#if !defined(NC_HAS_PARALLEL4) || NC_HAS_PARALLEL4 == 0 77 choke me 78#endif]])], [nc_has_parallel4=yes], [nc_has_parallel4=no]) 79AC_MSG_RESULT([$nc_has_parallel4]) 80 81AC_MSG_CHECKING([if netCDF was built with any parallel I/O features]) 82AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ 83#include <netcdf_meta.h> 84#if !defined(NC_HAS_PARALLEL) || NC_HAS_PARALLEL == 0 85 choke me 86#endif]])], [nc_has_parallel=yes], [nc_has_parallel=no]) 87AC_MSG_RESULT([$nc_has_parallel]) 88 89# Version 4.6.1 does not have NC_HAS_PARALLEL4 but does have 90# NC_HAS_PARALLEL. 91AC_MSG_CHECKING([if netCDF-fortran should be built with HDF5 parallel I/O features]) 92if test "x$nc_has_parallel" = xyes -a "x$nc_has_parallel4" = xno -a "x$nc_has_pnetcdf" = xno; then 93 nc_has_parallel4=yes 94fi 95if test "x$nc_has_parallel4" = xyes; then 96 AC_DEFINE([NF_HAS_PARALLEL4], [1], [Enable parallel I/O support via HDF5]) 97fi 98AC_MSG_RESULT([$nc_has_parallel4]) 99 100AC_MSG_CHECKING([if netCDF was built with support for szip writes]) 101AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ 102#include <netcdf_meta.h> 103#if !(NC_HAS_SZIP_WRITE) 104 choke me 105#endif]])], [nc_has_szip_write=yes], [nc_has_szip_write=no]) 106AC_MSG_RESULT([$nc_has_szip_write]) 107AM_CONDITIONAL(TEST_SZIP_WRITE, [test "x$nc_has_szip_write" = xyes]) 108 109# Find valgrind, if available, and add targets for it (ex: 110# check-valgrind). 111AX_VALGRIND_DFLT([sgcheck], [off]) 112AX_VALGRIND_CHECK 113AM_CONDITIONAL(ENABLE_VALGRIND, [test "x$VALGRIND_ENABLED" = xyes]) 114 115# Does the user want to run extra parallel tests when parallel 116# netCDF-4 is built? 117AC_MSG_CHECKING([whether parallel IO tests should be run]) 118AC_ARG_ENABLE([parallel-tests], 119 [AS_HELP_STRING([--enable-parallel-tests], 120 [Run extra parallel IO tests. Ignored if \ 121 netCDF-4 is not enabled, or built on a system \ 122 without parallel I/O support.])]) 123test "x$enable_parallel_tests" = xyes || enable_parallel_tests=no 124AC_MSG_RESULT($enable_parallel_tests) 125if test $enable_parallel_tests = yes -a "x$nc_has_pnetcdf" = xno -a "x$nc_has_parallel4" = xno ; then 126 # paralle I/O is not enabled 127 AC_MSG_ERROR([Parallel I/O tests requested, but netcdf-c does not support parallel I/O.]) 128fi 129AM_CONDITIONAL(TEST_PARALLEL, [test "x$enable_parallel_tests" = xyes]) 130 131# Determine if we want to enable doxygen-generated documentation. Any 132# new documentation input files should be inserted into 133# docs/Doxyfile.in and possibly docs/Makefile.am 134AC_MSG_CHECKING([whether netCDF documentation should be generated]) 135AC_ARG_ENABLE([doxygen], 136 [AS_HELP_STRING([--enable-doxygen], 137 [Enable generation of documentation with doxygen.])]) 138test "x$enable_doxygen" = xyes || enable_doxygen=no 139AC_MSG_RESULT($enable_doxygen) 140AM_CONDITIONAL([BUILD_DOCS], [test "x$enable_doxygen" = xyes]) 141 142# Does the user want to generate dot-based documentation? 143AC_ARG_ENABLE([dot], 144 [AS_HELP_STRING([--enable-dot], 145 [Use dot (provided by graphviz) to generate charts and graphs \ 146 in the doxygen-based documentation.])]) 147 test "x$enable_dot" = xyes || enable_dot=no 148 149# Does the user want to generate internal documentation? 150AC_ARG_ENABLE([internal-docs], 151 [AS_HELP_STRING([--enable-internal-docs], 152 [Include documentation of library internals. This is of interest \ 153 only to those developing the netCDF library.])]) 154test "x$enable_internal_docs" = xyes || enable_internal_docs=no 155AC_SUBST([BUILD_INTERNAL_DOCS], [$enable_internal_docs]) 156 157# Is doxygen installed? If so, have configure construct the Doxyfile. 158AC_CHECK_PROGS([DOXYGEN], [doxygen]) 159if test -z "$DOXYGEN"; then 160 AC_MSG_WARN([Doxygen not found - documentation will not be built]) 161fi 162 163# Is graphviz/dot installed? If so, we'll use dot to create 164# graphs in the documentation. 165AC_CHECK_PROGS([DOT], [dot]) 166if test -z "$DOT"; then 167 AC_MSG_WARN([dot not found - will use simple charts in documentation]) 168 HAVE_DOT=NO 169elif test "x$enable_dot" = xno; then 170 HAVE_DOT=NO 171else 172 HAVE_DOT=YES 173fi 174 175# If we have doxygen, and it's enabled, then process the file. 176if test "x$enable_doxygen" != xno; then 177 if test -n "$DOXYGEN"; then 178 AC_SUBST(HAVE_DOT) 179 AC_CONFIG_FILES([docs/Doxyfile]) 180 fi 181fi 182 183# Find the C compiler. 184AC_MSG_NOTICE([finding C compiler]) 185 186AC_PROG_CC 187AM_PROG_CC_C_O 188AC_C_CONST 189 190# Sed is needed to construct tests. 191AC_PROG_SED 192if test -z "$SED"; then 193 AC_MSG_WARN([sed not found - some tests will not be built]) 194fi 195AM_CONDITIONAL(USE_SED, [test -n "${SED+1}"]) 196 197# Find fortran compiler. If FC isn't set after AC_PROG_FC, we couldn't 198# find a fortran compiler. If the user requested the fortran API, and 199# has told us not to recover from a missing compiler, then bail out 200# right here. 201AC_MSG_NOTICE([finding Fortran compiler]) 202 203AC_PROG_FC 204AC_PROG_F77($FC) 205 206## Compiler with version information. This consists of the full path 207## name of the compiler and the reported version number. 208AC_SUBST([FC_VERSION]) 209## Strip anything that looks like a flag off of $FC 210FC_NOFLAGS=`echo $FC | sed 's/ -.*//'` 211 212if `echo $FC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then 213 FC_VERSION="$FC" 214else 215 FC_VERSION="$FC" 216 FC_VERSION="$(dirname $(which $FC))/$FC" 217fi 218if test -n "$fc_version_info"; then 219 FC_VERSION="$FC_VERSION ( $fc_version_info)" 220fi 221 222 223# If we couldn't find an F90 compiler, deal with it. 224if test "${FC+set}" = set && test "x$FC" = x; then 225 AC_MSG_FAILURE([Can't find F90 compiler.]) 226fi 227 228# Does the user want to test for Fortran 2003 compiler. 229# Added to get around NAG evaluation compiler error turning off F03 230AC_MSG_CHECKING([whether Fortran compiler is checked for ISO_C_BINDING support]) 231AC_ARG_ENABLE([f03-compiler-check], 232 [AS_HELP_STRING([--disable-f03-compiler-check], 233 [disable check of ISO_C_BINDING support in Fortran compiler])]) 234test "x$enable_f03_compiler_check" = xno || enable_f03_compiler_check=yes 235AC_MSG_RESULT($enable_f03_compiler_check) 236 237# next check to see if the Fortran compiler will support 238# ISO_C_BINDING 239nc_iso_c_binding=yes 240 241# Some f90 compilers change the case of the mod file names. Others 242# require special flags to be set to deal with .f90 files. Find out 243# about this compiler. 244AC_LANG_PUSH(Fortran) 245AC_FC_SRCEXT(f90) 246AC_LANG_POP(Fortran) 247AX_F90_MODULE_FLAG 248AC_SUBST(MOD_FLAG, ${ax_cv_f90_modflag}) 249if test "x$enable_f03_compiler_check" = xyes; then 250 AC_MSG_CHECKING([if Fortran compiler supports Fortran 2003 ISO_C_BINDING]) 251 cat <<EOF >conftest.f90 252module conftest_module 253USE ISO_C_BINDING 254end module conftest_module 255EOF 256 doit='$FC -c ${FCFLAGS} ${FCFLAGS_f90} conftest.f90' 257 if AC_TRY_EVAL(doit); then 258 nc_iso_c_binding=yes 259 else 260 nc_iso_c_binding=no 261 fi 262 AC_MSG_RESULT([$nc_iso_c_binding]) 263 264 AC_MSG_CHECKING([if Fortran compiler supports Fortran 2008 ISO_FORTRAN_ENV additions]) 265 cat <<EOF >conftest.f90 266Program test 267USE ISO_FORTRAN_ENV, ONLY: REAL32, REAL64, INT8, INT16, INT32, INT64 268End Program 269EOF 270 doit='$FC -c ${FCFLAGS} ${FCFLAGS_f90} conftest.f90' 271 if AC_TRY_EVAL(doit); then 272 nc_f2008_is0_env_additions=yes 273 AC_DEFINE([HAVE_F2008], 1, [if true, use Fortran 2008 ISO_FORTRAN_ENV additions]) 274 else 275 nc_f2008_is0_env_additions=no 276 fi 277 AC_MSG_RESULT([$nc_f2008_is0_env_additions]) 278 279 AC_MSG_CHECKING([if Fortran compiler supports TS29113 standard extension]) 280 cat <<EOF >conftest.f90 281Program test 282USE ISO_C_BINDING, ONLY: C_PTRDIFF_T 283End Program 284EOF 285 doit='$FC -c ${FCFLAGS} ${FCFLAGS_f90} conftest.f90' 286 if AC_TRY_EVAL(doit); then 287 nc_ts29113_support=yes 288 AC_DEFINE([HAVE_TS29113_SUPPORT], 1, [if true, Fortran compiler supports TS29113 extension]) 289 else 290 nc_ts29113_support=no 291 fi 292 AC_MSG_RESULT([$nc_ts29113_support]) 293 294 if test "x$nc_iso_c_binding" = xno; then 295 AC_MSG_FAILURE([Can't use build F03 interfaces]) 296 fi 297fi 298 299# Test to see if fortran compiler supports the flag 300# -fallow-argument-mismatch flag introduced in gfortran 10. 301# 302# Also allow support for NAG compiler using the -mismatch_all flag. 303# 304# See https://github.com/Unidata/netcdf-fortran/issues/212 305# See https://github.com/Unidata/netcdf-fortran/issues/218 306ac_save_FCFLAGS="$FCFLAGS" 307AC_MSG_CHECKING([if Fortran compiler supports allow-mismatch flag]) 308cat <<EOF >conftest.f90 309Program test 310USE ISO_C_BINDING, ONLY: C_PTRDIFF_T 311End Program 312EOF 313doit='$FC -c ${FCFLAGS} ${FCFLAGS_f90} -fallow-argument-mismatch conftest.f90' 314if AC_TRY_EVAL(doit); then 315 nf_allow_mismatch=yes 316 FCFLAGS="${FCFLAGS} -fallow-argument-mismatch" 317 else 318 nf_allow_mismatch=no 319fi 320AC_MSG_RESULT([$nf_allow_mismatch]) 321# End testing of gfortan allow-mismatch flags. 322 323AC_MSG_CHECKING([if Fortran compiler supports mismatch_all flag]) 324cat <<EOF >conftest.f90 325Program test 326USE ISO_C_BINDING, ONLY: C_PTRDIFF_T 327End Program 328EOF 329doit='$FC -c ${FCFLAGS} ${FCFLAGS_f90} -mismatch_all conftest.f90' 330if AC_TRY_EVAL(doit); then 331 nf_mismatch_all=yes 332 FCFLAGS="${FCFLAGS} -mismatch_all" 333 else 334 nf_mismatch_all=no 335fi 336AC_MSG_RESULT([$nf_mismatch_all]) 337 338#end testing of NAG mismatch_all flag. 339 340## 341# End mismatch checks 342## 343 344 345# We must have F2003 ISO bindings to build. 346if test "x$nc_iso_c_binding" = xno; then 347 AC_MSG_FAILURE([Fortran 2003 interface not supported]) 348fi 349nc_build_f03=yes 350 351 352# Does the user want to check into fortran type information? 353AC_MSG_CHECKING([whether fortran type sizes should be checked]) 354AC_ARG_ENABLE([fortran-type-check], 355 [AS_HELP_STRING([--disable-fortran-type-check], 356 [cause the Fortran type sizes checks to be skipped])]) 357test "x$enable_fortran_type_check" = xno || enable_fortran_type_check=yes 358AC_MSG_RESULT($enable_fortran_type_check) 359 360# Does the user want to run tests for large files (> 2GiB)? 361AC_MSG_CHECKING([whether large file (> 2GB) tests should be run]) 362AC_ARG_ENABLE([large-file-tests], 363 [AS_HELP_STRING([--enable-large-file-tests], 364 [Run tests which create very large data files (~13 GB disk space 365 required, but it will be recovered when tests are complete). See 366 option --with-temp-large to specify temporary directory])]) 367test "x$enable_large_file_tests" = xyes || enable_large_file_tests=no 368AC_MSG_RESULT($enable_large_file_tests) 369AM_CONDITIONAL(LARGE_FILE_TESTS, [test x$enable_large_file_tests = xyes]) 370if test "x$enable_large_file_tests" = xyes; then 371 AC_DEFINE([LARGE_FILE_TESTS], [1], [do large file tests]) 372fi 373 374# Does the user want to run benchmarks? 375AC_MSG_CHECKING([whether benchmarks should be run]) 376AC_ARG_ENABLE([benchmarks], 377 [AS_HELP_STRING([--enable-benchmarks], 378 [Run benchmarks.])]) 379test "x$enable_benchmarks" = xno || enable_benchmarks=yes 380AC_MSG_RESULT($enable_benchmarks) 381AM_CONDITIONAL(BUILD_BENCHMARKS, [test x$enable_benchmarks = xyes]) 382 383# If the env. variable TEMP_LARGE is set, or if 384# --with-temp-large=<directory>, use it as a place for the large 385# (i.e. > 2 GiB) files created during the large file testing. 386AC_MSG_CHECKING([where to put large temp files if large file tests are run]) 387AC_ARG_WITH([temp-large], 388 [AS_HELP_STRING([--with-temp-large=<directory>], 389 [specify directory where large files (i.e. >2 GB) \ 390 will be written, if large files tests are run with 391 --enable-large-file-tests])], 392 [TEMP_LARGE=$with_temp_large]) 393TEMP_LARGE=${TEMP_LARGE-.} 394AC_MSG_RESULT($TEMP_LARGE) 395AC_DEFINE_UNQUOTED([TEMP_LARGE], ["$TEMP_LARGE"], [Place to put very large netCDF test files.]) 396 397# Allow setting the fortran module install dir 398AC_ARG_WITH([fmoddir], 399 [AS_HELP_STRING([--with-fmoddir=DIR], [Fortran module install directory])], 400 [fmoddir=$withval], 401 [fmoddir="\${includedir}"]) 402AC_SUBST([fmoddir], [$fmoddir]) 403 404# Set up libtool. 405AC_MSG_NOTICE([setting up libtool]) 406LT_PREREQ([2.2]) 407LT_INIT 408 409AC_MSG_NOTICE([finding other utilities]) 410 411# Find the install program. 412AC_PROG_INSTALL 413 414AC_MSG_NOTICE([trying to set fortran flags for this platform]) 415AC_MSG_CHECKING([what FC is set to]) 416AC_MSG_RESULT([$FC]) 417 418# Check to see if any macros must be set to enable large (>2GB) files. 419AC_SYS_LARGEFILE 420 421# This will test the f77 compiler, as well as check some fortran types. 422if test "$enable_fortran_type_check" = yes; then 423 UD_FORTRAN_TYPES 424 if test "x$ud_fc_failed" = xyes; then 425 AC_MSG_ERROR([F77 compiler doesn't work.]) 426 fi 427else 428 AC_DEFINE(NCBYTE_T, byte) 429 AC_DEFINE(NCSHORT_T, integer*2) 430 AC_DEFINE(NF_INT1_T, byte) 431 AC_DEFINE(NF_INT2_T, integer*2) 432 AC_DEFINE(NF_INT8_T, integer*8) 433 AC_DEFINE(NF_INT1_IS_C_SIGNED_CHAR, 1, [default]) 434 AC_DEFINE(NF_INT2_IS_C_SHORT, 1, [default]) 435 AC_DEFINE(NF_INT_IS_C_INT, 1, [default]) 436 AC_DEFINE(NF_INT8_IS_C_LONG_LONG, 1, [default]) 437 AC_DEFINE(NF_REAL_IS_C_FLOAT, 1, [default]) 438 AC_DEFINE(NF_DOUBLEPRECISION_IS_C_DOUBLE, 1, [default]) 439fi 440 441AC_MSG_NOTICE([checking types, headers, and functions]) 442 443# We must check for all these, because they may be used by the netCDF 444# C library. 445# Removing the checks for some of the libraries because of issues 446# observed when they are detected, are not needed, and an attempt to 447# link against is made anyways. 448# See https://github.com/Unidata/netcdf-fortran/issues/164 449# 450# Specifying LDFLAGS="$(nc-config --libs [--static])" should 451# let downstream developers link more reliably against libnetcdf. 452 453AC_CHECK_LIB([m], [floor], [], []) 454AC_SEARCH_LIBS([dlopen], [dl dld], [], []) 455 456# When the underneath NetCDF C library was built with parallel I/O enables, 457# check if the Fortran compiler supports parallel I/O. Abort if not. 458#if test "x$nc_has_parallel4" = xyes -o "x$nc_has_pnetcdf" = xyes; then 459# AC_LANG_PUSH([Fortran]) 460# AC_CHECK_FUNC([MPI_File_open], [], 461# [AC_SEARCH_LIBS([MPI_File_open], [], [], 462# [AC_MSG_ERROR([ 463# ----------------------------------------------------------------------- 464# The NetCDF C library is built with parallel I/O feature enabled, but 465# the Fortran compiler '$FC' supplied in this configure command 466# does not support MPI-IO. Please use one that does. If parallel I/O 467# feature is not desired, please use a NetCDF C library with parallel 468# I/O feature disabled. Abort. 469# -----------------------------------------------------------------------]) 470# ])]) 471# AC_LANG_POP([Fortran]) 472#fi 473 474# Find the netCDF header and library. 475AC_CHECK_HEADERS([netcdf.h], [], [AC_MSG_ERROR([netcdf.h could not be found. Please set CPPFLAGS.])]) 476AC_SEARCH_LIBS([nc_open], [netcdf], [], 477 [AC_MSG_ERROR([Could not link to netcdf C library. Please set LDFLAGS; for static builds set LIBS to the results of nc-config --libs.])]) 478 479# See if various functions are available 480AC_CHECK_FUNCS([nc_def_opaque nccreate nc_set_log_level oc_open nc_def_var_szip]) 481 482# Starting with version 4.7.4, netcdf-c has function nc_def_var_szip(). 483if test "x$ac_cv_func_nc_def_var_szip" != xyes; then 484 AC_MSG_ERROR([netcdf-c version 4.7.4 or greater is required]) 485fi 486 487nc_build_v2=no 488nc_build_v4=no 489nc_has_logging=no 490nc_has_dap=no 491 492AC_CHECK_FUNCS([nc_get_chunk_cache_ints],[nc_build_v4=yes],[nc_build_v4=no]) 493test "x$ac_cv_func_nccreate" = xyes && nc_build_v2=yes 494test "x$ac_cv_func_nc_set_log_level" = xyes && nc_has_logging=yes 495test "x$ac_cv_func_oc_open" = xyes && nc_has_dap=yes 496 497if test "x$nc_build_v4" = xyes; then 498 AC_DEFINE([USE_NETCDF4], [1], [if true, build netCDF-4]) 499fi 500 501if test "x$nc_has_logging" = xyes; then 502 AC_DEFINE([LOGGING], [1], [if true, C library contains logging]) 503fi 504AC_MSG_CHECKING([netCDF logging present]) 505AC_MSG_RESULT([$nc_has_logging]) 506 507AC_MSG_CHECKING([netCDF v2 API present]) 508AC_MSG_RESULT([$nc_build_v2]) 509AC_MSG_CHECKING([netCDF-4 present]) 510AC_MSG_RESULT([$nc_build_v4]) 511 512AC_MSG_CHECKING([whether to test the filter API]) 513AC_ARG_ENABLE([filter-test], 514 [AS_HELP_STRING([--enable-filter-test], 515 [Run filter tests: requires access to the plugins directory in a netcdf-c build.])]) 516test "x$enable_filter_test" = xyes || enable_filter_test=no 517AC_MSG_RESULT($enable_filter_test) 518 519AM_CONDITIONAL([USE_NETCDF4], [test "x$nc_build_v4" = xyes]) 520AM_CONDITIONAL([BUILD_V2], [test "x$nc_build_v2" = xyes]) 521AM_CONDITIONAL([HAS_LOGGING], [test "x$nc_has_logging" = xyes]) 522AM_CONDITIONAL([USE_LOGGING], [test "x$nc_has_logging" = xyes]) 523AM_CONDITIONAL([BUILD_DAP], [test "x$nc_has_dap" = xyes]) 524AM_CONDITIONAL([BUILD_PNETCDF], [test "x$nc_has_pnetcdf" = xyes]) 525AM_CONDITIONAL([BUILD_PARALLEL4], [test "x$nc_has_parallel4" = xyes]) 526AM_CONDITIONAL([BUILD_PARALLEL], [test "x$nc_has_pnetcdf" = xyes -o "x$nc_has_parallel4" = xyes]) 527AM_CONDITIONAL([TEST_FILTERS], [test "x$enable_filter_test" = xyes]) 528 529AC_CHECK_HEADER(stdlib.h, ,AC_DEFINE([NO_STDLIB_H], [], [no stdlib.h])) 530AC_CHECK_HEADER(sys/types.h, ,AC_DEFINE([NO_SYS_TYPES_H], [], [no sys_types.h])) 531AC_CHECK_HEADERS([sys/param.h]) 532AC_CHECK_HEADERS([locale.h stdio.h stdarg.h errno.h ctype.h fcntl.h malloc.h stdlib.h string.h \ 533 strings.h unistd.h sys/stat.h getopt.h sys/time.h sys/resource.h]) 534AC_HEADER_DIRENT 535AC_HEADER_STDC 536AC_HEADER_SYS_WAIT 537AC_HEADER_TIME 538 539AC_FUNC_VPRINTF 540 541# Check for <stdbool.h> that conforms to C99 requirements 542AC_HEADER_STDBOOL 543 544# Check for these functions... 545AC_FUNC_ALLOCA 546AC_TYPE_SIZE_T 547AC_TYPE_OFF_T 548AC_CHECK_TYPES([ssize_t, ptrdiff_t, uchar, longlong]) 549AC_C_CHAR_UNSIGNED 550AC_CHECK_SIZEOF(short) 551AC_CHECK_SIZEOF(int) 552AC_CHECK_SIZEOF(long) 553AC_CHECK_SIZEOF(float) 554AC_CHECK_SIZEOF(double) 555AC_CHECK_SIZEOF(off_t) 556AC_CHECK_SIZEOF(size_t) 557AC_CHECK_SIZEOF(ptrdiff_t) 558AC_COMPUTE_INT([longlong_is_long],[sizeof(long long) == sizeof(long)],[],[longlong_is_long=0]) 559if test $longlong_is_long = 1; then 560 CFLAGS="$CFLAGS -DLONGLONG_IS_LONG" 561fi 562 563# Flags for nf-config script; by design $prefix, $includir, $libdir, 564# etc. are left as shell variables in the script so as to facilitate 565# relocation 566NC_LIBS="-lnetcdf" 567NC_LIBS="$LDFLAGS $NC_LIBS $LIBS" 568 569case "x$target_os" in 570xsolaris*) 571 NEWNCLIBS="" 572 for x in $NC_LIBS ; do 573 case "$x" in 574 -L*) r=`echo "$x" | sed -e 's|^-L|-R|'` 575 NEWNCLIBS="$NEWNCLIBS $x $r" 576 ;; 577 *) NEWNCLIBS="$NEWNCLIBS $x" ;; 578 esac 579 done 580 NC_LIBS="$NEWNCLIBS" 581 ;; 582*);; 583esac 584 585NC_FLIBS="-lnetcdff $NC_FLIBS" 586 587AC_SUBST([enable_shared]) 588AC_SUBST([enable_static]) 589AC_SUBST(NC_LIBS,[$NC_LIBS]) 590AC_SUBST(NC_FLIBS,[$NC_FLIBS]) 591AC_SUBST(HAS_F90,[$nc_build_f90]) 592AC_SUBST(HAS_F03,[$nc_build_f03]) 593AC_SUBST(HAS_DAP,[$nc_has_dap]) 594AC_SUBST(HAS_NC2,[$nc_build_v2]) 595AC_SUBST(HAS_NC4,[$nc_build_v4]) 596AC_SUBST(HAS_SZIP_WRITE,[$nc_has_szip_write]) 597AC_SUBST(HAS_LOGGING,[$nc_has_logging]) 598AC_SUBST(HAS_CDF5,[$nc_has_cdf5]) 599AC_SUBST(HAS_PNETCDF,[$nc_has_pnetcdf]) 600AC_SUBST(HAS_NC4_PARALLEL,[$nc_has_parallel4]) 601AC_SUBST(HAS_PARALLEL,[$nc_has_parallel]) 602AC_SUBST([AM_LDFLAGS]) 603 604# Some files need to exist in build directories that do not correspond 605# to their source directory, or the test program makes an assumption 606# about where files live. AC_CONFIG_LINKS provides a mechanism to 607# link/copy files if an out-of-source build is happening. 608AC_CONFIG_LINKS([nf_test/fills.nc:nf_test/ref_fills.nc]) 609 610AC_MSG_NOTICE([generating header files and makefiles]) 611 612AC_CONFIG_FILES([Makefile 613 nf-config 614 netcdf-fortran.pc 615 libnetcdff.settings 616 docs/Makefile 617 fortran/Makefile 618 nf_test/Makefile 619 nf_test4/Makefile 620 nf03_test/Makefile 621 nf03_test4/Makefile 622 CMakeExtras/Makefile 623 libsrc/Makefile 624 examples/Makefile 625 examples/F90/Makefile 626 examples/F77/Makefile], 627 [test -f nf-config && chmod 755 nf-config ]) 628 629AC_OUTPUT() 630 631cat libnetcdff.settings 632