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