From: Svyatoslav Mishyn Date: Sun, 8 May 2016 08:26:32 +0000 (+0300) Subject: configure: tune up a little bit X-Git-Tag: v0.1~8 X-Git-Url: https://git.armaanb.net/?p=opendoas.git;a=commitdiff_plain;h=e246f9e2fee02046072b69a9e8c29767db7f4652 configure: tune up a little bit * add usage() function * remove unused options * stop parsing option(s) if unknown was found * set up "--enable-debug" and "--enable-static" options Closes: #1 [via git-merge-pr] --- diff --git a/configure b/configure index 16d37ee..66589b9 100755 --- a/configure +++ b/configure @@ -1,30 +1,54 @@ #!/bin/sh +die() { + printf "$1\n" >&2 + exit 1 +} + +usage() { + cat <&2;; + --enable-static) BUILD_STATIC=yes;; + --help|-h) usage;; + *) die "Error: unknown option $opt";; esac done @@ -35,8 +59,8 @@ cat <>$CONFIG_MK DESTDIR ?= / PREFIX ?= ${PREFIX:="/usr"} EPREFIX ?= ${EPREFIX:="${PREFIX}"} -SHAREDIR ?= ${SHAREDIR:="${PREFIX}/share"} BINDIR ?= ${BINDIR:="${PREFIX}/bin"} +SHAREDIR ?= ${SHAREDIR:="${PREFIX}/share"} MANDIR ?= ${MANDIR:="${SHAREDIR}/man"} SYSCONFDIR?= ${SYSCONFDIR:="/etc"} PAMDIR ?= ${PAMDIR:="${SYSCONFDIR}/pam.d"} @@ -76,6 +100,12 @@ esac [ -n "$OS_CFLAGS" ] && \ printf 'CFLAGS += %s\n' "$OS_CFLAGS" >>$CONFIG_MK +[ -n "$DEBUG" ] && \ + printf 'CFLAGS += -O0 -g\n' >>$CONFIG_MK + +[ -n "$BUILD_STATIC" ] && \ + printf 'CFLAGS += -static\n' >>$CONFIG_MK + # Add CPPFLAGS/CFLAGS/LDFLAGS to CC for testing features XCC="${CC:=clang} $CFLAGS $OS_CFLAGS $CPPFLAGS $LDFLAGS" # Make sure to disable --as-needed for CC tests.