From da4f7fdb0c056a050210c0a1f67f1914827428bf Mon Sep 17 00:00:00 2001 From: Bryce Glover Date: Tue, 7 Mar 2017 16:23:47 -0500 Subject: [PATCH] [`autogen.sh`:] Abstract the absolute path of `libtoolize` or `glibtoolize` away into `$LIBTOOLIZE`. Increase portability by insulating `autogen.sh` from platform variance. --- autogen.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index a551bb4b..a0e7d3fb 100755 --- a/autogen.sh +++ b/autogen.sh @@ -46,6 +46,18 @@ if [ "$1" = "clean" ]; then find . -iname "Makefile.in" -type f -exec rm '{}' + fi +# Prevent any errors that might result from failing to properly invoke `libtoolize` or `glibtoolize,` whichever +# is present on your system, from occurring by testing for its existence and capturing the absolute path to its +# location for caching purposes prior to using it later on in 'Step 2:' +if command -v libtoolize >/dev/null 2>&1; then + LIBTOOLIZE="$(command -v libtoolize)" +elif command -v glibtoolize >/dev/null 2>&1; then + LIBTOOLIZE="$(command -v glibtoolize)" +else + echo "Unable to find a valid copy of libtoolize in your PATH!" + bail_out +fi + # create m4 directory if it not exists if [ ! -d m4 ]; then mkdir m4 @@ -71,8 +83,8 @@ aclocal -I config || bail_out # --- Step 2: echo "Running libtoolize" -libtoolize -f -c || glibtoolize -f -c || bail_out -libtoolize --automake || glibtoolize --automake || bail_out +$LIBTOOLIZE -f -c || bail_out +$LIBTOOLIZE --automake || bail_out # --- Step 3: Generate config.h.in from: # . configure.ac (look for AM_CONFIG_HEADER tag or AC_CONFIG_HEADER tag)