forked from azet/thc-tls-dos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
174 lines (142 loc) · 3.8 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
AC_INIT(src/thc-ssl-dos.c)
VER=`cat ${srcdir}/VERSION`
AC_MSG_RESULT(Begining autoconfiguration process for thc-ssl-dos-$VER...)
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(thc-ssl-dos, $VER)
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
dnl AC_PROG_LIBTOOL
dnl AC_DISABLE_SHARED
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_C_CONST
if test $ac_cv_prog_gcc = yes; then
CCOPTS='-O2 -Wall'
CFLAGS="$CCOPTS"
fi
test "x${prefix}" != "xNONE" || prefix="/usr/local"
test "x${exec_prefix}" != "xNONE" || exec_prefix="${prefix}"
trydir_i="${prefix}/include"
trydir_l="${prefix}/lib"
if test "x${prefix}" != "x/usr/local"; then
trydir_i="${trydir_i} /usr/local/include"
trydir_l="${trydir_l} /usr/local/lib"
fi
my_top_srcdir=`cd $srcdir; pwd`
my_toptop_srcdir=`cd $my_top_srcdir/..; pwd`
dnl INCLUDES="-I${my_top_srcdir}/inc $INCLUDES"
trydir_i="${trydir_i}"
AC_ARG_WITH(includes,
[ --with-includes=DIR Space-seperated list of include dirs],
[
trydir_i="$trydir_i ${withval}"
])
for xincdir in $trydir_i; do
if test ! -d "$xincdir"; then
continue;
fi
INCLUDES="$INCLUDES -I${xincdir}"
done
CPPFLAGS="${INCLUDES} $CPPFLAGS"
LIBDIR="-L./ $LIBDIR"
trydir_l="${trydir_l}"
AC_ARG_WITH(libs,
[ --with-libs=DIR Space-seperated list of li brary directories],
[
trydir_l="$trydir_l ${withval}"
])
for xlibdir in $trydir_l; do
if test ! -d "$xlibdir"; then
continue;
fi
LIBDIR="$LIBDIR -L${xlibdir}";
done
LDFLAGS="${LIBDIR} $LDFLAGS"
BUILD_STATIC=0
AC_MSG_CHECKING(whether to compile a static binary)
AC_ARG_ENABLE(static,
[ --enable-static Build a static binary],
[ case "$enableval" in
*)
AC_MSG_RESULT(yes)
BUILD_STATIC=1
;;
esac ],
AC_MSG_RESULT(no)
)
if test x"${BUILD_STATIC}" = "x1"; then
CFLAGS="${CFLAGS} -static"
LIBS="${LIBS} -ldl"
fi
WITH_DEBUG=0
AC_MSG_CHECKING(whether to compile with DEBUG flag)
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debug compilation],
[ case "$enableval" in
*)
AC_MSG_RESULT(yes)
WITH_DEBUG=1
;;
esac ],
AC_MSG_RESULT(no)
)
AC_CHECK_FILE([/dev/urandom], AC_DEFINE([HAVE_DEVURANDOM], [1], [Define that you found /dev/urandom]))
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(crypto, DH_free,, AC_MSG_ERROR(libcrypto not found [part of openssl].))
AC_CHECK_LIB(ssl, BIO_new_ssl,, AC_MSG_ERROR(openssl library not found.))
AC_MSG_CHECKING(OpenSSL library version)
AC_TRY_RUN([
#include <stdio.h>
#include <openssl/opensslv.h>
#if (OPENSSL_VERSION_NUMBER < 0x009080cf)
# error "new version required\n"
#endif
int main() { return 0; }
],
[AC_MSG_RESULT(ok)
OPENSSL_TO_OLD=0],
[AC_MSG_RESULT(to old)
OPENSSL_TO_OLD=1])
dnl [AC_MSG_ERROR(openssl headers not found)])
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(sys/time.h unistd.h string.h)
AC_C_CONST
AC_HEADER_TIME
AC_FUNC_MEMCMP
AC_TYPE_SIZE_T
AC_CHECK_TYPES(u_int32_t)
AC_CHECK_TYPES(uint32_t)
AC_CHECK_FUNCS(gettimeofday memcpy strchr snprintf vsnprintf)
if test x"${WITH_DEBUG}" = "x1"; then
AC_DEFINE(OPSH_WITH_DEBUG, 1, [def])
CFLAGS="${CFLAGS} -ggdb"
fi
AC_DEFINE(IS_UNIX, 1, [def])
dnl AC_SUBST(RSAREFLIB)
AC_OUTPUT(Makefile src/Makefile)
echo "THC-SSL-DOWN has been configured with the following options:"
echo ""
echo " Host: ${host}"
echo " Compiler: ${CC}"
echo " Compiler Flags: ${CFLAGS}"
echo "Preprocessor flags: ${CPPFLAGS}"
echo " Linker flags: ${LDFLAGS}"
echo " Libraries: ${LIBS}"
if test x"${OPENSSL_TO_OLD}" != "x0"; then
echo "WARNING: OPENSSL LIBRARIES ARE TO OLD! UPDATE THEM!\n"
sleep 1
echo "WARNING: OPENSSL LIBRARIES ARE TO OLD! UPDATE THEM!\n"
sleep 1
echo "WARNING: OPENSSL LIBRARIES ARE TO OLD! UPDATE THEM!\n"
sleep 1
fi
echo ""
if test x"${WITH_DEBUG}" = "x1"; then
echo " Debug build: Yes"
else
echo " Debug build: No"
fi
echo "Configuration complete. Now type: make all install"