From 386a8beb705a1f23417684bb890da543d13e44aa Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 24 Jul 2020 18:03:27 -0400 Subject: Rewrite configure script for all platforms --- configure | 68 +++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 19 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 96224d0..c617b1f 100755 --- a/configure +++ b/configure @@ -1,26 +1,56 @@ #!/bin/sh set -eu -base='-lcrypt' -libs='libcrypto libtls' -[ "$(uname)" = 'Darwin' ] && base= +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:-}" +} exec >config.mk -pkg-config --print-errors $libs +for opt; do + case "${opt}" in + (--prefix=*) echo "PREFIX = ${opt#*=}" ;; + (--mandir=*) echo "MANDIR = ${opt#*=}" ;; + (*) echo "warning: unsupported option ${opt}" >&2 ;; + esac +done -cat <