forked from TheTorProject/stegotorus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
189 lines (167 loc) · 5.81 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
dnl Copyright 2011 Nick Mathewson, George Kadianakis
dnl Copyright 2011, 2012 SRI International
dnl See LICENSE for other credits and copying information
dnl
AC_PREREQ([2.61])dnl Possibly earlier will do, but this is what I have
AC_INIT([stegotorus], [0.0])
AC_CONFIG_SRCDIR([src/main.cc])
AC_CONFIG_AUX_DIR([config-aux])
AC_LANG([C++])
AM_INIT_AUTOMAKE([foreign nostdinc silent-rules subdir-objects])
AM_MAINTAINER_MODE([enable])
AC_PROG_RANLIB
dnl This script deliberately does not check for a bunch of things
dnl that 'autoscan' thinks we ought to check for. Here is the list,
dnl with a rationale for each:
dnl
dnl Defined by C89, therefore unnecessary to check for nowadays:
dnl
dnl AC_CHECK_FUNCS([memset strcasecmp strchr strerror strrchr strstr strtoul])
dnl AC_CHECK_HEADERS([limits.h stddef.h stdlib.h string.h])
dnl AC_CHECK_TYPES([ptrdiff_t])
dnl AC_TYPE_SIZE_T
dnl
dnl Dealt with by our 'xmalloc' and 'xrealloc' wrappers:
dnl
dnl AC_FUNC_MALLOC
dnl AC_FUNC_REALLOC
dnl
dnl Defined by C++ since cfront, therefore unnecessary to check for
dnl in a C++ program:
dnl
dnl AC_C_INLINE
dnl AC_HEADER_STDBOOL # 'bool', 'true', and 'false', not the header
dnl
dnl Defined by Unix98, therefore adequately handled by #ifdef _WIN32
dnl (FIXME: Windows has not been tested in some time and is likely to
dnl be broken):
dnl
dnl AC_CHECK_HEADERS([fcntl.h unistd.h arpa/inet.h netinet/in.h
dnl sys/types.h sys/stat.h sys/un.h sys/wait.h])
dnl AC_CHECK_FUNCS([gettimeofday])
dnl AC_FUNC_FORK
dnl AC_TYPE_PID_T
dnl
dnl libevent handles for us (FIXME: we probably shouldn't rely on this):
dnl
dnl AC_CHECK_HEADERS([stdint.h])
dnl AC_CHECK_FUNCS([socket])
dnl AC_TYPE_SSIZE_T
dnl AC_TYPE_UINT8_T
dnl AC_TYPE_UINT16_T
dnl AC_TYPE_UINT32_T
dnl AC_TYPE_UINT64_T
dnl
dnl The fallback is inappropriate for our use case (it would copy
dnl several enormous files), it is only required for 'make check'
dnl in an out-of-tree build, and it's slated to go away RSN anyway:
dnl
dnl AC_PROG_LN_S
### Compiler and language features ###
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CXXCPP
# Make a conditional for whether we're on Windows or not, so we can
# select the right version of certain files.
AC_CACHE_CHECK([for Windows], ac_cv_system_windows,
[AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
/* _WIN32 is defined for both Win32 and Win64 */
#ifndef _WIN32
#error "this is not Windows"
#endif
]])],
[ac_cv_system_windows=yes],
[ac_cv_system_windows=no])])
AM_CONDITIONAL(WINDOWS, test $ac_cv_system_windows = yes)
AX_SYS_EXTENSIONS
AC_SYS_LARGEFILE
AX_CXXFLAGS_STDCXX_11([ext])
AX_CXX_DELETE_METHOD
AX_CXX_STATIC_ASSERT
### Programs ###
AX_PROG_RANLIB
PKG_PROG_PKG_CONFIG
# We need python 2.7 for TestLoader.discover().
# The unit tests presently only work on POSIX systems,
# and are flaky enough that we let them be configured off.
AC_ARG_ENABLE(integration-tests,
[AS_HELP_STRING([--disable-integration-tests],
[Disable tests of the complete program])],
[], [enable_integration_tests=yes])
if test x$enable_integration_tests != xyes; then
AC_MSG_WARN([Integration tests disabled by configure option.])
PYOS=none
else
AM_PATH_PYTHON([2.7],, [:])
if test "$PYTHON" = ":"; then
AC_MSG_WARN([Python interpreter not found; integration tests disabled.])
PYOS=none
else
PYOS=`$PYTHON -c 'import os; print os.name'`
if test "$PYOS" != "posix"; then
AC_MSG_WARN([Not a POSIX platform; integration tests disabled.])
fi
fi
fi
AM_CONDITIONAL([INTEGRATION_TESTS], [test "$PYOS" = "posix"])
### Libraries ###
# Presently no need for libssl, only libcrypto.
# We require version 1.0.1 for GCM support.
PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.0.1])
# libevent 2.0 radically changed the API
PKG_CHECK_MODULES([libevent], [libevent >= 2.0])
# there's no good reason not to require the latest zlib, which is
# from 2009
PKG_CHECK_MODULES([libz], [zlib >= 1.2.3.4])
# libcurl for htt_apache steg module
PKG_CHECK_MODULES([libcurl], [libcurl >= 7.22.0])
# the portable c++ library for manipulating filesystem
PKG_CHECK_MODULES([libboost], [libboost >= 1.46.0])
# configuration reader
PKG_CHECK_MODULES([libconfig], [libconfig++ >= 1.4.8])
LIBS="$libevent_LIBS $libcrypto_LIBS $libz_LIBS $libcurl_LIBS $libboost_LIBS $libconfig_LIBS"
# libraries needed for tester proxy
PKG_CHECK_MODULES([libevent_openssl], [libevent_openssl >= 2.0])
PKG_CHECK_MODULES([libssl], [libssl >= 1.0])
lib_CPPFLAGS="$libevent_CFLAGS $libcrypto_CFLAGS $libz_CFLAGS $libevent_openssl_CPPFLAGS $libssl_CPPFLAGS"
AC_SUBST(lib_CPPFLAGS)
# ntohl and a bunch of related functions require a special library on Windows.
# It is possible that libevent or libcrypto has hooked us up already.
# This can't be done with AC_SEARCH_LIBS -- see m4/winsock.m4 for gory details.
AX_LIB_WINSOCK2
LIBS="$LIBS $ws32_LIBS"
# We might need to explicitly link -lm for floor().
AC_SEARCH_LIBS([floor], [m], [], [
AC_MSG_ERROR([unable to find 'floor'])
])
lib_LIBS="$LIBS"
lib_CPPFLAGS="$libevent_CFLAGS $libcrypto_CFLAGS $libz_CFLAGS"
LIBS=
AC_SUBST(lib_LIBS)
AC_SUBST(lib_CPPFLAGS)
# pgen_pcap needs libpcap.
pcap_LIBS=
HAVE_PCAP=no
AC_SEARCH_LIBS([pcap_open_offline], [pcap],
[AC_CACHE_CHECK([whether libpcap is usable], ac_cv_libpcap_usable,
[AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <pcap/pcap.h>]],
[[char f;
pcap_t *p = pcap_open_offline("",&f);]])],
[ac_cv_libpcap_usable=yes], [ac_cv_libpcap_usable=no])])
if test $ac_cv_libpcap_usable = yes; then
HAVE_PCAP=yes
pcap_LIBS="$LIBS"
fi],
[])
LIBS=
AC_SUBST(pcap_LIBS)
AM_CONDITIONAL(HAVE_PCAP, test $HAVE_PCAP = yes)
### System features ###
AC_CHECK_HEADERS([execinfo.h paths.h],,,[/**/])
AC_CHECK_FUNCS([closefrom execvpe])
### Output ###
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_COMMANDS_PRE([DEFS=])dnl Suppress pointless -DHAVE_CONFIG_H.
AC_OUTPUT