From 44deb0bdec073dcd3c5041b0781e74b0ece759f6 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 9 Apr 2003 19:48:46 -0500 Subject: [PATCH] [svn-r6622] Purpose: Addition Description: Added "h5fc" utility. This is the same as the "h5cc" utility but for Fortran. It only handles static libraries since that's the only library we build for Fortran. Note! I've tested the code on the normal platforms but I haven't tested the utility itself. Platforms tested: Arabica (Fortran) Modi4 (Fortran & Parallel) Burrwhite (Fortran & C++ Misc. update: --- MANIFEST | 3 +- fortran/configure | 59 +----------- fortran/configure.in | 22 +---- fortran/src/Makefile.in | 16 +++- fortran/src/h5fc.in | 203 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 225 insertions(+), 78 deletions(-) create mode 100755 fortran/src/h5fc.in diff --git a/MANIFEST b/MANIFEST index 7a300b6830..3e56bee661 100644 --- a/MANIFEST +++ b/MANIFEST @@ -623,6 +623,7 @@ ./fortran/src/HDF5mpio.f90 ./fortran/src/Makefile.in ./fortran/src/README +./fortran/src/h5fc.in ./fortran/test/Dependencies ./fortran/test/Makefile.in @@ -1166,13 +1167,13 @@ ./tools/misc/Dependencies ./tools/misc/Makefile.in +./tools/misc/h5cc.in ./tools/misc/h5createU8.c ./tools/misc/h5debug.c ./tools/misc/h5import.c ./tools/misc/h5redeploy.in ./tools/misc/h5repart.c ./tools/misc/pdb2hdf.c -./tools/misc/h5cc.in ./tools/testfiles/tall-1.ddl ./tools/testfiles/tall-2.ddl diff --git a/fortran/configure b/fortran/configure index d1994cdea3..9da24ce1b0 100755 --- a/fortran/configure +++ b/fortran/configure @@ -8543,60 +8543,6 @@ rm -rf conftest* fi ;; - X-mpich) - echo "$as_me:$LINENO: result: mpich" >&5 -echo "${ECHO_T}mpich" >&6 - { echo "$as_me:$LINENO: WARNING: *** Why aren't you using an mpicc compiler? ***" >&5 -echo "$as_me: WARNING: *** Why aren't you using an mpicc compiler? ***" >&2;} - - PARALLEL=mpich - - -ac_ext=f90 -ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' -ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS conftest.$ac_ext $LDFLAGS $LIBS 1>&5' -cross_compiling=$ac_cv_prog_f9x_cross - - -test -d conftestdir || mkdir conftestdir -cd conftestdir -rm -rf * - -cat >conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - : - -else - LDFLAGS="$saved_LDFLAGS" - { { echo "$as_me:$LINENO: error: no mpich library" >&5 -echo "$as_me: error: no mpich library" >&2;} - { (exit 1); exit 1; }; } -fi -cd .. -rm -rf conftest* - - ;; - *) echo "$as_me:$LINENO: result: error" >&5 echo "${ECHO_T}error" >&6 @@ -8897,7 +8843,7 @@ fi saved_no_create=$no_create no_create=yes -ac_config_files="$ac_config_files config/depend1 config/depend2 config/depend3 config/depend4 config/dependN config/commence config/conclude Makefile src/H5fortran_types.f90 src/Makefile test/Makefile $PARALLEL_MAKE examples/Makefile" +ac_config_files="$ac_config_files config/depend1 config/depend2 config/depend3 config/depend4 config/dependN config/commence config/conclude Makefile src/h5fc src/H5fortran_types.f90 src/Makefile test/Makefile $PARALLEL_MAKE examples/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -9388,6 +9334,7 @@ do "config/commence" ) CONFIG_FILES="$CONFIG_FILES config/commence" ;; "config/conclude" ) CONFIG_FILES="$CONFIG_FILES config/conclude" ;; "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/h5fc" ) CONFIG_FILES="$CONFIG_FILES src/h5fc" ;; "src/H5fortran_types.f90" ) CONFIG_FILES="$CONFIG_FILES src/H5fortran_types.f90" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; @@ -10056,3 +10003,5 @@ no_create=$saved_no_create touch ./config/stamp2 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +chmod 755 src/h5fc diff --git a/fortran/configure.in b/fortran/configure.in index e335fe1345..423cef7a8b 100644 --- a/fortran/configure.in +++ b/fortran/configure.in @@ -691,25 +691,6 @@ case "X-$enable_parallel" in fi ;; - X-mpich) - dnl For normal mpich installation the compiler, mpicc, should know - dnl where the MPI and MPI-IO header files are located and know which - dnl extra libraries need to be linked and will supply appropriate - dnl flags to the underlying compiler. - AC_MSG_RESULT(mpich) - AC_MSG_WARN(*** Why aren't you using an mpicc compiler? ***) - - dnl Apparently mpicc isn't installed correctly so configure must - dnl search for the header files and libraries. Actually we only - dnl have to search for the libraries in order to get the onto the - dnl link line, the user will have already told us about the - dnl locations. Fail if something is missing. - PARALLEL=mpich - AC_CHECK_FLIB(fmpich, [ - include 'mpif.h' - call mpi_file_open( ierr )],, AC_MSG_ERROR(no mpich library)) - ;; - *) AC_MSG_RESULT(error) AC_MSG_ERROR(\'$enable_parallel\' is not a valid parallel search type) @@ -920,6 +901,7 @@ AC_CONFIG_FILES([config/depend1 config/commence config/conclude Makefile + src/h5fc src/H5fortran_types.f90 src/Makefile test/Makefile @@ -933,3 +915,5 @@ touch ./config/stamp2 dnl Finally the makefiles test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +chmod 755 src/h5fc diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 99b9c8c690..4d9ac8ddb0 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -1,8 +1,17 @@ ## -## HDF5 Forgran Library Makefile(.in) +## HDF5 Fortran Library Makefile(.in) ## -## Copyright (C) 2000 National Center for Supercomputing Applications. -## All rights reserved. +## Copyright by the Board of Trustees of the University of Illinois. +## All rights reserved. +## +## This file is part of HDF5. The full HDF5 copyright notice, including +## terms governing use, modification, and redistribution, is contained in +## the files COPYING and Copyright.html. COPYING can be found at the root +## of the source code distribution tree; Copyright.html can be found at the +## root level of an installed copy of the electronic HDF5 document set and +## is linked from the top-level documents page. It can also be found at +## http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have +## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. ## top_srcdir=@top_srcdir@/.. top_builddir=../.. @@ -23,6 +32,7 @@ DISTCLEAN=H5fortran_types.f90 ## Public header files (to be installed)... PUB_HDR=H5pubconf_fortran.h +PUB_PROGS=h5fc ## Source and object files for the library ADD_PARALLEL_FILES=@ADD_PARALLEL_FILES@ diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in new file mode 100755 index 0000000000..cedc0b5278 --- /dev/null +++ b/fortran/src/h5fc.in @@ -0,0 +1,203 @@ +#! /bin/sh +## +## Copyright by the Board of Trustees of the University of Illinois. +## All rights reserved. +## +## This file is part of HDF5. The full HDF5 copyright notice, including +## terms governing use, modification, and redistribution, is contained in +## the files COPYING and Copyright.html. COPYING can be found at the root +## of the source code distribution tree; Copyright.html can be found at the +## root level of an installed copy of the electronic HDF5 document set and +## is linked from the top-level documents page. It can also be found at +## http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have +## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. +## + +############################################################################ +## ## +## Things You May Have to Modify: ## +## ## +## If the following paths don't point to the place were HDF5 is installed ## +## on your system (i.e., you received a binary distribution or moved the ## +## files from the originally installed directory to another directory) ## +## then modify them accordingly to represent the new paths. ## +## ## +############################################################################ +prefix="@prefix@" +exec_prefix="@exec_prefix@" +libdir="@libdir@" +includedir="@includedir@" + +############################################################################ +## ## +## You shouldn't have to modify anything below this line. ## +## ## +############################################################################ + +host_os="@host_os@" + +prog_name="`basename $0`" + +allargs="" +compile_args="" +link_args="" +link_objs="" + +do_link="yes" +do_compile="no" +dash_o="no" +dash_c="no" +get_output_file="no" + +SHOW="eval" +FCBASE="@FC@" +FLINKERBASE="@FC@" +LDFLAGS="@LDFLAGS@" +LIBS="@LIBS@" + +FC="${HDF5_FC:-$FCBASE}" +FLINKER="${HDF5_FLINKER:-$FLINKERBASE}" + +usage() { + # A wonderfully informative "usage" message. + echo "usage: $prog_name [OPTIONS] " + echo " OPTIONS:" + echo " -help This help message." + echo " -echo Show all the shell commands executed" + echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" + echo " subdirectories [default: $prefix]" + echo " -show Show the commands without executing them" + echo " " + echo " - the normal compile line options for your compiler." + echo " $prog_name uses the same compiler you used to compile" + echo " HDF5. Check with your compiler's man pages for more" + echo " information on which options are needed." + echo " " + echo " You can override the compiler and linker to compile your program by" + echo " setting the following environment variables accordingly:" + echo " " + echo " HDF5_FC - use a different Fortran 90 or 95 compiler" + echo " HDF5_FLINKER - use a different linker" + echo " " + exit 1 +} + +if test "$#" = "0"; then + # No parameters specified, issue usage statement and exit. + usage +fi + +for arg in $@ ; do + if test "x$get_output_file" = "xyes"; then + link_args="$link_args $arg" + output_file="$arg" + get_output_file="no" + continue + fi + + case "$arg" in + -c) + allargs="$allargs $arg" + compile_args="$compile_args $arg" + + if test "x$do_link" = "xyes" -a -n "$output_file"; then + compile_args="$compile_args -o $outputfile" + fi + + do_link="no" + dash_c="yes" + ;; + -o) + allargs="$allargs $arg" + dash_o="yes" + + if test "x$dash_c" = "xyes"; then + compile_args="$compile_args $arg" + else + link_args="$link_args $arg" + do_link="yes" + get_output_file="yes" + fi + ;; + -E|-M) + allargs="$allargs $arg" + compile_args="$compile_args $arg" + dash_c="yes" + dash_o="no" + ;; + -l*) + link_args="$link_args $arg" + allargs="$allargs $arg" + ;; + -prefix=*) + prefix="`expr "$arg" : '-prefix=\(.*\)'`" + ;; + -echo) + set -x + ;; + -show) + SHOW="echo" + ;; + -help) + usage + ;; + *\"*) + qarg="'"$arg"'" + allargs="$allargs $qarg" + ;; + *\'*) + qarg='\"'"$arg"'\"' + allargs="$allargs $qarg" + ;; + *) + allargs="$allargs $qarg" + + if test -s "$arg"; then + ext=`expr "$arg" : '.*\(\..*\)'` + + if test "x$ext" = "x.c"; then + do_compile="yes" + compile_args="$compile_args $arg" + fname=`basename $arg .c` + link_objs="$link_objs $fname.o" + elif test "x$ext" = "x.o"; then + if test "x$dash_c" = "xyes"; then + compile_args="$compile_args $arg" + else + do_link="yes" + link_objs="$link_objs $arg" + fi + else + compile_args="$compile_args $arg" + link_args="$link_args $arg" + fi + else + compile_args="$compile_args $arg" + link_args="$link_args $arg" + fi + ;; + esac +done + +if test "x$do_compile" = "xyes"; then + if test "x$dash_c" != "xyes"; then + compile_args="-c $compile_args" + fi + + $SHOW $FC $FFLAGS $compile_args + status=$? + + if test "$status" != "0"; then + exit $status + fi +fi + +if test "x$do_link" = "xyes"; then + link_args="$link_args ${libdir}/libhdf5_fortran.a ${libdir}/libhdf5.a" + + link_args="$link_args $LIBS" + $SHOW $FLINKER $LDFLAGS $link_objs $link_args + status=$? +fi + +exit $status