xref: /freebsd/contrib/unbound/freebsd-configure.sh (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6set -e
7
8error() {
9	echo "$@" >&2
10	exit 1
11}
12
13unbound=$(dirname $(realpath $0))
14cd $unbound
15
16ldnssrc=$(realpath $unbound/../ldns)
17[ -f $ldnssrc/ldns/ldns.h ] || error "can't find LDNS sources"
18export CFLAGS="-I$ldnssrc"
19
20ldnsbld=$(realpath $unbound/../../lib/libldns)
21[ -f $ldnsbld/Makefile ] || error "can't find LDNS build directory"
22
23ldnsobj=$(realpath $(make -C$ldnsbld -V.OBJDIR))
24[ -f $ldnsobj/libprivateldns.a ] || error "can't find LDNS object directory"
25export LDFLAGS="-L$ldnsobj"
26
27export CC=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCC)
28export CPP=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCPP)
29
30autoconf
31autoheader
32./configure \
33	--prefix= --exec-prefix=/usr \
34	--with-conf-file=/var/unbound/unbound.conf \
35	--with-run-dir=/var/unbound \
36	--with-username=unbound
37
38# Don't try to provide bogus memory usage statistics based on sbrk(2).
39sed -n -i.orig -e '/HAVE_SBRK/!p' config.status
40./config.status config.h
41