cleanup: Replace a few calls to malloc/realloc with safe_malloc
[secnet] / configure.in
... / ...
CommitLineData
1dnl Process this file with autoconf to produce a configure script.
2
3sinclude(ac_prog_cc_no_writeable_strings.m4)
4
5AC_INIT(secnet,0.1.18+,secnet@chiark.greenend.org.uk)
6AC_CONFIG_SRCDIR(secnet.c)
7AC_CONFIG_HEADER(config.h)
8
9AC_PREREQ(2.50)
10AC_REVISION($Id: configure.in,v 1.4 2002/09/09 22:05:02 steve Exp $)
11
12AC_LANG_C
13
14# If fink is on the path then it is assumed we should use it.
15AC_PATH_PROG([FINK],[fink])
16if test "x$FINK" != x; then
17 finkdir=`echo $FINK|sed 's,/[[^/]]*/[[^/]]*$,,'`
18 CPPFLAGS="-I$finkdir/include ${CPPFLAGS}"
19 LDFLAGS="-L$finkdir/lib ${LDFLAGS}"
20fi
21
22AC_PROG_MAKE_SET
23AC_PROG_CC
24AC_PROG_INSTALL
25AC_PATH_PROG(RM,rm)
26AC_STDC_HEADERS
27AC_CHECK_HEADERS([stdint.h inttypes.h])
28AC_CHECK_HEADERS([net/if.h net/route.h])
29AC_CHECK_HEADERS([sys/socket.h])
30AC_CHECK_HEADERS([linux/if.h], [], [],
31[#if HAVE_SYS_SOCKET_H
32# include <sys/socket.h>
33#endif
34])
35AC_CHECK_HEADERS([stropts.h sys/sockio.h net/if_tun.h])
36AC_C_BIGENDIAN
37AC_CHECK_SIZEOF(unsigned long long)
38AC_CHECK_SIZEOF(unsigned long)
39AC_CHECK_SIZEOF(unsigned int)
40AC_CHECK_SIZEOF(unsigned short)
41AC_CHECK_SIZEOF(unsigned char)
42AC_PROG_CC_NO_WRITEABLE_STRINGS(WRITESTRINGS)
43
44AC_ARG_ENABLE(hacky-parallel,
45 [AS_HELP_STRING([--enable-hacky-parallel],
46 [parallelise slow cryptography (default is no)])], [
47 case "$enableval" in
48 n|0|no) ;;
49 y|1|yes) CFLAGS="$CFLAGS -DHACKY_PARALLEL" ;;
50 *) ;;
51 esac
52])
53
54AC_DEFUN([REQUIRE_HEADER],[AC_CHECK_HEADER($1,,[AC_MSG_ERROR($1 not found)])])
55
56dnl the order in which libraries is checked is important
57dnl eg. adns on Solaris 2.5.1 depends on -lnsl and -lsocket
58AC_CHECK_LIB(gmp,mpz_init_set_str)
59AC_CHECK_LIB(gmp2,mpz_init_set_str)
60AC_CHECK_LIB(gmp,__gmpz_init_set_str)
61REQUIRE_HEADER([gmp.h])
62dnl Would love to barf if no gmp was found, but how to test? Requiring the header will do for now.
63AC_CHECK_LIB(fl,yywrap)
64if test "$ac_cv_lib_fl_yywrap" != yes; then
65 AC_MSG_ERROR([A compatible libfl is required])
66fi
67AC_CHECK_LIB(nsl,inet_ntoa)
68AC_CHECK_LIB(socket,socket)
69AC_CHECK_LIB(resolv,inet_aton)
70AC_CHECK_LIB(adns,adns_init)
71REQUIRE_HEADER([adns.h])
72
73AC_MSG_NOTICE([Checking requirements for IPv6 support...])
74enable_ipv6=true
75m4_define(NO_IPV6,[enable_ipv6=false])
76AC_CHECK_DECL(AF_INET6, [],[NO_IPV6],[#include <netinet/in.h>])
77AC_CHECK_FUNC(adns_addr2text, [],[NO_IPV6])
78if $enable_ipv6; then
79 AC_MSG_NOTICE([Enabling IPv6 support])
80 AC_DEFINE(CONFIG_IPV6, 1,
81 [Define to 1 to use IPv6 support in system and adns])
82else
83 AC_MSG_WARN([Disabling IPv6 support])
84fi
85
86AC_OUTPUT(Makefile,echo timestamp >stamp-h)
87
88AH_TOP([
89#ifndef _CONFIG_H
90#define _CONFIG_H
91])
92
93AH_BOTTOM([
94/* -*- c -*- */
95
96/* These used to be in config.h.bot, but are now in configure.in. */
97
98#ifdef HAVE_INTTYPES_H
99#include <inttypes.h>
100#else
101#ifdef HAVE_STDINT_H
102#include <stdint.h>
103#else
104#if SIZEOF_UNSIGNED_LONG_LONG==8
105typedef unsigned long long uint64_t;
106typedef long long int64_t;
107#elif SIZEOF_UNSIGNED_LONG==8
108typedef unsigned long uint64_t;
109typedef long int64_t;
110#else
111#error I do not know what to use for a uint64_t.
112#endif
113
114/* Give us an unsigned 32-bit data type. */
115#if SIZEOF_UNSIGNED_LONG==4
116typedef unsigned long uint32_t;
117typedef long int32_t;
118#elif SIZEOF_UNSIGNED_INT==4
119typedef unsigned int uint32_t;
120typedef int int32_t;
121#else
122#error I do not know what to use for a uint32_t.
123#endif
124
125/* An unsigned 16-bit data type. */
126#if SIZEOF_UNSIGNED_INT==2
127typedef unsigned int uint16_t;
128typedef int int16_t;
129#elif SIZEOF_UNSIGNED_SHORT==2
130typedef unsigned short uint16_t;
131typedef short int16_t;
132#else
133#error I do not know what to use for a uint16_t.
134#endif
135
136/* An unsigned 8-bit data type */
137#if SIZEOF_UNSIGNED_CHAR==1
138typedef unsigned char uint8_t;
139#else
140#error I do not know what to use for a uint8_t.
141#endif
142#endif
143#endif
144
145#ifdef __GNUC__
146#define NORETURN(_x) void _x __attribute__ ((noreturn))
147#define FORMAT(_a,_b,_c) __attribute__ ((format (_a,_b,_c)))
148#else
149#define NORETURN(_x) _x
150#define FORMAT(_a,_b,_c)
151#endif
152
153#endif /* _CONFIG_H */
154])