aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSvyatoslav Mishyn <juef@openmailbox.org>2016-05-08 11:26:32 +0300
committerDuncaen <mail@duncano.de>2016-05-08 16:17:28 +0200
commite246f9e2fee02046072b69a9e8c29767db7f4652 (patch)
treee48bfc3c751d834678559abb511e804a293d1c1b
parent33e3630671ba6d2ec591fb45ba41af7e09fecf0a (diff)
downloadopendoas-e246f9e2fee02046072b69a9e8c29767db7f4652.tar.gz
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]
-rwxr-xr-xconfigure58
1 files changed, 44 insertions, 14 deletions
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 <<EOF
+usage: configure [options] [settings]
+
+ --prefix=PREFIX installation prefix [/usr]
+ --exec-prefix=EPREFIX installation prefix for executable files [PREFIX]
+ --bindir=DIR user executables [PREFIX/bin]
+ --datadir=DIR architecture-independent data files [PREFIX/share]
+ --mandir=DIR manual pages [DATADIR/man]
+ --sysconfdir=DIR directory for configuration files [/etc]
+ --pamdir=DIR PAM directory [SYSCONFDIR/pam.d]
+
+ --build=build-alias a cpu-vendor-opsys for the system where the application will be built
+ --host=host-alias a cpu-vendor-opsys for the system where the application will run
+ --target=target-alias the machine that CC will produce code for
+
+ --enable-debug enable debugging
+ --enable-seccomp enable seccomp
+ --enable-static prepare for static build
+
+ --help, -h display this help and exit
+EOF
+ exit 0
+}
+
for x; do
opt=${x%%=*}
var=${x#*=}
case "$opt" in
- --enable-debug) DEBUG=yes;;
--prefix) PREFIX=$var;;
--exec-prefix) EPREFIX=$var;;
--bindir) BINDIR=$var;;
- --mandir) MANDIR=$var;;
--datadir) SHAREDIR=$var;;
+ --mandir) MANDIR=$var;;
+ --sysconfdir) SYSCONFDIR=$var;;
+ --pamdir) PAMDIR=$var;;
--build) BUILD=$var;;
--host) HOST=$var;;
--target) TARGET=$var;;
- --includedir) INCLUDEDIR=$var;;
- --sysconfdir) SYSCONFDIR=$var;;
- --pamdir) PAMDIR=$var;;
- --localstatedir) LOCALSTATEDIR=$var;;
- --libdir) LIBDIR=$var;;
- --datadir|--infodir) ;; # ignore autotools
- --verbose) unset SILENT;;
- --pkgconfigdir) PKGCONFIGDIR=$var;;
- --enable-static) BUILD_STATIC=yes;;
+ --enable-debug) DEBUG=yes;;
--enable-seccomp) BUILD_SECCOMP=yes;;
- --help) usage;;
- *) echo "$0: WARNING: unknown option $opt" >&2;;
+ --enable-static) BUILD_STATIC=yes;;
+ --help|-h) usage;;
+ *) die "Error: unknown option $opt";;
esac
done
@@ -35,8 +59,8 @@ cat <<EOF >>$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.