1m4_sinclude([version.m4])
2
3AC_PREREQ([2.69])
4AC_INIT([opendnssec],[OPENDNSSEC_VERSION],[http://bugs.opendnssec.org/])
5AM_DEFAULT_VERBOSITY="0"
6AC_SUBST([AM_DEFAULT_VERBOSITY])
7AM_INIT_AUTOMAKE([foreign subdir-objects])
8AC_CONFIG_MACRO_DIR([m4])
9ACX_PREFIXHACK
10
11OPENDNSSEC_COMMON
12
13# extensions
14AC_USE_SYSTEM_EXTENSIONS
15
16# standard programs
17AC_PROG_CC
18AC_PROG_INSTALL
19LT_INIT
20AC_PROG_MAKE_SET
21AC_PROG_CXX
22
23# additional programs
24AC_PATH_PROG(XMLLINT, xmllint)
25AC_PATH_PROG(XSLTPROC, xsltproc)
26AC_PATH_PROG(JAVA, java)
27AC_PATH_PROG(CP, cp)
28AC_DEFINE_UNQUOTED(CP_COMMAND, "$CP", [System cp(3) command])
29
30# building, compiler flags
31AC_PROG_CC
32ACX_PEDANTIC
33AX_COMPILER_FLAGS_CFLAGS
34AX_C___ATTRIBUTE__
35ACX_ARG_RPATH
36ACX_RUNTIME_PATH_ADD
37AX_CFLAGS_WARN_ALL
38
39# checks for header files
40AC_HEADER_STDBOOL
41AC_CHECK_HEADERS([fcntl.h inttypes.h stdio.h stdlib.h string.h syslog.h unistd.h])
42AC_CHECK_HEADERS(getopt.h,, [AC_INCLUDES_DEFAULT])
43AC_CHECK_HEADERS([errno.h getopt.h pthread.h signal.h stdarg.h stdint.h strings.h])
44AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/stat.h sys/time.h sys/types.h sys/wait.h])
45AC_CHECK_HEADERS([libxml/parser.h libxml/relaxng.h libxml/xmlreader.h libxml/xpath.h])
46
47# checks for typedefs, structures, and compiler characteristics
48AC_C_CONST
49AC_TYPE_PID_T
50AC_TYPE_SIZE_T
51AC_TYPE_UID_T
52AC_TYPE_UINT16_T
53AC_MSG_CHECKING(for union semun)
54AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
55                #include <sys/ipc.h>
56                #include <sys/sem.h>]], [[union semun arg;]])],[have_union_semun=1],[have_union_semun=0
57])
58if test $have_union_semun = 1; then
59  AC_MSG_RESULT(yes)
60  AC_DEFINE(HAVE_UNION_SEMUN, 1, [union semun is defined])
61else
62  AC_MSG_RESULT(no)
63fi
64
65AX_PTHREAD
66
67# pthread
68# AX_PTHREAD([AC_DEFINE([HAVE_PTHREAD], [1],
69#     AS_ECHO(["Define if you have POSIX threads libraries and header files."])
70#     LDFLAGS="$CFLAGS $PTHREAD_CFLAGS $LDFLAGS $PTHREAD_LIBS $LIBS"])
71
72# LIBS="$PTHREAD_LIBS $LIBS"
73# CFLAGS="$CFLAGS $PTHREAD_CFLAGS $WARN_CFLAGS"
74# CC="$PTHREAD_CC"
75
76# checks for library functions
77AC_CHECK_FUNCS([arc4random arc4random_uniform])
78AC_CHECK_FUNCS([dup2 endpwent select strerror strtol])
79AC_CHECK_FUNCS([getpass getpassphrase memset])
80AC_CHECK_FUNCS([localtime_r memset strdup strerror strstr strtol strtoul])
81AC_CHECK_FUNCS([setregid setreuid])
82AC_CHECK_FUNCS([chown stat exit time atoi getpid waitpid sigfillset])
83AC_CHECK_FUNCS([malloc calloc realloc free])
84AC_CHECK_FUNCS([strlen strncmp strncat strncpy strerror strncasecmp strdup])
85AC_CHECK_FUNCS([fgetc fopen fclose ferror fprintf vsnprintf snprintf fflush])
86AC_CHECK_FUNCS([openlog closelog syslog])
87AC_CHECK_FUNCS([openlog_r closelog_r syslog_r vsyslog_r])
88AC_CHECK_FUNCS([chroot getgroups setgroups initgroups])
89AC_CHECK_FUNCS([close unlink fcntl socket listen bzero])
90AC_CHECK_FUNCS([va_start va_end])
91AC_CHECK_FUNCS([xmlInitParser xmlCleanupParser xmlCleanupThreads])
92AC_CHECK_FUNCS([pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock])
93AC_CHECK_FUNCS([pthread_cond_init pthread_cond_signal pthread_cond_destroy pthread_cond_wait pthread_cond_timedwait])
94AC_CHECK_FUNCS([pthread_create pthread_detach pthread_self pthread_join pthread_sigmask pthread_barrier_wait])
95
96AC_FUNC_CHOWN
97AC_FUNC_FORK
98AC_FUNC_MALLOC
99AC_FUNC_MEMCMP
100AC_FUNC_MKTIME
101AC_FUNC_REALLOC
102AC_FUNC_SELECT_ARGTYPES
103AC_FUNC_VPRINTF
104
105AC_REPLACE_FUNCS(strlcat)
106AC_REPLACE_FUNCS(strlcpy)
107AC_REPLACE_FUNCS(b64_pton)
108AC_REPLACE_FUNCS(b64_ntop)
109
110ACX_BROKEN_SETRES
111AC_CHECK_STRPTIME
112
113# check for some target-specific stuff
114case "$host" in
115*-*-darwin*)
116    AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
117	    [Define if your platform breaks doing a seteuid before a setuid])
118    AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
119    AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
120    ;;
121*-*-netbsd*)
122    AC_DEFINE(_NETBSD_SOURCE, 1, [Enable functions on BSD])
123    ;;
124esac
125
126# check for the sockaddr_un.sun_len member
127AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
128    [AC_DEFINE(HAVE_SOCKADDR_SUN_LEN,1,[Have the sockaddr_un.sun_len member.])],
129    [],
130    [ #include <sys/types.h>
131      #include <sys/un.h>
132    ])
133
134# common dependencies
135ACX_LIBXML2
136ACX_LDNS(1,6,17)
137ACX_LDNS_NOT(1,6,14, [binary incompatibility, see http://open.nlnetlabs.nl/pipermail/ldns-users/2012-October/000564.html])
138ACX_LDNS_NOT(1,6,15, [fail to create NSEC3 bitmap for empty non-terminals, see http://www.nlnetlabs.nl/pipermail/ldns-users/2012-November/000565.html])
139ACX_PKCS11_MODULES
140ACX_RT
141ACX_LIBC
142ACX_SSL
143ACX_CUNIT
144
145AC_DEFINE(USE_ED25519, 1, [Enable ldns ED25519 support])
146AC_DEFINE(USE_ED448, 1, [Enable ldns ED448 support])
147
148# cunit
149AM_CONDITIONAL([WITH_CUNIT], [test "${with_cunit}" != "no" -a -n "$CUNIT_LIBS"])
150
151# libhsm
152ACX_DLOPEN
153AC_DEFINE_UNQUOTED([HSM_DEFAULT_CONFIG],["$OPENDNSSEC_CONFIG_FILE"],[Default configuration file.])
154
155# enforcer
156AC_ARG_ENABLE(enforcer,
157	AS_HELP_STRING([--disable-enforcer],
158		[Disable enforcer build (default enabled)]),
159		[enable_enforcer="${enableval}"],
160		[enable_enforcer="yes"])
161if test "x${enable_enforcer}" = "xyes"; then
162	AC_DEFINE_UNQUOTED(SIGNER_CLI_UPDATE, "$OPENDNSSEC_SIGNER_CLI update", [Path to the OpenDNSSEC signer engine cli])
163	ACX_ENFORCER_DATABASE
164	ACX_LIBREADLINE
165fi
166AM_CONDITIONAL([ENABLE_ENFORCER], [test "${enable_enforcer}" = "yes"])
167
168# signer
169AC_ARG_ENABLE(signer,
170	AS_HELP_STRING([--disable-signer],
171		[Disable signer build (default enabled)]),
172		[enable_signer="${enableval}"],
173		[enable_signer="yes"])
174AM_CONDITIONAL([ENABLE_SIGNER], [test "${enable_signer}" = "yes"])
175
176INSTALLATIONCOND=""
177AC_ARG_ENABLE(installation-user,
178	AS_HELP_STRING([--enable-installation-user],
179		[Install for usage by specific user (default=disabled)]),
180		[enable_installationuser=$enableval],
181		[enable_installationuser="no"])
182AC_ARG_ENABLE(installation-group,
183	AS_HELP_STRING([--enable-installation-group],
184		[Install for usage by specific group (default=disabled)]),
185		[enable_installationgroup=$enableval],
186		[enable_installationgroup="no"])
187if test "x${enable_installationuser}" != "xno"; then
188	INSTALLATIONUSER="${enable_installationuser}"
189	INSTALLATIONUSERARG="-o${enable_installationuser}"
190	INSTALLATIONCOND="user"
191else
192	INSTALLATIONUSER=""
193	INSTALLATIONUSERARG=""
194fi
195if test "x${enable_installationgroup}" != "xno"; then
196	INSTALLATIONGROUP="${enable_installationgroup}"
197	INSTALLATIONGROUPARG="-g${enable_installationgroup}"
198	if test "x${enable_installationuser}" != "xno"; then
199		INSTALLATIONCOND="both"
200	else
201		INSTALLATIONCOND="group"
202	fi
203else
204	INSTALLATIONGROUP=""
205	INSTALLATIONGROUPARG=""
206fi
207AC_SUBST([INSTALLATIONGROUP])
208AC_SUBST([INSTALLATIONGROUPARG])
209AC_SUBST([INSTALLATIONUSER])
210AC_SUBST([INSTALLATIONUSERARG])
211AC_SUBST([INSTALLATIONCOND])
212
213# doxygen
214DX_PDF_FEATURE(OFF)
215DX_PS_FEATURE(OFF)
216DX_INIT_DOXYGEN(${PACKAGE_NAME}, [Doxyfile], [doxygen-doc])
217
218AC_CHECK_FUNC(backtrace, [AC_DEFINE([HAVE_BACKTRACE], [1], [Define if backtrace supported])])
219AC_CHECK_LIB(backtrace, backtrace_full, [AC_DEFINE([HAVE_BACKTRACE_FULL], [1], [Define if backtrace_full supported]) LIBS="$LIBS -lbacktrace"])
220
221AC_ARG_WITH([libunwind], AS_HELP_STRING([--with-libunwind], [Build with the libunwind library]))
222AS_IF([test "x$with_libunwind" = "xyes"], [
223   PKG_CHECK_MODULES([LIBUNWIND], [libunwind])
224])
225AC_SUBST([LIBUNWIND_CFLAGS])
226AC_SUBST([LIBUNWIND_LIBS])
227LIBS="$LIBS $LIBUNWIND_LIBS"
228
229AC_CONFIG_HEADERS([common/config.h])
230
231AC_CONFIG_FILES([
232	Makefile
233	Doxyfile
234	common/Makefile
235	conf/Makefile
236	conf/addns.xml
237	conf/conf.xml
238	conf/enforcerstate.xml
239	conf/kasp.xml
240	conf/signconf.xml
241	conf/zonelist.xml
242	enforcer/Makefile
243	enforcer/src/Makefile
244	enforcer/man/Makefile
245	enforcer/src/db/test/Makefile
246	enforcer/man/ods-enforcer.8
247	enforcer/man/ods-enforcer-db-setup.8
248	enforcer/man/ods-enforcerd.8
249	enforcer/src/utils/Makefile
250	enforcer/src/utils/ods-kaspcheck.1
251	libhsm/Makefile
252	libhsm/src/Makefile
253	libhsm/src/bin/Makefile
254	libhsm/src/bin/ods-hsmspeed.1
255	libhsm/src/bin/ods-hsmutil.1
256	libhsm/src/lib/Makefile
257	libhsm/checks/Makefile
258	libhsm/checks/conf-softhsm.xml
259	libhsm/checks/conf-sca6000.xml
260	libhsm/checks/conf-etoken.xml
261	libhsm/checks/conf-multi.xml
262	libhsm/checks/conf-opensc.xml
263	libhsm/checks/conf-ncipher.xml
264	libhsm/checks/conf-aepkeyper.xml
265	signer/Makefile
266	signer/man/Makefile
267	signer/man/ods-signer.8
268	signer/man/ods-signerd.8
269	signer/src/Makefile
270	tools/Makefile
271	tools/ods-control
272	tools/solaris/Makefile
273	tools/solaris/ods-enforcerd.init
274	tools/solaris/ods-signerd.init
275	tools/ods-timing.5
276	tools/ods-kasp.5
277	tools/opendnssec.7
278	tools/ods-control.8
279	tools/ods-kasp2html
280])
281
282AC_OUTPUT
283