diff mbox

[libdrm,2/2] autogen.sh: handle out-of-tree invokation

Message ID 1425902897-13398-2-git-send-email-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Emil Velikov March 9, 2015, 12:08 p.m. UTC
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 autogen.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/autogen.sh b/autogen.sh
index 30d679f..c896097 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,6 +1,14 @@ 
 #! /bin/sh
 
-test -n "$srcdir" || srcdir=`dirname "$0"`
-test -n "$srcdir" || srcdir=.
-autoreconf --force --install --verbose "$srcdir"
-test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
+srcdir=`dirname "$0"`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd "$srcdir"
+
+autoreconf --force --verbose --install || exit 1
+cd "$ORIGDIR" || exit $?
+
+if test -z "$NOCONFIGURE"; then
+    "$srcdir"/configure "$@"
+fi