Browse Source

Bugfix: Fix multiple bugs in autogen.sh

Don't use readlink -f unneccesarily (it's not portable)
Always run autoreconf within the real source directory
Run configure from PWD, *not* the real source directory
Properly quote options passed to configure
Luke Dashjr 13 years ago
parent
commit
d8cbe1e1e8
1 changed files with 10 additions and 12 deletions
  1. 10 12
      autogen.sh

+ 10 - 12
autogen.sh

@@ -1,17 +1,15 @@
-#!/bin/sh
-cwd="$PWD"
-bs_dir="$(dirname $(readlink -f $0))"
-rm -rf "${bs_dir}"/autom4te.cache
-rm -f "${bs_dir}"/aclocal.m4 "${bs_dir}"/ltmain.sh
+#!/bin/sh -e
+bs_dir="$(dirname "$0")"
 
 
 echo 'Running autoreconf -if...'
 echo 'Running autoreconf -if...'
-autoreconf -if || exit 1
+(
+	cd "${bs_dir}"
+	rm -rf autom4te.cache
+	rm -f aclocal.m4 ltmain.sh
+	autoreconf -if
+)
+
 if test -z "$NOCONFIGURE" ; then
 if test -z "$NOCONFIGURE" ; then
 	echo 'Configuring...'
 	echo 'Configuring...'
-	cd "${bs_dir}" &> /dev/null
-	test "$?" = "0" || e=1
-	test "$cwd" != "$bs_dir" && cd "$bs_dir" &> /dev/null
-	./configure $@
-	test "$e" = "1" && exit 1
-	cd "$cwd"
+	"${bs_dir}"/configure "$@"
 fi
 fi