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