summary refs log tree commit diff
path: root/configure
diff options
context:
space:
mode:
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure60
1 files changed, 39 insertions, 21 deletions
diff --git a/configure b/configure
index 68fce73..d1f940d 100755
--- a/configure
+++ b/configure
@@ -1,26 +1,44 @@
 #!/bin/sh
 set -eu
 
-exec >config.mk
-
-if [ $# -gt 0 ]; then
-	echo 'warning: this script does not process arguments' >&2
-fi
-
-libs='libcrypto libtls ncursesw'
+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:-}"
+}
 
-pkg-config --print-errors $libs
-exec_prefix=$(pkg-config --variable=exec_prefix openssl)
-
-cat <<EOF
-CFLAGS += $(pkg-config --cflags $libs)
-CFLAGS += -D'OPENSSL_BIN="${exec_prefix}/bin/openssl"'
-LDFLAGS += $(pkg-config --libs-only-L $libs)
-LDLIBS = $(pkg-config --libs-only-l $libs)
-EOF
+exec >config.mk
 
-if [ "$(uname)" = 'Linux' ]; then
-	cat <<-EOF
-	CFLAGS += -D_GNU_SOURCE
-	EOF
-fi
+case "$(uname)" in
+	(FreeBSD)
+		ldlibs -lncursesw
+		config libtls
+		defvar OPENSSL_BIN openssl exec_prefix /bin/openssl
+		;;
+	(OpenBSD)
+		ldlibs -lncursesw -ltls
+		defstr OPENSSL_BIN /usr/bin/openssl
+		;;
+	(Linux)
+		cflags -Wno-pedantic -D_GNU_SOURCE
+		config libcrypto libtls ncursesw
+		defvar OPENSSL_BIN openssl exec_prefix /bin/openssl
+		;;
+	(*)
+		config libcrypto libtls ncursesw
+		defvar OPENSSL_BIN openssl exec_prefix /bin/openssl
+		;;
+esac
x and notemap to pageJune McEnroe 2020-02-12Collapse simple linksJune McEnroe 2020-02-12Move catgirl up the pageJune McEnroe 2020-02-12Update catgirl pty grabJune McEnroe 2020-02-12Link to cgit /about pages where appropriateJune McEnroe 2020-02-11Separate LINKS from BINS for html to workJune McEnroe 2020-02-11Add margin to Bl-bullet itemsJune McEnroe 2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe 2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe Apparently sometimes it didn't like receiving its own internal storage to parse again. Understandable. 2020-02-09Add To Be Taught, If FortunateJune McEnroe 2020-02-04Add The Future of Another TimelineJune McEnroe Wow. One of the best I've read. 2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe Broke out LDLIBS for each bin, and made everything more uniform. 2020-01-28Change scout sensitivity to 1.4June McEnroe idk it seems to work. 2020-01-28Import shows.txtJune McEnroe