diff --git a/autogen.sh b/autogen.sh index 2bdcdc1a55..7ce702e830 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,22 +1,29 @@ #!/bin/sh # Run this to generate all the initial makefiles, etc. -srcdir=`dirname $0` +srcdir="$(dirname "$0")" test -z "$srcdir" && srcdir=. REQUIRED_AUTOMAKE_VERSION=1.9 PKG_NAME=NetworkManager-pptp -(test -f $srcdir/configure.ac \ - && test -f $srcdir/auth-dialog/main.c) || { - echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" - echo " top-level $PKG_NAME directory" +{ test -f "$srcdir/configure.ac" \ + && test -f "$srcdir/auth-dialog/main.c"; } || { + echo "**Error**: Directory ${srcdir} does not look like the top-level ${PKG_NAME} directory" exit 1 } -(cd $srcdir; - autoreconf --install --symlink && - intltoolize --force && - autoreconf && - ./configure --enable-maintainer-mode $@ -) +for test_tool in autoreconf intltoolize +do + [ -x "$(command -v "$test_tool")" ] || { + echo "${test_tool} was not found!" + exit 1 + } +done +if cd "$srcdir"; then + autoreconf --install --symlink + intltoolize --force + autoreconf + # Run ./configure if NOCONFIGURE environmental variable is not defined (is empty) + [ -z "$NOCONFIGURE" ] && ./configure --enable-maintainer-mode "$@" +fi