[autogen.sh:] Abstract the absolute path of libtoolize or glibtoolize away into $LIBTOOLIZE.

Increase portability by insulating `autogen.sh` from platform variance.
This commit is contained in:
Bryce Glover 2017-03-07 16:23:47 -05:00
parent b6eb8bebb1
commit da4f7fdb0c

View File

@ -46,6 +46,18 @@ if [ "$1" = "clean" ]; then
find . -iname "Makefile.in" -type f -exec rm '{}' + find . -iname "Makefile.in" -type f -exec rm '{}' +
fi 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 # create m4 directory if it not exists
if [ ! -d m4 ]; then if [ ! -d m4 ]; then
mkdir m4 mkdir m4
@ -71,8 +83,8 @@ aclocal -I config || bail_out
# --- Step 2: # --- Step 2:
echo "Running libtoolize" echo "Running libtoolize"
libtoolize -f -c || glibtoolize -f -c || bail_out $LIBTOOLIZE -f -c || bail_out
libtoolize --automake || glibtoolize --automake || bail_out $LIBTOOLIZE --automake || bail_out
# --- Step 3: Generate config.h.in from: # --- Step 3: Generate config.h.in from:
# . configure.ac (look for AM_CONFIG_HEADER tag or AC_CONFIG_HEADER tag) # . configure.ac (look for AM_CONFIG_HEADER tag or AC_CONFIG_HEADER tag)