about summary refs log tree commit diff
path: root/configure
diff options
context:
space:
mode:
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure28
1 files changed, 16 insertions, 12 deletions
diff --git a/configure b/configure
index 2047624..c001b39 100755
--- a/configure
+++ b/configure
@@ -1,23 +1,25 @@
 #!/bin/sh
 set -eu
 
+: ${PKG_CONFIG:=pkg-config}
+
 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:-}"
+	defstr "$1" "$(${PKG_CONFIG} --variable=$3 $2)${4:-}"
+}
+ldadd() {
+	lib=$1; shift
+	echo "LDADD.${lib} = $*"
+}
+config() {
+	${PKG_CONFIG} --print-errors "$@"
+	cflags $(${PKG_CONFIG} --cflags "$@")
+	for lib; do ldadd $lib $(${PKG_CONFIG} --libs $lib); done
 }
 
 exec >config.mk
@@ -25,6 +27,7 @@ exec >config.mk
 for opt; do
 	case "${opt}" in
 		(--prefix=*) echo "PREFIX = ${opt#*=}" ;;
+		(--bindir=*) echo "BINDIR = ${opt#*=}" ;;
 		(--mandir=*) echo "MANDIR = ${opt#*=}" ;;
 		(*) echo "warning: unsupported option ${opt}" >&2 ;;
 	esac
@@ -32,8 +35,9 @@ done
 
 case "$(uname)" in
 	(FreeBSD|OpenBSD)
-		echo 'LDFLAGS += -static'
-		config --static kcgi kcgi-html sqlite3
+		echo 'STATIC = -static'
+		PKG_CONFIG="${PKG_CONFIG} --static"
+		config kcgi kcgi-html sqlite3
 		;;
 	(Linux)
 		cflags -D_GNU_SOURCE