2016-03-22 15:37:07 +08:00
|
|
|
#!/bin/sh
|
2015-01-31 21:32:42 +08:00
|
|
|
#
|
|
|
|
# Copyright by The HDF Group.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
2017-04-18 03:32:16 +08:00
|
|
|
# the COPYING file, which can be found at the root of the source code
|
|
|
|
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
|
|
|
|
# If you do not have access to either file, you may request a copy from
|
|
|
|
# help@hdfgroup.org.
|
2015-01-31 21:32:42 +08:00
|
|
|
#
|
|
|
|
|
|
|
|
# A script to reconfigure autotools for HDF5, and to recreate other
|
|
|
|
# generated files specifc to HDF5.
|
|
|
|
#
|
2015-02-19 15:57:53 +08:00
|
|
|
# IMPORTANT OS X NOTE
|
2015-02-07 12:24:31 +08:00
|
|
|
#
|
2015-02-19 15:57:53 +08:00
|
|
|
# If you are using OS X, you will probably not have the autotools
|
2015-11-13 19:24:43 +08:00
|
|
|
# installed, even if you have the Xcode command-line tools.
|
2015-02-19 15:57:53 +08:00
|
|
|
#
|
|
|
|
# The easiest way to fix this is to install everything via Homebrew:
|
2015-02-07 12:24:31 +08:00
|
|
|
#
|
|
|
|
# http://brew.sh/
|
|
|
|
#
|
2015-02-19 15:57:53 +08:00
|
|
|
# After you install the base packages, install autoconf, automake,
|
2015-11-13 19:24:43 +08:00
|
|
|
# and libtool.
|
2015-02-07 12:24:31 +08:00
|
|
|
#
|
|
|
|
# brew install autoconf
|
|
|
|
# brew install automake
|
|
|
|
# brew install libtool
|
|
|
|
#
|
|
|
|
# This only takes a few minutes. Note that libtool and libtoolize will
|
|
|
|
# be glibtool and glibtoolize so as not to conflict with Apple's non-gnu
|
|
|
|
# tools. This autogen.sh script handles this for you.
|
|
|
|
#
|
2015-02-19 15:57:53 +08:00
|
|
|
# END IMPORTANT OS X NOTE
|
2015-02-07 12:24:31 +08:00
|
|
|
#
|
2015-01-31 21:32:42 +08:00
|
|
|
# If you want to use a particular version of the autotools, the paths
|
|
|
|
# to each tool can be overridden using the following environment
|
|
|
|
# variables:
|
|
|
|
#
|
|
|
|
# HDF5_ACLOCAL
|
|
|
|
# HDF5_AUTOHEADER
|
|
|
|
# HDF5_AUTOMAKE
|
|
|
|
# HDF5_AUTOCONF
|
|
|
|
# HDF5_LIBTOOL
|
|
|
|
# HDF5_M4
|
|
|
|
#
|
|
|
|
# Note that aclocal will attempt to include libtool's share/aclocal
|
|
|
|
# directory.
|
|
|
|
#
|
2015-02-06 10:39:36 +08:00
|
|
|
# This script takes two potential options:
|
2015-01-31 21:32:42 +08:00
|
|
|
#
|
2015-09-26 07:32:57 +08:00
|
|
|
# -p
|
2015-01-31 21:32:42 +08:00
|
|
|
#
|
|
|
|
# When this is selected, the autotools versions are set to the paths
|
|
|
|
# and versions used by The HDF Group to produce the released versions
|
2015-02-06 09:02:30 +08:00
|
|
|
# of the library.
|
2015-01-31 21:32:42 +08:00
|
|
|
#
|
2015-02-06 09:02:30 +08:00
|
|
|
# NOTE: This is probably temporary. Once we update our dev machines
|
|
|
|
# to have recent versions of the autotools this option will probably
|
|
|
|
# be removed.
|
2015-02-06 10:39:36 +08:00
|
|
|
#
|
2015-09-26 07:32:57 +08:00
|
|
|
# -v
|
2015-02-06 10:39:36 +08:00
|
|
|
#
|
|
|
|
# This emits some extra information, mainly tool versions.
|
2015-01-31 21:32:42 +08:00
|
|
|
|
2015-02-06 00:21:21 +08:00
|
|
|
echo
|
|
|
|
echo "**************************"
|
|
|
|
echo "* HDF5 autogen.sh script *"
|
|
|
|
echo "**************************"
|
|
|
|
echo
|
|
|
|
|
2015-02-06 09:02:30 +08:00
|
|
|
# Default is not production
|
2015-01-31 21:32:42 +08:00
|
|
|
production=false
|
|
|
|
|
2015-02-06 10:39:36 +08:00
|
|
|
# Default is not verbose output
|
|
|
|
verbose=false
|
|
|
|
|
|
|
|
optspec=":hpv-"
|
2015-01-31 21:32:42 +08:00
|
|
|
while getopts "$optspec" optchar; do
|
|
|
|
case "${optchar}" in
|
|
|
|
h)
|
2015-09-26 07:32:57 +08:00
|
|
|
echo "usage: $0 [OPTIONS]"
|
|
|
|
echo
|
|
|
|
echo " -h Print this help message."
|
2015-01-31 21:32:42 +08:00
|
|
|
echo
|
2015-09-29 03:04:04 +08:00
|
|
|
echo " -p Used by THG to use hard-codes autotools"
|
|
|
|
echo " paths on THG machines. Not for non-HDF-Group"
|
|
|
|
echo " users!"
|
2015-01-31 21:32:42 +08:00
|
|
|
echo
|
2015-09-26 07:32:57 +08:00
|
|
|
echo " -v Show more verbose output."
|
|
|
|
echo
|
|
|
|
echo " NOTE: Each tool can be set via an environment variable."
|
2015-01-31 21:32:42 +08:00
|
|
|
echo " These are documented inside this autogen.sh script."
|
|
|
|
echo
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
p)
|
2015-09-29 03:04:04 +08:00
|
|
|
echo "Setting THG production mode..."
|
2015-02-07 14:14:12 +08:00
|
|
|
echo
|
2015-01-31 21:32:42 +08:00
|
|
|
production=true
|
|
|
|
;;
|
2015-02-06 10:39:36 +08:00
|
|
|
v)
|
|
|
|
echo "Setting verbosity: high"
|
2015-02-07 14:14:12 +08:00
|
|
|
echo
|
2015-02-06 10:39:36 +08:00
|
|
|
verbose=true
|
|
|
|
;;
|
2015-01-31 21:32:42 +08:00
|
|
|
*)
|
2016-03-22 15:37:07 +08:00
|
|
|
if [ "$OPTERR" != 1 ] || case $optspec in :*) ;; *) false; esac; then
|
|
|
|
echo "ERROR: non-option argument: '-${OPTARG}'" >&2
|
|
|
|
echo "Quitting"
|
|
|
|
exit 1
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$production" = true ] ; then
|
|
|
|
|
|
|
|
# Production mode
|
|
|
|
#
|
2015-09-29 03:04:04 +08:00
|
|
|
# Hard-code canonical HDF Group tool locations.
|
2015-01-31 21:32:42 +08:00
|
|
|
|
2015-02-06 10:39:36 +08:00
|
|
|
# If paths to tools are not specified, assume they are
|
2015-09-29 03:04:04 +08:00
|
|
|
# located in /usr/hdf/bin/AUTOTOOLS and set paths accordingly.
|
2015-01-31 21:32:42 +08:00
|
|
|
if test -z ${HDF5_AUTOCONF}; then
|
2015-09-29 03:04:04 +08:00
|
|
|
HDF5_AUTOCONF=/usr/hdf/bin/AUTOTOOLS/autoconf
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_AUTOMAKE}; then
|
2015-09-29 03:04:04 +08:00
|
|
|
HDF5_AUTOMAKE=/usr/hdf/bin/AUTOTOOLS/automake
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_AUTOHEADER}; then
|
2015-09-29 03:04:04 +08:00
|
|
|
HDF5_AUTOHEADER=/usr/hdf/bin/AUTOTOOLS/autoheader
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_ACLOCAL}; then
|
2015-09-29 03:04:04 +08:00
|
|
|
HDF5_ACLOCAL=/usr/hdf/bin/AUTOTOOLS/aclocal
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_LIBTOOL}; then
|
2015-09-29 03:04:04 +08:00
|
|
|
HDF5_LIBTOOL=/usr/hdf/bin/AUTOTOOLS/libtool
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_M4}; then
|
2015-09-29 03:04:04 +08:00
|
|
|
HDF5_M4=/usr/hdf/bin/AUTOTOOLS/m4
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
# Not in production mode
|
|
|
|
#
|
|
|
|
# If paths to autotools are not specified, use whatever the system
|
2015-02-06 00:21:21 +08:00
|
|
|
# has installed as the default. We use 'which <tool>' to
|
|
|
|
# show exactly what's being used.
|
2015-01-31 21:32:42 +08:00
|
|
|
if test -z ${HDF5_AUTOCONF}; then
|
2015-02-06 00:21:21 +08:00
|
|
|
HDF5_AUTOCONF=$(which autoconf)
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_AUTOMAKE}; then
|
2015-02-06 00:21:21 +08:00
|
|
|
HDF5_AUTOMAKE=$(which automake)
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_AUTOHEADER}; then
|
2015-02-06 00:21:21 +08:00
|
|
|
HDF5_AUTOHEADER=$(which autoheader)
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_ACLOCAL}; then
|
2015-02-06 00:21:21 +08:00
|
|
|
HDF5_ACLOCAL=$(which aclocal)
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_LIBTOOL}; then
|
2015-02-07 12:24:31 +08:00
|
|
|
case "`uname`" in
|
|
|
|
Darwin*)
|
|
|
|
# libtool on OS-X is non-gnu
|
|
|
|
HDF5_LIBTOOL=$(which glibtool)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
HDF5_LIBTOOL=$(which libtool)
|
|
|
|
;;
|
|
|
|
esac
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
if test -z ${HDF5_M4}; then
|
2015-02-07 12:24:31 +08:00
|
|
|
HDF5_M4=$(which m4)
|
2015-01-31 21:32:42 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
fi # production
|
|
|
|
|
2015-02-06 00:21:21 +08:00
|
|
|
|
2015-01-31 21:32:42 +08:00
|
|
|
# Make sure that these versions of the autotools are in the path
|
|
|
|
AUTOCONF_DIR=`dirname ${HDF5_AUTOCONF}`
|
|
|
|
LIBTOOL_DIR=`dirname ${HDF5_LIBTOOL}`
|
|
|
|
M4_DIR=`dirname ${HDF5_M4}`
|
2015-11-13 19:24:43 +08:00
|
|
|
PATH=${AUTOCONF_DIR}:${LIBTOOL_DIR}:${M4_DIR}:$PATH
|
2015-01-31 21:32:42 +08:00
|
|
|
|
2015-02-06 00:21:21 +08:00
|
|
|
# Make libtoolize match the specified libtool
|
2015-02-07 12:24:31 +08:00
|
|
|
case "`uname`" in
|
|
|
|
Darwin*)
|
2015-02-22 16:07:00 +08:00
|
|
|
# On OS X, libtoolize could be named glibtoolize or
|
|
|
|
# libtoolize. Try the former first, then fall back
|
|
|
|
# to the latter if it's not found.
|
2015-02-06 02:31:21 +08:00
|
|
|
HDF5_LIBTOOLIZE="${LIBTOOL_DIR}/glibtoolize"
|
2015-02-22 16:07:00 +08:00
|
|
|
if [ ! -f $HDF5_LIBTOOLIZE ] ; then
|
|
|
|
HDF5_LIBTOOLIZE="${LIBTOOL_DIR}/libtoolize"
|
|
|
|
fi
|
2015-02-07 12:24:31 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
HDF5_LIBTOOLIZE="${LIBTOOL_DIR}/libtoolize"
|
|
|
|
;;
|
|
|
|
esac
|
2015-02-06 00:21:21 +08:00
|
|
|
|
2017-04-25 14:09:55 +08:00
|
|
|
# Run scripts that process source.
|
|
|
|
#
|
|
|
|
# These should be run before the autotools so that failures here block
|
|
|
|
# compilation.
|
|
|
|
|
|
|
|
# Run trace script
|
|
|
|
# The trace script adds H5TRACE macros to library source files. It should
|
|
|
|
# have no effect on files that don't have HDF5 API macros in them.
|
|
|
|
echo "Running trace script:"
|
|
|
|
bin/trace src/H5*.c || exit 1
|
|
|
|
echo
|
|
|
|
|
|
|
|
# Run make_err
|
|
|
|
# make_err automatically generates the H5E headers that create error message
|
|
|
|
# types for HDF5.
|
|
|
|
echo "Running error generation script:"
|
|
|
|
bin/make_err src/H5err.txt || exit 1
|
|
|
|
echo
|
|
|
|
|
|
|
|
# Run make_vers
|
|
|
|
# make_vers automatically generates the public headers that define the API version
|
|
|
|
# macros for HDF5.
|
|
|
|
echo "Running API version generation script:"
|
|
|
|
bin/make_vers src/H5vers.txt || exit 1
|
|
|
|
echo
|
|
|
|
|
|
|
|
# Run make_overflow
|
|
|
|
# make_overflow automatically generates macros for detecting overflows for type
|
|
|
|
# conversion.
|
|
|
|
echo "Running overflow macro generation script:"
|
|
|
|
bin/make_overflow src/H5overflow.txt || exit 1
|
|
|
|
echo
|
|
|
|
|
2015-01-31 21:32:42 +08:00
|
|
|
# Run autotools in order
|
2015-02-13 17:22:31 +08:00
|
|
|
#
|
|
|
|
# When available, we use the --force option to ensure all files are
|
|
|
|
# updated. This prevents the autotools from re-running to fix dependencies
|
|
|
|
# during the 'make' step, which can be a problem if environment variables
|
|
|
|
# were set on the command line during autogen invocation.
|
2015-02-06 00:21:21 +08:00
|
|
|
|
|
|
|
# Some versions of libtoolize will suggest that we add ACLOCAL_AMFLAGS
|
|
|
|
# = '-I m4'. This is already done in commence.am, which is included
|
|
|
|
# in Makefile.am. You can ignore this suggestion.
|
|
|
|
|
2015-02-13 17:22:31 +08:00
|
|
|
# LIBTOOLIZE
|
|
|
|
libtoolize_cmd="${HDF5_LIBTOOLIZE} --copy --force"
|
|
|
|
echo ${libtoolize_cmd}
|
2015-02-06 10:39:36 +08:00
|
|
|
if [ "$verbose" = true ] ; then
|
|
|
|
${HDF5_LIBTOOLIZE} --version
|
|
|
|
fi
|
2015-02-13 17:22:31 +08:00
|
|
|
${libtoolize_cmd} || exit 1
|
2015-02-06 00:21:21 +08:00
|
|
|
echo
|
|
|
|
echo "NOTE: You can ignore the warning about adding -I m4."
|
|
|
|
echo " We already do this in an included file."
|
|
|
|
echo
|
|
|
|
|
2015-02-13 17:22:31 +08:00
|
|
|
# ACLOCAL
|
2015-01-31 21:32:42 +08:00
|
|
|
if test -e "${LIBTOOL_DIR}/../share/aclocal" ; then
|
|
|
|
aclocal_include="-I ${LIBTOOL_DIR}/../share/aclocal"
|
|
|
|
fi
|
2015-09-16 23:57:37 +08:00
|
|
|
aclocal_cmd="${HDF5_ACLOCAL} --force -I m4 ${aclocal_include}"
|
2015-02-13 17:22:31 +08:00
|
|
|
echo ${aclocal_cmd}
|
2015-02-06 10:39:36 +08:00
|
|
|
if [ "$verbose" = true ] ; then
|
|
|
|
${HDF5_ACLOCAL} --version
|
|
|
|
fi
|
2015-02-13 17:22:31 +08:00
|
|
|
${aclocal_cmd} || exit 1
|
2015-02-06 00:21:21 +08:00
|
|
|
echo
|
2015-01-31 21:32:42 +08:00
|
|
|
|
2015-02-13 17:22:31 +08:00
|
|
|
# AUTOHEADER
|
|
|
|
autoheader_cmd="${HDF5_AUTOHEADER} --force"
|
|
|
|
echo ${autoheader_cmd}
|
2015-02-06 10:39:36 +08:00
|
|
|
if [ "$verbose" = true ] ; then
|
|
|
|
${HDF5_AUTOHEADER} --version
|
|
|
|
fi
|
2015-02-13 17:22:31 +08:00
|
|
|
${autoheader_cmd} || exit 1
|
2015-02-06 00:21:21 +08:00
|
|
|
echo
|
2015-01-31 21:32:42 +08:00
|
|
|
|
2015-02-13 17:22:31 +08:00
|
|
|
# AUTOMAKE
|
2015-09-19 05:52:48 +08:00
|
|
|
automake_cmd="${HDF5_AUTOMAKE} --copy --add-missing --force-missing"
|
2015-02-13 17:22:31 +08:00
|
|
|
echo ${automake_cmd}
|
2015-02-06 10:39:36 +08:00
|
|
|
if [ "$verbose" = true ] ; then
|
|
|
|
${HDF5_AUTOMAKE} --version
|
|
|
|
fi
|
2015-02-13 17:22:31 +08:00
|
|
|
${automake_cmd} || exit 1
|
2015-02-06 00:21:21 +08:00
|
|
|
echo
|
2015-01-31 21:32:42 +08:00
|
|
|
|
2015-02-13 17:22:31 +08:00
|
|
|
# AUTOCONF
|
|
|
|
autoconf_cmd="${HDF5_AUTOCONF} --force"
|
|
|
|
echo ${autoconf_cmd}
|
2015-02-06 10:39:36 +08:00
|
|
|
if [ "$verbose" = true ] ; then
|
|
|
|
${HDF5_AUTOCONF} --version
|
|
|
|
fi
|
2015-02-13 17:22:31 +08:00
|
|
|
${autoconf_cmd} || exit 1
|
2015-02-06 00:21:21 +08:00
|
|
|
echo
|
2015-01-31 21:32:42 +08:00
|
|
|
|
2017-04-25 14:09:55 +08:00
|
|
|
echo "*** SUCCESS ***"
|
2015-02-14 03:22:21 +08:00
|
|
|
|
2015-02-06 10:39:36 +08:00
|
|
|
echo
|
2015-01-31 21:32:42 +08:00
|
|
|
exit 0
|
|
|
|
|