From ee4d96a296a0d50b65685ac99cb6efb63a289d4c Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Tue, 5 Jun 2012 14:42:56 +0300 Subject: [PATCH] Check for glibtoolize, allow overrides from env --- mk/std-autogen.sh | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/mk/std-autogen.sh b/mk/std-autogen.sh index d823952..93ba852 100755 --- a/mk/std-autogen.sh +++ b/mk/std-autogen.sh @@ -6,6 +6,8 @@ # - it installs ltmain.sh, if LT_INIT or *LIBTOOL macro is used # +set -e + USUAL_DIR="$1" test -n "${USUAL_DIR}" || USUAL_DIR="." @@ -14,27 +16,41 @@ test -f "${USUAL_DIR}/m4/usual.m4" || { exit 1 } +# default programs +ACLOCAL=${ACLOCAL:-aclocal} +AUTOCONF=${AUTOCONF:-autoconf} +AUTOHEADER=${AUTOHEADER:-autoheader} + +# detect first glibtoolize then libtoolize +if test "x$LIBTOOLIZE" = "x"; then + LIBTOOLIZE=glibtoolize + which $LIBTOOLIZE >/dev/null 2>&1 \ + || LIBTOOLIZE=libtoolize +fi + # # Workarounds for libtoolize randomness - it does not update # the files if they exist, except it requires install-sh. # rm -f config.guess config.sub install-sh ltmain.sh libtool cp -p ${USUAL_DIR}/mk/install-sh . -if libtoolize --help | grep "[-][-]install" > /dev/null; then - libtoolize -i -f -q -c +if ${LIBTOOLIZE} --help | grep "[-][-]install" > /dev/null; then + ${LIBTOOLIZE} -i -f -q -c else - libtoolize -c + ${LIBTOOLIZE} -c fi # drop ltmain.sh if libtool is not used -grep -E 'LT_INIT|LIBTOOL' configure.ac > /dev/null || rm -f ltmain.sh +grep -E 'LT_INIT|LIBTOOL' configure.ac > /dev/null \ + || rm -f ltmain.sh # Now generate configure & config.h -aclocal -I ${USUAL_DIR}/m4 +${ACLOCAL} -I ${USUAL_DIR}/m4 -grep AC_CONFIG_HEADER configure.ac > /dev/null && autoheader +grep AC_CONFIG_HEADER configure.ac > /dev/null \ + && ${AUTOHEADER} -autoconf +${AUTOCONF} # clean junk rm -rf autom4te.* aclocal* -- 2.39.5