configure: allow enabling unit tests

This commit is contained in:
Jeremy Baxter 2024-08-08 15:56:54 +12:00
parent 76eb783a04
commit 85b71a6092

5
configure vendored
View file

@ -58,6 +58,7 @@ gen_CFLAGS () {
dmd) cflags="$cflags -debug";; dmd) cflags="$cflags -debug";;
esac esac
fi fi
[ -n "$unittest" ] && cflags="$cflags -unittest -main"
for flag in $cflags; do for flag in $cflags; do
using "$flag" using "$flag"
@ -85,7 +86,7 @@ gen_LDFLAGS () {
# command line interface # command line interface
while getopts c:dhr ch; do while getopts c:dhrt ch; do
case "$ch" in case "$ch" in
c) c)
dcname="$(basename "$OPTARG")" dcname="$(basename "$OPTARG")"
@ -97,6 +98,7 @@ while getopts c:dhr ch; do
;; ;;
d) debug=1 ;; d) debug=1 ;;
r) unset debug ;; r) unset debug ;;
t) unittest=1; debug=1 ;;
h) h)
cat <<EOF cat <<EOF
configure: create an optimised makefile for the current environment configure: create an optimised makefile for the current environment
@ -105,6 +107,7 @@ options:
-c: force use of a particular compiler (dmd or ldc2) -c: force use of a particular compiler (dmd or ldc2)
-d: build in debug mode, with debug symbols and statements enabled -d: build in debug mode, with debug symbols and statements enabled
-r: build in release mode with optimisation flags enabled (default) -r: build in release mode with optimisation flags enabled (default)
-t: build an executable to run unit tests (implies -d)
-h: show this help message -h: show this help message
EOF EOF
exit 0 exit 0