autogen: fix configure script generation when srcdir != builddir.
authorJavier Jardón <jjardon@gnome.org>
Wed, 27 Jun 2012 16:08:03 +0000 (01:08 +0900)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 27 Aug 2012 08:25:18 +0000 (10:25 +0200)
This patch allows for regenerating the configure script from a build
directory that is not the actual source directory.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
autogen.sh

index 3032585..920e77e 100755 (executable)
@@ -1,16 +1,17 @@
 #!/bin/sh
 
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
+PROJECT="gstreamer-vaapi"
 
-PROJECT=gstreamer-vaapi
-TEST_TYPE=-d
-FILE=gst-libs
+test -n "$srcdir" || srcdir="`dirname \"$0\"`"
+test -n "$srcdir" || srcdir=.
 
-test $TEST_TYPE $FILE || {
-    echo "You must run this script in the top-level $PROJECT directory"
+if ! test -f "$srcdir/configure.ac"; then
+    echo "Failed to find the top-level $PROJECT directory"
     exit 1
-}
+fi
+
+olddir="`pwd`"
+cd "$srcdir"
 
 mkdir -p m4
 
@@ -30,6 +31,8 @@ else
     autoreconf -v --install || exit $?
 fi
 
+cd "$olddir"
+
 if test -z "$NO_CONFIGURE"; then
-    ./configure "$@" && echo "Now type 'make' to compile $PROJECT."
+    $srcdir/configure "$@" && echo "Now type 'make' to compile $PROJECT."
 fi