diff --git a/configure.in b/configure.in index 6c1cc1b75..5f34ea9e2 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,8 @@ AC_PREREQ(2.59) AC_INIT(src/torrent.cpp) AM_INIT_AUTOMAKE(libtorrent, 0.12) -AM_CONFIG_HEADER(config.h) +# Nowhere in the source is config.h included, so make defines command line arguments +# AM_CONFIG_HEADER(config.h) AC_PROG_CC AC_PROG_CPP @@ -20,34 +21,36 @@ AX_BOOST_DATE_TIME dnl check that Boost.DateTime was found: if test -z "$BOOST_DATE_TIME_LIB"; then - AC_MSG_ERROR([unable to find Boost.DateTime library, currently this is required.]) + AC_MSG_ERROR([Unable to find Boost.DateTime library, currently this is required.]) fi 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.]) + 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.]) + 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.]) + AC_MSG_RESULT([Unable to find Boost.Regex library, example test_client will not be build.]) BUILD_TESTCLIENT=no; fi AX_BOOST_PROGRAM_OPTIONS + dnl check that Boost.Program_options was found: if test -z "$BOOST_PROGRAM_OPTIONS_LIB"; then - AC_MSG_RESULT([unable to find Boost.Program_options library, example test_client will not be build.]) + AC_MSG_RESULT([Unable to find Boost.Program_options library, example test_client will not be build.]) BUILD_TESTCLIENT=no; fi @@ -65,6 +68,60 @@ AC_CHECK_FUNC(gethostbyname, , 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]] +) +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]) + ;; + "verbose") + AC_MSG_RESULT(verbose) + AC_DEFINE(TORRENT_VERBOSE_LOGGING,,[define to use 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( + [dhtsupport], + AS_HELP_STRING([--with-dht-support=on|off|logging],[Specify how to use DHT support. Option logging will add extra logging. Default is on.]), + [[dhtsupport=$withval]], + [[dhtsupport=on]] +) +dnl Check the value for the --with-dht-support switch +AC_MSG_CHECKING([how to use DHT]) +case "$dhtsupport" in + "on") + AC_MSG_RESULT(on) + ;; + "off") + AC_MSG_RESULT(off) + AC_DEFINE(TORRENT_DISABLE_DHT,,[define not to use DHT support]) + ;; + "logging") + AC_MSG_RESULT(logging) + AC_DEFINE(TORRENT_DHT_VERBOSE_LOGGING,,[define to use DHT support with extra logging]) + ;; + *) + AC_MSG_RESULT() + AC_MSG_ERROR([Unknown dht-dupport option "$dhtsupport". Use either "on", "off" or "logging".]) + ;; +esac + dnl the user can choose which zlib to use AC_ARG_WITH( [zlib], @@ -88,7 +145,7 @@ case "$zlib" in "system") AC_MSG_RESULT(system) AC_CHECK_LIB(z, main, , - AC_MSG_ERROR([libtorrent depends on zlib but zlib was not found on your system]) + AC_MSG_ERROR([libtorrent depends on zlib but zlib was not found on your system.]) ) ;; "no") @@ -98,6 +155,7 @@ case "$zlib" in *) 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" @@ -140,17 +198,25 @@ case "$examples" in *) AC_MSG_RESULT() AC_MSG_ERROR([Unknown --enable-examples option "$examples". Use either "yes" or "no".]) + ;; esac dnl make $examples visible to Makefiles AC_SUBST([EXAMPLESDIR]) +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.]) + AC_DEFINE(TORRENT_LINKING_SHARED,,[Make sure the functions and classes are exported.]) +fi + dnl want some debugging symbols with that? AC_ARG_ENABLE( [debug], - AS_HELP_STRING([--enable-debug],[set compiler flags for debug symbols, default is "-g"]), + AS_HELP_STRING([--enable-debug],[Set compiler flags for debug symbols, default is no debugging.]), [case "$enableval" in no) - DEBUGFLAGS="-DNDEBUG" + AC_DEFINE(NDEBUG,,[Define to disable debugging]) + DEBUGFLAGS="" ;; yes) DEBUGFLAGS="-g" @@ -159,7 +225,8 @@ AC_ARG_ENABLE( DEBUGFLAGS="$enableval" ;; esac], - [DEBUGFLAGS="-g"] + [DEBUGFLAGS="" + AC_DEFINE(NDEBUG,,[Define to disable debugging])] ) AC_SUBST(DEBUGFLAGS) diff --git a/libtorrent.pc.in b/libtorrent.pc.in index 184cbed0a..218098849 100644 --- a/libtorrent.pc.in +++ b/libtorrent.pc.in @@ -3,6 +3,7 @@ exec_prefix=@exec_prefix@ bindir=@bindir@ libdir=@libdir@ datadir=@datadir@ +datarootdir=@datarootdir@ sysconfdir=@sysconfdir@ includedir=@includedir@ package=@PACKAGE@