diff --git a/.gitattributes b/.gitattributes index 58b464e8845034fd0922a6b4fc7a04320b0be265..73a5b0228ffc6d9b14d01ab384c0be4aa8161a1e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -162,13 +162,23 @@ interfaces/ruby/testObj.rb -text interfaces/testdata/gridTest.nc -text interfaces/testdata/mulval.grb -text interfaces/testdata/mulval.nc -text +m4/ac_lang_program_fortran.m4 -text m4/acx_assert_lang_is_fortran_variant.m4 -text +m4/acx_c_package.m4 -text m4/acx_check_strptr_convert.m4 -text m4/acx_execinfo.m4 -text +m4/acx_fortran_check_include.m4 -text +m4/acx_fortran_package.m4 -text +m4/acx_lang_c_check_include.m4 -text +m4/acx_lang_check_include.m4 -text +m4/acx_lang_fortran_check_include.m4 -text m4/acx_lang_other_suffix_conftest.m4 -text +m4/acx_lang_package.m4 -text +m4/acx_option_search_libs.m4 -text m4/acx_options.m4 -text m4/acx_sl_fc_mod_path_flag.m4 -text m4/acx_sl_mod_suffix.m4 -text +m4/asx_tr_arg.m4 -text m4/asx_unset.m4 -text m4/ax_pthread.m4 -text m4/libtool.m4 -text @@ -211,6 +221,7 @@ src/cgribexlib.c -text src/cksum.c -text src/cksum.h -text src/config.h.in -text +src/create_uuid.h -text src/datetime.h -text src/dmemory.c -text src/dmemory.h -text @@ -356,8 +367,6 @@ tests/cksum_read.c -text tests/cksum_verify.c -text tests/cksum_write.c -text tests/cksum_write_chunk.c -text -tests/create_uuid.c -text -tests/create_uuid.h -text tests/deco2d_model.c -text tests/ensure_array_size.c -text tests/ensure_array_size.h -text diff --git a/ChangeLog b/ChangeLog index 874b50c03fbaffc119895cf1f16ee712b0746749..ff65c2304beee8e70caa2833775412930944cb01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,12 @@ -2015-03-12 Uwe Schulzweida +2015-03-26 Uwe Schulzweida * Version 1.6.8 released * using CGRIBEX library version 1.7.1 +2015-02-18 Uwe Schulzweida + + * cdiDecodeTimevalue: fix rounding error for negativ timevalue + 2015-02-12 Uwe Schulzweida * scan netcdf time units attribute (bug fix) diff --git a/Makefile.in b/Makefile.in index c65dca1c0b225be90530e2de7662237f89a719c6..66cd526986a0bf7b364cc7d6654e5fddbef6e0f9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -96,17 +96,26 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ - $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/starlink_fpp.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/asx_tr_arg.m4 $(top_srcdir)/m4/asx_unset.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/starlink_fpp.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -249,6 +258,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NETCDF = @ENABLE_NETCDF@ @@ -296,6 +306,11 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_INCLUDE = @MPI_FC_INCLUDE@ +MPI_FC_LIB = @MPI_FC_LIB@ MPI_LAUNCH = @MPI_LAUNCH@ NC_CONFIG = @NC_CONFIG@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ diff --git a/acinclude.m4 b/acinclude.m4 index 68f06df48391166c322c2afec29c16328560e15b..b886306992ebafa8515078febab1dfa2df32fdc2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -14,6 +14,9 @@ AC_DEFUN([ACX_CHECK_CFINT], [AC_DEFINE(HAVE_CF_INTERFACE, [1], [Define if C / Fortran interface cfortran.h works])]) ]) +m4_include([m4/ac_lang_program_fortran.m4]) +m4_include([m4/acx_lang_fortran_check_include.m4]) +m4_include([m4/acx_lang_c_check_include.m4]) dnl dnl Local Variables: dnl mode: autoconf diff --git a/aclocal.m4 b/aclocal.m4 index 31d3d164636bbd4ada38de2fea63e5caf8e15e2d..3f8b4f3ee6dc90f5c09c900218da206e39eda11a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1184,12 +1184,18 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/acx_assert_lang_is_fortran_variant.m4]) +m4_include([m4/acx_c_package.m4]) m4_include([m4/acx_check_strptr_convert.m4]) m4_include([m4/acx_execinfo.m4]) +m4_include([m4/acx_fortran_package.m4]) +m4_include([m4/acx_lang_check_include.m4]) m4_include([m4/acx_lang_other_suffix_conftest.m4]) +m4_include([m4/acx_lang_package.m4]) +m4_include([m4/acx_option_search_libs.m4]) m4_include([m4/acx_options.m4]) m4_include([m4/acx_sl_fc_mod_path_flag.m4]) m4_include([m4/acx_sl_mod_suffix.m4]) +m4_include([m4/asx_tr_arg.m4]) m4_include([m4/asx_unset.m4]) m4_include([m4/ax_pthread.m4]) m4_include([m4/libtool.m4]) diff --git a/app/Makefile.in b/app/Makefile.in index dab93259508d93db2d507619f01985e2f3ab587c..b130d304eaf69661ec917fcc3f1b3008c3020006 100644 --- a/app/Makefile.in +++ b/app/Makefile.in @@ -89,17 +89,26 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ - $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/starlink_fpp.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/asx_tr_arg.m4 $(top_srcdir)/m4/asx_unset.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/starlink_fpp.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -222,6 +231,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NETCDF = @ENABLE_NETCDF@ @@ -269,6 +279,11 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_INCLUDE = @MPI_FC_INCLUDE@ +MPI_FC_LIB = @MPI_FC_LIB@ MPI_LAUNCH = @MPI_LAUNCH@ NC_CONFIG = @NC_CONFIG@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ diff --git a/cdi.settings.in b/cdi.settings.in index d1ea5660c2d0b0e48fd34851598eda5664fced4d..cc0877f76db4045f574fa240ae60e0934b08cff0 100644 --- a/cdi.settings.in +++ b/cdi.settings.in @@ -1,59 +1,76 @@ { - "CC" : "@CC@", - "CPP" : "@CPP@", - "CPPFLAGS" : "@CPPFLAGS@", - "CFLAGS" : "@CFLAGS@", - "LDFLAGS" : "@LDFLAGS@", - "LIBS" : "@LIBS@", - "FC" : "@FC@", - "F77" : "@F77@", - "FCFLAGS" : "@FCFLAGS@", - "LD" : "@LD@", - "NM" : "@NM@", - "AR" : "@AR@", - "AS" : "@AS@", - "DLLTOOL" : "@DLLTOOL@", - "OBJDUMP" : "@OBJDUMP@", - "STRIP" : "@STRIP@", - "RANLIB" : "@RANLIB@", - "INSTALL" : "@INSTALL@", + "build" : { + "tools" : { + "CC" : "@CC@", + "CPP" : "@CPP@", + "CPPFLAGS" : "@CPPFLAGS@", + "CFLAGS" : "@CFLAGS@", + "LDFLAGS" : "@LDFLAGS@", + "LIBS" : "@LIBS@", + "FC" : "@FC@", + "F77" : "@F77@", + "FCFLAGS" : "@FCFLAGS@", + "LD" : "@LD@", + "NM" : "@NM@", + "AR" : "@AR@", + "AS" : "@AS@", + "DLLTOOL" : "@DLLTOOL@", + "OBJDUMP" : "@OBJDUMP@", + "STRIP" : "@STRIP@", + "RANLIB" : "@RANLIB@", + "INSTALL" : "@INSTALL@" + }, + "platform" : { + "USER_NAME" : "@USER_NAME@", + "HOST_NAME" : "@HOST_NAME@", + "SYSTEM_TYPE" : "@SYSTEM_TYPE@" + }, + "libraries" : { + "threads" : { + "lib" : "@THREADS_LIBS@", + "include" : "@THREADS_INCLUDE@" + }, + "mpi" : { + "libs" : "@MPI_C_LIB@", + "cflags" : "@MPI_C_INCLUDE@", + "fclibs" : "@MPI_FC_LIB@", + "fcflags" : "@MPI_FC_INCLUDE@" + }, + "zlib" : { + "lib" : "@ZLIB_LIBS@", + "include" : "@ZLIB_INCLUDE@" + }, + "szlib" : { + "lib" : "@SZLIB_LIBS@", + "include" : "@SZLIB_INCLUDE@" + }, + "hdf5" : { + "lib" : "@HDF5_LIBS@", + "include" : "@HDF5_INCLUDE@" + }, + "netcdf" : { + "lib" : "@NETCDF_LIBS@", + "include" : "@NETCDF_INCLUDE@" + }, + "grib_api" : { + "lib" : "@GRIB_API_LIBS@", + "include" : "@GRIB_API_INCLUDE@" + }, + "jasper" : { + "lib" : "@JASPER_LIBS@" + } + } }, - "enable_cdi_lib" : @ENABLE_CDI_LIB@, - "grib" : "@ENABLE_GRIB@", - "cgribex" : "@ENABLE_CGRIBEX@", - "service" : "@ENABLE_SERVICE@", - "extra" : "@ENABLE_EXTRA@", - "ieg" : "@ENABLE_IEG@", - "threads" : { - "lib" : "@THREADS_LIBS@", - "include" : "@THREADS_INCLUDE@" - }, - "zlib" : { - "lib" : "@ZLIB_LIBS@", - "include" : "@ZLIB_INCLUDE@", - }, - "szlib" : { - "lib" : "@SZLIB_LIBS@", - "include" : "@SZLIB_INCLUDE@" - }, - "hdf5" : { - "lib" : "@HDF5_LIBS@", - "include" : "@HDF5_INCLUDE@" - }, - "netcdf" : { - "lib" : "@NETCDF_LIBS@", - "include" : "@NETCDF_INCLUDE@" - }, - "grib_api" : { - "lib" : "@GRIB_API_LIBS@", - "include" : "@GRIB_API_INCLUDE@" - }, - "jasper" : { - "lib" : "@JASPER_LIBS@" - }, - "enable_python" : @ENABLE_PYTHON@, - "enable_ruby" : @ENABLE_RUBY@, - "USER_NAME" : "@USER_NAME@", - "HOST_NAME" : "@HOST_NAME@", - "SYSTEM_TYPE" : "@SYSTEM_TYPE@" + "features" : { + "enable_cdi_lib" : @ENABLE_CDI_LIB@, + "grib" : "@ENABLE_GRIB@", + "cgribex" : "@ENABLE_CGRIBEX@", + "service" : "@ENABLE_SERVICE@", + "extra" : "@ENABLE_EXTRA@", + "ieg" : "@ENABLE_IEG@", + "enable_mpi" : @ENABLE_MPI@, + "parallel_nc4" : @HAVE_PARALLEL_NC4@, + "enable_python" : @ENABLE_PYTHON@, + "enable_ruby" : @ENABLE_RUBY@ + } } diff --git a/configure b/configure index 2b344efe42fbb315ec5a27dc325cfde0dec1dc22..e678deafa0f5027c40fe51543a67e524c7829765 100755 --- a/configure +++ b/configure @@ -620,6 +620,10 @@ BUILD_F77 BUILD_FC BUILD_CXX BUILD_CC +BUILD_FC_INCLUDE +BUILD_C_INCLUDE +BUILD_MPI_FC_LIB +BUILD_MPI_C_LIB BUILD_LIBS BUILD_LDFLAGS BUILD_FCFLAGS @@ -646,6 +650,7 @@ FC_MOD_FLAG ENABLE_F2003_ISOC CREATE_ISOC_FALSE CREATE_ISOC_TRUE +ENABLE_MPI USE_MPI USE_PPM_CORE_FALSE USE_PPM_CORE_TRUE @@ -660,6 +665,11 @@ PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG MPI_LAUNCH +MPI_FC_LIB +MPI_FC_INCLUDE +MPI_C_LIB +MPI_C_INCLUDE +MPIROOT ENABLE_NETCDF_FALSE ENABLE_NETCDF_TRUE ENABLE_ALL_STATIC_FALSE @@ -866,6 +876,9 @@ enable_extra enable_ieg enable_all_static enable_mpi +with_mpi_root +with_mpi_include +with_mpi_lib enable_iso_c_interface enable_swig enable_ruby @@ -890,6 +903,10 @@ CXX CXXFLAGS CCC CXXCPP +MPI_C_INCLUDE +MPI_C_LIB +MPI_FC_INCLUDE +MPI_FC_LIB PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR @@ -902,6 +919,10 @@ BUILD_CFLAGS BUILD_FCFLAGS BUILD_LDFLAGS BUILD_LIBS +BUILD_MPI_C_LIB +BUILD_MPI_FC_LIB +BUILD_C_INCLUDE +BUILD_FC_INCLUDE BUILD_CC BUILD_CXX BUILD_FC @@ -1592,6 +1613,11 @@ Optional Packages: library for grib2 compression; if a directory is given, it will be used as a value for --with-jasper-root + --with-mpi-root set directory to search for MPI headers and library + --with-mpi-include specifically set directory to search for MPI + headers, [default=$with_mpi_root/include] + --with-mpi-lib specifically set directory to search for MPI + library, [default=$with_mpi_root/lib] Some influential environment variables: CC C compiler command @@ -1611,6 +1637,14 @@ Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor + MPI_C_INCLUDE + specifically set flags to use when compiling sources using MPI + includes. + MPI_C_LIB specifically set flags to use when linking MPI. + MPI_FC_INCLUDE + specifically set flags to use when compiling sources using MPI + includes. + MPI_FC_LIB specifically set flags to use when linking MPI. PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path @@ -1630,6 +1664,14 @@ Some influential environment variables: BUILD_LDFLAGS append to LDFLAGS during build but not in configure phase BUILD_LIBS append to LIBS during build but not in configure phase + BUILD_MPI_C_LIB + append to MPI_C_LIB during build but not in configure phase + BUILD_MPI_FC_LIB + append to MPI_FC_LIB during build but not in configure phase + BUILD_C_INCLUDE + append to C_INCLUDE during build but not in configure phase + BUILD_FC_INCLUDE + append to FC_INCLUDE during build but not in configure phase BUILD_CC replace CC with expansion of $BUILD_CC during build but not in configure phase BUILD_CXX replace CXX with expansion of $BUILD_CXX during build but not in @@ -2851,6 +2893,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 @@ -9410,6 +9453,8 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; @@ -12541,7 +12586,7 @@ if ${ac_cv_fc_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF - program main + program conftest #ifndef __GNUC__ choke me #endif @@ -12570,7 +12615,7 @@ if ${ac_cv_prog_fc_g+:} false; then : else FCFLAGS=-g cat > conftest.$ac_ext <<_ACEOF - program main + program conftest end _ACEOF @@ -13720,6 +13765,8 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec_FC= tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; @@ -13973,7 +14020,7 @@ else $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF - program main + program conftest end _ACEOF @@ -14020,7 +14067,7 @@ else $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF - program main + program conftest end _ACEOF @@ -15163,7 +15210,7 @@ else eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_FC\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_FC\"" cat > conftest.$ac_ext <<_ACEOF - program main + program conftest end _ACEOF @@ -15517,7 +15564,7 @@ ac_cv_fc_srcext_f90=unknown for ac_flag in none -qsuffix=f=f90 -Tf; do test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag" cat > conftest.$ac_ext <<_ACEOF - program main + program conftest end _ACEOF @@ -15569,8 +15616,8 @@ fi - acx_sl_fpp_srcext=${ac_fc_srcext-F} - as_acx_sl_prog_fpp=`$as_echo " acx_sl_cv_prog_fpp_fc_${ac_fc_srcext-f}" | $as_tr_sh` + acx_sl_fpp_srcext=${ac_fc_srcext-F} + as_acx_sl_prog_fpp=`$as_echo "acx_sl_cv_prog_fpp_fc_${ac_fc_srcext-f}" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to preprocess Fortran files with suffix $acx_sl_fpp_srcext" >&5 $as_echo_n "checking how to preprocess Fortran files with suffix $acx_sl_fpp_srcext... " >&6; } @@ -15583,14 +15630,13 @@ else rm -f conftest* cat > conftest.$ac_ext <<_ACEOF - program main + program conftest #define OK #ifdef OK REAL A #else syntax error #endif - end _ACEOF ac_tmp=conftest.fppout @@ -15615,9 +15661,9 @@ $as_echo "$ac_try_echo"; } >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_acx_sl_prog_fpp=\"\$FPP\"" + eval "$as_acx_sl_prog_fpp=\"\$FPP\"" else - $as_echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: user-specified \$FPP ($FPP) does not work" >&5 @@ -15626,7 +15672,7 @@ $as_echo "$as_me: WARNING: user-specified \$FPP ($FPP) does not work" >&2;} fi rm -f core conftest.err conftest.$ac_objext else - mv $ac_tmp conftest.$ac_ext + mv $ac_tmp conftest.$ac_ext $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15643,21 +15689,23 @@ fi `cd $srcdir ; pwd`/util/xlfpreproc-wrapper \ `cd $srcdir ; pwd`/util/sunf95preproc-wrapper \ `cd $srcdir ; pwd`/util/crayftnpreproc-wrapper \ - "$FC -F" "$FC -F -fpp" "$FC -E" "$FC -E -cpp" \ + "$FC -F" "$FC -F -fpp" "$FC -E" "$FC -E" "$FC -E -cpp" \ "$FC $FCFLAGS -F" "$FC $FCFLAGS -E" "$FC $FCFLAGS -E" \ - "$FC $FCFLAGS -E -cpp" "$FC $FCFLAGS -x f95-cpp-input -E -P" + "$FC $FCFLAGS -E -cpp" "$FC $FCFLAGS -x f95-cpp-input -E -P" \ + "${F77-f77} -F" "${F77-f77} -E" 'fpp' \ + "$CPP" "$CPP -x c" 'cpp' '/lib/cpp' \ + '/usr/ccs/lib/cpp' 'g77 -E' '${CC-cc} -E' do rm -f conftest* cat > conftest.$ac_ext <<_ACEOF - program main + program conftest #define OK #ifdef OK REAL A #else syntax error #endif - end _ACEOF ac_tmp=conftest.fppout @@ -15685,14 +15733,14 @@ sed 's/^/| /' conftest.$ac_ext >&5 FPP="$ac_fpp" break else - $as_echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext else - mv $ac_tmp conftest.$ac_ext + mv $ac_tmp conftest.$ac_ext $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15704,14 +15752,13 @@ fi rm -f conftest* cat > conftest.$ac_ext <<_ACEOF - program main + program conftest #define OK #ifdef OK REAL A #else syntax error #endif - end _ACEOF ac_tmp=conftest.fppout @@ -15739,14 +15786,14 @@ sed 's/^/| /' conftest.$ac_ext >&5 FPP="$ac_fpp -P" break else - $as_echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext else - mv $ac_tmp conftest.$ac_ext + mv $ac_tmp conftest.$ac_ext $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15782,7 +15829,7 @@ $as_echo_n "checking if preprocessing with $FPP of Fortran source supports requi if ${acx_sl_cv_fc_indirect_ok+:} false; then : $as_echo_n "(cached) " >&6 else - acx_sl_cv_fc_indirect_ok=yes + acx_sl_cv_fc_indirect_ok=yes # Set up ac_fpp_need_* flags based on features in acx_sl_fpp_srcext=${ac_fc_srcext-F} # defaults for needed features @@ -15865,12 +15912,10 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_ext="$acx_sl_fpp_srcext" cat > conftest.$ac_ext <<_ACEOF - program main - + program conftest #ifndef OK syntax error #endif - end _ACEOF ac_ext=${ac_fc_srcext-f} @@ -15888,7 +15933,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu do if test x"$FPP_DEFOPT" != x ; then : cp conftest.${acx_sl_fpp_srcext}.bak conftest.$acx_sl_fpp_srcext - { { echo Running preprocessor $FPP $FPPFLAGS ${FPP_DEFOPT}OK conftest.$acx_sl_fpp_srcext; } >&5 + { { echo Running preprocessor $FPP $FPPFLAGS ${FPP_DEFOPT}OK conftest.$acx_sl_fpp_srcext; } >&5 ($FPP $FPPFLAGS ${FPP_DEFOPT}OK conftest.$acx_sl_fpp_srcext \ >conftest.${ac_ext}.tmp) 2>&5 ac_status=$? @@ -15897,7 +15942,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu mv conftest.${ac_ext}.tmp conftest.${ac_ext} if ac_fn_fc_try_compile "$LINENO"; then : - acx_sl_prog_fc_cpp_d=yes; break + acx_sl_prog_fc_cpp_d=yes; break fi rm -f core conftest.err conftest.$ac_objext fi @@ -15927,9 +15972,8 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_ext="inc" cat > conftest.$ac_ext <<_ACEOF - ! This statement overrides the IMPLICIT statement in the program - REAL cc - + ! This statement overrides the IMPLICIT statement in the program + REAL cc _ACEOF ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' @@ -15947,14 +15991,12 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_ext="$acx_sl_fpp_srcext" cat > conftest.$ac_ext <<_ACEOF - program main - + program conftest IMPLICIT CHARACTER (c) -! Comments in test programs should be freeform compliant just in case. -! conftest.inc contains the Fortran statement "REAL cc" + ! Comments in test programs should be freeform compliant just in case. + ! conftest.inc contains the Fortran statement "REAL cc" #include "conftest.inc" cc=1. - end _ACEOF ac_ext=${ac_fc_srcext-f} @@ -15969,7 +16011,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu do if test x"$FPP_INCOPT" != x ; then : cp conftest.${acx_sl_fpp_srcext}.bak conftest.$acx_sl_fpp_srcext - { { echo Running preprocessor $FPP $FPPFLAGS ${FPP_INCOPT}conftst conftest.$acx_sl_fpp_srcext; } >&5 + { { echo Running preprocessor $FPP $FPPFLAGS ${FPP_INCOPT}conftst conftest.$acx_sl_fpp_srcext; } >&5 ($FPP $FPPFLAGS ${FPP_INCOPT}conftst conftest.$acx_sl_fpp_srcext \ >conftest.${ac_ext}.tmp) 2>&5 ac_status=$? @@ -15978,7 +16020,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu mv conftest.${ac_ext}.tmp conftest.${ac_ext} if ac_fn_fc_try_compile "$LINENO"; then : - acx_sl_prog_fc_cpp_i=yes + acx_sl_prog_fc_cpp_i=yes break fi rm -f core conftest.err conftest.$ac_objext @@ -16006,13 +16048,11 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_ext="$acx_sl_fpp_srcext" cat > conftest.$ac_ext <<_ACEOF - program main - + program conftest #define NM xxxx IMPLICIT CHARACTER (n) REAL xxxx NM=1. - end _ACEOF ac_ext=${ac_fc_srcext-f} @@ -16022,7 +16062,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 + { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 ($FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext \ >conftest.${ac_ext}.tmp) 2>&5 ac_status=$? @@ -16031,7 +16071,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu mv conftest.${ac_ext}.tmp conftest.${ac_ext} if ac_fn_fc_try_compile "$LINENO"; then : - acx_sl_prog_fc_cpp_subs=yes + acx_sl_prog_fc_cpp_subs=yes else acx_sl_cv_fc_indirect_ok=no fi @@ -16054,11 +16094,10 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_ext="$acx_sl_fpp_srcext" cat > conftest.$ac_ext <<_ACEOF - program main + program conftest #define LONG '901234567890123456789012345678901234567890123456789012345678901234567890' CHARACTER(LEN=80) :: A A=LONG - end _ACEOF ac_ext=${ac_fc_srcext-f} @@ -16068,7 +16107,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 + { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 ($FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext \ >conftest.${ac_ext}.tmp) 2>&5 ac_status=$? @@ -16077,7 +16116,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu mv conftest.${ac_ext}.tmp conftest.${ac_ext} if ac_fn_fc_try_compile "$LINENO"; then : - acx_sl_prog_fc_cpp_wrap=yes + acx_sl_prog_fc_cpp_wrap=yes else acx_sl_cv_fc_indirect_ok=no fi @@ -16099,10 +16138,8 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_ext="$acx_sl_fpp_srcext" cat > conftest.$ac_ext <<_ACEOF - program main - + program conftest A=1. /* C-style comment */ - end _ACEOF ac_ext=${ac_fc_srcext-f} @@ -16112,7 +16149,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 + { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 ($FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext \ >conftest.${ac_ext}.tmp) 2>&5 ac_status=$? @@ -16121,7 +16158,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu mv conftest.${ac_ext}.tmp conftest.${ac_ext} if ac_fn_fc_try_compile "$LINENO"; then : - acx_sl_prog_fc_cpp_CSTYLE=yes + acx_sl_prog_fc_cpp_CSTYLE=yes else acx_sl_cv_fc_indirect_ok=no fi @@ -16143,10 +16180,8 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_ext="$acx_sl_fpp_srcext" cat > conftest.$ac_ext <<_ACEOF - program main - + program conftest A=1. /* C-style comment */ - end _ACEOF ac_ext=${ac_fc_srcext-f} @@ -16156,7 +16191,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 + { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 ($FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext \ >conftest.${ac_ext}.tmp) 2>&5 ac_status=$? @@ -16165,7 +16200,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu mv conftest.${ac_ext}.tmp conftest.${ac_ext} if ac_fn_fc_try_compile "$LINENO"; then : - acx_sl_prog_fc_cpp_CSTYLE=yes + acx_sl_prog_fc_cpp_CSTYLE=yes else acx_sl_cv_fc_indirect_ok=no fi @@ -16187,11 +16222,9 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_ext="$acx_sl_fpp_srcext" cat > conftest.$ac_ext <<_ACEOF - PROGRAM MAIN + PROGRAM MAIN CHARACTER(LEN=10) :: C C = "abcde" // "fghij"; END PROGRAM - - _ACEOF ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' @@ -16200,7 +16233,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 + { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 ($FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext \ >conftest.${ac_ext}.tmp) 2>&5 ac_status=$? @@ -16209,7 +16242,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu mv conftest.${ac_ext}.tmp conftest.${ac_ext} if ac_fn_fc_try_compile "$LINENO"; then : - acx_sl_prog_fc_cpp_cxxstyle=yes + acx_sl_prog_fc_cpp_cxxstyle=yes else acx_sl_cv_fc_indirect_ok=no fi @@ -16231,11 +16264,9 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_ext="$acx_sl_fpp_srcext" cat > conftest.$ac_ext <<_ACEOF - PROGRAM MAIN + PROGRAM MAIN CHARACTER(LEN=10) :: C C = "abcde" // "fghij"; END PROGRAM - - _ACEOF ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' @@ -16244,7 +16275,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 + { { echo Running preprocessor $FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext; } >&5 ($FPP $FPPFLAGS conftest.$acx_sl_fpp_srcext \ >conftest.${ac_ext}.tmp) 2>&5 ac_status=$? @@ -16253,9 +16284,9 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu mv conftest.${ac_ext}.tmp conftest.${ac_ext} if ac_fn_fc_try_compile "$LINENO"; then : - acx_sl_prog_fc_cpp_cxxstyle=yes + acx_sl_prog_fc_cpp_cxxstyle=yes else - acx_sl_cv_fc_indirect_ok=no + acx_sl_cv_fc_indirect_ok=no fi rm -f core conftest.err conftest.$ac_objext if test x$acx_sl_cv_fc_indirect_ok = xyes; then : @@ -16270,7 +16301,7 @@ fi if test x$acx_sl_cv_fc_indirect_ok = xyes; then : else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "required Fortran preprocessor not available See \`config.log' for more details" "$LINENO" 5; } @@ -17441,6 +17472,8 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec_F77= tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; @@ -27229,9 +27262,499 @@ fi # ---------------------------------------------------------------------- # Compile with MPI support +# Sed expression to map a string onto a valid argument string part. +asx_tr_arg="eval sed 'y%*+%pp%;s%[^-$as_cr_alnum]%-%g'" + # Check whether --enable-mpi was given. if test "${enable_mpi+set}" = set; then : enableval=$enable_mpi; enable_mpi=yes + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + have_MPI_c_bindings=yes + + +# Check whether --with-mpi-root was given. +if test "${with_mpi_root+set}" = set; then : + withval=$with_mpi_root; MPIROOT="$with_mpi_root" +fi + + if ${MPIROOT+:} false; then : + if ${MPI_C_LIB+:} false; then : + +else + acx_temp=$MPIROOT + MPI_C_LIB="-L$acx_temp/lib" +fi + if ${MPI_C_INCLUDE+:} false; then : + +else + acx_temp=$MPIROOT + MPI_C_INCLUDE="-I$acx_temp/include" +fi +fi + +# Check whether --with-mpi-include was given. +if test "${with_mpi_include+set}" = set; then : + withval=$with_mpi_include; MPI_C_INCLUDE="-I$with_mpi_include" +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpi.h extra include path" >&5 +$as_echo_n "checking for mpi.h extra include path... " >&6; } + if ${acx_cv_c_include_mpi_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_include_search_mpi_h_SAVE="$CPPFLAGS" + while :; do + for ac_incdir in ''; do + if test -z "$ac_incdir"; then : + ac_res="none required" + CPPFLAGS="$MPI_C_INCLUDE $ac_include_search_mpi_h_SAVE" +else + ac_res="-I$ac_incdir" + CPPFLAGS="$MPI_C_INCLUDE $ac_res $ac_include_search_mpi_h_SAVE" +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +#include <mpi.h> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_cv_c_include_mpi_h=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if ${acx_cv_c_include_mpi_h+:} false; then : + if test -z "$ac_incdir"; then : + acx_cv_c_include_mpi_h="$MPI_C_INCLUDE" +else + acx_cv_c_include_mpi_h="$MPI_C_INCLUDE -I$ac_incdir" +fi +fi + if ${acx_cv_c_include_mpi_h+:} false; then : + break +fi + done + if ${acx_cv_c_include_mpi_h+:} false; then : + break +fi + + break + done + CPPFLAGS=$ac_include_search_mpi_h_SAVE +fi + + if ${acx_cv_c_include_mpi_h+:} false; then : + acx_temp=$acx_cv_c_include_mpi_h + if test x"$acx_temp" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_temp" >&5 +$as_echo "$acx_temp" >&6; } +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_c_include_mpi_h+:} false; then : + acx_temp=$acx_cv_c_include_mpi_h + acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` + MPI_C_INCLUDE=$acx_temp +else + have_MPI_c_bindings=no + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Required header mpi.h not found or not compilable. +See \`config.log' for more details" "$LINENO" 5; } + enable_MPI=no +fi + + +# Check whether --with-mpi-lib was given. +if test "${with_mpi_lib+set}" = set; then : + withval=$with_mpi_lib; MPI_C_LIB="-L$with_mpi_lib" +fi + + + + if test "x$have_MPI_c_bindings" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing MPI_Waitall" >&5 +$as_echo_n "checking for library containing MPI_Waitall... " >&6; } + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + acx_option_func_search_save_LIBS="$LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char MPI_Waitall (); +int +main () +{ +return MPI_Waitall (); + ; + return 0; +} +_ACEOF + for ac_lib in '' mpi mpich; do + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$MPI_C_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$MPI_C_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_MPI_Waitall_c="$MPI_C_LIB " +else + acx_cv_option_search_MPI_Waitall_c="$MPI_C_LIB -l$ac_lib " +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + break +fi + done + rm conftest.$ac_ext + LIBS="$acx_option_func_search_save_LIBS" + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + break +fi + + break + done +fi + + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + if test x"$acx_cv_option_search_MPI_Waitall_c" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_MPI_Waitall_c" >&5 +$as_echo "$acx_cv_option_search_MPI_Waitall_c" >&6; } +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + +else + have_MPI_c_bindings=no + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Cannot link C MPI programs. +See \`config.log' for more details" "$LINENO" 5; } + enable_MPI=no +fi + + acx_temp=$acx_cv_option_search_MPI_Waitall_c + acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` + MPI_C_LIB=$acx_temp + +fi + + + + + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test -n "$FC" && test "X$FC" != "Xno"; then : + ac_ext=${ac_fc_srcext-f} +ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' +ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_fc_compiler_gnu + + + + + + + + + have_MPI_fc_bindings=yes + + +# Check whether --with-mpi-root was given. +if test "${with_mpi_root+set}" = set; then : + withval=$with_mpi_root; MPIROOT="$with_mpi_root" +fi + + if ${MPIROOT+:} false; then : + if ${MPI_FC_LIB+:} false; then : + +else + acx_temp=$MPIROOT + MPI_FC_LIB="-L$acx_temp/lib" +fi + if ${MPI_FC_INCLUDE+:} false; then : + +else + acx_temp=$MPIROOT + MPI_FC_INCLUDE="$FPP_INCOPT$acx_temp/include" +fi +fi + +# Check whether --with-mpi-include was given. +if test "${with_mpi_include+set}" = set; then : + withval=$with_mpi_include; MPI_FC_INCLUDE="$FPP_INCOPT$with_mpi_include" +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpif.h extra include path" >&5 +$as_echo_n "checking for mpif.h extra include path... " >&6; } + if ${acx_cv_fc_include_mpif_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_include_search_mpif_h_SAVE="$FCFLAGS" + while :; do + for ac_incdir in ''; do + if test -z "$ac_incdir"; then : + ac_res="none required" + FCFLAGS="$MPI_FC_INCLUDE $ac_include_search_mpif_h_SAVE" +else + ac_res="$FPP_INCOPT$ac_incdir" + FCFLAGS="$MPI_FC_INCLUDE $ac_res $ac_include_search_mpif_h_SAVE" +fi + cat > conftest.$ac_ext <<_ACEOF + program conftest + include 'mpif.h' + end +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + acx_cv_fc_include_mpif_h=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if ${acx_cv_fc_include_mpif_h+:} false; then : + if test -z "$ac_incdir"; then : + acx_cv_fc_include_mpif_h="$MPI_FC_INCLUDE" +else + acx_cv_fc_include_mpif_h="$MPI_FC_INCLUDE $FPP_INCOPT$ac_incdir" +fi +fi + if ${acx_cv_fc_include_mpif_h+:} false; then : + break +fi + done + if ${acx_cv_fc_include_mpif_h+:} false; then : + break +fi + + break + done + FCFLAGS=$ac_include_search_mpif_h_SAVE +fi + + if ${acx_cv_fc_include_mpif_h+:} false; then : + acx_temp=$acx_cv_fc_include_mpif_h + if test x"$acx_temp" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_temp" >&5 +$as_echo "$acx_temp" >&6; } +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_fc_include_mpif_h+:} false; then : + acx_temp=$acx_cv_fc_include_mpif_h + acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` + MPI_FC_INCLUDE=$acx_temp +else + have_MPI_fc_bindings=no + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Required include mpif.h not found or not compilable. +See \`config.log' for more details" "$LINENO" 5; } + enable_MPI=no +fi + + +# Check whether --with-mpi-lib was given. +if test "${with_mpi_lib+set}" = set; then : + withval=$with_mpi_lib; MPI_FC_LIB="-L$with_mpi_lib" +fi + + + + if test "x$have_MPI_fc_bindings" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing mpi_waitall" >&5 +$as_echo_n "checking for library containing mpi_waitall... " >&6; } + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + acx_option_func_search_save_LIBS="$LIBS" + cat > conftest.$ac_ext <<_ACEOF + program conftest + call mpi_waitall + end +_ACEOF + for ac_lib in '' mpi mpi_f90 mpi_f77 mpich; do + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$MPI_FC_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$MPI_FC_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_fc_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB " +else + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB -l$ac_lib " +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi + done + rm conftest.$ac_ext + LIBS="$acx_option_func_search_save_LIBS" + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi + acx_option_func_search_save_LIBS="$LIBS" + cat > conftest.$ac_ext <<_ACEOF + program conftest + call mpi_waitall + end +_ACEOF + for ac_lib in '' mpi mpi_f90 mpi_f77 mpich; do + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$MPI_FC_LIB -lmpi_f77 -lmpi $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$MPI_FC_LIB $ac_res -lmpi_f77 -lmpi $acx_option_func_search_save_LIBS" +fi + if ac_fn_fc_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB -lmpi_f77 -lmpi" +else + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB -l$ac_lib -lmpi_f77 -lmpi" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi + done + rm conftest.$ac_ext + LIBS="$acx_option_func_search_save_LIBS" + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi + acx_option_func_search_save_LIBS="$LIBS" + cat > conftest.$ac_ext <<_ACEOF + program conftest + call mpi_waitall + end +_ACEOF + for ac_lib in '' mpi mpi_f90 mpi_f77 mpich; do + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$MPI_FC_LIB -lmpi $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$MPI_FC_LIB $ac_res -lmpi $acx_option_func_search_save_LIBS" +fi + if ac_fn_fc_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB -lmpi" +else + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB -l$ac_lib -lmpi" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi + done + rm conftest.$ac_ext + LIBS="$acx_option_func_search_save_LIBS" + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi + + break + done +fi + + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + if test x"$acx_cv_option_search_mpi_waitall_fc" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_mpi_waitall_fc" >&5 +$as_echo "$acx_cv_option_search_mpi_waitall_fc" >&6; } +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + +else + have_MPI_fc_bindings=no + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Cannot link Fortran MPI programs. +See \`config.log' for more details" "$LINENO" 5; } + enable_MPI=no +fi + + acx_temp=$acx_cv_option_search_mpi_waitall_fc + acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` + MPI_FC_LIB=$acx_temp + +fi + + + + + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi else enable_mpi=no fi @@ -27696,6 +28219,8 @@ else fi +ENABLE_MPI=`test x"$enable_mpi" = xyes && echo true || echo false` + # ---------------------------------------------------------------------- # Create the Fortran Interface via iso_c_binding module (Fortran 2003 Standard) # Check whether --enable-iso-c-interface was given. @@ -27811,8 +28336,8 @@ else cd conftestdir cat > conftest.$ac_ext <<_ACEOF module cnftst - implicit none - integer :: i + implicit none + integer :: i end module cnftst _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : @@ -27826,13 +28351,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext FCFLAGS_save=$FCFLAGS FCFLAGS="$FCFLAGS ${i}conftestdir" cat > conftest.$ac_ext <<_ACEOF - program main - use cnftst - implicit none - i = 0 - + program conftest + use cnftst + implicit none + i = 0 end - _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : acx_sl_cv_fc_mod_path_flag_fc=$i ; FCFLAGS=$FCFLAGS_save ; break @@ -27876,12 +28399,10 @@ ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest ac_compiler_gnu=$ac_cv_fc_compiler_gnu cat > conftest.$ac_ext <<_ACEOF - module conftest - implicit none - integer :: i + implicit none + integer :: i end module conftest - _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : @@ -28238,7 +28759,6 @@ else USE_FC_FALSE= fi - # Checks for compiler COMPILER="$CC $CFLAGS" @@ -28442,6 +28962,10 @@ CFLAGS="$CFLAGS${BUILD_CFLAGS+ $BUILD_CFLAGS}" FCFLAGS="$FCFLAGS${BUILD_FCFLAGS+ $BUILD_FCFLAGS}" LDFLAGS="$LDFLAGS${BUILD_LDFLAGS+ $BUILD_LDFLAGS}" LIBS="$LIBS${BUILD_LIBS+ $BUILD_LIBS}" +MPI_C_LIB="$MPI_C_LIB${BUILD_MPI_C_LIB+ $BUILD_MPI_C_LIB}" +MPI_FC_LIB="$MPI_FC_LIB${BUILD_MPI_FC_LIB+ $BUILD_MPI_FC_LIB}" +C_INCLUDE="$C_INCLUDE${BUILD_C_INCLUDE+ $BUILD_C_INCLUDE}" +FC_INCLUDE="$FC_INCLUDE${BUILD_FC_INCLUDE+ $BUILD_FC_INCLUDE}" CC="${BUILD_CC-$CC}" CXX="${BUILD_CXX-$CXX}" FC="${BUILD_FC-$FC}" diff --git a/configure.ac b/configure.ac index 978316cb6c4cd362eb0f89b6fd099ee594ae2814..01fe53fad8a1b92d67e07d2dc03f8332f62fbf50 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,8 @@ echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}" CONFIG_ABORT=yes AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) +dnl forbid acx macro names from remaining unexpanded +m4_pattern_forbid([^ACX_]) AC_CANONICAL_HOST AC_CANONICAL_BUILD @@ -129,7 +131,23 @@ ACX_OPTIONS AM_CONDITIONAL([ENABLE_NETCDF],[test x$ENABLE_NETCDF = xyes]) # ---------------------------------------------------------------------- # Compile with MPI support -AC_ARG_ENABLE(mpi,AS_HELP_STRING([--enable-mpi],[Compile with MPI compiler [default=no]]),enable_mpi=yes,enable_mpi=no) +AC_ARG_ENABLE([mpi], + AS_HELP_STRING([--enable-mpi], + [Compile with MPI compiler @<:@default=no@:>@]), + [enable_mpi=yes + ACX_C_PACKAGE([MPI],[mpi.h],,, + [AC_MSG_FAILURE([Required header mpi.h not found or not compilable.]) + enable_MPI=no],[MPI_Waitall],[mpi mpich],,, + [AC_MSG_FAILURE([Cannot link C MPI programs.]) + enable_MPI=no]) + AS_IF([test -n "$FC" && test "X$FC" != "Xno"], + [ACX_FORTRAN_PACKAGE([MPI], [mpif.h],,, + [AC_MSG_FAILURE([Required include mpif.h not found or not compilable.]) + enable_MPI=no],[mpi_waitall], + [mpi mpi_f90 mpi_f77 mpich],[[-lmpi_f77 -lmpi],[-lmpi]],, + [AC_MSG_FAILURE([Cannot link Fortran MPI programs.]) + enable_MPI=no],[])])], + [enable_mpi=no]) AS_IF([test x"${enable_mpi}" = x"yes"], [USE_MPI=yes]) HAVE_PARALLEL_NC4=0 @@ -218,6 +236,7 @@ AC_SUBST([HAVE_PARALLEL_NC4]) AM_CONDITIONAL([USE_MPI],[test x"$USE_MPI" = xyes]) AM_CONDITIONAL([USE_PPM_CORE],[test $enable_ppm = yes]) AC_SUBST([USE_MPI]) +AC_SUBST([ENABLE_MPI],[`test x"$enable_mpi" = xyes && echo true || echo false`]) # ---------------------------------------------------------------------- # Create the Fortran Interface via iso_c_binding module (Fortran 2003 Standard) AC_ARG_ENABLE([iso-c-interface], @@ -307,40 +326,20 @@ AM_CONDITIONAL([USE_FC],[test -n "$FC" && test "X$FC" != "Xno" && test x$acx_cv_ dnl AC_SUBST([CPPFLAGS])dnl dnl -AC_ARG_VAR([BUILD_CFLAGS], - [append to CFLAGS during build but not in configure phase])dnl -AC_CONFIG_COMMANDS_PRE([CFLAGS="$CFLAGS${BUILD_CFLAGS+ $BUILD_CFLAGS}"])dnl -AM_SUBST_NOTMAKE([BUILD_CFLAGS])dnl -AC_ARG_VAR([BUILD_FCFLAGS], - [append to FCFLAGS during build but not in configure phase])dnl -AC_CONFIG_COMMANDS_PRE([FCFLAGS="$FCFLAGS${BUILD_FCFLAGS+ $BUILD_FCFLAGS}"])dnl -AM_SUBST_NOTMAKE([BUILD_FCFLAGS])dnl -AC_ARG_VAR([BUILD_LDFLAGS], - [append to LDFLAGS during build but not in configure phase])dnl -AC_CONFIG_COMMANDS_PRE([LDFLAGS="$LDFLAGS${BUILD_LDFLAGS+ $BUILD_LDFLAGS}"])dnl -AM_SUBST_NOTMAKE([BUILD_LDFLAGS])dnl -AC_ARG_VAR([BUILD_LIBS], - [append to LIBS during build but not in configure phase])dnl -AC_CONFIG_COMMANDS_PRE([LIBS="$LIBS${BUILD_LIBS+ $BUILD_LIBS}"])dnl -AM_SUBST_NOTMAKE([BUILD_LIBS])dnl -AC_ARG_VAR([BUILD_CC], - [replace CC with expansion of $BUILD_CC during build but not in configure phase])dnl -AC_CONFIG_COMMANDS_PRE([CC="${BUILD_CC-$CC}"])dnl -AM_SUBST_NOTMAKE([BUILD_CC])dnl -AC_ARG_VAR([BUILD_CXX], - [replace CXX with expansion of $BUILD_CXX during build but not in configure phase])dnl -AC_CONFIG_COMMANDS_PRE([CXX="${BUILD_CXX-$CXX}"])dnl -AM_SUBST_NOTMAKE([BUILD_CXX])dnl -AC_ARG_VAR([BUILD_FC], - [replace FC with expansion of $BUILD_FC during build but not in configure phase])dnl -AC_CONFIG_COMMANDS_PRE([FC="${BUILD_FC-$FC}"])dnl -AM_SUBST_NOTMAKE([BUILD_FC])dnl -AC_ARG_VAR([BUILD_F77], - [replace F77 with expansion of $BUILD_F77 during build but not in configure phase])dnl -AC_CONFIG_COMMANDS_PRE([F77="${BUILD_F77-$F77}"])dnl -AM_SUBST_NOTMAKE([BUILD_F77])dnl - +m4_foreach([build_flag_var],[[BUILD_CFLAGS],[BUILD_FCFLAGS],[BUILD_LDFLAGS],[BUILD_LIBS],[BUILD_MPI_C_LIB],[BUILD_MPI_FC_LIB],[BUILD_C_INCLUDE],[BUILD_FC_INCLUDE]], + [AC_ARG_VAR(build_flag_var, + [append to ]m4_bpatsubst(build_flag_var, [BUILD_], [])[ during build but not in configure phase])dnl +AC_CONFIG_COMMANDS_PRE(m4_bpatsubst(build_flag_var, [BUILD_], [])[="$]m4_bpatsubst(build_flag_var, [BUILD_], [])[$]{build_flag_var+ $build_flag_var[}"])dnl +AM_SUBST_NOTMAKE(build_flag_var)])dnl +m4_foreach([build_tool_var],[[BUILD_CC],[BUILD_CXX],[BUILD_FC],[BUILD_F77]], + [AC_ARG_VAR(build_tool_var, + [replace ]m4_bpatsubst(build_tool_var, [BUILD_], [])[ with expansion of $]build_tool_var[ during build but not in configure phase])dnl +AC_CONFIG_COMMANDS_PRE(m4_bpatsubst(build_tool_var, [BUILD_], [])[="$]{build_tool_var-$[]m4_bpatsubst(build_tool_var, [BUILD_], [])}["])dnl +AM_SUBST_NOTMAKE(build_tool_var)])dnl +dnl +dnl +dnl # Checks for compiler COMPILER="$CC $CFLAGS" AC_DEFINE_UNQUOTED(COMPILER, ["$COMPILER"], [Compiler]) diff --git a/examples/Makefile.in b/examples/Makefile.in index 33c054c510b90b16021dfd197de4b3190223d353..e7ec26b544d0033eafd5c2539805e6dbb5d99dc2 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -89,17 +89,26 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ - $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/starlink_fpp.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/asx_tr_arg.m4 $(top_srcdir)/m4/asx_unset.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/starlink_fpp.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -270,6 +279,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NETCDF = @ENABLE_NETCDF@ @@ -317,6 +327,11 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_INCLUDE = @MPI_FC_INCLUDE@ +MPI_FC_LIB = @MPI_FC_LIB@ MPI_LAUNCH = @MPI_LAUNCH@ NC_CONFIG = @NC_CONFIG@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ diff --git a/examples/pio/Makefile.am b/examples/pio/Makefile.am index 5f28c90ae11213dd240b3093945b5e51ab7bcc25..88bbc1ae70c5eac78fb9a73b22088882ede9e558 100644 --- a/examples/pio/Makefile.am +++ b/examples/pio/Makefile.am @@ -1,7 +1,8 @@ noinst_PROGRAMS=collectData collectDataNStreams AM_CPPFLAGS = -I$(top_srcdir)/src $(YAXT_CFLAGS) -AM_FCFLAGS = $(FPP_INCOPT)$(top_srcdir)/src +AM_FCFLAGS = $(FPP_INCOPT)$(top_srcdir)/src $(MPI_FC_INCLUDE) +AM_CFLAGS = $(MPI_C_INCLUDE) if USE_MPI noinst_PROGRAMS+=compareResourcesArray @@ -15,14 +16,15 @@ endif collectData_SOURCES=collectData.c if USE_MPI -LDADD=$(top_builddir)/src/libcdipio.la +LDADD=$(top_builddir)/src/libcdipio.la $(MPI_C_LIB) +collectData2003_LDADD=$(top_builddir)/src/libcdipio.la $(MPI_FC_LIB) else -LDADD= +LDADD=$(top_builddir)/src/libcdi.la +collectData2003_LDADD=$(top_builddir)/src/libcdi.la endif -LDADD+=$(top_builddir)/src/libcdi.la collectData2003_SOURCES=collectData2003.F90 -collectDataNStreams_SOURCES=collectDataNStreams.c +collectDataNStreams_SOURCES = collectDataNStreams.c -compareResourcesArray_SOURCES=compareResourcesArray.c +compareResourcesArray_SOURCES = compareResourcesArray.c diff --git a/examples/pio/Makefile.in b/examples/pio/Makefile.in index ec6029c4faf3f7f7085e04712fe32d8418fde590..dee19eadfcaaaa2b3e4078d80261c9a68fc54a00 100644 --- a/examples/pio/Makefile.in +++ b/examples/pio/Makefile.in @@ -90,17 +90,26 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ - $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/starlink_fpp.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/asx_tr_arg.m4 $(top_srcdir)/m4/asx_unset.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/starlink_fpp.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -114,23 +123,23 @@ PROGRAMS = $(noinst_PROGRAMS) am_collectData_OBJECTS = collectData.$(OBJEXT) collectData_OBJECTS = $(am_collectData_OBJECTS) collectData_LDADD = $(LDADD) +am__DEPENDENCIES_1 = @USE_MPI_FALSE@collectData_DEPENDENCIES = \ @USE_MPI_FALSE@ $(top_builddir)/src/libcdi.la @USE_MPI_TRUE@collectData_DEPENDENCIES = \ @USE_MPI_TRUE@ $(top_builddir)/src/libcdipio.la \ -@USE_MPI_TRUE@ $(top_builddir)/src/libcdi.la +@USE_MPI_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_collectData2003_OBJECTS = collectData2003.$(OBJEXT) collectData2003_OBJECTS = $(am_collectData2003_OBJECTS) -collectData2003_LDADD = $(LDADD) @USE_MPI_FALSE@collectData2003_DEPENDENCIES = \ @USE_MPI_FALSE@ $(top_builddir)/src/libcdi.la @USE_MPI_TRUE@collectData2003_DEPENDENCIES = \ @USE_MPI_TRUE@ $(top_builddir)/src/libcdipio.la \ -@USE_MPI_TRUE@ $(top_builddir)/src/libcdi.la +@USE_MPI_TRUE@ $(am__DEPENDENCIES_1) am_collectDataNStreams_OBJECTS = collectDataNStreams.$(OBJEXT) collectDataNStreams_OBJECTS = $(am_collectDataNStreams_OBJECTS) collectDataNStreams_LDADD = $(LDADD) @@ -138,7 +147,7 @@ collectDataNStreams_LDADD = $(LDADD) @USE_MPI_FALSE@ $(top_builddir)/src/libcdi.la @USE_MPI_TRUE@collectDataNStreams_DEPENDENCIES = \ @USE_MPI_TRUE@ $(top_builddir)/src/libcdipio.la \ -@USE_MPI_TRUE@ $(top_builddir)/src/libcdi.la +@USE_MPI_TRUE@ $(am__DEPENDENCIES_1) am_compareResourcesArray_OBJECTS = compareResourcesArray.$(OBJEXT) compareResourcesArray_OBJECTS = $(am_compareResourcesArray_OBJECTS) compareResourcesArray_LDADD = $(LDADD) @@ -146,7 +155,7 @@ compareResourcesArray_LDADD = $(LDADD) @USE_MPI_FALSE@ $(top_builddir)/src/libcdi.la @USE_MPI_TRUE@compareResourcesArray_DEPENDENCIES = \ @USE_MPI_TRUE@ $(top_builddir)/src/libcdipio.la \ -@USE_MPI_TRUE@ $(top_builddir)/src/libcdi.la +@USE_MPI_TRUE@ $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -264,6 +273,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NETCDF = @ENABLE_NETCDF@ @@ -311,6 +321,11 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_INCLUDE = @MPI_FC_INCLUDE@ +MPI_FC_LIB = @MPI_FC_LIB@ MPI_LAUNCH = @MPI_LAUNCH@ NC_CONFIG = @NC_CONFIG@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ @@ -418,11 +433,14 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/src $(YAXT_CFLAGS) -AM_FCFLAGS = $(FPP_INCOPT)$(top_srcdir)/src $(am__append_2) +AM_FCFLAGS = $(FPP_INCOPT)$(top_srcdir)/src $(MPI_FC_INCLUDE) \ + $(am__append_2) +AM_CFLAGS = $(MPI_C_INCLUDE) collectData_SOURCES = collectData.c @USE_MPI_FALSE@LDADD = $(top_builddir)/src/libcdi.la -@USE_MPI_TRUE@LDADD = $(top_builddir)/src/libcdipio.la \ -@USE_MPI_TRUE@ $(top_builddir)/src/libcdi.la +@USE_MPI_TRUE@LDADD = $(top_builddir)/src/libcdipio.la $(MPI_C_LIB) +@USE_MPI_FALSE@collectData2003_LDADD = $(top_builddir)/src/libcdi.la +@USE_MPI_TRUE@collectData2003_LDADD = $(top_builddir)/src/libcdipio.la $(MPI_FC_LIB) collectData2003_SOURCES = collectData2003.F90 collectDataNStreams_SOURCES = collectDataNStreams.c compareResourcesArray_SOURCES = compareResourcesArray.c diff --git a/examples/pio/compareResourcesArray.c b/examples/pio/compareResourcesArray.c index 53dc0f59e1fc63f299eec39cc518aed6ef9044d3..1cd44591178a218b3a0dbb3dbe92123de530191b 100644 --- a/examples/pio/compareResourcesArray.c +++ b/examples/pio/compareResourcesArray.c @@ -4,7 +4,6 @@ #include <stdio.h> -#ifdef USE_MPI #include <mpi.h> #include <yaxt.h> #include "cdi.h" @@ -223,23 +222,20 @@ static void modelRun ( MPI_Comm comm ) return; } -#endif - -int main (int argc, char *argv[]) +int main (int argc, char *argv[]) { -#ifdef USE_MPI int sizeGlob, pioNamespace; MPI_Comm commGlob, commModel; - MPI_Init(&argc, &argv); + MPI_Init(&argc, &argv); commGlob = MPI_COMM_WORLD; xt_initialize(commGlob); xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN )); - xmpi ( MPI_Comm_size ( commGlob, &sizeGlob )); + xmpi ( MPI_Comm_size ( commGlob, &sizeGlob )); - if ( sizeGlob != 1 ) + if ( sizeGlob != 1 ) xabort ( "test transition of resource array only with 1 PE." ); - + if ( nProcsIO != 1 ) xabort ( "bad distribution of tasks on PEs" ); @@ -250,10 +246,7 @@ int main (int argc, char *argv[]) modelRun ( commModel ); xt_finalize(); - MPI_Finalize (); -#else - printf ( "Use MPI for this testprogram.\n" ); -#endif + MPI_Finalize (); return 0; } diff --git a/interfaces/Makefile.in b/interfaces/Makefile.in index 40faeee854bb4295c5c8870e7aa21d288fb1e2f3..646a909aaad40acfe6727085f0b1bb0f13109a17 100644 --- a/interfaces/Makefile.in +++ b/interfaces/Makefile.in @@ -96,17 +96,26 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ - $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/starlink_fpp.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/asx_tr_arg.m4 $(top_srcdir)/m4/asx_unset.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/starlink_fpp.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -248,6 +257,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NETCDF = @ENABLE_NETCDF@ @@ -295,6 +305,11 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_INCLUDE = @MPI_FC_INCLUDE@ +MPI_FC_LIB = @MPI_FC_LIB@ MPI_LAUNCH = @MPI_LAUNCH@ NC_CONFIG = @NC_CONFIG@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ diff --git a/m4/ac_lang_program_fortran.m4 b/m4/ac_lang_program_fortran.m4 new file mode 100644 index 0000000000000000000000000000000000000000..566dbe2734d4c9976f7e417cd2fa19b097fe4300 --- /dev/null +++ b/m4/ac_lang_program_fortran.m4 @@ -0,0 +1,57 @@ +dnl we override the AC_LANG_PROGRAM macro here so we can portably +dnl include a Fortran header +dnl +dnl it's meant to stay only as long as 2.64 is still reasonably current +dnl the original Copyright notice is as follows: +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program 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 General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# AC_LANG_PROGRAM(Fortran)([PROLOGUE], [BODY]) +# ----------------------------------------------- +# FIXME: can the PROLOGUE be used? +# Yes, override AC_LANG_PROGRAM(Fortran)([PROLOGUE], [BODY]) with a version +# that uses prologue +m4_define([AC_LANG_PROGRAM(Fortran)],dnl +[ program conftest +m4_ifval([$1],[$1 +])$2 + end]) diff --git a/m4/acx_c_package.m4 b/m4/acx_c_package.m4 new file mode 100644 index 0000000000000000000000000000000000000000..4ffa1694a35e70148ab8bb6439e17b714904d7d7 --- /dev/null +++ b/m4/acx_c_package.m4 @@ -0,0 +1,66 @@ +dnl +dnl Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: configure configure.ac autotools +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl Commentary: +dnl +dnl +dnl +dnl Code: +dnl +dnl +dnl ACX_C_PACKAGE(PACKAGE, +dnl [INCLUDE], [EXTRA-INCLUDES], [EXTRA-INCLUDEFLAGS], +dnl [ACTION-IF_HEADER-NOT-FOUND], +dnl [FUNCTION], [LIB-CANDIDATES], [EXTRA-LIBS], [EXTRA-LIBFLAGS], +dnl [ACTION-IF-LIB-NOT-FOUND], +dnl [DEFAULT-ROOT]) +dnl ------------------------------------------------------------------- +dnl Check wether INCLUDE can be compiled and FUNCTION is found in +dnl LIB-CANDIDATES. Sets PACKAGE_C_LIB and PACKAGE_C_INCLUDE variables to +dnl necessary C compiler switches and arguments such that +dnl inclusion/compilation succeed for program using INCLUDE or +dnl FUNCTION respectively. +dnl Also defines configure --with arguments for PACKAGEROOT, +dnl PACKAGE-LIB and PACKAGE-INCLUDE. +AC_DEFUN([ACX_C_PACKAGE], + [AC_LANG_PUSH([C]) + ACX_GENERIC_PACKAGE([$1],[$2],[-I],[$3],[$4],[$5],[$6],[-L],[$7],[$8],[$9],[$10],[$11],[$12]) + AC_LANG_POP([C])dnl + ]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/m4/acx_fortran_check_include.m4 b/m4/acx_fortran_check_include.m4 new file mode 100644 index 0000000000000000000000000000000000000000..c902ed0667822b162e17e8a28d63fd5d931d08ed --- /dev/null +++ b/m4/acx_fortran_check_include.m4 @@ -0,0 +1,92 @@ +dnl acx_fortran_check_include.m4 --- check module inclusion in compilation +dnl +dnl Copyright (C) 2012 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl +# _ACX_FORTRAN_CHECK_MOD_IFELSE(MOD-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [PREAMBLE]) +# ------------------------------------------------------------------ +# Check the compiler accepts MOD-FILE. The PREAMBLE might be defaulted. +m4_defun([_ACX_FORTRAN_CHECK_MOD_IFELSE], + [AC_LANG_PUSH([Fortran]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,m4_ifval([$4], +[ $4 +])[ use $1])], + [AS_VAR_SET([acx_Mod], [yes])]) + AC_LANG_POP([Fortran]) + AS_VAR_SET_IF([acx_Mod],[$2],[$3])dnl +])# _ACX_FORTRAN_CHECK_MOD_IFELSE +# ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE(MOD-FILE, PATH... +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [MODS], [MOD-FLAGS], [TAG]) +# ------------------------------------------------------------------ +# Check the compiler loads MOD-FILE. The MODS might be defaulted. +# TAG defaults to extra +AC_DEFUN([ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE], + [AC_REQUIRE([AC_PROG_FC]) + AC_REQUIRE([ACX_SL_FC_CHECK_MOD_PATH_FLAG]) + AS_VAR_PUSHDEF([acx_Mod], [acx_cv_fortran_mod_$1])dnl + AC_MSG_CHECKING([for $1 m4_default([$7],[extra]) module path]) + AC_CACHE_VAL([acx_Mod],dnl + [ac_mod_search_FCFLAGS_SAVE="$FCFLAGS" + for ac_moddir in '' $2; do + AS_IF([test -z "$ac_moddir"], + [ac_res="none required" + FCFLAGS="m4_ifval([$6],[$6 ])$ac_mod_search_FCFLAGS_SAVE"], + [ac_res="$FC_MOD_FLAG$ac_moddir" + FCFLAGS="m4_ifval([$6],[$6 ])$ac_res $ac_mod_search_FCFLAGS_SAVE"]) + _ACX_FORTRAN_CHECK_MOD_IFELSE([$1],dnl + [AS_IF([test -z "$ac_moddir"],dnl + [AS_VAR_SET([acx_Mod],["$6"])],dnl + [AS_VAR_SET([acx_Mod],["]m4_ifval([$6],[$6 ])[$FC_MOD_FLAG$ac_moddir"])])],,[$5]) + AS_VAR_SET_IF([acx_Mod], [break])dnl + done + FCFLAGS="$ac_mod_search_FCFLAGS_SAVE"]) + AS_VAR_SET_IF([acx_Mod],dnl + [AS_IF([test x"AS_VAR_GET([acx_Mod])" = x],dnl + [AC_MSG_RESULT([(none required)])],dnl + [AC_MSG_RESULT([AS_VAR_GET([acx_Mod])])])], + [AC_MSG_RESULT([not found])]) + AS_VAR_SET_IF([acx_Mod], [$3], [$4])[]dnl + AS_VAR_POPDEF([acx_Mod])dnl +])# ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/acx_fortran_package.m4 b/m4/acx_fortran_package.m4 new file mode 100644 index 0000000000000000000000000000000000000000..aa5b316e6279a3e92c578c7d08fc7a9c1d9682ab --- /dev/null +++ b/m4/acx_fortran_package.m4 @@ -0,0 +1,144 @@ +dnl acx_fortran_package.m4 --- aggregate check for availability of +dnl include file(s) and library routines +dnl associated with a given package +dnl +dnl Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: fortran package availability check +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl Commentary: +dnl +dnl +dnl +dnl Code: +dnl +dnl +dnl ACX_FORTRAN_PACKAGE(PACKAGE, +dnl [INCLUDE], [EXTRA-INCLUDES], [EXTRA-INCLUDEFLAGS], +dnl [ACTION-IF_HEADER-NOT-FOUND], +dnl [FUNCTION], [LIB-CANDIDATES], [EXTRA-LIBS], [EXTRA-LIBFLAGS], +dnl [ACTION-IF-LIB-NOT-FOUND], +dnl [DEFAULT-ROOT]) +dnl ------------------------------------------------------------------- +dnl Check wether INCLUDE can be compiled and FUNCTION is found in +dnl LIB-CANDIDATES. Sets PACKAGE_LIB and PACKAGE_INCLUDE variables to +dnl necessary Fortran compiler switches and arguments such that +dnl inclusion/compilation succeed for program using INCLUDE or +dnl FUNCTION respectively. +dnl Also defines configure --with arguments for PACKAGEROOT, +dnl PACKAGE-LIB and PACKAGE-INCLUDE. +AC_DEFUN([ACX_FORTRAN_PACKAGE], + [AC_LANG_PUSH([Fortran]) + AC_REQUIRE([AC_PROG_FPP]) + ACX_GENERIC_PACKAGE([$1],[$2],[$FPP_INCOPT],[$3],[$4],[$5],[$6],[-L],[$7],[$8],[$9],[$10],[$11],[$12]) + AC_LANG_POP([Fortran])dnl + ]) +dnl +dnl +dnl ACX_F90_PACKAGE: same as ACX_FORTRAN_PACKAGE but uses module +dnl instead of header +dnl +dnl ACX_F90_PACKAGE(PACKAGE, +dnl MODULE, [EXTRA-INCLUDES], [EXTRA-INCLUDEFLAGS], +dnl [ACTION-IF-MODULE-NOT-FOUND], +dnl SUBROUTINE, [LIB-CANDIDATES], [EXTRA-LIBS], [EXTRA-LIBFLAGS], +dnl [ACTION-IF-LIB-NOT-FOUND], +dnl [DEFAULT-ROOT],[EXTRA-DECLARATION],[SUBROUTINE-ARGUMENTS]) +dnl ------------------------------------------------------------------- + +dnl Check wether USE MODULE can be compiled and FUNCTION is found in +dnl LIB-CANDIDATES. Sets PACKAGE_LIB and PACKAGE_MOD variables to +dnl necessary Fortran compiler switches and arguments such that +dnl compilation and linking succeed for programs using MODULE and +dnl calling SUBROUTINE respectively. Extra declaration will be +dnl inserted between use MODULE and the subroutine call. +dnl +dnl Also defines configure --with arguments for PACKAGEROOT, +dnl PACKAGE_FC_LIB and PACKAGE_FC_MOD. +AC_DEFUN([ACX_F90_PACKAGE], + [AC_LANG_PUSH([Fortran]) + AC_REQUIRE([AC_PROG_FC]) + AC_REQUIRE([ACX_SL_FC_CHECK_MOD_PATH_FLAG]) + AC_REQUIRE([_ASX_TR_ARG_PREPARE]) + AC_SUBST(AS_TR_CPP([$1][root])) + AC_ARG_WITH(ASX_TR_ARG([$1-root]), + [AS_HELP_STRING([--with-]ASX_TR_ARG([$1])[-root], + [set directory to search for $1 headers and library, @<:@default=$11@:>@])], + [AS_TR_CPP([$1][root])="$AS_TR_SH([with_]ASX_TR_ARG([$1])[_root])"], + m4_ifval([$11], [AS_TR_CPP([$1][root])=$11])) + AS_VAR_SET_IF(AS_TR_CPP([$1][root]), + [AS_VAR_SET_IF([AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])],, + [AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])="-L$[]AS_TR_CPP([$1][root])/lib"]) + AS_VAR_SET_IF([AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])],, + [AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])="$FC_MOD_FLAG$[]AS_TR_CPP([$1][root])/include"])]) + m4_ifval([$2],dnl + [AC_ARG_WITH(ASX_TR_ARG([$1-]_AC_LANG_ABBREV[-mod]), + [AS_HELP_STRING([--with-]ASX_TR_ARG([$1-]_AC_LANG_ABBREV)[-mod], + [specifically set directory to search for $1 module, ]dnl +[@<:@default=$]AS_TR_SH(ASX_TR_ARG([with_$1_root]))[/include@:>@])], + AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])[="$FC_MOD_FLAG$AS_TR_SH(ASX_TR_ARG([with_$1_]_AC_LANG_ABBREV[_mod]))"], + []) + AC_ARG_VAR(AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD]), + [flags to enable 'USE $1' in Fortran program.]) + ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE([$2],["$[]AS_TR_CPP([$1][root])/include" "$[]AS_TR_CPP([$1][root])/lib"], + AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])[=]AS_VAR_GET([acx_Mod]), + [$5], + [$3],m4_ifval([$4],[$4 ])[$[]AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])])]) + m4_ifval([$6], + [AC_ARG_WITH(ASX_TR_ARG([$1]_AC_LANG_ABBREV[-lib]), + [AS_HELP_STRING([--with-]ASX_TR_ARG([$1-]_AC_LANG_ABBREV)[-lib], + [specifically set directory to search for $1 library, ]dnl +[@<:@default=$]AS_TR_SH(ASX_TR_ARG([with_$1_root]))[/lib@:>@])], + AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])[="-L$AS_TR_SH(ASX_TR_ARG([with_$1_]_AC_LANG_ABBREV[_lib]))"], + []) + AS_IF([test x$]AS_TR_SH([have_][$1_]_AC_LANG_ABBREV[_bindings])[ = xyes], + [AS_VAR_PUSHDEF([ac_Search], [acx_cv_option_search_$6_]_AC_LANG_ABBREV)dnl + AC_SUBST(AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])) + acx_save_FCFLAGS="$FCFLAGS" + FCFLAGS="$[]AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD]) $FCFLAGS" + ACX_OPTION_SEARCH_LIBS_MULTI([$6],[$7],,dnl + [$10],[$8],m4_ifval([$9],[$9 ])$[]AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB]), + [ use $2]m4_ifval([$12],[[ + $12]]),[ call $6$13]) + FCFLAGS="$acx_save_FCFLAGS" + AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])="AS_VAR_GET([ac_Search])" + AS_VAR_POPDEF([ac_Search])])]) + AC_LANG_POP([Fortran])dnl + ]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/acx_lang_c_check_include.m4 b/m4/acx_lang_c_check_include.m4 new file mode 100644 index 0000000000000000000000000000000000000000..8c04bfcd43a3c85ec60ce8a383c68e72ca23aa0f --- /dev/null +++ b/m4/acx_lang_c_check_include.m4 @@ -0,0 +1,62 @@ +dnl acx_lang_c_check_include.m4 --- Check wether an include succeeds +dnl given one from a collection of +dnl include paths. +dnl +dnl Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: c header check -I path +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl Commentary: +dnl +dnl +dnl +dnl Code: +dnl +# ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE(C)(HEADER-FILE, PATH... +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES], [INCLUDE-FLAGS], [EXTRA-INCLUDE-FLAG-SETS]) +# ------------------------------------------------------------------ +# Check the compiler accepts HEADER-FILE. The INCLUDES might be defaulted. +AC_DEFUN([ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE(C)],dnl + [ACX_GENERIC_CHECK_INCLUDE_PATHS_IFELSE(CPPFLAGS,-I,$@)]) +# +m4_define([ACX_LANG_INCLUDE_PROGRAM(C)], + [AC_LANG_SOURCE([AC_INCLUDES_DEFAULT([$2]) +@%:@include <$1>])]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/acx_lang_check_include.m4 b/m4/acx_lang_check_include.m4 new file mode 100644 index 0000000000000000000000000000000000000000..9d4832fd5ecf8904718af1ae2087e033dd72672a --- /dev/null +++ b/m4/acx_lang_check_include.m4 @@ -0,0 +1,123 @@ +dnl acx_lang_check_include.m4 --- generic check for package includes +dnl +dnl Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: package include check +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl Commentary: +dnl +dnl +dnl +dnl Code: +dnl +# ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE(HEADER-FILE, PATH... +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES], [INCLUDE-FLAGS]) +# ------------------------------------------------------------------ +# Check wether the compiler accepts HEADER-FILE. +# The INCLUDES might be defaulted. +AC_DEFUN([ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE],dnl + [_AC_LANG_DISPATCH([$0],_AC_LANG,$@)]) + +# ACX_LANG_INCLUDE_PROGRAM(HEADER-FILE,[PRELUDE]) +AC_DEFUN([ACX_LANG_INCLUDE_PROGRAM], + [_AC_LANG_DISPATCH([$0],_AC_LANG,$@)]) + +# AC_LANG_CHECK_INCLUDE_IFELSE(HEADER-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# ------------------------------------------------------------------ +# Check the compiler accepts HEADER-FILE. The INCLUDES might be defaulted. +AC_DEFUN([_ACX_LANG_CHECK_INCLUDE_IFELSE], + [AC_COMPILE_IFELSE([ACX_LANG_INCLUDE_PROGRAM([$1],[$4])], + [AS_VAR_SET([acx_Include], [yes])]) + AS_VAR_SET_IF([acx_Include],[$2],[$3])dnl +])# AC_LANG_CHECK_INCLUDE_IFELSE + +# ACX_LANG_CHECK_INCLUDE_IFELSE(HEADER-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# ------------------------------------------------------------------ +# Check the compiler accepts HEADER-FILE. The INCLUDES might be defaulted. +AC_DEFUN([ACX_LANG_CHECK_INCLUDE_IFELSE], + [AS_VAR_PUSHDEF([acx_Include], [acx_cv_]_AC_LANG_ABBREV[_include_$1])dnl + AC_CACHE_CHECK([for $1],[acx_Include],dnl + [_ACX_LANG_CHECK_INCLUDE_IFELSE([$1],[$2],[$3],[$4])]) + AS_VAR_POPDEF([acx_Include])]) + +# ACX_GENERIC_CHECK_INCLUDE_PATHS_IFELSE(FLAGSVAR, INCOPT, HEADER-FILE, PATH... +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES], [INCLUDE-FLAGS], [EXTRA-INCLUDE-FLAG-SETS]) +# ------------------------------------------------------------------ +# Check wether the the current language compiler accepts HEADER-FILE. +# The INCLUDES might be defaulted. +AC_DEFUN([ACX_GENERIC_CHECK_INCLUDE_PATHS_IFELSE], + [AS_VAR_PUSHDEF([acx_Include], [acx_cv_]_AC_LANG_ABBREV[_include_$3])dnl + AS_VAR_PUSHDEF([save_flags],[ac_include_search_$3_SAVE]) + AC_MSG_CHECKING([for $3 extra include path]) + AC_CACHE_VAL([acx_Include],dnl + [AS_VAR_SET([save_flags],["@S|@$1"]) + while :; do + m4_foreach([ACX_IncSet],[$9], + [for ac_incdir in ''m4_ifval([$4],[ $4]); do + AS_IF([test -z "$ac_incdir"], + [ac_res="none required" + $1="m4_ifval(ACX_IncSet,ACX_IncSet )$8 AS_VAR_GET([save_flags])"], + [ac_res="$2$ac_incdir" + $1="m4_ifval(ACX_IncSet,ACX_IncSet )$8 $ac_res AS_VAR_GET([save_flags])"]) + _ACX_LANG_CHECK_INCLUDE_IFELSE([$3],dnl + [AS_IF([test -z "$ac_incdir"],dnl + [AS_VAR_SET([acx_Include],["]m4_ifval(ACX_IncSet,ACX_IncSet )$8["])],dnl + [AS_VAR_SET([acx_Include],["]m4_ifval(ACX_IncSet,ACX_IncSet )[$8 $2$ac_incdir"])])],,[$7]) + AS_VAR_SET_IF([acx_Include], [break]) + done + AS_VAR_SET_IF([acx_Include], [break]) + ]) + break + done + AS_VAR_COPY([$1],[save_flags])]) + AS_VAR_SET_IF([acx_Include], + [acx_temp=]AS_VAR_GET([acx_Include])[ + AS_IF([test x"$acx_temp" = x], + [AC_MSG_RESULT([(none required)])], + [AC_MSG_RESULT([$acx_temp])])], + [AC_MSG_RESULT([not found])]) + AS_VAR_SET_IF([acx_Include], [$5], [$6]) + AS_VAR_POPDEF([acx_Include])])dnl +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/acx_lang_fortran_check_include.m4 b/m4/acx_lang_fortran_check_include.m4 new file mode 100644 index 0000000000000000000000000000000000000000..f522555ef06c58d5f8fd829affdf9df4d50fd649 --- /dev/null +++ b/m4/acx_lang_fortran_check_include.m4 @@ -0,0 +1,66 @@ +dnl acx_lang_fortran_check_include.m4 --- check for fortran include files +dnl given a collection of paths +dnl +dnl Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl Commentary: +dnl +dnl +dnl +dnl Code: +dnl +# ACX_FORTRAN_CHECK_INCLUDE_PATHS_IFELSE(HEADER-FILE, PATH... +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES], [INCLUDE-FLAGS]) +# ------------------------------------------------------------------ +# Check the compiler accepts HEADER-FILE. The INCLUDES might be defaulted. +AC_DEFUN([ACX_FORTRAN_CHECK_INCLUDE_PATHS_IFELSE], + [AC_LANG_PUSH([Fortran]) + ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE($@) + AC_LANG_POP([Fortran])]) +dnl /ACX_FORTRAN_CHECK_INCLUDE_PATHS_IFELSE +dnl +AC_DEFUN([ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE(Fortran)],dnl + [ACX_GENERIC_CHECK_INCLUDE_PATHS_IFELSE(FCFLAGS,$FPP_INCOPT,$@)]) +dnl +AC_DEFUN([ACX_LANG_INCLUDE_PROGRAM(Fortran)], + [AC_LANG_PROGRAM([$2],[ include '$1'])]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/acx_lang_package.m4 b/m4/acx_lang_package.m4 new file mode 100644 index 0000000000000000000000000000000000000000..f4c4b6b4f46f89c93ce103dc8a4672b7b7f56119 --- /dev/null +++ b/m4/acx_lang_package.m4 @@ -0,0 +1,134 @@ +dnl acx_lang_package.m4 --- generic check for packaged software component +dnl consisting of header and library in directories +dnl that can be used by adding the flags in +dnl PACKAGE_LANG_INCLUDE and PACKAGE_LANG_LIB +dnl respectively to the language compiler command +dnl +dnl Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl Commentary: +dnl +dnl +dnl +dnl Code: +dnl +dnl +dnl ACX_GENERIC_PACKAGE(PACKAGE, [INCLUDE], INC_FLAG, [EXTRA-INCLUDES], +dnl [EXTRA-INCLUDEFLAGS], [ACTION-IF_HEADER-NOT-FOUND], [FUNCTION], +dnl LIBFLAG, [LIB-CANDIDATES], [EXTRA-LIBS], [EXTRA-LIBFLAGS], +dnl [ACTION-IF-LIB-NOT-FOUND], [DEFAULT-ROOT]) +dnl ------------------------------------------------------------------- +dnl Check wether INCLUDE can be compiled and FUNCTION is found in +dnl LIB-CANDIDATES with current language compiler. Sets PACKAGE_LANG_LIB +dnl and PACKAGE_LANG_INCLUDE variables to necessary compiler +dnl switches and arguments such that inclusion/compilation succeed for +dnl program using INCLUDE or FUNCTION respectively. Also defines +dnl configure --with arguments for PACKAGEROOT, PACKAGE-LIB and +dnl PACKAGE-INCLUDE. +dnl The code sets the shell variable have_PACKAGE__AC_LANG_ABBREV_bindings +dnl to yes if all requested tests succeeded, to no if any test failed. +dnl The library check will not run if the header check failed. +AC_DEFUN([ACX_GENERIC_PACKAGE], + [AC_REQUIRE([_ASX_TR_ARG_PREPARE]) + AS_VAR_PUSHDEF([acx_pkg_root],[AS_TR_CPP([$1][root])]) + AS_VAR_PUSHDEF([acx_pkg_lib],[AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])]) + AS_VAR_PUSHDEF([acx_pkg_inc],[AS_TR_CPP([$1_]_AC_LANG_ABBREV[_INCLUDE])]) + AS_VAR_PUSHDEF([acx_cv_pkg_inc], + [AS_TR_SH([acx_cv_]_AC_LANG_ABBREV[_include_]$2)]) + AS_VAR_PUSHDEF([acx_pkg_bindings], + [AS_TR_SH([have_][$1_]_AC_LANG_ABBREV[_bindings])]) + AS_VAR_SET([acx_pkg_bindings],[yes]) + AC_SUBST(acx_pkg_root) + AC_ARG_WITH(ASX_TR_ARG([$1-root]), + [AS_HELP_STRING([--with-]ASX_TR_ARG([$1])[-root], + [set directory to search for $1 headers and library]m4_ifval([$13],[, @<:@default=$13@:>@]))], + [AS_VAR_SET([acx_pkg_root],"$AS_TR_SH([with_]ASX_TR_ARG([$1])[_root])")], + m4_ifval([$13], AS_VAR_SET([acx_pkg_root],[$13]))) + AS_VAR_SET_IF([acx_pkg_root], + [AS_VAR_SET_IF([acx_pkg_lib],, + [AS_VAR_COPY([acx_temp],acx_pkg_root) + AS_VAR_SET([acx_pkg_lib],["$8$acx_temp/lib"])]) + AS_VAR_SET_IF([acx_pkg_inc],, + [AS_VAR_COPY([acx_temp],acx_pkg_root) + AS_VAR_SET([acx_pkg_inc],["$3$acx_temp/include"])])]) + m4_ifval([$2], + [AC_ARG_WITH(ASX_TR_ARG([$1-include]), + [AS_HELP_STRING([--with-[]ASX_TR_ARG([$1])[]-include], + [specifically set directory to search for $1 headers, ]dnl +[@<:@default=$]AS_TR_SH(ASX_TR_ARG([with_$1_root]))[/include@:>@])], + [AS_VAR_SET([acx_pkg_inc],["]$3[$]AS_TR_SH(ASX_TR_ARG([with_$1_include]))["])]) + AC_ARG_VAR(acx_pkg_inc,dnl +[specifically set flags to use when compiling sources +using $1 includes.]) + ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE([$2],[], + [AS_VAR_COPY([acx_temp],[acx_cv_pkg_inc]) + acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` + AS_VAR_COPY([acx_pkg_inc],[acx_temp])], + [AS_VAR_SET([acx_pkg_bindings],[no]) + $6], + [$4],[$]acx_pkg_inc,m4_ifval([$5],[[$5]],[[[]]]))]) + m4_ifval([$7], + [AC_ARG_WITH(ASX_TR_ARG([$1-lib]), + [AS_HELP_STRING([--with-]ASX_TR_ARG([$1])[-lib], + [specifically set directory to search for $1 library, ]dnl +[@<:@default=$]AS_TR_SH(ASX_TR_ARG([with_$1_root]))[/lib@:>@])], + [AS_VAR_SET([acx_pkg_lib],["$8$AS_TR_SH(ASX_TR_ARG([with_$1_lib]))"])]) + AC_ARG_VAR(acx_pkg_lib, + [specifically set flags to use when linking $1.]) + AC_SUBST(acx_pkg_lib) + AS_VAR_IF([acx_pkg_bindings],[yes], + [AS_VAR_PUSHDEF([ac_Search],[acx_cv_option_search_$7_]_AC_LANG_ABBREV)dnl + ACX_OPTION_SEARCH_LIBS_MULTI([$7],[$9],,dnl + [AS_VAR_SET([acx_pkg_bindings],[no]) + $12],[$10],m4_ifval([$11],[$11 ])$[acx_pkg_lib]) + AS_VAR_COPY([acx_temp],[ac_Search]) + acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` + AS_VAR_COPY([acx_pkg_lib],[acx_temp]) + AS_VAR_POPDEF([ac_Search])dnl + ]) + ])dnl + AS_VAR_POPDEF([acx_pkg_bindings]) + AS_VAR_POPDEF([acx_cv_pkg_inc]) + AS_VAR_POPDEF([acx_pkg_inc]) + AS_VAR_POPDEF([acx_pkg_lib]) + AS_VAR_POPDEF([acx_pkg_root]) + ]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/acx_option_search_libs.m4 b/m4/acx_option_search_libs.m4 new file mode 100644 index 0000000000000000000000000000000000000000..a00edfb3a8151850ddf520ffc13b67c90c0a879d --- /dev/null +++ b/m4/acx_option_search_libs.m4 @@ -0,0 +1,128 @@ +dnl acx_option_search_libs.m4 --- Search for library needed only by some +dnl sub-components and do not add corresponding +dnl flags to LIBS but give the user control with +dnl respect to how the test result is used +dnl +dnl Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl Commentary: +dnl +dnl +dnl +dnl Code: +dnl +dnl _ACX_OPTION_SEARCH_LIBS(FUNCTION, SEARCH-LIBS, +dnl [OTHER-LIBRARIES], [EXTRA-FLAGS], [PREAMBLE], [CALL-CODE]) +dnl same as ACX_OPTION_SEARCH_LIBS but does not cache result +dnl +dnl Uses either AC_LANG_PROGRAM([PREAMBLE],CALL-CODE) or +dnl AC_LANG_CALL([PREAMBLE],FUNCTION), depending on wether CALL-CODE +dnl is given or not. +AC_DEFUN([_ACX_OPTION_SEARCH_LIBS], + [acx_option_func_search_save_LIBS="$LIBS" + AC_LANG_CONFTEST([m4_ifval([$6],[AC_LANG_PROGRAM([$5],[$6])],[AC_LANG_CALL([$5], [$1])])]) + for ac_lib in '' $2; do + AS_IF([test -z "$ac_lib"], + [ac_res="none required" + LIBS="m4_ifval([$4],[$4 ])m4_ifnblank($3,[$3 ])$acx_option_func_search_save_LIBS"], + [ac_res="-l$ac_lib" + LIBS="m4_ifval([$4],[$4 ])$ac_res m4_ifnblank($3,[$3 ])$acx_option_func_search_save_LIBS"]) + AC_LINK_IFELSE([], [AS_IF([test x"$ac_res" = x"none required"],dnl + [AS_VAR_SET([ac_Search],["]m4_ifval([$4],[$4 ])[$3"])],dnl + [AS_VAR_SET([ac_Search],["]m4_ifval([$4],[$4 ])[-l$ac_lib $3"])])]) + AS_VAR_SET_IF([ac_Search], [break]) + done + rm conftest.$ac_ext + LIBS="$acx_option_func_search_save_LIBS"]) +dnl ACX_OPTION_SEARCH_LIBS(FUNCTION, SEARCH-LIBS, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES], +dnl [EXTRA-FLAGS], [PREAMBLE]) +dnl -------------------------------------------------------- +dnl Search for a library defining FUNC, if it's not already available. +dnl Do not add said library to default LIBS output variable. +dnl Use $ac_lib or $ac_res in ACTION if needed. Uses OTHER-LIBRARIES +dnl unconditionally, which might provoke linker errors. +AC_DEFUN([ACX_OPTION_SEARCH_LIBS], + [AS_VAR_PUSHDEF([ac_Search], [acx_cv_option_search_$1_]_AC_LANG_ABBREV)dnl + AC_CACHE_CHECK([for library containing $1], [ac_Search], + [_ACX_OPTION_SEARCH_LIBS([$1],[$2],[$5],[$6],[$7])]) + ac_res=AS_VAR_GET([ac_Search]) + AS_VAR_SET_IF([ac_Search], + [$3], + [$4]) + AS_VAR_POPDEF([ac_Search])dnl +]) +dnl ACX_OPTION_SEARCH_LIBS_MULTI(FUNCTION, SEARCH-LIBS, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES], +dnl [EXTRA-FLAGS], [PREAMBLE], [CALL-CODE]) +dnl -------------------------------------------------------- +dnl Search for a library defining FUNC, if it's not already available. +dnl Do not add said library to default LIBS output variable. +dnl Use $ac_lib or $ac_res in ACTION if needed. +dnl +dnl If CALL-CODE is present it will be compiled to make the function +dnl call, otherwise AC_LANG_CALL will be used with FUNCTION as +dnl argument. +dnl +dnl Tries first to link without any OTHER-LIBRARY, then successively +dnl tries each library in the list. +AC_DEFUN([ACX_OPTION_SEARCH_LIBS_MULTI], + [AS_VAR_PUSHDEF([ac_Search], [acx_cv_option_search_$1_]_AC_LANG_ABBREV)dnl + AC_MSG_CHECKING([for library containing $1]) + AC_CACHE_VAL([ac_Search],dnl + [while :; do + m4_if(m4_car($5),[[]],,[_ACX_OPTION_SEARCH_LIBS([$1],[$2],,[$6],[$7],[$8]) + AS_VAR_SET_IF([ac_Search], [break])]) + m4_foreach([ACX_LibSet], [$5],dnl + [_ACX_OPTION_SEARCH_LIBS([$1],[$2],[ACX_LibSet],[$6],[$7],[$8]) + AS_VAR_SET_IF([ac_Search],[break]) + ]) + break + done]) + AS_VAR_SET_IF([ac_Search],dnl + [AS_IF([test x"AS_VAR_GET([ac_Search])" = x],dnl + [AC_MSG_RESULT([(none required)])],dnl + [AC_MSG_RESULT([AS_VAR_GET([ac_Search])])])],dnl + [AC_MSG_RESULT([not found])]) + AS_VAR_SET_IF([ac_Search],[$3],[$4]) + AS_VAR_POPDEF([ac_Search])dnl +]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/acx_sl_fc_mod_path_flag.m4 b/m4/acx_sl_fc_mod_path_flag.m4 index 022255bba9e8f30339bcde8bca866146a5ea71fb..3ac0440d93b4609f5c8b80bd987eadea8c18b0b1 100644 --- a/m4/acx_sl_fc_mod_path_flag.m4 +++ b/m4/acx_sl_fc_mod_path_flag.m4 @@ -61,22 +61,22 @@ AC_DEFUN([ACX_SL_FC_CHECK_MOD_PATH_FLAG],dnl AC_CACHE_CHECK([for flag to alter module search path],[mod_flag], [mkdir conftestdir cd conftestdir - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ module cnftst - implicit none - integer :: i + AC_COMPILE_IFELSE([AC_LANG_SOURCE( +[ module cnftst + implicit none + integer :: i end module cnftst])],, [AC_MSG_ERROR([Cannot compile fortran modules])]) cd .. for i in -I -M -module -p; do FCFLAGS_save=$FCFLAGS FCFLAGS="$FCFLAGS ${i}conftestdir" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[dnl - use cnftst - implicit none - i = 0 -]) - ],[AS_VAR_SET([mod_flag],[$i]) ; FCFLAGS=$FCFLAGS_save ; break], - [:]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], +[ use cnftst + implicit none + i = 0])], + [AS_VAR_SET([mod_flag],[$i]) ; FCFLAGS=$FCFLAGS_save ; break], + [:]) FCFLAGS=$FCFLAGS_save done FCFLAGS=$FCFLAGS_save diff --git a/m4/acx_sl_mod_suffix.m4 b/m4/acx_sl_mod_suffix.m4 index bf26daa7aee349b2ee25ef6e4c5070cd2b51e949..b92d8f510c3d134004034d53c941cdd6471ade19 100644 --- a/m4/acx_sl_mod_suffix.m4 +++ b/m4/acx_sl_mod_suffix.m4 @@ -61,12 +61,11 @@ AC_DEFUN([ACX_SL_FC_MOD_SUFFIX], AC_ARG_VAR([FCMODEXT], [file extension of compiled Fortran module files]) ac_fc_mod_uppercase=no AC_LANG_PUSH([Fortran]) - AC_COMPILE_IFELSE([ - module conftest - implicit none - integer :: i - end module conftest - ]) + AC_COMPILE_IFELSE( +[ module conftest + implicit none + integer :: i + end module conftest]) while :; do acx_fc_mod_name= m4_foreach([acx_fc_mod_name],dnl diff --git a/m4/asx_tr_arg.m4 b/m4/asx_tr_arg.m4 new file mode 100644 index 0000000000000000000000000000000000000000..58c27da6d5ca0c745f3fad7297afcb3efd3d6e83 --- /dev/null +++ b/m4/asx_tr_arg.m4 @@ -0,0 +1,69 @@ +dnl asx_tr_arg.m4 --- create configure argument string for AC_ARG_* macros +dnl +dnl Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl Commentary: +dnl +dnl +dnl +dnl Code: +dnl +# _AS_TR_ARG_PREPARE +# ----------------- +AC_DEFUN([_ASX_TR_ARG_PREPARE], +[AS_REQUIRE([_AS_CR_PREPARE])dnl +# Sed expression to map a string onto a valid argument string part. +asx_tr_arg="eval sed 'y%*+%pp%;s%[[^-$as_cr_alnum]]%-%g'" +]) + + +# AS_TR_ARG(EXPRESSION) +# -------------------- +# Transform EXPRESSION into a nice-looking argument suffix, i.e. +# for AC_ARG_WITH or AC_ARG_ENABLE. +# sh/m4 polymorphic +AC_DEFUN([ASX_TR_ARG], +[AS_REQUIRE([_$0_PREPARE])dnl +AS_LITERAL_IF([$1], + [m4_bpatsubst(m4_translit([m4_translit([$1], [A-Z], [a-z])], [*+], [pp]), + [[^a-zA-Z0-9-]], [-])], + [`echo "$1" | $asx_tr_arg`])]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 44e0ecff11e3a16ca7656be45268d0bd597afc51..fb7ebda39369de1ad397addb8f4f5baae40bea27 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -4817,6 +4817,8 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; diff --git a/m4/starlink_fpp.m4 b/m4/starlink_fpp.m4 index 423ede971415c8793d552b15350e36f745aa73b7..e09f132145a09f50f4fc6a89a18f4d5009663693 100644 --- a/m4/starlink_fpp.m4 +++ b/m4/starlink_fpp.m4 @@ -108,8 +108,7 @@ AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_SIMPLE], [AC_LANG_PROGRAM(,[@%:@define OK @%:@ifndef OK syntax error -@%:@endif -])])#_ACX_SL_LANG_PROGRAM_FPP_SIMPLE +@%:@endif])])#_ACX_SL_LANG_PROGRAM_FPP_SIMPLE # _ACX_SL_LANG_PROGRAM_FPP_ONLY @@ -123,19 +122,16 @@ AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_ONLY], REAL A @%:@else syntax error -@%:@endif -])])#_ACX_SL_LANG_PROGRAM_FPP_ONLY +@%:@endif])])#_ACX_SL_LANG_PROGRAM_FPP_ONLY # _ACX_SL_LANG_PROGRAM_FPP_D # --------------------------- # Like _ACX_SL_LANG_PROGRAM_FPP_SIMPLE, but OK is passed via -D switch AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_D], -[AC_LANG_PROGRAM([],[ -@%:@ifndef OK +[AC_LANG_PROGRAM([],[@%:@ifndef OK syntax error -@%:@endif -])])#_ACX_SL_LANG_PROGRAM_FPP_D +@%:@endif])])#_ACX_SL_LANG_PROGRAM_FPP_D # _ACX_SL_LANG_PROGRAM_FPP_I @@ -143,13 +139,11 @@ AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_D], # Test for #include statement # If unsupported, this should give a type error AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_I], -[AC_LANG_PROGRAM([],[ - IMPLICIT CHARACTER (c) -! Comments in test programs should be freeform compliant just in case. -! conftest.inc contains the Fortran statement "REAL cc" + [AC_LANG_PROGRAM(,[ IMPLICIT CHARACTER (c) + ! Comments in test programs should be freeform compliant just in case. + ! conftest.inc contains the Fortran statement "REAL cc" @%:@include "conftest.inc" - cc=1. -])])#_ACX_SL_LANG_PROGRAM_FPP_I + cc=1.])])#_ACX_SL_LANG_PROGRAM_FPP_I # _ACX_SL_LANG_PROGRAM_FPP_SUBS @@ -157,12 +151,10 @@ AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_I], # Test whether cpp symbols are expanded in Fortran code lines # If not, this should give a type error AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_SUBS], -[AC_LANG_PROGRAM(,[ -@%:@define NM xxxx +[AC_LANG_PROGRAM(,[@%:@define NM xxxx IMPLICIT CHARACTER (n) REAL xxxx - NM=1. -])])#_ACX_SL_LANG_PROGRAM_FPP_SUBS + NM=1.])])#_ACX_SL_LANG_PROGRAM_FPP_SUBS # _ACX_SL_LANG_PROGRAM_FPP_WRAP @@ -171,39 +163,38 @@ AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_SUBS], # to macro substitution. # If not, this gives an "unterminated character constant" error AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_WRAP], -[AC_LANG_PROGRAM(,[m4_case(_AC_LANG,[Fortran], + [AC_LANG_PROGRAM(, + [m4_case(_AC_LANG, + [Fortran], [@%:@define LONG '901234567890123456789012345678901234567890123456789012345678901234567890' CHARACTER(LEN=80) :: A - A=LONG -],[Fortran 77], + A=LONG], + [Fortran 77], [@%:@define LONG '901234567890123456789012345678901234567890123456789012345678901234567890' CHARACTER*80 A - A=LONG -],[m4_fatal([$0: current language is not Fortran: ] _AC_LANG)])])])#_ACX_SL_LANG_PROGRAM_FPP_WRAP + A=LONG], + [m4_fatal([$0: current language is not Fortran: ] _AC_LANG)])])])#_ACX_SL_LANG_PROGRAM_FPP_WRAP # _ACX_SL_LANG_PROGRAM_FPP_CSTYLE # --------------------------- # Test program for C style comments AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_CSTYLE], -[AC_LANG_PROGRAM(,[ - A=1. /* C-style comment */ -])])#_ACX_SL_LANG_PROGRAM_FPP_CSTYLE +[AC_LANG_PROGRAM(,[ A=1. /* C-style comment */])])#_ACX_SL_LANG_PROGRAM_FPP_CSTYLE # _ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE # --------------------------- # Test program for C++ style comments AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE], -[AC_LANG_SOURCE([m4_case(_AC_LANG,[Fortran],dnl + [AC_LANG_SOURCE([m4_case(_AC_LANG, + [Fortran], [ PROGRAM MAIN CHARACTER(LEN=10) :: C - C = "abcde" // "fghij"; END PROGRAM -],[Fortran 77], + C = "abcde" // "fghij"; END PROGRAM], + [Fortran 77], [ PROGRAM MAIN CHARACTER*10 C - C = "abcde" // "fghij"; END PROGRAM -])]) -])#_ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE + C = "abcde" // "fghij"; END PROGRAM])])])#_ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE # _ACX_SL_SET_FPP_FEATURE_VARS ([feature list]) # -------------------------------------- @@ -274,9 +265,9 @@ AC_DEFUN([_ACX_SL_TEST_FPP], [# we have Fortran! See if the file can be compiled: mv $ac_tmp conftest.$ac_ext AC_COMPILE_IFELSE(, [_AC_MSG_LOG_CONFTEST - $3],dnl + $3], [_AC_MSG_LOG_CONFTEST - $4])],dnl + $4])], [mv $ac_tmp conftest.$ac_ext _AC_MSG_LOG_CONFTEST $4])]) @@ -293,19 +284,19 @@ dnl preprocessing failed. So this command doesn't work. # _ACX_SL_PROG_FPP([SUFFIX], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------ # Try to figure out how to preprocess files with the given suffix -# just like the selected Fortran compiler does +# for use with the selected Fortran compiler # # Must be run after _ACX_SL_PROG_FC_CPP -AC_DEFUN([_ACX_SL_PROG_FPP],dnl +AC_DEFUN([_ACX_SL_PROG_FPP], [acx_sl_fpp_srcext=m4_default([$1],[${ac_fc_srcext-F}]) - AS_VAR_PUSHDEF([acx_sl_prog_fpp],dnl + AS_VAR_PUSHDEF([acx_sl_prog_fpp], [acx_sl_cv_prog_fpp_]_AC_LANG_ABBREV[_]m4_default([$1],[${ac_fc_srcext-f}])) - AC_CACHE_CHECK([how to preprocess Fortran files with suffix $acx_sl_fpp_srcext],dnl -[acx_sl_prog_fpp], + AC_CACHE_CHECK([how to preprocess Fortran files with suffix $acx_sl_fpp_srcext], + [acx_sl_prog_fpp], [AS_VAR_SET([acx_sl_prog_fpp], []) # Let the user specify FPP AS_IF([test -n "$FPP"], - [_ACX_SL_TEST_FPP([$FPP],[$acx_sl_fpp_srcext],dnl + [_ACX_SL_TEST_FPP([$FPP],[$acx_sl_fpp_srcext], [AS_VAR_SET([acx_sl_prog_fpp], ["$FPP"])], [AC_MSG_WARN([user-specified \$FPP ($FPP) does not work]) FPP=])]) @@ -314,9 +305,12 @@ AC_DEFUN([_ACX_SL_PROG_FPP],dnl `cd $srcdir ; pwd`/util/xlfpreproc-wrapper \ `cd $srcdir ; pwd`/util/sunf95preproc-wrapper \ `cd $srcdir ; pwd`/util/crayftnpreproc-wrapper \ - "$FC -F" "$FC -F -fpp" "$FC -E" "$FC -E -cpp" \ + "$FC -F" "$FC -F -fpp" "$FC -E" "$FC -E" "$FC -E -cpp" \ "$FC $FCFLAGS -F" "$FC $FCFLAGS -E" "$FC $FCFLAGS -E" \ - "$FC $FCFLAGS -E -cpp" "$FC $FCFLAGS -x f95-cpp-input -E -P" + "$FC $FCFLAGS -E -cpp" "$FC $FCFLAGS -x f95-cpp-input -E -P" \ + "${F77-f77} -F" "${F77-f77} -E" 'fpp' \ + "$CPP" "$CPP -x c" 'cpp' '/lib/cpp' \ + '/usr/ccs/lib/cpp' 'g77 -E' '${CC-cc} -E' do _ACX_SL_TEST_FPP([$ac_fpp],[$acx_sl_fpp_srcext],[FPP="$ac_fpp" break]) @@ -376,9 +370,9 @@ fi # [ACTION-IF-COMPILABLE],[ACTION-IF-NOT-COMPILABLE]) # helper macro to run the preprocessor or compile directly # with preprocessor flags -m4_define([_ACX_FPP_COMPILE_IFELSE],dnl - [m4_if([$2],[direct],dnl - [cp conftest.$acx_sl_fpp_srcext conftest.${ac_ext}.tmp],dnl +m4_define([_ACX_FPP_COMPILE_IFELSE], + [m4_if([$2],[direct], + [cp conftest.$acx_sl_fpp_srcext conftest.${ac_ext}.tmp], [_AC_RUN_LOG([$FPP $FPPFLAGS m4_ifval([$1],[$1 ])conftest.$acx_sl_fpp_srcext \ >conftest.${ac_ext}.tmp], [echo Running preprocessor $FPP $FPPFLAGS m4_ifval([$1],[$1 ])conftest.$acx_sl_fpp_srcext])]) @@ -406,10 +400,10 @@ m4_define([_ACX_FPP_COMPILE_IFELSE],dnl # AC_DEFUN([ACX_SL_PROG_FC_FPP_FEATURES], [AS_VAR_PUSHDEF([acx_sl_fpp_ok], [acx_sl_cv_]_AC_LANG_ABBREV[_$2_ok]) - AC_CACHE_CHECK([if ]m4_case([$2],[direct],[compilation with $FC],dnl -[indirect],[preprocessing with $FPP],dnl -[m4_fatal([$0: only direct or indirect method supported: ']$2['])])[ of Fortran source supports required preprocessor features],dnl -[acx_sl_fpp_ok],dnl + AC_CACHE_CHECK([if ]m4_case([$2],[direct],[compilation with $FC], +[indirect],[preprocessing with $FPP], +[m4_fatal([$0: only direct or indirect method supported: ']$2['])])[ of Fortran source supports required preprocessor features], +[acx_sl_fpp_ok], [AS_VAR_SET([acx_sl_fpp_ok], [yes]) # Set up ac_fpp_need_* flags based on features in $1 acx_sl_fpp_srcext=m4_default([$3],[${ac_fc_srcext-F}]) @@ -421,7 +415,7 @@ AC_DEFUN([ACX_SL_PROG_FC_FPP_FEATURES], ACX_ASSERT_LANG_IS_FORTRAN_VARIANT ac_save_FCFLAGS=$FCFLAGS - m4_case([$2],[direct],[],[indirect],[],dnl + m4_case([$2],[direct],[],[indirect],[], [m4_fatal([$0: only direct or indirect method supported: ] $2)]) # We need to skip the following tests if we're trying direct compilation @@ -429,7 +423,7 @@ AC_DEFUN([ACX_SL_PROG_FC_FPP_FEATURES], AS_IF([test x$ac_fpp_need_d = xyes], [acx_sl_prog_fc_cpp_d=no _AS_ECHO_LOG([Trying flag to create preprocessor defines.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext],dnl + ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], [_ACX_SL_LANG_PROGRAM_FPP_D]) # Normally we expect to be able to define preprocessor macros # with -D, but this might be IBM xlf compiler, which needs @@ -439,7 +433,7 @@ AC_DEFUN([ACX_SL_PROG_FC_FPP_FEATURES], do AS_IF([test x"$FPP_DEFOPT" != x ], [cp conftest.${acx_sl_fpp_srcext}.bak conftest.$acx_sl_fpp_srcext - _ACX_FPP_COMPILE_IFELSE([${FPP_DEFOPT}OK],[$2],dnl + _ACX_FPP_COMPILE_IFELSE([${FPP_DEFOPT}OK],[$2], [acx_sl_prog_fc_cpp_d=yes; break])]) done FCFLAGS=$ac_save_FCFLAGS @@ -455,10 +449,9 @@ AC_DEFUN([ACX_SL_PROG_FC_FPP_FEATURES], _AS_ECHO_LOG([Trying flag to add directories to preprocessor search path.]) AS_MKDIR_P([conftst]) cd conftst - ACX_LANG_OTHER_SUFFIX_CONFTEST([inc],dnl - [AC_LANG_SOURCE([! This statement overrides the IMPLICIT statement in the program - REAL cc -])]) + ACX_LANG_OTHER_SUFFIX_CONFTEST([inc], + [AC_LANG_SOURCE([ ! This statement overrides the IMPLICIT statement in the program + REAL cc])]) cd .. ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext],[_ACX_SL_LANG_PROGRAM_FPP_I]) mv conftest.$acx_sl_fpp_srcext conftest.${acx_sl_fpp_srcext}.bak @@ -466,7 +459,7 @@ AC_DEFUN([ACX_SL_PROG_FC_FPP_FEATURES], do AS_IF([test x"$FPP_INCOPT" != x ], [cp conftest.${acx_sl_fpp_srcext}.bak conftest.$acx_sl_fpp_srcext - _ACX_FPP_COMPILE_IFELSE([${FPP_INCOPT}conftst],[$2],dnl + _ACX_FPP_COMPILE_IFELSE([${FPP_INCOPT}conftst],[$2], [acx_sl_prog_fc_cpp_i=yes break])]) done @@ -484,7 +477,7 @@ dnl _AS_ECHO_LOG([Testing preprocessor expansion in Fortran code.]) ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], [_ACX_SL_LANG_PROGRAM_FPP_SUBS]) - _ACX_FPP_COMPILE_IFELSE(,[$2],dnl + _ACX_FPP_COMPILE_IFELSE(,[$2], [acx_sl_prog_fc_cpp_subs=yes],[AS_VAR_SET([acx_sl_fpp_ok], [no])]) AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], [_AS_ECHO_LOG([Test successful.])], @@ -495,9 +488,9 @@ dnl AS_IF([test $ac_fpp_need_wrap = yes], [acx_sl_prog_fc_cpp_wrap=no _AS_ECHO_LOG([Testing wether preprocessor wraps long lines.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext],dnl + ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], [_ACX_SL_LANG_PROGRAM_FPP_WRAP]) - _ACX_FPP_COMPILE_IFELSE(,[$2],dnl + _ACX_FPP_COMPILE_IFELSE(,[$2], [acx_sl_prog_fc_cpp_wrap=yes], [AS_VAR_SET([acx_sl_fpp_ok], [no])]) AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], [_AS_ECHO_LOG([Test successful.])], @@ -507,9 +500,9 @@ dnl dnl AS_IF([test $ac_fpp_need_CSTYLE = yes], [_AS_ECHO_LOG([Testing wether preprocessor removes C-style comments.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext],dnl + ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], [_ACX_SL_LANG_PROGRAM_FPP_CSTYLE]) - _ACX_FPP_COMPILE_IFELSE(,[$2],dnl + _ACX_FPP_COMPILE_IFELSE(,[$2], [acx_sl_prog_fc_cpp_CSTYLE=yes], [AS_VAR_SET([acx_sl_fpp_ok], [no])]) AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], [_AS_ECHO_LOG([Test successful.])], @@ -518,9 +511,9 @@ dnl dnl AS_IF([test $ac_fpp_need_cstyle = yes], [_AS_ECHO_LOG([Testing wether preprocessor leaves C-style comments in place.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext],dnl + ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], [_ACX_SL_LANG_PROGRAM_FPP_CSTYLE]) - _ACX_FPP_COMPILE_IFELSE(,[$2],dnl + _ACX_FPP_COMPILE_IFELSE(,[$2], [acx_sl_prog_fc_cpp_CSTYLE=yes], [AS_VAR_SET([acx_sl_fpp_ok], [no])]) AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], [_AS_ECHO_LOG([Test failed.])], @@ -529,9 +522,9 @@ dnl dnl AS_IF([test $ac_fpp_need_cxxstyle = yes], [_AS_ECHO_LOG([Testing if preprocessor leaves C++-style comments in place.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext],dnl + ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], [_ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE]) - _ACX_FPP_COMPILE_IFELSE(,[$2],dnl + _ACX_FPP_COMPILE_IFELSE(,[$2], [acx_sl_prog_fc_cpp_cxxstyle=yes],[AS_VAR_SET([acx_sl_fpp_ok], [no])]) AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], [_AS_ECHO_LOG([Test successful.])], @@ -540,10 +533,10 @@ dnl dnl AS_IF([test $ac_fpp_need_CXXSTYLE = yes], [_AS_ECHO_LOG([Testing if preprocessor suppresses C++-style comments.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext],dnl + ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], [_ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE]) - _ACX_FPP_COMPILE_IFELSE(,[$2],dnl - [acx_sl_prog_fc_cpp_cxxstyle=yes],dnl + _ACX_FPP_COMPILE_IFELSE(,[$2], + [acx_sl_prog_fc_cpp_cxxstyle=yes], [AS_VAR_SET([acx_sl_fpp_ok], [no])]) AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], [_AS_ECHO_LOG([Test failed.])], @@ -631,7 +624,7 @@ dnl AC_REQUIRE([AC_PROG_CPP([cpp])])dnl # ac_prog_fc_cpp_*, which we copy to cv variables afterwards. This # allows this macro to be reusable for other cv variables (see # below) - ACX_SL_PROG_FC_FPP_FEATURES([$1],[indirect],[$2],,dnl + ACX_SL_PROG_FC_FPP_FEATURES([$1],[indirect],[$2],, [AC_MSG_FAILURE([required Fortran preprocessor not available])]) ])# AC_PROG_FPP @@ -661,7 +654,7 @@ AC_DEFUN([ACX_FC_INTEGRAL_FPP], [acx_sl_prog_fc_cpp=yes],[FC=f95 AS_VAR_SET([acx_sl_fpp_ok], [no])]) ]) - ACX_SL_PROG_FC_FPP_FEATURES([$1],[indirect],[$2],,dnl + ACX_SL_PROG_FC_FPP_FEATURES([$1],[indirect],[$2],, [AC_MSG_FAILURE([required Fortran preprocessor not available])]) ac_first_save_FPPFLAGS=$FPPFLAGS FPPFLAGS="$FPPFLAGS $FPPFLAGS_F" diff --git a/src/Makefile.am b/src/Makefile.am index 7eda163d380288e0219c2694d866d8bfdcfa80f3..12d0f2dd97a7dfd83c490fdc2b7a06907f4df25d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ else noinst_LTLIBRARIES += libcdi.la endif -AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) +AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) $(MPI_C_INCLUDE) libcdi_la_SOURCES = \ basetime.c \ @@ -39,6 +39,7 @@ libcdi_la_SOURCES = \ cksum.h \ cdi_cksum.c \ cdi_cksum.h \ + create_uuid.h \ dtypes.h \ error.c \ error.h \ @@ -169,11 +170,9 @@ libcdipio_la_SOURCES = \ pio_cdf_int.c \ pio_cdf_int.h -libcdipio_la_LIBADD = libcdi.la $(PPM_CORE_LIBS) $(YAXT_LIBS) +libcdipio_la_LIBADD = libcdi.la $(PPM_CORE_LIBS) $(YAXT_LIBS) $(MPI_C_LIB) - -#libcdi_la_CPPFLAGS = @CPPFLAGS@ -libcdi_la_LIBADD = +libcdi_la_LIBADD = $(UUID_C_LIB) # #cdilib.c: # $(top_srcdir)/src/make_cdilib $(top_srcdir)/src diff --git a/src/Makefile.in b/src/Makefile.in index 02d5e31621071c3e8ece2c4a78def193818c6cd1..89166ab2229734fe5cd9664004cea95cb00bcdb7 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -98,17 +98,26 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ - $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/starlink_fpp.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/asx_tr_arg.m4 $(top_srcdir)/m4/asx_unset.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/starlink_fpp.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -145,7 +154,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) -libcdi_la_DEPENDENCIES = +am__DEPENDENCIES_1 = +libcdi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libcdi_la_OBJECTS = basetime.lo binary.lo calendar.lo cdf.lo \ cdf_int.lo cdi_error.lo cdi_util.lo cdiFortran.lo \ cgribexlib.lo dmemory.lo cksum.lo cdi_cksum.lo error.lo \ @@ -168,9 +178,8 @@ am__v_lt_0 = --silent am__v_lt_1 = @ENABLE_CDI_LIB_FALSE@am_libcdi_la_rpath = @ENABLE_CDI_LIB_TRUE@am_libcdi_la_rpath = -rpath $(libdir) -am__DEPENDENCIES_1 = libcdipio_la_DEPENDENCIES = libcdi.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libcdipio_la_OBJECTS = cdipioFortran.lo pio.lo pio_comm.lo \ pio_dbuffer.lo pio_interface.lo pio_mpinonb.lo \ pio_record_send.lo pio_posixasynch.lo \ @@ -284,6 +293,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NETCDF = @ENABLE_NETCDF@ @@ -331,6 +341,11 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_INCLUDE = @MPI_FC_INCLUDE@ +MPI_FC_LIB = @MPI_FC_LIB@ MPI_LAUNCH = @MPI_LAUNCH@ NC_CONFIG = @NC_CONFIG@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ @@ -444,7 +459,7 @@ noinst_LTLIBRARIES = libcdiresunpack.la $(am__append_1) \ $(am__append_4) @ENABLE_CDI_LIB_TRUE@lib_LTLIBRARIES = libcdi.la $(am__append_2) @ENABLE_CDI_LIB_TRUE@include_HEADERS = cdi.h cdi.inc $(am__append_3) -AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) +AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) $(MPI_C_INCLUDE) libcdi_la_SOURCES = \ basetime.c \ basetime.h \ @@ -471,6 +486,7 @@ libcdi_la_SOURCES = \ cksum.h \ cdi_cksum.c \ cdi_cksum.h \ + create_uuid.h \ dtypes.h \ error.c \ error.h \ @@ -592,10 +608,8 @@ libcdipio_la_SOURCES = \ pio_cdf_int.c \ pio_cdf_int.h -libcdipio_la_LIBADD = libcdi.la $(PPM_CORE_LIBS) $(YAXT_LIBS) - -#libcdi_la_CPPFLAGS = @CPPFLAGS@ -libcdi_la_LIBADD = +libcdipio_la_LIBADD = libcdi.la $(PPM_CORE_LIBS) $(YAXT_LIBS) $(MPI_C_LIB) +libcdi_la_LIBADD = $(UUID_C_LIB) # #cdilib.c: # $(top_srcdir)/src/make_cdilib $(top_srcdir)/src diff --git a/src/cdi.h b/src/cdi.h index 2bf06ab4d4e48993c20f91f847c1b2c3d9c5742b..8f6baa43fe67637b1c753e8a2a717a4a1b48b256 100644 --- a/src/cdi.h +++ b/src/cdi.h @@ -333,6 +333,7 @@ int streamInqCurTimestepID(int streamID); const char* streamFilename(int streamID); const char* streamFilesuffix(int filetype); + off_t streamNvals(int streamID); int streamInqNvars ( int streamID ); diff --git a/src/cdi_int.c b/src/cdi_int.c index a915d736c3da12f28175c47668da1e2f887ec9b2..53d2afa77119aaf1fb3f98e110c53f79063f690a 100644 --- a/src/cdi_int.c +++ b/src/cdi_int.c @@ -389,12 +389,6 @@ const char *strfiletype(int filetype) } -int streamSize(void) -{ - return reshCountType ( &streamOps ); -} - - void cdiDefGlobal(const char *string, int val) { if ( strcmp(string, "REGULARGRID") == 0 ) cdiDataUnreduced = val; diff --git a/src/cdi_int.h b/src/cdi_int.h index 29dc91e6147b33a1dc3d845877f38019f8e69add..d85041d47fd4d3b51aa355d0ffa3658dd88286e9 100644 --- a/src/cdi_int.h +++ b/src/cdi_int.h @@ -318,8 +318,7 @@ int cdiInqAccesstype(int streamID); int getByteswap(int byteorder); -int streamSize (); -void streamGetIndexList ( int, int * ); +void cdiStreamGetIndexList(unsigned numIDs, int IDs[numIDs]); void cdiInitialize(void); diff --git a/tests/create_uuid.h b/src/create_uuid.h similarity index 100% rename from tests/create_uuid.h rename to src/create_uuid.h diff --git a/src/grid.c b/src/grid.c index 9a21d908432f2f32bdb800cd90ec2ae08a41e50a..1172f230e13335c9980a869abe20715f6cd86221 100644 --- a/src/grid.c +++ b/src/grid.c @@ -56,7 +56,7 @@ static void gridPack ( void * gridptr, void * buff, int size, int *position, void *context); static int gridTxCode ( void ); -static const resOps gridOps = { +const resOps gridOps = { gridCompareP, gridDestroyP, gridPrintP, @@ -201,9 +201,9 @@ void grid_copy(grid_t *gridptr2, grid_t *gridptr1) gridptr2->self = gridID2; } -int gridSize(void) +unsigned cdiGridCount(void) { - return reshCountType ( &gridOps ); + return reshCountType(&gridOps); } // used also in CDO @@ -999,11 +999,12 @@ void gridDefXsize(int gridID, int xsize) { grid_t *gridptr = gridID2Ptr(gridID); - if ( xsize > gridInqSize(gridID) ) - Error("xsize %d is greater then gridsize %d", xsize, gridInqSize(gridID)); + int gridSize = gridInqSize(gridID); + if ( xsize > gridSize ) + Error("xsize %d is greater then gridsize %d", xsize, gridSize); - if ( gridInqType(gridID) == GRID_UNSTRUCTURED && xsize != gridInqSize(gridID) ) - Error("xsize %d must be equal to gridsize %d for gridtype: UNSTRUCTURED", xsize, gridInqSize(gridID)); + if ( gridInqType(gridID) == GRID_UNSTRUCTURED && xsize != gridSize ) + Error("xsize %d must be equal to gridsize %d for gridtype: UNSTRUCTURED", xsize, gridSize); if (gridptr->xsize != xsize) { @@ -1013,10 +1014,10 @@ void gridDefXsize(int gridID, int xsize) if ( gridInqType(gridID) != GRID_UNSTRUCTURED ) { - long gridsize = gridptr->xsize*gridptr->ysize; - if ( gridsize > 0 && gridsize != gridInqSize(gridID) ) + long axisproduct = gridptr->xsize*gridptr->ysize; + if ( axisproduct > 0 && axisproduct != gridSize ) Error("Inconsistent grid declaration! (xsize=%d ysize=%d gridsize=%d)", - gridptr->xsize, gridptr->ysize, gridInqSize(gridID)); + gridptr->xsize, gridptr->ysize, gridSize); } } @@ -1099,11 +1100,13 @@ void gridDefYsize(int gridID, int ysize) { grid_t *gridptr = gridID2Ptr(gridID); - if ( ysize > gridInqSize(gridID) ) - Error("ysize %d is greater then gridsize %d", ysize, gridInqSize(gridID)); + int gridSize = gridInqSize(gridID); - if ( gridInqType(gridID) == GRID_UNSTRUCTURED && ysize != gridInqSize(gridID) ) - Error("ysize %d must be equal gridsize %d for gridtype: UNSTRUCTURED", ysize, gridInqSize(gridID)); + if ( ysize > gridSize ) + Error("ysize %d is greater then gridsize %d", ysize, gridSize); + + if ( gridInqType(gridID) == GRID_UNSTRUCTURED && ysize != gridSize ) + Error("ysize %d must be equal gridsize %d for gridtype: UNSTRUCTURED", ysize, gridSize); if (gridptr->ysize != ysize) { @@ -1113,10 +1116,10 @@ void gridDefYsize(int gridID, int ysize) if ( gridInqType(gridID) != GRID_UNSTRUCTURED ) { - long gridsize = gridptr->xsize*gridptr->ysize; - if ( gridsize > 0 && gridsize != gridInqSize(gridID) ) + long axisproduct = gridptr->xsize*gridptr->ysize; + if ( axisproduct > 0 && axisproduct != gridSize ) Error("Inconsistent grid declaration! (xsize=%d ysize=%d gridsize=%d)", - gridptr->xsize, gridptr->ysize, gridInqSize(gridID)); + gridptr->xsize, gridptr->ysize, gridSize); } } @@ -3857,9 +3860,9 @@ void gridInqUUID(int gridID, unsigned char uuid[CDI_UUID_SIZE]) } -void gridGetIndexList ( int ngrids, int * gridIndexList ) +void cdiGridGetIndexList(unsigned ngrids, int * gridIndexList) { - reshGetResHListOfType ( ngrids, gridIndexList, &gridOps ); + reshGetResHListOfType(ngrids, gridIndexList, &gridOps); } diff --git a/src/grid.h b/src/grid.h index b85943489f50fcce9406e35df6ca92673eded907..bde677d2256ffdf1a3f710102bafc8e6fa5f62b8 100644 --- a/src/grid.h +++ b/src/grid.h @@ -2,6 +2,7 @@ #define _GRID_H #include "cdi.h" +#include "resource_handle.h" typedef unsigned char mask_t; @@ -76,7 +77,7 @@ grid_t; void grid_init(grid_t *gridptr); void grid_free(grid_t *gridptr); -int gridSize(void); +unsigned cdiGridCount(void); const double *gridInqXvalsPtr(int gridID); const double *gridInqYvalsPtr(int gridID); @@ -88,13 +89,15 @@ const double *gridInqAreaPtr(int gridID); int gridCompare(int gridID, const grid_t *grid); int gridGenerate(const grid_t *grid); -void gridGetIndexList( int, int * ); +void cdiGridGetIndexList(unsigned, int * ); void gridUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos, int originNamespace, void *context, int force_id); +extern const resOps gridOps; + #endif /* * Local Variables: diff --git a/src/institution.c b/src/institution.c index 0edcd6b5959158a8ada3fa0c2acbc62d874f40fc..b4cdadb4b475e14bceba7d3694f3dd9818b14e0f 100644 --- a/src/institution.c +++ b/src/institution.c @@ -88,12 +88,6 @@ void instituteDefaultEntries ( void ) } -int instituteCount ( void ) -{ - return reshCountType ( &instituteOps ); -} - - static int instituteCompareKernel(institute_t * ip1, institute_t * ip2) { diff --git a/src/model.c b/src/model.c index b14181edb3e8c33d5e01a8cdbecf689bc7c89ec9..fdd58e96b9351aa00fbb32444a8954667bc4be4f 100644 --- a/src/model.c +++ b/src/model.c @@ -132,11 +132,6 @@ void modelInit(void) if ( env ) MODEL_Debug = atoi(env); } -int modelSize ( void ) -{ - return reshCountType ( &modelOps ); -} - struct modelLoc { char *name; diff --git a/src/namespace.c b/src/namespace.c index 15fc5ed27fbd61c35d3d975cd3b45bcbc7ca1d24..c850c5259bb94487a250d89975175d3c058c17ab 100644 --- a/src/namespace.c +++ b/src/namespace.c @@ -21,7 +21,7 @@ #include "cdi_int.h" #include "stream_cdf.h" -static int nNamespaces = 1; +static unsigned nNamespaces = 1; static int activeNamespace = 0; #ifdef HAVE_LIBNETCDF @@ -61,7 +61,7 @@ static const union namespaceSwitchValue defaultSwitches_[NUM_NAMESPACE_SWITCH] = defaultSwitches; #endif -struct Namespace +static struct Namespace { statusCode resStage; union namespaceSwitchValue switches[NUM_NAMESPACE_SWITCH]; @@ -70,9 +70,9 @@ struct Namespace .switches = defaultSwitches }; -struct Namespace *namespaces = &initialNamespace; +static struct Namespace *namespaces = &initialNamespace; -static int namespacesSize = 1; +static unsigned namespacesSize = 1; #if defined (HAVE_LIBPTHREAD) # include <pthread.h> @@ -151,10 +151,10 @@ namespaceNew() if (namespacesSize > nNamespaces) { /* namespace is already available and only needs reinitialization */ - for (int i = 0; i < namespacesSize; ++i) + for (unsigned i = 0; i < namespacesSize; ++i) if (namespaces[i].resStage == STAGE_UNUSED) { - newNamespaceID = i; + newNamespaceID = (int)i; break; } } @@ -171,7 +171,7 @@ namespaceNew() else if (namespacesSize < NUM_NAMESPACES) { /* make room for additional namespace */ - newNamespaceID = namespacesSize; + newNamespaceID = (int)namespacesSize; namespaces = (struct Namespace *)xrealloc(namespaces, ((size_t)namespacesSize + 1) * sizeof (namespaces[0])); ++namespacesSize; @@ -203,7 +203,8 @@ namespaceDelete(int namespaceID) { NAMESPACE_INIT(); NAMESPACE_LOCK(); - xassert(namespaceID < namespacesSize && nNamespaces); + xassert(namespaceID >= 0 && (unsigned)namespaceID < namespacesSize + && nNamespaces); reshListDestruct(namespaceID); namespaces[namespaceID].resStage = STAGE_UNUSED; --nNamespaces; @@ -212,13 +213,13 @@ namespaceDelete(int namespaceID) int namespaceGetNumber () { - return nNamespaces; + return (int)nNamespaces; } void namespaceSetActive ( int nId ) { - xassert(nId < namespacesSize && nId >= 0 + xassert((unsigned)nId < namespacesSize && namespaces[nId].resStage != STAGE_UNUSED); activeNamespace = nId; } @@ -294,9 +295,9 @@ void cdiReset(void) { NAMESPACE_INIT(); NAMESPACE_LOCK(); - for (int namespaceID = 0; namespaceID < namespacesSize; ++namespaceID) + for (unsigned namespaceID = 0; namespaceID < namespacesSize; ++namespaceID) if (namespaces[namespaceID].resStage != STAGE_UNUSED) - namespaceDelete(namespaceID); + namespaceDelete((int)namespaceID); if (namespaces != &initialNamespace) { free(namespaces); diff --git a/src/pio_interface.c b/src/pio_interface.c index 19d3b7d6639b92db54f7d5d9692fe48fa8240aa9..d4c67fb524e0b48507555353a976c1fdceb0877b 100644 --- a/src/pio_interface.c +++ b/src/pio_interface.c @@ -155,7 +155,7 @@ in order of vSizes static void varMapGen(int *vSizes, int *sSizes, int *varMapping, - int nStreams, int *nodeSizes, int nNodes) + unsigned nStreams, int *nodeSizes, int nNodes) { int weightsStreams[nStreams]; @@ -170,9 +170,9 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping, int buckets[nProcsColl]; - for ( i = 0; i < nStreams; i++ ) + for (unsigned i = 0; i < nStreams; i++ ) { - nVars += * ( sSizes + i ); + nVars += sSizes[i]; weightsStreams[i] = 0; for ( j = 0; j < * ( sSizes + i ); j++ ) weightsStreams[i] += * ( vSizes + offset++ ); @@ -185,13 +185,13 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping, for ( j = 0; j < nNodes; j++ ) w[j] = ( double ) * ( nodeSizes + j ) / ( double ) nPEs; - mapProblems ( weightsStreams, streamMapping, nStreams, nNodes, w ); + mapProblems(weightsStreams, streamMapping, (int)nStreams, nNodes, w); free ( w ); for ( i = 0; i < nNodes; i++ ) { nVarsNode = 0; - for ( j = 0; j < nStreams; j++ ) + for (unsigned j = 0; j < nStreams; j++) if ( * ( streamMapping + j ) == i ) nVarsNode += * ( sSizes + j ); @@ -201,12 +201,12 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping, offset = 0; offsetN = 0; - for ( j = 0; j < nStreams; j++ ) - if ( * ( streamMapping + j ) == i ) + for (unsigned j = 0; j < nStreams; j++ ) + if (streamMapping[j] == i) for ( k = 0; k < * ( sSizes + j ); k ++ ) - * ( weightsVarsNode + offsetN++ ) = * ( vSizes + offset++ ); + weightsVarsNode[offsetN++] = vSizes[offset++]; else - offset += * ( sSizes + j ); + offset += sSizes[j]; for ( j = 0; j < * ( nodeSizes + i ); j ++ ) w[j] = 1.0 / ( double ) * ( nodeSizes + i ); @@ -217,7 +217,7 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping, offset = 0; offsetN = 0; - for ( j = 0; j < nStreams; j++ ) + for (unsigned j = 0; j < nStreams; j++) if ( * ( streamMapping + j ) == i ) for ( k = 0; k < * ( sSizes + j ); k ++ ) * ( varMapping + offset ++ ) = @@ -249,28 +249,28 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping, static void varsMapNDeco(int nNodes, int *nodeSizes) { - int nStreams, nVars, * resHs, * streamSizes, * varSizes, * varMapping, + int nVars, * resHs, * streamSizes, * varSizes, * varMapping, * collectsData; int k = 0; int nProcsColl = commInqNProcsColl (); xdebug ( "START, nProcsColl=%d", nProcsColl ); - nStreams = streamSize (); + unsigned nStreams = reshCountType(&streamOps); - resHs = xmalloc((size_t)nStreams * sizeof (resHs[0])); - streamSizes = xmalloc((size_t)nStreams * sizeof (streamSizes[0])); + resHs = xmalloc(nStreams * sizeof (resHs[0])); + streamSizes = xmalloc(nStreams * sizeof (streamSizes[0])); collectsData = xmalloc((size_t)nProcsColl * sizeof (collectsData[0])); - streamGetIndexList ( nStreams, resHs ); + cdiStreamGetIndexList(nStreams, resHs); - for (int i = 0; i < nStreams; i++ ) - streamSizes[i] = streamInqNvars ( * ( resHs + i )); + for (unsigned i = 0; i < nStreams; i++ ) + streamSizes[i] = streamInqNvars(resHs[i]); nVars = sum_int((size_t)nStreams, streamSizes); varSizes = xcalloc((size_t)nVars, sizeof (varSizes[0])); varMapping = xmalloc((size_t)nVars * sizeof (varMapping[0])); - for (int i = 0; i < nStreams; i++ ) + for (unsigned i = 0; i < nStreams; i++ ) { int vlistID = streamInqVlist(resHs[i]); for (int j = 0; j < streamSizes[i]; j++ ) @@ -283,7 +283,7 @@ varsMapNDeco(int nNodes, int *nodeSizes) nStreams, nodeSizes, nNodes ); k = 0; - for (int i = 0; i < nStreams; i++ ) + for (unsigned i = 0; i < nStreams; i++ ) for (int j = 0; j < * ( streamSizes + i ); j++ ) { vlistDefVarIOrank ( streamInqVlist ( * ( resHs + i )), j, @@ -343,7 +343,7 @@ struct collDesc static void modelWinDefBufferSizes(void) { - int collID, nstreams, * streamIndexList, streamNo, nvars, varID; + int collID, * streamIndexList, nvars, varID; size_t sumWinBufferSize = 0; int nProcsColl = commInqNProcsColl (); int rankGlob = commInqRankGlob (); @@ -353,11 +353,11 @@ modelWinDefBufferSizes(void) xdebug("%s", "START"); xassert(txWin != NULL); - nstreams = reshCountType ( &streamOps ); + unsigned nstreams = reshCountType ( &streamOps ); streamIndexList = xmalloc((size_t)nstreams * sizeof (streamIndexList[0])); collIndex = xcalloc((size_t)nProcsColl, sizeof (collIndex[0])); reshGetResHListOfType ( nstreams, streamIndexList, &streamOps ); - for ( streamNo = 0; streamNo < nstreams; streamNo++ ) + for (unsigned streamNo = 0; streamNo < nstreams; streamNo++ ) { // memory required for data int streamID = streamIndexList[streamNo]; diff --git a/src/pio_server.c b/src/pio_server.c index 52652fa10ffe4f1b9b5d098501048878c2b7b805..8180d7fd9dcab2b0e31761baa716e8d934d4733a 100644 --- a/src/pio_server.c +++ b/src/pio_server.c @@ -76,7 +76,7 @@ void serverWinCleanup () static size_t collDefBufferSizes() { - int nstreams, * streamIndexList, streamNo, vlistID, nvars, varID, iorank; + int *streamIndexList, vlistID, nvars, varID, iorank; int modelID; size_t sumGetBufferSizes = 0; int rankGlob = commInqRankGlob (); @@ -85,10 +85,10 @@ collDefBufferSizes() xassert(rxWin != NULL); - nstreams = reshCountType ( &streamOps ); + unsigned nstreams = reshCountType ( &streamOps ); streamIndexList = xmalloc((size_t)nstreams * sizeof (streamIndexList[0])); reshGetResHListOfType ( nstreams, streamIndexList, &streamOps ); - for ( streamNo = 0; streamNo < nstreams; streamNo++ ) + for (unsigned streamNo = 0; streamNo < nstreams; streamNo++) { // space required for data vlistID = streamInqVlist ( streamIndexList[streamNo] ); @@ -575,18 +575,18 @@ buildStreamMap(struct winHeaderEntry *winDict) /* join with list of streams written to in total */ { int *streamIDs, *streamIsWritten; - int numTotalStreamIDs = streamSize(); - streamIDs = (int*) xmalloc(2 * sizeof (streamIDs[0]) * (size_t)numTotalStreamIDs); - streamGetIndexList(numTotalStreamIDs, streamIDs); + unsigned numTotalStreamIDs = reshCountType(&streamOps); + streamIDs = xmalloc(2 * sizeof (streamIDs[0]) * (size_t)numTotalStreamIDs); + cdiStreamGetIndexList(numTotalStreamIDs, streamIDs); streamIsWritten = streamIDs + numTotalStreamIDs; - for (int i = 0; i < numTotalStreamIDs; ++i) + for (unsigned i = 0; i < numTotalStreamIDs; ++i) streamIsWritten[i] = streamIsInList(streamMap, numStreamIDs, streamIDs[i]); /* Find what streams are written to at all on any process */ - xmpi(MPI_Allreduce(MPI_IN_PLACE, streamIsWritten, numTotalStreamIDs, + xmpi(MPI_Allreduce(MPI_IN_PLACE, streamIsWritten, (int)numTotalStreamIDs, MPI_INT, MPI_BOR, commInqCommColl())); /* append streams written to on other tasks to mapping */ - for (int i = 0; i < numTotalStreamIDs; ++i) + for (unsigned i = 0; i < numTotalStreamIDs; ++i) if (streamIsWritten[i] && !streamIsInList(streamMap, numStreamIDs, streamIDs[i])) numStreamIDs = inventorizeStream(streamMap, numStreamIDs, @@ -1096,13 +1096,13 @@ void cdiPioServer(void (*postCommSetupActions)(void)) if ( nfinished == nProcsModel ) { { - int nStreams = streamSize (); + unsigned nStreams = reshCountType(&streamOps); if ( nStreams > 0 ) { - int * resHs = xmalloc((size_t)nStreams * sizeof (resHs[0])); - streamGetIndexList ( nStreams, resHs ); - for (int streamNo = 0; streamNo < nStreams; ++streamNo) + int *resHs = xmalloc(nStreams * sizeof (resHs[0])); + cdiStreamGetIndexList(nStreams, resHs); + for (unsigned streamNo = 0; streamNo < nStreams; ++streamNo) streamClose(resHs[streamNo]); free(resHs); } diff --git a/src/pio_util.c b/src/pio_util.c index 16f88701a9ca49423ea01741db7df14a5524b576..07ae4dd385c33e4829e9a2aced5465f1f5af474e 100644 --- a/src/pio_util.c +++ b/src/pio_util.c @@ -66,7 +66,7 @@ void pcdiXMPI(int iret, const char *filename, int line) "errorString: \"%s\"\n", rank, filename, line, errorString[0], errorString[1]); - MPI_Abort(MPI_COMM_WORLD, iret); + MPI_Abort(MPI_COMM_WORLD, 1); } /*****************************************************************************/ diff --git a/src/resource_handle.c b/src/resource_handle.c index f0f2301f6530750644cd154c54beb500f0e9a32a..5c6cfdd13d61b38724b7d43fc49165f19d2ebe95 100644 --- a/src/resource_handle.c +++ b/src/resource_handle.c @@ -431,19 +431,17 @@ void *reshGetValue(const char * caller, const char* expressionString, cdiResH re /**************************************************************/ -void reshGetResHListOfType ( int c, int * resHs, const resOps * ops ) +void reshGetResHListOfType(unsigned numIDs, int resHs[numIDs], const resOps *ops) { - int i, j = 0, nsp; - xassert ( resHs && ops ); LIST_INIT(1); LIST_LOCK(); - nsp = namespaceGetActive (); - - for ( i = 0; i < resHList[nsp].size && j < c; i++ ) + int nsp = namespaceGetActive(); + unsigned j = 0; + for (int i = 0; i < resHList[nsp].size && j < numIDs; i++ ) if ((resHList[nsp].resources[i].status & RESH_IN_USE_BIT) && resHList[nsp].resources[i].res.v.ops == ops) resHs[j++] = namespaceIdxEncode2(nsp, i); @@ -500,20 +498,21 @@ cdiResHFilterApply(const resOps *p, /**************************************************************/ -int reshCountType ( const resOps * ops ) +unsigned reshCountType(const resOps *ops) { - int i, nsp, countType = 0; + unsigned countType = 0; - xassert ( ops ); + xassert(ops); LIST_INIT(1); LIST_LOCK(); - nsp = namespaceGetActive (); + int nsp = namespaceGetActive (); listElem_t *r = resHList[nsp].resources; - for ( i = 0; i < resHList[nsp].size; i++ ) + size_t len = (size_t)resHList[nsp].size; + for (size_t i = 0; i < len; i++ ) countType += ((r[i].status & RESH_IN_USE_BIT) && r[i].res.v.ops == ops); LIST_UNLOCK(); diff --git a/src/resource_handle.h b/src/resource_handle.h index aad9a0c5cacc5cebbab568b2375dccc795417f49..b2c376d6b90361ba3a9f3bf1fb86826f758120fc 100644 --- a/src/resource_handle.h +++ b/src/resource_handle.h @@ -57,13 +57,13 @@ void reshRemove ( cdiResH, const resOps * ); /*> doesn't check resource type */ void reshDestroy(cdiResH); -int reshCountType ( const resOps * ); +unsigned reshCountType(const resOps *resTypeOps); void * reshGetValue(const char* caller, const char* expressionString, cdiResH id, const resOps* ops); #define reshGetVal(resH, ops) reshGetValue(__func__, #resH, resH, ops) -void reshGetResHListOfType ( int, int *, const resOps * ); +void reshGetResHListOfType(unsigned numIDs, int IDs[numIDs], const resOps *ops); enum cdiApplyRet { CDI_APPLY_ERROR = -1, diff --git a/src/servicelib.c b/src/servicelib.c index 56df92eccd0664514e9829b2022a08e28296bd83..a632f7a3e5987fc680fe017958109df506c0f612 100644 --- a/src/servicelib.c +++ b/src/servicelib.c @@ -2,6 +2,8 @@ # include "config.h" #endif +#ifdef HAVE_LIBSERVICE + #include <stdio.h> #include <stdarg.h> #include <string.h> @@ -609,3 +611,4 @@ void srvWrite(int fileID, srvrec_t *srvp) * require-trailing-newline: t * End: */ +#endif /* HAVE_LIBSERVICE */ diff --git a/src/stream.c b/src/stream.c index 74048549c0fe07d569602f76222bd1a12d3c131c..79931f3637e203e0e86fab0063ebf13dce2ce768 100644 --- a/src/stream.c +++ b/src/stream.c @@ -311,8 +311,11 @@ int streamInqByteorder(int streamID) const char *streamFilesuffix(int filetype) { // static char *fileSuffix[] = {"", ".grb", ".g2", ".nc", ".nc", ".nc4", ".nc4", ".srv", ".ext", ".ieg"}; - static const char *fileSuffix[] = {"", ".grb", ".grb", ".nc", ".nc", ".nc", ".nc", ".srv", ".ext", ".ieg"}; - int size = (int) (sizeof(fileSuffix)/sizeof(char *)); + /* note: the 2nd dimenstion of the fileSuffix array must be equal to or + * larger than the length of the longest suffix (dot and \0 terminator + * included) */ + static const char fileSuffix[][5] = {"", ".grb", ".grb", ".nc", ".nc", ".nc", ".nc", ".srv", ".ext", ".ieg"}; + int size = (int)(sizeof(fileSuffix)/sizeof(fileSuffix[0])); if ( filetype > 0 && filetype < size ) return (fileSuffix[filetype]); @@ -2171,9 +2174,9 @@ void cdiStreamSetupVlist(stream_t *streamptr, int vlistID, int vlistIDorig) } -void streamGetIndexList ( int nstreams, int * streamIndexList ) +void cdiStreamGetIndexList(unsigned numIDs, int IDs[numIDs]) { - reshGetResHListOfType ( nstreams, streamIndexList, &streamOps ); + reshGetResHListOfType(numIDs, IDs, &streamOps); } int streamInqNvars ( int streamID ) @@ -2276,7 +2279,6 @@ void streamPrintP ( void * streamptr, FILE * fp ) fprintf ( fp, "vlistIDorig = %d\n", sp->vlistIDorig ); } - enum { streamNint = 11, }; diff --git a/src/stream_srv.c b/src/stream_srv.c index 6e2d2e2b186268fab39e74868d1147b5ea04011b..da62efbd46519f9e1a3031b1412c26e9069516f2 100644 --- a/src/stream_srv.c +++ b/src/stream_srv.c @@ -206,25 +206,17 @@ static void srv_add_record(stream_t *streamptr, int param, int level, int xsize, int ysize, size_t recsize, off_t position, int prec) { - int leveltype; - int gridID = CDI_UNDEFID; - int levelID = 0; - int tsID, recID, varID; - int datatype; - record_t *record; - grid_t grid; - int vlistID; + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int recID = recordNewEntry(streamptr, tsID); + record_t *record = &streamptr->tsteps[tsID].records[recID]; - vlistID = streamptr->vlistID; - tsID = streamptr->curTsID; - recID = recordNewEntry(streamptr, tsID); - record = &streamptr->tsteps[tsID].records[recID]; - - (*record).size = recsize; - (*record).position = position; - (*record).param = param; - (*record).ilevel = level; + record->size = recsize; + record->position = position; + record->param = param; + record->ilevel = level; + grid_t grid; memset(&grid, 0, sizeof(grid_t)); grid.type = GRID_GENERIC; grid.size = xsize*ysize; @@ -232,21 +224,24 @@ void srv_add_record(stream_t *streamptr, int param, int level, int xsize, int ys grid.ysize = ysize; grid.xvals = NULL; grid.yvals = NULL; - gridID = varDefGrid(vlistID, &grid, 0); + int gridID = varDefGrid(vlistID, &grid, 0); /* if ( level == 0 ) leveltype = ZAXIS_SURFACE; else leveltype = ZAXIS_GENERIC; */ - leveltype = ZAXIS_GENERIC; + int leveltype = ZAXIS_GENERIC; + + int datatype = srvInqDatatype(prec); - datatype = srvInqDatatype(prec); + int levelID = 0; + int varID; varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0, datatype, &varID, &levelID, TSTEP_INSTANT, 0, 0, -1, NULL, NULL, NULL, NULL); xassert(varID <= SHRT_MAX && levelID <= SHRT_MAX); - (*record).varID = (short)varID; - (*record).levelID = (short)levelID; + record->varID = (short)varID; + record->levelID = (short)levelID; streamptr->tsteps[tsID].nallrecs++; streamptr->nrecs++; diff --git a/src/table.c b/src/table.c index 5e8c37287ded9580ca06659914cba83c115328e2..bd7ec02db9867d63fcb4849a7fceb993965783a8 100644 --- a/src/table.c +++ b/src/table.c @@ -796,27 +796,21 @@ void tableFWriteC(FILE *ptfp, int tableID) int tableInqParCode(int tableID, char *varname, int *code) { - int item, npars; - int err = 0; - - npars = parTable[tableID].npars; + int err = 1; - if ( tableID == UNDEFID || varname == NULL ) - { - err = 1; - } - else + if ( tableID != UNDEFID && varname != NULL ) { - for ( item = 0; item < npars; item++ ) + int npars = parTable[tableID].npars; + for ( int item = 0; item < npars; item++ ) { - if ( parTable[tableID].pars[item].name ) - if ( strcmp(parTable[tableID].pars[item].name, varname) == 0 ) - { - *code = parTable[tableID].pars[item].id; - break; - } + if ( parTable[tableID].pars[item].name + && strcmp(parTable[tableID].pars[item].name, varname) == 0 ) + { + *code = parTable[tableID].pars[item].id; + err = 0; + break; + } } - if ( item == npars ) err = 1; } return (err); @@ -825,27 +819,21 @@ int tableInqParCode(int tableID, char *varname, int *code) int tableInqParName(int tableID, int code, char *varname) { - int item, npars; - int err = 0; + int err = 1; - npars = parTable[tableID].npars; - - if ( tableID == UNDEFID ) - { - err = 1; - } - else + if ( tableID != UNDEFID ) { - for ( item = 0; item < npars; item++ ) + int npars = parTable[tableID].npars; + for ( int item = 0; item < npars; item++ ) { if ( parTable[tableID].pars[item].id == code ) { if ( parTable[tableID].pars[item].name ) strcpy(varname, parTable[tableID].pars[item].name); //FIXME: This may overrun the supplied buffer! + err = 0; break; } } - if ( item == npars ) err = 1; } return (err); @@ -855,12 +843,11 @@ int tableInqParName(int tableID, int code, char *varname) const char *tableInqParNamePtr(int tableID, int code) { const char *name = NULL; - int item, npars; if ( tableID != UNDEFID ) { - npars = parTable[tableID].npars; - for ( item = 0; item < npars; item++ ) + int npars = parTable[tableID].npars; + for ( int item = 0; item < npars; item++ ) { if ( parTable[tableID].pars[item].id == code ) { @@ -877,12 +864,11 @@ const char *tableInqParNamePtr(int tableID, int code) const char *tableInqParLongnamePtr(int tableID, int code) { const char *longname = NULL; - int item, npars; if ( tableID != UNDEFID ) { - npars = parTable[tableID].npars; - for ( item = 0; item < npars; item++ ) + int npars = parTable[tableID].npars; + for ( int item = 0; item < npars; item++ ) { if ( parTable[tableID].pars[item].id == code ) { @@ -899,12 +885,11 @@ const char *tableInqParLongnamePtr(int tableID, int code) const char *tableInqParUnitsPtr(int tableID, int code) { const char *units = NULL; - int item, npars; if ( tableID != UNDEFID ) { - npars = parTable[tableID].npars; - for ( item = 0; item < npars; item++ ) + int npars = parTable[tableID].npars; + for ( int item = 0; item < npars; item++ ) { if ( parTable[tableID].pars[item].id == code ) { @@ -920,30 +905,24 @@ const char *tableInqParUnitsPtr(int tableID, int code) int tableInqParLongname(int tableID, int code, char *longname) { - int item, npars; - int err = 0; - - npars = parTable[tableID].npars; - if ( ((tableID >= 0) & (tableID < MAX_TABLE)) | (tableID == UNDEFID) ) { } else Error("Invalid table ID %d", tableID); - if ( tableID == UNDEFID ) - { - err = 1; - } - else + int err = 1; + + if ( tableID != UNDEFID ) { - for ( item = 0; item < npars; item++ ) + int npars = parTable[tableID].npars; + for ( int item = 0; item < npars; item++ ) { if ( parTable[tableID].pars[item].id == code ) { if ( parTable[tableID].pars[item].longname ) strcpy(longname, parTable[tableID].pars[item].longname); + err = 0; break; } } - if ( item == npars ) err = 1; } return (err); @@ -952,30 +931,25 @@ int tableInqParLongname(int tableID, int code, char *longname) int tableInqParUnits(int tableID, int code, char *units) { - int item, npars; - int err = 0; - - npars = parTable[tableID].npars; if ( ((tableID >= 0) & (tableID < MAX_TABLE)) | (tableID == UNDEFID) ) { } else Error("Invalid table ID %d", tableID); - if ( tableID == UNDEFID ) - { - err = 1; - } - else + int err = 1; + + if ( tableID != UNDEFID ) { - for ( item = 0; item < npars; item++ ) + int npars = parTable[tableID].npars; + for ( int item = 0; item < npars; item++ ) { if ( parTable[tableID].pars[item].id == code ) { if ( parTable[tableID].pars[item].units ) strcpy(units, parTable[tableID].pars[item].units); + err = 0; break; } } - if ( item == npars ) err = 1; } return (err); @@ -984,11 +958,13 @@ int tableInqParUnits(int tableID, int code, char *units) void tableInqPar(int tableID, int code, char *name, char *longname, char *units) { - int item, npars; - npars = parTable[tableID].npars; + if ( ((tableID >= 0) & (tableID < MAX_TABLE)) | (tableID == UNDEFID) ) { } else + Error("Invalid table ID %d", tableID); - for ( item = 0; item < npars; item++ ) + int npars = parTable[tableID].npars; + + for ( int item = 0; item < npars; item++ ) { if ( parTable[tableID].pars[item].id == code ) { diff --git a/src/util.c b/src/util.c index b75792d9d1dfd7a7aeca41f8afd8e13a9f936a14..8c33813f0b807ac80f3f6154fee3de96b72ce9f9 100644 --- a/src/util.c +++ b/src/util.c @@ -2,6 +2,9 @@ # include "config.h" #endif +#define _XOPEN_SOURCE 600 + +#include <errno.h> #include <stdio.h> #include <string.h> #include <float.h> @@ -145,3 +148,91 @@ char* cdiUnescapeSpaces(const char* string, const char** outStringEnd) if(outStringEnd) *outStringEnd = &string[length + escapeCount]; return result; } + +#ifdef HAVE_DECL_UUID_GENERATE +#include <sys/time.h> +#include <uuid/uuid.h> +void +create_uuid(unsigned char *uuid) +{ + static int uuid_seeded = 0; + static char uuid_rand_state[31 * sizeof (long)]; + char *caller_rand_state; + if (uuid_seeded) + caller_rand_state = setstate(uuid_rand_state); + else + { + struct timeval tv; + int status = gettimeofday(&tv, NULL); + if (status != 0) + { + perror("uuid random seed generation failed!"); + exit(1); + } + unsigned seed = (unsigned)(tv.tv_sec ^ tv.tv_usec); + caller_rand_state = initstate(seed, uuid_rand_state, + sizeof (uuid_rand_state)); + uuid_seeded = 1; + } + uuid_generate(uuid); + setstate(caller_rand_state); +} +#elif defined (HAVE_DECL_UUID_CREATE) +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +#include <uuid.h> +void +create_uuid(unsigned char *uuid) +{ + unsigned32 status; + uuid_create((uuid_t *)uuid, &status); + if (status == -1) + { + perror("uuid generation failed!"); + exit(1); + } +} +#else +#include <sys/time.h> +void +create_uuid(unsigned char *uuid) +{ + static int uuid_seeded = 0; + static char uuid_rand_state[31 * sizeof (long)]; + char *caller_rand_state; + if (uuid_seeded) + caller_rand_state = setstate(uuid_rand_state); + else + { + struct timeval tv; + int status = gettimeofday(&tv, NULL); + if (status != 0) + { + perror("failed seed generation!"); + exit(1); + } + unsigned seed = tv.tv_sec ^ tv.tv_usec; + caller_rand_state = initstate(seed, uuid_rand_state, + sizeof (uuid_rand_state)); + uuid_seeded = 1; + } + for (size_t i = 0; i < CDI_UUID_SIZE; ++i) + uuid[i] = (unsigned char)random(); + /* encode variant into msb of octet 8 */ + uuid[8] = (unsigned char)((uuid[8] & 0x3f) | (1 << 7)); + /* encode version 4 ((pseudo-)random uuid) into msb of octet 7 */ + uuid[7] = (unsigned char)((uuid[7] & 0x0f) | (4 << 4)); + setstate(caller_rand_state); +} +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/src/varscan.c b/src/varscan.c index d1fd60f0ea9e56ac8434951c65dbe1a078cac4e9..559cdb66e21ce7b6087a04fcff0bccb3387f5a37 100644 --- a/src/varscan.c +++ b/src/varscan.c @@ -2,12 +2,14 @@ # include "config.h" #endif +#include <stdbool.h> #include <string.h> #include <math.h> #include "cdi.h" #include "cdi_int.h" #include "dmemory.h" +#include "resource_handle.h" #include "varscan.h" #include "vlist.h" #include "grid.h" @@ -80,12 +82,12 @@ vartable_t; static vartable_t *vartable; -static int varTablesize = 0; -static int nvars = 0; +static unsigned varTablesize = 0; +static unsigned nvars = 0; -static -void paramInitEntry(int varID, int param) +static void +paramInitEntry(unsigned varID, int param) { vartable[varID].param = param; vartable[varID].prec = 0; @@ -118,12 +120,10 @@ void paramInitEntry(int varID, int param) vartable[varID].ensdata = NULL; } -static -int varGetEntry(int param, int zaxistype, int ltype1, int tsteptype, const char *name) +static unsigned +varGetEntry(int param, int zaxistype, int ltype1, int tsteptype, const char *name) { - int varID; - - for ( varID = 0; varID < varTablesize; varID++ ) + for ( unsigned varID = 0; varID < varTablesize; varID++ ) { if ( vartable[varID].param == param && vartable[varID].zaxistype == zaxistype && @@ -141,15 +141,13 @@ int varGetEntry(int param, int zaxistype, int ltype1, int tsteptype, const char } } - return (UNDEFID); + return (unsigned)-1; } static void varFree(void) { - int varID; - - for ( varID = 0; varID < nvars; varID++ ) + for ( unsigned varID = 0; varID < nvars; varID++ ) { if ( vartable[varID].levelTable ) free(vartable[varID].levelTable); @@ -175,8 +173,8 @@ void varFree(void) Vctsize = 0; } -static -int levelNewEntry(int varID, int level1, int level2) +static int +levelNewEntry(unsigned varID, int level1, int level2) { int levelID = 0; int levelTableSize; @@ -247,10 +245,10 @@ int levelNewEntry(int varID, int level1, int level2) #define UNDEF_PARAM -4711 -static -int paramNewEntry(int param) +static unsigned +paramNewEntry(int param) { - int varID = 0; + unsigned varID = 0; /* Look for a free slot in vartable. @@ -258,8 +256,6 @@ int paramNewEntry(int param) */ if ( ! varTablesize ) { - int i; - varTablesize = 2; vartable = (vartable_t *)xmalloc((size_t)varTablesize * sizeof (vartable_t)); @@ -269,7 +265,7 @@ int paramNewEntry(int param) SysError("Allocation of vartable failed"); } - for( i = 0; i < varTablesize; i++ ) + for( unsigned i = 0; i < varTablesize; i++ ) { vartable[i].param = UNDEF_PARAM; #if defined (HAVE_LIBGRIB_API) @@ -291,7 +287,6 @@ int paramNewEntry(int param) */ if ( varID == varTablesize ) { - int i; varTablesize = 2 * varTablesize; vartable = (vartable_t *)xrealloc(vartable, (size_t)varTablesize @@ -303,7 +298,7 @@ int paramNewEntry(int param) } varID = varTablesize/2; - for( i = varID; i < varTablesize; i++ ) + for( unsigned i = varID; i < varTablesize; i++ ) { vartable[i].param = UNDEF_PARAM; #if defined (HAVE_LIBGRIB_API) @@ -324,13 +319,10 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds, int *pvarID, int *plevelID, int tsteptype, int numavg, int ltype1, int ltype2, const char *name, const char *stdname, const char *longname, const char *units) { - int varID = UNDEFID; - int levelID = -1; + unsigned varID = (cdiSplitLtype105 != 1 || zaxistype != ZAXIS_HEIGHT) ? + varGetEntry(param, zaxistype, ltype1, tsteptype, name) : (unsigned)UNDEFID; - if ( ! (cdiSplitLtype105 == 1 && zaxistype == ZAXIS_HEIGHT) ) - varID = varGetEntry(param, zaxistype, ltype1, tsteptype, name); - - if ( varID == UNDEFID ) + if ( varID == (unsigned)UNDEFID ) { nvars++; varID = paramNewEntry(param); @@ -368,10 +360,10 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds, if ( prec > vartable[varID].prec ) vartable[varID].prec = prec; - levelID = levelNewEntry(varID, level1, level2); + int levelID = levelNewEntry(varID, level1, level2); vartable[varID].levelTable[levelID].recID = recID; - *pvarID = varID; + *pvarID = (int)varID; *plevelID = levelID; } /* @@ -441,7 +433,7 @@ int cmpparam(const void* s1, const void* s2) void cdi_generate_vars(stream_t *streamptr) { - int varID, gridID, zaxisID; + int gridID, zaxisID; int instID, modelID, tableID; int param, zaxistype, ltype1, ltype2; int prec; @@ -453,40 +445,33 @@ void cdi_generate_vars(stream_t *streamptr) double *dlevels = NULL; double *dlevels1 = NULL; double *dlevels2 = NULL; - int index, varid; double level_sf = 1; int vlistID = streamptr->vlistID; - int *varids = (int *)xmalloc((size_t)nvars*sizeof(int)); - for ( varID = 0; varID < nvars; varID++ ) varids[varID] = varID; + int *varids = (int *)xmalloc(nvars*sizeof(int)); + for ( unsigned varID = 0; varID < nvars; varID++ ) varids[varID] = (int)varID; if ( streamptr->sortname ) { - param_t **varInfo; - varInfo = (param_t **)xmalloc((size_t)nvars * sizeof (param_t *)); - varInfo[0] = (param_t *)xmalloc((size_t)nvars * sizeof (param_t)); - - for ( int index = 1; index < nvars; index++ ) - varInfo[index] = varInfo[0] + index; + param_t *varInfo = (param_t *)xmalloc((size_t)nvars * sizeof (param_t)); - for ( varid = 0; varid < nvars; varid++ ) + for ( unsigned varID = 0; varID < nvars; varID++ ) { - varInfo[varid]->varid = varids[varid]; - varInfo[varid]->param = vartable[varid].param; - varInfo[varid]->ltype = vartable[varid].ltype1; + varInfo[varID].varid = varids[varID]; + varInfo[varID].param = vartable[varID].param; + varInfo[varID].ltype = vartable[varID].ltype1; } - qsort(varInfo[0], (size_t)nvars, sizeof(param_t), cmpparam); - for ( varid = 0; varid < nvars; varid++ ) + qsort(varInfo, (size_t)nvars, sizeof(param_t), cmpparam); + for ( unsigned varID = 0; varID < nvars; varID++ ) { - varids[varid] = varInfo[varid]->varid; + varids[varID] = varInfo[varID].varid; } - free(varInfo[0]); free(varInfo); } - for ( index = 0; index < nvars; index++ ) + for ( unsigned index = 0; index < nvars; index++ ) { - varid = varids[index]; + int varid = varids[index]; gridID = vartable[varid].gridID; param = vartable[varid].param; @@ -600,7 +585,7 @@ void cdi_generate_vars(stream_t *streamptr) if ( lbounds ) free(dlevels2); free(dlevels); - varID = stream_new_var(streamptr, gridID, zaxisID); + int varID = stream_new_var(streamptr, gridID, zaxisID); varID = vlistDefVar(vlistID, gridID, zaxisID, tsteptype); vlistDefVarParam(vlistID, varID, param); @@ -688,10 +673,10 @@ void cdi_generate_vars(stream_t *streamptr) if ( tableID != UNDEFID ) vlistDefVarTable(vlistID, varID, tableID); } - for ( index = 0; index < nvars; index++ ) + for ( unsigned index = 0; index < nvars; index++ ) { - varID = index; - varid = varids[index]; + int varID = (int)index; + int varid = varids[index]; unsigned nlevels = vartable[varid].nlevels; /* @@ -741,6 +726,25 @@ void varDefZAxisReference(int nhlev, int nvgrid, unsigned char uuid[CDI_UUID_SIZ memcpy(uuidVGrid, uuid, CDI_UUID_SIZE); } +struct varDefGridSearchState +{ + int resIDValue; + const grid_t *queryKey; +}; + +static enum cdiApplyRet +varDefGridSearch(int id, void *res, void *data) +{ + struct varDefGridSearchState *state = data; + (void)res; + if (gridCompare(id, state->queryKey) == 0) + { + state->resIDValue = id; + return CDI_APPLY_STOP; + } + else + return CDI_APPLY_GO_ON; +} int varDefGrid(int vlistID, const grid_t *grid, int mode) { @@ -750,19 +754,14 @@ int varDefGrid(int vlistID, const grid_t *grid, int mode) */ int gridglobdefined = FALSE; int griddefined; - int ngrids; int gridID = CDI_UNDEFID; - int index; - vlist_t *vlistptr; - int * gridIndexList, i; - - vlistptr = vlist_to_pointer(vlistID); + vlist_t *vlistptr = vlist_to_pointer(vlistID); griddefined = FALSE; - ngrids = vlistptr->ngrids; + unsigned ngrids = (unsigned)vlistptr->ngrids; if ( mode == 0 ) - for ( index = 0; index < ngrids; index++ ) + for (unsigned index = 0; index < ngrids; index++ ) { gridID = vlistptr->gridIDs[index]; if ( gridID == UNDEFID ) @@ -777,26 +776,14 @@ int varDefGrid(int vlistID, const grid_t *grid, int mode) if ( ! griddefined ) { - ngrids = gridSize(); - if ( ngrids > 0 ) - { - gridIndexList = (int*)xmalloc((size_t)ngrids * sizeof(int)); - gridGetIndexList ( ngrids, gridIndexList ); - for ( i = 0; i < ngrids; i++ ) - { - gridID = gridIndexList[i]; - if ( gridCompare(gridID, grid) == 0 ) - { - gridglobdefined = TRUE; - break; - } - } - if ( gridIndexList ) free ( gridIndexList ); - } - - ngrids = vlistptr->ngrids; - if ( mode == 1 ) - for ( index = 0; index < ngrids; index++ ) + struct varDefGridSearchState query = { .queryKey = grid }; + if ((gridglobdefined + = (cdiResHFilterApply(&gridOps, varDefGridSearch, &query) + == CDI_APPLY_STOP))) + gridID = query.resIDValue; + + if ( mode == 1 && gridglobdefined) + for (unsigned index = 0; index < ngrids; index++ ) if ( vlistptr->gridIDs[index] == gridID ) { gridglobdefined = FALSE; @@ -807,7 +794,7 @@ int varDefGrid(int vlistID, const grid_t *grid, int mode) if ( ! griddefined ) { if ( ! gridglobdefined ) gridID = gridGenerate(grid); - ngrids = vlistptr->ngrids; + ngrids = (unsigned)vlistptr->ngrids; vlistptr->gridIDs[ngrids] = gridID; vlistptr->ngrids++; } @@ -862,6 +849,33 @@ int zaxisCompare(int zaxisID, int zaxistype, int nlevels, int lbounds, const dou return (differ); } +struct varDefZAxisSearchState +{ + int resIDValue; + int zaxistype; + int nlevels; + double *levels; + int lbounds; + char *longname, *units; + int ltype; +}; + +static enum cdiApplyRet +varDefZAxisSearch(int id, void *res, void *data) +{ + struct varDefZAxisSearchState *state = data; + (void)res; + if (zaxisCompare(id, state->zaxistype, state->nlevels, state->lbounds, + state->levels, state->longname, state->units, state->ltype) + == 0) + { + state->resIDValue = id; + return CDI_APPLY_STOP; + } + else + return CDI_APPLY_GO_ON; +} + int varDefZaxis(int vlistID, int zaxistype, int nlevels, double *levels, int lbounds, double *levels1, double *levels2, int vctsize, double *vct, char *name, @@ -871,17 +885,15 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, double *levels, int lbo mode: 0 search in vlist and zaxis table 1 search in zaxis table */ - int zaxisdefined; + int zaxisdefined = 0; int nzaxis; int zaxisID = UNDEFID; int index; int zaxisglobdefined = 0; vlist_t *vlistptr; - int i; vlistptr = vlist_to_pointer(vlistID); - zaxisdefined = 0; nzaxis = vlistptr->nzaxis; if ( mode == 0 ) @@ -898,27 +910,22 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, double *levels, int lbo if ( ! zaxisdefined ) { - nzaxis = zaxisSize(); - if ( nzaxis > 0 ) - { - int *zaxisIndexList; - zaxisIndexList = (int *)xmalloc((size_t)nzaxis * sizeof (int)); - zaxisGetIndexList(nzaxis, zaxisIndexList); - for ( i = 0; i < nzaxis; i++ ) - { - zaxisID = zaxisIndexList[i]; - if ( zaxisCompare(zaxisID, zaxistype, nlevels, lbounds, levels, longname, units, ltype1) == 0 ) - { - zaxisglobdefined = 1; - break; - } - } - if ( zaxisIndexList ) free ( zaxisIndexList ); - } - - nzaxis = vlistptr->nzaxis; - if ( mode == 1 ) - for ( index = 0; index < nzaxis; index++ ) + struct varDefZAxisSearchState query = { + .zaxistype = zaxistype, + .nlevels = nlevels, + .levels = levels, + .lbounds = lbounds, + .longname = longname, + .units = units, + .ltype = ltype1, + }; + if ((zaxisglobdefined + = (cdiResHFilterApply(&zaxisOps, varDefZAxisSearch, &query) + == CDI_APPLY_STOP))) + zaxisID = query.resIDValue; + + if ( mode == 1 && zaxisglobdefined) + for (int index = 0; index < nzaxis; index++ ) if ( vlistptr->zaxisIDs[index] == zaxisID ) { zaxisglobdefined = FALSE; @@ -955,7 +962,6 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, double *levels, int lbo zaxisDefLtype(zaxisID, ltype1); } - nzaxis = vlistptr->nzaxis; vlistptr->zaxisIDs[nzaxis] = zaxisID; vlistptr->nzaxis++; } diff --git a/src/vlist.c b/src/vlist.c index 2c49eed4d440ac511a8d25e7c750267d86ae2c69..a9228f43a1a7ebea7cbba1d30111107997fb9054 100644 --- a/src/vlist.c +++ b/src/vlist.c @@ -23,8 +23,6 @@ int cdiNAdditionalGRIBKeys = 0; char* cdiAdditionalGRIBKeys[MAX_OPT_GRIB_ENTRIES]; #endif -extern void zaxisGetIndexList ( int, int * ); - static int VLIST_Debug = 0; static void vlist_initialize(void); @@ -445,13 +443,13 @@ int vlist_generate_zaxis(int vlistID, int zaxistype, int nlevels, const double * if ( ! zaxisdefined ) { - nzaxis = zaxisSize(); + unsigned nzaxis = cdiZaxisCount(); if ( nzaxis > 0 ) { int *zaxisIndexList = (int *)xmalloc((size_t)nzaxis * sizeof (int)); reshLock(); - zaxisGetIndexList ( nzaxis, zaxisIndexList ); - for ( int index = 0; index < nzaxis; ++index ) + cdiZaxisGetIndexList(nzaxis, zaxisIndexList); + for (unsigned index = 0; index < nzaxis; ++index) { zaxisID = zaxisIndexList[index]; if ( zaxisCompare(zaxisID, zaxistype, nlevels, has_bounds, levels, NULL, NULL, 0) == 0 ) diff --git a/src/zaxis.c b/src/zaxis.c index 0eb983b3fcda268d94d71c2d1a9501fe6187fd80..641808bd2903235227756cd04e442fd894c926ef 100644 --- a/src/zaxis.c +++ b/src/zaxis.c @@ -94,7 +94,7 @@ static int zaxisGetPackSize ( void * zaxisptr, void *context); static void zaxisPack ( void * zaxisptr, void * buffer, int size, int *pos, void *context); static int zaxisTxCode ( void ); -static const resOps zaxisOps = { +const resOps zaxisOps = { (int (*)(void *, void *))zaxisCompareP, zaxisDestroyP, zaxisPrintP, @@ -192,9 +192,9 @@ void zaxis_copy(zaxis_t *zaxisptr2, zaxis_t *zaxisptr1) zaxisptr2->self = zaxisID2; } -int zaxisSize(void) +unsigned cdiZaxisCount(void) { - return reshCountType ( &zaxisOps ); + return reshCountType(&zaxisOps); } static int @@ -1657,9 +1657,9 @@ zaxisPack(void * voidP, void * packBuffer, int packBufferSize, } -void zaxisGetIndexList ( int nzaxis, int * zaxisResHs ) +void cdiZaxisGetIndexList(unsigned nzaxis, int zaxisResHs[nzaxis]) { - reshGetResHListOfType ( nzaxis, zaxisResHs, &zaxisOps ); + reshGetResHListOfType(nzaxis, zaxisResHs, &zaxisOps); } #undef ZAXIS_STR_SERIALIZE diff --git a/src/zaxis.h b/src/zaxis.h index b530a29230d72d8a810a6bc12241781d7e2759ae..7d975533d032bf6a182155c4c3a853842a09a0ae 100644 --- a/src/zaxis.h +++ b/src/zaxis.h @@ -1,14 +1,21 @@ #ifndef _ZAXIS_H #define _ZAXIS_H - void zaxisGetTypeDescription(int zaxisType, int* outPositive, const char** outName, const char** outLongName, const char** outStdName, const char** outUnit); //The returned const char* point to static storage. Don't free or modify them. int zaxisSize(void); +unsigned cdiZaxisCount(void); + +void cdiZaxisGetIndexList(unsigned numIDs, int IDs[numIDs]); + void zaxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos, int originNamespace, void *context, int force_id); +void zaxisDefLtype2(int zaxisID, int ltype2); + +extern const resOps zaxisOps; + #endif diff --git a/tests/Makefile.am b/tests/Makefile.am index 009d6765fa6be04429c287d39e1588613d19b038..ce3412f194b73bebe776245f1ceaf19db4192c46 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,28 +26,25 @@ cksum_read_SOURCES = cksum_read.c \ stream_cksum.c stream_cksum.h \ ensure_array_size.h ensure_array_size.c pio_write_SOURCES = pio_write.c pio_write.h simple_model.c \ - simple_model_helper.h simple_model_helper.c \ - create_uuid.h create_uuid.c + simple_model_helper.h simple_model_helper.c pio_write_deco2d_SOURCES = pio_write.c pio_write.h deco2d_model.c \ - simple_model_helper.h simple_model_helper.c \ - create_uuid.h create_uuid.c -test_resource_copy_SOURCES = test_resource_copy.c \ - create_uuid.h create_uuid.c + simple_model_helper.h simple_model_helper.c +test_resource_copy_SOURCES = test_resource_copy.c test_resource_copy_LDADD = $(UUID_C_LIB) ../src/libcdiresunpack.la $(LDADD) -test_resource_copy_mpi_SOURCES = test_resource_copy.c \ - create_uuid.h create_uuid.c +test_resource_copy_mpi_SOURCES = test_resource_copy.c test_cdf_write_SOURCES = test_cdf_write.c test_cdf_read_SOURCES = test_cdf_read.c testprog_input_file_SOURCES = testprog_input_file.c # -AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) +AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) $(MPI_C_INCLUDE) if USE_MPI -pio_write_LDADD = ../src/libcdipio.la $(UUID_C_LIB) -pio_write_deco2d_LDADD = ../src/libcdipio.la $(UUID_C_LIB) +pio_write_LDADD = ../src/libcdipio.la $(UUID_C_LIB) $(MPI_C_LIB) +pio_write_deco2d_LDADD = ../src/libcdipio.la $(UUID_C_LIB) $(MPI_C_LIB) TESTS += test_resource_copy_mpi_run check_PROGRAMS += test_resource_copy_mpi test_resource_copy_mpi_LDADD = ../src/libcdipio.la $(UUID_C_LIB) -test_resource_copy_mpi_CFLAGS = $(AM_CFLAGS) $(CFLAGS) -DMPI_MARSHALLING +test_resource_copy_mpi_CFLAGS = $(AM_CFLAGS) $(CFLAGS) \ + -DMPI_MARSHALLING else pio_write_LDADD = $(LDADD) $(UUID_C_LIB) pio_write_deco2d_LDADD = $(LDADD) $(UUID_C_LIB) diff --git a/tests/Makefile.in b/tests/Makefile.in index fb5a73db138c00be559bf34406ee0692efb6165e..c843151da40283e0b2f53e42eff6d61eed6ee05d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -83,11 +83,12 @@ TESTS = cksum_verify$(EXEEXT) test_cksum_grib test_cksum_nc \ pio_cksum_mpinonb pio_cksum_fpguard pio_cksum_asynch \ pio_cksum_writer pio_cksum_cdf test_resource_copy$(EXEEXT) \ pio_write_deco2d_run test_f2003 test_cdf_transformation \ - $(am__append_2) + test_input_file $(am__append_2) check_PROGRAMS = cksum_verify$(EXEEXT) test_grib$(EXEEXT) \ cksum_write$(EXEEXT) cksum_read$(EXEEXT) pio_write$(EXEEXT) \ test_resource_copy$(EXEEXT) cksum_write_chunk$(EXEEXT) \ - pio_write_deco2d$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) + pio_write_deco2d$(EXEEXT) testprog_input_file$(EXEEXT) \ + $(am__EXEEXT_1) $(am__EXEEXT_2) @ENABLE_NETCDF_TRUE@am__append_1 = test_cdf_write test_cdf_read @USE_MPI_TRUE@am__append_2 = test_resource_copy_mpi_run @USE_MPI_TRUE@am__append_3 = test_resource_copy_mpi @@ -109,17 +110,26 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ - $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/starlink_fpp.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/asx_tr_arg.m4 $(top_srcdir)/m4/asx_unset.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/starlink_fpp.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -159,22 +169,21 @@ cksum_write_chunk_OBJECTS = $(am_cksum_write_chunk_OBJECTS) cksum_write_chunk_LDADD = $(LDADD) cksum_write_chunk_DEPENDENCIES = ../src/libcdi.la am_pio_write_OBJECTS = pio_write.$(OBJEXT) simple_model.$(OBJEXT) \ - simple_model_helper.$(OBJEXT) create_uuid.$(OBJEXT) + simple_model_helper.$(OBJEXT) pio_write_OBJECTS = $(am_pio_write_OBJECTS) am__DEPENDENCIES_1 = ../src/libcdi.la am__DEPENDENCIES_2 = @USE_MPI_FALSE@pio_write_DEPENDENCIES = $(am__DEPENDENCIES_1) \ @USE_MPI_FALSE@ $(am__DEPENDENCIES_2) @USE_MPI_TRUE@pio_write_DEPENDENCIES = ../src/libcdipio.la \ -@USE_MPI_TRUE@ $(am__DEPENDENCIES_2) +@USE_MPI_TRUE@ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2) am_pio_write_deco2d_OBJECTS = pio_write.$(OBJEXT) \ - deco2d_model.$(OBJEXT) simple_model_helper.$(OBJEXT) \ - create_uuid.$(OBJEXT) + deco2d_model.$(OBJEXT) simple_model_helper.$(OBJEXT) pio_write_deco2d_OBJECTS = $(am_pio_write_deco2d_OBJECTS) @USE_MPI_FALSE@pio_write_deco2d_DEPENDENCIES = $(am__DEPENDENCIES_1) \ @USE_MPI_FALSE@ $(am__DEPENDENCIES_2) @USE_MPI_TRUE@pio_write_deco2d_DEPENDENCIES = ../src/libcdipio.la \ -@USE_MPI_TRUE@ $(am__DEPENDENCIES_2) +@USE_MPI_TRUE@ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2) am_test_cdf_read_OBJECTS = test_cdf_read.$(OBJEXT) test_cdf_read_OBJECTS = $(am_test_cdf_read_OBJECTS) test_cdf_read_LDADD = $(LDADD) @@ -187,14 +196,12 @@ am_test_grib_OBJECTS = test_grib.$(OBJEXT) test_grib_OBJECTS = $(am_test_grib_OBJECTS) test_grib_LDADD = $(LDADD) test_grib_DEPENDENCIES = ../src/libcdi.la -am_test_resource_copy_OBJECTS = test_resource_copy.$(OBJEXT) \ - create_uuid.$(OBJEXT) +am_test_resource_copy_OBJECTS = test_resource_copy.$(OBJEXT) test_resource_copy_OBJECTS = $(am_test_resource_copy_OBJECTS) test_resource_copy_DEPENDENCIES = $(am__DEPENDENCIES_2) \ ../src/libcdiresunpack.la $(am__DEPENDENCIES_1) am_test_resource_copy_mpi_OBJECTS = \ - test_resource_copy_mpi-test_resource_copy.$(OBJEXT) \ - test_resource_copy_mpi-create_uuid.$(OBJEXT) + test_resource_copy_mpi-test_resource_copy.$(OBJEXT) test_resource_copy_mpi_OBJECTS = $(am_test_resource_copy_mpi_OBJECTS) @USE_MPI_FALSE@test_resource_copy_mpi_DEPENDENCIES = \ @USE_MPI_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) @@ -204,6 +211,10 @@ test_resource_copy_mpi_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ +am_testprog_input_file_OBJECTS = testprog_input_file.$(OBJEXT) +testprog_input_file_OBJECTS = $(am_testprog_input_file_OBJECTS) +testprog_input_file_LDADD = $(LDADD) +testprog_input_file_DEPENDENCIES = ../src/libcdi.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -243,13 +254,15 @@ SOURCES = $(cksum_read_SOURCES) $(cksum_verify_SOURCES) \ $(pio_write_SOURCES) $(pio_write_deco2d_SOURCES) \ $(test_cdf_read_SOURCES) $(test_cdf_write_SOURCES) \ $(test_grib_SOURCES) $(test_resource_copy_SOURCES) \ - $(test_resource_copy_mpi_SOURCES) + $(test_resource_copy_mpi_SOURCES) \ + $(testprog_input_file_SOURCES) DIST_SOURCES = $(cksum_read_SOURCES) $(cksum_verify_SOURCES) \ $(cksum_write_SOURCES) $(cksum_write_chunk_SOURCES) \ $(pio_write_SOURCES) $(pio_write_deco2d_SOURCES) \ $(test_cdf_read_SOURCES) $(test_cdf_write_SOURCES) \ $(test_grib_SOURCES) $(test_resource_copy_SOURCES) \ - $(test_resource_copy_mpi_SOURCES) + $(test_resource_copy_mpi_SOURCES) \ + $(testprog_input_file_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -331,6 +344,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NETCDF = @ENABLE_NETCDF@ @@ -378,6 +392,11 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_INCLUDE = @MPI_FC_INCLUDE@ +MPI_FC_LIB = @MPI_FC_LIB@ MPI_LAUNCH = @MPI_LAUNCH@ NC_CONFIG = @NC_CONFIG@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ @@ -496,30 +515,28 @@ cksum_read_SOURCES = cksum_read.c \ ensure_array_size.h ensure_array_size.c pio_write_SOURCES = pio_write.c pio_write.h simple_model.c \ - simple_model_helper.h simple_model_helper.c \ - create_uuid.h create_uuid.c + simple_model_helper.h simple_model_helper.c pio_write_deco2d_SOURCES = pio_write.c pio_write.h deco2d_model.c \ - simple_model_helper.h simple_model_helper.c \ - create_uuid.h create_uuid.c - -test_resource_copy_SOURCES = test_resource_copy.c \ - create_uuid.h create_uuid.c + simple_model_helper.h simple_model_helper.c +test_resource_copy_SOURCES = test_resource_copy.c test_resource_copy_LDADD = $(UUID_C_LIB) ../src/libcdiresunpack.la $(LDADD) -test_resource_copy_mpi_SOURCES = test_resource_copy.c \ - create_uuid.h create_uuid.c - +test_resource_copy_mpi_SOURCES = test_resource_copy.c test_cdf_write_SOURCES = test_cdf_write.c test_cdf_read_SOURCES = test_cdf_read.c -AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) +testprog_input_file_SOURCES = testprog_input_file.c +# +AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) $(MPI_C_INCLUDE) @USE_MPI_FALSE@pio_write_LDADD = $(LDADD) $(UUID_C_LIB) -@USE_MPI_TRUE@pio_write_LDADD = ../src/libcdipio.la $(UUID_C_LIB) +@USE_MPI_TRUE@pio_write_LDADD = ../src/libcdipio.la $(UUID_C_LIB) $(MPI_C_LIB) @USE_MPI_FALSE@pio_write_deco2d_LDADD = $(LDADD) $(UUID_C_LIB) -@USE_MPI_TRUE@pio_write_deco2d_LDADD = ../src/libcdipio.la $(UUID_C_LIB) +@USE_MPI_TRUE@pio_write_deco2d_LDADD = ../src/libcdipio.la $(UUID_C_LIB) $(MPI_C_LIB) @USE_MPI_FALSE@test_resource_copy_mpi_LDADD = $(LDADD) $(UUID_C_LIB) @USE_MPI_TRUE@test_resource_copy_mpi_LDADD = ../src/libcdipio.la $(UUID_C_LIB) -@USE_MPI_TRUE@test_resource_copy_mpi_CFLAGS = $(AM_CFLAGS) $(CFLAGS) -DMPI_MARSHALLING +@USE_MPI_TRUE@test_resource_copy_mpi_CFLAGS = $(AM_CFLAGS) $(CFLAGS) \ +@USE_MPI_TRUE@ -DMPI_MARSHALLING + LDADD = ../src/libcdi.la -lm AM_CPPFLAGS = -I$(top_srcdir)/src # @@ -652,6 +669,10 @@ test_resource_copy_mpi$(EXEEXT): $(test_resource_copy_mpi_OBJECTS) $(test_resour @rm -f test_resource_copy_mpi$(EXEEXT) $(AM_V_CCLD)$(test_resource_copy_mpi_LINK) $(test_resource_copy_mpi_OBJECTS) $(test_resource_copy_mpi_LDADD) $(LIBS) +testprog_input_file$(EXEEXT): $(testprog_input_file_OBJECTS) $(testprog_input_file_DEPENDENCIES) $(EXTRA_testprog_input_file_DEPENDENCIES) + @rm -f testprog_input_file$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(testprog_input_file_OBJECTS) $(testprog_input_file_LDADD) $(LIBS) + mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -662,7 +683,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_verify.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_write.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_write_chunk.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/create_uuid.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deco2d_model.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ensure_array_size.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_write.Po@am__quote@ @@ -673,8 +693,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cdf_write.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_grib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy_mpi-create_uuid.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy_mpi-test_resource_copy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testprog_input_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/var_cksum.Po@am__quote@ .c.o: @@ -712,20 +732,6 @@ test_resource_copy_mpi-test_resource_copy.obj: test_resource_copy.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -c -o test_resource_copy_mpi-test_resource_copy.obj `if test -f 'test_resource_copy.c'; then $(CYGPATH_W) 'test_resource_copy.c'; else $(CYGPATH_W) '$(srcdir)/test_resource_copy.c'; fi` -test_resource_copy_mpi-create_uuid.o: create_uuid.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -MT test_resource_copy_mpi-create_uuid.o -MD -MP -MF $(DEPDIR)/test_resource_copy_mpi-create_uuid.Tpo -c -o test_resource_copy_mpi-create_uuid.o `test -f 'create_uuid.c' || echo '$(srcdir)/'`create_uuid.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_resource_copy_mpi-create_uuid.Tpo $(DEPDIR)/test_resource_copy_mpi-create_uuid.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='create_uuid.c' object='test_resource_copy_mpi-create_uuid.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -c -o test_resource_copy_mpi-create_uuid.o `test -f 'create_uuid.c' || echo '$(srcdir)/'`create_uuid.c - -test_resource_copy_mpi-create_uuid.obj: create_uuid.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -MT test_resource_copy_mpi-create_uuid.obj -MD -MP -MF $(DEPDIR)/test_resource_copy_mpi-create_uuid.Tpo -c -o test_resource_copy_mpi-create_uuid.obj `if test -f 'create_uuid.c'; then $(CYGPATH_W) 'create_uuid.c'; else $(CYGPATH_W) '$(srcdir)/create_uuid.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_resource_copy_mpi-create_uuid.Tpo $(DEPDIR)/test_resource_copy_mpi-create_uuid.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='create_uuid.c' object='test_resource_copy_mpi-create_uuid.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -c -o test_resource_copy_mpi-create_uuid.obj `if test -f 'create_uuid.c'; then $(CYGPATH_W) 'create_uuid.c'; else $(CYGPATH_W) '$(srcdir)/create_uuid.c'; fi` - mostlyclean-libtool: -rm -f *.lo diff --git a/tests/create_uuid.c b/tests/create_uuid.c deleted file mode 100644 index d15e3d1935f7a18fb8c7beb4bda057e24da68463..0000000000000000000000000000000000000000 --- a/tests/create_uuid.c +++ /dev/null @@ -1,91 +0,0 @@ -#if defined (HAVE_CONFIG_H) -# include "config.h" -#endif - -#define _XOPEN_SOURCE 600 - -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> - -#include "create_uuid.h" - - - -#ifdef HAVE_DECL_UUID_GENERATE -#include <sys/time.h> -#include <uuid/uuid.h> -void -create_uuid(unsigned char *uuid) -{ - static int uuid_seeded = 0; - static char uuid_rand_state[31 * sizeof (long)]; - char *caller_rand_state; - if (uuid_seeded) - caller_rand_state = setstate(uuid_rand_state); - else - { - struct timeval tv; - int status = gettimeofday(&tv, NULL); - if (status != 0) - { - perror("uuid random seed generation failed!"); - exit(1); - } - unsigned seed = (unsigned)(tv.tv_sec ^ tv.tv_usec); - caller_rand_state = initstate(seed, uuid_rand_state, - sizeof (uuid_rand_state)); - uuid_seeded = 1; - } - uuid_generate(uuid); - setstate(caller_rand_state); -} -#elif defined (HAVE_DECL_UUID_CREATE) -typedef uint8_t u_int8_t; -typedef uint16_t u_int16_t; -typedef uint32_t u_int32_t; -#include <uuid.h> -void -create_uuid(unsigned char *uuid) -{ - unsigned32 status; - uuid_create((uuid_t *)uuid, &status); - if (status == -1) - { - perror("uuid generation failed!"); - exit(1); - } -} -#else -#include <sys/time.h> -void -create_uuid(unsigned char *uuid) -{ - static int uuid_seeded = 0; - static char uuid_rand_state[31 * sizeof (long)]; - char *caller_rand_state; - if (uuid_seeded) - caller_rand_state = setstate(uuid_rand_state); - else - { - struct timeval tv; - int status = gettimeofday(&tv, NULL); - if (status != 0) - { - perror("failed seed generation!"); - exit(1); - } - unsigned seed = tv.tv_sec ^ tv.tv_usec; - caller_rand_state = initstate(seed, uuid_rand_state, - sizeof (uuid_rand_state)); - uuid_seeded = 1; - } - for (size_t i = 0; i < CDI_UUID_SIZE; ++i) - uuid[i] = (unsigned char)random(); - /* encode variant into msb of octet 8 */ - uuid[8] = (unsigned char)((uuid[8] & 0x3f) | (1 << 7)); - /* encode version 4 ((pseudo-)random uuid) into msb of octet 7 */ - uuid[7] = (unsigned char)((uuid[7] & 0x0f) | (4 << 4)); - setstate(caller_rand_state); -} -#endif diff --git a/util/mpi_launch_poe b/util/mpi_launch_poe index 6bb2f765ebff382abad29db87517adac2bd6cd05..003cab44dac273790da7e0edd08d20abb08ddede 100755 --- a/util/mpi_launch_poe +++ b/util/mpi_launch_poe @@ -1,4 +1,36 @@ #! /usr/bin/ksh93 +# +# Copyright (C) 2014 Thomas Jahns <jahns@dkrz.de> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of the DKRZ GmbH nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Run programs on AIX PE like mpirun does for other systems +# if [ x"$1" = x-n ]; then shift MP_PROCS="$1" @@ -16,3 +48,8 @@ export MP_HOSTFILE yes "$hostname" | head -n ${MP_PROCS-1} >$MP_HOSTFILE poe "$@" +# +# Local Variables: +# mode: sh +# End: +# diff --git a/util/sunf95preproc-wrapper b/util/sunf95preproc-wrapper index c3e47601c8e24d424ef4917291e6344139288b23..4427021de089c21c43be4c13a98bfe7781ad6bd9 100755 --- a/util/sunf95preproc-wrapper +++ b/util/sunf95preproc-wrapper @@ -69,7 +69,11 @@ if [ "${FC+set}" != set ]; then fi FC=${FC-$F90C} # nagfor 5.3 up chokes on -EP flag -nag=`$FC -V 2>&1 | sed -n '/^NAG/s/NAG Fortran Compiler.*/NAG/;t print;b;: print; p'` +nag=`$FC -V 2>&1 | sed -n '/^NAG/s/NAG Fortran Compiler.*/NAG/ +t print +b +: print +p'` [ x"$nag" = xNAG ] || FCFLAGS=${FCFLAGS--EP} # append -fpp if necessary IFStr=`echo "$IFS" | sed -n '$!s/$/\\\\n/