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/mHTTP/1.1 200 OK Content-Type: text/plain; charset=utf-8 Connection: close Transfer-Encoding: chunked Cache-Control: max-age=0, private, must-revalidate, no-transform Set-Cookie: i_like_gitea=313283b7b533bdf9; Path=/; HttpOnly; Secure; SameSite=Lax Set-Cookie: _csrf=hU6t6TDhdqTWCvk48xEbMfO1HPY6MTc1MzI0NDcyNjI0ODc3MDc1Nw; Path=/; Max-Age=86400; HttpOnly; Secure; SameSite=Lax X-Frame-Options: SAMEORIGIN Date: Wed, 23 Jul 2025 04:25:26 GMT X-Cache-Status: HIT X-Cache-Age: 0 64c4 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/m 0