Skip to content

Commit 9be1980

Browse files
committed
build: Fix autogen.sh $LIBTOOLIZE detection logic
* Don't silence `libtoolize --version` error message. It would be useful for diagnosing any problem when `libtoolize --version` fails. (libtoolize not found? No permission to execute? Now you know which error it is.) * Change the guessing code of libtoolize program name to a loop. It'll perform silently. * Silence the `libtoolize --version` output when it succeeds. Signed-off-by: Kang-che Sung <[email protected]>
1 parent 8900923 commit 9be1980

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

autogen.sh

+12-11
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@
2525
# and procede with the "normal" build procedures.
2626

2727
# use LIBTOOLIZE, if set
28-
LIBTOOLIZE_ORIG="$LIBTOOLIZE";
29-
if test "x$LIBTOOLIZE" = "x"; then LIBTOOLIZE=libtoolize; fi
28+
if test "x$LIBTOOLIZE" = "x"; then
29+
for ac_prog in libtoolize glibtoolize; do
30+
if $ac_prog --version >/dev/null 2>&1; then
31+
LIBTOOLIZE=$ac_prog
32+
break
33+
fi
34+
done
35+
fi
3036

3137
# test libtoolize
32-
$LIBTOOLIZE --version 2>/dev/null
33-
if test "$?" -ne 0; then
34-
LIBTOOLIZE=glibtoolize
35-
$LIBTOOLIZE --version 2>/dev/null
36-
if test "$?" -ne 0; then
37-
echo "error: libtoolize not working, re-run with LIBTOOLIZE=/path/to/libtoolize">&2
38-
echo " LIBTOOLIZE is currently \"$LIBTOOLIZE_ORIG\"">&2
39-
exit 1
40-
fi
38+
if test "x$LIBTOOLIZE" = "x" || ! $LIBTOOLIZE --version >/dev/null; then
39+
echo "error: libtoolize not working, re-run with LIBTOOLIZE=/path/to/libtoolize">&2
40+
echo " LIBTOOLIZE is currently \"$LIBTOOLIZE\"">&2
41+
exit 1
4142
fi
4243

4344
#if we pretend to have a ChangeLog, then automake is less

0 commit comments

Comments
 (0)