about summary refs log tree commit diff
path: root/configure
blob: 293678077d1407cdb99e68caf75d3e65cc497b4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
set -eu

base='-lcrypt'
libs='libcrypto libtls'

exec >config.mk

case "$(uname)" in
	(Darwin)
		base=''
		;;
	(FreeBSD)
		if ! pkg info -e libressl; then
			echo 'LibreSSL required' >&2
			exit 1
		fi
		prefix=$(pkg query '%p' libressl)
		cat <<-EOF
		MANDIR = \${PREFIX}/man
		CFLAGS += -I${prefix}/include
		CFLAGS += -D'OPENSSL_BIN="${prefix}/bin/openssl"'
		LDFLAGS += -L${prefix}/lib
		EOF
		exit
		;;
	(Linux)
		cat <<-EOF
		CFLAGS += -D_GNU_SOURCE
		CFLAGS += -D'CERTBOT_PATH="/etc/letsencrypt"'
		LDLIBS.calico = \${LDLIBS}
		RCS =
		DIRS =
		EOF
		;;
esac

pkg-config --print-errors $libs

cat <<EOF
CFLAGS += $(pkg-config --cflags $libs)
CFLAGS += -D'OPENSSL_BIN="$(pkg-config --variable=prefix openssl)/bin/openssl"'
LDFLAGS += $(pkg-config --libs-only-L $libs)
LDLIBS = $base $(pkg-config --libs-only-l $libs)
EOF