~ubuntu-branches/ubuntu/maverick/libtorrent-rasterbar/maverick

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2010-08-10 12:59:37 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810125937-jbcmmf17y8yo9hgz
Tags: 0.15.0-0ubuntu1
* New upstream version.
* debian/patches/100_fix_html_docs.patch: refreshed.
* debian/control: bump up standards-version to 3.9.1 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#                                               -*- Autoconf -*-
 
2
# Process this file with autoconf to produce a configure script.
 
3
 
 
4
# $Id: configure.ac 3872 2009-09-18 18:47:57Z cristiangreco $
 
5
 
 
6
AC_PREREQ([2.63])
 
7
 
 
8
AC_INIT([libtorrent-rasterbar],[0.15.0],[arvid@cs.umu.se],
 
9
        [libtorrent-rasterbar],[http://www.libtorrent.org])
 
10
AC_CONFIG_SRCDIR([src/torrent.cpp])
 
11
AC_CONFIG_AUX_DIR([build-aux])
 
12
AC_CONFIG_MACRO_DIR([m4])
 
13
 
 
14
# Silencing build output (automake-1.11)
 
15
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
16
 
 
17
 
 
18
###############################################################################
 
19
dnl ---------------------------------------------------------------------------
 
20
dnl interface version info
 
21
dnl ---------------------------------------------------------------------------
 
22
dnl Advanced information about versioning:
 
23
dnl   * "Writing shared libraries" by Mike Hearn
 
24
dnl         http://navi.cx/~mike/writing-shared-libraries.html
 
25
dnl   * libtool.info chapter "Versioning"
 
26
dnl   * libtool.info chapter "Updating library version information"
 
27
dnl ---------------------------------------------------------------------------
 
28
dnl Versioning:
 
29
dnl  - CURRENT (Major):  Increment if the interface has changes. AGE is always
 
30
dnl                      *changed* at the same time.
 
31
dnl  - AGE (Micro):      Increment if any interfaces have been added; set to 0
 
32
dnl                      if any interfaces have been removed. Removal has
 
33
dnl                      precedence over adding, so set to 0 if both happened.
 
34
dnl                      It denotes upward compatibility.
 
35
dnl  - REVISION (Minor): Increment any time the source changes; set to
 
36
dnl                      0 if you incremented CURRENT.
 
37
dnl
 
38
dnl  To summarize. Any interface *change* increment CURRENT. If that interface
 
39
dnl  change does not break upward compatibility (ie it is an addition),
 
40
dnl  increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
 
41
dnl  REVISION is set to 0, otherwise REVISION is incremented.
 
42
dnl ---------------------------------------------------------------------------
 
43
 
 
44
m4_define([VERSION_INFO_CURRENT],[6])
 
45
m4_define([VERSION_INFO_REVISION],[0])
 
46
m4_define([VERSION_INFO_AGE],[0])
 
47
INTERFACE_VERSION_INFO=VERSION_INFO_CURRENT:VERSION_INFO_REVISION:VERSION_INFO_AGE
 
48
AC_SUBST(INTERFACE_VERSION_INFO)
 
49
###############################################################################
 
50
 
 
51
 
 
52
###############################################################################
 
53
# Start
 
54
###############################################################################
 
55
 
 
56
AS_ECHO
 
57
AS_ECHO "Building $PACKAGE_STRING"
 
58
 
 
59
 
 
60
###############################################################################
 
61
# Performing some basic checks and initializing the build system
 
62
###############################################################################
 
63
 
 
64
AS_ECHO
 
65
AS_ECHO "Checking for a C/C++ compiler to use:"
 
66
AC_PROG_CC
 
67
AC_PROG_CPP
 
68
AC_PROG_CC_C_O
 
69
AC_PROG_CXX
 
70
AC_PROG_CXXCPP
 
71
AC_PROG_CXX_C_O
 
72
 
 
73
AS_ECHO
 
74
AS_ECHO "Checking system type:"
 
75
AC_CANONICAL_BUILD
 
76
AC_CANONICAL_HOST
 
77
AC_CANONICAL_TARGET
 
78
 
 
79
AS_ECHO
 
80
AS_ECHO "Initializing Automake:"
 
81
AM_INIT_AUTOMAKE([1.11 foreign])
 
82
 
 
83
 
 
84
AS_ECHO
 
85
AS_ECHO "Initializing Libtool:"
 
86
LT_PREREQ([2.2.6])
 
87
LT_INIT
 
88
 
 
89
 
 
90
###############################################################################
 
91
# Checking for needed base libraries
 
92
###############################################################################
 
93
 
 
94
AS_ECHO
 
95
AS_ECHO "Checking for posix thread support:"
 
96
 
 
97
AX_PTHREAD()
 
98
 
 
99
LIBS="$PTHREAD_LIBS $LIBS"
 
100
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
 
101
CC="$PTHREAD_CC"
 
102
 
 
103
AS_ECHO
 
104
AS_ECHO "Checking for boost libraries:"
 
105
 
 
106
AX_BOOST_BASE([1.36])
 
107
 
 
108
AX_BOOST_SYSTEM()
 
109
AS_IF([test -z "$BOOST_SYSTEM_LIB"],
 
110
      [AC_MSG_ERROR(Boost.System library not found. Try using --with-boost-system=lib)])
 
111
 
 
112
AX_BOOST_FILESYSTEM()
 
113
AS_IF([test -z "$BOOST_FILESYSTEM_LIB"],
 
114
      [AC_MSG_ERROR(Boost.Filesystem library not found. Try using --with-boost-filesystem=lib)])
 
115
 
 
116
AX_BOOST_THREAD()
 
117
AS_IF([test -z "$BOOST_THREAD_LIB"],
 
118
      [AC_MSG_ERROR(Boost.Thread library not found. Try using --with-boost-thread=lib)])
 
119
 
 
120
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
 
121
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
 
122
 
 
123
 
 
124
###############################################################################
 
125
# Checking for functions and other stuffs
 
126
###############################################################################
 
127
 
 
128
 
 
129
AS_ECHO
 
130
AS_ECHO "Checking for pkg-config:"
 
131
 
 
132
PKG_PROG_PKG_CONFIG([0.20])
 
133
 
 
134
AS_ECHO
 
135
AS_ECHO "Checking for functions and headers:"
 
136
 
 
137
AC_SYS_LARGEFILE
 
138
AC_PROG_INSTALL
 
139
AC_PROG_LN_S
 
140
AC_PROG_MAKE_SET
 
141
 
 
142
# check for gethostbyname and gethostbyname_r (used in src/GeoIP.c)
 
143
AC_CHECK_FUNCS([gethostbyname], [],
 
144
  [AC_CHECK_LIB([nsl], [gethostbyname], [],
 
145
    [AC_CHECK_LIB([resolv], [gethostbyname], [],
 
146
      [AC_CHECK_LIB([socket], [gethostbyname], [],
 
147
        [AC_CHECK_LIB([ws2_32], [main],
 
148
          [AC_CHECK_LIB([wsock32], [main],
 
149
            [LIBS="-lws2_32 -lwsock32 $LIBS"],
 
150
            [AC_MSG_ERROR([wsock32 function not found.])])],
 
151
          [AC_MSG_ERROR([gethostbyname function not found.])])])])])]
 
152
)
 
153
 
 
154
AC_CHECK_FUNCS(gethostbyname_r, [
 
155
  # We look for the one that returns `int'.
 
156
  # Hopefully this check is robust enough.
 
157
  AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
 
158
    AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)])
 
159
])
 
