xref: /freebsd/contrib/unbound/freebsd-configure.sh (revision bc96366c864c07ef352edb92017357917c75b36c)
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/libldns.a ] || error "can't find LDNS object directory"
25export LDFLAGS="-L$ldnsobj"
26
27autoconf
28autoheader
29./configure \
30	--prefix= --exec-prefix=/usr \
31	--with-conf-file=/var/unbound/unbound.conf \
32	--with-run-dir=/var/unbound \
33	--with-username=unbound
34
35# Don't try to provide bogus memory usage statistics based on sbrk(2).
36sed -n -i.orig -e '/HAVE_SBRK/!p' config.status
37./config.status config.h
38