diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 000000000..fb4bf1160 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,7 @@ +SUBDIRS = include @ZLIBDIR@ src examples test +EXTRA_DIST = docs Jamfile project-root.jam \ +m4/ac_cxx_namespaces.m4 m4/acx_pthread.m4 m4/ax_boost_date-time.m4 \ +m4/ax_boost_filesystem.m4 m4/ax_boost_thread.m4 + +check: test + test/test_hasher && test/test_bencoding && test/test_ip_filter && echo "tests done, all OK" diff --git a/configure.in b/configure.in new file mode 100644 index 000000000..6ffd11d64 --- /dev/null +++ b/configure.in @@ -0,0 +1,119 @@ +AC_PREREQ(2.59) + +AC_INIT(src/torrent.cpp) +AM_INIT_AUTOMAKE(libtorrent, 0.9) + +AM_CONFIG_HEADER(config.h) + +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_LIBTOOL +# AC_PROG_RANLIB is obsolete by AC_PROC_LIBTOOL + +dnl Check for pthreads and boost libraries. +ACX_PTHREAD + +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.]) +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.]) +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.]) +fi + +dnl try different ways of resolving gethostbyname +AC_CHECK_FUNC(gethostbyname, , + AC_CHECK_LIB(resolv, gethostbyname, , + AC_CHECK_LIB(nsl, gethostbyname, , + AC_CHECK_LIB(ws2_32, main, , + AC_CHECK_LIB(wsock32, main, , + AC_MSG_ERROR([gethostbyname not found. Stopped.]))))) +) + +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, , + AC_MSG_ERROR([libtorrent depends on zlib but zlib was not found on your system]) + ) + ;; + "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".]) +esac +if [[ "$zlib" = "shipped" ]]; then + ZLIB="\$(top_builddir)/zlib/libzlib.la" + ZLIBDIR="zlib" + ZLIBINCL="-I\$(top_builddir)/zlib" + 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]) + +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"]), + [case "$enableval" in + no) + DEBUGFLAGS="-DNDEBUG" + ;; + yes) + DEBUGFLAGS="-g" + ;; + *) + DEBUGFLAGS="$enableval" + ;; + esac], + [DEBUGFLAGS="-g"] +) +AC_SUBST(DEBUGFLAGS) + +AC_CONFIG_FILES(Makefile src/Makefile include/Makefile examples/Makefile test/Makefile) +AC_OUTPUT diff --git a/docs/manual.html b/docs/manual.html index 73750e168..cc3f9ef75 100755 --- a/docs/manual.html +++ b/docs/manual.html @@ -361,7 +361,7 @@ For more build configuration flags see

building with autotools

First of all, you need to install automake and autoconf. Many -unix/linux systems comes with these preinstalled.

+unix/linux systems come with these preinstalled.

Step 1: Running configure

