|
Packit |
e9ba0d |
#!/bin/sh
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
set -e
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
[ ! -e .gitmodules ] || [ ! -e .git ] || {
|
|
Packit |
e9ba0d |
echo "autogen.sh: updating git submodules"
|
|
Packit |
e9ba0d |
git submodule init
|
|
Packit |
e9ba0d |
git submodule update
|
|
Packit |
e9ba0d |
}
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
case "$(uname)" in
|
|
Packit |
e9ba0d |
Darwin)
|
|
Packit |
e9ba0d |
LIBTOOLIZE=${LIBTOOLIZE:-glibtoolize}
|
|
Packit |
e9ba0d |
;;
|
|
Packit |
e9ba0d |
*)
|
|
Packit |
e9ba0d |
LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
|
|
Packit |
e9ba0d |
;;
|
|
Packit |
e9ba0d |
esac
|
|
Packit |
e9ba0d |
AUTORECONF=${AUTORECONF:-autoreconf}
|
|
Packit |
e9ba0d |
ACLOCAL=${ACLOCAL:-aclocal}
|
|
Packit |
e9ba0d |
AUTOCONF=${AUTOCONF:-autoconf}
|
|
Packit |
e9ba0d |
AUTOHEADER=${AUTOHEADER:-autoheader}
|
|
Packit |
e9ba0d |
AUTOMAKE=${AUTOMAKE:-automake}
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
# Check we have all tools installed
|
|
Packit |
e9ba0d |
check_command() {
|
|
Packit |
e9ba0d |
command -v "${1}" > /dev/null 2>&1 || {
|
|
Packit |
e9ba0d |
>&2 echo "autogen.sh: could not find \`$1'. \`$1' is required to run autogen.sh."
|
|
Packit |
e9ba0d |
exit 1
|
|
Packit |
e9ba0d |
}
|
|
Packit |
e9ba0d |
}
|
|
Packit |
e9ba0d |
check_command "$LIBTOOLIZE"
|
|
Packit |
e9ba0d |
check_command "$AUTORECONF"
|
|
Packit |
e9ba0d |
check_command "$ACLOCAL"
|
|
Packit |
e9ba0d |
check_command "$AUTOCONF"
|
|
Packit |
e9ba0d |
check_command "$AUTOHEADER"
|
|
Packit |
e9ba0d |
check_command "$AUTOMAKE"
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
# Absence of pkg-config or misconfiguration can make some odd error
|
|
Packit |
e9ba0d |
# messages, we check if it is installed correctly. See:
|
|
Packit |
e9ba0d |
# https://blogs.oracle.com/mandy/entry/autoconf_weirdness
|
|
Packit |
e9ba0d |
#
|
|
Packit |
e9ba0d |
# We cannot just check for pkg-config command, we need to check for
|
|
Packit |
e9ba0d |
# PKG_* macros. The pkg-config command can be defined in ./configure,
|
|
Packit |
e9ba0d |
# we cannot tell anything when not present.
|
|
Packit |
e9ba0d |
check_pkg_config() {
|
|
Packit |
e9ba0d |
grep -q '^AC_DEFUN.*PKG_CHECK_MODULES' aclocal.m4 || {
|
|
Packit |
e9ba0d |
cat <<EOF >&2
|
|
Packit |
e9ba0d |
autogen.sh: could not find PKG_CHECK_MODULES macro.
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
Either pkg-config is not installed on your system or
|
|
Packit |
e9ba0d |
\`pkg.m4' is missing or not found by aclocal.
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
If \`pkg.m4' is installed at an unusual location, re-run
|
|
Packit |
e9ba0d |
\`autogen.sh' by setting \`ACLOCAL_FLAGS':
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
ACLOCAL_FLAGS="-I <prefix>/share/aclocal" ./autogen.sh
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
EOF
|
|
Packit |
e9ba0d |
exit 1
|
|
Packit |
e9ba0d |
}
|
|
Packit |
e9ba0d |
}
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
echo "autogen.sh: start libtoolize to get ltmain.sh"
|
|
Packit |
e9ba0d |
${LIBTOOLIZE} --copy --force
|
|
Packit |
e9ba0d |
echo "autogen.sh: reconfigure with autoreconf"
|
|
Packit |
e9ba0d |
${AUTORECONF} -vif -I m4 || {
|
|
Packit |
e9ba0d |
echo "autogen.sh: autoreconf has failed ($?), let's do it manually"
|
|
Packit |
e9ba0d |
for dir in $PWD *; do
|
|
Packit |
e9ba0d |
[ -d "$dir" ] || continue
|
|
Packit |
e9ba0d |
[ -f "$dir"/configure.ac ] || [ -f "$dir"/configure.in ] || continue
|
|
Packit |
e9ba0d |
echo "autogen.sh: configure `basename $dir`"
|
|
Packit |
e9ba0d |
(cd "$dir" && ${ACLOCAL} -I m4 ${ACLOCAL_FLAGS})
|
|
Packit |
e9ba0d |
if [ x"$dir" = x"$PWD" ]; then
|
|
Packit |
e9ba0d |
(cd "$dir" && check_pkg_config)
|
|
Packit |
e9ba0d |
fi
|
|
Packit |
e9ba0d |
(cd "$dir" && ${LIBTOOLIZE} --automake --copy --force)
|
|
Packit |
e9ba0d |
(cd "$dir" && ${ACLOCAL} -I m4 ${ACLOCAL_FLAGS})
|
|
Packit |
e9ba0d |
(cd "$dir" && ${AUTOCONF} --force)
|
|
Packit |
e9ba0d |
(cd "$dir" && ${AUTOHEADER})
|
|
Packit |
e9ba0d |
(cd "$dir" && ${AUTOMAKE} --add-missing --copy --force-missing)
|
|
Packit |
e9ba0d |
done
|
|
Packit |
e9ba0d |
}
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
echo "autogen.sh: for the next step, run ./configure"
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
exit 0
|