diff --git a/autogen.sh b/autogen.sh index 306db436c5..e92f83a71e 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,100 +2,91 @@ # # Run this before configure # -# This file blatantly ripped off from subversion. -# -# Note: this dependency on Perl is fine: only developers use autogen.sh -# and we can state that dev people need Perl on their machine - -rm -f autogen.err -automake --version | perl -ne 'if (/\(GNU automake\) (([0-9]+).([0-9]+))/) {print; if ($2 < 1 || ($2 == 1 && $3 < 4)) {exit 1;}}' - -if [ $? -ne 0 ]; then - echo "Error: you need automake 1.4 or later. Please upgrade." +if [ ! -f "autogen.sh" ]; then + echo "$0: This script must be run in the top-level directory" exit 1 fi -if test ! -d `aclocal --print-ac-dir 2>> autogen.err`; then - echo "Bad aclocal (automake) installation" - exit 1 -fi - -# Update the m4 macros -autoreconf -fvi +rm -f autogen.err -# Produce aclocal.m4, so autoconf gets the automake macros it needs -# -case `uname` in - CYGWIN*) - include_dir='-I m4' # Needed for Cygwin only. - ;; - Darwin) - [ "$LIBTOOLIZE" = "" ] && LIBTOOLIZE=glibtoolize - ;; -esac +run_configure=true +while [ -n "$1" ] +do + case "$1" in + --help|-help|-h) + echo "Usage: $0 [--no-configure] [--clean]" + exit 0 + ;; + --no-configure) + run_configure=false + shift + ;; + --clean) + # Start from a clean state. + rm -rf config.cache autom4te*.cache + shift + ;; + *) + break 2 + esac +done - ${LIBTOOLIZE:=libtoolize} --force --copy || { - echo "error: libtoolize failed" +# For version x.y>1.4, x should not be 0, and y should be [4-9] or more than one digit. +automake --version >/dev/null && + automake --version | test "`sed -En '/^automake \(GNU automake\) [^0]\.([4-9]|[1-9][0-9])/p'`" +if [ $? -ne 0 ]; then + echo "$0: Error: you need automake 1.4 or later. Please upgrade." exit 1 -} - -echo "Creating aclocal.m4: aclocal $include_dir $ACLOCAL_FLAGS" - -aclocal $include_dir $ACLOCAL_FLAGS 2>> autogen.err - -# Produce all the `GNUmakefile.in's and create neat missing things -# like `install-sh', etc. -# -echo "automake --add-missing --copy --foreign" - -automake --add-missing --copy --foreign 2>> autogen.err || { - echo "" - echo "* * * warning: possible errors while running automake - check autogen.err" - echo "" -} +fi # If there's a config.cache file, we may need to delete it. # If we have an existing configure script, save a copy for comparison. +# (Based on Subversion's autogen.sh, see also the deletion code below.) +OLD_CONFIGURE="${TMPDIR:-/tmp}/configure.$$.tmp" if [ -f config.cache ] && [ -f configure ]; then - cp configure configure.$$.tmp + cp configure "$OLD_CONFIGURE" fi -# Produce ./configure -# -echo "Creating configure..." +echo "$0: Creating 'configure'..." -autoconf 2>> autogen.err || { +# Regenerate configuration scripts with the latest autotools updates. +autoreconf -fvi 2>autogen.err +status=$? +if [ $status -ne 0 ]; then echo "" - echo "* * * warning: possible errors while running automake - check autogen.err" + echo "$0: * * * Warning: autoreconf returned bad status ($status) - check autogen.err" echo "" - grep 'Undefined AX_ macro' autogen.err && exit 1 -} + exit 1 +fi -run_configure=true -for arg in $*; do - case $arg in - --no-configure) - run_configure=false - ;; - *) - ;; - esac -done +# If we have a config.cache file, toss it if the configure script has +# changed, or if we just built it for the first time. +if [ -f config.cache ]; then + ( + [ -f "$OLD_CONFIGURE" ] && cmp configure "$OLD_CONFIGURE" > /dev/null 2>&1 + ) || ( + echo "$0: Tossing config.cache, since 'configure' has changed." + rm config.cache + ) + rm -f "$OLD_CONFIGURE" +fi if $run_configure; then mkdir -p build cd build + echo + echo "$0: Running 'configure'..." ../configure --enable-maintainer-mode "$@" status=$? if [ $status -eq 0 ]; then echo - echo "Now type 'make' to compile link-grammar (in the 'build' directory)." + echo "$0: Now type 'make' to compile link-grammar (in the 'build' directory)." else echo - echo "\"configure\" returned a bad status ($status)." + echo "$0: 'configure' returned a bad status ($status)." fi else echo - echo "Now run 'configure' and 'make' to compile link-grammar." + echo "$0: Now run 'configure' and 'make' to compile link-grammar." fi diff --git a/mingw/README-MinGW64.md b/mingw/README-MinGW64.md index c99512e386..a4612123e6 100644 --- a/mingw/README-MinGW64.md +++ b/mingw/README-MinGW64.md @@ -63,7 +63,7 @@ Then build and install link-grammar with mkdir build cd build - ../configure + sh ../configure make make install