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