summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-19 22:49:22 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-20 01:42:55 -0400
commita5e739a570081231eccb5a01a2b891f8bbaa86ba (patch)
treec1ab43b9506ead76639f6a849d5fae275129a7f9
parent5368222db6093195dbbd5fc7418508b154b1b769 (diff)
build-sys: allow autogen.sh to take configure params
It is sometimes nice to run autogen with some configure parameters. For example: ./autogen.sh c --disable-manpages So pass any extra args after the [cgals] verb to the configure command. Also, check that the verb is correct (empty or one of the known letters) before doing any non-trivial work.
-rwxr-xr-xautogen.sh21
1 files changed, 16 insertions, 5 deletions
diff --git a/autogen.sh b/autogen.sh
index 4ec1b2be79..82ebb57db1 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -17,6 +17,16 @@
set -e
+verb="$1"
+
+if [[ -n "$verb" ]]; then
+ if [[ "$verb" != [cgals] ]]; then
+ echo "Unexpected argument: $verb" >&2
+ exit 1
+ fi
+ shift
+fi
+
oldpwd=$(pwd)
topdir=$(dirname $0)
cd $topdir
@@ -52,21 +62,22 @@ args="$args \
"
fi
+args="$args $@"
cd $oldpwd
-if [ "x$1" = "xc" ]; then
+if [ "$verb" = "c" ]; then
$topdir/configure CFLAGS='-g -O0 -ftrapv' $args
make clean
-elif [ "x$1" = "xg" ]; then
+elif [ "$verb" = "g" ]; then
$topdir/configure CFLAGS='-g -Og -ftrapv' $args
make clean
-elif [ "x$1" = "xa" ]; then
+elif [ "$verb" = "a" ]; then
$topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure -Wsuggest-attribute=const -ftrapv' $args
make clean
-elif [ "x$1" = "xl" ]; then
+elif [ "$verb" = "l" ]; then
$topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv' $args
make clean
-elif [ "x$1" = "xs" ]; then
+elif [ "$verb" = "s" ]; then
scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0 -ftrapv' $args
scan-build make
else