1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3#
4#	@(#) configure.ac
5#
6#	2008-06-27	initial setup
7#	2008-06-29	add of BIND path checking
8#	2008-06-30	add of arg checkings
9#	2008-07-02	additional arg checkings
10#	2008-07-04	check for getopt_long() added
11#	2008-08-30	check for unsigned integer types
12#	2008-10-01	if BIND_UTIL_PATH check failed, use config_zkt.h setting as last resort
13#	2009-07-30	check for timegm() added
14#	2009-12-02	the tr command in bind_version= didn't work well under solaris
15#	2010-10-14	new option to specify BIND_UTIL_PATH on command line (thanks to Mans Nilsson)
16#			No build in default BIND_UTIL_PATH used anymore
17#	2015-07-15	new option for USE_DS_TRACKING added (thanks to Sven Strickroth)
18#
19
20dnl AC_PREREQ(2.59)
21
22### Package name and current version
23AC_INIT(ZKT, 1.1.4, Holger Zuleger hznet.de)
24dnl AC_REVISION($Revision: 1.397 $)
25
26### Files to test to check if src dir contains the package
27AC_CONFIG_SRCDIR([zkt-signer.c])
28AC_CONFIG_HEADER([config.h])
29
30
31### Checks for programs.
32AC_PROG_CC
33
34### find out the path to BIND utils and version
35AC_ARG_ENABLE([bind_util_path], AS_HELP_STRING(	[--enable-bind_util_path=PATH], [Define path to BIND utilities, default is path to dnssec-signzone]), [bind_util_path=$enableval])
36if test -n "$bind_util_path"
37then
38	if test -x "$bind_util_path/dnssec-signzone"
39	then
40		AC_MSG_NOTICE([BIND utilities path successfully set to $bind_util_path.])
41		SIGNZONE_PROG=$bind_util_path/dnssec-signzone
42	else
43        	AC_MSG_ERROR([*** 'BIND utility not found in $bind_util_path, please use --enable-bind_util_path= to set it manually' ***])
44	fi
45else
46	AC_PATH_PROG([SIGNZONE_PROG], dnssec-signzone)
47	AC_MSG_NOTICE([BIND utility $SIGNZONE_PROG found])
48	if test -n "$SIGNZONE_PROG"
49	then
50		bind_util_path=`dirname "$SIGNZONE_PROG"`
51		AC_MSG_NOTICE([BIND utilities path automatically set to $bind_util_path.])
52	else
53        	AC_MSG_ERROR([*** 'could not determine BIND utility path, please use --enable-bind_util_path= ' to set it manually ***])
54	fi
55fi
56### By now, we have a path. We'll use it.
57# define BIND_UTIL_PATH in config.h.in
58AC_DEFINE_UNQUOTED(BIND_UTIL_PATH, "$bind_util_path/", Path to BIND utilities)
59
60# define BIND_VERSION in config.h.in
61bind_version=`$SIGNZONE_PROG 2>&1 |  awk -F: '/^Version:/ { split ($2, v, "."); printf ("%2d%02d%02d\n", atoi (v[[1]]), atoi (v[[2]]), atoi (v[[3]])); };'`
62AC_MSG_NOTICE([BIND_VERSION string set to $bind_version.])
63AC_DEFINE_UNQUOTED(BIND_VERSION, $bind_version, BIND version as integer number without dots)
64if test $bind_version -lt "90800"
65then
66	AC_MSG_ERROR([*** 'This version of ZKT requires a BIND version greater 9.7' ***])
67fi
68
69
70AC_CHECK_TYPE(uint, unsigned int)
71AC_CHECK_TYPE(ulong, unsigned long)
72AC_CHECK_TYPE(ushort, unsigned short)
73AC_CHECK_TYPE(uchar, unsigned char)
74
75### define configure arguments
76AC_ARG_ENABLE([color_mode], AS_HELP_STRING([--disable-color-mode], [zkt without colors]))
77color_mode=1
78AS_IF([test "$enable_color_mode" = "no"], [color_mode=0])
79
80AC_ARG_WITH([curses],
81    AS_HELP_STRING([--without-curses], [Ignore presence of curses and disable color mode]))
82
83AS_IF([test "x$with_curses" != "xno"],
84	[AC_CHECK_LIB([ncurses],[tgetent])],
85	        [HAVE_LIB_NCURSES=0; color_mode=0])
86
87AC_DEFINE_UNQUOTED(COLOR_MODE, $color_mode, zkt-ls with colors)
88
89
90dnl printtimezone is a default-disabled feature
91AC_ARG_ENABLE([printtimezone], AS_HELP_STRING( [--enable-print-timezone], [print out timezone]))
92printtimezone=0
93AS_IF([test "$enable_printtimezone" = "yes"], [printtimezone=1])
94AC_DEFINE_UNQUOTED(PRINT_TIMEZONE, $printtimezone, print out timezone)
95
96AC_ARG_ENABLE([printyear], AS_HELP_STRING( [--enable-print-age], [print age with year]))
97printyear=0
98AS_IF([test "$enable_printyear" = "yes"], [printyear=1])
99AC_DEFINE_UNQUOTED(PRINT_AGE_WITH_YEAR, $printyear, print age with year)
100
101AC_ARG_ENABLE([logprogname], AS_HELP_STRING( [--enable-log-progname], [log with progname]))
102logprogname=0
103AS_IF([test "$enable_logprogname" = "yes"], [logprogname=1])
104AC_DEFINE_UNQUOTED(LOG_WITH_PROGNAME, $logprogname, log with progname)
105
106dnl logtimestamp is a default-enabled feature
107AC_ARG_ENABLE([logtimestamp], AS_HELP_STRING([--disable-log-timestamp], [do not log with timestamp]))
108logtimestamp=1
109AS_IF([test "$enable_logtimestamp" = "no"], [logtimestamp=0])
110AC_DEFINE_UNQUOTED(LOG_WITH_TIMESTAMP, $logtimestamp, log with timestamp)
111
112AC_ARG_ENABLE([loglevel], AS_HELP_STRING([--disable-log-level], [do not log with level]))
113loglevel=1
114AS_IF([test "$enable_loglevel" = "no"], [loglevel=0])
115AC_DEFINE_UNQUOTED(LOG_WITH_LEVEL, $loglevel, log with level)
116
117AC_ARG_ENABLE([ttl_in_keyfile], AS_HELP_STRING([--disable-ttl-in-keyfiles], [do not allow TTL values in keyfiles]))
118ttl_in_keyfile=1
119AS_IF([test "$enable_ttl_in_keyfile" = "no"], [ttl_in_keyfile=0])
120AC_DEFINE_UNQUOTED(TTL_IN_KEYFILE_ALLOWED, $ttl_in_keyfile, TTL in keyfiles allowed)
121
122AC_ARG_ENABLE([ds_tracking], AS_HELP_STRING( [--enable-ds-tracking], [track DS record in parent zone (ksk-rollover)]))
123ds_tracking=0
124AS_IF([test "$enable_ds_tracking" = "yes"], [ds_tracking=1])
125AC_DEFINE_UNQUOTED(USE_DS_TRACKING, $ds_tracking, track DS record)
126if test "$ds_tracking" = 1
127then
128	### find the path to dig
129	AC_PATH_PROG([dig_path], [dig])
130	if test -z "$dig_path"
131	then
132		AC_MSG_NOTICE([Could not find path to dig program. Please disable ds-tracking])
133	else
134		AC_DEFINE_UNQUOTED(DIG_PATH, "$dig_path", path to dig binary)
135	fi
136fi
137
138
139
140configpath="/var/named"
141AC_ARG_ENABLE([configpath],
142	AS_HELP_STRING( [--enable-configpath=PATH], [set path of config file (defaults to /var/named)]),
143	[configpath=$enableval])
144case "$configpath" in
145yes)
146	configpath="/var/named"
147	;;
148no)
149	configpath=""
150	;;
151*)
152	;;
153esac
154AC_DEFINE_UNQUOTED(CONFIG_PATH, "$configpath/", [set path of config file (defaults to /var/named)])
155
156usetree=1
157t=""
158AC_ARG_ENABLE([tree],
159	AS_HELP_STRING( [--disable-tree], [use single linked list instead of binary tree data structure for dnssec-zkt]),
160	[usetree=$enableval])
161if test "$usetree" = no
162then
163	usetree=0
164	t="S"
165fi
166AC_DEFINE_UNQUOTED(USE_TREE, $usetree, Use TREE data structure for dnssec-zkt)
167
168AC_DEFINE_UNQUOTED(ZKT_VERSION, "$t$PACKAGE_VERSION", ZKT version string)
169AC_DEFINE_UNQUOTED(ZKT_COPYRIGHT, "(c) Feb 2005 - Nov 2012 Holger Zuleger hznet.de", ZKT copyright string)
170
171### Checks for libraries.
172
173### Checks for header files.
174AC_HEADER_DIRENT
175AC_HEADER_STDC
176AC_CHECK_HEADERS([fcntl.h netdb.h stdlib.h getopt.h string.h strings.h sys/socket.h sys/time.h sys/types.h syslog.h unistd.h utime.h term.h curses.h])
177
178
179### Checks for typedefs, structures, and compiler characteristics.
180AC_C_CONST
181AC_TYPE_SIZE_T
182AC_HEADER_TIME
183AC_STRUCT_TM
184AC_TYPE_UID_T
185
186
187### Checks for library functions.
188dnl AC_FUNC_MALLOC
189AC_FUNC_CLOSEDIR_VOID
190AC_FUNC_ERROR_AT_LINE
191AC_FUNC_MKTIME
192AC_FUNC_STAT
193AC_FUNC_STRFTIME
194AC_FUNC_UTIME_NULL
195AC_FUNC_VPRINTF
196# 2008-07-04 getopt_long added
197# 2009-07-30 timegm added
198AC_CHECK_FUNCS([getopt_long gettimeofday memset putenv socket strcasecmp strchr strdup strerror strncasecmp strrchr tzset utime getuid timegm])
199
200
201AC_CONFIG_FILES([Makefile])
202AC_OUTPUT
203