In your shell, change directory to the libtorrent directory and run diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 000000000..da9c8d30c --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,17 @@ +bin_PROGRAMS = client_test dump_torrent make_torrent simple_client +EXTRA_DIST = Jamfile + +client_test_SOURCES = client_test.cpp +client_test_LDADD = $(top_builddir)/src/libtorrent.la + +dump_torrent_SOURCES = dump_torrent.cpp +dump_torrent_LDADD = $(top_builddir)/src/libtorrent.la + +make_torrent_SOURCES = make_torrent.cpp +make_torrent_LDADD = $(top_builddir)/src/libtorrent.la + +simple_client_SOURCES = simple_client.cpp +simple_client_LDADD = $(top_builddir)/src/libtorrent.la + +AM_CXXFLAGS=-ftemplate-depth-50 -I$(top_srcdir)/include @DEBUGFLAGS@ @PTHREAD_CFLAGS@ +AM_LDFLAGS= ${LDLAGS} -L./ -l@BOOST_DATE_TIME_LIB@ -l@BOOST_FILESYSTEM_LIB@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 000000000..38ef16cdc --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1,38 @@ +pkginclude_HEADERS = libtorrent/alert.hpp \ +libtorrent/alert_types.hpp \ +libtorrent/allocate_resources.hpp \ +libtorrent/async_gethostbyname.hpp \ +libtorrent/bencode.hpp \ +libtorrent/debug.hpp \ +libtorrent/entry.hpp \ +libtorrent/escape_string.hpp \ +libtorrent/file.hpp \ +libtorrent/fingerprint.hpp \ +libtorrent/hasher.hpp \ +libtorrent/http_settings.hpp \ +libtorrent/http_tracker_connection.hpp \ +libtorrent/identify_client.hpp \ +libtorrent/invariant_check.hpp \ +libtorrent/io.hpp \ +libtorrent/ip_filter.hpp \ +libtorrent/peer.hpp \ +libtorrent/peer_connection.hpp \ +libtorrent/peer_id.hpp \ +libtorrent/peer_info.hpp \ +libtorrent/peer_request.hpp \ +libtorrent/piece_block_progress.hpp \ +libtorrent/piece_picker.hpp \ +libtorrent/policy.hpp \ +libtorrent/resource_request.hpp \ +libtorrent/session.hpp \ +libtorrent/size_type.hpp \ +libtorrent/socket.hpp \ +libtorrent/stat.hpp \ +libtorrent/storage.hpp \ +libtorrent/torrent.hpp \ +libtorrent/torrent_handle.hpp \ +libtorrent/torrent_info.hpp \ +libtorrent/tracker_manager.hpp \ +libtorrent/udp_tracker_connection.hpp \ +libtorrent/utf8.hpp \ +libtorrent/version.hpp diff --git a/m4/ac_cxx_namespaces.m4 b/m4/ac_cxx_namespaces.m4 new file mode 100644 index 000000000..2f18477bf --- /dev/null +++ b/m4/ac_cxx_namespaces.m4 @@ -0,0 +1,25 @@ +dnl @synopsis AC_CXX_NAMESPACES +dnl +dnl If the compiler can prevent names clashes using namespaces, define +dnl HAVE_NAMESPACES. +dnl +dnl @category Cxx +dnl @author Todd Veldhuizen +dnl @author Luc Maisonobe +dnl @version 2004-02-04 +dnl @license AllPermissive + +AC_DEFUN([AC_CXX_NAMESPACES], +[AC_CACHE_CHECK(whether the compiler implements namespaces, +ac_cv_cxx_namespaces, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], + [using namespace Outer::Inner; return i;], + ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_namespaces" = yes; then + AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) +fi +]) diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4 new file mode 100644 index 000000000..bedf51c32 --- /dev/null +++ b/m4/acx_pthread.m4 @@ -0,0 +1,199 @@ +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html +dnl +AC_DEFUN([ACX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_SAVE +AC_LANG_C +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) + AC_MSG_RESULT($acx_pthread_ok) + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthread or + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" + ;; +esac + +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) + if test x"$acx_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_TRY_LINK([#include ], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [acx_pthread_ok=yes]) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($acx_pthread_ok) + if test "x$acx_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: threads are created detached by default + # and the JOINABLE attribute has a nonstandard name (UNDETACHED). + AC_MSG_CHECKING([for joinable pthread attribute]) + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_JOINABLE;], + ok=PTHREAD_CREATE_JOINABLE, ok=unknown) + if test x"$ok" = xunknown; then + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_UNDETACHED;], + ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) + fi + if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then + AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, + [Define to the necessary symbol if this constant + uses a non-standard name on your system.]) + fi + AC_MSG_RESULT(${ok}) + if test x"$ok" = xunknown; then + AC_MSG_WARN([we do not know how to create joinable pthreads]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with cc_r + AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + acx_pthread_ok=no + $2 +fi +AC_LANG_RESTORE +])dnl ACX_PTHREAD diff --git a/m4/ax_boost_date-time.m4 b/m4/ax_boost_date-time.m4 new file mode 100644 index 000000000..702c657ef --- /dev/null +++ b/m4/ax_boost_date-time.m4 @@ -0,0 +1,43 @@ +dnl @synopsis AX_BOOST_DATE_TIME +dnl +dnl This macro checks to see if the Boost.DateTime library is +dnl installed. It also attempts to guess the currect library name using +dnl several attempts. It tries to build the library name using a user +dnl supplied name or suffix and then just the raw library. +dnl +dnl If the library is found, HAVE_BOOST_DATE_TIME is defined and +dnl BOOST_DATE_TIME_LIB is set to the name of the library. +dnl +dnl This macro calls AC_SUBST(BOOST_DATE_TIME_LIB). +dnl +dnl @category InstalledPackages +dnl @author Michael Tindal +dnl @version 2004-09-20 +dnl @license GPLWithACException + +AC_DEFUN([AX_BOOST_DATE_TIME], +[AC_REQUIRE([AC_CXX_NAMESPACES])dnl +AC_CACHE_CHECK(whether the Boost::DateTime library is available, +ax_cv_boost_date_time, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include ]], + [[using namespace boost::gregorian; date d(2002,Jan,10); return 0;]]), + ax_cv_boost_date_time=yes, ax_cv_boost_date_time=no) + AC_LANG_RESTORE +]) +if test "$ax_cv_boost_date_time" = yes; then + AC_DEFINE(HAVE_BOOST_DATE_TIME,,[define if the Boost::DateTime library is available]) + dnl Now determine the appropriate file names + AC_ARG_WITH([boost-date-time],AS_HELP_STRING([--with-boost-date-time], + [specify the boost date-time library or suffix to use]), + [if test "x$with_boost_date_time" != "xno"; then + ax_date_time_lib=$with_boost_date_time + ax_boost_date_time_lib=boost_date_time-$with_boost_date_time + fi]) + for ax_lib in $ax_date_time_lib $ax_boost_date_time_lib boost_date_time; do + AC_CHECK_LIB($ax_lib, main, [BOOST_DATE_TIME_LIB=$ax_lib break]) + done + AC_SUBST(BOOST_DATE_TIME_LIB) +fi +])dnl diff --git a/m4/ax_boost_filesystem.m4 b/m4/ax_boost_filesystem.m4 new file mode 100644 index 000000000..f733ac3c9 --- /dev/null +++ b/m4/ax_boost_filesystem.m4 @@ -0,0 +1,45 @@ +dnl @synopsis AX_BOOST_FILESYSTEM +dnl +dnl This macro checks to see if the Boost.Filesystem library is +dnl installed. It also attempts to guess the currect library name using +dnl several attempts. It tries to build the library name using a user +dnl supplied name or suffix and then just the raw library. +dnl +dnl If the library is found, HAVE_BOOST_FILESYSTEM is defined and +dnl BOOST_FILESYSTEM_LIB is set to the name of the library. +dnl +dnl This macro calls AC_SUBST(BOOST_FILESYSTEM_LIB). +dnl +dnl @category InstalledPackages +dnl @author Michael Tindal +dnl @version 2005-05-20 +dnl @license GPLWithACException + +AC_DEFUN([AX_BOOST_FILESYSTEM], +[AC_REQUIRE([AC_CXX_NAMESPACES])dnl +AC_CACHE_CHECK(whether the Boost::Filesystem library is available, +ax_cv_boost_filesystem, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include ]], + [[using namespace boost::filesystem; + path my_path( "foo/bar/data.txt" ); + return 0;]]), + ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no) + AC_LANG_RESTORE +]) +if test "$ax_cv_boost_filesystem" = yes; then + AC_DEFINE(HAVE_BOOST_FILE,,[define if the Boost::FILESYSTEM library is available]) + dnl Now determine the appropriate file names + AC_ARG_WITH([boost-filesystem],AS_HELP_STRING([--with-boost-filesystem], + [specify the boost filesystem library or suffix to use]), + [if test "x$with_boost_filesystem" != "xno"; then + ax_filesystem_lib=$with_boost_filesystem + ax_boost_filesystem_lib=boost_filesystem-$with_boost_filesystem + fi]) + for ax_lib in $ax_filesystem_lib $ax_boost_filesystem_lib boost_filesystem; do + AC_CHECK_LIB($ax_lib, main, [BOOST_FILESYSTEM_LIB=$ax_lib break]) + done + AC_SUBST(BOOST_FILESYSTEM_LIB) +fi +])dnl diff --git a/m4/ax_boost_thread.m4 b/m4/ax_boost_thread.m4 new file mode 100644 index 000000000..8057920c1 --- /dev/null +++ b/m4/ax_boost_thread.m4 @@ -0,0 +1,48 @@ +dnl @synopsis AX_BOOST_THREAD +dnl +dnl This macro checks to see if the Boost.Thread library is installed. +dnl It also attempts to guess the currect library name using several +dnl attempts. It tries to build the library name using a user supplied +dnl name or suffix and then just the raw library. +dnl +dnl If the library is found, HAVE_BOOST_THREAD is defined and +dnl BOOST_THREAD_LIB is set to the name of the library. +dnl +dnl This macro calls AC_SUBST(BOOST_THREAD_LIB). +dnl +dnl @category InstalledPackages +dnl @author Michael Tindal +dnl @version 2004-09-20 +dnl @license GPLWithACException + +AC_DEFUN([AX_BOOST_THREAD], +[AC_REQUIRE([AC_CXX_NAMESPACES])dnl +AC_CACHE_CHECK(whether the Boost::Thread library is available, +ax_cv_boost_thread, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + CXXFLAGS_SAVE=$CXXFLAGS +dnl FIXME: need to include a generic way to check for the flag +dnl to turn on threading support. + CXXFLAGS="-pthread $CXXFLAGS" + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include ]], + [[boost::thread_group thrds; return 0;]]), + ax_cv_boost_thread=yes, ax_cv_boost_thread=no) + CXXFLAGS=$CXXFLAGS_SAVE + AC_LANG_RESTORE +]) +if test "$ax_cv_boost_thread" = yes; then + AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Thread library is available]) + dnl Now determine the appropriate file names + AC_ARG_WITH([boost-thread],AS_HELP_STRING([--with-boost-thread], + [specify the boost thread library or suffix to use]), + [if test "x$with_boost_thread" != "xno"; then + ax_thread_lib=$with_boost_thread + ax_boost_thread_lib=boost_thread-$with_boost_thread + fi]) + for ax_lib in $ax_thread_lib $ax_boost_thread_lib boost_thread; do + AC_CHECK_LIB($ax_lib, main, [BOOST_THREAD_LIB=$ax_lib break]) + done + AC_SUBST(BOOST_THREAD_LIB) +fi +])dnl diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 000000000..75f22b60b --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,57 @@ +lib_LTLIBRARIES = libtorrent.la + +libtorrent_la_SOURCES = allocate_resources.cpp async_gethostbyname.cpp \ +entry.cpp escape_string.cpp \ +peer_connection.cpp piece_picker.cpp policy.cpp \ +session.cpp sha1.cpp socket.cpp stat.cpp \ +storage.cpp torrent.cpp torrent_handle.cpp \ +torrent_info.cpp tracker_manager.cpp \ +http_tracker_connection.cpp udp_tracker_connection.cpp \ +alert.cpp identify_client.cpp ip_filter.cpp file.cpp + +noinst_HEADERS = \ +$(top_srcdir)/include/libtorrent/alert.hpp \ +$(top_srcdir)/include/libtorrent/alert_types.hpp \ +$(top_srcdir)/include/libtorrent/allocate_resources.hpp \ +$(top_srcdir)/include/libtorrent/async_gethostbyname.hpp \ +$(top_srcdir)/include/libtorrent/bencode.hpp \ +$(top_srcdir)/include/libtorrent/debug.hpp \ +$(top_srcdir)/include/libtorrent/entry.hpp \ +$(top_srcdir)/include/libtorrent/escape_string.hpp \ +$(top_srcdir)/include/libtorrent/file.hpp \ +$(top_srcdir)/include/libtorrent/fingerprint.hpp \ +$(top_srcdir)/include/libtorrent/hasher.hpp \ +$(top_srcdir)/include/libtorrent/http_settings.hpp \ +$(top_srcdir)/include/libtorrent/http_tracker_connection.hpp \ +$(top_srcdir)/include/libtorrent/identify_client.hpp \ +$(top_srcdir)/include/libtorrent/invariant_check.hpp \ +$(top_srcdir)/include/libtorrent/io.hpp \ +$(top_srcdir)/include/libtorrent/ip_filter.hpp \ +$(top_srcdir)/include/libtorrent/peer.hpp \ +$(top_srcdir)/include/libtorrent/peer_connection.hpp \ +$(top_srcdir)/include/libtorrent/peer_id.hpp \ +$(top_srcdir)/include/libtorrent/peer_info.hpp \ +$(top_srcdir)/include/libtorrent/peer_request.hpp \ +$(top_srcdir)/include/libtorrent/piece_block_progress.hpp \ +$(top_srcdir)/include/libtorrent/piece_picker.hpp \ +$(top_srcdir)/include/libtorrent/policy.hpp \ +$(top_srcdir)/include/libtorrent/resource_request.hpp \ +$(top_srcdir)/include/libtorrent/session.hpp \ +$(top_srcdir)/include/libtorrent/size_type.hpp \ +$(top_srcdir)/include/libtorrent/socket.hpp \ +$(top_srcdir)/include/libtorrent/stat.hpp \ +$(top_srcdir)/include/libtorrent/storage.hpp \ +$(top_srcdir)/include/libtorrent/torrent.hpp \ +$(top_srcdir)/include/libtorrent/torrent_handle.hpp \ +$(top_srcdir)/include/libtorrent/torrent_info.hpp \ +$(top_srcdir)/include/libtorrent/tracker_manager.hpp \ +$(top_srcdir)/include/libtorrent/udp_tracker_connection.hpp \ +$(top_srcdir)/include/libtorrent/utf8.hpp \ +$(top_srcdir)/include/libtorrent/version.hpp + + +libtorrent_la_LDFLAGS = $(LDFLAGS) -version-info 1:0:1 +libtorrent_la_LIBADD = @ZLIB@ -l@BOOST_DATE_TIME_LIB@ -l@BOOST_FILESYSTEM_LIB@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ + +AM_CXXFLAGS= -ftemplate-depth-50 -I$(top_srcdir)/include @ZLIBINCL@ @DEBUGFLAGS@ @PTHREAD_CFLAGS@ +AM_LDFLAGS= $(LDFLAGS) -L./ -l@BOOST_DATE_TIME_LIB@ -l@BOOST_FILESYSTEM_LIB@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 000000000..857e6655b --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,19 @@ +bin_PROGRAMS = test_hasher test_bencoding test_ip_filter test_piece_picker +EXTRA_DIST = Jamfile + +test_hasher_SOURCES = main.cpp test_hasher.cpp +test_hasher_LDADD = $(top_builddir)/src/libtorrent.la + +test_bencoding_SOURCES = main.cpp test_bencoding.cpp +test_bencoding_LDADD = $(top_builddir)/src/libtorrent.la + +test_ip_filter_SOURCES = main.cpp test_ip_filter.cpp +test_ip_filter_LDADD = $(top_builddir)/src/libtorrent.la + +test_piece_picker_SOURCES = main.cpp test_piece_picker.cpp +test_piece_picker_LDADD = $(top_builddir)/src/libtorrent.la + +noinst_HEADERS = test.hpp + +AM_CXXFLAGS=-ftemplate-depth-50 -I$(top_srcdir)/include @DEBUGFLAGS@ @PTHREAD_CFLAGS@ +AM_LDFLAGS= -L./ -l@BOOST_DATE_TIME_LIB@ -l@BOOST_FILESYSTEM_LIB@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ diff --git a/zlib/Makefile.am b/zlib/Makefile.am new file mode 100644 index 000000000..8b1bc1781 --- /dev/null +++ b/zlib/Makefile.am @@ -0,0 +1,10 @@ +noinst_LTLIBRARIES = libzlib.la + +libzlib_la_SOURCES = adler32.c compress.c crc32.c deflate.c \ +gzio.c infback.c inffast.c inflate.c \ +inftrees.c trees.c uncompr.c zutil.c + +noinst_HEADERS = \ +crc32.h deflate.h inffast.h \ +inffixed.h inflate.h inftrees.h \ +trees.h zconf.h zlib.h zutil.h