forked from adulau/ssldump
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
250 lines (221 loc) · 7.2 KB
/
configure.in
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
dnl Copyright (C) 1999-2000 RTFM, Inc.
dnl All Rights Reserved
dnl This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
dnl <ekr\@rtfm.com> and licensed by RTFM, Inc.
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
dnl are met:
dnl 1. Redistributions of source code must retain the above copyright
dnl notice, this list of conditions and the following disclaimer.
dnl 2. Redistributions in binary form must reproduce the above copyright
dnl notice, this list of conditions and the following disclaimer in the
dnl documentation and/or other materials provided with the distribution.
dnl 3. All advertising materials mentioning features or use of this software
dnl must display the following acknowledgement:
dnl
dnl This product includes software developed by Eric Rescorla for
dnl RTFM, Inc.
dnl
dnl 4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be
dnl used to endorse or promote products derived from this
dnl software without specific prior written permission.
dnl
dnl THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND
dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
dnl ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE.
dnl Process this file with autoconf to produce a configure script.
AC_INIT(base/pcap-snoop.c)
AC_CANONICAL_SYSTEM
dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_MSG_RESULT(configuring for $target_os)
dnl Replace `main' with a function in -lm:
AC_CHECK_LIB(m, pow)
dnl System-specific stuff
case "$target_os" in
linux*)
DEFINES="$DEFINES -D_BSD_SOURCE=1 -DLINUX"
;;
solaris*)
LIBS="$LIBS -lsocket -lnsl"
;;
esac
RECORD_MOD="dummy"
dnl Look for PCAP
dnl We absolutely need pcap
ac_pcap_inc_dir="/usr/include /usr/include/pcap /usr/local/include"
ac_pcap_lib_dir="/usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib"
AC_ARG_WITH(pcap,[--with-pcap root location for pcap library],
if test "$withval" = "no"; then
AC_MSG_ERROR(PCAP required for ssldump)
else
ac_pcap_inc_dir=$withval/include
ac_pcap_lib_dir=$withval/lib
fi
)
AC_ARG_WITH(pcap-inc,[--with-pcap-inc PCAP include files],
ac_pcap_inc_dir=$withval
)
AC_ARG_WITH(pcap-lib,[--with-pcap-lib PCAP library files],
ac_pcap_lib_dir=$withval
)
dnl Now look for it
AC_MSG_CHECKING(for PCAP include files)
ac_found_pcap_inc_dir="no"
for dir in $ac_pcap_inc_dir; do
if test -f $dir/pcap.h; then
if test "$dir" != "/usr/include"; then
INCLUDES="-I$dir $INCLUDES"
fi
ac_found_pcap_inc_dir=$dir
echo "found in $dir"
break;
fi
done
if test "$ac_found_pcap_inc_dir" = "no"; then
echo
AC_MSG_ERROR(Couldn't find PCAP includes: needed for ssldump)
fi
AC_MSG_CHECKING(for PCAP library)
ac_found_pcap_lib_dir="no"
for dir in $ac_pcap_lib_dir; do
if test -f $dir/libpcap.a -o -f $dir/libpcap.so; then
dnl Ok, we think we've found them, but check that they
dnl actually ontain the right functions
save_LIBS=$LIBS
save_LDFLAGS=$LDFLAGS
LIBS="-lpcap $LIBS"
if test "$dir" != "/usr/lib" -a "$dir" != "/usr/lib64"; then
LDFLAGS="-L$dir $LDFLAGS"
fi
AC_TRY_LINK_FUNC(pcap_open_live,ac_linked_libpcap="true",
ac_linked_libpcap="false");
if test "$ac_linked_libpcap" != "false"; then
ac_found_pcap_lib_dir=$dir
break
fi
LIBS=$save_LIBS
LDFLAGS=$save_LDFLAGS
fi
done
if test "$ac_found_pcap_lib_dir" = "no"; then
echo
AC_MSG_ERROR(Couldn't find PCAP library: needed for ssldump)
else
echo "found in $ac_found_pcap_lib_dir"
fi
dnl See if we can find OpenSSL
dnl We can compile without OpenSSL if we have to
ac_use_openssl="true"
ac_openssl_lib_dir="/usr/lib /usr/local /usr/local/ssl /usr/local/ssl/lib /usr/pkg"
ac_openssl_inc_dir="/usr/include /usr/local /usr/local/ssl /usr/pkg /usr/local/ssl/include"
AC_ARG_WITH(openssl,[--with-openssl root location for OpenSSL],
if test "$withval" = "no"; then
ac_use_openssl="false"
else
ac_openssl_lib_dir="$withval/lib $withval"
ac_openssl_inc_dir=$withval/include
fi
)
AC_ARG_WITH(openssl-inc,[--with-openssl-inc OpenSSL include files],
ac_openssl_inc_dir=$withval
)
AC_ARG_WITH(openssl-lib,[--with-openssl-lib OpenSSL library files],
ac_openssl_lib_dir=$withval
)
dnl Now look for OpenSSL
if test "$ac_use_openssl" != "false"; then
ac_found_openssl_inc_dir="no"
AC_MSG_CHECKING(for OpenSSL include files)
for dir in $ac_openssl_inc_dir; do
if test -f $dir/openssl/ssl.h; then
ac_found_openssl_inc_dir=$dir
break
fi
done
if test "$ac_found_openssl_inc_dir" != "no"; then
echo "found in $ac_found_openssl_inc_dir"
else
echo "not found."
ac_use_openssl="false"
fi
fi
if test "$ac_use_openssl" != "false"; then
ac_found_openssl_lib_dir="no"
AC_MSG_CHECKING(for OpenSSL libraries)
for dir in $ac_openssl_lib_dir; do
found_ssl="false"
if test -f $dir/libssl.a -a -f $dir/libcrypto.a; then
found_ssl="true"
fi
if test -f $dir/libssl.so -a -f $dir/libcrypto.so; then
found_ssl="true"
fi
if $found_ssl != "false"; then
dnl Ok, we think we've found them, but check that they
dnl actually ontain the right functions
save_LIBS=$LIBS
save_LDFLAGS=$LDFLAGS
LIBS="-lssl -lcrypto $LIBS"
LDFLAGS="-L$dir $LDFLAGS"
AC_TRY_LINK_FUNC(SSL_load_error_strings,ac_linked_libssl="true",
ac_linked_libssl="false");
AC_TRY_LINK_FUNC(RC4_set_key,ac_linked_libcrypto="true",
ac_linked_libcrypto="false");
if test "$ac_linked_libssl" != "false" -a \
"$ac_linked_libcrypto" != "false"; then
ac_found_openssl_lib_dir=$dir
break
fi
LIBS=$save_LIBS
LDFLAGS=$save_LDFLAGS
fi
done
if test "$ac_found_openssl_lib_dir" != "no"; then
echo "found in $ac_found_openssl_lib_dir"
INCLUDES="-I$ac_found_openssl_inc_dir $INCLUDES"
DEFINES="-DOPENSSL $DEFINES"
else
echo "not found."
ac_use_openssl="false"
fi
fi
if test "$ac_use_openssl" = "false"; then
AC_MSG_WARN(compiling without OpenSSL)
fi
AC_ARG_WITH(record,[--with-record Compile with record module (EKR Use Only)],
DEFINES="-DENABLE_RECORD $DEFINES"
RECORD_MOD="record"
)
dnl Replace `main' with a function in -lpcap:
AC_CHECK_LIB(pcap, pcap_open)
dnl Checks for header files.
AC_CHECK_HEADERS(sys/time.h)
AC_HEADER_STDC
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
dnl Find a 4-byte integer size
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned long long)
dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strdup)
AC_SUBST(RECORD_MOD)
AC_SUBST(INCLUDES)
AC_SUBST(DEFINES)
AC_OUTPUT(Makefile)