formatting fixes in client test, and made the test build when resolve countries is...
[libtorrent-kjk.git] / configure.in
blob09f73c7685803a823c064e5710c4f025b2d848b8
1 AC_PREREQ(2.59)
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)
9 AC_PROG_CC
11 if test -z "$(which $CC)"; then
12     AC_MSG_ERROR([Unable to find a working C compiler, giving up.])
15 AC_PROG_CPP
16 AC_PROG_CXX
18 if test -z "$(which $CXX)"; then
19     AC_MSG_ERROR([Unable to find a working C++ compiler, giving up.])
22 AC_CACHE_SAVE
23 AC_PROG_INSTALL
24 AC_PROG_MAKE_SET
25 AC_PROG_LIBTOOL
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.
34 ACX_PTHREAD
36 AX_BOOST_DATE_TIME
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.])
43 AX_BOOST_FILESYSTEM
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.])
50 AX_BOOST_THREAD
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.])
57 AX_BOOST_REGEX
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.])
62    BUILD_TESTCLIENT=no;
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.])
70    BUILD_TESTCLIENT=no;
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
88 AC_ARG_WITH(
89         [logging],
90         AS_HELP_STRING([--with-logging=none|default|verbose],[Specify how much logging to use. Default is none.]),
91         [[logging=$withval]],
92         [[logging=none]]
94 dnl Check the value for the --with-logging switch
95 AC_MSG_CHECKING([what form of logging to use])
96 case "$logging" in
97         "none")
98                 AC_MSG_RESULT(none)
99                 ;;
100         "default")
101                 AC_MSG_RESULT(default)
102                 AC_DEFINE(TORRENT_LOGGING,,[define to use some logging])
103                 ;;
104         "verbose")
105                 AC_MSG_RESULT(verbose)
106                 AC_DEFINE(TORRENT_VERBOSE_LOGGING,,[define to use verbose logging])
107                 ;;
108         *)
109                 AC_MSG_RESULT()
110                 AC_MSG_ERROR([Unknown logging option "$logging". Use either "none", "default" or "verbose".])
111                 ;;
112 esac
114 dnl find out what kind of dht-support to use
115 AC_ARG_WITH(
116         [dht],
117         AS_HELP_STRING([--with-dht=on|off|logging],[Specify how to use DHT support. Option logging will add extra logging. Default is on.]),
118         [[dht=$withval]],
119         [[dht=on]]
121 dnl Check the value for the --with-dht switch
122 AC_MSG_CHECKING([how to use DHT])
123 case "$dht" in
124         "on")
125                 AC_MSG_RESULT(on)
126                 ;;
127         "off")
128                 AC_MSG_RESULT(off)
129                 AC_DEFINE(TORRENT_DISABLE_DHT,,[define not to use DHT support])
130                 ;;
131         "logging")
132                 AC_MSG_RESULT(logging)
133                 AC_DEFINE(TORRENT_DHT_VERBOSE_LOGGING,,[define to use DHT support with extra logging])
134                 ;;
135         *)
136                 AC_MSG_RESULT()
137                 AC_MSG_ERROR([Unknown dht option "$dht". Use either "on", "off" or "logging".])
138                 ;;
139 esac
140 AM_CONDITIONAL(USE_DHT, test "x$dht" != "xoff")
142 dnl the user can choose which zlib to use
143 AC_ARG_WITH(
144         [zlib],
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.]),
146         [[zlib=$withval]],
147         [[zlib=detect]]
149 dnl Check the value for the --with-zlib switch
150 AC_MSG_CHECKING([which zlib implementation to use])
151 case "$zlib" in
152         "detect")
153                 AC_MSG_RESULT([autodetect])
154                 AC_CHECK_LIB(z, main,
155                         [zlib="system"],
156                         [zlib="shipped"]
157                 )
158                 ;;
159         "shipped")
160                 AC_MSG_RESULT(shipped)
161                 ;;
162         "system")
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.])
166                 )
167                 ;;
168         "no")
169                 AC_MSG_RESULT()
170                 AC_MSG_ERROR([libtorrent depends on zlib, you must specify either "system" or "shipped".])
171                 ;;
172         *)
173                 AC_MSG_RESULT()
174                 AC_MSG_ERROR([Unknown zlib option "$zlib". Use either "system" or "shipped".])
175                 ;;
176 esac
177 if [[ "$zlib" = "shipped" ]]; then
178         ZLIB="\$(top_builddir)/zlib/libzlib.la"
179         ZLIBDIR="zlib"
180         ZLIBINCL="-I\$(top_srcdir)/zlib"
181         AC_CONFIG_FILES(zlib/Makefile)
182 elif [[ "$zlib" = "system" ]]; then
183         ZLIB="-lz"
184         ZLIBDIR=""
185         ZLIBINCL=""
188 dnl make ZLIB and ZLIBDIR visible to Makefiles
189 AC_SUBST([ZLIB])
190 AC_SUBST([ZLIBDIR])
191 AC_SUBST([ZLIBINCL])
193 dnl Check whether the examples should be build
194 AC_ARG_ENABLE(
195         [examples],
196         AS_HELP_STRING([--enable-examples],[Build the examples. Default is not to build them.]),
197         [[examples=$enableval]],
198         [[examples=no]]
200 dnl Check the value of the --with-examples switch
201 AC_MSG_CHECKING([if the examples should be build])
202 case "$examples" in
203         "yes")
204                 AC_MSG_RESULT(yes)
205                 EXAMPLESDIR="examples"
206                 ;;
207         "no")
208                 AC_MSG_RESULT(no)
209                 EXAMPLESDIR=""
210                 ;;
211         "")
212                 AC_MSG_RESULT(yes (default))
213                 EXAMPLESDIR="examples"
214                 ;;
215         *)
216                 AC_MSG_RESULT()
217                 AC_MSG_ERROR([Unknown --enable-examples option "$examples". Use either "yes" or "no".])
218                 ;;
219 esac
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?
230 AC_ARG_ENABLE(
231         [debug],
232         AS_HELP_STRING([--enable-debug],[Set compiler flags for debug symbols, default is no debugging.]),
233         [case "$enableval" in
234                 no)
235                         AC_DEFINE(NDEBUG,,[Define to disable debugging])
236                         DEBUGFLAGS=""
237                         ;;
238                 yes)
239                         DEBUGFLAGS="-g"
240                         ;;
241                 *)
242                         DEBUGFLAGS="$enableval"
243                         ;;
244         esac],
245         [DEBUGFLAGS=""
246         AC_DEFINE(NDEBUG,,[Define to disable debugging])]
248 AC_SUBST(DEBUGFLAGS)
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)
254 AC_OUTPUT