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#
18
19dnl AC_PREREQ(2.59)
20
21### Package name and current version
22AC_INIT(ZKT, 1.1.3, Holger Zuleger hznet.de)
23dnl AC_REVISION(Revision: 1.397 )
24
25### Files to test to check if src dir contains the package
26AC_CONFIG_SRCDIR([zkt-signer.c])
27AC_CONFIG_HEADER([config.h])
28
29
30### Checks for programs.
31AC_PROG_CC
32
33### find out the path to BIND utils and version
34AC_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])
35if test -n "$bind_util_path"
36then
37	if test -x "$bind_util_path/dnssec-signzone"
38	then
39		AC_MSG_NOTICE([BIND utilities path successfully set to $bind_util_path.])
40		SIGNZONE_PROG=$bind_util_path/dnssec-signzone
41	else
42        	AC_MSG_ERROR([*** 'BIND utility not found in $bind_util_path, please use --enable-bind_util_path= to set it manually' ***])
43	fi
44else
45	AC_PATH_PROG([SIGNZONE_PROG], dnssec-signzone)
46	AC_MSG_NOTICE([BIND utility $SIGNZONE_PROG found])
47	if test -n "$SIGNZONE_PROG"
48	then
49		bind_util_path=`dirname "$SIGNZONE_PROG"`
50		AC_MSG_NOTICE([BIND utilities path automatically set to $bind_util_path.])
51	else
52        	AC_MSG_ERROR([*** 'could not determine BIND utility path, please use --enable-bind_util_path= ' to set it manually ***])
53	fi
54fi
55### By now, we have a path. We'll use it.
56# define BIND_UTIL_PATH in config.h.in
57AC_DEFINE_UNQUOTED(BIND_UTIL_PATH, "$bind_util_path/", Path to BIND utilities)
58
59# define BIND_VERSION in config.h.in
60bind_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]])); };'`
61AC_MSG_NOTICE([BIND_VERSION string set to $bind_version.])
62AC_DEFINE_UNQUOTED(BIND_VERSION, $bind_version, BIND version as integer number without dots)
63if test $bind_version -lt "90800"
64then
65	AC_MSG_ERROR([*** 'This version of ZKT requires a BIND version greater 9.7' ***])
66fi
67
68
69AC_CHECK_TYPE(uint, unsigned int)
70AC_CHECK_TYPE(ulong, unsigned long)
71AC_CHECK_TYPE(ushort, unsigned short)
72AC_CHECK_TYPE(uchar, unsigned char)
73
74### define configure arguments
75AC_ARG_ENABLE([color_mode], AS_HELP_STRING([--disable-color-mode], [zkt without colors]))
76color_mode=1
77AS_IF([test "$enable_color_mode" = "no"], [color_mode=0])
78
79AC_ARG_WITH([curses],
80    AS_HELP_STRING([--without-curses], [Ignore presence of curses and disable color mode]))
81
82AS_IF([test "x$with_curses" != "xno"],
83	[AC_CHECK_LIB([ncurses],[tgetent])],
84	        [HAVE_LIB_NCURSES=0; color_mode=0])
85
86AC_DEFINE_UNQUOTED(COLOR_MODE, $color_mode, zkt-ls with colors)
87
88
89dnl printtimezone is a default-disabled feature
90AC_ARG_ENABLE([printtimezone], AS_HELP_STRING( [--enable-print-timezone], [print out timezone]))
91printtimezone=0
92AS_IF([test "$enable_printtimezone" = "yes"], [printtimezone=1])
93AC_DEFINE_UNQUOTED(PRINT_TIMEZONE, $printtimezone, print out timezone)
94
95AC_ARG_ENABLE([printyear], AS_HELP_STRING( [--enable-print-age], [print age with year]))
96printyear=0
97AS_IF([test "$enable_printyear" = "yes"], [printyear=1])
98AC_DEFINE_UNQUOTED(PRINT_AGE_WITH_YEAR, $printyear, print age with year)
99
100AC_ARG_ENABLE([logprogname], AS_HELP_STRING( [--enable-log-progname], [log with progname]))
101logprogname=0
102AS_IF([test "$enable_logprogname" = "yes"], [logprogname=1])
103AC_DEFINE_UNQUOTED(LOG_WITH_PROGNAME, $logprogname, log with progname)
104
105dnl logtimestamp is a default-enabled feature
106AC_ARG_ENABLE([logtimestamp], AS_HELP_STRING([--disable-log-timestamp], [do not log with timestamp]))
107logtimestamp=1
108AS_IF([test "$enable_logtimestamp" = "no"], [logtimestamp=0])
109AC_DEFINE_UNQUOTED(LOG_WITH_TIMESTAMP, $logtimestamp, log with timestamp)
110
111AC_ARG_ENABLE([loglevel], AS_HELP_STRING([--disable-log-level], [do not log with level]))
112loglevel=1
113AS_IF([test "$enable_loglevel" = "no"], [loglevel=0])
114AC_DEFINE_UNQUOTED(LOG_WITH_LEVEL, $loglevel, log with level)
115
116AC_ARG_ENABLE([ttl_in_keyfile], AS_HELP_STRING([--disable-ttl-in-keyfiles], [do not allow TTL values in keyfiles]))
117ttl_in_keyfile=1
118AS_IF([test "$enable_ttl_in_keyfile" = "no"], [ttl_in_keyfile=0])
119AC_DEFINE_UNQUOTED(TTL_IN_KEYFILE_ALLOWED, $ttl_in_keyfile, TTL in keyfiles allowed)
120
121configpath="/var/named"
122AC_ARG_ENABLE([configpath],
123	AS_HELP_STRING( [--enable-configpath=PATH], [set path of config file (defaults to /var/named)]),
124	[configpath=$enableval])
125case "$configpath" in
126yes)
127	configpath="/var/named"
128	;;
129no)
130	configpath=""
131	;;
132*)
133	;;
134esac
135AC_DEFINE_UNQUOTED(CONFIG_PATH, "$configpath/", [set path of config file (defaults to /var/named)])
136
137usetree=1
138t=""
139AC_ARG_ENABLE([tree],
140	AS_HELP_STRING( [--disable-tree], [use single linked list instead of binary tree data structure for dnssec-zkt]),
141	[usetree=$enableval])
142if test "$usetree" = no
143then
144	usetree=0
145	t="S"
146fi
147AC_DEFINE_UNQUOTED(USE_TREE, $usetree, Use TREE data structure for dnssec-zkt)
148
149AC_DEFINE_UNQUOTED(ZKT_VERSION, "$t$PACKAGE_VERSION", ZKT version string)
150AC_DEFINE_UNQUOTED(ZKT_COPYRIGHT, "(c) Feb 2005 - Nov 2012 Holger Zuleger hznet.de", ZKT copyright string)
151
152### Checks for libraries.
153
154### Checks for header files.
155AC_HEADER_DIRENT
156AC_HEADER_STDC
157AC_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])
158
159
160### Checks for typedefs, structures, and compiler characteristics.
161AC_C_CONST
162AC_TYPE_SIZE_T
163AC_HEADER_TIME
164AC_STRUCT_TM
165AC_TYPE_UID_T
166
167
168### Checks for library functions.
169dnl AC_FUNC_MALLOC
170AC_FUNC_CLOSEDIR_VOID
171AC_FUNC_ERROR_AT_LINE
172AC_FUNC_MKTIME
173AC_FUNC_STAT
174AC_FUNC_STRFTIME
175AC_FUNC_UTIME_NULL
176AC_FUNC_VPRINTF
177# 2008-07-04 getopt_long added
178# 2009-07-30 timegm added
179AC_CHECK_FUNCS([getopt_long gettimeofday memset putenv socket strcasecmp strchr strdup strerror strncasecmp strrchr tzset utime getuid timegm])
180
181
182AC_CONFIG_FILES([Makefile])
183AC_OUTPUT
184