forked from libtorrent/libtorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
453 lines (408 loc) · 13.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
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
AC_PREREQ(2.60)
AC_INIT([libtorrent-rasterbar], [0.15.0], [[email protected]])
AM_INIT_AUTOMAKE(foreign 1.10)
AC_CONFIG_SRCDIR([src/torrent.cpp])
dnl ---------------------------------------------------------------------------
dnl interface version info
dnl ---------------------------------------------------------------------------
dnl Advanced information about versioning:
dnl * "Writing shared libraries" by Mike Hearn
dnl http://navi.cx/~mike/writing-shared-libraries.html
dnl * libtool.info chapter "Versioning"
dnl * libtool.info chapter "Updating library version information"
dnl ---------------------------------------------------------------------------
dnl Versioning:
dnl - CURRENT (Major): Increment if the interface has changes. AGE is always
dnl *changed* at the same time.
dnl - AGE (Micro): Increment if any interfaces have been added; set to 0
dnl if any interfaces have been removed. Removal has
dnl precedence over adding, so set to 0 if both happened.
dnl It denotes upward compatibility.
dnl - REVISION (Minor): Increment any time the source changes; set to
dnl 0 if you incremented CURRENT.
dnl
dnl To summarize. Any interface *change* increment CURRENT. If that interface
dnl change does not break upward compatibility (ie it is an addition),
dnl increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
dnl REVISION is set to 0, otherwise REVISION is incremented.
dnl ---------------------------------------------------------------------------
VERSION_INFO_CURRENT=5
VERSION_INFO_REVISION=0
VERSION_INFO_AGE=0
INTERFACE_VERSION_INFO=$VERSION_INFO_CURRENT:$VERSION_INFO_REVISION:$VERSION_INFO_AGE
AC_SUBST(INTERFACE_VERSION_INFO)
dnl ---------------------------------------------------------------------------
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
if test -z "$(which $CC)"; then
AC_MSG_ERROR([Unable to find a working C compiler, giving up.])
fi
AC_PROG_CPP
AC_PROG_CXX
if test -z "$(which $CXX)"; then
AC_MSG_ERROR([Unable to find a working C++ compiler, giving up.])
fi
AC_CACHE_SAVE
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
# AC_PROG_RANLIB is obsolete by AC_PROC_LIBTOOL
AC_SYS_LARGEFILE
dnl Check for pthreads.
ACX_PTHREAD
AM_CONDITIONAL([ENABLE_SHIPPED_ASIO], false)
dnl Check for boost libraries.
AX_BOOST_BASE([1.35],[
AX_BOOST_SYSTEM
dnl check that Boost.System was found:
if test -z "$BOOST_SYSTEM_LIB"; then
AC_MSG_ERROR([unable to find Boost.System library, currently this is required.])
fi
AX_BOOST_ASIO
dnl check that Boost.Asio was found:
if test -z "$BOOST_ASIO_LIB"; then
AC_MSG_ERROR([Unable to find Boost.Asio library, currently this is required.])
fi
],[
AX_BOOST_BASE([1.34],[
dnl the user can choose which Asio library to use
AC_ARG_WITH([asio],
AS_HELP_STRING([--with-asio=shipped|system|your_path],
[Specify the Asio library to use, shipped or system. Default is to use shipped library. You can also specify a path for your system.]),
[[asio=$withval]],
[[asio=shipped]]
)
dnl Check the value for the --with-asio switch
AC_MSG_CHECKING([which Asio implementation to use])
case "$asio" in
"shipped")
AC_MSG_RESULT(shipped)
ASIO_HPP=`dirname $0`/include/libtorrent/asio.hpp
ASIO_DIR=`dirname $0`/include/libtorrent/asio
AC_CHECK_FILES($ASIO_HPP $ASIO_DIR/ssl/stream.hpp $ASIO_DIR/ip/tcp.hpp,
enable_shipped_asio=yes,
AC_MSG_ERROR([libtorrent-rasterbar depends on Asio library but it was not found.])
)
;;
"system")
AC_MSG_RESULT(system)
ASIO_HPP=/usr/include/asio.hpp
ASIO_DIR=/usr/include/asio
AC_CHECK_FILES($ASIO_HPP $ASIO_DIR/ssl/stream.hpp $ASIO_DIR/ip/tcp.hpp,
enable_shipped_asio=no,
AC_MSG_ERROR([libtorrent-rasterbar depends on Asio library but it was not found on your system.])
)
;;
*)
AC_MSG_RESULT(detect)
ASIO_HPP=$asio/../asio.hpp
ASIO_DIR=$asio
AC_CHECK_FILES($ASIO_HPP $ASIO_DIR/ssl/stream.hpp $ASIO_DIR/ip/tcp.hpp,
enable_shipped_asio=no,
AC_MSG_ERROR([libtorrent-rasterbar depends on Asio library but it was not found in the path you specified.])
)
;;
esac
AM_CONDITIONAL([ENABLE_SHIPPED_ASIO], [test x$enable_shipped_asio = "xyes"])
])
])
AC_MSG_NOTICE([BOOST_CPPFLAGS=$BOOST_CPPFLAGS])
AC_MSG_NOTICE([BOOST_LDFLAGS=$BOOST_LDFLAGS])
AX_BOOST_FILESYSTEM
dnl check that Boost.Filesystem was found:
if test -z "$BOOST_FILESYSTEM_LIB"; then
AC_MSG_ERROR([Unable to find Boost.Filesystem library, currently this is required.])
fi
AX_BOOST_THREAD
dnl check that Boost.Thread was found:
if test -z "$BOOST_THREAD_LIB"; then
AC_MSG_ERROR([Unable to find Boost.Thread library, currently this is required.])
fi
AX_BOOST_REGEX
dnl check that Boost.Regex was found:
if test -z "$BOOST_REGEX_LIB"; then
AC_MSG_RESULT([Unable to find Boost.Regex library, example test_client will not be build.])
BUILD_TESTCLIENT=no;
fi
dnl Apply boost config.
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
if [[ "x$BUILD_TESTCLIENT" != "xno" ]]; then
CLIENT_TEST_BIN=client_test;
AC_SUBST(CLIENT_TEST_BIN)
fi
dnl try different ways of resolving gethostbyname
AC_CHECK_FUNC(gethostbyname, ,
AC_CHECK_LIB(resolv, gethostbyname, ,
AC_CHECK_LIB(nsl, gethostbyname, ,
AC_CHECK_LIB(ws2_32, main,
AC_CHECK_LIB(wsock32, main, [LIBS="$LIBS -lws2_32 -lwsock32";] ,
AC_MSG_ERROR([wsock32 not found. Stopped.])) ,
AC_MSG_ERROR([gethostbyname not found. Stopped.]))))
)
dnl find out what kind of logging to use
AC_ARG_WITH(
[logging],
AS_HELP_STRING([--with-logging=none|default|verbose],[Specify how much logging to use. Default is none.]),
[[logging=$withval]],
[[logging=none]]
)
COMPILETIME_OPTIONS=""
dnl Check the value for the --with-logging switch
AC_MSG_CHECKING([what form of logging to use])
case "$logging" in
"none")
AC_MSG_RESULT(none)
;;
"default")
AC_MSG_RESULT(default)
AC_DEFINE(TORRENT_LOGGING,,[define to use some logging])
COMPILETIME_OPTIONS+="-DTORRENT_LOGGING "
;;
"verbose")
AC_MSG_RESULT(verbose)
AC_DEFINE(TORRENT_VERBOSE_LOGGING,,[define to use verbose logging])
COMPILETIME_OPTIONS+="-DTORRENT_VERBOSE_LOGGING "
;;
*)
AC_MSG_RESULT()
AC_MSG_ERROR([Unknown logging option "$logging". Use either "none", "default" or "verbose".])
;;
esac
dnl find out what kind of dht-support to use
AC_ARG_WITH(
[dht],
AS_HELP_STRING([--with-dht=on|off|logging],[Specify how to use DHT support. Option logging will add extra logging. Default is on.]),
[[dht=$withval]],
[[dht=on]]
)
dnl Check the value for the --with-dht switch
AC_MSG_CHECKING([how to use DHT])
case "$dht" in
"on")
AC_MSG_RESULT(on)
;;
"off")
AC_MSG_RESULT(off)
AC_DEFINE(TORRENT_DISABLE_DHT,,[define not to use DHT support])
COMPILETIME_OPTIONS+="-DTORRENT_DISABLE_DHT "
;;
"logging")
AC_MSG_RESULT(logging)
AC_DEFINE(TORRENT_DHT_VERBOSE_LOGGING,,[define to use DHT support with extra logging])
COMPILETIME_OPTIONS+="-DTORRENT_DHT_VERBOSE_LOGGING "
;;
*)
AC_MSG_RESULT()
AC_MSG_ERROR([Unknown dht option "$dht". Use either "on", "off" or "logging".])
;;
esac
AM_CONDITIONAL(USE_DHT, test "x$dht" != "xoff")
dnl encryption support.
AC_ARG_WITH(
[encryption],
AS_HELP_STRING([--with-encryption=on|off],[Specify how to use encryption support. Default is on.]),
[[encryption=$withval]],
[[encryption=on]]
)
dnl Check the value for the --with-encryption switch
AC_MSG_CHECKING([how to use encryption])
case "$encryption" in
"on")
AC_MSG_RESULT(on)
CHECK_SSL()
AC_DEFINE(TORRENT_USE_OPENSSL,,[define to use openssl with libtorrent-rasterbar])
COMPILETIME_OPTIONS+="-DTORRENT_USE_OPENSSL "
;;
"off")
AC_MSG_RESULT(off)
AC_DEFINE(TORRENT_DISABLE_ENCRYPTION,,[define not to use encryption support])
COMPILETIME_OPTIONS+="-DTORRENT_DISABLE_ENCRYPTION "
;;
*)
AC_MSG_RESULT()
AC_MSG_ERROR([Unknown encryption option "$encryption". Use either "on" or "off".])
;;
esac
AM_CONDITIONAL(USE_ENCRYPTION, test "x$encryption" != "xoff")
dnl the user can choose which zlib to use
AC_ARG_WITH(
[zlib],
AS_HELP_STRING([--with-zlib=shipped|system],[Specify the zlib to use, shipped or system. Default is to autodetect system and fallback to shipped.]),
[[zlib=$withval]],
[[zlib=detect]]
)
dnl Check the value for the --with-zlib switch
AC_MSG_CHECKING([which zlib implementation to use])
case "$zlib" in
"detect")
AC_MSG_RESULT([autodetect])
AC_CHECK_LIB(z, main, ,
[zlib="shipped"]
)
;;
"shipped")
AC_MSG_RESULT(shipped)
;;
"system")
AC_MSG_RESULT(system)
AC_CHECK_LIB(z, main, ,
AC_MSG_ERROR([libtorrent-rasterbar depends on zlib but zlib was not found on your system.])
)
;;
"no")
AC_MSG_RESULT()
AC_MSG_ERROR([libtorrent-rasterbar depends on zlib, you must specify either "system" or "shipped".])
;;
*)
AC_MSG_RESULT()
AC_MSG_ERROR([Unknown zlib option "$zlib". Use either "system" or "shipped".])
;;
esac
if [[ "$zlib" = "shipped" ]]; then
ZLIB="\$(top_builddir)/zlib/libzlib.la"
AM_CONDITIONAL([ENABLE_SHIPPED_ZLIB], true)
ZLIBINCL="-I\$(top_srcdir)/zlib"
elif [[ "$zlib" = "system" ]] || [[ "$zlib" = "detect" ]]; then
ZLIB="" # AC_CHECK_LIB will add -lz to @LIBS@ automatically
AM_CONDITIONAL([ENABLE_SHIPPED_ZLIB], false)
ZLIBINCL=""
fi
dnl make ZLIB and ZLIBDIR visible to Makefiles
AC_SUBST([ZLIB])
AC_SUBST([ZLIBINCL])
dnl Check whether python bindings should be build
AC_ARG_ENABLE(
[python-binding],
AS_HELP_STRING([--enable-python-binding],[Build python binding. Default is to not build them.]),
[[ac_python_binding=$enableval]],
[[ac_python_binding=no]]
)
AC_MSG_CHECKING([if python bindings should be build])
case "$ac_python_binding" in
"yes")
AC_MSG_RESULT(yes)
AM_PATH_PYTHON([2.4],,AC_MSG_ERROR([Python not found. Python is required to build python binding.]))
AX_BOOST_PYTHON
dnl check that Boost.Python was found:
if test -z "$BOOST_PYTHON_LIB"; then
AC_MSG_ERROR([Unable to find Boost.Python library, this is required to build python bindings.])
fi
AM_CONDITIONAL([ENABLE_PYTHON_BINDING],true)
;;
"no")
AC_MSG_RESULT(no)
AM_CONDITIONAL([ENABLE_PYTHON_BINDING],false)
;;
"")
AC_MSG_RESULT(no)
AM_CONDITIONAL([ENABLE_PYTHON_BINDING],false)
;;
*)
AC_MSG_RESULT()
AC_MSG_ERROR([Unknown --enable-python option "$python". Use either "yes" or "no".])
;;
esac
dnl Use possibly specific python install params
if [[ "x$PYTHON_INSTALL_PARAMS" == "x" ]]; then
PYTHON_INSTALL_PARAMS='--prefix=$(DESTDIR)$(prefix)'
fi
AC_SUBST(PYTHON_INSTALL_PARAMS)
dnl Check whether the examples should be build
AC_ARG_ENABLE(
[examples],
AS_HELP_STRING([--enable-examples],[Build the examples. Default is not to build them.]),
[[examples=$enableval]],
[[examples=no]]
)
dnl Check the value of the --with-examples switch
AC_MSG_CHECKING([if the examples should be build])
case "$examples" in
"yes")
AC_MSG_RESULT(yes)
AM_CONDITIONAL([ENABLE_EXAMPLES], true)
;;
"no")
AC_MSG_RESULT(no)
AM_CONDITIONAL([ENABLE_EXAMPLES], false)
;;
"")
AC_MSG_RESULT(yes (default))
AM_CONDITIONAL([ENABLE_EXAMPLES], true)
;;
*)
AC_MSG_RESULT()
AC_MSG_ERROR([Unknown --enable-examples option "$examples". Use either "yes" or "no".])
;;
esac
dnl Check whether the tests should be build
AC_ARG_ENABLE(
[tests],
AS_HELP_STRING([--enable-tests],[Build test files. Default is not to build them.]),
[[tests=$enableval]],
[[tests=no]]
)
dnl Check the value of the --with-tests switch
AC_MSG_CHECKING([if test files should be build])
case "$tests" in
"yes")
AC_MSG_RESULT(yes)
AM_CONDITIONAL([ENABLE_TESTS], true)
;;
"no")
AC_MSG_RESULT(no)
AM_CONDITIONAL([ENABLE_TESTS], false)
;;
"")
AC_MSG_RESULT(yes (default))
AM_CONDITIONAL([ENABLE_TESTS], true)
;;
*)
AC_MSG_RESULT()
AC_MSG_ERROR([Unknown --enable-tests option "$tests". Use either "yes" or "no".])
;;
esac
dnl Set some defines if we are building a shared library
if [[ "x$enable_shared" == "xyes" ]]; then
AC_DEFINE(TORRENT_BUILDING_SHARED,,[Make sure the functions and classes are exported.])
COMPILETIME_OPTIONS+="-DTORRENT_LINKING_SHARED "
fi
AC_DEFINE(BOOST_EXCEPTION_DISABLE,,[We don't need boost.exception features])
COMPILETIME_OPTIONS+="-DBOOST_EXCEPTION_DISABLE "
dnl want some debugging symbols with that?
AC_ARG_ENABLE(
[debug],
AS_HELP_STRING([--enable-debug],[Set compiler flags for debug symbols, default is no debugging.]),
[case "$enableval" in
no)
AC_DEFINE(NDEBUG,,[Define to disable debugging])
DEBUGFLAGS="-Os"
# COMPILETIME_OPTIONS+="-DNDEBUG "
;;
yes)
DEBUGFLAGS="-g"
COMPILETIME_OPTIONS+="-DTORRENT_DEBUG "
AC_DEFINE(TORRENT_DEBUG,,[Define to enable libtorrent debug build])
;;
*)
AC_MSG_RESULT()
AC_MSG_ERROR([Unknown --enable-debug option "$enableval". Use either "yes" or "no".])
;;
esac],
[DEBUGFLAGS="-Os"
AC_DEFINE(NDEBUG,,[Define to disable debugging])
# COMPILETIME_OPTIONS+="-DNDEBUG "
]
)
AC_SUBST(DEBUGFLAGS)
dnl Compile time options.
AC_SUBST(COMPILETIME_OPTIONS)
AC_OUTPUT([Makefile
src/Makefile
include/Makefile
zlib/Makefile
examples/Makefile
test/Makefile
bindings/python/Makefile
bindings/python/setup.py
libtorrent-rasterbar.pc])