160
 
 
161
AC_CHECK_FUNCS([clock_gettime], [],
 
162
    [AC_CHECK_LIB([rt], [clock_gettime], [],
 
163
      [AC_CHECK_LIB([posix4], [clock_gettime], [],
 
164
      [AC_MSG_WARN([clock_gettime function not found.])])])]
 
165
)
 
166
 
 
167
 
 
168
dnl Pass some build options to setup.py and .pc file
 
169
COMPILETIME_OPTIONS=""
 
170
 
 
171
 
 
172
###############################################################################
 
173
# Setting configure options
 
174
###############################################################################
 
175
 
 
176
AC_ARG_ENABLE(
 
177
  [logging],
 
178
  [AS_HELP_STRING(
 
179
    [--enable-logging],
 
180
    [enable logging to disk (use value "verbose" to enable verbose peer wire logging or "errors" limit logging to errors ) [default=no]])],
 
181
  [[ARG_ENABLE_LOGGING=$enableval]],
 
182
  [[ARG_ENABLE_LOGGING=no]]
 
183
)
 
184
 
 
185
AC_ARG_ENABLE(
 
186
  [debug],
 
187
  [AS_HELP_STRING(
 
188
    [--enable-debug],
 
189
    [enable debug build [default=no]])],
 
190
  [
 
191
   ARG_ENABLE_DEBUG=$enableval
 
192
   ac_arg_enable_debug=$enableval
 
193
  ],
 
194
  [
 
195
   ARG_ENABLE_DEBUG=no
 
196
   ac_arg_enable_debug=no
 
197
  ]
 
198
)
 
199
 
 
200
AC_ARG_ENABLE(
 
201
  [dht],
 
202
  [AS_HELP_STRING(
 
203
    [--disable-dht],
 
204
    [disable dht support (use value "logging" to add extra logging) [default=yes]])],
 
205
  [[ARG_ENABLE_DHT=$enableval]],
 
206
  [[ARG_ENABLE_DHT=yes]]
 
207
)
 
208
 
 
209
AC_ARG_ENABLE(
 
210
  [encryption],
 
211
  [AS_HELP_STRING(
 
212
    [--disable-encryption],
 
213
    [disable encryption support (requires OpenSSL to be installed on your system, you can use --with-openssl to set the path) [default=yes]])],
 
214
  [[ARG_ENABLE_ENCRYPTION=$enableval]],
 
215
  [[ARG_ENABLE_ENCRYPTION=yes]]
 
216
)
 
217
 
 
218
AC_ARG_ENABLE(
 
219
  [pool-allocators],
 
220
  [AS_HELP_STRING(
 
221
    [--disable-pool-allocators],
 
222
    [disable pool allocators for send buffers [default=yes]])],
 
223
  [[ARG_ENABLE_POOL_ALLOC=$enableval]],
 
224
  [[ARG_ENABLE_POOL_ALLOC=yes]]
 
225
)
 
