| 1 | |
|---|
| 2 | AC_PREREQ(2.62) |
|---|
| 3 | define([svnversion], esyscmd([sh -c "echo -n $(( `svnversion | tr -d 'M'` + 1 ))"]))dnl |
|---|
| 4 | AC_INIT([onioncat],[[0.2.2.r]svnversion],[rahra@cypherpunk.at]) |
|---|
| 5 | AM_INIT_AUTOMAKE([-Wall -Werror]) |
|---|
| 6 | AC_CONFIG_HEADERS([config.h]) |
|---|
| 7 | |
|---|
| 8 | AC_DEFINE(SVN_REVISION, "svnversion", [SVN Revision]) |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[enable debugging]), |
|---|
| 12 | AC_DEFINE([DEBUG], [1], [enable debugging]) |
|---|
| 13 | ) |
|---|
| 14 | |
|---|
| 15 | AC_ARG_ENABLE([packet-log], AS_HELP_STRING([--enable-packet-log],[enable packet logging]), |
|---|
| 16 | AC_DEFINE([PACKET_LOG], [], [enable packet logging])) |
|---|
| 17 | |
|---|
| 18 | AC_ARG_ENABLE([handle-http], AS_HELP_STRING([--enable-handle-http],[enable handling of accidental HTTP requests]), |
|---|
| 19 | AC_DEFINE([HANDLE_HTTP], [], [enable handling of accidental HTTP requests])) |
|---|
| 20 | |
|---|
| 21 | AC_ARG_ENABLE([packet-queue], AS_HELP_STRING([--enable-packet-queue],[enable queueuing of packets while connecting setup]), |
|---|
| 22 | AC_DEFINE([PACKET_QUEUE], [], [enable packet queue])) |
|---|
| 23 | |
|---|
| 24 | AC_ARG_ENABLE([check-ipsrc], AS_HELP_STRING([--disable-check-ipsrc],[disable source ip checking before forwarding]), |
|---|
| 25 | AC_DEFINE([CHECK_IPSRC], [1], [disable source ip checking])) |
|---|
| 26 | |
|---|
| 27 | AC_ARG_ENABLE([rtt], AS_HELP_STRING([--enable-rtt],[enable inband RTT measurement]), |
|---|
| 28 | AC_DEFINE([MEASURE_RTT], [1], [enable RTT measurement])) |
|---|
| 29 | |
|---|
| 30 | AC_ARG_ENABLE([tundev], AS_HELP_STRING([--disable-tundev],[compile without tunnel device code]), |
|---|
| 31 | AC_DEFINE([WITHOUT_TUN], [1], [exclude tunnel device code])) |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | if test "${enable_debug+set}" = set ; then |
|---|
| 35 | AC_SUBST([CFLAGS], [["-Wall -g -D_POSIX_PTHREAD_SEMANTICS"]]) |
|---|
| 36 | else |
|---|
| 37 | AC_SUBST([CFLAGS], [["-Wall -O2 -D_POSIX_PTHREAD_SEMANTICS"]]) |
|---|
| 38 | fi |
|---|
| 39 | |
|---|
| 40 | # Checks for programs. |
|---|
| 41 | AC_PROG_CC |
|---|
| 42 | #AC_PROG_INSTALL |
|---|
| 43 | AC_PROG_LN_S |
|---|
| 44 | AC_PROG_MKDIR_P |
|---|
| 45 | |
|---|
| 46 | m4_include([ax_pthread.m4]) |
|---|
| 47 | ACX_PTHREAD |
|---|
| 48 | LIBS="$PTHREAD_LIBS $LIBS" |
|---|
| 49 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
|---|
| 50 | CC="$PTHREAD_CC" |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | # Checks for libraries. |
|---|
| 54 | #AC_CHECK_LIB([pthread], [pthread_create]) |
|---|
| 55 | #AC_CHECK_LIB([rt], [clock_gettime]) |
|---|
| 56 | #AC_CHECK_LIB([readline], [main]) |
|---|
| 57 | |
|---|
| 58 | AC_SEARCH_LIBS([bind], [socket]) |
|---|
| 59 | AC_SEARCH_LIBS([inet_ntop], [nsl]) |
|---|
| 60 | |
|---|
| 61 | # Checks for header files. |
|---|
| 62 | #AC_HEADER_STDC |
|---|
| 63 | AC_CHECK_HEADERS([sys/types.h sys/wait.h sys/socket.h sys/stat.h netdb.h arpa/nameser.h netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip6.h netinet/in6.h net/if.h net/if_tun.h net/tun/if_tun.h linux/if_tun.h linux/sockios.h endian.h sys/endian.h netinet/icmp6.h net/ethernet.h netinet/if_ether.h netinet/ether.h netinet/udp.h sys/ethernet.h fcntl.h time.h], [], [], |
|---|
| 64 | [[ |
|---|
| 65 | #ifdef HAVE_SYS_TYPES_H |
|---|
| 66 | #include <sys/types.h> |
|---|
| 67 | #endif |
|---|
| 68 | #ifdef HAVE_SYS_SOCKET_H |
|---|
| 69 | #include <sys/socket.h> |
|---|
| 70 | #endif |
|---|
| 71 | #ifdef HAVE_NETINET_IN_H |
|---|
| 72 | #include <netinet/in.h> |
|---|
| 73 | #endif |
|---|
| 74 | #ifdef HAVE_NETINET_IN_SYSTM_H |
|---|
| 75 | #include <netinet/in_systm.h> |
|---|
| 76 | #endif |
|---|
| 77 | #ifdef HAVE_NET_IF_H |
|---|
| 78 | #include <net/if.h> |
|---|
| 79 | #endif |
|---|
| 80 | ]] |
|---|
| 81 | ) |
|---|
| 82 | #AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [], []) |
|---|
| 83 | |
|---|
| 84 | # Checks for typedefs, structures, and compiler characteristics. |
|---|
| 85 | AC_C_CONST |
|---|
| 86 | #AC_TYPE_UID_T |
|---|
| 87 | #AC_STRUCT_TM |
|---|
| 88 | #AC_TYPE_UINT16_T |
|---|
| 89 | #AC_TYPE_UINT32_T |
|---|
| 90 | #AC_TYPE_UINT8_T |
|---|
| 91 | #AC_CHECK_MEMBER([struct sockaddr_in.sin_addr], [AC_DEFINE([HAVE_SIN_LEN], [1], [define if struct sockaddr_in.sin_len exists])]) |
|---|
| 92 | #AC_CHECK_TYPE([struct sockaddr_in], [AC_DEFINE([HAVE_STRUCT_IP6_HDR],[1],[define if struct ip6_hdr exists])]) |
|---|
| 93 | |
|---|
| 94 | AC_CHECK_TYPES([struct ip6_hdr], , , |
|---|
| 95 | [ |
|---|
| 96 | #ifdef HAVE_SYS_TYPES_H |
|---|
| 97 | #include <sys/types.h> |
|---|
| 98 | #endif |
|---|
| 99 | #ifdef HAVE_NETINET_IN_H |
|---|
| 100 | #include <netinet/in.h> |
|---|
| 101 | #endif |
|---|
| 102 | #ifdef HAVE_NETINET_IN6_H |
|---|
| 103 | #include <netinet/in6.h> |
|---|
| 104 | #endif |
|---|
| 105 | #ifdef HAVE_NETINET_IP6_H |
|---|
| 106 | #include <netinet/ip6.h> |
|---|
| 107 | #endif |
|---|
| 108 | ]) |
|---|
| 109 | |
|---|
| 110 | AC_CHECK_TYPES([struct iphdr], , , |
|---|
| 111 | [ |
|---|
| 112 | #ifdef HAVE_SYS_TYPES_H |
|---|
| 113 | #include <sys/types.h> |
|---|
| 114 | #endif |
|---|
| 115 | #ifdef HAVE_NETINET_IN_H |
|---|
| 116 | #include <netinet/in.h> |
|---|
| 117 | #endif |
|---|
| 118 | #ifdef HAVE_NETINET_IP_H |
|---|
| 119 | #include <netinet/ip.h> |
|---|
| 120 | #endif |
|---|
| 121 | ]) |
|---|
| 122 | |
|---|
| 123 | AC_CHECK_TYPES([struct ip], , , |
|---|
| 124 | [ |
|---|
| 125 | #ifdef HAVE_SYS_TYPES_H |
|---|
| 126 | #include <sys/types.h> |
|---|
| 127 | #endif |
|---|
| 128 | #ifdef HAVE_NETINET_IN_H |
|---|
| 129 | #include <netinet/in.h> |
|---|
| 130 | #endif |
|---|
| 131 | #ifdef HAVE_NETINET_IN_SYSTM_H |
|---|
| 132 | #include <netinet/in_systm.h> |
|---|
| 133 | #endif |
|---|
| 134 | #ifdef HAVE_NETINET_IP_H |
|---|
| 135 | #include <netinet/ip.h> |
|---|
| 136 | #endif |
|---|
| 137 | ]) |
|---|
| 138 | |
|---|
| 139 | AC_CHECK_MEMBER([struct sockaddr_in.sin_len], |
|---|
| 140 | [ AC_DEFINE(HAVE_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?]) ], |
|---|
| 141 | [], |
|---|
| 142 | [ |
|---|
| 143 | #ifdef HAVE_SYS_TYPES_H |
|---|
| 144 | #include <sys/types.h> |
|---|
| 145 | #endif |
|---|
| 146 | #ifdef HAVE_SYS_SOCKET_H |
|---|
| 147 | #include <sys/socket.h> |
|---|
| 148 | #endif |
|---|
| 149 | #ifdef HAVE_NETINET_IN_H |
|---|
| 150 | #include <netinet/in.h> |
|---|
| 151 | #endif |
|---|
| 152 | ]) |
|---|
| 153 | |
|---|
| 154 | AC_CHECK_MEMBER([struct stat.st_mtim], |
|---|
| 155 | [AC_DEFINE(HAVE_STAT_ST_MTIM, 1, [Do we have stat.st_mtim?])], |
|---|
| 156 | [ |
|---|
| 157 | AC_CHECK_MEMBER([struct stat.st_mtimespec], |
|---|
| 158 | [AC_DEFINE(HAVE_STAT_ST_MTIMESPEC, 1, [Do we have stat.st_mtimespec?])], |
|---|
| 159 | [], |
|---|
| 160 | [ |
|---|
| 161 | #ifdef HAVE_SYS_TYPES_H |
|---|
| 162 | #include <sys/types.h> |
|---|
| 163 | #endif |
|---|
| 164 | #ifdef HAVE_SYS_STAT_H |
|---|
| 165 | #include <sys/stat.h> |
|---|
| 166 | #endif |
|---|
| 167 | ]) |
|---|
| 168 | ], |
|---|
| 169 | [ |
|---|
| 170 | #ifdef HAVE_SYS_TYPES_H |
|---|
| 171 | #include <sys/types.h> |
|---|
| 172 | #endif |
|---|
| 173 | #ifdef HAVE_SYS_STAT_H |
|---|
| 174 | #include <sys/stat.h> |
|---|
| 175 | #endif |
|---|
| 176 | ]) |
|---|
| 177 | |
|---|
| 178 | AC_CHECK_MEMBER([struct ether_header.ether_dhost.ether_addr_octet], |
|---|
| 179 | [AC_DEFINE(HAVE_ETHER_ADDR_OCTET, 1, [Do we have ether_header.ether_dhost.ether_addr_octet])], |
|---|
| 180 | [], |
|---|
| 181 | [ |
|---|
| 182 | #ifdef HAVE_SYS_TYPES_H |
|---|
| 183 | #include <sys/types.h> |
|---|
| 184 | #endif |
|---|
| 185 | #ifdef HAVE_SYS_ETHERNET_H |
|---|
| 186 | #include <sys/ethernet.h> |
|---|
| 187 | #endif |
|---|
| 188 | ]) |
|---|
| 189 | |
|---|
| 190 | # Checks for library functions. |
|---|
| 191 | #AC_PROG_GCC_TRADITIONAL |
|---|
| 192 | #AC_FUNC_MALLOC |
|---|
| 193 | #AC_FUNC_MEMCMP |
|---|
| 194 | #AC_FUNC_SELECT_ARGTYPES |
|---|
| 195 | #AC_FUNC_STRFTIME |
|---|
| 196 | #AC_FUNC_VPRINTF |
|---|
| 197 | #AC_CHECK_FUNCS([clock_gettime memset select socket strchr strerror]) |
|---|
| 198 | AC_CHECK_FUNCS([strlcat strlcpy ether_ntoa ether_ntoa_r]) |
|---|
| 199 | |
|---|
| 200 | AC_CONFIG_FILES([Makefile src/cygwin/Makefile src/Makefile man/Makefile i2p/Makefile]) |
|---|
| 201 | AC_OUTPUT |
|---|
| 202 | |
|---|