|
fukasawa |
e60969 |
#! /bin/sh
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# Run 'autoreconf' to build 'configure', 'Makefile.in' and other configure
|
|
fukasawa |
e60969 |
# control files.
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# The first time this is run on a GIT checkout the only files that exist are
|
|
fukasawa |
e60969 |
# configure.ac and Makefile.am; all of the autotools support scripts are
|
|
fukasawa |
e60969 |
# missing. They are instantiated with autoreconf --force --install.
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# For regular ("tarball") distributions all the files should exist. We do not
|
|
fukasawa |
e60969 |
# want them to be updated *under any circumstances*. It should never be
|
|
fukasawa |
e60969 |
# necessary to run autogen.sh because ./configure --enable-maintainer-mode says
|
|
fukasawa |
e60969 |
# what to do if Makefile.am or configure.ac are changed.
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# It is *probably* OK to update the files on a GIT checkout, because they have
|
|
fukasawa |
e60969 |
# come from the local tools, but leave that to the user who is assumed to know
|
|
fukasawa |
e60969 |
# whether it is ok or required.
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# This script is intended to work without arguments, there are, however, hidden
|
|
fukasawa |
e60969 |
# arguments (a) for use while testing the script and (b) to fix up systems that
|
|
fukasawa |
e60969 |
# have been broken. If (b) is required the script prompts for the correct
|
|
fukasawa |
e60969 |
# options. For this reason the options are *NOT* documented in the help; this
|
|
fukasawa |
e60969 |
# is deliberate; UTSL.
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
clean=
|
|
fukasawa |
e60969 |
maintainer=
|
|
fukasawa |
e60969 |
while test $# -gt 0
|
|
fukasawa |
e60969 |
do
|
|
fukasawa |
e60969 |
case "$1" in
|
|
fukasawa |
e60969 |
--maintainer)
|
|
fukasawa |
e60969 |
maintainer=1;;
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
--clean)
|
|
fukasawa |
e60969 |
clean=1;;
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
*)
|
|
fukasawa |
e60969 |
exec >&2
|
|
fukasawa |
e60969 |
echo "$0: usage: ./autogen.sh"
|
|
fukasawa |
e60969 |
if test -d .git
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
echo " ./autogen.sh generates the configure script and"
|
|
fukasawa |
e60969 |
echo " Makefile.in, or refreshes them after changes to Makefile.am"
|
|
fukasawa |
e60969 |
echo " or configure.ac. You may prefer to just run autoreconf."
|
|
fukasawa |
e60969 |
elif test -z "$maintainer"
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
echo " DO NOT RUN THIS SCRIPT."
|
|
fukasawa |
e60969 |
echo " If you need to change Makefile.am or configure.ac then you"
|
|
fukasawa |
e60969 |
echo " also need to run ./configure --enable-maintainer-mode and"
|
|
fukasawa |
e60969 |
echo " use the appropriate autotools, *NOT* this script, to update"
|
|
fukasawa |
e60969 |
echo " everything, please check the documentation of autoreconf."
|
|
fukasawa |
e60969 |
echo " WARNING: libpng is intentionally generated with a known,"
|
|
fukasawa |
e60969 |
echo " fixed, set of autotools. It is known *NOT* to work with"
|
|
fukasawa |
e60969 |
echo " the collection of autotools distributed on highly reputable"
|
|
fukasawa |
e60969 |
echo " operating systems."
|
|
fukasawa |
e60969 |
echo " Remember: autotools is GNU software, you are expected to"
|
|
fukasawa |
e60969 |
echo " pay for support."
|
|
fukasawa |
e60969 |
else
|
|
fukasawa |
e60969 |
echo " You have run autogen.sh with --maintainer enabled and you"
|
|
fukasawa |
e60969 |
echo " are not using a GIT distribution, then you have given an"
|
|
fukasawa |
e60969 |
echo " unrecognized argument. This is not good. --maintainer"
|
|
fukasawa |
e60969 |
echo " switches off any assumptions that you might not know what"
|
|
fukasawa |
e60969 |
echo " you are doing."
|
|
fukasawa |
e60969 |
fi
|
|
fukasawa |
e60969 |
exit 1;;
|
|
fukasawa |
e60969 |
esac
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
shift
|
|
fukasawa |
e60969 |
done
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# First check for a set of the autotools files; if absent then this is assumed
|
|
fukasawa |
e60969 |
# to be a GIT version and the local autotools must be used. If present this
|
|
fukasawa |
e60969 |
# is a tarball distribution and the script should not be used. If partially
|
|
fukasawa |
e60969 |
# present bad things are happening.
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# The autotools generated files:
|
|
fukasawa |
e60969 |
libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in
|
|
fukasawa |
e60969 |
config.sub configure depcomp install-sh ltmain.sh missing\
|
|
fukasawa |
e60969 |
test-driver"
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# Files generated by versions of configue >2.68 or automake >1.13 (i.e. later
|
|
fukasawa |
e60969 |
# versions than those required by configure.ac):
|
|
fukasawa |
e60969 |
libpng_autotools_extra="compile config.h.in~"
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# These are separate because 'maintainer-clean' does not remove them.
|
|
fukasawa |
e60969 |
libpng_libtool_files="scripts/libtool.m4 scripts/ltoptions.m4\
|
|
fukasawa |
e60969 |
scripts/ltsugar.m4 scripts/ltversion.m4 scripts/lt~obsolete.m4"
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
libpng_autotools_dirs="autom4te.cache" # not required
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# The configure generated files:
|
|
fukasawa |
e60969 |
libpng_configure_files="Makefile config.h config.log config.status\
|
|
fukasawa |
e60969 |
libpng-config libpng.pc libtool stamp-h1"
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
libpng_configure_dirs=".deps"
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# We must remove the configure generated files as well as the autotools
|
|
fukasawa |
e60969 |
# generated files if autotools are regenerated because otherwise if configure
|
|
fukasawa |
e60969 |
# has been run without "--enable-maintainer-mode" make can do a partial update
|
|
fukasawa |
e60969 |
# of Makefile. These functions do the two bits of cleaning.
|
|
fukasawa |
e60969 |
clean_autotools(){
|
|
fukasawa |
e60969 |
rm -rf $libpng_autotools_files $libpng_libtool_files $libpng_autotools_dirs
|
|
fukasawa |
e60969 |
rm -rf $libpng_autotools_extra
|
|
fukasawa |
e60969 |
}
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
clean_configure(){
|
|
fukasawa |
e60969 |
rm -rf $libpng_configure_files $libpng_configure_dirs
|
|
fukasawa |
e60969 |
}
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# Clean: remove everything (this is to help with testing)
|
|
fukasawa |
e60969 |
if test -n "$clean"
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
clean_configure
|
|
fukasawa |
e60969 |
if test -n "$maintainer"
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
clean_autotools
|
|
fukasawa |
e60969 |
fi
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
exit 0
|
|
fukasawa |
e60969 |
fi
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# Validate the distribution.
|
|
fukasawa |
e60969 |
libpng_autotools_file_found=
|
|
fukasawa |
e60969 |
libpng_autotools_file_missing=
|
|
fukasawa |
e60969 |
for file in $libpng_autotools_files
|
|
fukasawa |
e60969 |
do
|
|
fukasawa |
e60969 |
if test -f "$file"
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
libpng_autotools_file_found=1
|
|
fukasawa |
e60969 |
else
|
|
fukasawa |
e60969 |
libpng_autotools_file_missing=1
|
|
fukasawa |
e60969 |
fi
|
|
fukasawa |
e60969 |
done
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# Presence of one of these does not *invalidate* missing, but absence
|
|
fukasawa |
e60969 |
# invalidates found.
|
|
fukasawa |
e60969 |
for file in $libpng_libtool_files
|
|
fukasawa |
e60969 |
do
|
|
fukasawa |
e60969 |
if test ! -f "$file"
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
libpng_autotools_file_missing=1
|
|
fukasawa |
e60969 |
fi
|
|
fukasawa |
e60969 |
done
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# The cache directory doesn't matter - it will be regenerated and does not exist
|
|
fukasawa |
e60969 |
# anyway in a tarball.
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# Either everything is missing or everything is there, the --maintainer option
|
|
fukasawa |
e60969 |
# just changes this so that the mode is set to generate all the files.
|
|
fukasawa |
e60969 |
mode=
|
|
fukasawa |
e60969 |
if test -z "$libpng_autotools_file_found" -o -n "$maintainer"
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
mode="autoreconf"
|
|
fukasawa |
e60969 |
else
|
|
fukasawa |
e60969 |
if test -n "$libpng_autotools_file_missing"
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
mode="broken"
|
|
fukasawa |
e60969 |
else
|
|
fukasawa |
e60969 |
mode="configure"
|
|
fukasawa |
e60969 |
fi
|
|
fukasawa |
e60969 |
fi
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# So:
|
|
fukasawa |
e60969 |
case "$mode" in
|
|
fukasawa |
e60969 |
autoreconf)
|
|
fukasawa |
e60969 |
# Clean in case configure files exist
|
|
fukasawa |
e60969 |
clean_configure
|
|
fukasawa |
e60969 |
clean_autotools
|
|
fukasawa |
e60969 |
# Everything must be initialized, so use --force
|
|
fukasawa |
e60969 |
if autoreconf --warnings=all --force --install
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
missing=
|
|
fukasawa |
e60969 |
for file in $libpng_autotools_files
|
|
fukasawa |
e60969 |
do
|
|
fukasawa |
e60969 |
test -f "$file" || missing=1
|
|
fukasawa |
e60969 |
done
|
|
fukasawa |
e60969 |
# ignore the cache directory
|
|
fukasawa |
e60969 |
test -z "$missing" || {
|
|
fukasawa |
e60969 |
exec >&2
|
|
fukasawa |
e60969 |
echo "autoreconf was run, but did not produce all the expected"
|
|
fukasawa |
e60969 |
echo "files. It is likely that your autotools installation is"
|
|
fukasawa |
e60969 |
echo "not compatible with that expected by libpng."
|
|
fukasawa |
e60969 |
exit 1
|
|
fukasawa |
e60969 |
}
|
|
fukasawa |
e60969 |
else
|
|
fukasawa |
e60969 |
exec >&2
|
|
fukasawa |
e60969 |
echo "autoreconf failed: your version of autotools is incompatible"
|
|
fukasawa |
e60969 |
echo "with this libpng version. Please use a distributed archive"
|
|
fukasawa |
e60969 |
echo "(which includes the autotools generated files) and run configure"
|
|
fukasawa |
e60969 |
echo "instead."
|
|
fukasawa |
e60969 |
exit 1
|
|
fukasawa |
e60969 |
fi;;
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
configure)
|
|
fukasawa |
e60969 |
if test -d .git
|
|
fukasawa |
e60969 |
then
|
|
fukasawa |
e60969 |
exec >&2
|
|
fukasawa |
e60969 |
echo "ERROR: running autoreconf on an initialized sytem"
|
|
fukasawa |
e60969 |
echo " This is not necessary; it is only necessary to remake the"
|
|
fukasawa |
e60969 |
echo " autotools generated files if Makefile.am or configure.ac"
|
|
fukasawa |
e60969 |
echo " change and make does the right thing with:"
|
|
fukasawa |
e60969 |
echo
|
|
fukasawa |
e60969 |
echo " ./configure --enable-maintainer-mode."
|
|
fukasawa |
e60969 |
echo
|
|
fukasawa |
e60969 |
echo " You can run autoreconf yourself if you don't like maintainer"
|
|
fukasawa |
e60969 |
echo " mode and you can also just run autoreconf -f -i to initialize"
|
|
fukasawa |
e60969 |
echo " everything in the first place; this script is only for"
|
|
fukasawa |
e60969 |
echo " compatibility with prior releases."
|
|
fukasawa |
e60969 |
exit 1
|
|
fukasawa |
e60969 |
else
|
|
fukasawa |
e60969 |
exec >&2
|
|
fukasawa |
e60969 |
echo "autogen.sh is intended only to generate 'configure' on systems"
|
|
fukasawa |
e60969 |
echo "that do not have it. You have a complete 'configure', if you"
|
|
fukasawa |
e60969 |
echo "need to change Makefile.am or configure.ac you also need to"
|
|
fukasawa |
e60969 |
echo "run configure with the --enable-maintainer-mode option."
|
|
fukasawa |
e60969 |
exit 1
|
|
fukasawa |
e60969 |
fi;;
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
broken)
|
|
fukasawa |
e60969 |
exec >&2
|
|
fukasawa |
e60969 |
echo "Your system has a partial set of autotools generated files."
|
|
fukasawa |
e60969 |
echo "autogen.sh is unable to proceed. The full set of files is"
|
|
fukasawa |
e60969 |
echo "contained in the libpng 'tar' distribution archive and you do"
|
|
fukasawa |
e60969 |
echo "not need to run autogen.sh if you use it."
|
|
fukasawa |
e60969 |
exit 1;;
|
|
fukasawa |
e60969 |
esac
|