Skip to content

Commit

Permalink
[autogen.sh:] Abstract the absolute path of libtoolize or `glibto…
Browse files Browse the repository at this point in the history
…olize` away into `$LIBTOOLIZE`.

Increase portability by insulating `autogen.sh` from platform variance.
  • Loading branch information
RandomDSdevel committed Mar 9, 2017
1 parent b6eb8be commit da4f7fd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit da4f7fd

Please sign in to comment.