build-sys: use git version as program version output
[debian/dhcpd-pools.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.64)
5 AC_CONFIG_MACRO_DIR([m4])
6 AC_INIT([dhcpd-pools],
7         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
8         [kerolasa@iki.fi],,[http://dhcpd-pools.sourceforge.net/])
9 AM_INIT_AUTOMAKE
10 AC_CONFIG_SRCDIR([src/dhcpd-pools.h])
11 AC_CONFIG_HEADERS([config.h])
12
13 AC_GNU_SOURCE
14
15 # Checks for programs
16 AC_PROG_AWK
17 AC_PROG_CC
18 AC_PROG_CXX
19 AC_PROG_MAKE_SET
20 AC_PROG_LIBTOOL
21
22 # Checks for libraries.
23 LT_INIT
24
25 # Checks for header files.
26
27 AC_CHECK_HEADERS([arpa/inet.h \
28         fcntl.h \
29         libintl.h \
30         netinet/in.h \
31         stdlib.h \
32         string.h \
33         strings.h \
34         sys/socket.h \
35         unistd.h])
36
37 # Checks for typedefs, structures, and compiler characteristics.
38 AC_HEADER_STDBOOL
39 AC_TYPE_SIZE_T
40
41 # Checks for library functions.
42 AC_FUNC_MALLOC
43 AC_CHECK_FUNCS([inet_ntoa memset strerror strstr strdup])
44
45 # GNU commandline parsing in getopt.h present?
46 AC_CHECK_HEADERS(getopt.h, AC_DEFINE(HAVE_GETOPT_H),
47         import_sources="getopt.c getopt1.c $import_sources")
48
49 AC_CONFIG_FILES([Makefile
50                  man/Makefile
51                  src/Makefile
52                  contrib/Makefile])
53
54 AC_MSG_CHECKING(whether program_invocation_short_name is defined)
55 AC_TRY_COMPILE([#include <argp.h>],
56                 [program_invocation_short_name = "test";],
57                 AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1,
58                         [Define if program_invocation_short_name is defined])
59                 AC_MSG_RESULT(yes),
60                 AC_MSG_RESULT(no))
61
62 AC_MSG_CHECKING([whether __progname is defined])
63 AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
64         [if (*__progname == 0) return;])],
65         AC_DEFINE(HAVE___PROGNAME, 1, [Define if __progname is defined])
66         AC_MSG_RESULT(yes),
67         AC_MSG_RESULT(no))
68
69 AC_ARG_WITH(dhcpd-conf,
70         [AC_HELP_STRING([--with-dhcpd-conf], [default path of dhcpd.conf])],
71         AC_DEFINE_UNQUOTED(DHCPDCONF_FILE,"$withval"),
72         AC_DEFINE(DHCPDCONF_FILE,["/etc/dhcpd.conf"],[default path of dhcpd.conf]))
73 AC_ARG_WITH(dhcpd-leases,
74         [AC_HELP_STRING([--with-dhcpd-leases], [default path of dhcpd.leases])],
75         AC_DEFINE_UNQUOTED(DHCPDLEASE_FILE,"$withval"),
76         AC_DEFINE(DHCPDLEASE_FILE,["/var/lib/dhcp/dhcpd.leases"],[default path of dhcpd.leases]))
77 AC_ARG_WITH(output-format,
78         [AC_HELP_STRING([--with-output-format], [default output format])],
79         AC_DEFINE_UNQUOTED(OUTPUT_FORMAT,"$withval"),
80         AC_DEFINE(OUTPUT_FORMAT,["text"],[default output format]))
81 AC_ARG_WITH(output-limit,
82         [AC_HELP_STRING([--with-output-limit], [default output limitations])],
83         AC_DEFINE_UNQUOTED(OUTPUT_LIMIT,"$withval"),
84         AC_DEFINE(OUTPUT_LIMIT,["77"],[default output limitations]))
85
86 AC_OUTPUT