1AC_REVISION($Id: configure.in 2853 2017-01-28 07:47:58Z wkliao $)dnl 2dnl -*- Mode: shell-script-mode; -*- 3dnl Process this file with GNU autoconf(1) to produce a configure script. 4dnl 5 6AC_PREREQ([2.59]) 7AC_INIT([parallel-netcdf],[1.8.1],[parallel-netcdf@mcs.anl.gov]) 8 9dnl ncconfig.h.in will be created by autoreconf (autoheader) 10AC_CONFIG_HEADERS([src/lib/ncconfig.h]) 11AC_CONFIG_SRCDIR([src/lib/pnetcdf.h.in]) 12 13AC_CONFIG_AUX_DIR([./scripts]) 14 15CONFIGURE_ARGS_CLEAN=`echo $* | tr '"' ' '` 16 17dnl parse the version numbers to 4 env variables 18PNETCDF_VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1` 19PNETCDF_VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2` 20PNETCDF_VERSION_SUB=`echo ${PACKAGE_VERSION} | cut -d. -f3` 21PNETCDF_VERSION_PRE=`echo ${PACKAGE_VERSION} | cut -d. -f4` 22 23dnl Note major, minor, and sub are required, but pre is not. 24PNETCDF_VERSION=${PACKAGE_VERSION} 25 26dnl Do not change the following line, It is set by SVN automatically. 27dnl It defines PNETCDF_RELEASE_DATE, a string that will be used in 28dnl ncmpi_inq_libvers() to generate release date 29SVN_DATE="$LastChangedDate: 2017-01-28 01:47:58 -0600 (Sat, 28 Jan 2017) $" 30PNETCDF_RELEASE_DATE2=`echo $SVN_DATE | cut -d' ' -f2` 31PNETCDF_RELEASE_DATE=`echo $SVN_DATE | cut -d' ' -f6,7,8 | cut -d')' -f1` 32 33dnl user defined macro for printing messages for debugging 34_DEBUG=no 35AC_DEFUN([UD_MSG_DEBUG], 36 [if test "x${_DEBUG}" = xyes ; then 37 AC_MSG_NOTICE([DEBUG: $1]) 38 fi 39 ] 40) 41 42UD_MSG_DEBUG([PNETCDF_VERSION_MAJOR=$PNETCDF_VERSION_MAJOR]) 43UD_MSG_DEBUG([PNETCDF_VERSION_MINOR=$PNETCDF_VERSION_MINOR]) 44UD_MSG_DEBUG([PNETCDF_VERSION_SUB=$PNETCDF_VERSION_SUB]) 45UD_MSG_DEBUG([PNETCDF_VERSION_PRE=$PNETCDF_VERSION_PRE]) 46UD_MSG_DEBUG([PNETCDF_VERSION=$PNETCDF_VERSION]) 47UD_MSG_DEBUG([PNETCDF_RELEASE_DATE=$PNETCDF_RELEASE_DATE]) 48 49dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION_MAJOR, $PNETCDF_VERSION_MAJOR, major version number) 50dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION_MINOR, $PNETCDF_VERSION_MINOR, minor version number) 51dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION_SUB, $PNETCDF_VERSION_SUB, sub version number) 52dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION_PRE, $PNETCDF_VERSION_PRE, pre-release string) 53dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION, ["$PNETCDF_VERSION"], full PnetCDF version string) 54dnl AC_DEFINE_UNQUOTED(PNETCDF_RELEASE_DATE, ["$PNETCDF_RELEASE_DATE"], PnetCDF release date string) 55dnl AC_DEFINE_UNQUOTED(CONFIGURE_ARGS_CLEAN, ["$CONFIGURE_ARGS_CLEAN"], configure command-line arguments used) 56 57AC_SUBST(PNETCDF_VERSION_MAJOR) 58AC_SUBST(PNETCDF_VERSION_MINOR) 59AC_SUBST(PNETCDF_VERSION_SUB) 60AC_SUBST(PNETCDF_VERSION_PRE) 61AC_SUBST(PNETCDF_VERSION) 62AC_SUBST(PNETCDF_RELEASE_DATE) 63AC_SUBST(PNETCDF_RELEASE_DATE2) 64AC_SUBST(PACKAGE_VERSION) 65AC_SUBST(CONFIGURE_ARGS_CLEAN) 66 67dnl these used to live in acconfig.h 68dnl autoheader only adds these templates to the first invocation of AC_CONFIG_HEADERS 69AH_TEMPLATE([NCBYTE_T], [Type of NC_BYTE]) 70AH_TEMPLATE([NCSHORT_T], [Type of NC_SHORT]) 71AH_TEMPLATE([NF_DOUBLEPRECISION_IS_C_], [C type for Fortran double]) 72AH_TEMPLATE([NF_INT1_IS_C_], [C type for Fortran INT1]) 73AH_TEMPLATE([NF_INT1_T], [Type for Fortran INT1]) 74AH_TEMPLATE([NF_INT2_IS_C_], [C type for Fortran INT2]) 75AH_TEMPLATE([NF_INT2_T], [Type for Fortran INT2]) 76AH_TEMPLATE([NF_INT_IS_C_], [C type for Fortran INT]) 77AH_TEMPLATE([NF_INT8_IS_C_], [C type for Fortran INT8]) 78AH_TEMPLATE([NF_INT8_T], [Type for Fortran INT8]) 79AH_TEMPLATE([NF_REAL_IS_C_], [C type for Fortran REAL]) 80AH_TEMPLATE([NO_IEEE_FLOAT], [Does system have IEEE FLOAT]) 81AH_TEMPLATE([DISABLE_FILE_SYNC], [Define if to disable MPI_File_sync]) 82AH_TEMPLATE([DISABLE_IN_PLACE_SWAP], [Define if to disable in-place byte swap]) 83AH_TEMPLATE([ENABLE_SUBFILING], [Define if to enable subfiling feature]) 84AH_TEMPLATE([PNC_MALLOC_TRACE], [Define if to enable malloc tracing]) 85AH_TEMPLATE([HAVE_FUNC_MACRO], [Define if C++ macro __func__ is defined]) 86AH_TEMPLATE([HAVE_FUNCTION_MACRO], [Define if C++ macro __FUNCTION__ is defined]) 87AH_TEMPLATE([RELAX_COORD_BOUND], [Define if relaxed coord check is enabled]) 88 89dnl an option to use a customized rm command 90AC_ARG_VAR(RM, Command for deleting files or directories. default: rm) 91if test "x${RM}" != x ; then 92 AC_MSG_CHECKING(rm ) 93 if ! test -f ${RM} ; then 94 AC_CHECK_PROG([rm_cmd], [${RM}], [yes], [no]) 95 if test "x${rm_cmd}" = xyes ; then 96 RM=${RM} 97 fi 98 else 99 RM=${RM} 100 fi 101 AC_MSG_RESULT(using $RM) 102else 103 RM="rm" 104fi 105AC_SUBST(RM) 106 107AC_ARG_ENABLE(echo, 108 [AS_HELP_STRING([--enable-echo], 109 [Turn on strong echoing. @<:@default: disabled@:>@])], 110 [set -x] 111) 112 113MPI_INSTALL= 114AC_ARG_WITH(mpi, 115 [AS_HELP_STRING([--with-mpi=/path/to/implementation], 116 [installation prefix for MPI implementation])], 117 if test x"$withval" = xyes; then 118 AC_MSG_ERROR(--with-mpi must be given a pathname) 119 else 120 MPI_INSTALL=${withval} 121 fi 122) 123if test "x${MPI_INSTALL}" != x && (! test -d "${MPI_INSTALL}") ; then 124 AC_MSG_ERROR(Directory '${MPI_INSTALL}' specified in --with-mpi does not exist) 125fi 126 127AC_ARG_VAR(MPICC, MPI C compiler) 128AC_ARG_VAR(MPICXX, MPI C++ compiler) 129AC_ARG_VAR(MPIF77, MPI Fortran 77 compiler) 130AC_ARG_VAR(MPIF90, MPI Fortran 90 compiler) 131AC_ARG_VAR(CC, Overwritten by MPICC if MPICC is set) 132AC_ARG_VAR(CXX, Overwritten by MPICXX if MPICXX is set) 133AC_ARG_VAR(F77, Overwritten by MPIF77 if MPIF77 is set) 134AC_ARG_VAR(FC, Overwritten by MPIF90 if MPIF90 is set) 135AC_ARG_VAR(CFLAGS, Debugging and optimization options for the C compiler) 136AC_ARG_VAR(CPPFLAGS, [Preprocessor options for C and C++ compilers, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>]) 137AC_ARG_VAR(CXXFLAGS, Debugging and optimization options for the C compiler) 138AC_ARG_VAR(FFLAGS, Debugging and optimization options for the Fortran 77 compiler) 139AC_ARG_VAR(FCFLAGS, Debugging and optimization options for the Fortran 90 compiler) 140AC_ARG_VAR(FPPFLAGS, [Preprocessor options for Fortran compilers, e.g. -I<include dir>]) 141 142dnl Check if MPICC, MPICXX, MPIF77, MPIF90 are set by the user. 143dnl If not, set MPICC equal to CC. Similarly, for MPICXX, MPIF77, and MPIF90 144if test "x$MPICC" = x && test "x$CC" != x ; then MPICC=$CC ; fi 145if test "x$MPICXX" = x && test "x$CXX" != x ; then MPICXX=$CXX ; fi 146if test "x$MPIF77" = x && test "x$F77" != x ; then MPIF77=$F77 ; fi 147if test "x$MPIF77" = x && test "x$FC" != x ; then MPIF77=$FC ; fi 148if test "x$MPIF90" = x && test "x$F90" != x ; then MPIF90=$F90 ; fi 149if test "x$MPIF90" = x && test "x$FC" != x ; then MPIF90=$FC ; fi 150 151CANDIDATE_MPICC="${MPICC} mpicc" 152CANDIDATE_MPICXX="${MPICXX} mpicxx mpic++ mpiCC" 153CANDIDATE_MPIF77="${MPIF77} mpif77" 154CANDIDATE_MPIF90="${MPIF90} mpif90" 155 156dnl add IBM MPI compilers 157CANDIDATE_MPICC="${CANDIDATE_MPICC} mpcc_r mpcc mpixlc_r mpixlc" 158CANDIDATE_MPICXX="${CANDIDATE_MPICXX} mpCC_r mpCC mpixlcxx_r mpixlcxx mpixlC_r mpixlC" 159CANDIDATE_MPIF77="${CANDIDATE_MPIF77} mpixlf77_r mpixlf77" 160CANDIDATE_MPIF90="${CANDIDATE_MPIF90} mpixlf90_r mpixlf90" 161 162dnl add IBM BGL MPI compilers 163CANDIDATE_MPICC="${CANDIDATE_MPICC} blrts_xlc mpxlc_r mpxlc" 164CANDIDATE_MPICXX="${CANDIDATE_MPICXX} blrts_xlC mpxlC_r mpxlC" 165CANDIDATE_MPIF77="${CANDIDATE_MPIF77} blrts_xlf mpxlf_r mpxlf" 166CANDIDATE_MPIF90="${CANDIDATE_MPIF90} blrts_xlf90 mpxlf90_r mpxlf90 mpxlf95_r mpxlf95" 167 168dnl add Fujitsu MPI compilers 169CANDIDATE_MPICC="${CANDIDATE_MPICC} mpifccpx" 170CANDIDATE_MPICXX="${CANDIDATE_MPICXX} mpiFCCpx" 171CANDIDATE_MPIF77="${CANDIDATE_MPIF77} mpifrtpx" 172CANDIDATE_MPIF90="${CANDIDATE_MPIF90} mpifrtpx" 173 174dnl add Cray MPI compiler wrappers 175CANDIDATE_MPICC="${CANDIDATE_MPICC} cc" 176CANDIDATE_MPICXX="${CANDIDATE_MPICXX} CC" 177CANDIDATE_MPIF77="${CANDIDATE_MPIF77} ftn" 178CANDIDATE_MPIF90="${CANDIDATE_MPIF90} ftn" 179 180dnl add Intel MPI compiler wrappers 181CANDIDATE_MPICC="${CANDIDATE_MPICC} mpiicc icc" 182CANDIDATE_MPICXX="${CANDIDATE_MPICXX} mpiicpc icpc" 183CANDIDATE_MPIF77="${CANDIDATE_MPIF77} mpiifort mpiifc ifort" 184CANDIDATE_MPIF90="${CANDIDATE_MPIF90} mpiifort mpiifc ifort" 185 186UD_CHECK_MPI_COMPILER([MPICC], [$CANDIDATE_MPICC]) 187if test "x${MPICC}" = x ; then 188 AC_MSG_ERROR([ 189 ----------------------------------------------------------------------- 190 No MPI C compiler can be found. Parallel netCDF requires an MPI C 191 compiler. Please specify the location of one either with the MPICC 192 environment variable or the --with-mpi configure flag 193 -----------------------------------------------------------------------]) 194fi 195 196CC=${MPICC} 197AC_SUBST(MPICC) 198 199dnl Now MPICC is configured, let's do some basic compiler tests 200AC_PROG_CC 201 202dnl this call needs at least autoconf version 2.60 203dnl AC_USE_SYSTEM_EXTENSIONS 204 205dnl enable large file support 206AC_SYS_LARGEFILE 207 208UD_PROG_CC_MAKEDEPEND 209 210dnl AC_HEADER_STDC 211dnl AC_CHECK_HEADERS([malloc.h]) 212 213# check if MPICC works for basic MPI call: MPI_Comm_rank() 214AC_CHECK_FUNC([MPI_Comm_rank], [], 215 dnl maybe -lmpi is needed at link stage 216 [AC_SEARCH_LIBS([MPI_Comm_rank], [mpi mpich], [], 217 [AC_MSG_ERROR([ 218 ------------------------------------------------------------ 219 Invalid MPI compiler specified or detected: "${MPICC}" 220 A working MPI compiler is required. Please specify the location 221 of one either with the MPICC environment variable or the 222 --with-mpi configure flag 223 ------------------------------------------------------------]) 224])]) 225 226 227AC_ARG_ENABLE([mpi-io-test], 228 [AS_HELP_STRING([--disable-mpi-io-test], 229 [Disable check for MPI-IO support in MPI implementation, 230 if you know your MPI implementation has MPI-IO support 231 but the configure test fails to find it. 232 @<:@default: enabled@:>@])], 233 [enable_mpi_io_test=${enableval}], [enable_mpi_io_test=yes] 234) 235 236if test "x${enable_mpi_io_test}" = xyes ; then 237 AC_CHECK_FUNC([MPI_File_open], [], 238 dnl maybe -lmpio is needed at link stage 239 [AC_SEARCH_LIBS([MPI_File_open], [mpio], [], 240 [AC_MSG_ERROR([ 241 ------------------------------------------------------------ 242 MPI implementation does not support MPI-IO 243 PnetCDF requires MPI-IO support to work properly. 244 ------------------------------------------------------------])] 245 )]) 246fi 247 248dnl check MPI C++ compiler 249AC_ARG_ENABLE(cxx, 250 [AS_HELP_STRING([--disable-cxx], 251 [Turn off support for the C++ interface, 252 if you only need the C interface. @<:@default: enabled@:>@])], 253 [enable_cxx=${enableval}], [enable_cxx=auto] 254) 255 256if test "x${enable_cxx}" != xno ; then 257 UD_CHECK_MPI_COMPILER([MPICXX], [$CANDIDATE_MPICXX]) 258 259 if test "x${MPICXX}" = x ; then 260 AC_MSG_ERROR([ 261 ------------------------------------------------------------ 262 configure cannot find a C++ compiler. Please specify the 263 locations of the compiler either with the MPICXX 264 environment variable or the --with-mpi configure flag. 265 ------------------------------------------------------------]) 266 has_mpicxx=no 267 else 268 CXX=${MPICXX} 269 AC_SUBST(MPICXX) 270 has_mpicxx=yes 271 272 dnl UD_PROG_CXX 273 AC_PROG_CXX(${MPICXX}) 274 dnl autoconf 2.5.9 has not yet implemented AC_PROG_CXX_C_O 275 dnl AC_PROG_CXX_C_O 276 277 dnl test if MPICXX can compile an MPI-IO program 278 if test "x${enable_mpi_io_test}" = xyes ; then 279 AC_LANG_PUSH(C++) 280 AC_CHECK_FUNC([MPI_File_close], [], 281 dnl maybe -lmpi++ is needed at link stage 282 [AC_SEARCH_LIBS([MPI_File_close], [mpi++ mpichcxx mpi_cxx], [], 283 [has_mpicxx=no 284 MPICXX= 285 AC_MSG_WARN([ 286 ---------------------------------------------------------- 287 MPI C++ implementation does not support MPI-IO 288 Disabling C++ testing programs 289 ----------------------------------------------------------])] 290 )]) 291 AC_LANG_POP(C++) 292 fi 293 fi 294 if test "x${has_mpicxx}" = xyes ; then 295 UD_CHECK_MPI_CPP_SEEK_SET 296 UD_MSG_DEBUG(ac_cv_CHECK_MPI_CPP_SEEK_SET=$ac_cv_CHECK_MPI_CPP_SEEK_SET) 297 if test "x${ac_cv_CHECK_MPI_CPP_SEEK_SET}" = xyes ; then 298 CXXCPPFLAGS="${CXXCPPFLAGS} -DMPICH_IGNORE_CXX_SEEK -DMPICH_SKIP_MPICXX" 299 fi 300 fi 301else 302has_mpicxx=no 303fi 304AC_SUBST(has_mpicxx) 305 306dnl I took the "-ansi" off the CFLAGS for the strict case, as it was 307dnl preventing PATH_MAX from being defined for some of the test files, 308dnl and I was having a tough time figuring out how to get it back! -- RobR 309dnl Note this must be done after the type of C compiler is determined 310AC_ARG_ENABLE(strict, 311 [AS_HELP_STRING([--enable-strict], 312 [Turn on strict debugging with gcc. @<:@default: disabled@:>@])], 313 [enable_strict=${enableval}], [enable_strict=no] 314) 315 316if test "x${enable_strict}" = xyes; then 317 if test "x${GCC}" = xyes; then 318 CPPFLAGS="${CPPFLAGS} -Wall -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast" 319 CXXCPPFLAGS="${CXXCPPFLAGS} -Wall -Wundef -Wpointer-arith" 320 else 321 AC_MSG_WARN([--enable-strict is for GNU compiler only]) 322 enable_strict=no 323 fi 324fi 325AC_SUBST(CXXCPPFLAGS) 326 327AC_ARG_ENABLE(fortran, 328 [AS_HELP_STRING([--disable-fortran], 329 [Turn off support for the Fortran interface, 330 if you only need the C interface. @<:@default: enabled@:>@])], 331 [enable_fortran=${enableval}], [enable_fortran=auto] 332) 333 334if test "x${enable_fortran}" != xno ; then 335 UD_CHECK_MPI_COMPILER([MPIF77], [$CANDIDATE_MPIF77]) 336 UD_CHECK_MPI_COMPILER([MPIF90], [$CANDIDATE_MPIF90]) 337fi 338if test "x${enable_fortran}" = xyes ; then 339 dnl user explicitly requests to build Fortran APIs 340 if test "x${MPIF77}" = x && test "x${MPIF90}" = x ; then 341 AC_MSG_ERROR([ 342 ------------------------------------------------------------ 343 Fortran support is explicitly requested, but configure 344 cannot find a Fortran 77 or Fortran 90 compiler. Please 345 specify the locations of the compilers either with the 346 MPIF77 MPIF90 environment variables or the --with-mpi 347 configure flag. 348 ------------------------------------------------------------]) 349 fi 350fi 351 352dnl AC_MSG_NOTICE(enable_fortran=${enable_fortran}) 353 354dnl Check if MPIF90 is a valid MPI compiler 355if test "x${MPIF90}" != x ; then 356 FC=${MPIF90} 357 AC_PROG_FC 358 dnl FCFLAGS is set in AC_PROG_FC 359 360 FCLIBS_save="$FCLIBS" 361 FCLIBS="" 362 AC_FC_LIBRARY_LDFLAGS 363 UD_MSG_DEBUG([before FCLIBS=$FCLIBS]) 364 dnl The autoconf macro for finding FCLIBS sometimes makes mistakes 365 dnl (particularly with the Fujitsu frt compiler). This next step 366 dnl first sees if the FCLIBS is valid with the Fortran compiler 367 dnl This also happens to Solaris Studio Fortran compilers 368 dnl AC_PROG_FC_FCLIBS_VALID 369 dnl Now see if FCLIBS works with the C compiler (remove invalid ones) 370 PAC_PROG_FC_CHECK_FCLIBS 371 372 dnl replace FLIBS and F90LIBS with FCLIBS 373 UD_MSG_DEBUG([after FCLIBS=$FCLIBS]) 374 FLIBS="$FCLIBS" 375 F90LIBS="$FCLIBS" 376 377 dnl We use F90FLAGS for debugging and optimization options for Fortran 90 programs 378 F90FLAGS=${FCFLAGS} 379 AC_SUBST(F90FLAGS) 380 381 AC_LANG_PUSH([Fortran]) 382 AC_MSG_CHECKING([if mpi.mod is available]) 383 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ use mpi]])], 384 [mpi_mod=yes], [mpi_mod=no] 385 ) 386 AC_MSG_RESULT($mpi_mod) 387 AC_MSG_CHECKING([if MPIF90 is valid]) 388 if test "x${mpi_mod}" = xyes ; then 389 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ use mpi 390 integer err, rank 391 call MPI_Comm_rank(MPI_COMM_WORLD, rank, err)]])], 392 [valid_mpif90=yes],[valid_mpif90=no] 393 ) 394 else 395 dnl mpi.mod is not available, check if can use mpif.h 396 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ include "mpif.h" 397 integer err, rank 398 call MPI_Comm_rank(MPI_COMM_WORLD, rank, err)]])], 399 [valid_mpif90=yes],[valid_mpif90=no] 400 ) 401 fi 402 AC_MSG_RESULT($valid_mpif90) 403 AC_LANG_POP([Fortran]) 404 if test "x${valid_mpif90}" = xno ; then 405 if test "x${enable_fortran}" = xyes ; then 406 AC_MSG_ERROR([ 407 ------------------------------------------------------------ 408 Invalid MPI Fortran 90 compiler specified: "${MPIF90}" 409 A working MPI compiler is required. Please specify the 410 location of one either with the MPIF90 environment 411 variable or the --with-mpi configure flag. 412 ------------------------------------------------------------]) 413 fi 414 AC_MSG_WARN([ 415 ------------------------------------------------------------ 416 Invalid MPI Fortran 90 compiler: "${MPIF90}" 417 Fortran feature is disabled 418 ------------------------------------------------------------]) 419 enable_fortran=no 420 else 421 if test "x${mpi_mod}" = xyes ; then 422 USE_MPIF_HEADER="use mpi, only: MPI_OFFSET_KIND" 423 else 424 USE_MPIF_HEADER="include \"mpif.h\"" 425 fi 426 AC_SUBST(USE_MPIF_HEADER) 427 AC_SUBST(mpi_mod) 428 fi 429fi 430 431dnl Check if MPIF77 is a valid MPI compiler 432F77_SUPPORT_FREEFORM=no 433if test "x${enable_fortran}" != xno && test "x${MPIF77}" != xno ; then 434 F77=${MPIF77} 435 AC_PROG_F77 436 dnl FFLAGS is set in AC_PROG_F77 437 438 AC_F77_LIBRARY_LDFLAGS 439 440 dnl We use F77FLAGS for debugging and optimization options for Fortran 77 programs 441 F77FLAGS=${FFLAGS} 442 AC_SUBST(F77FLAGS) 443 444 dnl get flag for Fortran free form (this flag is only used in testing) 445 FC_saved=${FC} 446 FC=${F77} 447 UD_FC_FREEFORM 448 if test "x${ac_cv_fc_freeform}" != xunknown ; then 449 F77_SUPPORT_FREEFORM=yes 450 FFREEFORMFLAG=${ac_cv_fc_freeform} 451 fi 452 UD_MSG_DEBUG([FC=$FC F90FLAGS=$F90FLAGS FFREEFORMFLAG=$FFREEFORMFLAG]) 453 AC_SUBST(FFREEFORMFLAG) 454 FC=${FC_saved} 455 456 AC_LANG_PUSH([Fortran 77]) 457 AC_MSG_CHECKING([if MPIF77 is valid]) 458 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ include "mpif.h" 459 integer comm 460 comm = MPI_COMM_WORLD]])], 461 [valid_mpif77=yes], [valid_mpif77=no] 462 ) 463 AC_MSG_RESULT($valid_mpif77) 464 AC_LANG_POP([Fortran 77]) 465 if test "x${valid_mpif77}" = xno ; then 466 if test "x${enable_fortran}" = xyes ; then 467 AC_MSG_ERROR([ 468 ------------------------------------------------------------ 469 Invalid MPI Fortran 77 compiler specified: "${MPIF77}" 470 A working MPI compiler is required. Please specify the 471 location of one either with the MPIF77 environment 472 variable or the --with-mpi configure flag 473 ------------------------------------------------------------]) 474 fi 475 AC_MSG_WARN([ 476 ------------------------------------------------------------ 477 MPI Fortran header file mpif.h is not valid: 478 Fortran feature is disabled 479 ------------------------------------------------------------]) 480 enable_fortran=no 481 fi 482fi 483AC_SUBST(F77_SUPPORT_FREEFORM) 484 485if test "x${enable_fortran}" = xauto ; then 486 if test "x${valid_mpif77}" = xyes && test "x${valid_mpif90}" = xyes ; then 487 enable_fortran=yes 488 else 489 enable_fortran=no 490 AC_MSG_WARN([ 491 ------------------------------------------------------------ 492 Either MPI Fortran 77 or 90 compiler is not working: 493 "MPIF77 = ${MPIF77}" 494 "MPIF90 = ${MPIF90}" 495 Disable Fortran feature ... 496 ------------------------------------------------------------]) 497 fi 498fi 499 500if test "x${enable_fortran}" = xyes ; then 501 dnl GNU Fortran compiler automatically invokes preprocessor for files with 502 dnl extension .F and .F90. To manually invoke the preprocessor on any file, 503 dnl use compiler flag -cpp. To disable, use -nocpp. 504 dnl For other compilers, we need to find the compile flags for Fortran 505 dnl preprocessor. 506 dnl steal AC_FC_PP_SRCEXT from autoconf V2.69 to make UD_FC_PP_SRCEXT 507 UD_FC_PP_SRCEXT([f]) dnl sets ac_cv_fc_pp_srcext_f 508 UD_FC_PP_SRCEXT([F]) dnl sets ac_cv_fc_pp_srcext_F 509 UD_FC_PP_SRCEXT([f90]) dnl sets ac_cv_fc_pp_srcext_f90 510 UD_FC_PP_SRCEXT([F90]) dnl sets ac_cv_fc_pp_srcext_F90 511 512 F77PPFLAGS_f=${ac_cv_fc_pp_srcext_f} 513 F77PPFLAGS_F=${ac_cv_fc_pp_srcext_F} 514 F90PPFLAGS_f90=${ac_cv_fc_pp_srcext_f90} 515 F90PPFLAGS_F90=${ac_cv_fc_pp_srcext_F90} 516 AC_SUBST(F77PPFLAGS_f) 517 AC_SUBST(F77PPFLAGS_F) 518 AC_SUBST(F90PPFLAGS_f90) 519 AC_SUBST(F90PPFLAGS_F90) 520 521 FPPFLAGS=${FPPFLAGS-} 522 AC_SUBST(FPP) 523 AC_SUBST(FPPFLAGS) 524 525 dnl compiler command-line define preprocessor flag, result in FC_DEFINE 526 UD_FC_PP_DEFINE 527 528 dnl check compiler flags for file extensions in .f .F .f90 .F90 529 AC_LANG_PUSH([Fortran]) 530 AC_FC_SRCEXT([f]) 531 AC_FC_SRCEXT([F]) 532 AC_FC_SRCEXT([f90]) 533 AC_FC_SRCEXT([F90]) 534 AC_SUBST(F77FLAGS_f) 535 AC_SUBST(F77FLAGS_F) 536 AC_SUBST(F90FLAGS_f90) 537 AC_SUBST(F90FLAGS_F90) 538 AC_LANG_POP([Fortran]) 539 540 dnl get flag for Fortran fixed form (this flag is only used in testing) 541 UD_FC_FIXEDFORM 542 FFIXEDFORMFLAG=${ac_cv_fc_fixedform} 543 UD_MSG_DEBUG([FC=$FC F90FLAGS=$F90FLAGS FFIXEDFORMFLAG=$FFIXEDFORMFLAG]) 544 AC_SUBST(FFIXEDFORMFLAG) 545 546 # Checking for Fortran types also determines the Fortran name mangling 547 # and places the value into FCALLSCSUB as the C name corresponding 548 # to the Fortran name SUB 549 AC_FC_FUNC(sub, [FCALLSCSUB]) 550 551 # determine the correct name mapping 552 case $FCALLSCSUB in 553 SUB) 554 AC_DEFINE(F77_NAME_UPPER,,[Define if Fortran names are uppercase]) 555 ;; 556 sub_) 557 # This is the hard case. Gcc uses one _ unless the name includes 558 # an underscore, in which case it gets two trailing underscores. 559 # Use essentially the same configure code that the original configure 560 # used to determine SUB 561 AC_MSG_CHECKING([for C-equivalent to Fortran routine "SUB_A"]) 562 dnl " 563 AC_FC_FUNC(sub_a, [FCALLSCSUBA]) 564 AC_MSG_RESULT($FCALLSCSUBA) 565 case $FCALLSCSUBA in 566 sub_a__) 567 AC_DEFINE(F77_NAME_LOWER_2USCORE,,[Define if Fortran names are lower case with two trailing underscore2]) 568 ;; 569 sub_a_) 570 AC_DEFINE(F77_NAME_LOWER_USCORE,,[Define if Fortran names are lower case with one trailing underscore]) 571 ;; 572 *) 573 AC_MSG_WARN([Unrecognized Fortran name mapping]) 574 ;; 575 esac 576 ;; 577 sub) 578 AC_DEFINE(F77_NAME_LOWER,,[Define if Fortran names are lower case]) 579 ;; 580 *) 581 AC_MSG_WARN([Unrecognized Fortran name mapping]) 582 ;; 583 esac 584 585 dnl Some Fortran 77 compilers, such as pgf77, do not allow "_8" modifier, 586 dnl because _8 modifier is a Fortran 90 feature 587 dnl UD_CHECK_PGF77 588 dnl UD_MSG_DEBUG([ac_cv_fc_compiler_pgf77=$ac_cv_fc_compiler_pgf77]) 589 590 dnl Check if the Fortran compiler is an NAG 591 UD_CHECK_FC_NAG 592 if test "x${ac_cv_fc_compiler_nag}" = xyes ; then 593 NAGf90FPPFLAGS="-DNAGf90Fortran" 594 NAG_FCFLAGS="-mismatch" 595 AC_SUBST(NAGf90FPPFLAGS) 596 AC_SUBST(NAG_FCFLAGS) 597 fi 598 599 dnl check Fortran parameter modifier for 8-byte integer type 600 dnl We need this to set the max constants for UINT, INT64, and UINT64 601 UD_FC_CONSTANT_MODIFIER 602 UD_MSG_DEBUG([ac_cv_fc_constant_modifier=$ac_cv_fc_constant_modifier]) 603 PNF_INT8_MODIFIER="" 604 if test "x${ac_cv_fc_constant_modifier}" = xnone ; then 605 PNF_FILL_UINT=4294967295 606 PNF_FILL_INT64=-9223372036854775806 607 PNF_FILL_UINT64=18446744073709551614 608 PNF_X_UINT_MAX=4294967295 609 PNF_X_INT8_MIN=-9223372036854775807 610 PNF_X_INT8_MAX=9223372036854775807 611 PNF_X_UINT8_MAX=18446744073709551615 612 else 613 if test "x${ac_cv_fc_constant_modifier}" = xEightByteInt ; then 614 PNF_INT8_MODIFIER=" integer, parameter :: EightByteInt = selected_int_kind(18)" 615 fi 616 PNF_FILL_UINT=4294967295_${ac_cv_fc_constant_modifier} 617 PNF_FILL_INT64=-9223372036854775806_${ac_cv_fc_constant_modifier} 618 PNF_FILL_UINT64=18446744073709551614_${ac_cv_fc_constant_modifier} 619 PNF_X_UINT_MAX=4294967295_${ac_cv_fc_constant_modifier} 620 PNF_X_INT8_MIN=-9223372036854775807_${ac_cv_fc_constant_modifier} 621 PNF_X_INT8_MAX=9223372036854775807_${ac_cv_fc_constant_modifier} 622 PNF_X_UINT8_MAX=18446744073709551615_${ac_cv_fc_constant_modifier} 623 fi 624 AC_SUBST(PNF_INT8_MODIFIER) 625 AC_SUBST(PNF_FILL_UINT) 626 AC_SUBST(PNF_FILL_INT64) 627 AC_SUBST(PNF_FILL_UINT64) 628 AC_SUBST(PNF_X_UINT_MAX) 629 AC_SUBST(PNF_X_INT8_MIN) 630 AC_SUBST(PNF_X_INT8_MAX) 631 AC_SUBST(PNF_X_UINT8_MAX) 632 633 AC_SUBST(MPIF77) 634 AC_SUBST(MPIF90) 635fi 636 637AC_PROG_INSTALL 638 639have_yacc_lex=no 640dnl Starting from PnetCDF 1.5.0, yacc and lex is no longer needed 641dnl see comments in src/utils/ncmpigen/Makefile.in for build rules for 642dnl ncmpigenyy.c and ncmpigentab.c. If rebuild is desired, uncomment 643dnl below checking to check availability of yacc/lex/bison 644dnl AC_PROG_YACC 645dnl dnl if neither bison nor byacc is found, YACC will be set to yacc 646dnl have_yacc_lex=yes 647dnl if test "x$YACC" = xyacc; then 648dnl AC_CHECK_PROGS(YACC_PATH, yacc) 649dnl if test "x$YACC_PATH" = x; then 650dnl dnl cannot find bison or yacc required to build ncmpigentab.c 651dnl have_yacc_lex=no 652dnl fi 653dnl fi 654dnl 655dnl AC_PROG_LEX 656dnl if (test "x$LEX" != xflex) && (test "x$LEX" != xlex) ; then 657dnl dnl cannot find flex or lex required to build ncmpigenyy.c 658dnl have_yacc_lex=no 659dnl fi 660AC_SUBST(have_yacc_lex) 661 662dnl AC_PROG_AWK 663AC_PROG_LN_S 664AC_PROG_MAKE_SET 665AC_SUBST(SET_MAKE) 666AC_PROG_EGREP 667 668dnl AC_PROG_SED and AC_PROG_GREP are only available on autoconf 2.60 and later 669dnl AC_PROG_SED 670dnl AC_PROG_GREP 671 672dnl YACC and LEX are required to build PnetCDF utility tool ncmpigen 673dnl if configure finds bison then YACC is set to bison -y, so we need to clean 674dnl up the output a bit before testing 675dnl Below checks commands yacc and lex availability under PATH. However, this 676dnl checking is redundant, as AC_PROG_* did that already 677dnl YACC_CMD="${YACC% *}" 678dnl AC_CHECK_PROG([yacc_cmd], [${YACC_CMD}], [yes], [no]) 679dnl AC_CHECK_PROG([lex_cmd], [${LEX}], [yes], [no]) 680dnl if test "x${yacc_cmd}" = no ; then 681dnl AC_MSG_ERROR([could not find bison/yacc required by PnetCDF]) 682dnl fi 683dnl if test "x${lex_cmd}" = no ; then 684dnl AC_MSG_ERROR([could not find flex/lex required by PnetCDF]) 685dnl fi 686 687UD_PROG_M4 688UD_PROG_AR() 689UD_PROG_NM() 690# We could use the PAC check for ranlib (it also makes sure that ranlib works, 691# which is not always true, particularly when GNU tools are installed on 692# a system that doesn't have (or need) ranlib 693AC_PROG_RANLIB 694 695dnl Check for <stdbool.h> that conforms to C99 requirements 696dnl this is also for using bool type in utf8proc.h/utf8proc.c to support 697dnl special characters in CDF-2 and CDF-5 698AC_HEADER_STDBOOL 699 700dnl AC_C_CONST 701AC_C_INLINE 702 703dnl we do not use struct stat yet 704dnl AC_CHECK_MEMBERS([struct stat.st_blksize]) 705 706UD_CHECK_IEEE 707 708dnl cross compile fails with undefined reference to rpl_realloc and rpl_malloc 709dnl AC_FUNC_MALLOC 710dnl AC_FUNC_REALLOC 711 712dnl below checks availability of a bunch C functions, but we have not yet 713dnl implemented alternative calls 714dnl AC_FUNC_ERROR_AT_LINE 715dnl AC_FUNC_MEMCMP 716dnl AC_FUNC_STRTOD 717dnl AC_FUNC_VPRINTF 718dnl AC_CHECK_FUNCS([memset setlocale sqrt strchr strrchr strtol]) 719dnl AC_CHECK_LIB([m], [tanh]) 720dnl UD_CHECK_LIB_MATH 721AC_CHECK_FUNCS([strerror access unlink]) 722 723AC_ARG_ENABLE([debug], 724 [AS_HELP_STRING([--enable-debug], 725 [Enable PnetCDF internal debug mode. This also enables safe mode. 726 @<:@default: disabled@:>@])], 727 [debug=${enableval}], [debug=no] 728) 729 730PNETCDF_DEBUG=0 731if test "x${debug}" = xyes; then 732 dnl malloc memory allocation tracing relies on tdelete and tsearch 733 AC_CHECK_HEADERS([search.h]) 734 AC_CHECK_FUNCS([tsearch tdelete]) 735 736 dnl check required functions for enabling malloc tracing 737 if (test "x${ac_cv_func_tsearch}" = xyes) && 738 (test "x${ac_cv_func_tdelete}" = xyes) ; then 739 AC_DEFINE(PNC_MALLOC_TRACE) 740 fi 741 PNETCDF_DEBUG=1 742fi 743AC_SUBST(PNETCDF_DEBUG) 744 745AC_CHECK_TYPE([MPI_Offset], [], [], [#include <mpi.h>]) 746if test "x${ac_cv_type_MPI_Offset}" = xyes; then 747 AC_CHECK_SIZEOF([MPI_Offset], [], [#include <mpi.h>]) 748else 749 AC_MSG_ERROR([Unable to find type MPI_Offset in mpi.h]) 750fi 751AC_CHECK_SIZEOF([MPI_Aint], [], [#include <mpi.h>]) 752 753dnl Now we know how big MPI_Offset is. If it's less than 8 bytes 754dnl we have to disable support for CDF-2 and CDF-5 file formats 755if test "$ac_cv_sizeof_MPI_Offset" -lt "8"; then 756 AC_MSG_WARN("Unable to support CDF-2 and CDF-5 formats"); 757 enable_cdf_2_n_5=no 758else 759 AC_DEFINE(ENABLE_CDF5,,[Define if able to support CDF-5 file format]) 760 enable_cdf_2_n_5=yes 761fi 762 763SIZEOF_MPI_AINT_IS_4=no 764if test "x$ac_cv_sizeof_MPI_Aint" = x4; then 765 SIZEOF_MPI_AINT_IS_4=yes 766fi 767AC_SUBST(SIZEOF_MPI_AINT_IS_4) 768 769dnl the nonblocking routines build up lists of requests with MPI_Type_struct. 770dnl If MPI_Offset not the same size as MPI_Aint, the arrays passed around will 771dnl get mangled. 772if test "$ac_cv_sizeof_MPI_Offset" -ne "$ac_cv_sizeof_MPI_Aint"; then 773 AC_MSG_WARN(MPI_Offset and MPI_Aint are detected of different sizes: the request aggregation in non-blocking APIs is thus disabled) 774 enable_aggregation=no 775else 776 AC_DEFINE(ENABLE_REQ_AGGREGATION,,[Define if able to support request aggregation in nonblocking routines]) 777 enable_aggregation=yes 778fi 779 780# check for MPI-2 only functions 781AC_CHECK_FUNCS(MPI_Info_dup MPI_Info_free MPI_Get_address) 782AC_CHECK_FUNCS(MPI_Type_create_subarray MPI_Type_create_hvector MPI_Type_create_hindexed MPI_Type_create_struct MPI_Type_create_resized MPI_Type_get_extent) 783 784dnl Check for presence of MPI COMBINERS. 785UD_HAS_MPI_CONST(MPI_COMBINER_DUP) 786UD_HAS_MPI_CONST(MPI_COMBINER_HVECTOR_INTEGER) 787UD_HAS_MPI_CONST(MPI_COMBINER_HINDEXED_INTEGER) 788UD_HAS_MPI_CONST(MPI_COMBINER_SUBARRAY) 789UD_HAS_MPI_CONST(MPI_COMBINER_DARRAY) 790UD_HAS_MPI_CONST(MPI_COMBINER_RESIZED) 791UD_HAS_MPI_CONST(MPI_COMBINER_STRUCT_INTEGER) 792UD_HAS_MPI_CONST(MPI_COMBINER_INDEXED_BLOCK) 793UD_HAS_MPI_CONST(MPI_COMBINER_F90_REAL) 794UD_HAS_MPI_CONST(MPI_COMBINER_F90_INTEGER) 795UD_HAS_MPI_CONST(MPI_COMBINER_F90_COMPLEX) 796 797dnl Check for presence of various MPI error classes. 798dnl These could be enums, so we have to do compile checks. 799UD_HAS_MPI_CONST(MPI_ERR_FILE_EXISTS) 800UD_HAS_MPI_CONST(MPI_ERR_NO_SUCH_FILE) 801UD_HAS_MPI_CONST(MPI_ERR_AMODE) 802UD_HAS_MPI_CONST(MPI_ERR_NOT_SAME) 803UD_HAS_MPI_CONST(MPI_ERR_BAD_FILE) 804UD_HAS_MPI_CONST(MPI_ERR_READ_ONLY) 805UD_HAS_MPI_CONST(MPI_ERR_ACCESS) 806UD_HAS_MPI_CONST(MPI_ERR_NO_SPACE) 807UD_HAS_MPI_CONST(MPI_ERR_QUOTA) 808 809dnl Check for presence of C types 810UD_HAS_MPI_DATATYPE(MPI_CHAR) 811UD_HAS_MPI_DATATYPE(MPI_BYTE) 812UD_HAS_MPI_DATATYPE(MPI_SIGNED_CHAR) 813UD_HAS_MPI_DATATYPE(MPI_UNSIGNED_CHAR) 814UD_HAS_MPI_DATATYPE(MPI_SHORT) 815UD_HAS_MPI_DATATYPE(MPI_UNSIGNED_SHORT) 816UD_HAS_MPI_DATATYPE(MPI_INT) 817UD_HAS_MPI_DATATYPE(MPI_UNSIGNED) 818UD_HAS_MPI_DATATYPE(MPI_LONG) 819UD_HAS_MPI_DATATYPE(MPI_FLOAT) 820UD_HAS_MPI_DATATYPE(MPI_DOUBLE) 821UD_HAS_MPI_DATATYPE(MPI_LONG_LONG_INT) 822UD_HAS_MPI_DATATYPE(MPI_UNSIGNED_LONG_LONG) 823UD_HAS_MPI_DATATYPE(MPI_UB) 824UD_HAS_MPI_DATATYPE(MPI_LB) 825dnl UD_HAS_MPI_DATATYPE(MPI_OFFSET) 826dnl HAVE_MPI_OFFSET might have already been defined in mpi.h 827dnl Add "_DATATYPE" suffix to distinguish from checking MPI_Offset 828UD_HAS_MPI_DATATYPE(MPI_OFFSET, _DATATYPE) 829 830dnl Check for presence of Fortran types 831dnl These could be enums, so we have to do compile checks. 832dnl 833dnl We do this for a couple of reasons. First, the MPI might have been 834dnl built without Fortran support, in which case these types might not 835dnl exist. Second, we need to map these types to corresponding C types 836dnl where possible to simplify processing at run time. 837if test "x${enable_fortran}" = xyes ; then 838 UD_HAS_MPI_DATATYPE(MPI_CHARACTER) 839 UD_HAS_MPI_DATATYPE(MPI_REAL) 840 UD_HAS_MPI_DATATYPE(MPI_INTEGER) 841 UD_HAS_MPI_DATATYPE(MPI_DOUBLE_PRECISION) 842 UD_HAS_MPI_DATATYPE(MPI_INTEGER1) 843 UD_HAS_MPI_DATATYPE(MPI_INTEGER2) 844 UD_HAS_MPI_DATATYPE(MPI_INTEGER4) 845 UD_HAS_MPI_DATATYPE(MPI_INTEGER8) 846 UD_HAS_MPI_DATATYPE(MPI_INTEGER16) 847 UD_HAS_MPI_DATATYPE(MPI_REAL4) 848 UD_HAS_MPI_DATATYPE(MPI_REAL8) 849 UD_HAS_MPI_DATATYPE(MPI_REAL16) 850 UD_HAS_MPI_DATATYPE(MPI_COMPLEX8) 851 UD_HAS_MPI_DATATYPE(MPI_COMPLEX16) 852 UD_HAS_MPI_DATATYPE(MPI_COMPLEX32) 853fi 854 855in_place_swap=yes 856AC_ARG_ENABLE([in-place-swap], 857 [AS_HELP_STRING([--disable-in-place-swap], 858 [Disable memory in-place byte swap on Little Endian 859 machines. @<:@default: enabled@:>@])], 860 [in_place_swap=${enableval}], [in_place_swap=yes] 861) 862if test "x${in_place_swap}" = xno ; then 863 AC_DEFINE(DISABLE_IN_PLACE_SWAP) 864fi 865AC_SUBST(in_place_swap) 866 867AC_C_CHAR_UNSIGNED 868AC_C_BIGENDIAN 869is_bigendian=no 870if test "x${ac_cv_c_bigendian}" = xyes ; then 871 is_bigendian=yes 872fi 873AC_SUBST(is_bigendian) 874 875dnl For big Endian, put buffer needs no byte swap and hence can be declared as 876dnl INTENT(IN). For little Endian, put buffer may be used for byte swap in 877dnl place and hence must be declared as INTENT(INOUT). 878dnl This will configure/produce the file src/libf90/api.f90 879if test "x${ac_cv_c_bigendian}" = xyes || (test "x${in_place_swap}" = xno) ; then 880 INTENTV="IN" 881else 882 INTENTV="INOUT" 883fi 884AC_SUBST(INTENTV) 885 886AC_TYPE_SIZE_T 887AC_TYPE_OFF_T 888AC_CHECK_TYPES([ssize_t, ptrdiff_t, uchar, ushort, uint, longlong, ulonglong, int64, uint64]) 889 890AC_CHECK_SIZEOF(size_t) 891AC_CHECK_SIZEOF(off_t) 892AC_CHECK_SIZEOF(signed char) 893AC_CHECK_SIZEOF(unsigned char) 894AC_CHECK_SIZEOF(short) 895AC_CHECK_SIZEOF(unsigned short int) 896AC_CHECK_SIZEOF(unsigned short) 897AC_CHECK_SIZEOF(int) 898AC_CHECK_SIZEOF(unsigned int) 899AC_CHECK_SIZEOF(long) 900AC_CHECK_SIZEOF(float) 901AC_CHECK_SIZEOF(double) 902AC_CHECK_SIZEOF(long long) 903AC_CHECK_SIZEOF(unsigned long long) 904 905if test "$ac_cv_type_ushort" = yes ; then 906 AC_CHECK_SIZEOF(ushort) 907fi 908if test "$ac_cv_type_uint" = yes ; then 909 AC_CHECK_SIZEOF(uint) 910fi 911if test "$ac_cv_type_longlong" = yes ; then 912 AC_CHECK_SIZEOF(longlong) 913fi 914if test "$ac_cv_type_ulonglong" = yes ; then 915 AC_CHECK_SIZEOF(ulonglong) 916fi 917 918if test "x${enable_fortran}" = xyes ; then 919 if test "$cross_compiling" = yes; then 920 UD_CHECK_FORTRAN_TYPE([NF_INT1_T], [integer*1 byte "integer(kind=1)"]) 921 UD_CHECK_FORTRAN_TYPE([NF_INT2_T], [integer*2 "integer(kind=2)"]) 922 UD_CHECK_FORTRAN_TYPE([NF_INT8_T], [integer*8 "integer(kind=8)"]) 923 else 924 UD_FORTRAN_TYPES 925 fi 926 927 NFMPI_OFFSET="integer*$ac_cv_sizeof_MPI_Offset" 928 AC_MSG_CHECKING([for Fortran NFMPI_OFFSET "$NFMPI_OFFSET"]) 929 dnl " 930 AC_LANG_PUSH([Fortran 77]) 931 AC_COMPILE_IFELSE( 932 [AC_LANG_SOURCE([ 933 subroutine sub(value) 934 $NFMPI_OFFSET value 935 end 936 ])], 937 [ac_cv_NFMPI_OFFSET=yes], [ac_cv_NFMPI_OFFSET=no] 938 ) 939 AC_LANG_POP([Fortran 77]) 940 if test "$ac_cv_NFMPI_OFFSET" = yes ; then 941 AC_MSG_RESULT(yes) 942 else 943 AC_MSG_RESULT(no) 944 AC_MSG_ERROR([F77 does not support "$NFMPI_OFFSET"]) 945 dnl " 946 fi 947 ${RM} -rf conftest* 948fi 949 950SIZEOF_MPI_OFFSET=$ac_cv_sizeof_MPI_Offset 951AC_SUBST(SIZEOF_MPI_OFFSET) 952 953if test "x${enable_fortran}" = xyes ; then 954 955 UD_FC_MODULE_EXTENSION 956 dnl UD_FC_MODULE_EXTENSION defines FC_MODEXT 957 if test "x${FC_MODEXT}" = x ; then 958 AC_MSG_ERROR([cannot determine Fortran module file extension!]) 959 fi 960 UD_MSG_DEBUG([FC_MODEXT=$FC_MODEXT]) 961 962 UD_FC_MODULE_FLAG 963 dnl UD_FC_MODULE_FLAG defines FC_MODINC 964 UD_MSG_DEBUG([FC_MODINC=$FC_MODINC]) 965 966 UD_FC_MODULE_OUTPUT_FLAG 967 dnl UD_FC_MODULE_OUTPUT_FLAG defines FC_MODOUT 968 UD_MSG_DEBUG([FC_MODOUT=$FC_MODOUT]) 969fi 970 971HAVE_F77_GNU_INT=no 972HAVE_F77_INT1=no 973HAVE_F77_INT2=no 974HAVE_F77_INT8=no 975if test "x${enable_fortran}" = xyes ; then 976 UD_CHECK_F77_GNU_INT 977 UD_MSG_DEBUG([ac_cv_f77_gnu_int=$ac_cv_f77_gnu_int]) 978 HAVE_F77_GNU_INT=$ac_cv_f77_gnu_int 979 AC_SUBST(HAVE_F77_GNU_INT) 980 981 UD_CHECK_F77_INT1 982 UD_MSG_DEBUG([ac_cv_f77_int1=$ac_cv_f77_int1]) 983 HAVE_F77_INT1=$ac_cv_f77_int1 984 AC_SUBST(HAVE_F77_INT1) 985 UD_CHECK_F77_INT2 986 UD_MSG_DEBUG([ac_cv_f77_int2=$ac_cv_f77_int2]) 987 HAVE_F77_INT2=$ac_cv_f77_int2 988 AC_SUBST(HAVE_F77_INT2) 989 UD_CHECK_F77_INT8 990 UD_MSG_DEBUG([ac_cv_f77_int8=$ac_cv_f77_int8]) 991 HAVE_F77_INT8=$ac_cv_f77_int8 992 AC_SUBST(HAVE_F77_INT8) 993fi 994 995dnl 996dnl Below is to check if a Fortran compiler produces module files with upper 997dnl case file name, e.g. PNETCDF.mod. However, this does not work for Mac OSX 998dnl file system which is case insensitive 999dnl 1000if test "x${enable_fortran}" = xyes ; then 1001 UD_PROG_FC_UPPERCASE_MOD 1002fi 1003UPPER_CASE_MOD=no 1004if test "x$ac_cv_prog_f90_uppercase_mod" = xyes ; then 1005 UPPER_CASE_MOD=yes 1006fi 1007AC_SUBST(UPPER_CASE_MOD) 1008 1009if test "x${enable_fortran}" = xyes ; then 1010 if test "x${enable_strict}" = xyes; then 1011 FPPFLAGS="${FPPFLAGS} -Wall" 1012 fi 1013 AC_SUBST(FLIBS) 1014 AC_SUBST(FCLIBS) 1015 AC_SUBST(F90LIBS) 1016 AC_SUBST(FLDFLAGS) 1017 AC_SUBST(F90LDFLAGS) 1018fi 1019 1020has_fortran=${enable_fortran} 1021AC_SUBST(has_fortran) 1022 1023UD_MAKEWHATIS 1024 1025dnl 1026dnl GNU coverage 1027dnl 1028dnl This is for internal testing only. It should not be enabled for building a 1029dnl production PnetCDF. This is because running an executable compiled with 1030dnl coverage will produce an output file named "gmon.out". Since coverage is 1031dnl not parallelized, running a program compiled with coverage may cause 1032dnl problems on concurrently writing to gmon.out in conflicts, possible 1033dnl corrupting the file or program hanging. Thus, make target "ptest" should 1034dnl also be disabled when coverage is enabled. 1035dnl 1036dnl After all other tests, optionally enable coverage, we do this last 1037dnl because legend has it that sometimes on some compilers the coverage flags 1038dnl mess up other checks 1039dnl 1040AC_ARG_ENABLE([coverage], 1041 [AS_HELP_STRING([--enable-coverage], 1042 [Compile with coverage support (gcc-based only). @<:@default: disabled@:>@])], 1043 [enable_coverage=${enableval}], [enable_coverage=no] 1044) 1045if test "x${enable_coverage}" = xyes; then 1046 if test "x${GCC}" = xyes; then 1047 dnl it is GNU compiler 1048 LCOV_FLAGS="-pg -fprofile-arcs -ftest-coverage --coverage -O0" 1049 CFLAGS="${CFLAGS} ${LCOV_FLAGS}" 1050 if test "x${has_mpicxx}" = xyes ; then 1051 CXXFLAGS="${CXXFLAGS} ${LCOV_FLAGS}" 1052 fi 1053 if test "x${enable_fortran}" = xyes ; then 1054 FCFLAGS="${FCFLAGS} ${LCOV_FLAGS}" 1055 F77FLAGS="${F77FLAGS} ${LCOV_FLAGS}" 1056 F90FLAGS="${F90FLAGS} ${LCOV_FLAGS}" 1057 fi 1058 LCOV_LIB=-lgcov 1059 AC_SUBST(LCOV_LIB) 1060 else 1061 AC_MSG_WARN([--enable-coverage is for GNU compiler only]) 1062 enable_coverage=no 1063 fi 1064fi 1065AC_SUBST(enable_coverage) 1066 1067if test "x${has_mpicxx}" = xyes ; then 1068 UD_CXX_MACRO_FUNC 1069 if test "x${ac_cv_cxx_macro_func}" == xyes ; then 1070 AC_DEFINE(HAVE_FUNC_MACRO) 1071 fi 1072 if test "x${ac_cv_cxx_macro_function}" == xyes ; then 1073 AC_DEFINE(HAVE_FUNCTION_MACRO) 1074 fi 1075fi 1076 1077if test "x${debug}" = xyes; then 1078 dnl add -g flag if not presented 1079 dnl remove all -O and -fast flags 1080 dnl add -O0 to all flags 1081 if ! echo "${CFLAGS}" | ${EGREP} -q -- "-g" ; then 1082 CFLAGS="${CFLAGS} -g" 1083 fi 1084 CFLAGS=`echo $CFLAGS | sed 's/-O. *//g' | sed 's/-fast *//g'` 1085 CFLAGS="${CFLAGS} -O0" 1086 1087 if test "x${has_mpicxx}" = xyes ; then 1088 if ! echo "${CXXFLAGS}" | ${EGREP} -q -- "-g" ; then 1089 CXXFLAGS="${CXXFLAGS} -g" 1090 fi 1091 CXXFLAGS=`echo $CXXFLAGS | sed 's/-O. *//g' | sed 's/-fast *//g'` 1092 CXXFLAGS="${CXXFLAGS} -O0" 1093 fi 1094 1095 if test "x${enable_fortran}" = xyes ; then 1096 if ! echo "${FCFLAGS}" | ${EGREP} -q -- "-g" ; then 1097 FCFLAGS="${FCFLAGS} -g" 1098 fi 1099 if ! echo "${F77FLAGS}" | ${EGREP} -q -- "-g" ; then 1100 F77FLAGS="${F77FLAGS} -g" 1101 fi 1102 if ! echo "${F90FLAGS}" | ${EGREP} -q -- "-g" ; then 1103 F90FLAGS="${F90FLAGS} -g" 1104 fi 1105 1106 FCFLAGS=`echo $FCFLAGS | sed 's/-O. *//g' | sed 's/-fast *//g'` 1107 F77FLAGS=`echo $F77FLAGS | sed 's/-O. *//g' | sed 's/-fast *//g'` 1108 F90FLAGS=`echo $F90FLAGS | sed 's/-O. *//g' | sed 's/-fast *//g'` 1109 FCFLAGS="${FCFLAGS} -O0" 1110 F77FLAGS="${F77FLAGS} -O0" 1111 F90FLAGS="${F90FLAGS} -O0" 1112 fi 1113fi 1114 1115chmod u+x ${srcdir}/scripts/install-sh 1116 1117AC_ARG_ENABLE([subfiling], 1118 [AS_HELP_STRING([--enable-subfiling], 1119 [Enable subfiling support. @<:@default: disabled@:>@])], 1120 [enable_subfiling=${enableval}], [enable_subfiling=no] 1121) 1122AC_SUBST(enable_subfiling) 1123 1124ENABLE_SUBFILING=0 1125if test "x$enable_subfiling" = "xyes" ; then 1126 AC_DEFINE(ENABLE_SUBFILING) 1127 ENABLE_SUBFILING=1 1128fi 1129AC_SUBST(ENABLE_SUBFILING) 1130 1131AC_ARG_ENABLE([erange-fill], 1132 [AS_HELP_STRING([--disable-erange-fill], 1133 [Disable use of fill value when out-of-range type 1134 conversion causes NC_ERANGE error. @<:@default: enabled@:>@])], 1135 [enable_erange_fill=${enableval}], [enable_erange_fill=yes] 1136) 1137AC_SUBST(enable_erange_fill) 1138 1139ENABLE_ERANGE_FILL=0 1140if test "x$enable_erange_fill" = "xyes" ; then 1141 ENABLE_ERANGE_FILL=1 1142fi 1143AC_SUBST(ENABLE_ERANGE_FILL) 1144 1145AC_ARG_ENABLE([relax-coord-bound], 1146 [AS_HELP_STRING([--enable-relax-coord-bound], 1147 [Enable relaxed error NC_EINVALCOORDS to allow coordinate 1148 start argument equal to dimension size when argument 1149 count is zero. @<:@default: disabled@:>@])], 1150 [enable_relax_coord_bound=${enableval}], [enable_relax_coord_bound=no] 1151) 1152RELAX_COORD_BOUND=0 1153if test "x$enable_relax_coord_bound" = "xyes" ; then 1154 AC_DEFINE(RELAX_COORD_BOUND) 1155 RELAX_COORD_BOUND=1 1156fi 1157AC_SUBST(RELAX_COORD_BOUND) 1158 1159AC_PATH_PROG([LATEX], [latex]) 1160AC_PATH_PROG([DVIPDF], [dvipdf]) 1161has_latex=no 1162if test "x${LATEX}" != x ; then 1163 has_latex=yes 1164fi 1165AC_SUBST(LATEX) 1166AC_SUBST(DVIPDF) 1167AC_SUBST(has_latex) 1168 1169BUILDDIR=`pwd` 1170AC_SUBST(BUILDDIR) 1171 1172AC_ARG_ENABLE([file-sync], 1173 [AS_HELP_STRING([--disable-file-sync], 1174 [Disable MPI file sync if you know your file system can 1175 provide data consistency. @<:@default: enabled@:>@])], 1176 [file_sync=${enableval}], [file_sync=yes] 1177) 1178if test "x${file_sync}" = xno ; then 1179 AC_DEFINE(DISABLE_FILE_SYNC) 1180fi 1181 1182AC_ARG_ENABLE([large-file-test], 1183 [AS_HELP_STRING([--enable-large-file-test], 1184 [Enable testing for large (>4GB) file/variable I/O. Note 1185 "make testing" can run very slow. @<:@default: disabled@:>@])], 1186 [large_file_test=${enableval}], [large_file_test=no] 1187) 1188AC_SUBST(large_file_test) 1189 1190dnl PNETCDF_INC and PNETCDF_LIB are for benchmark programs use only 1191PNETCDF_INC=${BUILDDIR}/src/libf90 1192PNETCDF_LIB="-L${BUILDDIR}/src/lib" 1193AC_SUBST(PNETCDF_INC) 1194AC_SUBST(PNETCDF_LIB) 1195 1196AC_ARG_VAR(TEST_SEQRUN, [Run command (on one process) for make target check on cross-compile environment. Example: "aprun -n 1". @<:@default: none@:>@]) 1197AC_ARG_VAR(TEST_MPIRUN, [MPI run command for make target ptest, @<:@default: mpiexec -n NP@:>@]) 1198AC_ARG_VAR(TEST_OUTDIR, [Output file directory for make target ptest, @<:@default: ./@:>@]) 1199if test "x${TEST_MPIRUN}" = x ; then 1200 dnl set default to mpiexec 1201 TEST_MPIRUN="mpiexec -n NP" 1202fi 1203if test "x${TEST_OUTDIR}" = x ; then 1204 dnl set default to current directory 1205 TEST_OUTDIR=. 1206fi 1207AC_SUBST(TEST_SEQRUN) 1208AC_SUBST(TEST_MPIRUN) 1209AC_SUBST(TEST_OUTDIR) 1210 1211dnl find if gcc is available for compiling ncoffsets to run in sequential 1212AC_PATH_PROG([SEQ_CC], [gcc], [$MPICC]) 1213AC_SUBST(SEQ_CC) 1214 1215# Configuration Date 1216if test "x$SOURCE_DATE_EPOCH" != "x" ; then 1217 AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date -u -d "${SOURCE_DATE_EPOCH}"`" 1218else 1219 AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date`" 1220fi 1221 1222AC_CONFIG_HEADERS([src/libf/nfconfig_inc]) 1223AC_CONFIG_FILES(macros.make \ 1224 Makefile \ 1225 pnetcdf_pc \ 1226 src/Makefile \ 1227 src/lib/Makefile \ 1228 src/lib/pnetcdf.h \ 1229 src/utils/Makefile \ 1230 src/utils/ncmpidump/Makefile \ 1231 src/utils/ncmpidiff/Makefile \ 1232 src/utils/ncmpigen/Makefile \ 1233 src/utils/ncmpivalid/Makefile \ 1234 src/utils/pnetcdf_version/Makefile \ 1235 src/utils/ncoffsets/Makefile \ 1236 test/Makefile \ 1237 test/common/Makefile \ 1238 test/nc_test/Makefile \ 1239 test/C/Makefile \ 1240 test/fandc/Makefile \ 1241 test/testcases/Makefile \ 1242 test/nonblocking/Makefile \ 1243 test/header/Makefile \ 1244 test/cdf_format/Makefile \ 1245 test/largefile/Makefile \ 1246 examples/C/Makefile \ 1247 examples/tutorial/Makefile \ 1248 examples/Makefile \ 1249 doc/Makefile \ 1250 man/Makefile \ 1251 scripts/Makefile \ 1252 benchmarks/Makefile \ 1253 benchmarks/C/Makefile \ 1254 test/nf_test/Makefile \ 1255 test/nf_test/tests.inc \ 1256 test/nf90_test/Makefile \ 1257 test/F90/Makefile \ 1258 examples/F77/Makefile \ 1259 examples/F90/Makefile \ 1260 src/libf90/Makefile \ 1261 src/libf90/pnetcdf.f90 \ 1262 src/libf90/api.f90 \ 1263 src/libf90/nfmpi_constants.f90 \ 1264 src/libf/Makefile \ 1265 src/libf/pnetcdf.inc \ 1266 src/libcxx/Makefile \ 1267 examples/CXX/Makefile \ 1268 test/CXX/Makefile \ 1269 benchmarks/FLASH-IO/Makefile \ 1270 test/subfile/Makefile) 1271 1272# The following dependency is for configure.in and configure 1273# See autoconf manual 2.69, Section 4.8.5 Automatic Remaking 1274AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) 1275 1276dnl add executable permission to pnetcdf-config and check_install 1277AC_CONFIG_FILES([pnetcdf-config], [chmod u+x pnetcdf-config]) 1278AC_CONFIG_FILES([check_install], [chmod u+x check_install]) 1279 1280AC_OUTPUT 1281echo "------------------------------------------------------------------------------" 1282 1283if test "x${enable_mpi_io_test}" = xno ; then 1284 AC_MSG_WARN([ 1285 NOTE: disabling the MPI-IO test is a VERY bad idea. 1286 Please make sure you know what you are doing]) 1287fi 1288 1289msg_large_files=no 1290if test "$ac_cv_sizeof_off_t" -gt 4 ; then 1291 msg_large_files=yes 1292fi 1293 1294echo \ 1295" 1296 ${PACKAGE_NAME} Version ${PACKAGE_VERSION} 1297 1298 Features: Support for large files (> 4 GB) - ${msg_large_files} 1299 Build Fortran APIs - ${enable_fortran} 1300 Build C++ APIs - ${has_mpicxx} 1301 Build CDF-2 and CDF-5 support - ${enable_cdf_2_n_5}" 1302if test "x${enable_aggreg}" = xno; then 1303 echo "\ 1304 Request aggregation in nonblocking APIs - $no" 1305fi 1306if test "x${enable_erange_fill}" = xno; then 1307 echo "\ 1308 Fill variables when NC_ERANGE occurs - no" 1309fi 1310if test "x${enable_subfiling}" = xyes; then 1311 echo "\ 1312 Build subfiling support - yes" 1313fi 1314if test "x${enable_relax_coord_bound}" = xyes; then 1315 echo "\ 1316 Relax start coordinate bound check - enabled" 1317fi 1318if test "x${ac_cv_c_bigendian}" = xno && (test "x${in_place_swap}" = xno) ; then 1319 echo "\ 1320 Memory in-place byte swap - disabled" 1321fi 1322if test "x${large_file_test}" = xyes; then 1323 echo "\ 1324 Testing large file/variable I/O - enabled" 1325fi 1326if test "x${debug}" = xyes; then 1327 echo "\ 1328 PnetCDF internal debug mode - enabled" 1329fi 1330if test "x${enable_fortran}" = xyes && (test "x${F77_SUPPORT_FREEFORM}" = xno) ; then 1331 echo "\ 1332 Support free form in Fortran 77 - no" 1333fi 1334 1335echo "\ 1336 1337 Compilers: MPICC = ${MPICC}" 1338if test "${has_mpicxx}" = yes ; then 1339 echo "\ 1340 MPICXX = ${MPICXX}" 1341fi 1342if test "${enable_fortran}" = yes ; then 1343 echo "\ 1344 MPIF77 = ${MPIF77} 1345 MPIF90 = ${MPIF90}" 1346fi 1347echo "\ 1348 CFLAGS = ${CFLAGS}" 1349if test "x${CPPFLAGS}" != x ; then 1350 echo "\ 1351 CPPFLAGS = ${CPPFLAGS}" 1352fi 1353if test "${has_mpicxx}" = yes ; then 1354 echo "\ 1355 CXXFLAGS = ${CXXFLAGS}" 1356 if test "x${CXXCPPFLAGS}" != x ; then 1357 echo "\ 1358 CXXCPPFLAGS = ${CXXCPPFLAGS}" 1359 fi 1360fi 1361if test "${enable_fortran}" = yes ; then 1362 echo "\ 1363 F77FLAGS = ${F77FLAGS} 1364 F90FLAGS = ${F90FLAGS}" 1365 if test "x${FPPFLAGS}" != x ; then 1366 echo "\ 1367 FPPFLAGS = ${FPPFLAGS}" 1368 fi 1369fi 1370if test "x${LDFLAGS}" != x ; then 1371 echo "\ 1372 LDFLAGS = ${LDFLAGS}" 1373fi 1374if test "x${LIBS}" != x ; then 1375 echo "\ 1376 LIBS = ${LIBS}" 1377fi 1378echo "\ 1379 1380 Now type 'make' to build the library and utility tools and then 1381 type 'make @<:@<target>@:>@' for testing and installation, 1382 where the optional <target> is: 1383 check - test PnetCDF build for sequential run 1384 ptest - test PnetCDF build for parallel run 1385 install - install PnetCDF 1386------------------------------------------------------------------------------" 1387 1388