freebsd-configure.sh revision 255839
1255577Sdes#!/bin/sh
2255779Sdes#
3255779Sdes# $FreeBSD: head/contrib/unbound/freebsd-configure.sh 255839 2013-09-24 09:56:10Z des $
4255779Sdes#
5255577Sdes
6255577Sdesset -e
7255577Sdes
8255577Sdeserror() {
9255577Sdes	echo "$@" >&2
10255577Sdes	exit 1
11255577Sdes}
12255577Sdes
13255577Sdesunbound=$(dirname $(realpath $0))
14255577Sdescd $unbound
15255577Sdes
16255577Sdesldnssrc=$(realpath $unbound/../ldns)
17255577Sdes[ -f $ldnssrc/ldns/ldns.h ] || error "can't find LDNS sources"
18255577Sdesexport CFLAGS="-I$ldnssrc"
19255577Sdes
20255577Sdesldnsbld=$(realpath $unbound/../../lib/libldns)
21255577Sdes[ -f $ldnsbld/Makefile ] || error "can't find LDNS build directory"
22255577Sdes
23255577Sdesldnsobj=$(realpath $(make -C$ldnsbld -V.OBJDIR))
24255577Sdes[ -f $ldnsobj/libldns.a ] || error "can't find LDNS object directory"
25255577Sdesexport LDFLAGS="-L$ldnsobj"
26255577Sdes
27255839Sdesautoconf
28255839Sdesautoheader
29255577Sdes./configure \
30255594Sdes	--prefix= --exec-prefix=/usr \
31255839Sdes	--with-conf-file=/var/unbound/unbound.conf \
32255577Sdes	--with-run-dir=/var/unbound \
33255577Sdes	--with-username=unbound
34255577Sdes
35255577Sdes# Regenerate the configuration parser
36255577Sdes{
37255577Sdescat <<EOF
38255577Sdes#include "config.h"
39255577Sdes#include "util/configyyrename.h"
40255577SdesEOF
41255577Sdes/usr/bin/flex -L -t util/configlexer.lex
42255577Sdes} >util/configlexer.c
43255577Sdes
44255795Sdes/usr/bin/yacc -d -o util/configparser.c util/configparser.y
45