-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
330 lines (288 loc) · 9.5 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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
dnl Process this file with autoconf to produce a configure script.
dnl
dnl configure.in
dnl -------------------
dnl copyright : (C) 2002-2004 by Simone Tellini
dnl email : [email protected]
dnl revision : $Id: configure.in,v 1.20 2004-09-12 11:52:52 tellini Exp $
dnl
dnl -----------------------------------
dnl Setup
dnl -----------------------------------
AC_INIT(src/Makefile.am)
AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER(src/include/config.h:src/include/config-h.in)
AM_INIT_AUTOMAKE(prometeo, 1.6)
AC_LANG([C++])
dnl this doesn't work as I'd like it to
dnl AC_PREFIX_DEFAULT(/usr/local/prometeo)
test "$prefix" = NONE && prefix=/usr/local/prometeo
test "$exec_prefix" = NONE && exec_prefix=/usr/local/prometeo
eval conftemp=${sysconfdir}
AC_DEFINE_UNQUOTED( CFG_DIR, "$conftemp", [Config directory] )
eval conftemp=${libdir}
AC_DEFINE_UNQUOTED( MOD_DIR, "$conftemp/prometeo", [Modules directory] )
eval conftemp=${datadir}
AC_DEFINE_UNQUOTED( DATA_DIR, "$conftemp/prometeo", [Data directory] )
dnl -----------------------------------
dnl Checks for programs.
dnl -----------------------------------
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_CHECK_TOOL( SED, sed )
dnl -----------------------------------
dnl Check for libltdl
dnl -----------------------------------
AC_LIBTOOL_DLOPEN
AC_LIBLTDL_CONVENIENCE
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_CONFIG_SUBDIRS(libltdl)
AC_SUBST(LIBTOOL_DEPS)
dnl -----------------------------------
dnl Check for headers
dnl -----------------------------------
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(string.h strings.h unistd.h syslog.h sys/syslog.h sys/pstat.h libutil.h zlib.h)
AC_CHECK_HEADER(security/pam_appl.h,
[AC_DEFINE(HAVE_SECURITY_PAM_APPL_H, 1, [Define to 1 if you have the <security/pam_appl.h> header file])],
[AC_CHECK_HEADER(bsd_auth.h,
[AC_DEFINE(HAVE_BSD_AUTH_H, 1, [Define to 1 if you have the <bsd_auth.h> header file])],
[AC_MSG_ERROR(No usable authentication library found!)])
])
AC_CHECK_HEADER(sdom.h, [], [AC_MSG_ERROR(Cannot find sablotron headers!)])
AC_CHECK_HEADERS(netinet/ip.h netinet/ip_fil.h netinet/ip_nat.h)
AC_CHECK_HEADERS(netinet/ip_compat.h netinet/ip_fil_compat.h)
AC_CHECK_HEADERS(linux/netfilter_ipv4.h)
dnl -----------------------------------
dnl Checks for typedefs, structures and
dnl compiler characteristics
dnl -----------------------------------
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CACHE_CHECK([for socklen_t], [promac_cv_var_socklen_t],
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[socklen_t len; len = 1;],
[promac_cv_var_socklen_t=yes],
[promac_cv_var_socklen_t=no])
])
if test "$promac_cv_var_socklen_t" = no ; then
AC_DEFINE( socklen_t, int, [Define to 'int' if <sys/socket.h> doesn't provide it.] )
fi
AC_CACHE_CHECK([for MSG_NOSIGNAL], [promac_cv_var_msg_no_signal],
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[int foo = MSG_NOSIGNAL;],
[promac_cv_var_msg_no_signal=yes],
[promac_cv_var_msg_no_signal=no])
])
if test "$promac_cv_var_msg_no_signal" = no ; then
AC_DEFINE( MSG_NOSIGNAL, 0, [Define to 0 if <sys/socket.h> doesn't define MSG_NOSIGNAL.])
fi
AC_CACHE_CHECK([whether sockaddr_un has sun_len], [promac_cv_var_SOCKADDR_UN_LEN],
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>],
[struct sockaddr_un addr; addr.sun_len = 1;],
[promac_cv_var_SOCKADDR_UN_LEN=yes],
[promac_cv_var_SOCKADDR_UN_LEN=no])
])
if test "$promac_cv_var_SOCKADDR_UN_LEN" = yes ; then
AC_DEFINE( HAVE_SOCKADDR_UN_LEN, 1, [Define if sockaddr_un has the sun_len field] )
fi
AC_CACHE_CHECK([for msg_accrights field in struct msghdr], promac_cv_have_accrights_in_msghdr,
[AC_TRY_RUN(
[#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
int main() {
#ifdef msg_accrights
exit(1);
#endif
struct msghdr m;
m.msg_accrights = 0;
exit(0);
}],
[ promac_cv_have_accrights_in_msghdr="yes"],
[ promac_cv_have_accrights_in_msghdr="no" ])
])
if test "x$promac_cv_have_accrights_in_msghdr" = "xyes" ; then
AC_DEFINE( HAVE_ACCRIGHTS_IN_MSGHDR, 1, [Define if msghdr has the msg_accrights field] )
fi
AC_CACHE_CHECK([for msg_control field in struct msghdr], promac_cv_have_control_in_msghdr,
[AC_TRY_RUN(
[#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
int main() {
#ifdef msg_control
exit(1);
#endif
struct msghdr m;
m.msg_control = 0;
exit(0);
}],
[ promac_cv_have_control_in_msghdr="yes" ],
[ promac_cv_have_control_in_msghdr="no" ])
])
if test "x$promac_cv_have_control_in_msghdr" = "xyes" ; then
AC_DEFINE( HAVE_CONTROL_IN_MSGHDR, 1, [Define if msghdr has the msg_control field] )
fi
dnl -----------------------------------
dnl Check for options
dnl -----------------------------------
use_ssl="no"
AC_ARG_WITH( openssl,
[ --with-openssl[[=DIR]] build with OpenSSL support [[/usr/local/ssl]]],
[
case "$withval" in
no)
openssl_prefix=""
;;
yes)
openssl_prefix="/usr/local/ssl"
use_ssl="yes"
AC_DEFINE( USE_SSL, 1, [Define to build with OpenSSL support] )
;;
*)
openssl_prefix=$withval
use_ssl="yes"
AC_DEFINE( USE_SSL, 1, [Define to build with OpenSSL support] )
esac
],
[openssl_prefix=""]
)
if test "x$openssl_prefix" != "x" ; then
LDFLAGS="-L${openssl_prefix}/lib ${LDFLAGS}"
CPPFLAGS="-I${openssl_prefix}/include ${CPPFLAGS}"
fi
dnl -----------------------------------
dnl Check for libraries functions
dnl -----------------------------------
AC_CHECK_FUNCS(memset memcpy strdup strncmp)
AC_CHECK_FUNCS(setsid setproctitle)
AC_CHECK_FUNCS(sendmsg recvmsg)
AM_WITH_EXPAT
AC_CHECK_LIB(util, setproctitle, [AC_DEFINE(HAVE_SETPROCTITLE, 1, [Define if you have setproctitle()])])
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(nsl, gethostent,, [AC_CHECK_LIB(resolv, gethostbyname)])
AC_CHECK_LIB(z, deflate)
AC_CHECK_LIB(pam, pam_start, [], [AC_MSG_ERROR([library 'pam' is required])])
if test "x$openssl_prefix" != "x" ; then
dnl Order matters!
AC_CHECK_LIB(crypto, [CRYPTO_new_ex_data], [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
AC_CHECK_LIB(ssl, [SSL_library_init], [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
fi
AC_MSG_CHECKING([for Sablotron])
saved_libs=$LIBS
LIBS="$LIBS -lsablot ${EXPAT_LIBS}"
AC_TRY_LINK(
[#include <sdom.h>],
[SablotCreateProcessor( NULL );],
[AC_MSG_RESULT(ok)],
[AC_MSG_ERROR([library sablotron is required])]
)
LIBS=$saved_libs
dnl -----------------------------------
dnl Misc functions checks
dnl -----------------------------------
AC_CACHE_CHECK([whether vsyslog accepts a stdarg va_list], [promac_cv_var_VSYSLOG],
[AC_TRY_LINK(
[#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
#ifdef HAVE_SYS_SYSLOG_H
#include <sys/syslog.h>
#endif
#include <stdarg.h>],
[ void foo( int a, char *b, ... ) { va_list ap; va_start( ap, b ); vsyslog( a, b, ap ); va_end( ap ); } ],
[promac_cv_var_VSYSLOG=yes],
[promac_cv_var_VSYSLOG=no])
])
if test "$promac_cv_var_VSYSLOG" = yes ; then
AC_DEFINE( HAVE_VSYSLOG, 1, [Define if there is a stdarg-compatible vsyslog function] )
fi
AC_CACHE_CHECK([for PS_STRINGS], [promac_cv_var_PS_STRINGS],
[AC_TRY_LINK(
[#include <machine/vmparam.h>
#include <sys/exec.h>
],
[PS_STRINGS->ps_nargvstr = 1;
PS_STRINGS->ps_argvstr = "foo";],
[promac_cv_var_PS_STRINGS=yes],
[promac_cv_var_PS_STRINGS=no])
])
if test "$promac_cv_var_PS_STRINGS" = yes ; then
AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS thing exists.])
fi
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 enable IPv6 support],
[use_ipv6="$enableval"],
[use_ipv6="no"]
)
if test "$use_ipv6" = "yes" ; then
AC_CACHE_CHECK([for IPv6 support], [promac_cv_var_IPV6],
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[int foo = AF_INET6;],
[promac_cv_var_IPV6=yes],
[promac_cv_var_IPV6=no])
])
if test "$promac_cv_var_IPV6" = yes ; then
AC_DEFINE( HAVE_IPV6, 1, [Define if IPv6 support is available.] )
fi
AC_CACHE_CHECK([for getipnodebyname], [promac_cv_var_GETIPNODEBYNAME],
[AC_TRY_LINK(
[#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
],
[getipnodebyname( "foo", AF_INET6, 0, NULL );],
[promac_cv_var_GETIPNODEBYNAME=yes],
[promac_cv_var_GETIPNODEBYNAME=no])
])
if test "$promac_cv_var_GETIPNODEBYNAME" = yes ; then
AC_DEFINE( HAVE_GETIPNODEBYNAME, 1, [Define if you have the getipnodebyname function.] )
fi
fi
AC_ARG_ENABLE(debug,
[ --enable-debug enable debug logging]
[use_debug="$enableval"],
[use_debug="no"]
)
if test "$use_debug" = "yes" ; then
AC_DEFINE( DEBUG, 1, [Define to 1 to enable debug logging.] )
fi
dnl -----------------------------------
dnl Substitute symbols
dnl -----------------------------------
AC_SUBST(ac_aux_dir)
AC_SUBST(sysconfdir)
AC_SUBST(CPPFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(INCLTDL)
AC_SUBST(LIBLTDL)
AC_SUBST(EXPAT_LIBS)
AM_CONDITIONAL(BUILD_WITH_SSL, test "$use_ssl" = "yes" )
dnl -----------------------------------
dnl Genereate the output files
dnl -----------------------------------
AC_OUTPUT([Makefile src/Makefile src/libprom/Makefile src/prometeo/Makefile
src/include/Makefile src/prometeoctl/Makefile src/mod_tunnel/Makefile
src/mod_http/Makefile src/mod_ftp/Makefile
src/mod_cfg/Makefile src/mod_cfg/data/Makefile
src/mod_ssl/Makefile src/mod_pop3/Makefile src/mod_socks5/Makefile],
[test -z "$CONFIG_HEADERS" || echo timestamp > src/include/stamp-h.in])