-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.in
245 lines (215 loc) · 7.24 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
dnl File: configure.in
dnl Revision: 1.0
dnl Created: 00/09/29
dnl Author: Michel Hoche-Mong ([email protected])
dnl $Id: configure.in,v 1.24 2009/04/04 09:08:40 hoche Exp $
dnl
AC_INIT
AC_CONFIG_SRCDIR(icb/main.c)
AC_CONFIG_HEADER(config.h)
AC_LANG(C)
dnl
dnl Some standard autoconfig stuff
dnl
AC_PROG_MAKE_SET
AC_PROG_CC
if [[ x"$GCC" = x"yes" ]]; then
CFLAGS="$CFLAGS -Wall"
fi
AC_PROG_CPP
dnl these checks are inane. make them be useful, hoche. -hoche.
AC_CHECK_PROG(RM, rm, rm, rm)
AC_CHECK_PROG(AR, ar, ar, ar)
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PATH_PROG(UNAME, uname, "")
AC_AIX
AC_ISC_POSIX
dnl
dnl standard type checking
dnl
AC_TYPE_SIGNAL
AC_CHECK_HEADERS([libgen.h])
AC_CHECK_FUNCS(strstr lrand48)
dnl
dnl Find libraries, functions and special programs
dnl
AC_CHECK_LIB(resolv, _res)
AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket -lnsl")
dnl readline needs termcap
AC_CHECK_LIB(termcap, tputs, LIBS="$LIBS -ltermcap", [
dnl hunt for shared libs
AC_MSG_CHECKING(for tputs in libtermcap.so)
for i in /lib \
/usr/lib \
/usr/local/lib \
; do
for j in `find $i -name "*termcap*" -print`; do
orig_libs=$LIBS
LIBS="$LIBS $j"
AC_TRY_LINK([
#include <stdio.h>
], [
tputs();
], [
AC_MSG_RESULT(shared library is $j)
], LIBS=${orig_libs})
if test x"${LIBS}" != x"${orig_libs}"; then
break 2;
fi
done
done
])
dnl TCL needs these
AC_CHECK_LIB(m, sqrt)
AC_CHECK_LIB(dl, dlsym)
dnl solaris needs this for signals
AC_CHECK_LIB(ucb,sigblock, LIBS="$LIBS -lucb")
dnl
dnl Here we define some --with & --enable things:
dnl
AC_ARG_ENABLE(debugging,
[ --enable-debugging Outputs extra debugging information at all
times. Normally, you should not enable this,
but instead use the -D flag of the commands,
which toggles debbuging output at runtime.
--disable-debugging Disallows debugging code to be built in.
This might provide some speed benefits.],
AC_DEFINE([DEBUG], [], [Defined if debugging is enabled.])
)
AC_ARG_ENABLE(developer,
[ --enable-developer Turns on super-duper-extra-compile-warnings
when using gcc.],
developer=yes
)
AC_ARG_WITH(ssl,
[ --with-ssl Enable SSL using OpenSSL. (Experimental)],
ssl="$with_ssl", ssl="no")
AC_ARG_ENABLE(static,
[ --enable-static[=ARG] With static linking.],
ICB_AC_SET_STATIC(enable_static), enable_static="" )
AC_ARG_WITH(default-host,
[ --with-default-host=\"default.icb.net\" Default icb server.],
icb_default_host="$with_default_host")
AC_ARG_WITH(default-port,
[ --with-default-port=7326 Default port to connect to.],
icb_default_port="$with_default_port")
dnl
dnl was developer mode set?
dnl
AC_MSG_CHECKING(for developer flags)
if test "x$developer" = "xyes" -a "x$ac_cv_prog_gcc" = "xyes"; then
devflags="-W -Wall"
#devflags="$devflags -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs"
CFLAGS="$CFLAGS $devflags"
else
devflags="none"
fi
AC_MSG_RESULT($devflags)
dnl
dnl was static set?
dnl
AC_MSG_CHECKING(for static linking flag)
if test x"$enable_static" != x; then
dnl not sure if it's right to just include -lc here
LIBS="$LIBS -lc"
STATICFLAG=$enable_static
AC_MSG_RESULT([$enable_static])
else
STATICFLAG=""
AC_MSG_RESULT(Not using static linking)
fi
AC_SUBST(STATICFLAG)
dnl
dnl compiling on MacOSX?
dnl
AC_MSG_CHECKING(if we're building on MacOS X)
if test `uname -s` = Darwin; then
AC_MSG_RESULT(yes. I'll use -all_load when linking.)
LDFLAGS="$LDFLAGS -all_load"
else
AC_MSG_RESULT(no)
fi
dnl Locate TCL and readline
dnl
ICB_AC_PATH_READLINE
ICB_AC_PATH_TCL
AH_TEMPLATE([HAVE_SSL])
AH_TEMPLATE([DEFAULT_SSL_PORT], [Default server port to connect to when using SSL.])
dnl Locate SSL libs.
if test x"$ssl" = x"yes" ; then
dnl Order matters!
if test "$PORTNAME" != "win32"; then
AC_SEARCH_LIBS(CRYPTO_new_ex_data, crypto, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
FOUND_SSL_LIB="no"
AC_SEARCH_LIBS(OPENSSL_init_ssl, ssl, [], [FOUND_SSL_LIB="yes"])
AC_SEARCH_LIBS(SSL_library_init, ssl, [], [FOUND_SSL_LIB="yes"])
AS_IF([test "x$FOUND_SSL_LIB" = xno], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
else
AC_SEARCH_LIBS(CRYPTO_new_ex_data, eay32 crypto, [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
FOUND_SSL_LIB="no"
AC_SEARCH_LIBS(OPENSSL_init_ssl, ssleay32 ssl, [FOUND_SSL_LIB="yes"])
AC_SEARCH_LIBS(SSL_library_init, ssleay32 ssl, [FOUND_SSL_LIB="yes"])
AS_IF([test "x$FOUND_SSL_LIB" = xno], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
fi
fi
if test x"$FOUND_SSL_LIB" = x"yes" ; then
AC_DEFINE([HAVE_SSL], [], [Define to enable SSL])
if test "x$icb_default_ssl_port" = "x"; then
AC_CACHE_CHECK("default server ssl port", ac_cv_icb_default_ssl_port, [
ac_cv_icb_default_ssl_port="7327" ])
else
ac_cv_icb_default_ssl_port=`eval echo "${icb_default_ssl_port}"`
fi
AC_DEFINE_UNQUOTED(DEFAULT_SSL_PORT, $ac_cv_icb_default_ssl_port)
AC_CHECK_FUNCS(TLS_client_method)
fi
dnl
dnl set default port
dnl
if test "x$icb_default_port" = "x"; then
AC_CACHE_CHECK("default server port", ac_cv_icb_default_port, [
ac_cv_icb_default_port="7326" ])
else
ac_cv_icb_default_port=`eval echo "${icb_default_port}"`
fi
AC_DEFINE_UNQUOTED([DEFAULT_PORT], $ac_cv_icb_default_port, [Default port to connect to.])
dnl
dnl set default host
dnl
if test "x$icb_default_host" = "x"; then
AC_CACHE_CHECK("default server", ac_cv_icb_default_host, [
ac_cv_icb_default_host="default.icb.net" ])
else
ac_cv_icb_default_host=`eval echo "${icb_default_host}"`
fi
AC_DEFINE_UNQUOTED([DEFAULT_HOST], "$ac_cv_icb_default_host", [Default host to connect to.])
dnl
dnl precheck prefix before setting datadir
dnl
if test "x${prefix}" = "xNONE" -o "x${prefix}" = "x" ; then
prefix="/usr/local"
fi
dnl
dnl set datadir
dnl this is a bloody horrible kludge of a way to change the datadir default
dnl from ${prefix}/share to ${prefix}/share/icb, and means that you can't
dnl use --datadir to set it back to ${prefix}/share, but until something
dnl better comes along, it'll have to do. Besides, ${prefix}/share is Just
dnl Wrong anyway.
dnl
def_datadir=`eval echo "${prefix}/share"`
actual_datadir=`eval echo "${datadir}"`
if test "x${actual_datadir}" = "x" -o "x${actual_datadir}" = "x${def_datadir}" ; then
icb_sys_datadir=`eval echo "${prefix}/share/icb"`
else
icb_sys_datadir=`eval echo "${actual_datadir}"`
fi
datadir=${icb_sys_datadir}
icb_server_db=`eval echo "${icb_sys_datadir}/icbserverdb"`
AC_DEFINE_UNQUOTED(ICB_SYS_DATADIR, "$icb_sys_datadir", [Directory to store the system files like icbserverdb])
AC_DEFINE_UNQUOTED(SERVERLIST, "$icb_server_db", [The full path to the icbserverdb file])
dnl
dnl OK! Done! Generate the files.
dnl
AC_OUTPUT(Makefile icb/Makefile, echo timestamp > stamp-h)