diff options
author | June McEnroe <june@causal.agency> | 2020-07-23 17:43:54 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-23 17:43:54 -0400 |
commit | 86133bdcaae3358bb4af740d8bfd22a045379ac4 (patch) | |
tree | e30583ad0b5bd4fa2f1fc164f25572905a4862a5 /configure | |
parent | Add OpenBSD instructions (diff) | |
download | scooper-86133bdcaae3358bb4af740d8bfd22a045379ac4.tar.gz scooper-86133bdcaae3358bb4af740d8bfd22a045379ac4.zip |
Rewrite configure script
Diffstat (limited to '')
-rwxr-xr-x | configure | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/configure b/configure index ab23150..c55e71a 100755 --- a/configure +++ b/configure @@ -1,9 +1,41 @@ #!/bin/sh set -eu -pkg-config "$@" --print-errors scooper.pc +cflags() { + echo "CFLAGS += $*" +} +ldlibs() { + echo "LDLIBS ${o:-}= $*" + o=+ +} +config() { + pkg-config --print-errors "$@" + cflags $(pkg-config --cflags "$@") + ldlibs $(pkg-config --libs "$@") +} +defstr() { + cflags "-D'$1=\"$2\"'" +} +defvar() { + defstr "$1" "$(pkg-config --variable=$3 $2)${4:-}" +} -cat >config.mk <<EOF -CFLAGS += $(pkg-config "$@" --cflags scooper.pc) -LDLIBS = $(pkg-config "$@" --libs scooper.pc) -EOF +exec >config.mk + +for opt; do + case "${opt}" in + (--prefix=*) echo "PREFIX = ${opt#*=}" ;; + (--mandir=*) echo "MANDIR = ${opt#*=}" ;; + (*) echo "warning: unsupported option ${opt}" >&2 ;; + esac +done + +case "$(uname)" in + (FreeBSD|OpenBSD) + echo 'LDFLAGS += -static' + config --static kcgi kcgi-html sqlite3 + ;; + (*) + config kcgi kcgi-html sqlite3 + ;; +esac |