3 AC_INIT(src/torrent.cpp)
4 AM_INIT_AUTOMAKE(libtorrent, 0.13)
6 # Nowhere in the source is config.h included, so make defines command line arguments
7 # AM_CONFIG_HEADER(config.h)
11 if test -z "$(which $CC)"; then
12 AC_MSG_ERROR([Unable to find a working C compiler, giving up.])
18 if test -z "$(which $CXX)"; then
19 AC_MSG_ERROR([Unable to find a working C++ compiler, giving up.])
26 # AC_PROG_RANLIB is obsolete by AC_PROC_LIBTOOL
28 dnl Make sure that the asio header files are added.
29 ASIO_DIR=include/libtorrent/asio
30 AC_CHECK_FILES([$ASIO_DIR/../asio.hpp $ASIO_DIR/ssl/stream.hpp $ASIO_DIR/ip/tcp.hpp ],,AC_MSG_ERROR([ ASIO header files not found. Get them from asio.sourceforge.net and include or symlink them. Example: ln -s ../../../asio/include/asio.hpp include/libtorrent/asio.hpp && ln -s ../../../asio/include/asio include/libtorrent/asio ]) )
31 dnl check asio version
33 dnl Check for pthreads and boost libraries.
38 dnl check that Boost.DateTime was found:
39 if test -z "$BOOST_DATE_TIME_LIB"; then
40 AC_MSG_ERROR([Unable to find Boost.DateTime library, currently this is required.])
45 dnl check that Boost.Filesystem was found:
46 if test -z "$BOOST_FILESYSTEM_LIB"; then
47 AC_MSG_ERROR([Unable to find Boost.Filesystem library, currently this is required.])
52 dnl check that Boost.Thread was found:
53 if test -z "$BOOST_THREAD_LIB"; then
54 AC_MSG_ERROR([Unable to find Boost.Thread library, currently this is required.])
59 dnl check that Boost.Regex was found:
60 if test -z "$BOOST_REGEX_LIB"; then
61 AC_MSG_RESULT([Unable to find Boost.Regex library, example test_client will not be build.])
65 AX_BOOST_PROGRAM_OPTIONS
67 dnl check that Boost.Program_options was found:
68 if test -z "$BOOST_PROGRAM_OPTIONS_LIB"; then
69 AC_MSG_RESULT([Unable to find Boost.Program_options library, example test_client will not be build.])
73 if [[ "x$BUILD_TESTCLIENT" != "xno" ]]; then
74 CLIENT_TEST_BIN=client_test;
75 AC_SUBST(CLIENT_TEST_BIN)
78 dnl try different ways of resolving gethostbyname
79 AC_CHECK_FUNC(gethostbyname, ,
80 AC_CHECK_LIB(resolv, gethostbyname, ,
81 AC_CHECK_LIB(nsl, gethostbyname, ,
82 AC_CHECK_LIB(ws2_32, main, ,
83 AC_CHECK_LIB(wsock32, main, ,
84 AC_MSG_ERROR([gethostbyname not found. Stopped.])))))
87 dnl find out what kind of logging to use
90 AS_HELP_STRING([--with-logging=none|default|verbose],[Specify how much logging to use. Default is none.]),
94 dnl Check the value for the --with-logging switch
95 AC_MSG_CHECKING([what form of logging to use])
101 AC_MSG_RESULT(default)
102 AC_DEFINE(TORRENT_LOGGING,,[define to use some logging])
105 AC_MSG_RESULT(verbose)
106 AC_DEFINE(TORRENT_VERBOSE_LOGGING,,[define to use verbose logging])
110 AC_MSG_ERROR([Unknown logging option "$logging". Use either "none", "default" or "verbose".])
114 dnl find out what kind of dht-support to use
117 AS_HELP_STRING([--with-dht=on|off|logging],[Specify how to use DHT support. Option logging will add extra logging. Default is on.]),
121 dnl Check the value for the --with-dht switch
122 AC_MSG_CHECKING([how to use DHT])
129 AC_DEFINE(TORRENT_DISABLE_DHT,,[define not to use DHT support])
132 AC_MSG_RESULT(logging)
133 AC_DEFINE(TORRENT_DHT_VERBOSE_LOGGING,,[define to use DHT support with extra logging])
137 AC_MSG_ERROR([Unknown dht option "$dht". Use either "on", "off" or "logging".])
140 AM_CONDITIONAL(USE_DHT, test "x$dht" != "xoff")
142 dnl the user can choose which zlib to use
145 AS_HELP_STRING([--with-zlib=shipped|system],[Specify the zlib to use, shipped or system. Default is to autodetect system and fallback to shipped.]),
149 dnl Check the value for the --with-zlib switch
150 AC_MSG_CHECKING([which zlib implementation to use])
153 AC_MSG_RESULT([autodetect])
154 AC_CHECK_LIB(z, main,
160 AC_MSG_RESULT(shipped)
163 AC_MSG_RESULT(system)
164 AC_CHECK_LIB(z, main, ,
165 AC_MSG_ERROR([libtorrent depends on zlib but zlib was not found on your system.])
170 AC_MSG_ERROR([libtorrent depends on zlib, you must specify either "system" or "shipped".])
174 AC_MSG_ERROR([Unknown zlib option "$zlib". Use either "system" or "shipped".])
177 if [[ "$zlib" = "shipped" ]]; then
178 ZLIB="\$(top_builddir)/zlib/libzlib.la"
180 ZLIBINCL="-I\$(top_srcdir)/zlib"
181 AC_CONFIG_FILES(zlib/Makefile)
182 elif [[ "$zlib" = "system" ]]; then
188 dnl make ZLIB and ZLIBDIR visible to Makefiles
193 dnl Check whether the examples should be build
196 AS_HELP_STRING([--enable-examples],[Build the examples. Default is not to build them.]),
197 [[examples=$enableval]],
200 dnl Check the value of the --with-examples switch
201 AC_MSG_CHECKING([if the examples should be build])
205 EXAMPLESDIR="examples"
212 AC_MSG_RESULT(yes (default))
213 EXAMPLESDIR="examples"
217 AC_MSG_ERROR([Unknown --enable-examples option "$examples". Use either "yes" or "no".])
220 dnl make $examples visible to Makefiles
221 AC_SUBST([EXAMPLESDIR])
223 dnl Set some defines if we are building a shared library
224 if [[ "x$enable_shared" == "xyes" ]]; then
225 AC_DEFINE(TORRENT_BUILDING_SHARED,,[Make sure the functions and classes are exported.])
226 AC_DEFINE(TORRENT_LINKING_SHARED,,[Make sure the functions and classes are exported.])
229 dnl want some debugging symbols with that?
232 AS_HELP_STRING([--enable-debug],[Set compiler flags for debug symbols, default is no debugging.]),
233 [case "$enableval" in
235 AC_DEFINE(NDEBUG,,[Define to disable debugging])
242 DEBUGFLAGS="$enableval"
246 AC_DEFINE(NDEBUG,,[Define to disable debugging])]
250 AC_CONFIG_FILES(Makefile src/Makefile include/Makefile test/Makefile libtorrent.pc)
251 if [[ "x$examples" == "xyes" ]]; then
252 AC_CONFIG_FILES(examples/Makefile)