diff options
author | June McEnroe <june@causal.agency> | 2020-07-24 11:42:40 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-24 11:42:40 -0400 |
commit | 049ad2666299d572c5ed4a2b1614e6c475630143 (patch) | |
tree | 3c600b62fed8b4f67fdfd5bd406f545b5df5b7b0 /configure | |
parent | Add scooper to README (diff) | |
download | litterbox-049ad2666299d572c5ed4a2b1614e6c475630143.tar.gz litterbox-049ad2666299d572c5ed4a2b1614e6c475630143.zip |
Rewrite configure script for all platforms, add OpenBSD
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 64 |
1 files changed, 48 insertions, 16 deletions
diff --git a/configure b/configure index e0873e3..3a688cf 100755 --- a/configure +++ b/configure @@ -1,22 +1,54 @@ #!/bin/sh set -eu -exec >config.mk +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:-}" +} -libs='libtls sqlite3' -pkg-config --print-errors $libs +exec >config.mk -cat <<EOF -CFLAGS += $(pkg-config --cflags $libs) -CFLAGS += -D'SQLITE3_BIN="$(pkg-config --variable=exec_prefix sqlite3)/bin/sqlite3"' -LDFLAGS += $(pkg-config --libs-only-L $libs) -LDLIBS = $(pkg-config --libs-only-l sqlite3) -LDLIBS.litterbox = $(pkg-config --libs-only-l $libs) -INSTALLS = -EOF +for opt; do + case "${opt}" in + (--prefix=*) echo "PREFIX = ${opt#*=}" ;; + (--mandir=*) echo "MANDIR = ${opt#*=}" ;; + (--sysconfdir=*) echo "ETCDIR = ${opt#*=}" ;; + (*) echo "warning: unsupported option ${opt}" >&2 ;; + esac +done -if [ "$(uname)" = 'Linux' ]; then - cat <<-EOF - CFLAGS += -D_GNU_SOURCE - EOF -fi +case "$(uname)" in + (FreeBSD) + config sqlite3 libtls + defvar SQLITE3_BIN sqlite3 exec_prefix /bin/sqlite3 + echo 'INSTALLS = install-rcs' + ;; + (OpenBSD) + ldlibs -ltls + config sqlite3 + defvar SQLITE3_BIN sqlite3 exec_prefix /bin/sqlite3 + ;; + (Linux) + cflags -D_GNU_SOURCE + config sqlite3 libtls + defvar SQLITE3_BIN sqlite3 exec_prefix /bin/sqlite3 + ;; + (*) + config sqlite3 libtls + defvar SQLITE3_BIN sqlite3 exec_prefix /bin/sqlite3 + ;; +esac |