Security: Reduce impact of bogus key setup packet DoS
[secnet] / configure.in
CommitLineData
2fe58dfd
SE
1dnl Process this file with autoconf to produce a configure script.
2
fe5e9cc4
SE
3sinclude(ac_prog_cc_no_writeable_strings.m4)
4
f74f5f43
SE
5AC_INIT(secnet,0.1.16+,secnet@chiark.greenend.org.uk)
6AC_CONFIG_SRCDIR(secnet.c)
2fe58dfd
SE
7AC_CONFIG_HEADER(config.h)
8
f74f5f43 9AC_PREREQ(2.50)
3b83c932 10AC_REVISION($Id: configure.in,v 1.4 2002/09/09 22:05:02 steve Exp $)
2fe58dfd
SE
11
12AC_LANG_C
13
14AC_PROG_MAKE_SET
15AC_PROG_CC
974d0468 16AC_PROG_INSTALL
2fe58dfd
SE
17AC_PATH_PROG(RM,rm)
18AC_STDC_HEADERS
f74f5f43
SE
19AC_CHECK_HEADERS([stdint.h inttypes.h])
20AC_CHECK_HEADERS([net/if.h net/route.h])
21AC_CHECK_HEADERS([sys/socket.h])
22AC_CHECK_HEADERS([linux/if.h], [], [],
23[#if HAVE_SYS_SOCKET_H
24# include <sys/socket.h>
25#endif
26])
27AC_CHECK_HEADERS([stropts.h sys/sockio.h net/if_tun.h])
2fe58dfd 28AC_C_BIGENDIAN
8dea8d37
SE
29AC_CHECK_SIZEOF(unsigned long long)
30AC_CHECK_SIZEOF(unsigned long)
31AC_CHECK_SIZEOF(unsigned int)
32AC_CHECK_SIZEOF(unsigned short)
33AC_CHECK_SIZEOF(unsigned char)
fe5e9cc4 34AC_PROG_CC_NO_WRITEABLE_STRINGS(WRITESTRINGS)
2fe58dfd 35
e1b81bd6
IJ
36AC_ARG_ENABLE(hacky-parallel,
37 [AS_HELP_STRING([--enable-hacky-parallel],
38 [parallelise slow cryptography (default is no)])], [
39 case "$enableval" in
40 n|0|no) ;;
41 y|1|yes) CFLAGS="$CFLAGS -DHACKY_PARALLEL" ;;
42 *) ;;
43 esac
44])
45
f74f5f43
SE
46AC_DEFUN([REQUIRE_HEADER],[AC_CHECK_HEADER($1,,[AC_MSG_ERROR($1 not found)])])
47
469fd1d9
SE
48dnl the order in which libraries is checked is important
49dnl eg. adns on Solaris 2.5.1 depends on -lnsl and -lsocket
59635212 50AC_CHECK_LIB(gmp,mpz_init_set_str)
2fe58dfd 51AC_CHECK_LIB(gmp2,mpz_init_set_str)
469fd1d9 52AC_CHECK_LIB(gmp,__gmpz_init_set_str)
f74f5f43
SE
53REQUIRE_HEADER([gmp.h])
54dnl Would love to barf if no gmp was found, but how to test? Requiring the header will do for now.
2fe58dfd 55AC_CHECK_LIB(fl,yywrap)
f74f5f43
SE
56if test "$ac_cv_lib_fl_yywrap" != yes; then
57 AC_MSG_ERROR([A compatible libfl is required])
58fi
469fd1d9 59AC_CHECK_LIB(nsl,inet_ntoa)
469fd1d9
SE
60AC_CHECK_LIB(socket,socket)
61AC_CHECK_LIB(resolv,inet_aton)
62AC_CHECK_LIB(adns,adns_init)
f74f5f43 63REQUIRE_HEADER([adns.h])
2fe58dfd 64
8dea8d37 65dnl check for getopt in standard library
f74f5f43 66AC_REPLACE_FUNCS([snprintf])
8dea8d37 67
8689b3a9 68AC_OUTPUT(Makefile,echo timestamp >stamp-h)
f74f5f43
SE
69
70AH_TOP([
71#ifndef _CONFIG_H
72#define _CONFIG_H
73])
74
75AH_BOTTOM([
76/* -*- c -*- */
77
78/* These used to be in config.h.bot, but are now in configure.in. */
79
80#ifdef HAVE_INTTYPES_H
81#include <inttypes.h>
82#else
83#ifdef HAVE_STDINT_H
84#include <stdint.h>
85#else
86#if SIZEOF_UNSIGNED_LONG_LONG==8
87typedef unsigned long long uint64_t;
88typedef long long int64_t;
89#elif SIZEOF_UNSIGNED_LONG==8
90typedef unsigned long uint64_t;
91typedef long int64_t;
92#else
93#error I do not know what to use for a uint64_t.
94#endif
95
96/* Give us an unsigned 32-bit data type. */
97#if SIZEOF_UNSIGNED_LONG==4
98typedef unsigned long uint32_t;
99typedef long int32_t;
100#elif SIZEOF_UNSIGNED_INT==4
101typedef unsigned int uint32_t;
102typedef int int32_t;
103#else
104#error I do not know what to use for a uint32_t.
105#endif
106
107/* An unsigned 16-bit data type. */
108#if SIZEOF_UNSIGNED_INT==2
109typedef unsigned int uint16_t;
110typedef int int16_t;
111#elif SIZEOF_UNSIGNED_SHORT==2
112typedef unsigned short uint16_t;
113typedef short int16_t;
114#else
115#error I do not know what to use for a uint16_t.
116#endif
117
118/* An unsigned 8-bit data type */
119#if SIZEOF_UNSIGNED_CHAR==1
120typedef unsigned char uint8_t;
121#else
122#error I do not know what to use for a uint8_t.
123#endif
124#endif
125#endif
126
127#ifndef HAVE_SNPRINTF
128#include <stdio.h>
129#include <stdarg.h>
130#include "snprintf.h"
131#endif
132
133#ifdef __GNUC__
134#define NORETURN(_x) void _x __attribute__ ((noreturn))
135#define FORMAT(_a,_b,_c) __attribute__ ((format (_a,_b,_c)))
136#else
137#define NORETURN(_x) _x
138#define FORMAT(_a,_b,_c)
139#endif
140
141#endif /* _CONFIG_H */
142])