226
 
 
227
AC_ARG_ENABLE(
 
228
  [invariant-checks],
 
229
  [AS_HELP_STRING(
 
230
    [--enable-invariant-checks],
 
231
    [enable invariant checks (use value "full" to turn on extra expensive invariant checks) @<:@default=yes if debug is enabled, no otherwhise@:>@])],
 
232
  [[ARG_ENABLE_INVARIANT=$enableval]],
 
233
  [
 
234
   AS_IF([test "x$ac_arg_enable_debug" = "xyes"],
 
235
         [ARG_ENABLE_INVARIANT=yes],
 
236
         [ARG_ENABLE_INVARIANT=no])
 
237
  ]
 
238
)
 
239
 
 
240
AC_ARG_ENABLE(
 
241
  [deprecated-functions],
 
242
  [AS_HELP_STRING(
 
243
    [--disable-deprecated-functions],
 
244
    [disable deprecated functions from the API [default=yes]])],
 
245
  [[ARG_ENABLE_DEPRECATED=$enableval]],
 
246
  [[ARG_ENABLE_DEPRECATED=yes]]
 
247
)
 
248
 
 
249
AC_ARG_ENABLE(
 
250
  [statistics],
 
251
  [AS_HELP_STRING(
 
252
    [--enable-statistics],
 
253
    [enable statistics logging feature [default=no]])],
 
254
  [[ARG_ENABLE_STATS=$enableval]],
 
255
  [[ARG_ENABLE_STATS=no]]
 
256
)
 
257
 
 
258
AC_ARG_ENABLE(
 
259
  [disk-stats],
 
260
  [AS_HELP_STRING(
 
261
    [--enable-disk-stats],
 
262
    [enable disk activity logging feature [default=no]])],
 
263
  [[ARG_ENABLE_DISK_STATS=$enableval]],
 
264
  [[ARG_ENABLE_DISK_STATS=no]]
 
265
)
 
266
 
 
267
AC_ARG_ENABLE(
 
268
  [geoip],
 
269
  [AS_HELP_STRING(
 
270
    [--disable-geoip],
 
271
    [disable geoip support (if enabled, you can use --with-libgeoip to choose whether to link against shipped or system library) [default=yes]])],
 
272
  [
 
273
   ARG_ENABLE_GEOIP=$enableval
 
274
   ac_arg_enable_geoip=$enableval
 
275
  ],
 
276
  [
 
277
   ARG_ENABLE_GEOIP=yes
 
278
   ac_arg_enable_geoip=yes
 
279
  ]
 
280
)
 
281
 
 
282
AC_ARG_ENABLE(
 
283
  [examples],
 
284
  [AS_HELP_STRING(
 
285
    [--enable-examples],
 
286
    [build example files [default=no]])],
 
287
  [[ARG_ENABLE_EXAMPLES=$enableval]],
 
288
  [[ARG_ENABLE_EXAMPLES=no]]
 
289
)
 
290
 
 
291
AC_ARG_ENABLE(
 
292
  [tests],
 
293
  [AS_HELP_STRING(
 
294
    [--enable-tests],
 
295
    [build test files [default=no]])],
 
296
  [[ARG_ENABLE_TESTS=$enableval]],
 
297
  [[ARG_ENABLE_TESTS=no]]
 
298
)
 
299
 
 
300
AC_ARG_ENABLE(
 
301
  [python-binding],
 
302
  [AS_HELP_STRING(
 
303
    [--enable-python-binding],
 
304
    [build python bindings [default=no]])],
 
305
  [[ARG_ENABLE_PYTHON_BINDING=$enableval]],
 
306
  [[ARG_ENABLE_PYTHON_BINDING=no]]
 
307
)
 
308
 
 
309
AC_ARG_WITH(
 
310
  [zlib],
 
311
  [AS_HELP_STRING(
 
312
    [--without-zlib],
 
313
    [disable linking against system zlib [default=system]])],
 
314
  [[ARG_WITH_ZLIB=$withval]],
 
315
  [[ARG_WITH_ZLIB=yes]]
 
316
)
 
317
 
 
318
AC_ARG_WITH(
 
319
  [libgeoip],
 
320
  [AS_HELP_STRING(
 
321
    [--with-libgeoip],
 
322
    [enable linking against system libgeoip [default=shipped]])],
 
323
  [[ARG_WITH_LIBGEOIP=$withval]],
 
324
  [[ARG_WITH_LIBGEOIP=no]]
 
325
)
 
326
 
 
327
 
 
328
###############################################################################
 
329
# Checking configure options
 
330
###############################################################################
 
331
 
 
332
AS_ECHO
 
333
AS_ECHO "Checking build options:"
 
334
 
 
335
AC_MSG_CHECKING([whether deprecated functions should be enabled])
 
