2003-07-10 03:28:34 +08:00
|
|
|
#!/bin/sh
|
2004-12-29 22:26:20 +08:00
|
|
|
##
|
|
|
|
## 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.
|
|
|
|
##
|
2003-07-10 03:28:34 +08:00
|
|
|
# Build HDF5 library by doing configure, make, and tests.
|
|
|
|
# Usage: See USAGE()
|
|
|
|
# Programmer: Albert Cheng
|
|
|
|
# Creation date: Jul 9, 2003
|
|
|
|
|
|
|
|
# Some handy definitions
|
|
|
|
USAGE()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
Buildhdf5 builds the HDF5 library by running configure, make and make check.
|
|
|
|
It skips the configure part if one has been done already. In effect, one
|
|
|
|
can continue from a previous build.
|
|
|
|
|
|
|
|
Command Syntax
|
|
|
|
==============
|
2005-11-24 04:33:48 +08:00
|
|
|
buildhdf5 [-config] [-srcdir dir] config-arguments ...
|
2003-07-10 03:28:34 +08:00
|
|
|
-config: run configure only. [default to do build too]
|
2005-11-24 04:33:48 +08:00
|
|
|
-szlib: configure in the szlib option
|
2003-07-10 03:28:34 +08:00
|
|
|
-help: show this help page
|
|
|
|
-n: no execution, just show commands
|
|
|
|
-srcdir: use dir as the source directory
|
|
|
|
[Note: this is different from --srcdir
|
|
|
|
which will be passed to configure]
|
|
|
|
all other arguments are passed to configure
|
|
|
|
|
|
|
|
|
|
|
|
Configure in place or by srcdir
|
|
|
|
===============================
|
|
|
|
By default, the command looks for the configure command in
|
|
|
|
'.' and then '../hdf5'. When it finds it, it uses it to do
|
|
|
|
the configure part. In effect, if ./configure is found, it
|
|
|
|
does the build in place. If it finds ../hdf5/configure, it
|
|
|
|
does the --srcdir (that is separated source) build. Therefore,
|
|
|
|
if you have the following structure setup, you can run multiple
|
|
|
|
hosts building simultantously using a common source code.
|
2005-11-24 04:33:48 +08:00
|
|
|
hdf5_v1.7/hdf5 # holds the source
|
|
|
|
.../sunbox # for SunOS
|
|
|
|
.../linux # for Linux
|
|
|
|
.../linuxpp # for Linux parallel
|
2003-07-10 03:28:34 +08:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TIMESTAMP()
|
|
|
|
{
|
|
|
|
echo "=====" "`date`" "====="
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QUIT()
|
|
|
|
{
|
|
|
|
TIMESTAMP
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Do one step bracketed with time stamps
|
|
|
|
# The '< /dev/null' is needed to prevent some applications like MPI
|
|
|
|
# jobs blocked for reading when they read stdin unnecessary.
|
|
|
|
STEP()
|
|
|
|
{
|
|
|
|
banner="$1"
|
|
|
|
command="$2"
|
|
|
|
resultfile="$3"
|
|
|
|
|
|
|
|
echo "$banner"
|
|
|
|
(TIMESTAMP; nerror=0 ;
|
|
|
|
echo "eval $command"
|
|
|
|
eval $command || nerror=1 ;
|
|
|
|
TIMESTAMP; exit $nerror) < /dev/null >> "$resultfile" 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "error in '$banner'. buildhdf5 aborted."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-24 04:33:48 +08:00
|
|
|
# Try locate the SZLIB.
|
|
|
|
# This is a hack because there is no consistent szlib pathname.
|
|
|
|
LOCATE_SZLIB()
|
2003-07-10 03:28:34 +08:00
|
|
|
{
|
|
|
|
OS=`uname -s`
|
|
|
|
echo OS=$OS
|
|
|
|
case "$OS" in
|
|
|
|
HP-UX)
|
2005-11-24 04:33:48 +08:00
|
|
|
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/HPUX-11.00"
|
2003-07-10 03:28:34 +08:00
|
|
|
;;
|
|
|
|
IRIX)
|
2005-11-24 04:33:48 +08:00
|
|
|
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/IRIX64-6.5-32bit"
|
2003-07-10 03:28:34 +08:00
|
|
|
;;
|
|
|
|
IRIX64)
|
|
|
|
case "$CC" in
|
|
|
|
*-n32)
|
2005-11-24 04:33:48 +08:00
|
|
|
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/IRIX64-6.5-32bit"
|
2003-07-10 03:28:34 +08:00
|
|
|
;;
|
|
|
|
*)
|
2005-11-24 04:33:48 +08:00
|
|
|
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/IRIX64-6.5"
|
2003-07-10 03:28:34 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
Linux)
|
2005-11-24 04:33:48 +08:00
|
|
|
case `uname -m` in
|
|
|
|
i686)
|
|
|
|
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/Linux2.4"
|
2003-07-10 03:28:34 +08:00
|
|
|
;;
|
|
|
|
*)
|
2005-11-24 04:33:48 +08:00
|
|
|
# Don't know. Give a shot at standard places.
|
|
|
|
szlibpaths="/usr/ncsa /usr/sdt"
|
2003-07-10 03:28:34 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2005-11-24 04:33:48 +08:00
|
|
|
SunOS)
|
|
|
|
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/SunOS_5.8"
|
2003-07-10 03:28:34 +08:00
|
|
|
;;
|
|
|
|
*)
|
2005-11-24 04:33:48 +08:00
|
|
|
# Don't know. Give a shot at standard places.
|
|
|
|
szlibpaths="/usr/ncsa /usr/sdt"
|
2003-07-10 03:28:34 +08:00
|
|
|
;;
|
|
|
|
esac
|
2005-11-24 04:33:48 +08:00
|
|
|
echo szlibpaths=$szlibpaths
|
|
|
|
for x in $szlibpaths dummy; do
|
|
|
|
if [ $x != dummy -a -f $x/include/szlib.h -a -f $x/lib/libsz.a ]; then
|
|
|
|
WITH_SZLIB="--with-szlib=$x"
|
2003-07-10 03:28:34 +08:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2005-11-24 04:33:48 +08:00
|
|
|
echo WITH_SZLIB="$WITH_SZLIB"
|
2003-07-10 03:28:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Configure. Default to do --srcdir.
|
|
|
|
CONFIG()
|
|
|
|
{
|
2003-07-11 03:40:47 +08:00
|
|
|
CMD="$SRCDIR/configure $*"
|
2003-07-10 03:28:34 +08:00
|
|
|
echo $CMD
|
|
|
|
if [ "$NOEXEC" != 'noexec' ]; then
|
|
|
|
$CMD
|
|
|
|
else
|
|
|
|
true # set exit code as 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Main body
|
|
|
|
TIMESTAMP
|
|
|
|
trap QUIT 0
|
|
|
|
|
|
|
|
#
|
|
|
|
# setup
|
|
|
|
#
|
|
|
|
MAKE=${MAKE:-'gmake'}
|
|
|
|
export MAKE
|
|
|
|
CONFIGURE="CONFIG"
|
2005-11-24 04:33:48 +08:00
|
|
|
CONFIG_OP= # configure options
|
2003-07-10 03:28:34 +08:00
|
|
|
CONFIG_ONLY=no # default is configure and build
|
|
|
|
NOEXEC= # default to execute commands
|
|
|
|
SRCDIRLIST=". ../hdf5" # places to look for configure
|
|
|
|
nerror=0
|
|
|
|
|
|
|
|
# parse some options
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
-config)
|
|
|
|
# do configure only
|
|
|
|
CONFIG_ONLY=yes
|
|
|
|
;;
|
|
|
|
-help)
|
|
|
|
USAGE
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-n)
|
|
|
|
NOEXEC='noexec'
|
|
|
|
;;
|
|
|
|
-srcdir)
|
|
|
|
shift
|
|
|
|
SRCDIRLIST="$1"
|
|
|
|
;;
|
2005-11-24 04:33:48 +08:00
|
|
|
-szlib)
|
|
|
|
LOCATE_SZLIB
|
|
|
|
;;
|
2003-07-10 03:28:34 +08:00
|
|
|
*) # Quit parsing
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
# Figure out if srcdir is wished.
|
|
|
|
# Make sure we are at the library root level
|
|
|
|
# by checking couple typical files. Not bullet-proof.
|
|
|
|
for SRCDIR in $SRCDIRLIST dummy; do
|
|
|
|
if [ x-$SRCDIR = x-dummy ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
if [ -d $SRCDIR/src -a -d $SRCDIR/config -a -f $SRCDIR/configure ]
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ x-$SRCDIR = x-dummy ]; then
|
|
|
|
echo "Could not find the source dir or configure script. Abort."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2005-11-24 04:33:48 +08:00
|
|
|
# Setup Configure options
|
|
|
|
CONFIG_OP="$WITH_SZLIB"
|
|
|
|
|
2003-07-10 03:28:34 +08:00
|
|
|
# Configure
|
|
|
|
# no configure if already done.
|
|
|
|
if [ ! -f config.status ]; then
|
2005-11-24 04:33:48 +08:00
|
|
|
CONFIGURE="$CONFIGURE $CONFIG_OP $*"
|
|
|
|
STEP "Configure HDF5..." "$CONFIGURE" "#config"
|
2003-07-10 03:28:34 +08:00
|
|
|
else
|
|
|
|
STEP "Confiugre Skipped" "echo Confiugre Skipped" "#config"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ x-$CONFIG_ONLY = x-yes ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Compile
|
|
|
|
STEP "Make HDF5..." "$MAKE" "#make"
|
|
|
|
|
|
|
|
# Tests
|
|
|
|
STEP "Testing HDF5..." "$MAKE check" "#test"
|
|
|
|
|
|
|
|
# all done
|
|
|
|
echo "No Errors encountered"
|
|
|
|
TIMESTAMP
|