Deleted Added
full compact
configure.ac (266114) configure.ac (276605)
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3AC_PREREQ(2.56)
4sinclude(acx_nlnetlabs.m4)
5sinclude(ax_pthread.m4)
6sinclude(acx_python.m4)
7sinclude(ac_pkg_swig.m4)
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3AC_PREREQ(2.56)
4sinclude(acx_nlnetlabs.m4)
5sinclude(ax_pthread.m4)
6sinclude(acx_python.m4)
7sinclude(ac_pkg_swig.m4)
8sinclude(dnstap/dnstap.m4)
8
9# must be numbers. ac_defun because of later processing
10m4_define([VERSION_MAJOR],[1])
9
10# must be numbers. ac_defun because of later processing
11m4_define([VERSION_MAJOR],[1])
11m4_define([VERSION_MINOR],[4])
12m4_define([VERSION_MICRO],[22])
12m4_define([VERSION_MINOR],[5])
13m4_define([VERSION_MICRO],[1])
13AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl, unbound)
14AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
15AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
16AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
17
14AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl, unbound)
15AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
16AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
17AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
18
18LIBUNBOUND_CURRENT=4
19LIBUNBOUND_REVISION=1
20LIBUNBOUND_AGE=2
19LIBUNBOUND_CURRENT=5
20LIBUNBOUND_REVISION=3
21LIBUNBOUND_AGE=3
21# 1.0.0 had 0:12:0
22# 1.0.1 had 0:13:0
23# 1.0.2 had 0:14:0
24# 1.1.0 had 0:15:0
25# 1.1.1 had 0:16:0
26# 1.2.0 had 0:17:0
27# 1.2.1 had 0:18:0
28# 1.3.0 had 1:0:0 # ub_cancel and -export-symbols.
29# 1.3.1 had 1:1:0
30# 1.3.2 had 1:2:0
31# 1.3.3 had 1:3:0
32# 1.3.4 had 1:4:0
33# 1.4.0-snapshots had 1:5:0
34# 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus
35# 1.4.1 had 2:1:0
36# 1.4.2 had 2:2:0
37# 1.4.3 had 2:3:0
38# 1.4.4 had 2:4:0
39# 1.4.5 had 2:5:0
40# 1.4.6 had 2:6:0
41# 1.4.7 had 2:7:0
42# 1.4.8 had 2:8:0
43# 1.4.9 had 2:9:0
44# 1.4.10 had 2:10:0
45# 1.4.11 had 2:11:0
46# 1.4.12 had 2:12:0
47# 1.4.13 had 2:13:0
48# and 1.4.13p1 and 1.4.13.p2
49# 1.4.14 had 2:14:0
50# 1.4.15 had 3:0:1 # adds ub_version()
51# 1.4.16 had 3:1:1
52# 1.4.17 had 3:2:1
53# 1.4.18 had 3:3:1
54# 1.4.19 had 3:4:1
55# 1.4.20 had 4:0:2 # adds libunbound.ttl # but shipped 3:5:1
56# 1.4.21 had 4:1:2
22# 1.0.0 had 0:12:0
23# 1.0.1 had 0:13:0
24# 1.0.2 had 0:14:0
25# 1.1.0 had 0:15:0
26# 1.1.1 had 0:16:0
27# 1.2.0 had 0:17:0
28# 1.2.1 had 0:18:0
29# 1.3.0 had 1:0:0 # ub_cancel and -export-symbols.
30# 1.3.1 had 1:1:0
31# 1.3.2 had 1:2:0
32# 1.3.3 had 1:3:0
33# 1.3.4 had 1:4:0
34# 1.4.0-snapshots had 1:5:0
35# 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus
36# 1.4.1 had 2:1:0
37# 1.4.2 had 2:2:0
38# 1.4.3 had 2:3:0
39# 1.4.4 had 2:4:0
40# 1.4.5 had 2:5:0
41# 1.4.6 had 2:6:0
42# 1.4.7 had 2:7:0
43# 1.4.8 had 2:8:0
44# 1.4.9 had 2:9:0
45# 1.4.10 had 2:10:0
46# 1.4.11 had 2:11:0
47# 1.4.12 had 2:12:0
48# 1.4.13 had 2:13:0
49# and 1.4.13p1 and 1.4.13.p2
50# 1.4.14 had 2:14:0
51# 1.4.15 had 3:0:1 # adds ub_version()
52# 1.4.16 had 3:1:1
53# 1.4.17 had 3:2:1
54# 1.4.18 had 3:3:1
55# 1.4.19 had 3:4:1
56# 1.4.20 had 4:0:2 # adds libunbound.ttl # but shipped 3:5:1
57# 1.4.21 had 4:1:2
58# 1.4.22 had 4:1:2
59# 1.5.0 had 5:3:3 # adds ub_ctx_add_ta_autr
60# 1.5.1 had 5:4:3
57
58# Current -- the number of the binary API that we're implementing
59# Revision -- which iteration of the implementation of the binary
60# API are we supplying?
61# Age -- How many previous binary API versions do we also
62# support?
63#
64# If we release a new version that does not change the binary API,
65# increment Revision.
66#
67# If we release a new version that changes the binary API, but does
68# not break programs compiled against the old binary API, increment
69# Current and Age. Set Revision to 0, since this is the first
70# implementation of the new API.
71#
72# Otherwise, we're changing the binary API and breaking bakward
73# compatibility with old binaries. Increment Current. Set Age to 0,
74# since we're backward compatible with no previous APIs. Set Revision
75# to 0 too.
76AC_SUBST(LIBUNBOUND_CURRENT)
77AC_SUBST(LIBUNBOUND_REVISION)
78AC_SUBST(LIBUNBOUND_AGE)
79
80CFLAGS="$CFLAGS"
81AC_AIX
82if test "$ac_cv_header_minix_config_h" = "yes"; then
83 AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix])
84fi
85
86dnl
87dnl By default set prefix to /usr/local
88dnl
89case "$prefix" in
90 NONE)
91 prefix="/usr/local"
92 ;;
93esac
94
95# are we on MinGW?
96if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
97else
98 if echo $target | grep mingw32 >/dev/null; then on_mingw="yes"
99 else on_mingw="no"; fi
100fi
101
102#
103# Determine configuration file
104# the eval is to evaluate shell expansion twice
105if test $on_mingw = "no"; then
106 ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
107else
108 ub_conf_file="C:\\Program Files\\Unbound\\service.conf"
109fi
110AC_ARG_WITH([conf_file],
111 AC_HELP_STRING([--with-conf-file=path],
112 [Pathname to the Unbound configuration file]),
113 [ub_conf_file="$withval"])
114AC_SUBST(ub_conf_file)
115ACX_ESCAPE_BACKSLASH($ub_conf_file, hdr_config)
116AC_DEFINE_UNQUOTED(CONFIGFILE, ["$hdr_config"], [Pathname to the Unbound configuration file])
117
118# Determine run, chroot directory and pidfile locations
119AC_ARG_WITH(run-dir,
120 AC_HELP_STRING([--with-run-dir=path],
121 [set default directory to chdir to (by default dir part of cfg file)]),
122 UNBOUND_RUN_DIR="$withval",
123if test $on_mingw = no; then
124 UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`
125else
126 UNBOUND_RUN_DIR=""
127fi
128)
129AC_SUBST(UNBOUND_RUN_DIR)
130ACX_ESCAPE_BACKSLASH($UNBOUND_RUN_DIR, hdr_run)
131AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to])
132
133AC_ARG_WITH(chroot-dir,
134 AC_HELP_STRING([--with-chroot-dir=path],
135 [set default directory to chroot to (by default same as run-dir)]),
136 UNBOUND_CHROOT_DIR="$withval",
137if test $on_mingw = no; then
138 UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR"
139else
140 UNBOUND_CHROOT_DIR=""
141fi
142)
143AC_SUBST(UNBOUND_CHROOT_DIR)
144ACX_ESCAPE_BACKSLASH($UNBOUND_CHROOT_DIR, hdr_chroot)
145AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to])
146
147AC_ARG_WITH(share-dir,
148 AC_HELP_STRING([--with-share-dir=path],
149 [set default directory with shared data (by default same as share/unbound)]),
150 UNBOUND_SHARE_DIR="$withval",
151 UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR")
152AC_SUBST(UNBOUND_SHARE_DIR)
153AC_DEFINE_UNQUOTED(SHARE_DIR, ["$UNBOUND_SHARE_DIR"], [Shared data])
154
155AC_ARG_WITH(pidfile,
156 AC_HELP_STRING([--with-pidfile=filename],
157 [set default pathname to unbound pidfile (default run-dir/unbound.pid)]),
158 UNBOUND_PIDFILE="$withval",
159if test $on_mingw = no; then
160 UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid"
161else
162 UNBOUND_PIDFILE=""
163fi
164)
165AC_SUBST(UNBOUND_PIDFILE)
166ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid)
167AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location])
168
169AC_ARG_WITH(rootkey-file,
170 AC_HELP_STRING([--with-rootkey-file=filename],
171 [set default pathname to root key file (default run-dir/root.key). This file is read and written.]),
172 UNBOUND_ROOTKEY_FILE="$withval",
173if test $on_mingw = no; then
174 UNBOUND_ROOTKEY_FILE="$UNBOUND_RUN_DIR/root.key"
175else
176 UNBOUND_ROOTKEY_FILE="C:\\Program Files\\Unbound\\root.key"
177fi
178)
179AC_SUBST(UNBOUND_ROOTKEY_FILE)
180ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTKEY_FILE, hdr_rkey)
181AC_DEFINE_UNQUOTED(ROOT_ANCHOR_FILE, ["$hdr_rkey"], [default rootkey location])
182
183AC_ARG_WITH(rootcert-file,
184 AC_HELP_STRING([--with-rootcert-file=filename],
185 [set default pathname to root update certificate file (default run-dir/icannbundle.pem). This file need not exist if you are content with the builtin.]),
186 UNBOUND_ROOTCERT_FILE="$withval",
187if test $on_mingw = no; then
188 UNBOUND_ROOTCERT_FILE="$UNBOUND_RUN_DIR/icannbundle.pem"
189else
190 UNBOUND_ROOTCERT_FILE="C:\\Program Files\\Unbound\\icannbundle.pem"
191fi
192)
193AC_SUBST(UNBOUND_ROOTCERT_FILE)
194ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTCERT_FILE, hdr_rpem)
195AC_DEFINE_UNQUOTED(ROOT_CERT_FILE, ["$hdr_rpem"], [default rootcert location])
196
197AC_ARG_WITH(username,
198 AC_HELP_STRING([--with-username=user],
199 [set default user that unbound changes to (default user is unbound)]),
200 UNBOUND_USERNAME="$withval",
201 UNBOUND_USERNAME="unbound")
202AC_SUBST(UNBOUND_USERNAME)
203AC_DEFINE_UNQUOTED(UB_USERNAME, ["$UNBOUND_USERNAME"], [default username])
204
205AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
206ACX_RSRC_VERSION(wnvs)
207AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource files])
208
209# Checks for typedefs, structures, and compiler characteristics.
210AC_C_CONST
211AC_LANG_C
212# allow user to override the -g -O2 flags.
213if test "x$CFLAGS" = "x" ; then
214ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"])
215ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"])
216fi
217AC_PROG_CC
218ACX_DEPFLAG
219ACX_DETERMINE_EXT_FLAGS_UNBOUND
220
221# debug mode flags warnings
222AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable warnings, asserts, makefile-dependencies]))
223AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [same as enable-checking]))
224if test "$enable_debug" = "yes"; then debug_enabled="$enable_debug";
225else debug_enabled="$enable_checking"; fi
226AC_SUBST(debug_enabled)
227case "$debug_enabled" in
228 yes)
229 ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
230 ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
231 ACX_CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"])
232 ACX_CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
233 AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.])
234 ;;
235 no|*)
236 # nothing to do.
237 ;;
238esac
239ACX_CHECK_FLTO
240
241AC_C_INLINE
242ACX_CHECK_FORMAT_ATTRIBUTE
243ACX_CHECK_UNUSED_ATTRIBUTE
244
245if test "$srcdir" != "."; then
246 CPPFLAGS="$CPPFLAGS -I$srcdir"
247fi
248
249AC_DEFUN([ACX_YYLEX_DESTROY], [
250 AC_MSG_CHECKING([for yylex_destroy])
251 if echo %% | $LEX -t 2>&1 | grep yylex_destroy >/dev/null 2>&1; then
252 AC_DEFINE(LEX_HAS_YYLEX_DESTROY, 1, [if lex has yylex_destroy])
253 AC_MSG_RESULT(yes)
254 else AC_MSG_RESULT(no); fi
255])
256
257AC_PROG_LEX
258ACX_YYLEX_DESTROY
259AC_PROG_YACC
260AC_CHECK_PROG(doxygen, doxygen, doxygen)
261AC_CHECK_TOOL(STRIP, strip)
262ACX_LIBTOOL_C_ONLY
263
264# Checks for header files.
61
62# Current -- the number of the binary API that we're implementing
63# Revision -- which iteration of the implementation of the binary
64# API are we supplying?
65# Age -- How many previous binary API versions do we also
66# support?
67#
68# If we release a new version that does not change the binary API,
69# increment Revision.
70#
71# If we release a new version that changes the binary API, but does
72# not break programs compiled against the old binary API, increment
73# Current and Age. Set Revision to 0, since this is the first
74# implementation of the new API.
75#
76# Otherwise, we're changing the binary API and breaking bakward
77# compatibility with old binaries. Increment Current. Set Age to 0,
78# since we're backward compatible with no previous APIs. Set Revision
79# to 0 too.
80AC_SUBST(LIBUNBOUND_CURRENT)
81AC_SUBST(LIBUNBOUND_REVISION)
82AC_SUBST(LIBUNBOUND_AGE)
83
84CFLAGS="$CFLAGS"
85AC_AIX
86if test "$ac_cv_header_minix_config_h" = "yes"; then
87 AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix])
88fi
89
90dnl
91dnl By default set prefix to /usr/local
92dnl
93case "$prefix" in
94 NONE)
95 prefix="/usr/local"
96 ;;
97esac
98
99# are we on MinGW?
100if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
101else
102 if echo $target | grep mingw32 >/dev/null; then on_mingw="yes"
103 else on_mingw="no"; fi
104fi
105
106#
107# Determine configuration file
108# the eval is to evaluate shell expansion twice
109if test $on_mingw = "no"; then
110 ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
111else
112 ub_conf_file="C:\\Program Files\\Unbound\\service.conf"
113fi
114AC_ARG_WITH([conf_file],
115 AC_HELP_STRING([--with-conf-file=path],
116 [Pathname to the Unbound configuration file]),
117 [ub_conf_file="$withval"])
118AC_SUBST(ub_conf_file)
119ACX_ESCAPE_BACKSLASH($ub_conf_file, hdr_config)
120AC_DEFINE_UNQUOTED(CONFIGFILE, ["$hdr_config"], [Pathname to the Unbound configuration file])
121
122# Determine run, chroot directory and pidfile locations
123AC_ARG_WITH(run-dir,
124 AC_HELP_STRING([--with-run-dir=path],
125 [set default directory to chdir to (by default dir part of cfg file)]),
126 UNBOUND_RUN_DIR="$withval",
127if test $on_mingw = no; then
128 UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`
129else
130 UNBOUND_RUN_DIR=""
131fi
132)
133AC_SUBST(UNBOUND_RUN_DIR)
134ACX_ESCAPE_BACKSLASH($UNBOUND_RUN_DIR, hdr_run)
135AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to])
136
137AC_ARG_WITH(chroot-dir,
138 AC_HELP_STRING([--with-chroot-dir=path],
139 [set default directory to chroot to (by default same as run-dir)]),
140 UNBOUND_CHROOT_DIR="$withval",
141if test $on_mingw = no; then
142 UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR"
143else
144 UNBOUND_CHROOT_DIR=""
145fi
146)
147AC_SUBST(UNBOUND_CHROOT_DIR)
148ACX_ESCAPE_BACKSLASH($UNBOUND_CHROOT_DIR, hdr_chroot)
149AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to])
150
151AC_ARG_WITH(share-dir,
152 AC_HELP_STRING([--with-share-dir=path],
153 [set default directory with shared data (by default same as share/unbound)]),
154 UNBOUND_SHARE_DIR="$withval",
155 UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR")
156AC_SUBST(UNBOUND_SHARE_DIR)
157AC_DEFINE_UNQUOTED(SHARE_DIR, ["$UNBOUND_SHARE_DIR"], [Shared data])
158
159AC_ARG_WITH(pidfile,
160 AC_HELP_STRING([--with-pidfile=filename],
161 [set default pathname to unbound pidfile (default run-dir/unbound.pid)]),
162 UNBOUND_PIDFILE="$withval",
163if test $on_mingw = no; then
164 UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid"
165else
166 UNBOUND_PIDFILE=""
167fi
168)
169AC_SUBST(UNBOUND_PIDFILE)
170ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid)
171AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location])
172
173AC_ARG_WITH(rootkey-file,
174 AC_HELP_STRING([--with-rootkey-file=filename],
175 [set default pathname to root key file (default run-dir/root.key). This file is read and written.]),
176 UNBOUND_ROOTKEY_FILE="$withval",
177if test $on_mingw = no; then
178 UNBOUND_ROOTKEY_FILE="$UNBOUND_RUN_DIR/root.key"
179else
180 UNBOUND_ROOTKEY_FILE="C:\\Program Files\\Unbound\\root.key"
181fi
182)
183AC_SUBST(UNBOUND_ROOTKEY_FILE)
184ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTKEY_FILE, hdr_rkey)
185AC_DEFINE_UNQUOTED(ROOT_ANCHOR_FILE, ["$hdr_rkey"], [default rootkey location])
186
187AC_ARG_WITH(rootcert-file,
188 AC_HELP_STRING([--with-rootcert-file=filename],
189 [set default pathname to root update certificate file (default run-dir/icannbundle.pem). This file need not exist if you are content with the builtin.]),
190 UNBOUND_ROOTCERT_FILE="$withval",
191if test $on_mingw = no; then
192 UNBOUND_ROOTCERT_FILE="$UNBOUND_RUN_DIR/icannbundle.pem"
193else
194 UNBOUND_ROOTCERT_FILE="C:\\Program Files\\Unbound\\icannbundle.pem"
195fi
196)
197AC_SUBST(UNBOUND_ROOTCERT_FILE)
198ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTCERT_FILE, hdr_rpem)
199AC_DEFINE_UNQUOTED(ROOT_CERT_FILE, ["$hdr_rpem"], [default rootcert location])
200
201AC_ARG_WITH(username,
202 AC_HELP_STRING([--with-username=user],
203 [set default user that unbound changes to (default user is unbound)]),
204 UNBOUND_USERNAME="$withval",
205 UNBOUND_USERNAME="unbound")
206AC_SUBST(UNBOUND_USERNAME)
207AC_DEFINE_UNQUOTED(UB_USERNAME, ["$UNBOUND_USERNAME"], [default username])
208
209AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
210ACX_RSRC_VERSION(wnvs)
211AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource files])
212
213# Checks for typedefs, structures, and compiler characteristics.
214AC_C_CONST
215AC_LANG_C
216# allow user to override the -g -O2 flags.
217if test "x$CFLAGS" = "x" ; then
218ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"])
219ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"])
220fi
221AC_PROG_CC
222ACX_DEPFLAG
223ACX_DETERMINE_EXT_FLAGS_UNBOUND
224
225# debug mode flags warnings
226AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable warnings, asserts, makefile-dependencies]))
227AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [same as enable-checking]))
228if test "$enable_debug" = "yes"; then debug_enabled="$enable_debug";
229else debug_enabled="$enable_checking"; fi
230AC_SUBST(debug_enabled)
231case "$debug_enabled" in
232 yes)
233 ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
234 ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
235 ACX_CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"])
236 ACX_CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
237 AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.])
238 ;;
239 no|*)
240 # nothing to do.
241 ;;
242esac
243ACX_CHECK_FLTO
244
245AC_C_INLINE
246ACX_CHECK_FORMAT_ATTRIBUTE
247ACX_CHECK_UNUSED_ATTRIBUTE
248
249if test "$srcdir" != "."; then
250 CPPFLAGS="$CPPFLAGS -I$srcdir"
251fi
252
253AC_DEFUN([ACX_YYLEX_DESTROY], [
254 AC_MSG_CHECKING([for yylex_destroy])
255 if echo %% | $LEX -t 2>&1 | grep yylex_destroy >/dev/null 2>&1; then
256 AC_DEFINE(LEX_HAS_YYLEX_DESTROY, 1, [if lex has yylex_destroy])
257 AC_MSG_RESULT(yes)
258 else AC_MSG_RESULT(no); fi
259])
260
261AC_PROG_LEX
262ACX_YYLEX_DESTROY
263AC_PROG_YACC
264AC_CHECK_PROG(doxygen, doxygen, doxygen)
265AC_CHECK_TOOL(STRIP, strip)
266ACX_LIBTOOL_C_ONLY
267
268# Checks for header files.
265AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT])
269AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h endian.h],,, [AC_INCLUDES_DEFAULT])
266
267# check for types.
268# Using own tests for int64* because autoconf builtin only give 32bit.
269AC_CHECK_TYPE(int8_t, signed char)
270AC_CHECK_TYPE(int16_t, short)
271AC_CHECK_TYPE(int32_t, int)
272AC_CHECK_TYPE(int64_t, long long)
273AC_CHECK_TYPE(uint8_t, unsigned char)
274AC_CHECK_TYPE(uint16_t, unsigned short)
275AC_CHECK_TYPE(uint32_t, unsigned int)
276AC_CHECK_TYPE(uint64_t, unsigned long long)
277AC_TYPE_SIZE_T
278AC_CHECK_TYPE(ssize_t, int)
279AC_TYPE_UID_T
280AC_TYPE_PID_T
281AC_TYPE_OFF_T
282ACX_TYPE_U_CHAR
283ACX_TYPE_RLIM_T
284ACX_TYPE_SOCKLEN_T
285ACX_TYPE_IN_ADDR_T
286ACX_TYPE_IN_PORT_T
287ACX_CHECK_MEMCMP_SIGNED
288
289AC_CHECK_SIZEOF(time_t,,[
290AC_INCLUDES_DEFAULT
291#ifdef TIME_WITH_SYS_TIME
292# include <sys/time.h>
293# include <time.h>
294#else
295# ifdef HAVE_SYS_TIME_H
296# include <sys/time.h>
297# else
298# include <time.h>
299# endif
300#endif
301])
302
303# add option to disable the evil rpath
304ACX_ARG_RPATH
305AC_SUBST(RUNTIME_PATH)
306
307# check to see if libraries are needed for these functions.
308AC_SEARCH_LIBS([inet_pton], [nsl])
309AC_SEARCH_LIBS([socket], [socket])
310
311# check wether strptime also works
312AC_DEFUN([AC_CHECK_STRPTIME_WORKS],
313[AC_REQUIRE([AC_PROG_CC])
314AC_MSG_CHECKING(whether strptime works)
315if test c${cross_compiling} = cno; then
316AC_RUN_IFELSE([AC_LANG_SOURCE([[
270
271# check for types.
272# Using own tests for int64* because autoconf builtin only give 32bit.
273AC_CHECK_TYPE(int8_t, signed char)
274AC_CHECK_TYPE(int16_t, short)
275AC_CHECK_TYPE(int32_t, int)
276AC_CHECK_TYPE(int64_t, long long)
277AC_CHECK_TYPE(uint8_t, unsigned char)
278AC_CHECK_TYPE(uint16_t, unsigned short)
279AC_CHECK_TYPE(uint32_t, unsigned int)
280AC_CHECK_TYPE(uint64_t, unsigned long long)
281AC_TYPE_SIZE_T
282AC_CHECK_TYPE(ssize_t, int)
283AC_TYPE_UID_T
284AC_TYPE_PID_T
285AC_TYPE_OFF_T
286ACX_TYPE_U_CHAR
287ACX_TYPE_RLIM_T
288ACX_TYPE_SOCKLEN_T
289ACX_TYPE_IN_ADDR_T
290ACX_TYPE_IN_PORT_T
291ACX_CHECK_MEMCMP_SIGNED
292
293AC_CHECK_SIZEOF(time_t,,[
294AC_INCLUDES_DEFAULT
295#ifdef TIME_WITH_SYS_TIME
296# include <sys/time.h>
297# include <time.h>
298#else
299# ifdef HAVE_SYS_TIME_H
300# include <sys/time.h>
301# else
302# include <time.h>
303# endif
304#endif
305])
306
307# add option to disable the evil rpath
308ACX_ARG_RPATH
309AC_SUBST(RUNTIME_PATH)
310
311# check to see if libraries are needed for these functions.
312AC_SEARCH_LIBS([inet_pton], [nsl])
313AC_SEARCH_LIBS([socket], [socket])
314
315# check wether strptime also works
316AC_DEFUN([AC_CHECK_STRPTIME_WORKS],
317[AC_REQUIRE([AC_PROG_CC])
318AC_MSG_CHECKING(whether strptime works)
319if test c${cross_compiling} = cno; then
320AC_RUN_IFELSE([AC_LANG_SOURCE([[
317#define _XOPEN_SOURCE
321#define _XOPEN_SOURCE 600
318#include <time.h>
319int main(void) { struct tm tm; char *res;
320res = strptime("2010-07-15T00:00:00+00:00", "%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t", &tm);
321if (!res) return 2;
322res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm);
323if (!res) return 1; return 0; }
324]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"])
325else
326eval "ac_cv_c_strptime_works=maybe"
327fi
328AC_MSG_RESULT($ac_cv_c_strptime_works)
329if test $ac_cv_c_strptime_works = no; then
330AC_LIBOBJ(strptime)
331else
332AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.])
333fi
334])dnl
335
336# check some functions of the OS before linking libs (while still runnable).
337AC_FUNC_CHOWN
338AC_FUNC_FORK
339AC_TYPE_SIGNAL
340AC_FUNC_FSEEKO
341ACX_SYS_LARGEFILE
342ACX_CHECK_NONBLOCKING_BROKEN
343ACX_MKDIR_ONE_ARG
344AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])])
345
346# set memory allocation checking if requested
347AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks],
348 [ enable to memory allocation statistics, for debug purposes ]),
349 , )
350AC_ARG_ENABLE(alloc-lite, AC_HELP_STRING([--enable-alloc-lite],
351 [ enable for lightweight alloc assertions, for debug purposes ]),
352 , )
353AC_ARG_ENABLE(alloc-nonregional, AC_HELP_STRING([--enable-alloc-nonregional],
354 [ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]),
355 , )
356if test x_$enable_alloc_nonregional = x_yes; then
357 AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use])
358fi
359if test x_$enable_alloc_checks = x_yes; then
360 AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use])
361else
362 if test x_$enable_alloc_lite = x_yes; then
363 AC_DEFINE(UNBOUND_ALLOC_LITE, 1, [use to enable lightweight alloc assertions, for debug use])
364 else
365 ACX_FUNC_MALLOC([unbound])
366 fi
367fi
368
369# check windows threads (we use them, not pthreads, on windows).
370if test "$on_mingw" = "yes"; then
371# check windows threads
372 AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT])
373 AC_MSG_CHECKING([for CreateThread])
374 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
375#ifdef HAVE_WINDOWS_H
376#include <windows.h>
377#endif
378], [
379 HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
380])],
381 AC_MSG_RESULT(yes)
382 AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads])
383,
384 AC_MSG_RESULT(no)
385)
386
387else
388# not on mingw, check thread libraries.
389
390# check for thread library.
391# check this first, so that the pthread lib does not get linked in via
392# libssl or libpython, and thus distorts the tests, and we end up using
393# the non-threadsafe C libraries.
394AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads],
395 [use pthreads library, or --without-pthreads to disable threading support.]),
396 [ ],[ withval="yes" ])
397ub_have_pthreads=no
398if test x_$withval != x_no; then
399 AX_PTHREAD([
400 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
401 LIBS="$PTHREAD_LIBS $LIBS"
402 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
403 CC="$PTHREAD_CC"
404 ub_have_pthreads=yes
405 AC_CHECK_TYPES([pthread_spinlock_t, pthread_rwlock_t],,,[#include <pthread.h>])
406 ])
407fi
408
409# check solaris thread library
410AC_ARG_WITH(solaris-threads, AC_HELP_STRING([--with-solaris-threads],
411 [use solaris native thread library.]), [ ],[ withval="no" ])
412ub_have_sol_threads=no
413if test x_$withval != x_no; then
414 if test x_$ub_have_pthreads != x_no; then
415 AC_WARN([Have pthreads already, ignoring --with-solaris-threads])
416 else
417 AC_SEARCH_LIBS(thr_create, [thread],
418 [
419 AC_DEFINE(HAVE_SOLARIS_THREADS, 1, [Using Solaris threads])
420
421 ACX_CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"],
422 [CFLAGS="$CFLAGS -D_REENTRANT"])
423 ub_have_sol_threads=yes
424 ] , [
425 AC_ERROR([no solaris threads found.])
426 ])
427 fi
428fi
429
430fi # end of non-mingw check of thread libraries
431
432# Check for PyUnbound
433AC_ARG_WITH(pyunbound,
434 AC_HELP_STRING([--with-pyunbound],
435 [build PyUnbound, or --without-pyunbound to skip it. (default=no)]),
436 [], [ withval="no" ])
437
438ub_test_python=no
439ub_with_pyunbound=no
440if test x_$withval != x_no; then
441 ub_with_pyunbound=yes
442 ub_test_python=yes
443fi
444
445# Check for Python module
446AC_ARG_WITH(pythonmodule,
447 AC_HELP_STRING([--with-pythonmodule],
448 [build Python module, or --without-pythonmodule to disable script engine. (default=no)]),
449 [], [ withval="no" ])
450
451ub_with_pythonmod=no
452if test x_$withval != x_no; then
453 ub_with_pythonmod=yes
454 ub_test_python=yes
455fi
456
457# Check for Python & SWIG only on PyUnbound or PyModule
458if test x_$ub_test_python != x_no; then
459
460 # Check for Python
461 ub_have_python=no
462 ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS
463 AC_PYTHON_DEVEL
464 if test ! -z "$PYTHON_VERSION"; then
322#include <time.h>
323int main(void) { struct tm tm; char *res;
324res = strptime("2010-07-15T00:00:00+00:00", "%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t", &tm);
325if (!res) return 2;
326res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm);
327if (!res) return 1; return 0; }
328]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"])
329else
330eval "ac_cv_c_strptime_works=maybe"
331fi
332AC_MSG_RESULT($ac_cv_c_strptime_works)
333if test $ac_cv_c_strptime_works = no; then
334AC_LIBOBJ(strptime)
335else
336AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.])
337fi
338])dnl
339
340# check some functions of the OS before linking libs (while still runnable).
341AC_FUNC_CHOWN
342AC_FUNC_FORK
343AC_TYPE_SIGNAL
344AC_FUNC_FSEEKO
345ACX_SYS_LARGEFILE
346ACX_CHECK_NONBLOCKING_BROKEN
347ACX_MKDIR_ONE_ARG
348AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])])
349
350# set memory allocation checking if requested
351AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks],
352 [ enable to memory allocation statistics, for debug purposes ]),
353 , )
354AC_ARG_ENABLE(alloc-lite, AC_HELP_STRING([--enable-alloc-lite],
355 [ enable for lightweight alloc assertions, for debug purposes ]),
356 , )
357AC_ARG_ENABLE(alloc-nonregional, AC_HELP_STRING([--enable-alloc-nonregional],
358 [ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]),
359 , )
360if test x_$enable_alloc_nonregional = x_yes; then
361 AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use])
362fi
363if test x_$enable_alloc_checks = x_yes; then
364 AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use])
365else
366 if test x_$enable_alloc_lite = x_yes; then
367 AC_DEFINE(UNBOUND_ALLOC_LITE, 1, [use to enable lightweight alloc assertions, for debug use])
368 else
369 ACX_FUNC_MALLOC([unbound])
370 fi
371fi
372
373# check windows threads (we use them, not pthreads, on windows).
374if test "$on_mingw" = "yes"; then
375# check windows threads
376 AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT])
377 AC_MSG_CHECKING([for CreateThread])
378 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
379#ifdef HAVE_WINDOWS_H
380#include <windows.h>
381#endif
382], [
383 HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
384])],
385 AC_MSG_RESULT(yes)
386 AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads])
387,
388 AC_MSG_RESULT(no)
389)
390
391else
392# not on mingw, check thread libraries.
393
394# check for thread library.
395# check this first, so that the pthread lib does not get linked in via
396# libssl or libpython, and thus distorts the tests, and we end up using
397# the non-threadsafe C libraries.
398AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads],
399 [use pthreads library, or --without-pthreads to disable threading support.]),
400 [ ],[ withval="yes" ])
401ub_have_pthreads=no
402if test x_$withval != x_no; then
403 AX_PTHREAD([
404 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
405 LIBS="$PTHREAD_LIBS $LIBS"
406 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
407 CC="$PTHREAD_CC"
408 ub_have_pthreads=yes
409 AC_CHECK_TYPES([pthread_spinlock_t, pthread_rwlock_t],,,[#include <pthread.h>])
410 ])
411fi
412
413# check solaris thread library
414AC_ARG_WITH(solaris-threads, AC_HELP_STRING([--with-solaris-threads],
415 [use solaris native thread library.]), [ ],[ withval="no" ])
416ub_have_sol_threads=no
417if test x_$withval != x_no; then
418 if test x_$ub_have_pthreads != x_no; then
419 AC_WARN([Have pthreads already, ignoring --with-solaris-threads])
420 else
421 AC_SEARCH_LIBS(thr_create, [thread],
422 [
423 AC_DEFINE(HAVE_SOLARIS_THREADS, 1, [Using Solaris threads])
424
425 ACX_CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"],
426 [CFLAGS="$CFLAGS -D_REENTRANT"])
427 ub_have_sol_threads=yes
428 ] , [
429 AC_ERROR([no solaris threads found.])
430 ])
431 fi
432fi
433
434fi # end of non-mingw check of thread libraries
435
436# Check for PyUnbound
437AC_ARG_WITH(pyunbound,
438 AC_HELP_STRING([--with-pyunbound],
439 [build PyUnbound, or --without-pyunbound to skip it. (default=no)]),
440 [], [ withval="no" ])
441
442ub_test_python=no
443ub_with_pyunbound=no
444if test x_$withval != x_no; then
445 ub_with_pyunbound=yes
446 ub_test_python=yes
447fi
448
449# Check for Python module
450AC_ARG_WITH(pythonmodule,
451 AC_HELP_STRING([--with-pythonmodule],
452 [build Python module, or --without-pythonmodule to disable script engine. (default=no)]),
453 [], [ withval="no" ])
454
455ub_with_pythonmod=no
456if test x_$withval != x_no; then
457 ub_with_pythonmod=yes
458 ub_test_python=yes
459fi
460
461# Check for Python & SWIG only on PyUnbound or PyModule
462if test x_$ub_test_python != x_no; then
463
464 # Check for Python
465 ub_have_python=no
466 ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS
467 AC_PYTHON_DEVEL
468 if test ! -z "$PYTHON_VERSION"; then
465 if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then
469 if test `$PYTHON -c "print('$PYTHON_VERSION' >= '2.4.0')"` = "False"; then
466 AC_ERROR([Python version >= 2.4.0 is required])
467 fi
468
469 # Have Python
470 AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.])
471 LIBS="$PYTHON_LDFLAGS $LIBS"
472 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
473 ub_have_python=yes
474
475 # Check for SWIG
476 ub_have_swig=no
477 AC_PROG_SWIG
478 AC_MSG_CHECKING(SWIG)
479 if test ! -x "$SWIG"; then
480 AC_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound])
481 else
482 AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.])
483 AC_SUBST(swig, "$SWIG")
484 AC_MSG_RESULT(present)
485
486 # If have Python & SWIG
487 # Declare PythonMod
488 if test x_$ub_with_pythonmod != x_no; then
489 AC_DEFINE(WITH_PYTHONMODULE, 1, [Define if you want Python module.])
490 WITH_PYTHONMODULE=yes
491 AC_SUBST(WITH_PYTHONMODULE)
492 PYTHONMOD_OBJ="pythonmod.lo pythonmod_utils.lo"
493 AC_SUBST(PYTHONMOD_OBJ)
494 PYTHONMOD_HEADER='$(srcdir)/pythonmod/pythonmod.h'
495 AC_SUBST(PYTHONMOD_HEADER)
496 PYTHONMOD_INSTALL=pythonmod-install
497 AC_SUBST(PYTHONMOD_INSTALL)
498 PYTHONMOD_UNINSTALL=pythonmod-uninstall
499 AC_SUBST(PYTHONMOD_UNINSTALL)
500 fi
501
502 # Declare PyUnbound
503 if test x_$ub_with_pyunbound != x_no; then
504 AC_DEFINE(WITH_PYUNBOUND, 1, [Define if you want PyUnbound.])
505 WITH_PYUNBOUND=yes
506 AC_SUBST(WITH_PYUNBOUND)
507 PYUNBOUND_OBJ="libunbound_wrap.lo"
508 AC_SUBST(PYUNBOUND_OBJ)
509 PYUNBOUND_TARGET="_unbound.la"
510 AC_SUBST(PYUNBOUND_TARGET)
511 PYUNBOUND_INSTALL=pyunbound-install
512 AC_SUBST(PYUNBOUND_INSTALL)
513 PYUNBOUND_UNINSTALL=pyunbound-uninstall
514 AC_SUBST(PYUNBOUND_UNINSTALL)
515 fi
516 fi
517 else
518 AC_MSG_RESULT([*** Python libraries not found, won't build PythonMod or PyUnbound ***])
519 ub_with_pyunbound=no
520 ub_with_pythonmod=no
521 fi
522fi
523
524if test "`uname`" = "NetBSD"; then
525 NETBSD_LINTFLAGS='"-D__RENAME(x)=" -D_NETINET_IN_H_'
526 AC_SUBST(NETBSD_LINTFLAGS)
527fi
528CONFIG_DATE=`date +%Y%m%d`
529AC_SUBST(CONFIG_DATE)
530
531# Checks for libraries.
532
533# libnss
534USE_NSS="no"
535AC_ARG_WITH([nss], AC_HELP_STRING([--with-nss=path],
536 [use libnss instead of openssl, installed at path.]),
537 [
538 USE_NSS="yes"
539 AC_DEFINE(HAVE_NSS, 1, [Use libnss for crypto])
540 if test "$withval" != "" -a "$withval" != "yes"; then
541 CPPFLAGS="$CPPFLAGS -I$withval/include/nss3"
542 LDFLAGS="$LDFLAGS -L$withval/lib"
543 ACX_RUNTIME_PATH_ADD([$withval/lib])
544 CPPFLAGS="-I$withval/include/nspr4 $CPPFLAGS"
545 else
546 CPPFLAGS="$CPPFLAGS -I/usr/include/nss3"
547 CPPFLAGS="-I/usr/include/nspr4 $CPPFLAGS"
548 fi
549 LIBS="$LIBS -lnss3 -lnspr4"
550 ]
551)
552
553# openssl
554if test $USE_NSS = "no"; then
555ACX_WITH_SSL
556ACX_LIB_SSL
470 AC_ERROR([Python version >= 2.4.0 is required])
471 fi
472
473 # Have Python
474 AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.])
475 LIBS="$PYTHON_LDFLAGS $LIBS"
476 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
477 ub_have_python=yes
478
479 # Check for SWIG
480 ub_have_swig=no
481 AC_PROG_SWIG
482 AC_MSG_CHECKING(SWIG)
483 if test ! -x "$SWIG"; then
484 AC_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound])
485 else
486 AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.])
487 AC_SUBST(swig, "$SWIG")
488 AC_MSG_RESULT(present)
489
490 # If have Python & SWIG
491 # Declare PythonMod
492 if test x_$ub_with_pythonmod != x_no; then
493 AC_DEFINE(WITH_PYTHONMODULE, 1, [Define if you want Python module.])
494 WITH_PYTHONMODULE=yes
495 AC_SUBST(WITH_PYTHONMODULE)
496 PYTHONMOD_OBJ="pythonmod.lo pythonmod_utils.lo"
497 AC_SUBST(PYTHONMOD_OBJ)
498 PYTHONMOD_HEADER='$(srcdir)/pythonmod/pythonmod.h'
499 AC_SUBST(PYTHONMOD_HEADER)
500 PYTHONMOD_INSTALL=pythonmod-install
501 AC_SUBST(PYTHONMOD_INSTALL)
502 PYTHONMOD_UNINSTALL=pythonmod-uninstall
503 AC_SUBST(PYTHONMOD_UNINSTALL)
504 fi
505
506 # Declare PyUnbound
507 if test x_$ub_with_pyunbound != x_no; then
508 AC_DEFINE(WITH_PYUNBOUND, 1, [Define if you want PyUnbound.])
509 WITH_PYUNBOUND=yes
510 AC_SUBST(WITH_PYUNBOUND)
511 PYUNBOUND_OBJ="libunbound_wrap.lo"
512 AC_SUBST(PYUNBOUND_OBJ)
513 PYUNBOUND_TARGET="_unbound.la"
514 AC_SUBST(PYUNBOUND_TARGET)
515 PYUNBOUND_INSTALL=pyunbound-install
516 AC_SUBST(PYUNBOUND_INSTALL)
517 PYUNBOUND_UNINSTALL=pyunbound-uninstall
518 AC_SUBST(PYUNBOUND_UNINSTALL)
519 fi
520 fi
521 else
522 AC_MSG_RESULT([*** Python libraries not found, won't build PythonMod or PyUnbound ***])
523 ub_with_pyunbound=no
524 ub_with_pythonmod=no
525 fi
526fi
527
528if test "`uname`" = "NetBSD"; then
529 NETBSD_LINTFLAGS='"-D__RENAME(x)=" -D_NETINET_IN_H_'
530 AC_SUBST(NETBSD_LINTFLAGS)
531fi
532CONFIG_DATE=`date +%Y%m%d`
533AC_SUBST(CONFIG_DATE)
534
535# Checks for libraries.
536
537# libnss
538USE_NSS="no"
539AC_ARG_WITH([nss], AC_HELP_STRING([--with-nss=path],
540 [use libnss instead of openssl, installed at path.]),
541 [
542 USE_NSS="yes"
543 AC_DEFINE(HAVE_NSS, 1, [Use libnss for crypto])
544 if test "$withval" != "" -a "$withval" != "yes"; then
545 CPPFLAGS="$CPPFLAGS -I$withval/include/nss3"
546 LDFLAGS="$LDFLAGS -L$withval/lib"
547 ACX_RUNTIME_PATH_ADD([$withval/lib])
548 CPPFLAGS="-I$withval/include/nspr4 $CPPFLAGS"
549 else
550 CPPFLAGS="$CPPFLAGS -I/usr/include/nss3"
551 CPPFLAGS="-I/usr/include/nspr4 $CPPFLAGS"
552 fi
553 LIBS="$LIBS -lnss3 -lnspr4"
554 ]
555)
556
557# openssl
558if test $USE_NSS = "no"; then
559ACX_WITH_SSL
560ACX_LIB_SSL
561AC_MSG_CHECKING([for LibreSSL])
562if grep OPENSSL_VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "LibreSSL" >/dev/null; then
563 AC_MSG_RESULT([yes])
564 AC_DEFINE([HAVE_LIBRESSL], [1], [Define if we have LibreSSL])
565 # libressl provides these compat functions, but they may also be
566 # declared by the OS in libc. See if they have been declared.
567 AC_CHECK_DECLS([strlcpy,strlcat,arc4random,arc4random_uniform])
568else
569 AC_MSG_RESULT([no])
570fi
557AC_CHECK_HEADERS([openssl/conf.h],,, [AC_INCLUDES_DEFAULT])
558AC_CHECK_HEADERS([openssl/engine.h],,, [AC_INCLUDES_DEFAULT])
559AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode])
560AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free], [], [], [
561AC_INCLUDES_DEFAULT
562#ifdef HAVE_OPENSSL_ERR_H
563#include <openssl/err.h>
564#endif
565
566#ifdef HAVE_OPENSSL_RAND_H
567#include <openssl/rand.h>
568#endif
569
570#ifdef HAVE_OPENSSL_CONF_H
571#include <openssl/conf.h>
572#endif
573
574#ifdef HAVE_OPENSSL_ENGINE_H
575#include <openssl/engine.h>
576#endif
577#include <openssl/ssl.h>
578#include <openssl/evp.h>
579])
580fi
581
582
583AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support]))
584case "$enable_sha2" in
585 no)
586 ;;
587 yes|*)
588 AC_DEFINE([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.])
589 ;;
590esac
591
592# check wether gost also works
593AC_DEFUN([AC_CHECK_GOST_WORKS],
594[AC_REQUIRE([AC_PROG_CC])
595AC_MSG_CHECKING([if GOST works])
596if test c${cross_compiling} = cno; then
597BAKCFLAGS="$CFLAGS"
598if test -n "$ssldir"; then
599 CFLAGS="$CFLAGS -Wl,-rpath,$ssldir/lib"
600fi
601AC_RUN_IFELSE([AC_LANG_SOURCE([[
602#include <string.h>
603#include <openssl/ssl.h>
604#include <openssl/evp.h>
605#include <openssl/engine.h>
606#include <openssl/conf.h>
607/* routine to load gost (from sldns) */
608int load_gost_id(void)
609{
610 static int gost_id = 0;
611 const EVP_PKEY_ASN1_METHOD* meth;
612 ENGINE* e;
613
614 if(gost_id) return gost_id;
615
616 /* see if configuration loaded gost implementation from other engine*/
617 meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1);
618 if(meth) {
619 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
620 return gost_id;
621 }
622
623 /* see if engine can be loaded already */
624 e = ENGINE_by_id("gost");
625 if(!e) {
626 /* load it ourself, in case statically linked */
627 ENGINE_load_builtin_engines();
628 ENGINE_load_dynamic();
629 e = ENGINE_by_id("gost");
630 }
631 if(!e) {
632 /* no gost engine in openssl */
633 return 0;
634 }
635 if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
636 ENGINE_finish(e);
637 ENGINE_free(e);
638 return 0;
639 }
640
641 meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1);
642 if(!meth) {
643 /* algo not found */
644 ENGINE_finish(e);
645 ENGINE_free(e);
646 return 0;
647 }
648 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
649 return gost_id;
650}
651int main(void) {
652 EVP_MD_CTX* ctx;
653 const EVP_MD* md;
654 unsigned char digest[64]; /* its a 256-bit digest, so uses 32 bytes */
655 const char* str = "Hello world";
656 const unsigned char check[] = {
657 0x40 , 0xed , 0xf8 , 0x56 , 0x5a , 0xc5 , 0x36 , 0xe1 ,
658 0x33 , 0x7c , 0x7e , 0x87 , 0x62 , 0x1c , 0x42 , 0xe0 ,
659 0x17 , 0x1b , 0x5e , 0xce , 0xa8 , 0x46 , 0x65 , 0x4d ,
660 0x8d , 0x3e , 0x22 , 0x9b , 0xe1 , 0x30 , 0x19 , 0x9d
661 };
662 OPENSSL_config(NULL);
663 (void)load_gost_id();
664 md = EVP_get_digestbyname("md_gost94");
665 if(!md) return 1;
666 memset(digest, 0, sizeof(digest));
667 ctx = EVP_MD_CTX_create();
668 if(!ctx) return 2;
669 if(!EVP_DigestInit_ex(ctx, md, NULL)) return 3;
670 if(!EVP_DigestUpdate(ctx, str, 10)) return 4;
671 if(!EVP_DigestFinal_ex(ctx, digest, NULL)) return 5;
672 /* uncomment to see the hash calculated.
673 {int i;
674 for(i=0; i<32; i++)
675 printf(" %2.2x", (int)digest[i]);
676 printf("\n");}
677 */
678 if(memcmp(digest, check, sizeof(check)) != 0)
679 return 6;
680 return 0;
681}
682]])] , [eval "ac_cv_c_gost_works=yes"], [eval "ac_cv_c_gost_works=no"])
683CFLAGS="$BAKCFLAGS"
684else
685eval "ac_cv_c_gost_works=maybe"
686fi
687AC_MSG_RESULT($ac_cv_c_gost_works)
688])dnl
689
690AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support]))
691use_gost="no"
692if test $USE_NSS = "no"; then
693case "$enable_gost" in
694 no)
695 ;;
696 *)
697 AC_CHECK_FUNC(EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL 1.0.0 is needed for GOST support])])
698 AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([OpenSSL does not support ECC, needed for GOST support])])
699 AC_CHECK_GOST_WORKS
700 if test "$ac_cv_c_gost_works" != no; then
701 use_gost="yes"
702 AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.])
703 fi
704 ;;
705esac
706fi dnl !USE_NSS
707
708AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--disable-ecdsa], [Disable ECDSA support]))
709use_ecdsa="no"
710case "$enable_ecdsa" in
711 no)
712 ;;
713 *)
714 if test $USE_NSS = "no"; then
715 AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa])])
716 AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade or rerun with --disable-ecdsa])])
717 AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [], [AC_MSG_ERROR([OpenSSL does not support the ECDSA curves: please upgrade or rerun with --disable-ecdsa])], [AC_INCLUDES_DEFAULT
718#include <openssl/evp.h>
719 ])
720 # see if OPENSSL 1.0.0 or later (has EVP MD and Verify independency)
721 AC_MSG_CHECKING([if openssl supports SHA2 and ECDSA with EVP])
571AC_CHECK_HEADERS([openssl/conf.h],,, [AC_INCLUDES_DEFAULT])
572AC_CHECK_HEADERS([openssl/engine.h],,, [AC_INCLUDES_DEFAULT])
573AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode])
574AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free], [], [], [
575AC_INCLUDES_DEFAULT
576#ifdef HAVE_OPENSSL_ERR_H
577#include <openssl/err.h>
578#endif
579
580#ifdef HAVE_OPENSSL_RAND_H
581#include <openssl/rand.h>
582#endif
583
584#ifdef HAVE_OPENSSL_CONF_H
585#include <openssl/conf.h>
586#endif
587
588#ifdef HAVE_OPENSSL_ENGINE_H
589#include <openssl/engine.h>
590#endif
591#include <openssl/ssl.h>
592#include <openssl/evp.h>
593])
594fi
595
596
597AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support]))
598case "$enable_sha2" in
599 no)
600 ;;
601 yes|*)
602 AC_DEFINE([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.])
603 ;;
604esac
605
606# check wether gost also works
607AC_DEFUN([AC_CHECK_GOST_WORKS],
608[AC_REQUIRE([AC_PROG_CC])
609AC_MSG_CHECKING([if GOST works])
610if test c${cross_compiling} = cno; then
611BAKCFLAGS="$CFLAGS"
612if test -n "$ssldir"; then
613 CFLAGS="$CFLAGS -Wl,-rpath,$ssldir/lib"
614fi
615AC_RUN_IFELSE([AC_LANG_SOURCE([[
616#include <string.h>
617#include <openssl/ssl.h>
618#include <openssl/evp.h>
619#include <openssl/engine.h>
620#include <openssl/conf.h>
621/* routine to load gost (from sldns) */
622int load_gost_id(void)
623{
624 static int gost_id = 0;
625 const EVP_PKEY_ASN1_METHOD* meth;
626 ENGINE* e;
627
628 if(gost_id) return gost_id;
629
630 /* see if configuration loaded gost implementation from other engine*/
631 meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1);
632 if(meth) {
633 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
634 return gost_id;
635 }
636
637 /* see if engine can be loaded already */
638 e = ENGINE_by_id("gost");
639 if(!e) {
640 /* load it ourself, in case statically linked */
641 ENGINE_load_builtin_engines();
642 ENGINE_load_dynamic();
643 e = ENGINE_by_id("gost");
644 }
645 if(!e) {
646 /* no gost engine in openssl */
647 return 0;
648 }
649 if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
650 ENGINE_finish(e);
651 ENGINE_free(e);
652 return 0;
653 }
654
655 meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1);
656 if(!meth) {
657 /* algo not found */
658 ENGINE_finish(e);
659 ENGINE_free(e);
660 return 0;
661 }
662 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
663 return gost_id;
664}
665int main(void) {
666 EVP_MD_CTX* ctx;
667 const EVP_MD* md;
668 unsigned char digest[64]; /* its a 256-bit digest, so uses 32 bytes */
669 const char* str = "Hello world";
670 const unsigned char check[] = {
671 0x40 , 0xed , 0xf8 , 0x56 , 0x5a , 0xc5 , 0x36 , 0xe1 ,
672 0x33 , 0x7c , 0x7e , 0x87 , 0x62 , 0x1c , 0x42 , 0xe0 ,
673 0x17 , 0x1b , 0x5e , 0xce , 0xa8 , 0x46 , 0x65 , 0x4d ,
674 0x8d , 0x3e , 0x22 , 0x9b , 0xe1 , 0x30 , 0x19 , 0x9d
675 };
676 OPENSSL_config(NULL);
677 (void)load_gost_id();
678 md = EVP_get_digestbyname("md_gost94");
679 if(!md) return 1;
680 memset(digest, 0, sizeof(digest));
681 ctx = EVP_MD_CTX_create();
682 if(!ctx) return 2;
683 if(!EVP_DigestInit_ex(ctx, md, NULL)) return 3;
684 if(!EVP_DigestUpdate(ctx, str, 10)) return 4;
685 if(!EVP_DigestFinal_ex(ctx, digest, NULL)) return 5;
686 /* uncomment to see the hash calculated.
687 {int i;
688 for(i=0; i<32; i++)
689 printf(" %2.2x", (int)digest[i]);
690 printf("\n");}
691 */
692 if(memcmp(digest, check, sizeof(check)) != 0)
693 return 6;
694 return 0;
695}
696]])] , [eval "ac_cv_c_gost_works=yes"], [eval "ac_cv_c_gost_works=no"])
697CFLAGS="$BAKCFLAGS"
698else
699eval "ac_cv_c_gost_works=maybe"
700fi
701AC_MSG_RESULT($ac_cv_c_gost_works)
702])dnl
703
704AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support]))
705use_gost="no"
706if test $USE_NSS = "no"; then
707case "$enable_gost" in
708 no)
709 ;;
710 *)
711 AC_CHECK_FUNC(EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL 1.0.0 is needed for GOST support])])
712 AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([OpenSSL does not support ECC, needed for GOST support])])
713 AC_CHECK_GOST_WORKS
714 if test "$ac_cv_c_gost_works" != no; then
715 use_gost="yes"
716 AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.])
717 fi
718 ;;
719esac
720fi dnl !USE_NSS
721
722AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--disable-ecdsa], [Disable ECDSA support]))
723use_ecdsa="no"
724case "$enable_ecdsa" in
725 no)
726 ;;
727 *)
728 if test $USE_NSS = "no"; then
729 AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa])])
730 AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade or rerun with --disable-ecdsa])])
731 AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [], [AC_MSG_ERROR([OpenSSL does not support the ECDSA curves: please upgrade or rerun with --disable-ecdsa])], [AC_INCLUDES_DEFAULT
732#include <openssl/evp.h>
733 ])
734 # see if OPENSSL 1.0.0 or later (has EVP MD and Verify independency)
735 AC_MSG_CHECKING([if openssl supports SHA2 and ECDSA with EVP])
722 if grep OPENSSL_VERSION_NUMBER $ssldir/include/openssl/opensslv.h | grep 0x0 >/dev/null; then
723 AC_MSG_RESULT([no])
724 AC_DEFINE_UNQUOTED([USE_ECDSA_EVP_WORKAROUND], [1], [Define this to enable an EVP workaround for older openssl])
736 if grep OPENSSL_VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "OpenSSL" >/dev/null; then
737 if grep OPENSSL_VERSION_NUMBER $ssldir/include/openssl/opensslv.h | grep 0x0 >/dev/null; then
738 AC_MSG_RESULT([no])
739 AC_DEFINE_UNQUOTED([USE_ECDSA_EVP_WORKAROUND], [1], [Define this to enable an EVP workaround for older openssl])
740 else
741 AC_MSG_RESULT([yes])
742 fi
725 else
743 else
744 # not OpenSSL, thus likely LibreSSL, which supports it
726 AC_MSG_RESULT([yes])
727 fi
728 fi
729 # we now know we have ECDSA and the required curves.
730 AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.])
731 use_ecdsa="yes"
732 ;;
733esac
734
735AC_ARG_ENABLE(event-api, AC_HELP_STRING([--enable-event-api], [Enable (experimental) libevent-based libunbound API installed to unbound-event.h]))
736use_unbound_event="no"
737case "$enable_event_api" in
738 yes)
739 use_unbound_event="yes"
740 ;;
741 *)
742 ;;
743esac
744
745# check for libevent
746AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname],
747 [use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path). Slower, but allows use of large outgoing port ranges.]),
748 [ ],[ withval="no" ])
749if test x_$withval = x_yes -o x_$withval != x_no; then
750 AC_MSG_CHECKING(for libevent)
751 if test x_$withval = x_ -o x_$withval = x_yes; then
752 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
753 fi
754 for dir in $withval; do
755 thedir="$dir"
756 if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then
757 found_libevent="yes"
758 dnl assume /usr is in default path.
759 if test "$thedir" != "/usr"; then
760 CPPFLAGS="$CPPFLAGS -I$thedir/include"
761 fi
762 break;
763 fi
764 done
765 if test x_$found_libevent != x_yes; then
766 if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then
767 # libevent source directory
768 AC_MSG_RESULT(found in $thedir)
769 CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include"
770 BAK_LDFLAGS_SET="1"
771 BAK_LDFLAGS="$LDFLAGS"
772 # remove evdns from linking
773 mkdir build >/dev/null 2>&1
774 mkdir build/libevent >/dev/null 2>&1
775 mkdir build/libevent/.libs >/dev/null 2>&1
776 ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
777 ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo | grep -v bufferevent_openssl\.lo`
778 ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
779 cp $ev_files_o build/libevent
780 cp $ev_files_lo build/libevent
781 cp $ev_files_libso build/libevent/.libs
782 LATE_LDFLAGS="build/libevent/*.lo -lm"
783 LDFLAGS="build/libevent/*.o $LDFLAGS -lm"
784 else
785 AC_MSG_ERROR([Cannot find the libevent library in $withval
786You can restart ./configure --with-libevent=no to use a builtin alternative.
787Please note that this alternative is not as capable as libevent when using
788large outgoing port ranges. ])
789 fi
790 else
791 AC_MSG_RESULT(found in $thedir)
792 dnl if event2 exists and no event lib in dir itself, use subdir
793 if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then
794 LDFLAGS="$LDFLAGS -L$thedir/lib/event2"
795 ACX_RUNTIME_PATH_ADD([$thedir/lib/event2])
796 else
797 dnl assume /usr is in default path, do not add "".
798 if test "$thedir" != "/usr" -a "$thedir" != ""; then
799 LDFLAGS="$LDFLAGS -L$thedir/lib"
800 ACX_RUNTIME_PATH_ADD([$thedir/lib])
801 fi
802 fi
803 fi
804 # check for library used by libevent after 1.3c
805 AC_SEARCH_LIBS([clock_gettime], [rt])
806
807 # is the event.h header libev or libevent?
808 AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT])
809 AC_CHECK_DECL(EV_VERSION_MAJOR, [
810 AC_SEARCH_LIBS(event_set, [ev])
811 ],[
812 AC_SEARCH_LIBS(event_set, [event])
813 ],[AC_INCLUDES_DEFAULT
814#include <event.h>
815 ])
816 AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
817 AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later
818 AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later
819 AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later
820 AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51)
821 AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00)
822 if test -n "$BAK_LDFLAGS_SET"; then
823 LDFLAGS="$BAK_LDFLAGS"
824 fi
825 if test "$use_unbound_event" = "yes"; then
826 AC_SUBST(UNBOUND_EVENT_INSTALL, [unbound-event-install])
827 AC_SUBST(UNBOUND_EVENT_UNINSTALL, [unbound-event-uninstall])
828 fi
829else
830 AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events])
831fi
832
833# check for libexpat
834AC_ARG_WITH(libexpat, AC_HELP_STRING([--with-libexpat=path],
835 [specify explicit path for libexpat.]),
836 [ ],[ withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" ])
837AC_MSG_CHECKING(for libexpat)
838found_libexpat="no"
839for dir in $withval ; do
840 if test -f "$dir/include/expat.h"; then
841 found_libexpat="yes"
842 dnl assume /usr is in default path.
843 if test "$dir" != "/usr"; then
844 CPPFLAGS="$CPPFLAGS -I$dir/include"
845 LDFLAGS="$LDFLAGS -L$dir/lib"
846 fi
847 AC_MSG_RESULT(found in $dir)
848 break;
849 fi
850done
851if test x_$found_libexpat != x_yes; then
852 AC_ERROR([Could not find libexpat, expat.h])
853fi
854AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT])
855
856# set static linking if requested
857AC_SUBST(staticexe)
858staticexe=""
859AC_ARG_ENABLE(static-exe, AC_HELP_STRING([--enable-static-exe],
860 [ enable to compile executables statically against (event) libs, for debug purposes ]),
861 , )
862if test x_$enable_static_exe = x_yes; then
863 staticexe="-static"
864 if test "$on_mingw" = yes; then
865 staticexe="-all-static"
866 # for static crosscompile, include gdi32 and zlib here.
867 if test "`uname`" = "Linux"; then
868 LIBS="$LIBS -lgdi32 -lz"
869 fi
870 fi
871fi
872
873# set lock checking if requested
874AC_ARG_ENABLE(lock_checks, AC_HELP_STRING([--enable-lock-checks],
875 [ enable to check lock and unlock calls, for debug purposes ]),
876 , )
877if test x_$enable_lock_checks = x_yes; then
878 AC_DEFINE(ENABLE_LOCK_CHECKS, 1, [Define if you want to use debug lock checking (slow).])
879 CHECKLOCK_OBJ="checklocks.lo"
880 AC_SUBST(CHECKLOCK_OBJ)
881fi
882
883ACX_CHECK_GETADDRINFO_WITH_INCLUDES
884if test "$USE_WINSOCK" = 1; then
885 AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API])
886 AC_CHECK_HEADERS([iphlpapi.h],,, [AC_INCLUDES_DEFAULT
887#include <windows.h>
888 ])
889 AC_CHECK_TOOL(WINDRES, windres)
890 LIBS="$LIBS -liphlpapi"
891 WINAPPS="unbound-service-install.exe unbound-service-remove.exe anchor-update.exe"
892 AC_SUBST(WINAPPS)
893 WIN_DAEMON_SRC="winrc/win_svc.c winrc/w_inst.c"
894 AC_SUBST(WIN_DAEMON_SRC)
895 WIN_DAEMON_OBJ="win_svc.lo w_inst.lo"
896 AC_SUBST(WIN_DAEMON_OBJ)
897 WIN_DAEMON_OBJ_LINK="rsrc_unbound.o"
898 AC_SUBST(WIN_DAEMON_OBJ_LINK)
899 WIN_HOST_OBJ_LINK="rsrc_unbound_host.o"
900 AC_SUBST(WIN_HOST_OBJ_LINK)
901 WIN_UBANCHOR_OBJ_LINK="rsrc_unbound_anchor.o log.lo locks.lo"
902 AC_SUBST(WIN_UBANCHOR_OBJ_LINK)
903 WIN_CONTROL_OBJ_LINK="rsrc_unbound_control.o"
904 AC_SUBST(WIN_CONTROL_OBJ_LINK)
905 WIN_CHECKCONF_OBJ_LINK="rsrc_unbound_checkconf.o"
906 AC_SUBST(WIN_CHECKCONF_OBJ_LINK)
907fi
908if test $ac_cv_func_getaddrinfo = no; then
909 AC_LIBOBJ([fake-rfc2553])
910fi
911# check after getaddrinfo for its libraries
912ACX_FUNC_IOCTLSOCKET
913
914# see if daemon(3) exists, and if it is deprecated.
915AC_CHECK_FUNCS([daemon])
916if test $ac_cv_func_daemon = yes; then
917 ACX_FUNC_DEPRECATED([daemon], [(void)daemon(0, 0);], [
918#include <stdlib.h>
919])
920fi
921
922AC_CHECK_MEMBERS([struct in_pktinfo.ipi_spec_dst],,,[
923AC_INCLUDES_DEFAULT
924#if HAVE_SYS_PARAM_H
925#include <sys/param.h>
926#endif
927
928#ifdef HAVE_SYS_SOCKET_H
929#include <sys/socket.h>
930#endif
931
932#ifdef HAVE_SYS_UIO_H
933#include <sys/uio.h>
934#endif
935
936#ifdef HAVE_NETINET_IN_H
937#include <netinet/in.h>
938#endif
939
940#ifdef HAVE_ARPA_INET_H
941#include <arpa/inet.h>
942#endif
943
944#ifdef HAVE_WINSOCK2_H
945#include <winsock2.h>
946#endif
947
948#ifdef HAVE_WS2TCPIP_H
949#include <ws2tcpip.h>
950#endif
951])
952AC_SEARCH_LIBS([setusercontext], [util])
953AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent])
954AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])
955AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])
956
957# check if setreuid en setregid fail, on MacOSX10.4(darwin8).
958if echo $build_os | grep darwin8 > /dev/null; then
959 AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
960fi
961AC_REPLACE_FUNCS(inet_aton)
962AC_REPLACE_FUNCS(inet_pton)
963AC_REPLACE_FUNCS(inet_ntop)
964AC_REPLACE_FUNCS(snprintf)
965AC_REPLACE_FUNCS(strlcat)
966AC_REPLACE_FUNCS(strlcpy)
967AC_REPLACE_FUNCS(memmove)
968AC_REPLACE_FUNCS(gmtime_r)
745 AC_MSG_RESULT([yes])
746 fi
747 fi
748 # we now know we have ECDSA and the required curves.
749 AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.])
750 use_ecdsa="yes"
751 ;;
752esac
753
754AC_ARG_ENABLE(event-api, AC_HELP_STRING([--enable-event-api], [Enable (experimental) libevent-based libunbound API installed to unbound-event.h]))
755use_unbound_event="no"
756case "$enable_event_api" in
757 yes)
758 use_unbound_event="yes"
759 ;;
760 *)
761 ;;
762esac
763
764# check for libevent
765AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname],
766 [use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path). Slower, but allows use of large outgoing port ranges.]),
767 [ ],[ withval="no" ])
768if test x_$withval = x_yes -o x_$withval != x_no; then
769 AC_MSG_CHECKING(for libevent)
770 if test x_$withval = x_ -o x_$withval = x_yes; then
771 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
772 fi
773 for dir in $withval; do
774 thedir="$dir"
775 if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then
776 found_libevent="yes"
777 dnl assume /usr is in default path.
778 if test "$thedir" != "/usr"; then
779 CPPFLAGS="$CPPFLAGS -I$thedir/include"
780 fi
781 break;
782 fi
783 done
784 if test x_$found_libevent != x_yes; then
785 if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then
786 # libevent source directory
787 AC_MSG_RESULT(found in $thedir)
788 CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include"
789 BAK_LDFLAGS_SET="1"
790 BAK_LDFLAGS="$LDFLAGS"
791 # remove evdns from linking
792 mkdir build >/dev/null 2>&1
793 mkdir build/libevent >/dev/null 2>&1
794 mkdir build/libevent/.libs >/dev/null 2>&1
795 ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
796 ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo | grep -v bufferevent_openssl\.lo`
797 ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
798 cp $ev_files_o build/libevent
799 cp $ev_files_lo build/libevent
800 cp $ev_files_libso build/libevent/.libs
801 LATE_LDFLAGS="build/libevent/*.lo -lm"
802 LDFLAGS="build/libevent/*.o $LDFLAGS -lm"
803 else
804 AC_MSG_ERROR([Cannot find the libevent library in $withval
805You can restart ./configure --with-libevent=no to use a builtin alternative.
806Please note that this alternative is not as capable as libevent when using
807large outgoing port ranges. ])
808 fi
809 else
810 AC_MSG_RESULT(found in $thedir)
811 dnl if event2 exists and no event lib in dir itself, use subdir
812 if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then
813 LDFLAGS="$LDFLAGS -L$thedir/lib/event2"
814 ACX_RUNTIME_PATH_ADD([$thedir/lib/event2])
815 else
816 dnl assume /usr is in default path, do not add "".
817 if test "$thedir" != "/usr" -a "$thedir" != ""; then
818 LDFLAGS="$LDFLAGS -L$thedir/lib"
819 ACX_RUNTIME_PATH_ADD([$thedir/lib])
820 fi
821 fi
822 fi
823 # check for library used by libevent after 1.3c
824 AC_SEARCH_LIBS([clock_gettime], [rt])
825
826 # is the event.h header libev or libevent?
827 AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT])
828 AC_CHECK_DECL(EV_VERSION_MAJOR, [
829 AC_SEARCH_LIBS(event_set, [ev])
830 ],[
831 AC_SEARCH_LIBS(event_set, [event])
832 ],[AC_INCLUDES_DEFAULT
833#include <event.h>
834 ])
835 AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
836 AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later
837 AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later
838 AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later
839 AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51)
840 AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00)
841 if test -n "$BAK_LDFLAGS_SET"; then
842 LDFLAGS="$BAK_LDFLAGS"
843 fi
844 if test "$use_unbound_event" = "yes"; then
845 AC_SUBST(UNBOUND_EVENT_INSTALL, [unbound-event-install])
846 AC_SUBST(UNBOUND_EVENT_UNINSTALL, [unbound-event-uninstall])
847 fi
848else
849 AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events])
850fi
851
852# check for libexpat
853AC_ARG_WITH(libexpat, AC_HELP_STRING([--with-libexpat=path],
854 [specify explicit path for libexpat.]),
855 [ ],[ withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" ])
856AC_MSG_CHECKING(for libexpat)
857found_libexpat="no"
858for dir in $withval ; do
859 if test -f "$dir/include/expat.h"; then
860 found_libexpat="yes"
861 dnl assume /usr is in default path.
862 if test "$dir" != "/usr"; then
863 CPPFLAGS="$CPPFLAGS -I$dir/include"
864 LDFLAGS="$LDFLAGS -L$dir/lib"
865 fi
866 AC_MSG_RESULT(found in $dir)
867 break;
868 fi
869done
870if test x_$found_libexpat != x_yes; then
871 AC_ERROR([Could not find libexpat, expat.h])
872fi
873AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT])
874
875# set static linking if requested
876AC_SUBST(staticexe)
877staticexe=""
878AC_ARG_ENABLE(static-exe, AC_HELP_STRING([--enable-static-exe],
879 [ enable to compile executables statically against (event) libs, for debug purposes ]),
880 , )
881if test x_$enable_static_exe = x_yes; then
882 staticexe="-static"
883 if test "$on_mingw" = yes; then
884 staticexe="-all-static"
885 # for static crosscompile, include gdi32 and zlib here.
886 if test "`uname`" = "Linux"; then
887 LIBS="$LIBS -lgdi32 -lz"
888 fi
889 fi
890fi
891
892# set lock checking if requested
893AC_ARG_ENABLE(lock_checks, AC_HELP_STRING([--enable-lock-checks],
894 [ enable to check lock and unlock calls, for debug purposes ]),
895 , )
896if test x_$enable_lock_checks = x_yes; then
897 AC_DEFINE(ENABLE_LOCK_CHECKS, 1, [Define if you want to use debug lock checking (slow).])
898 CHECKLOCK_OBJ="checklocks.lo"
899 AC_SUBST(CHECKLOCK_OBJ)
900fi
901
902ACX_CHECK_GETADDRINFO_WITH_INCLUDES
903if test "$USE_WINSOCK" = 1; then
904 AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API])
905 AC_CHECK_HEADERS([iphlpapi.h],,, [AC_INCLUDES_DEFAULT
906#include <windows.h>
907 ])
908 AC_CHECK_TOOL(WINDRES, windres)
909 LIBS="$LIBS -liphlpapi"
910 WINAPPS="unbound-service-install.exe unbound-service-remove.exe anchor-update.exe"
911 AC_SUBST(WINAPPS)
912 WIN_DAEMON_SRC="winrc/win_svc.c winrc/w_inst.c"
913 AC_SUBST(WIN_DAEMON_SRC)
914 WIN_DAEMON_OBJ="win_svc.lo w_inst.lo"
915 AC_SUBST(WIN_DAEMON_OBJ)
916 WIN_DAEMON_OBJ_LINK="rsrc_unbound.o"
917 AC_SUBST(WIN_DAEMON_OBJ_LINK)
918 WIN_HOST_OBJ_LINK="rsrc_unbound_host.o"
919 AC_SUBST(WIN_HOST_OBJ_LINK)
920 WIN_UBANCHOR_OBJ_LINK="rsrc_unbound_anchor.o log.lo locks.lo"
921 AC_SUBST(WIN_UBANCHOR_OBJ_LINK)
922 WIN_CONTROL_OBJ_LINK="rsrc_unbound_control.o"
923 AC_SUBST(WIN_CONTROL_OBJ_LINK)
924 WIN_CHECKCONF_OBJ_LINK="rsrc_unbound_checkconf.o"
925 AC_SUBST(WIN_CHECKCONF_OBJ_LINK)
926fi
927if test $ac_cv_func_getaddrinfo = no; then
928 AC_LIBOBJ([fake-rfc2553])
929fi
930# check after getaddrinfo for its libraries
931ACX_FUNC_IOCTLSOCKET
932
933# see if daemon(3) exists, and if it is deprecated.
934AC_CHECK_FUNCS([daemon])
935if test $ac_cv_func_daemon = yes; then
936 ACX_FUNC_DEPRECATED([daemon], [(void)daemon(0, 0);], [
937#include <stdlib.h>
938])
939fi
940
941AC_CHECK_MEMBERS([struct in_pktinfo.ipi_spec_dst],,,[
942AC_INCLUDES_DEFAULT
943#if HAVE_SYS_PARAM_H
944#include <sys/param.h>
945#endif
946
947#ifdef HAVE_SYS_SOCKET_H
948#include <sys/socket.h>
949#endif
950
951#ifdef HAVE_SYS_UIO_H
952#include <sys/uio.h>
953#endif
954
955#ifdef HAVE_NETINET_IN_H
956#include <netinet/in.h>
957#endif
958
959#ifdef HAVE_ARPA_INET_H
960#include <arpa/inet.h>
961#endif
962
963#ifdef HAVE_WINSOCK2_H
964#include <winsock2.h>
965#endif
966
967#ifdef HAVE_WS2TCPIP_H
968#include <ws2tcpip.h>
969#endif
970])
971AC_SEARCH_LIBS([setusercontext], [util])
972AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent])
973AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])
974AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])
975
976# check if setreuid en setregid fail, on MacOSX10.4(darwin8).
977if echo $build_os | grep darwin8 > /dev/null; then
978 AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
979fi
980AC_REPLACE_FUNCS(inet_aton)
981AC_REPLACE_FUNCS(inet_pton)
982AC_REPLACE_FUNCS(inet_ntop)
983AC_REPLACE_FUNCS(snprintf)
984AC_REPLACE_FUNCS(strlcat)
985AC_REPLACE_FUNCS(strlcpy)
986AC_REPLACE_FUNCS(memmove)
987AC_REPLACE_FUNCS(gmtime_r)
988LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
989AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4)
990if test "$USE_NSS" = "no"; then
991 AC_REPLACE_FUNCS(arc4random)
992 AC_REPLACE_FUNCS(arc4random_uniform)
993 if test "$ac_cv_func_arc4random" = "no"; then
994 AC_LIBOBJ(explicit_bzero)
995 AC_LIBOBJ(arc4_lock)
996 AC_CHECK_FUNCS([getentropy],,[
997 if test "$USE_WINSOCK" = 1; then
998 AC_LIBOBJ(getentropy_win)
999 else
1000 case `uname` in
1001 Darwin)
1002 AC_LIBOBJ(getentropy_osx)
1003 ;;
1004 SunOS)
1005 AC_LIBOBJ(getentropy_solaris)
1006 AC_CHECK_HEADERS([sys/sha2.h],, [
1007 AC_CHECK_FUNCS([SHA512_Update],,[
1008 AC_LIBOBJ(sha512)
1009 ])
1010 ], [AC_INCLUDES_DEFAULT])
1011 if test "$ac_cv_header_sys_sha2_h" = "yes"; then
1012 # this lib needed for sha2 on solaris
1013 LIBS="$LIBS -lmd"
1014 fi
1015 ;;
1016 Linux|*)
1017 AC_LIBOBJ(getentropy_linux)
1018 AC_CHECK_FUNCS([SHA512_Update],,[
1019 AC_DEFINE([COMPAT_SHA512], [1], [Do sha512 definitions in config.h])
1020 AC_LIBOBJ(sha512)
1021 ])
1022 AC_CHECK_HEADERS([sys/sysctl.h],,, [AC_INCLUDES_DEFAULT])
1023 AC_SEARCH_LIBS([clock_gettime], [rt])
1024 ;;
1025 esac
1026 fi
1027 ])
1028 fi
1029fi
969LIBOBJ_WITHOUT_CTIME="$LIBOBJS"
970AC_SUBST(LIBOBJ_WITHOUT_CTIME)
971AC_REPLACE_FUNCS(ctime_r)
972
973AC_ARG_ENABLE(allsymbols, AC_HELP_STRING([--enable-allsymbols], [export all symbols from libunbound and link binaries to it, smaller install size but libunbound export table is polluted by internal symbols]))
974case "$enable_allsymbols" in
975 yes)
976 COMMON_OBJ_ALL_SYMBOLS=""
977 UBSYMS=""
978 EXTRALINK="-L. -L.libs -lunbound"
979 AC_DEFINE(EXPORT_ALL_SYMBOLS, 1, [Define this if you enabled-allsymbols from libunbound to link binaries to it for smaller install size, but the libunbound export table is polluted by internal symbols])
980 ;;
981 no|*)
982 COMMON_OBJ_ALL_SYMBOLS='$(COMMON_OBJ)'
983 UBSYMS='-export-symbols $(srcdir)/libunbound/ubsyms.def'
984 EXTRALINK=""
985 ;;
986esac
987AC_SUBST(COMMON_OBJ_ALL_SYMBOLS)
988AC_SUBST(EXTRALINK)
989AC_SUBST(UBSYMS)
990if test x_$enable_lock_checks = x_yes; then
991 UBSYMS="-export-symbols clubsyms.def"
992 cp ${srcdir}/libunbound/ubsyms.def clubsyms.def
993 echo lock_protect >> clubsyms.def
994 echo lock_unprotect >> clubsyms.def
995 echo lock_get_mem >> clubsyms.def
996 echo checklock_start >> clubsyms.def
997 echo checklock_stop >> clubsyms.def
998 echo checklock_lock >> clubsyms.def
999 echo checklock_unlock >> clubsyms.def
1000 echo checklock_init >> clubsyms.def
1001 echo checklock_thrcreate >> clubsyms.def
1002 echo checklock_thrjoin >> clubsyms.def
1003fi
1004
1030LIBOBJ_WITHOUT_CTIME="$LIBOBJS"
1031AC_SUBST(LIBOBJ_WITHOUT_CTIME)
1032AC_REPLACE_FUNCS(ctime_r)
1033
1034AC_ARG_ENABLE(allsymbols, AC_HELP_STRING([--enable-allsymbols], [export all symbols from libunbound and link binaries to it, smaller install size but libunbound export table is polluted by internal symbols]))
1035case "$enable_allsymbols" in
1036 yes)
1037 COMMON_OBJ_ALL_SYMBOLS=""
1038 UBSYMS=""
1039 EXTRALINK="-L. -L.libs -lunbound"
1040 AC_DEFINE(EXPORT_ALL_SYMBOLS, 1, [Define this if you enabled-allsymbols from libunbound to link binaries to it for smaller install size, but the libunbound export table is polluted by internal symbols])
1041 ;;
1042 no|*)
1043 COMMON_OBJ_ALL_SYMBOLS='$(COMMON_OBJ)'
1044 UBSYMS='-export-symbols $(srcdir)/libunbound/ubsyms.def'
1045 EXTRALINK=""
1046 ;;
1047esac
1048AC_SUBST(COMMON_OBJ_ALL_SYMBOLS)
1049AC_SUBST(EXTRALINK)
1050AC_SUBST(UBSYMS)
1051if test x_$enable_lock_checks = x_yes; then
1052 UBSYMS="-export-symbols clubsyms.def"
1053 cp ${srcdir}/libunbound/ubsyms.def clubsyms.def
1054 echo lock_protect >> clubsyms.def
1055 echo lock_unprotect >> clubsyms.def
1056 echo lock_get_mem >> clubsyms.def
1057 echo checklock_start >> clubsyms.def
1058 echo checklock_stop >> clubsyms.def
1059 echo checklock_lock >> clubsyms.def
1060 echo checklock_unlock >> clubsyms.def
1061 echo checklock_init >> clubsyms.def
1062 echo checklock_thrcreate >> clubsyms.def
1063 echo checklock_thrjoin >> clubsyms.def
1064fi
1065
1066# check for dnstap if requested
1067dt_DNSTAP([$UNBOUND_RUN_DIR/dnstap.sock],
1068 [
1069 AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support])
1070 AC_SUBST([ENABLE_DNSTAP], [1])
1071
1072 AC_SUBST([opt_dnstap_socket_path])
1073 ACX_ESCAPE_BACKSLASH($opt_dnstap_socket_path, hdr_dnstap_socket_path)
1074 AC_DEFINE_UNQUOTED(DNSTAP_SOCKET_PATH,
1075 ["$hdr_dnstap_socket_path"], [default dnstap socket path])
1076
1077 AC_SUBST([DNSTAP_SRC], ["dnstap/dnstap.c dnstap/dnstap.pb-c.c"])
1078 AC_SUBST([DNSTAP_OBJ], ["dnstap.lo dnstap.pb-c.lo"])
1079 ],
1080 [
1081 AC_SUBST([ENABLE_DNSTAP], [0])
1082 ]
1083)
1084
1005AC_MSG_CHECKING([if ${MAKE:-make} supports $< with implicit rule in scope])
1006# on openBSD, the implicit rule make $< work.
1007# on Solaris, it does not work ($? is changed sources, $^ lists dependencies).
1008# gmake works.
1009cat >conftest.make <<EOF
1010all: conftest.lo
1011
1012conftest.lo foo.lo bla.lo:
1013 if test -f "\$<"; then touch \$@; fi
1014
1015.SUFFIXES: .lo
1016.c.lo:
1017 if test -f "\$<"; then touch \$@; fi
1018
1019conftest.lo: conftest.dir/conftest.c
1020EOF
1021mkdir conftest.dir
1022touch conftest.dir/conftest.c
1023rm -f conftest.lo conftest.c
1024${MAKE:-make} -f conftest.make >/dev/null
1025rm -f conftest.make conftest.c conftest.dir/conftest.c
1026rm -rf conftest.dir
1027if test ! -f conftest.lo; then
1028 AC_MSG_RESULT(no)
1029 SOURCEDETERMINE='echo "$^" | awk "-F " "{print \$$1;}" > .source'
1030 SOURCEFILE='`cat .source`'
1031else
1032 AC_MSG_RESULT(yes)
1033 SOURCEDETERMINE=':'
1034 SOURCEFILE='$<'
1035fi
1036rm -f conftest.lo
1037AC_SUBST(SOURCEDETERMINE)
1038AC_SUBST(SOURCEFILE)
1039
1040# see if we want to build the library or everything
1041ALLTARGET="alltargets"
1042INSTALLTARGET="install-all"
1043AC_ARG_WITH(libunbound-only, AC_HELP_STRING([--with-libunbound-only],
1044 [do not build daemon and tool programs]),
1045 [
1046 if test "$withval" = "yes"; then
1047 ALLTARGET="lib"
1048 INSTALLTARGET="install-lib"
1049 fi
1050])
1051AC_SUBST(ALLTARGET)
1052AC_SUBST(INSTALLTARGET)
1053
1054ACX_STRIP_EXT_FLAGS
1055LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
1056
1057AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [10240], [Define to the maximum message length to pass to syslog.])
1058
1059AH_BOTTOM(
1060dnl this must be first AH_CONFIG, to define the flags before any includes.
1061AHX_CONFIG_EXT_FLAGS
1062
1063dnl includes
1064[
1065#ifndef UNBOUND_DEBUG
1066# define NDEBUG
1067#endif
1068
1069/** Use small-ldns codebase */
1070#define USE_SLDNS 1
1071#ifdef HAVE_SSL
1072# define LDNS_BUILD_CONFIG_HAVE_SSL 1
1073#endif
1074
1075#include <stdio.h>
1076#include <string.h>
1077#include <unistd.h>
1078#include <assert.h>
1079
1080#if STDC_HEADERS
1081#include <stdlib.h>
1082#include <stddef.h>
1083#endif
1084
1085#ifdef HAVE_STDARG_H
1086#include <stdarg.h>
1087#endif
1088
1089#ifdef HAVE_STDINT_H
1090#include <stdint.h>
1091#endif
1092
1093#include <errno.h>
1094
1095#if HAVE_SYS_PARAM_H
1096#include <sys/param.h>
1097#endif
1098
1099#ifdef HAVE_SYS_SOCKET_H
1100#include <sys/socket.h>
1101#endif
1102
1103#ifdef HAVE_SYS_UIO_H
1104#include <sys/uio.h>
1105#endif
1106
1107#ifdef HAVE_NETINET_IN_H
1108#include <netinet/in.h>
1109#endif
1110
1111#ifdef HAVE_ARPA_INET_H
1112#include <arpa/inet.h>
1113#endif
1114
1115#ifdef HAVE_WINSOCK2_H
1116#include <winsock2.h>
1117#endif
1118
1119#ifdef HAVE_WS2TCPIP_H
1120#include <ws2tcpip.h>
1121#endif
1122
1123#ifndef USE_WINSOCK
1124#define ARG_LL "%ll"
1125#else
1126#define ARG_LL "%I64"
1127#endif
1128]
1129
1130AHX_CONFIG_FORMAT_ATTRIBUTE
1131AHX_CONFIG_UNUSED_ATTRIBUTE
1132AHX_CONFIG_FSEEKO
1133AHX_CONFIG_MAXHOSTNAMELEN
1134AHX_CONFIG_SNPRINTF(unbound)
1135AHX_CONFIG_INET_PTON(unbound)
1136AHX_CONFIG_INET_NTOP(unbound)
1137AHX_CONFIG_INET_ATON(unbound)
1138AHX_CONFIG_MEMMOVE(unbound)
1139AHX_CONFIG_STRLCAT(unbound)
1140AHX_CONFIG_STRLCPY(unbound)
1141AHX_CONFIG_GMTIME_R(unbound)
1142AHX_CONFIG_W32_SLEEP
1143AHX_CONFIG_W32_USLEEP
1144AHX_CONFIG_W32_RANDOM
1145AHX_CONFIG_W32_SRANDOM
1146AHX_CONFIG_W32_FD_SET_T
1147AHX_CONFIG_IPV6_MIN_MTU
1148AHX_MEMCMP_BROKEN(unbound)
1149
1150[
1151#ifndef HAVE_CTIME_R
1152#define ctime_r unbound_ctime_r
1153char *ctime_r(const time_t *timep, char *buf);
1154#endif
1155
1156#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
1157#define strptime unbound_strptime
1158struct tm;
1159char *strptime(const char *s, const char *format, struct tm *tm);
1160#endif
1161
1085AC_MSG_CHECKING([if ${MAKE:-make} supports $< with implicit rule in scope])
1086# on openBSD, the implicit rule make $< work.
1087# on Solaris, it does not work ($? is changed sources, $^ lists dependencies).
1088# gmake works.
1089cat >conftest.make <<EOF
1090all: conftest.lo
1091
1092conftest.lo foo.lo bla.lo:
1093 if test -f "\$<"; then touch \$@; fi
1094
1095.SUFFIXES: .lo
1096.c.lo:
1097 if test -f "\$<"; then touch \$@; fi
1098
1099conftest.lo: conftest.dir/conftest.c
1100EOF
1101mkdir conftest.dir
1102touch conftest.dir/conftest.c
1103rm -f conftest.lo conftest.c
1104${MAKE:-make} -f conftest.make >/dev/null
1105rm -f conftest.make conftest.c conftest.dir/conftest.c
1106rm -rf conftest.dir
1107if test ! -f conftest.lo; then
1108 AC_MSG_RESULT(no)
1109 SOURCEDETERMINE='echo "$^" | awk "-F " "{print \$$1;}" > .source'
1110 SOURCEFILE='`cat .source`'
1111else
1112 AC_MSG_RESULT(yes)
1113 SOURCEDETERMINE=':'
1114 SOURCEFILE='$<'
1115fi
1116rm -f conftest.lo
1117AC_SUBST(SOURCEDETERMINE)
1118AC_SUBST(SOURCEFILE)
1119
1120# see if we want to build the library or everything
1121ALLTARGET="alltargets"
1122INSTALLTARGET="install-all"
1123AC_ARG_WITH(libunbound-only, AC_HELP_STRING([--with-libunbound-only],
1124 [do not build daemon and tool programs]),
1125 [
1126 if test "$withval" = "yes"; then
1127 ALLTARGET="lib"
1128 INSTALLTARGET="install-lib"
1129 fi
1130])
1131AC_SUBST(ALLTARGET)
1132AC_SUBST(INSTALLTARGET)
1133
1134ACX_STRIP_EXT_FLAGS
1135LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
1136
1137AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [10240], [Define to the maximum message length to pass to syslog.])
1138
1139AH_BOTTOM(
1140dnl this must be first AH_CONFIG, to define the flags before any includes.
1141AHX_CONFIG_EXT_FLAGS
1142
1143dnl includes
1144[
1145#ifndef UNBOUND_DEBUG
1146# define NDEBUG
1147#endif
1148
1149/** Use small-ldns codebase */
1150#define USE_SLDNS 1
1151#ifdef HAVE_SSL
1152# define LDNS_BUILD_CONFIG_HAVE_SSL 1
1153#endif
1154
1155#include <stdio.h>
1156#include <string.h>
1157#include <unistd.h>
1158#include <assert.h>
1159
1160#if STDC_HEADERS
1161#include <stdlib.h>
1162#include <stddef.h>
1163#endif
1164
1165#ifdef HAVE_STDARG_H
1166#include <stdarg.h>
1167#endif
1168
1169#ifdef HAVE_STDINT_H
1170#include <stdint.h>
1171#endif
1172
1173#include <errno.h>
1174
1175#if HAVE_SYS_PARAM_H
1176#include <sys/param.h>
1177#endif
1178
1179#ifdef HAVE_SYS_SOCKET_H
1180#include <sys/socket.h>
1181#endif
1182
1183#ifdef HAVE_SYS_UIO_H
1184#include <sys/uio.h>
1185#endif
1186
1187#ifdef HAVE_NETINET_IN_H
1188#include <netinet/in.h>
1189#endif
1190
1191#ifdef HAVE_ARPA_INET_H
1192#include <arpa/inet.h>
1193#endif
1194
1195#ifdef HAVE_WINSOCK2_H
1196#include <winsock2.h>
1197#endif
1198
1199#ifdef HAVE_WS2TCPIP_H
1200#include <ws2tcpip.h>
1201#endif
1202
1203#ifndef USE_WINSOCK
1204#define ARG_LL "%ll"
1205#else
1206#define ARG_LL "%I64"
1207#endif
1208]
1209
1210AHX_CONFIG_FORMAT_ATTRIBUTE
1211AHX_CONFIG_UNUSED_ATTRIBUTE
1212AHX_CONFIG_FSEEKO
1213AHX_CONFIG_MAXHOSTNAMELEN
1214AHX_CONFIG_SNPRINTF(unbound)
1215AHX_CONFIG_INET_PTON(unbound)
1216AHX_CONFIG_INET_NTOP(unbound)
1217AHX_CONFIG_INET_ATON(unbound)
1218AHX_CONFIG_MEMMOVE(unbound)
1219AHX_CONFIG_STRLCAT(unbound)
1220AHX_CONFIG_STRLCPY(unbound)
1221AHX_CONFIG_GMTIME_R(unbound)
1222AHX_CONFIG_W32_SLEEP
1223AHX_CONFIG_W32_USLEEP
1224AHX_CONFIG_W32_RANDOM
1225AHX_CONFIG_W32_SRANDOM
1226AHX_CONFIG_W32_FD_SET_T
1227AHX_CONFIG_IPV6_MIN_MTU
1228AHX_MEMCMP_BROKEN(unbound)
1229
1230[
1231#ifndef HAVE_CTIME_R
1232#define ctime_r unbound_ctime_r
1233char *ctime_r(const time_t *timep, char *buf);
1234#endif
1235
1236#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
1237#define strptime unbound_strptime
1238struct tm;
1239char *strptime(const char *s, const char *format, struct tm *tm);
1240#endif
1241
1242#ifdef HAVE_LIBRESSL
1243# if !HAVE_DECL_STRLCPY
1244size_t strlcpy(char *dst, const char *src, size_t siz);
1245# endif
1246# if !HAVE_DECL_STRLCAT
1247size_t strlcat(char *dst, const char *src, size_t siz);
1248# endif
1249# if !HAVE_DECL_ARC4RANDOM && defined(HAVE_ARC4RANDOM)
1250uint32_t arc4random(void);
1251# endif
1252# if !HAVE_DECL_ARC4RANDOM_UNIFORM && defined(HAVE_ARC4RANDOM_UNIFORM)
1253uint32_t arc4random_uniform(uint32_t upper_bound);
1254# endif
1255#endif /* HAVE_LIBRESSL */
1256#ifndef HAVE_ARC4RANDOM
1257void explicit_bzero(void* buf, size_t len);
1258int getentropy(void* buf, size_t len);
1259uint32_t arc4random(void);
1260void arc4random_buf(void* buf, size_t n);
1261void _ARC4_LOCK(void);
1262void _ARC4_UNLOCK(void);
1263#endif
1264#ifndef HAVE_ARC4RANDOM_UNIFORM
1265uint32_t arc4random_uniform(uint32_t upper_bound);
1266#endif
1267#ifdef COMPAT_SHA512
1268#ifndef SHA512_DIGEST_LENGTH
1269#define SHA512_BLOCK_LENGTH 128
1270#define SHA512_DIGEST_LENGTH 64
1271#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
1272typedef struct _SHA512_CTX {
1273 uint64_t state[8];
1274 uint64_t bitcount[2];
1275 uint8_t buffer[SHA512_BLOCK_LENGTH];
1276} SHA512_CTX;
1277#endif /* SHA512_DIGEST_LENGTH */
1278void SHA512_Init(SHA512_CTX*);
1279void SHA512_Update(SHA512_CTX*, void*, size_t);
1280void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
1281unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest);
1282#endif /* COMPAT_SHA512 */
1283
1284
1285
1162#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
1163 /* using version of libevent that is not threadsafe. */
1164# define LIBEVENT_SIGNAL_PROBLEM 1
1165#endif
1166
1167#ifndef CHECKED_INET6
1168# define CHECKED_INET6
1169# ifdef AF_INET6
1170# define INET6
1171# else
1172# define AF_INET6 28
1173# endif
1174#endif /* CHECKED_INET6 */
1175
1176#ifndef HAVE_GETADDRINFO
1177struct sockaddr_storage;
1178#include "compat/fake-rfc2553.h"
1179#endif
1180
1181#ifdef UNBOUND_ALLOC_STATS
1182# define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__)
1183# define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__)
1184# define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__)
1185# define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__)
1186void *unbound_stat_malloc(size_t size);
1187void *unbound_stat_calloc(size_t nmemb, size_t size);
1188void unbound_stat_free(void *ptr);
1189void *unbound_stat_realloc(void *ptr, size_t size);
1190void *unbound_stat_malloc_log(size_t size, const char* file, int line,
1191 const char* func);
1192void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file,
1193 int line, const char* func);
1194void unbound_stat_free_log(void *ptr, const char* file, int line,
1195 const char* func);
1196void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
1197 int line, const char* func);
1198#elif defined(UNBOUND_ALLOC_LITE)
1199# include "util/alloc.h"
1200#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
1201
1202/** default port for DNS traffic. */
1203#define UNBOUND_DNS_PORT 53
1204/** default port for unbound control traffic, registered port with IANA,
1205 ub-dns-control 8953/tcp unbound dns nameserver control */
1206#define UNBOUND_CONTROL_PORT 8953
1207/** the version of unbound-control that this software implements */
1208#define UNBOUND_CONTROL_VERSION 1
1209
1210])
1211
1286#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
1287 /* using version of libevent that is not threadsafe. */
1288# define LIBEVENT_SIGNAL_PROBLEM 1
1289#endif
1290
1291#ifndef CHECKED_INET6
1292# define CHECKED_INET6
1293# ifdef AF_INET6
1294# define INET6
1295# else
1296# define AF_INET6 28
1297# endif
1298#endif /* CHECKED_INET6 */
1299
1300#ifndef HAVE_GETADDRINFO
1301struct sockaddr_storage;
1302#include "compat/fake-rfc2553.h"
1303#endif
1304
1305#ifdef UNBOUND_ALLOC_STATS
1306# define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__)
1307# define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__)
1308# define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__)
1309# define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__)
1310void *unbound_stat_malloc(size_t size);
1311void *unbound_stat_calloc(size_t nmemb, size_t size);
1312void unbound_stat_free(void *ptr);
1313void *unbound_stat_realloc(void *ptr, size_t size);
1314void *unbound_stat_malloc_log(size_t size, const char* file, int line,
1315 const char* func);
1316void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file,
1317 int line, const char* func);
1318void unbound_stat_free_log(void *ptr, const char* file, int line,
1319 const char* func);
1320void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
1321 int line, const char* func);
1322#elif defined(UNBOUND_ALLOC_LITE)
1323# include "util/alloc.h"
1324#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
1325
1326/** default port for DNS traffic. */
1327#define UNBOUND_DNS_PORT 53
1328/** default port for unbound control traffic, registered port with IANA,
1329 ub-dns-control 8953/tcp unbound dns nameserver control */
1330#define UNBOUND_CONTROL_PORT 8953
1331/** the version of unbound-control that this software implements */
1332#define UNBOUND_CONTROL_VERSION 1
1333
1334])
1335
1212AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8 smallapp/unbound-control-setup.sh])
1336dnl if we build from source tree, the man pages need @date@ and @version@
1337dnl if this is a distro tarball, that was already done by makedist.sh
1338AC_SUBST(version, [VERSION_MAJOR.VERSION_MINOR.VERSION_MICRO])
1339AC_SUBST(date, [`date +'%b %e, %Y'`])
1340
1341AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8 doc/unbound-host.1 smallapp/unbound-control-setup.sh dnstap/dnstap_config.h])
1213AC_CONFIG_HEADER([config.h])
1214AC_OUTPUT
1342AC_CONFIG_HEADER([config.h])
1343AC_OUTPUT