-if libtoolize --version >/dev/null 2>&1; then
- libtoolize="libtoolize"
-elif glibtoolize --version >/dev/null 2>&1; then
- libtoolize="glibtoolize"
+# Abort execution on error
+set -e
+
+if which libtoolize > /dev/null; then
+ libtoolize="libtoolize"
+elif which glibtoolize >/dev/null; then
+ libtoolize="glibtoolize"