3
AC_INIT([libtorrent-rasterbar], [0.14.10], [arvid@cs.umu.se])
4
AM_INIT_AUTOMAKE(foreign 1.10)
5
AC_CONFIG_SRCDIR([src/torrent.cpp])
8
dnl ---------------------------------------------------------------------------
9
dnl interface version info
10
dnl ---------------------------------------------------------------------------
11
dnl Advanced information about versioning:
12
dnl * "Writing shared libraries" by Mike Hearn
13
dnl http://navi.cx/~mike/writing-shared-libraries.html
14
dnl * libtool.info chapter "Versioning"
15
dnl * libtool.info chapter "Updating library version information"
16
dnl ---------------------------------------------------------------------------
18
dnl - CURRENT (Major): Increment if the interface has changes. AGE is always
19
dnl *changed* at the same time.
20
dnl - AGE (Micro): Increment if any interfaces have been added; set to 0
21
dnl if any interfaces have been removed. Removal has
22
dnl precedence over adding, so set to 0 if both happened.
23
dnl It denotes upward compatibility.
24
dnl - REVISION (Minor): Increment any time the source changes; set to
25
dnl 0 if you incremented CURRENT.
27
dnl To summarize. Any interface *change* increment CURRENT. If that interface
28
dnl change does not break upward compatibility (ie it is an addition),
29
dnl increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
30
dnl REVISION is set to 0, otherwise REVISION is incremented.
31
dnl ---------------------------------------------------------------------------
32
VERSION_INFO_CURRENT=5
33
VERSION_INFO_REVISION=0
35
INTERFACE_VERSION_INFO=$VERSION_INFO_CURRENT:$VERSION_INFO_REVISION:$VERSION_INFO_AGE
36
AC_SUBST(INTERFACE_VERSION_INFO)
37
dnl ---------------------------------------------------------------------------
39
AC_CONFIG_MACRO_DIR([m4])
43
if test -z "$(which $CC)"; then
44
AC_MSG_ERROR([Unable to find a working C compiler, giving up.])
50
if test -z "$(which $CXX)"; then
51
AC_MSG_ERROR([Unable to find a working C++ compiler, giving up.])
58
# AC_PROG_RANLIB is obsolete by AC_PROC_LIBTOOL
62
dnl Check for pthreads.
65
dnl Pass some build options to setup.py and .pc file
66
COMPILETIME_OPTIONS=""
68
AM_CONDITIONAL([ENABLE_SHIPPED_ASIO], false)
70
dnl Check for boost libraries.
71
AX_BOOST_BASE([1.35],[
73
dnl check that Boost.System was found:
74
if test -z "$BOOST_SYSTEM_LIB"; then
75
AC_MSG_ERROR([unable to find Boost.System library, currently this is required.])
79
dnl check that Boost.Asio was found:
80
if test -z "$BOOST_ASIO_LIB"; then
81
AC_MSG_ERROR([Unable to find Boost.Asio library, currently this is required.])
84
AX_BOOST_BASE([1.34],[
86
dnl the user can choose which Asio library to use
88
AS_HELP_STRING([--with-asio=shipped|system|your_path],
89
[Specify the Asio library to use, shipped or system. Default is to use shipped library. You can also specify a path for your system.]),
94
dnl Check the value for the --with-asio switch
95
AC_MSG_CHECKING([which Asio implementation to use])
98
AC_MSG_RESULT(shipped)
99
ASIO_HPP=`dirname $0`/include/libtorrent/asio.hpp
100
ASIO_DIR=`dirname $0`/include/libtorrent/asio
101
AC_CHECK_FILES($ASIO_HPP $ASIO_DIR/ssl/stream.hpp $ASIO_DIR/ip/tcp.hpp,
102
enable_shipped_asio=yes,
103
AC_MSG_ERROR([libtorrent-rasterbar depends on Asio library but it was not found.])
107
AC_MSG_RESULT(system)
108
ASIO_HPP=/usr/include/asio.hpp
109
ASIO_DIR=/usr/include/asio
110
AC_CHECK_FILES($ASIO_HPP $ASIO_DIR/ssl/stream.hpp $ASIO_DIR/ip/tcp.hpp,
111
enable_shipped_asio=no,
112
AC_MSG_ERROR([libtorrent-rasterbar depends on Asio library but it was not found on your system.])
116
AC_MSG_RESULT(detect)
117
ASIO_HPP=$asio/../asio.hpp
119
AC_CHECK_FILES($ASIO_HPP $ASIO_DIR/ssl/stream.hpp $ASIO_DIR/ip/tcp.hpp,
120
enable_shipped_asio=no,
121
AC_MSG_ERROR([libtorrent-rasterbar depends on Asio library but it was not found in the path you specified.])
125
AM_CONDITIONAL([ENABLE_SHIPPED_ASIO], [test x$enable_shipped_asio = "xyes"])
129
AC_MSG_NOTICE([BOOST_CPPFLAGS=$BOOST_CPPFLAGS])
130
AC_MSG_NOTICE([BOOST_LDFLAGS=$BOOST_LDFLAGS])
133
dnl check that Boost.Filesystem was found:
134
if test -z "$BOOST_FILESYSTEM_LIB"; then
135
AC_MSG_ERROR([Unable to find Boost.Filesystem library, currently this is required.])
139
dnl check that Boost.Thread was found:
140
if test -z "$BOOST_THREAD_LIB"; then
141
AC_MSG_ERROR([Unable to find Boost.Thread library, currently this is required.])
145
dnl check that Boost.Regex was found:
146
if test -z "$BOOST_REGEX_LIB"; then
147
AC_MSG_RESULT([Unable to find Boost.Regex library, example test_client will not be build.])
151
AX_BOOST_PROGRAM_OPTIONS
152
dnl check that Boost.Program_options was found:
153
if test -z "$BOOST_PROGRAM_OPTIONS_LIB"; then
154
AC_MSG_RESULT([Unable to find Boost.Program_options library, example test_client will not be build.])
158
dnl Apply boost config.
159
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
160
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
162
if [[ "x$BUILD_TESTCLIENT" != "xno" ]]; then
163
CLIENT_TEST_BIN=client_test;
164
AC_SUBST(CLIENT_TEST_BIN)
167
dnl try different ways of resolving gethostbyname
168
AC_CHECK_FUNC(gethostbyname, ,
169
AC_CHECK_LIB(resolv, gethostbyname, ,
170
AC_CHECK_LIB(nsl, gethostbyname, ,
171
AC_CHECK_LIB(ws2_32, main,
172
AC_CHECK_LIB(wsock32, main, [LIBS="$LIBS -lws2_32 -lwsock32";] ,
173
AC_MSG_ERROR([wsock32 not found. Stopped.])) ,
174
AC_MSG_ERROR([gethostbyname not found. Stopped.]))))
177
dnl find out what kind of logging to use
180
AS_HELP_STRING([--with-logging=none|default|verbose],[Specify how much logging to use. Default is none.]),
181
[[logging=$withval]],
185
# this works around a bug in asio in boost-1.39
186
# see: https://svn.boost.org/trac/boost/ticket/3095
187
AC_DEFINE(BOOST_ASIO_HASH_MAP_BUCKETS,1021,)
188
COMPILETIME_OPTIONS+="-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 "
190
dnl Check the value for the --with-logging switch
191
AC_MSG_CHECKING([what form of logging to use])
197
AC_MSG_RESULT(default)
198
AC_DEFINE(TORRENT_LOGGING,,[define to use some logging])
199
COMPILETIME_OPTIONS+="-DTORRENT_LOGGING "
202
AC_MSG_RESULT(verbose)
203
AC_DEFINE(TORRENT_VERBOSE_LOGGING,,[define to use verbose logging])
204
COMPILETIME_OPTIONS+="-DTORRENT_VERBOSE_LOGGING "
208
AC_MSG_ERROR([Unknown logging option "$logging". Use either "none", "default" or "verbose".])
212
dnl find out what kind of dht-support to use
215
AS_HELP_STRING([--with-dht=on|off|logging],[Specify how to use DHT support. Option logging will add extra logging. Default is on.]),
219
dnl Check the value for the --with-dht switch
220
AC_MSG_CHECKING([how to use DHT])
227
AC_DEFINE(TORRENT_DISABLE_DHT,,[define not to use DHT support])
228
COMPILETIME_OPTIONS+="-DTORRENT_DISABLE_DHT "
231
AC_MSG_RESULT(logging)
232
AC_DEFINE(TORRENT_DHT_VERBOSE_LOGGING,,[define to use DHT support with extra logging])
233
COMPILETIME_OPTIONS+="-DTORRENT_DHT_VERBOSE_LOGGING "
237
AC_MSG_ERROR([Unknown dht option "$dht". Use either "on", "off" or "logging".])
240
AM_CONDITIONAL(USE_DHT, test "x$dht" != "xoff")
242
dnl encryption support.
245
AS_HELP_STRING([--with-encryption=on|off],[Specify how to use encryption support. Default is on.]),
246
[[encryption=$withval]],
250
dnl Check the value for the --with-encryption switch
251
AC_MSG_CHECKING([how to use encryption])
252
case "$encryption" in
256
AC_DEFINE(TORRENT_USE_OPENSSL,,[define to use openssl with libtorrent-rasterbar])
257
COMPILETIME_OPTIONS+="-DTORRENT_USE_OPENSSL "
262
AC_DEFINE(TORRENT_DISABLE_ENCRYPTION,,[define not to use encryption support])
263
COMPILETIME_OPTIONS+="-DTORRENT_DISABLE_ENCRYPTION "
267
AC_MSG_ERROR([Unknown encryption option "$encryption". Use either "on" or "off".])
270
AM_CONDITIONAL(USE_ENCRYPTION, test "x$encryption" != "xoff")
272
dnl the user can choose which zlib to use
275
AS_HELP_STRING([--with-zlib=shipped|system],[Specify the zlib to use, shipped or system. Default is to autodetect system and fallback to shipped.]),
279
dnl Check the value for the --with-zlib switch
280
AC_MSG_CHECKING([which zlib implementation to use])
283
AC_MSG_RESULT([autodetect])
284
AC_CHECK_LIB(z, main, ,
289
AC_MSG_RESULT(shipped)
292
AC_MSG_RESULT(system)
293
AC_CHECK_LIB(z, main, ,
294
AC_MSG_ERROR([libtorrent-rasterbar depends on zlib but zlib was not found on your system.])
299
AC_MSG_ERROR([libtorrent-rasterbar depends on zlib, you must specify either "system" or "shipped".])
303
AC_MSG_ERROR([Unknown zlib option "$zlib". Use either "system" or "shipped".])
306
if [[ "$zlib" = "shipped" ]]; then
307
ZLIB="\$(top_builddir)/zlib/libzlib.la"
308
AM_CONDITIONAL([ENABLE_SHIPPED_ZLIB], true)
309
ZLIBINCL="-I\$(top_srcdir)/zlib"
310
elif [[ "$zlib" = "system" ]] || [[ "$zlib" = "detect" ]]; then
311
ZLIB="" # AC_CHECK_LIB will add -lz to @LIBS@ automatically
312
AM_CONDITIONAL([ENABLE_SHIPPED_ZLIB], false)
316
dnl make ZLIB and ZLIBDIR visible to Makefiles
324
[disable geoip support (if enabled, you can use --with-libgeoip to choose whether to link against shipped or system library) [default=yes]])],
326
ARG_ENABLE_GEOIP=$enableval
327
ac_arg_enable_geoip=$enableval
331
ac_arg_enable_geoip=yes
339
[enable linking against system libgeoip [default=shipped]])],
340
[[ARG_WITH_LIBGEOIP=$withval]],
341
[[ARG_WITH_LIBGEOIP=no]]
344
AC_MSG_CHECKING([whether to link against system libgeoip]) #depends: $ac_arg_enable_geoip
345
AS_CASE(["$ARG_WITH_LIBGEOIP"],
349
AS_IF([test "x$ac_arg_enable_geoip" = "xno"],
350
[AC_MSG_ERROR([GeoIP support is disabled with this build configuration. Try using --enable-geoip.])])
352
PKG_PROG_PKG_CONFIG([0.20])
354
AC_MSG_NOTICE([libgeoip: now checking for the libgeoip library...])
357
LIBS="$GEOIP_LIBS $LIBS"
358
CFLAGS="$GEOIP_CFLAGS $CFLAGS"
360
AC_MSG_ERROR([GeoIP library not found. Try using --without-libgeoip to link against the shipped copy.])
364
AS_IF([test "x$ac_arg_enable_geoip" = "xno"], [
365
# redundant check: session_impl.hpp just won't check for any
366
# GeoIP.h, so any value would be ok (ie. this AS_IF could be
368
AC_MSG_RESULT([disabled])
369
ARG_WITH_LIBGEOIP="disabled"
372
ARG_WITH_LIBGEOIP="no"
373
AC_DEFINE([WITH_SHIPPED_GEOIP_H],[1],[Define to use shipped copy of GeoIP.h])
374
COMPILETIME_OPTIONS+="-DWITH_SHIPPED_GEOIP_H "
377
[AC_MSG_RESULT([$ARG_WITH_LIBGEOIP])
378
AC_MSG_ERROR([Unknown option "$ARG_WITH_LIBGEOIP". Use either "yes" or "no".])]
381
AM_CONDITIONAL([WITH_SHIPPED_GEOIP], [test "x$ARG_WITH_LIBGEOIP" = "xno" ])
383
dnl Check whether python bindings should be build
386
AS_HELP_STRING([--enable-python-binding],[Build python binding. Default is to not build them.]),
387
[[ac_python_binding=$enableval]],
388
[[ac_python_binding=no]]
391
AC_MSG_CHECKING([if python bindings should be build])
392
case "$ac_python_binding" in
396
AM_PATH_PYTHON([2.4],,AC_MSG_ERROR([Python not found. Python is required to build python binding.]))
399
dnl check that Boost.Python was found:
400
if test -z "$BOOST_PYTHON_LIB"; then
401
AC_MSG_ERROR([Unable to find Boost.Python library, this is required to build python bindings.])
404
AM_CONDITIONAL([ENABLE_PYTHON_BINDING],true)
409
AM_CONDITIONAL([ENABLE_PYTHON_BINDING],false)
413
AM_CONDITIONAL([ENABLE_PYTHON_BINDING],false)
417
AC_MSG_ERROR([Unknown --enable-python option "$python". Use either "yes" or "no".])
421
dnl Use possibly specific python install params
422
if [[ "x$PYTHON_INSTALL_PARAMS" == "x" ]]; then
423
PYTHON_INSTALL_PARAMS='--prefix=$(DESTDIR)$(prefix)'
425
AC_SUBST(PYTHON_INSTALL_PARAMS)
427
dnl Check whether the examples should be build
430
AS_HELP_STRING([--enable-examples],[Build the examples. Default is not to build them.]),
431
[[examples=$enableval]],
434
dnl Check the value of the --with-examples switch
435
AC_MSG_CHECKING([if the examples should be build])
439
AM_CONDITIONAL([ENABLE_EXAMPLES], true)
443
AM_CONDITIONAL([ENABLE_EXAMPLES], false)
446
AC_MSG_RESULT(yes (default))
447
AM_CONDITIONAL([ENABLE_EXAMPLES], true)
451
AC_MSG_ERROR([Unknown --enable-examples option "$examples". Use either "yes" or "no".])
455
dnl Check whether the tests should be build
458
AS_HELP_STRING([--enable-tests],[Build test files. Default is not to build them.]),
459
[[tests=$enableval]],
462
dnl Check the value of the --with-tests switch
463
AC_MSG_CHECKING([if test files should be build])
467
AM_CONDITIONAL([ENABLE_TESTS], true)
471
AM_CONDITIONAL([ENABLE_TESTS], false)
474
AC_MSG_RESULT(yes (default))
475
AM_CONDITIONAL([ENABLE_TESTS], true)
479
AC_MSG_ERROR([Unknown --enable-tests option "$tests". Use either "yes" or "no".])
483
dnl Set some defines if we are building a shared library
484
if [[ "x$enable_shared" == "xyes" ]]; then
485
AC_DEFINE(TORRENT_BUILDING_SHARED,,[Make sure the functions and classes are exported.])
486
COMPILETIME_OPTIONS+="-DTORRENT_LINKING_SHARED "
489
AC_DEFINE(BOOST_EXCEPTION_DISABLE,,[We do not need boost.exception features])
490
COMPILETIME_OPTIONS+="-DBOOST_EXCEPTION_DISABLE "
492
dnl want some debugging symbols with that?
495
AS_HELP_STRING([--enable-debug],[Set compiler flags for debug symbols, default is no debugging.]),
496
[case "$enableval" in
498
AC_DEFINE(NDEBUG,,[Define to disable debugging])
500
# COMPILETIME_OPTIONS+="-DNDEBUG "
504
COMPILETIME_OPTIONS+="-DTORRENT_DEBUG "
505
AC_DEFINE(TORRENT_DEBUG,,[Define to enable libtorrent debug build])
509
AC_MSG_ERROR([Unknown --enable-debug option "$enableval". Use either "yes" or "no".])
513
AC_DEFINE(NDEBUG,,[Define to disable debugging])
514
# COMPILETIME_OPTIONS+="-DNDEBUG "
519
dnl Compile time options.
520
AC_SUBST(COMPILETIME_OPTIONS)
528
bindings/python/Makefile
529
bindings/python/setup.py
530
libtorrent-rasterbar.pc])