From e0f28b45917137a73dbd77b8ee2a42aaed8a74c8 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 15:58:08 +0300 Subject: [PATCH 01/17] autogen.sh: Remove comments that will not be relevant --- autogen.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/autogen.sh b/autogen.sh index 306db436c..2191664be 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,10 +2,6 @@ # # 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 From 3b93bcc0e43cb682cc0e85aa9bd2253b98382736 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 20:32:32 +0300 Subject: [PATCH 02/17] autogen.sh: Replace perl by sed --- autogen.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 2191664be..e14a3bef3 100755 --- a/autogen.sh +++ b/autogen.sh @@ -6,7 +6,9 @@ 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;}}' - +# 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 "Error: you need automake 1.4 or later. Please upgrade." exit 1 From 6baa9f021d5f44b694d8f8f3d212b778ce310ced Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 16:30:11 +0300 Subject: [PATCH 03/17] autogen.sh: Remove aclocal It is handled by autoreconf. The autoconf manual says: "aclocal is expected to disappear. This feature really should not be offered by Automake." And then it says "... never call aclocal yourself." Also remove the special Cygwin setting of '-I m4'. --- autogen.sh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/autogen.sh b/autogen.sh index e14a3bef3..6dfbf9085 100755 --- a/autogen.sh +++ b/autogen.sh @@ -5,7 +5,6 @@ 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;}}' # 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'`" @@ -14,20 +13,10 @@ if [ $? -ne 0 ]; then 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 -# 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 ;; @@ -38,10 +27,6 @@ esac 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. # From f54669ce0eb3a37c66ae473fd9147bb4ef8b09f6 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 16:44:15 +0300 Subject: [PATCH 04/17] autogen.sh: Remove libtoolize On MacOS, autoreconf is supposed to call glibtoolize if exists (to be validated later). --- autogen.sh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/autogen.sh b/autogen.sh index 6dfbf9085..f95be77e2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -16,17 +16,6 @@ fi # Update the m4 macros autoreconf -fvi -case `uname` in - Darwin) - [ "$LIBTOOLIZE" = "" ] && LIBTOOLIZE=glibtoolize - ;; -esac - - ${LIBTOOLIZE:=libtoolize} --force --copy || { - echo "error: libtoolize failed" - exit 1 -} - # Produce all the `GNUmakefile.in's and create neat missing things # like `install-sh', etc. # From 8a0fa56e1afd24c63c4a29a630b55f56c5556c33 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 16:45:47 +0300 Subject: [PATCH 05/17] autogen.sh: Remove automake It is invoked by autoreconf. --- autogen.sh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/autogen.sh b/autogen.sh index f95be77e2..1d34fe8f9 100755 --- a/autogen.sh +++ b/autogen.sh @@ -16,17 +16,6 @@ fi # Update the m4 macros autoreconf -fvi -# 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 "" -} - # 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. if [ -f config.cache ] && [ -f configure ]; then From 6e3c1f79387190777890310cb5c9f2d503140e1f Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 17:49:22 +0300 Subject: [PATCH 06/17] autogen.sh: Remove autoconf It is invoked by autoreconf, --- autogen.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/autogen.sh b/autogen.sh index 1d34fe8f9..26016642a 100755 --- a/autogen.sh +++ b/autogen.sh @@ -26,13 +26,6 @@ fi # echo "Creating configure..." -autoconf 2>> autogen.err || { - echo "" - echo "* * * warning: possible errors while running automake - check autogen.err" - echo "" - grep 'Undefined AX_ macro' autogen.err && exit 1 -} - run_configure=true for arg in $*; do case $arg in From be81fd5ec0b1c716f80bed797ba57ca00b03f830 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 17:02:06 +0300 Subject: [PATCH 07/17] autogen.sh: Move things to be done before overwriting configure --- autogen.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/autogen.sh b/autogen.sh index 26016642a..b73b4b34b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,19 +13,17 @@ if [ $? -ne 0 ]; then exit 1 fi -# Update the m4 macros -autoreconf -fvi - # 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. if [ -f config.cache ] && [ -f configure ]; then cp configure configure.$$.tmp fi -# Produce ./configure -# echo "Creating configure..." +# Update the m4 macros +autoreconf -fvi + run_configure=true for arg in $*; do case $arg in From f99aa42d194a3257eee7be2f2e6825457e160b40 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 16:58:33 +0300 Subject: [PATCH 08/17] autogen.sh: Check autoreconf exit status --- autogen.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index b73b4b34b..f3d1a776d 100755 --- a/autogen.sh +++ b/autogen.sh @@ -22,7 +22,14 @@ fi echo "Creating configure..." # Update the m4 macros -autoreconf -fvi +autoreconf -fvi 2>autogen.err +status=$? +if [ $status -ne 0 ]; then + echo "" + echo "* * * Warning: autoreconf returned bad status ($status) - check autogen.err" + echo "" + exit 1 +fi run_configure=true for arg in $*; do From d5dfa2572fb6ba6c23ee8a6773911652aa5336a9 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 16:59:08 +0300 Subject: [PATCH 09/17] autogen.sh: Update the comment on autoreconf --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index f3d1a776d..74bb795ab 100755 --- a/autogen.sh +++ b/autogen.sh @@ -21,7 +21,7 @@ fi echo "Creating configure..." -# Update the m4 macros +# Regenerate configuration scripts with the latest autotools updates. autoreconf -fvi 2>autogen.err status=$? if [ $status -ne 0 ]; then From 3a6c62e983982e320a2969458b182b0782ddccf5 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 18:13:58 +0300 Subject: [PATCH 10/17] autogen.sh: Remove config.cache if needed The code to keep the old configure script was taken from Subversion's autogen.sh, but somehow only the first half of the code was used, making it pointless. Add the second half of the code that removes config.cache if the configure script has been changed. --- autogen.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 74bb795ab..90b254157 100755 --- a/autogen.sh +++ b/autogen.sh @@ -15,8 +15,10 @@ 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 echo "Creating configure..." @@ -31,6 +33,18 @@ if [ $status -ne 0 ]; then exit 1 fi +# 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 "Tossing config.cache, since configure has changed." + rm config.cache + ) + rm -f "$OLD_CONFIGURE" +fi + run_configure=true for arg in $*; do case $arg in From 8f001d561d2c20e589eb1bf8d604e9c4a3eb5e32 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 18:37:31 +0300 Subject: [PATCH 11/17] autogen.sh: Make clear when configure output starts --- autogen.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autogen.sh b/autogen.sh index 90b254157..83e6d9b79 100755 --- a/autogen.sh +++ b/autogen.sh @@ -59,6 +59,8 @@ done if $run_configure; then mkdir -p build cd build + echo + echo "Running 'configure'..." ../configure --enable-maintainer-mode "$@" status=$? if [ $status -eq 0 ]; then From 8168b7bf2e877f427a86b9109d1fbc5119937354 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 18:40:44 +0300 Subject: [PATCH 12/17] autogen.sh: Print configure in quotes consistently --- autogen.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autogen.sh b/autogen.sh index 83e6d9b79..079525bc0 100755 --- a/autogen.sh +++ b/autogen.sh @@ -21,7 +21,7 @@ if [ -f config.cache ] && [ -f configure ]; then cp configure "$OLD_CONFIGURE" fi -echo "Creating configure..." +echo "Creating 'configure'..." # Regenerate configuration scripts with the latest autotools updates. autoreconf -fvi 2>autogen.err @@ -39,7 +39,7 @@ if [ -f config.cache ]; then ( [ -f "$OLD_CONFIGURE" ] && cmp configure "$OLD_CONFIGURE" > /dev/null 2>&1 ) || ( - echo "Tossing config.cache, since configure has changed." + echo "Tossing config.cache, since 'configure' has changed." rm config.cache ) rm -f "$OLD_CONFIGURE" @@ -68,7 +68,7 @@ if $run_configure; then echo "Now type 'make' to compile link-grammar (in the 'build' directory)." else echo - echo "\"configure\" returned a bad status ($status)." + echo "'configure' returned a bad status ($status)." fi else echo From b762896279c5f070df1b9e35548a7340926a479a Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 18:43:49 +0300 Subject: [PATCH 13/17] autogen.sh: Prefix messages with the script name --- autogen.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/autogen.sh b/autogen.sh index 079525bc0..aaf90f59b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -9,7 +9,7 @@ rm -f autogen.err 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 "Error: you need automake 1.4 or later. Please upgrade." + echo "$0: Error: you need automake 1.4 or later. Please upgrade." exit 1 fi @@ -21,14 +21,14 @@ if [ -f config.cache ] && [ -f configure ]; then cp configure "$OLD_CONFIGURE" fi -echo "Creating 'configure'..." +echo "$0: Creating 'configure'..." # Regenerate configuration scripts with the latest autotools updates. autoreconf -fvi 2>autogen.err status=$? if [ $status -ne 0 ]; then echo "" - echo "* * * Warning: autoreconf returned bad status ($status) - check autogen.err" + echo "$0: * * * Warning: autoreconf returned bad status ($status) - check autogen.err" echo "" exit 1 fi @@ -39,7 +39,7 @@ if [ -f config.cache ]; then ( [ -f "$OLD_CONFIGURE" ] && cmp configure "$OLD_CONFIGURE" > /dev/null 2>&1 ) || ( - echo "Tossing config.cache, since 'configure' has changed." + echo "$0: Tossing config.cache, since 'configure' has changed." rm config.cache ) rm -f "$OLD_CONFIGURE" @@ -60,17 +60,17 @@ if $run_configure; then mkdir -p build cd build echo - echo "Running 'configure'..." + 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 From 38db0ca4fe0c6c9ce564817fff81dd159ea8cb34 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 19:54:55 +0300 Subject: [PATCH 14/17] autogen.sh: Add --clean --- autogen.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/autogen.sh b/autogen.sh index aaf90f59b..f97a808c2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -5,6 +5,24 @@ rm -f autogen.err +run_configure=true +while [ -n "$1" ] +do + case "$1" in + --no-configure) + run_configure=false + shift + ;; + --clean) + # Start from a clean state. + rm -rf config.cache autom4te*.cache + shift + ;; + *) + break 2 + esac +done + # 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'`" @@ -45,17 +63,6 @@ if [ -f config.cache ]; then rm -f "$OLD_CONFIGURE" fi -run_configure=true -for arg in $*; do - case $arg in - --no-configure) - run_configure=false - ;; - *) - ;; - esac -done - if $run_configure; then mkdir -p build cd build From f09212399c70935aec496f046dddadfa4c3deb34 Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 19:55:28 +0300 Subject: [PATCH 15/17] autogen.sh: Add --help --- autogen.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autogen.sh b/autogen.sh index f97a808c2..40465c1fd 100755 --- a/autogen.sh +++ b/autogen.sh @@ -9,6 +9,10 @@ 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 From b635c4522a997ccc33ec42895aa9487d9b13dfae Mon Sep 17 00:00:00 2001 From: ampli Date: Sat, 18 May 2024 19:15:55 +0300 Subject: [PATCH 16/17] autogen.sh: Add invocation directory consistency check --- autogen.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autogen.sh b/autogen.sh index 40465c1fd..e92f83a71 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,6 +3,11 @@ # Run this before configure # +if [ ! -f "autogen.sh" ]; then + echo "$0: This script must be run in the top-level directory" + exit 1 +fi + rm -f autogen.err run_configure=true From ba675acde949436c21caf8ec3cf17f326d81ec36 Mon Sep 17 00:00:00 2001 From: ampli Date: Sun, 19 May 2024 04:10:27 +0300 Subject: [PATCH 17/17] README-MinGW64.md: "sh ../configure" --- mingw/README-MinGW64.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw/README-MinGW64.md b/mingw/README-MinGW64.md index c99512e38..a4612123e 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