OSDN Git Service

autogen: modernize configure script generator.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 28 Sep 2012 07:53:20 +0000 (09:53 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 28 Sep 2012 07:55:47 +0000 (09:55 +0200)
Make it possible to run autogen.sh from a different location from the
original source directory. Make execution of the `configure' script
optional. i.e. don't run it by default if NO_CONFIGURE variable is set.

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

index afa2394..ab04e1d 100755 (executable)
@@ -1,3 +1,4 @@
+#!/bin/sh
 # Copyright (c) 2007 Intel Corporation. All Rights Reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-#! /bin/sh
-autoreconf -v --install
-./configure "$@"
+PROJECT="libva"
+
+test -n "$srcdir" || srcdir="`dirname \"$0\"`"
+test -n "$srcdir" || srcdir=.
+
+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
+
+AUTORECONF=`which autoreconf`
+if test -z $AUTORECONF; then
+    echo "*** No autoreconf found ***"
+    exit 1
+else
+    autoreconf -v --install || exit $?
+fi
+
+cd "$olddir"
+
+if test -z "$NO_CONFIGURE"; then
+    $srcdir/configure "$@" && echo "Now type 'make' to compile $PROJECT."
+fi