cleanup: specify never-interactive option for flex scanner
[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.16+,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
14AC_PROG_MAKE_SET
15AC_PROG_CC
16AC_PROG_INSTALL
17AC_PATH_PROG(RM,rm)
18AC_STDC_HEADERS
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])
28AC_C_BIGENDIAN
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)
34AC_PROG_CC_NO_WRITEABLE_STRINGS(WRITESTRINGS)
35
36AC_DEFUN([REQUIRE_HEADER],[AC_CHECK_HEADER($1,,[AC_MSG_ERROR($1 not found)])])
37
38dnl the order in which libraries is checked is important
39dnl eg. adns on Solaris 2.5.1 depends on -lnsl and -lsocket
40AC_CHECK_LIB(gmp,mpz_init_set_str)
41AC_CHECK_LIB(gmp2,mpz_init_set_str)
42AC_CHECK_LIB(gmp,__gmpz_init_set_str)
43REQUIRE_HEADER([gmp.h])
44dnl Would love to barf if no gmp was found, but how to test? Requiring the header will do for now.
45AC_CHECK_LIB(fl,yywrap)
46if test "$ac_cv_lib_fl_yywrap" != yes; then
47 AC_MSG_ERROR([A compatible libfl is required])
48fi
49AC_CHECK_LIB(nsl,inet_ntoa)
50AC_CHECK_LIB(getopt,getopt_long)
51AC_CHECK_LIB(gnugetopt,getopt_long)
52AC_CHECK_LIB(socket,socket)
53AC_CHECK_LIB(resolv,inet_aton)
54AC_CHECK_LIB(adns,adns_init)
55REQUIRE_HEADER([adns.h])
56
57dnl check for getopt in standard library
58AC_REPLACE_FUNCS([snprintf])
59AC_CHECK_FUNC([getopt_long], [], [AC_LIBOBJ([getopt])
60 AC_LIBOBJ([getopt1])])
61
62AC_OUTPUT(Makefile,echo timestamp >stamp-h)
63
64AH_TOP([
65#ifndef _CONFIG_H
66#define _CONFIG_H
67])
68
69AH_BOTTOM([
70/* -*- c -*- */
71
72/* These used to be in config.h.bot, but are now in configure.in. */
73
74#ifdef HAVE_INTTYPES_H
75#include <inttypes.h>
76#else
77#ifdef HAVE_STDINT_H
78#include <stdint.h>
79#else
80#if SIZEOF_UNSIGNED_LONG_LONG==8
81typedef unsigned long long uint64_t;
82typedef long long int64_t;
83#elif SIZEOF_UNSIGNED_LONG==8
84typedef unsigned long uint64_t;
85typedef long int64_t;
86#else
87#error I do not know what to use for a uint64_t.
88#endif
89
90/* Give us an unsigned 32-bit data type. */
91#if SIZEOF_UNSIGNED_LONG==4
92typedef unsigned long uint32_t;
93typedef long int32_t;
94#elif SIZEOF_UNSIGNED_INT==4
95typedef unsigned int uint32_t;
96typedef int int32_t;
97#else
98#error I do not know what to use for a uint32_t.
99#endif
100
101/* An unsigned 16-bit data type. */
102#if SIZEOF_UNSIGNED_INT==2
103typedef unsigned int uint16_t;
104typedef int int16_t;
105#elif SIZEOF_UNSIGNED_SHORT==2
106typedef unsigned short uint16_t;
107typedef short int16_t;
108#else
109#error I do not know what to use for a uint16_t.
110#endif
111
112/* An unsigned 8-bit data type */
113#if SIZEOF_UNSIGNED_CHAR==1
114typedef unsigned char uint8_t;
115#else
116#error I do not know what to use for a uint8_t.
117#endif
118#endif
119#endif
120
121#ifndef HAVE_SNPRINTF
122#include <stdio.h>
123#include <stdarg.h>
124#include "snprintf.h"
125#endif
126
127#ifdef __GNUC__
128#define NORETURN(_x) void _x __attribute__ ((noreturn))
129#define FORMAT(_a,_b,_c) __attribute__ ((format (_a,_b,_c)))
130#else
131#define NORETURN(_x) _x
132#define FORMAT(_a,_b,_c)
133#endif
134
135#endif /* _CONFIG_H */
136])