2005-08-17 02:24:41 +02:00
|
|
|
AC_PREREQ(2.59)
|
|
|
|
|
|
|
|
AC_INIT(src/torrent.cpp)
|
2007-12-09 02:21:20 +01:00
|
|
|
AM_INIT_AUTOMAKE(libtorrent, 0.14)
|
2005-08-17 02:24:41 +02:00
|
|
|
|
2006-11-19 16:24:30 +01:00
|
|
|
# Nowhere in the source is config.h included, so make defines command line arguments
|
|
|
|
# AM_CONFIG_HEADER(config.h)
|
2005-08-17 02:24:41 +02:00
|
|
|
|
|
|
|
AC_PROG_CC
|
2007-01-13 20:09:21 +01:00
|
|
|
|
|
|
|
if test -z "$(which $CC)"; then
|
|
|
|
AC_MSG_ERROR([Unable to find a working C compiler, giving up.])
|
|
|
|
fi
|
|
|
|
|
2005-08-17 02:24:41 +02:00
|
|
|
AC_PROG_CPP
|
2007-02-09 20:56:16 +01:00
|
|
|
AC_PROG_CXX
|
2007-01-13 20:09:21 +01:00
|
|
|
|
|
|
|
if test -z "$(which $CXX)"; then
|
|
|
|
AC_MSG_ERROR([Unable to find a working C++ compiler, giving up.])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_CACHE_SAVE
|
2005-08-17 02:24:41 +02:00
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_MAKE_SET
|
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
# AC_PROG_RANLIB is obsolete by AC_PROC_LIBTOOL
|
|
|
|
|
2008-04-22 18:22:51 +02:00
|
|
|
AC_SYS_LARGEFILE
|
|
|
|
|
2007-12-14 21:53:56 +01:00
|
|
|
SAVED_LIBS="$LIBS"
|
|
|
|
|
2005-08-17 02:24:41 +02:00
|
|
|
dnl Check for pthreads and boost libraries.
|
|
|
|
ACX_PTHREAD
|
|
|
|
|
2008-05-12 00:43:44 +02:00
|
|
|
AX_BOOST_SYSTEM
|
|
|
|
dnl check that Boost.System was found:
|
|
|
|
if test -z "$BOOST_SYSTEM_LIB"; then
|
|
|
|
AC_MSG_ERROR([unable to find Boost.System library, currently this is required.])
|
|
|
|
fi
|
|
|
|
|
2007-12-08 23:02:59 +01:00
|
|
|
AX_BOOST_IOSTREAMS
|
|
|
|
dnl check that Boost.IOStreams was found:
|
|
|
|
if test -z "$BOOST_IOSTREAMS_LIB"; then
|
|
|
|
AC_MSG_ERROR([unable to find Boost.IOStreams library, currently this is required.])
|
|
|
|
fi
|
|
|
|
|
2005-08-17 02:24:41 +02:00
|
|
|
AX_BOOST_DATE_TIME
|
|
|
|
|
|
|
|
dnl check that Boost.DateTime was found:
|
|
|
|
if test -z "$BOOST_DATE_TIME_LIB"; then
|
2006-11-19 16:24:30 +01:00
|
|
|
AC_MSG_ERROR([Unable to find Boost.DateTime library, currently this is required.])
|
2005-08-17 02:24:41 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
AX_BOOST_FILESYSTEM
|
|
|
|
|
|
|
|
dnl check that Boost.Filesystem was found:
|
|
|
|
if test -z "$BOOST_FILESYSTEM_LIB"; then
|
2006-11-19 16:24:30 +01:00
|
|
|
AC_MSG_ERROR([Unable to find Boost.Filesystem library, currently this is required.])
|
2005-08-17 02:24:41 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
AX_BOOST_THREAD
|
|
|
|
|
|
|
|
dnl check that Boost.Thread was found:
|
|
|
|
if test -z "$BOOST_THREAD_LIB"; then
|
2006-11-19 16:24:30 +01:00
|
|
|
AC_MSG_ERROR([Unable to find Boost.Thread library, currently this is required.])
|
2005-08-17 02:24:41 +02:00
|
|
|
fi
|
|
|
|
|
2008-05-12 00:43:44 +02:00
|
|
|
AX_BOOST_ASIO
|
|
|
|
|
|
|
|
dnl check that Boost.Asio was found:
|
|
|
|
if test -z "$BOOST_ASIO_LIB"; then
|
|
|
|
AC_MSG_ERROR([Unable to find Boost.Asio library, currently this is required.])
|
|
|
|
fi
|
|
|
|
|
2005-10-16 21:13:54 +02:00
|
|
|
AX_BOOST_REGEX
|
2006-11-19 16:24:30 +01:00
|
|
|
|
2005-10-16 21:13:54 +02:00
|
|
|
dnl check that Boost.Regex was found:
|
|
|
|
if test -z "$BOOST_REGEX_LIB"; then
|
2006-11-19 16:24:30 +01:00
|
|
|
AC_MSG_RESULT([Unable to find Boost.Regex library, example test_client will not be build.])
|
2005-10-16 21:13:54 +02:00
|
|
|
BUILD_TESTCLIENT=no;
|
|
|
|
fi
|
|
|
|
|
|
|
|
AX_BOOST_PROGRAM_OPTIONS
|
2006-11-19 16:24:30 +01:00
|
|
|
|
2005-10-16 21:13:54 +02:00
|
|
|
dnl check that Boost.Program_options was found:
|
|
|
|
if test -z "$BOOST_PROGRAM_OPTIONS_LIB"; then
|
2006-11-19 16:24:30 +01:00
|
|
|
AC_MSG_RESULT([Unable to find Boost.Program_options library, example test_client will not be build.])
|
2005-10-16 21:13:54 +02:00
|
|
|
BUILD_TESTCLIENT=no;
|
|
|
|
fi
|
|
|
|
|
2007-12-14 21:53:56 +01:00
|
|
|
LIBS="$SAVED_LIBS"
|
|
|
|
|
2005-10-16 21:13:54 +02:00
|
|
|
if [[ "x$BUILD_TESTCLIENT" != "xno" ]]; then
|
|
|
|
CLIENT_TEST_BIN=client_test;
|
|
|
|
AC_SUBST(CLIENT_TEST_BIN)
|
|
|
|
fi
|
|
|
|
|
2005-08-17 02:24:41 +02:00
|
|
|
dnl try different ways of resolving gethostbyname
|
|
|
|
AC_CHECK_FUNC(gethostbyname, ,
|
|
|
|
AC_CHECK_LIB(resolv, gethostbyname, ,
|
|
|
|
AC_CHECK_LIB(nsl, gethostbyname, ,
|
2008-04-28 01:19:42 +02:00
|
|
|
AC_CHECK_LIB(ws2_32, main,
|
|
|
|
AC_CHECK_LIB(wsock32, main, [LIBS="$LIBS -lws2_32 -lwsock32";] ,
|
|
|
|
AC_MSG_ERROR([wsock32 not found. Stopped.])) ,
|
|
|
|
AC_MSG_ERROR([gethostbyname not found. Stopped.]))))
|
2005-08-17 02:24:41 +02:00
|
|
|
)
|
|
|
|
|
2006-11-19 16:24:30 +01:00
|
|
|
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(
|
2007-03-16 14:40:49 +01:00
|
|
|
[dht],
|
|
|
|
AS_HELP_STRING([--with-dht=on|off|logging],[Specify how to use DHT support. Option logging will add extra logging. Default is on.]),
|
|
|
|
[[dht=$withval]],
|
|
|
|
[[dht=on]]
|
2006-11-19 16:24:30 +01:00
|
|
|
)
|
2007-04-13 21:28:00 +02:00
|
|
|
dnl Check the value for the --with-dht switch
|
2006-11-19 16:24:30 +01:00
|
|
|
AC_MSG_CHECKING([how to use DHT])
|
2007-03-16 14:40:49 +01:00
|
|
|
case "$dht" in
|
2006-11-19 16:24:30 +01:00
|
|
|
"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()
|
2007-04-13 21:28:00 +02:00
|
|
|
AC_MSG_ERROR([Unknown dht option "$dht". Use either "on", "off" or "logging".])
|
2006-11-19 16:24:30 +01:00
|
|
|
;;
|
|
|
|
esac
|
2007-04-13 18:11:11 +02:00
|
|
|
AM_CONDITIONAL(USE_DHT, test "x$dht" != "xoff")
|
2006-11-19 16:24:30 +01:00
|
|
|
|
2007-06-09 00:55:33 +02:00
|
|
|
dnl encryption support.
|
|
|
|
AC_ARG_WITH(
|
|
|
|
[encryption],
|
|
|
|
AS_HELP_STRING([--with-encryption=on|off],[Specify how to use encryption support. Default is on.]),
|
|
|
|
[[encryption=$withval]],
|
|
|
|
[[encryption=on]]
|
|
|
|
)
|
|
|
|
|
|
|
|
dnl Check the value for the --with-encryption switch
|
|
|
|
AC_MSG_CHECKING([how to use encryption])
|
|
|
|
case "$encryption" in
|
|
|
|
"on")
|
|
|
|
AC_MSG_RESULT(on)
|
2007-12-14 21:53:56 +01:00
|
|
|
CHECK_SSL()
|
2007-06-09 00:55:33 +02:00
|
|
|
AC_DEFINE(TORRENT_USE_OPENSSL,,[define to use openssl with libtorrent])
|
|
|
|
|
|
|
|
;;
|
|
|
|
"off")
|
|
|
|
AC_MSG_RESULT(off)
|
|
|
|
AC_DEFINE(TORRENT_DISABLE_ENCRYPTION,,[define not to use encryption support])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT()
|
|
|
|
AC_MSG_ERROR([Unknown encryption option "$encryption". Use either "on" or "off".])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AM_CONDITIONAL(USE_ENCRYPTION, test "x$encryption" != "xoff")
|
|
|
|
|
2005-08-17 02:24:41 +02:00
|
|
|
dnl the user can choose which zlib to use
|
|
|
|
AC_ARG_WITH(
|
|
|
|
[zlib],
|
|
|
|
AS_HELP_STRING([--with-zlib=shipped|system],[Specify the zlib to use, shipped or system. Default is to autodetect system and fallback to shipped.]),
|
|
|
|
[[zlib=$withval]],
|
|
|
|
[[zlib=detect]]
|
|
|
|
)
|
|
|
|
dnl Check the value for the --with-zlib switch
|
|
|
|
AC_MSG_CHECKING([which zlib implementation to use])
|
|
|
|
case "$zlib" in
|
|
|
|
"detect")
|
|
|
|
AC_MSG_RESULT([autodetect])
|
|
|
|
AC_CHECK_LIB(z, main,
|
|
|
|
[zlib="system"],
|
|
|
|
[zlib="shipped"]
|
|
|
|
)
|
|
|
|
;;
|
|
|
|
"shipped")
|
|
|
|
AC_MSG_RESULT(shipped)
|
|
|
|
;;
|
|
|
|
"system")
|
|
|
|
AC_MSG_RESULT(system)
|
|
|
|
AC_CHECK_LIB(z, main, ,
|
2006-11-19 16:24:30 +01:00
|
|
|
AC_MSG_ERROR([libtorrent depends on zlib but zlib was not found on your system.])
|
2005-08-17 02:24:41 +02:00
|
|
|
)
|
|
|
|
;;
|
|
|
|
"no")
|
|
|
|
AC_MSG_RESULT()
|
|
|
|
AC_MSG_ERROR([libtorrent depends on zlib, you must specify either "system" or "shipped".])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT()
|
|
|
|
AC_MSG_ERROR([Unknown zlib option "$zlib". Use either "system" or "shipped".])
|
2006-11-19 16:24:30 +01:00
|
|
|
;;
|
2005-08-17 02:24:41 +02:00
|
|
|
esac
|
|
|
|
if [[ "$zlib" = "shipped" ]]; then
|
|
|
|
ZLIB="\$(top_builddir)/zlib/libzlib.la"
|
|
|
|
ZLIBDIR="zlib"
|
2005-08-27 19:02:43 +02:00
|
|
|
ZLIBINCL="-I\$(top_srcdir)/zlib"
|
2005-08-17 02:24:41 +02:00
|
|
|
AC_CONFIG_FILES(zlib/Makefile)
|
|
|
|
elif [[ "$zlib" = "system" ]]; then
|
|
|
|
ZLIB="-lz"
|
|
|
|
ZLIBDIR=""
|
|
|
|
ZLIBINCL=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl make ZLIB and ZLIBDIR visible to Makefiles
|
|
|
|
AC_SUBST([ZLIB])
|
|
|
|
AC_SUBST([ZLIBDIR])
|
|
|
|
AC_SUBST([ZLIBINCL])
|
|
|
|
|
2006-08-27 20:47:02 +02:00
|
|
|
dnl Check whether the examples should be build
|
|
|
|
AC_ARG_ENABLE(
|
|
|
|
[examples],
|
2006-09-27 22:04:49 +02:00
|
|
|
AS_HELP_STRING([--enable-examples],[Build the examples. Default is not to build them.]),
|
2006-08-27 20:47:02 +02:00
|
|
|
[[examples=$enableval]],
|
|
|
|
[[examples=no]]
|
|
|
|
)
|
|
|
|
dnl Check the value of the --with-examples switch
|
|
|
|
AC_MSG_CHECKING([if the examples should be build])
|
|
|
|
case "$examples" in
|
|
|
|
"yes")
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
EXAMPLESDIR="examples"
|
|
|
|
;;
|
|
|
|
"no")
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
EXAMPLESDIR=""
|
|
|
|
;;
|
|
|
|
"")
|
|
|
|
AC_MSG_RESULT(yes (default))
|
|
|
|
EXAMPLESDIR="examples"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT()
|
|
|
|
AC_MSG_ERROR([Unknown --enable-examples option "$examples". Use either "yes" or "no".])
|
2006-11-19 16:24:30 +01:00
|
|
|
;;
|
2006-08-27 20:47:02 +02:00
|
|
|
esac
|
|
|
|
dnl make $examples visible to Makefiles
|
|
|
|
AC_SUBST([EXAMPLESDIR])
|
|
|
|
|
2006-11-19 16:24:30 +01:00
|
|
|
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
|
|
|
|
|
2005-08-17 02:24:41 +02:00
|
|
|
dnl want some debugging symbols with that?
|
|
|
|
AC_ARG_ENABLE(
|
|
|
|
[debug],
|
2006-11-19 16:24:30 +01:00
|
|
|
AS_HELP_STRING([--enable-debug],[Set compiler flags for debug symbols, default is no debugging.]),
|
2005-08-17 02:24:41 +02:00
|
|
|
[case "$enableval" in
|
|
|
|
no)
|
2006-11-19 16:24:30 +01:00
|
|
|
AC_DEFINE(NDEBUG,,[Define to disable debugging])
|
|
|
|
DEBUGFLAGS=""
|
2005-08-17 02:24:41 +02:00
|
|
|
;;
|
|
|
|
yes)
|
|
|
|
DEBUGFLAGS="-g"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
DEBUGFLAGS="$enableval"
|
|
|
|
;;
|
|
|
|
esac],
|
2006-11-19 16:24:30 +01:00
|
|
|
[DEBUGFLAGS=""
|
|
|
|
AC_DEFINE(NDEBUG,,[Define to disable debugging])]
|
2005-08-17 02:24:41 +02:00
|
|
|
)
|
|
|
|
AC_SUBST(DEBUGFLAGS)
|
|
|
|
|
2006-08-27 20:47:02 +02:00
|
|
|
AC_CONFIG_FILES(Makefile src/Makefile include/Makefile test/Makefile libtorrent.pc)
|
|
|
|
if [[ "x$examples" == "xyes" ]]; then
|
|
|
|
AC_CONFIG_FILES(examples/Makefile)
|
|
|
|
fi
|
2005-08-17 02:24:41 +02:00
|
|
|
AC_OUTPUT
|