336
AS_CASE(["$ARG_ENABLE_DEPRECATED"],
 
337
  ["yes"|"on"], [
 
338
      AC_MSG_RESULT([yes])
 
339
    ],
 
340
  ["no"|"off"], [
 
341
      AC_MSG_RESULT([no])
 
342
      AC_DEFINE([TORRENT_NO_DEPRECATE],[1],[Define to exclude all deprecated functions from the API.])
 
343
    ],
 
344
  [AC_MSG_RESULT([$ARG_ENABLE_DEPRECATED])
 
345
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_DEPRECATED". Use either "yes" or "no".])]
 
346
)
 
347
 
 
348
AC_MSG_CHECKING([whether debug build should be enabled])
 
349
AS_CASE(["$ARG_ENABLE_DEBUG"],
 
350
  ["yes"], [
 
351
      AC_MSG_RESULT([yes])
 
352
      AC_DEFINE([TORRENT_DEBUG],[1],[Define to enable debug code.])
 
353
      COMPILETIME_OPTIONS+="-DTORRENT_DEBUG "
 
354
      DEBUGFLAGS="-g"
 
355
   ],
 
356
  ["no"], [
 
357
      AC_MSG_RESULT([no])
 
358
      AC_DEFINE([NDEBUG],[1],[Define to disable debug code.])
 
359
      #COMPILETIME_OPTIONS+="-DNDEBUG "
 
360
      DEBUGFLAGS="-Os"
 
361
   ],
 
362
  [AC_MSG_RESULT([$ARG_ENABLE_DEBUG])
 
363
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_DEBUG". Use either "yes" or "no".])]
 
364
)
 
365
 
 
366
AC_MSG_CHECKING([whether invariant check should be enabled]) #depends: $ac_arg_enable_debug
 
367
AS_CASE(["$ARG_ENABLE_INVARIANT"],
 
368
  ["yes"|"on"], [
 
369
      AC_MSG_RESULT([yes])
 
370
      AS_IF([test "x$ac_arg_enable_debug" = "xno"],
 
371
            [AC_MSG_ERROR([invariant-checks: this setting only affects debug build. Try using --enable-debug.])])
 
372
    ],
 
373
  ["no"|"off"], [
 
374
      AC_MSG_RESULT([no])
 
375
      AS_IF([test "x$ac_arg_enable_debug" = "xyes"],
 
376
            [AC_DEFINE([TORRENT_DISABLE_INVARIANT_CHECKS],[1],[Define to disable internal invariant checks. Asserts are still enabled while debug is on.])])
 
377
    ],
 
378
  ["full"], [
 
379
      AC_MSG_RESULT([full])
 
380
      AS_IF([test "x$ac_arg_enable_debug" = "xyes"],
 
381
            [AC_DEFINE([TORRENT_EXPENSIVE_INVARIANT_CHECKS],[1],[Define to enable extra expensive invariant checks.])],
 
382
            [AC_MSG_ERROR([invariant-checks: this setting only affects debug build. Try using --enable-debug.])])
 
383
    ],
 
384
  [AC_MSG_RESULT([$ARG_ENABLE_INVARIANT])
 
385
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_INVARIANT". Use either "yes", "no" or "full".])]
 
386
)
 
387
 
 
388
AC_MSG_CHECKING([whether logging to disk should be enabled])
 
389
AS_CASE(["$ARG_ENABLE_LOGGING"],
 
390
  ["yes"|"default"], [
 
391
      AC_MSG_RESULT([yes])
 
392
      AC_DEFINE([TORRENT_LOGGING],[1],[Define to enable logging of the session events.])
 
393
      COMPILETIME_OPTIONS+="-DTORRENT_LOGGING "
 
394
    ],
 
395
  ["no"|"none"], [
 
396
      AC_MSG_RESULT([no])
 
397
    ],
 
398
  ["verbose"], [
 
399
      AC_MSG_RESULT([verbose])
 
400
      AC_DEFINE([TORRENT_VERBOSE_LOGGING],[1],[Define to enable logging of the session events and every peer connection.])
 
401
      COMPILETIME_OPTIONS+="-DTORRENT_VERBOSE_LOGGING "
 
402
    ],
 
403
  ["errors"], [
 
404
      AC_MSG_RESULT([errors])
 
405
      AC_DEFINE([TORRENT_ERROR_LOGGING],[1],[Define to enable logging of the session events and every peer connection limited to errors.])
 
406
      COMPILETIME_OPTIONS+="-DTORRENT_ERROR_LOGGING "
 
407
    ],
 
408
  [AC_MSG_RESULT([$ARG_ENABLE_LOGGING])
 
409
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_LOGGING". Use either "yes", "no", "verbose" or "errors".])]
 
410
)
 
411
 
 
412
AC_MSG_CHECKING([whether statistics logging should be enabled])
 
413
AS_CASE(["$ARG_ENABLE_STATS"],
 
414
  ["yes"|"on"], [
 
415
      AC_MSG_RESULT([yes])
 
416
      AC_DEFINE([TORRENT_STATS],[1],[Define to generate a log with statistics.])
 
417
    ],
 
418
  ["no"|"off"], [
 
419
      AC_MSG_RESULT([no])
 
420
    ],
 
421
  [AC_MSG_RESULT([$ARG_ENABLE_STATS])
 
422
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_STATS". Use either "yes" or "no".])]
 
423
)
 
424
 
 
425
AC_MSG_CHECKING([whether disk activity logging should be enabled])
 
426
AS_CASE(["$ARG_ENABLE_DISK_STATS"],
 
427
  ["yes"|"on"], [
 
428
      AC_MSG_RESULT([yes])
 
429
      AC_DEFINE([TORRENT_DISK_STATS],[1],[Define to create a log of all disk activities.])
 
430
    ],
 
431
  ["no"|"off"], [
 
432
      AC_MSG_RESULT([no])
 
433
    ],
 
434
  [AC_MSG_RESULT([$ARG_ENABLE_DISK_STATS])
 
435
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_DISK_STATS". Use either "yes" or "no".])]
 
436
)
 
437
 
 
438
AS_ECHO
 
439
AS_ECHO "Checking features to be enabled:"
 
440
 
 
441
AC_MSG_CHECKING([whether encryption support should be enabled])
 
442
AS_CASE(["$ARG_ENABLE_ENCRYPTION"],
 
443
  ["yes"|"on"], [
 
444
      AC_MSG_RESULT([yes])
 
445
      AC_MSG_NOTICE([encryption support: now checking for the OpenSSL library...])
 
446
 
 
447
      AX_CHECK_OPENSSL([
 
448
          AC_DEFINE([TORRENT_USE_OPENSSL],[1],[Define to use OpenSSL support.])
 
449
          COMPILETIME_OPTIONS+="-DTORRENT_USE_OPENSSL "
 
450
        ], [
 
451
          AC_MSG_ERROR([OpenSSL library not found. Try using --with-openssl=DIR or disabling encryption at all.])
 
452
      ])
 
453
    ],
 
454
  ["no"|"off"], [
 
455
      AC_MSG_RESULT([no])
 
456
      AC_DEFINE([TORRENT_DISABLE_ENCRYPTION],[1],[Define to disable any encryption support and avoid linking against OpenSSL.])
 
457
      COMPILETIME_OPTIONS+="-DTORRENT_DISABLE_ENCRYPTION "
 
458
    ],
 
459
  [AC_MSG_RESULT([$ARG_ENABLE_ENCRYPTION])
 
460
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_ENCRYPTION". Use either "yes" or "no".])]
 
461
)
 
462
 
 
463
AC_MSG_CHECKING([whether geoip support should be enabled])
 
464
AS_CASE(["$ARG_ENABLE_GEOIP"],
 
465
  ["yes"], [
 
466
    AC_MSG_RESULT([yes])
 
467
   ],
 
468
  ["no"], [
 
469
    AC_MSG_RESULT([no])
 
470
    AC_DEFINE([TORRENT_DISABLE_GEO_IP],[1],[Define to disable the GeoIP support and avoid linking against LGPLed code.])
 
471
    COMPILETIME_OPTIONS+="-DTORRENT_DISABLE_GEO_IP "
 
472
   ],
 
473
  [AC_MSG_RESULT([$ARG_ENABLE_GEOIP])
 
474
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_GEOIP". Use either "yes" or "no".])]
 
475
)
 
476
 
 
477
AC_MSG_CHECKING([whether dht support should be enabled])
 
478
AS_CASE(["$ARG_ENABLE_DHT"],
 
479
  ["yes"|"on"], [
 
480
      AC_MSG_RESULT([yes])
 
481
    ],
 
482
  ["no"|"off"], [
 
483
      AC_MSG_RESULT([no])
 
484
      AC_DEFINE([TORRENT_DISABLE_DHT],[1],[Define to disable the DHT support.])
 
485
      COMPILETIME_OPTIONS+="-DTORRENT_DISABLE_DHT "
 
486
    ],
 
487
  ["logging"], [
 
488
      AC_MSG_RESULT([logging])
 
489
      AC_DEFINE([TORRENT_DHT_VERBOSE_LOGGING],[1],[Define to enable DHT support with verbose logging.])
 
490
      COMPILETIME_OPTIONS+="-DTORRENT_DHT_VERBOSE_LOGGING "
 
491
    ],
 
492
  [AC_MSG_RESULT([$ARG_ENABLE_DHT])
 
493
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_DHT". Use either "yes", "no" or "logging".])]
 
494
)
 
495
 
 
496
AC_MSG_CHECKING([whether pool allocators should be enabled])
 
497
AS_CASE(["$ARG_ENABLE_POOL_ALLOC"],
 
498
  ["yes"|"on"], [
 
499
      AC_MSG_RESULT([yes])
 
500
    ],
 
501
  ["no"|"off"], [
 
502
      AC_MSG_RESULT([no])
 
503
      AC_DEFINE([TORRENT_DISABLE_POOL_ALLOCATOR],[1],[Define to disable use of boost::pool for pool allocators.])
 
504
    ],
 
505
  [AC_MSG_RESULT([$ARG_ENABLE_POOL_ALLOC])
 
506
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_POOL_ALLOC". Use either "yes" or "no".])]
 
507
)
 
508
 
 
509
AS_ECHO
 
510
AS_ECHO "Checking for extra build files:"
 
511
 
 
512
AC_MSG_CHECKING([whether example files should be built])
 
513
AS_CASE(["$ARG_ENABLE_EXAMPLES"],
 
514
  ["yes"], [AC_MSG_RESULT([yes])],
 
515
  ["no"],  [AC_MSG_RESULT([no])],
 
516
  [AC_MSG_RESULT([$ARG_ENABLE_EXAMPLES])
 
517
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_EXAMPLES". Use either "yes" or "no".])]
 
518
)
 
519
 
 
520
AC_MSG_CHECKING([whether test files should be built])
 
521
AS_CASE(["$ARG_ENABLE_TESTS"],
 
522
  ["yes"], [AC_MSG_RESULT([yes])],
 
523
  ["no"],  [AC_MSG_RESULT([no])],
 
524
  [AC_MSG_RESULT([$ARG_ENABLE_TESTS])
 
525
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_TESTS". Use either "yes" or "no".])]
 
526
)
 
527
 
 
528
AC_MSG_CHECKING([whether python bindings should be built])
 
529
AS_CASE(["$ARG_ENABLE_PYTHON_BINDING"],
 
530
  ["yes"], [
 
531
      AC_MSG_RESULT([yes])
 
532
 
 
533
      AM_PATH_PYTHON([2.4], [], AC_MSG_ERROR([Python interpreter not found.]))
 
534
      AX_PYTHON_DEVEL([>= '2.4'])
 
535
      AX_BOOST_PYTHON()
 
536
 
 
537
      AS_IF([test -z "$BOOST_PYTHON_LIB"],
 
538
            [AC_MSG_ERROR([Boost.Python library not found. Try using --with-boost-python=lib.])])
 
539
    ],
 
540
  ["no"], [
 
541
      AC_MSG_RESULT([no])
 
542
    ],
 
543
  [AC_MSG_RESULT([$ARG_ENABLE_PYTHON_BINDING])
 
544
   AC_MSG_ERROR([Unknown option "$ARG_ENABLE_PYTHON_BINDING". Use either "yes" or "no".])]
 
545
)
 
546
 
 
547
AS_ECHO
 
548
AS_ECHO "Checking for external libraries:"
 
549
 
 
550
AC_MSG_CHECKING([whether to link against system zlib])
 
551
AS_CASE(["$ARG_WITH_ZLIB"],
 
552
  ["yes"|"system"], [
 
553
      AC_MSG_RESULT([yes])
 
554
      AC_CHECK_HEADER([zlib.h], [
 
555
        AC_CHECK_LIB([z], [main], [],
 
556
          [AC_MSG_ERROR([zlib library not found. Try using --without-zlib to link against the shipped copy.])])],
 
557
          [AC_MSG_ERROR([zlib header not found. Try using --without-zlib to link against the shipped copy.])])
 
558
   ],
 
559
  ["no"|"shipped"], [
 
560
      AC_MSG_RESULT([no])
 
561
      AC_MSG_NOTICE([zlib: linking against shipped zlib.])
 
562
      #AC_SUBST([ZLIB], ["\$(top_builddir)/zlib/libzlib.la"])
 
563
      #AC_SUBST([ZLIBINCL], ["-I\$(top_srcdir)/zlib"])
 
564
      #AC_MSG_NOTICE([zlib= $ZLIB zlibincl= $ZLIBINCL])
 
565
      ARG_WITH_ZLIB="no"
 
566
   ],
 
567
  [AC_MSG_RESULT([$ARG_WITH_ZLIB])
 
568
   AC_MSG_ERROR([Unknown option "$ARG_WITH_ZLIB". Use either "yes" or "no".])]
 
569
)
 
570
 
 
571
AC_MSG_CHECKING([for FIEMAP support])
 
572
AC_CHECK_HEADERS([linux/fiemap.h])
 
573
 
 
574
AC_MSG_CHECKING([whether to link against system libgeoip]) #depends: $ac_arg_enable_geoip
 
575
AS_CASE(["$ARG_WITH_LIBGEOIP"],
 
576
  ["yes"|"system"], [
 
577
      AC_MSG_RESULT([yes])
 
578
 
 
579
      AS_IF([test "x$ac_arg_enable_geoip" = "xno"],
 
580
            [AC_MSG_ERROR([GeoIP support is disabled with this build configuration. Try using --enable-geoip.])])
 
581
 
 
582
      AC_MSG_NOTICE([libgeoip: now checking for the libgeoip library...])
 
583
 
 
584
      AC_CHECK_GEOIP([
 
585
        LIBS="$GEOIP_LIBS $LIBS"
 
586
        CFLAGS="$GEOIP_CFLAGS $CFLAGS"
 
587
       ],[
 
588
        AC_MSG_ERROR([GeoIP library not found. Try using --without-libgeoip to link against the shipped copy.])
 
589
      ])
 
590
   ],
 
591
  ["no"|"shipped"], [
 
592
      AS_IF([test "x$ac_arg_enable_geoip" = "xno"], [
 
593
            # redundant check: session_impl.hpp just won't check for any
 
594
            # GeoIP.h, so any value would be ok (ie. this AS_IF could be
 
595
            # removed)
 
596
            AC_MSG_RESULT([disabled])
 
597
            ARG_WITH_LIBGEOIP="disabled"
 
598
       ], [
 
599
            AC_MSG_RESULT([no])
 
600
            ARG_WITH_LIBGEOIP="no"
 
601
            AC_DEFINE([WITH_SHIPPED_GEOIP_H],[1],[Define to use shipped copy of GeoIP.h])
 
602
            COMPILETIME_OPTIONS+="-DWITH_SHIPPED_GEOIP_H "
 
603
      ])
 
604
   ],
 
605
  [AC_MSG_RESULT([$ARG_WITH_LIBGEOIP])
 
606
   AC_MSG_ERROR([Unknown option "$ARG_WITH_LIBGEOIP". Use either "yes" or "no".])]
 
607
)
 
608
 
 
609
 
 
610
###############################################################################
 
611
# Setting conditional variables for Makefiles
 
612
###############################################################################
 
613
 
 
614
AM_CONDITIONAL([ENABLE_DHT], [test "x$ARG_ENABLE_DHT" = "xyes" -o "x$ARG_ENABLE_DHT" = "xlogging" ])
 
615
AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$ARG_ENABLE_EXAMPLES" = "xyes"])
 
616
AM_CONDITIONAL([ENABLE_TESTS], [test "x$ARG_ENABLE_TESTS" = "xyes"])
 
617
AM_CONDITIONAL([ENABLE_PYTHON_BINDING], [test "x$ARG_ENABLE_PYTHON_BINDING" = "xyes"])
 
618
 
 
619
AM_CONDITIONAL([WITH_SHIPPED_ZLIB], [test "x$ARG_WITH_ZLIB" = "xno" ])
 
620
AM_CONDITIONAL([WITH_SHIPPED_GEOIP], [test "x$ARG_WITH_LIBGEOIP" = "xno" ])
 
621
 
 
622
 
 
623
###############################################################################
 
624
# Other useful stuff
 
625
###############################################################################
 
626
 
 
627
# this works around a bug in asio in boost-1.39
 
628
# see: https://svn.boost.org/trac/boost/ticket/3095
 
629
AC_DEFINE([BOOST_ASIO_HASH_MAP_BUCKETS],[1021],[Define to fix a wrong behavior in boost 1.39.])
 
630
COMPILETIME_OPTIONS+="-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 "
 
631
 
 
632
AC_DEFINE([BOOST_EXCEPTION_DISABLE],[1],[Define to disable the boost.exception features.])
 
633
COMPILETIME_OPTIONS+="-DBOOST_EXCEPTION_DISABLE "
 
634
 
 
635
dnl Use possibly specific python install params
 
636
AC_ARG_VAR([PYTHON_INSTALL_PARAMS], [Set specific install parameters for python bindings.])
 
637
AS_IF([test "x$PYTHON_INSTALL_PARAMS" = "x"],
 
638
      [PYTHON_INSTALL_PARAMS='--prefix=$(DESTDIR)$(prefix)'])
 
639
 
 
640
dnl Set some defines if we are building a shared library
 
641
AS_IF([test "x$enable_shared" = "xyes"],
 
642
      [AC_DEFINE([TORRENT_BUILDING_SHARED],[1],[Define to exports functions and classes with default visibility in GCC.])
 
643
       COMPILETIME_OPTIONS+="-DTORRENT_LINKING_SHARED "])
 
644
 
 
645
AC_SUBST(DEBUGFLAGS)
 
646
AC_SUBST(PYTHON_INSTALL_PARAMS)
 
647
AC_SUBST(COMPILETIME_OPTIONS)
 
648
 
 
649
 
 
650
# Try to guess real svn revision if any, fallback to hardcoded otherwise
 
651
SVN_REVISION=`svn info 2>/dev/null | sed -n -e '/^URL\:.*libtorrent.svn.sourceforge.net/,$!d;s,^Revision\: \([[0-9]]*\)$,\1,p'`
 
652
AS_IF([test -z "$SVN_REVISION"],
 
653
      [SVN_REVISION=`sed -n -e 's/^#define LIBTORRENT_REVISION \"\$Rev\: \([0-9]*\) \$\" $/\1/p' include/libtorrent/version.hpp`])
 
654
 
 
655
 
 
656
###############################################################################
 
657
# Generating Makefiles
 
658
###############################################################################
 
659
 
 
660
AS_ECHO
 
661
AS_ECHO "Generating Makefiles:"
 
662
 
 
663
AC_CONFIG_FILES(
 
664
  [Makefile]
 
665
  [src/Makefile]
 
666
  [include/libtorrent/Makefile]
 
667
  [examples/Makefile]
 
668
  [test/Makefile]
 
669
  [zlib/Makefile]
 
670
  [bindings/Makefile]
 
671
  [bindings/python/Makefile]
 
672
  [bindings/python/setup.py]
 
673
  [libtorrent-rasterbar.pc]
 
674
  [libtorrent-rasterbar-cmake.pc]
 
675
)
 
676
 
 
677
AC_OUTPUT
 
678
 
 
679
 
 
680
###############################################################################
 
681
# Generating config.report
 
682
###############################################################################
 
683
 
 
684
AS_ECHO
 
685
AS_ECHO "Configure script has finished system check."
 
686
AS_ECHO
 
687
 
 
688
cat > config.report << END
 
689
   Config results:
 
690
  -=-=-=-=-=-=-=-=-
 
691
 
 
692
Package:
 
693
  name:                 ${PACKAGE_NAME}
 
694
  version:              ${PACKAGE_VERSION}
 
695
  svn revision:         ${SVN_REVISION}
 
696
 
 
697
Build environment:
 
698
  build system:         ${build}
 
699
  host system:          ${host}
 
700
  target system:        ${target}
 
701
 
 
702
Compiler and linker flags:
 
703
  CPPFlags:             ${CPPFLAGS}
 
704
  CFlags:               ${CFLAGS}
 
705
  CXXFlags:             ${CXXFLAGS}
 
706
  LDFlags:              ${LDFLAGS}
 
707
  Libs:                 ${LIBS}
 
708
  Defs:                 ${DEFS}
 
709
 
 
710
Build options:
 
711
  deprecated functions: ${ARG_ENABLE_DEPRECATED:-yes}
 
712
  debug build:          ${ARG_ENABLE_DEBUG:-no}
 
713
  invariant checks:     ${ARG_ENABLE_INVARIANT:-no}
 
714
  logging support:      ${ARG_ENABLE_LOGGING:-no}
 
715
  statistics:           ${ARG_ENABLE_STATS:-no}
 
716
  disk statistics:      ${ARG_ENABLE_DISK_STATS:-no}
 
717
 
 
718
Features:
 
719
  encryption support:   ${ARG_ENABLE_ENCRYPTION:-yes}
 
720
  geoip support:        ${ARG_ENABLE_GEOIP:-yes}
 
721
  dht support:          ${ARG_ENABLE_DHT:-yes}
 
722
  pool allocators:      ${ARG_ENABLE_POOL_ALLOC:-yes}
 
723
 
 
724
Extra builds:
 
725
  examples:             ${ARG_ENABLE_EXAMPLES:-no}
 
726
  tests:                ${ARG_ENABLE_TESTS:-no}
 
727
  python bindings:      ${ARG_ENABLE_PYTHON_BINDING:-no}
 
728
 
 
729
Pthread library:
 
730
  CFlags:               ${PTHREAD_CFLAGS}
 
731
  Libs:                 ${PTHREAD_LIBS}
 
732
 
 
733
Boost libraries:
 
734
  version:              ${BOOST_VERSION}
 
735
  CPPFlags:             ${BOOST_CPPFLAGS}
 
736
  LDFlags:              ${BOOST_LDFLAGS}
 
737
  boost.system:         ${BOOST_SYSTEM_LIB}
 
738
  boost.filesystem:     ${BOOST_FILESYSTEM_LIB}
 
739
  boost.thread:         ${BOOST_THREAD_LIB}
 
740
END
 
741
 
 
742
AS_IF([test "x$ARG_ENABLE_PYTHON_BINDING" = "xyes"], [
 
743
cat >> config.report << END
 
744
  boost.python:         ${BOOST_PYTHON_LIB}
 
745
 
 
746
Python environment:
 
747
  -automake-
 
748
  binary:               ${PYTHON}
 
749
  version:              ${PYTHON_VERSION}
 
750
  platform:             ${PYTHON_PLATFORM}
 
751
  prefix:               ${PYTHON_PREFIX}
 
752
  exec_prefix:          ${PYTHON_EXEC_PREFIX}
 
753
  pythondir:            ${pythondir}
 
754
  pkgpythondir:         ${pkgpythondir}
 
755
  pyexecdir:            ${pyexecdir}
 
756
  pkgpyexecdir:         ${pkgpyexecdir}
 
757
 
 
758
  -m4-
 
759
  cppflags:             ${PYTHON_CPPFLAGS}
 
760
  ldflags:              ${PYTHON_LDFLAGS}
 
761
  extra libs:           ${PYTHON_EXTRA_LIBS}
 
762
  extra ldflags:        ${PYTHON_EXTRA_LDFLAGS}
 
763
 
 
764
END
 
765
])
 
766
 
 
767
cat >> config.report << END
 
768
 
 
769
External libraries:
 
770
  system zlib:          ${ARG_WITH_ZLIB:-yes}
 
771
  system libgeoip:      ${ARG_WITH_LIBGEOIP:-no}
 
772
END
 
773
 
 
774
AS_IF([test "x$ARG_WITH_LIBGEOIP" = "xyes"], [
 
775
cat >> config.report << END
 
776
 
 
777
GeoIP library:
 
778
  GeoIP CFlags:         ${GEOIP_CFLAGS}
 
779
  GeoIP Libs:           ${GEOIP_LIBS}
 
780
END
 
781
])
 
782
 
 
783
AS_IF([test "x$ARG_ENABLE_ENCRYPTION" = "xyes"], [
 
784
cat >> config.report << END
 
785
 
 
786
OpenSSL library:
 
787
  OpenSSL Libs:         ${OPENSSL_LIBS}
 
788
  OpenSSL LDFlags:      ${OPENSSL_LDFLAGS}
 
789
  OpenSSL Includes:     ${OPENSSL_INCLUDES}
 
790
END 
 
791
])
 
792
 
 
793
cat config.report
 
794
 
 
795
AS_ECHO
 
796
AS_ECHO "Type 'make' to compile $PACKAGE_STRING"
 
797
AS_ECHO "or type 'make V=1' for verbose compiling"
 
798
AS_ECHO "and then 'make install' to install it into $prefix"
 
799
AS_ECHO