From f9f7b689a3039c9e34dae9a53823bb6f3f477a04 Mon Sep 17 00:00:00 2001 From: roman_rybalko Date: Tue, 2 Sep 2008 11:14:10 +0000 Subject: [PATCH] automake build system fix: make dist always creates same dist regardless of configure parameters, test/Makefile.am made more clear --- Makefile.am | 3 +- configure.in | 31 +++++---------- examples/Makefile.am | 5 ++- test/Makefile.am | 89 +++++++++++++++----------------------------- zlib/Makefile.am | 3 ++ 5 files changed, 49 insertions(+), 82 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1f3db3ed3..47a269863 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = include @ZLIBDIR@ src @EXAMPLESDIR@ @TESTSDIR@ +#DISTCHECK_CONFIGURE_FLAGS = --enable-tests +SUBDIRS = include zlib src examples test EXTRA_DIST = autotool.sh docs/manual.html docs/manual.rst docs/extension_protocol.rst \ docs/extension_protocol.html \ docs/projects.rst docs/projects.html \ diff --git a/configure.in b/configure.in index 6d0dd196e..dc1074a07 100644 --- a/configure.in +++ b/configure.in @@ -292,18 +292,16 @@ case "$zlib" in esac if [[ "$zlib" = "shipped" ]]; then ZLIB="\$(top_builddir)/zlib/libzlib.la" - ZLIBDIR="zlib" + AM_CONDITIONAL([ENABLE_SHIPPED_ZLIB], true) ZLIBINCL="-I\$(top_srcdir)/zlib" - AC_CONFIG_FILES(zlib/Makefile) elif [[ "$zlib" = "system" ]]; then ZLIB="-lz" - ZLIBDIR="" + AM_CONDITIONAL([ENABLE_SHIPPED_ZLIB], false) ZLIBINCL="" fi dnl make ZLIB and ZLIBDIR visible to Makefiles AC_SUBST([ZLIB]) -AC_SUBST([ZLIBDIR]) AC_SUBST([ZLIBINCL]) dnl Check whether the examples should be build @@ -318,23 +316,21 @@ AC_MSG_CHECKING([if the examples should be build]) case "$examples" in "yes") AC_MSG_RESULT(yes) - EXAMPLESDIR="examples" + AM_CONDITIONAL([ENABLE_EXAMPLES], true) ;; "no") AC_MSG_RESULT(no) - EXAMPLESDIR="" + AM_CONDITIONAL([ENABLE_EXAMPLES], false) ;; "") AC_MSG_RESULT(yes (default)) - EXAMPLESDIR="examples" + AM_CONDITIONAL([ENABLE_EXAMPLES], true) ;; *) 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 Check whether the tests should be build AC_ARG_ENABLE( @@ -348,23 +344,21 @@ AC_MSG_CHECKING([if test files should be build]) case "$tests" in "yes") AC_MSG_RESULT(yes) - TESTSDIR="test" + AM_CONDITIONAL([ENABLE_TESTS], true) ;; "no") AC_MSG_RESULT(no) - TESTSDIR="" + AM_CONDITIONAL([ENABLE_TESTS], false) ;; "") AC_MSG_RESULT(yes (default)) - TESTSDIR="test" + AM_CONDITIONAL([ENABLE_TESTS], true) ;; *) AC_MSG_RESULT() AC_MSG_ERROR([Unknown --enable-tests option "$examples". Use either "yes" or "no".]) ;; esac -dnl make $examples visible to Makefiles -AC_SUBST([TESTSDIR]) dnl Set some defines if we are building a shared library if [[ "x$enable_shared" == "xyes" ]]; then @@ -398,11 +392,4 @@ AC_SUBST(DEBUGFLAGS) dnl Compile time options. AC_SUBST(COMPILETIME_OPTIONS) -AC_CONFIG_FILES(Makefile src/Makefile include/Makefile libtorrent-rasterbar.pc) -if [[ "x$examples" == "xyes" ]]; then - AC_CONFIG_FILES(examples/Makefile) -fi -if [[ "x$tests" == "xyes" ]]; then - AC_CONFIG_FILES(test/Makefile) -fi -AC_OUTPUT +AC_OUTPUT([Makefile src/Makefile include/Makefile zlib/Makefile examples/Makefile test/Makefile libtorrent-rasterbar.pc]) diff --git a/examples/Makefile.am b/examples/Makefile.am index 6b54f45bb..d07f292e7 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,5 +1,8 @@ +if ENABLE_EXAMPLES +# no indent here! - BSD make issue bin_PROGRAMS = @CLIENT_TEST_BIN@ dump_torrent make_torrent simple_client enum_if -EXTRA_PROGRAMS = client_test +endif +EXTRA_PROGRAMS = client_test dump_torrent make_torrent simple_client enum_if EXTRA_DIST = Jamfile client_test_SOURCES = client_test.cpp diff --git a/test/Makefile.am b/test/Makefile.am index 8b1745326..83c721613 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,70 +1,43 @@ -check_PROGRAMS = test_hasher test_bencoding test_ip_filter test_piece_picker \ +test_programs = test_hasher test_bencoding test_ip_filter test_piece_picker \ test_storage test_metadata_extension test_buffer test_swarm test_pe_crypto test_primitives \ test_bandwidth_limiter test_upnp test_fast_extension test_pex test_web_seed \ test_http_connection test_torrent test_transfer test_lsd +if ENABLE_TESTS +# no indent here! - BSD make issue +check_PROGRAMS = $(test_programs) +noinst_LTLIBRARIES = libtest.la +endif TESTS = $(check_PROGRAMS) EXTRA_DIST = Jamfile - -test_lsd_SOURCES = main.cpp setup_transfer.cpp test_lsd.cpp -test_lsd_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_http_connection_SOURCES = main.cpp setup_transfer.cpp test_http_connection.cpp -test_http_connection_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_web_seed_SOURCES = main.cpp setup_transfer.cpp test_web_seed.cpp -test_web_seed_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_pex_SOURCES = main.cpp setup_transfer.cpp test_pex.cpp -test_pex_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_fast_extension_SOURCES = main.cpp setup_transfer.cpp test_fast_extension.cpp -test_fast_extension_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_upnp_SOURCES = test_upnp.cpp -test_upnp_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_hasher_SOURCES = main.cpp test_hasher.cpp -test_hasher_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_bencoding_SOURCES = main.cpp test_bencoding.cpp -test_bencoding_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_ip_filter_SOURCES = main.cpp test_ip_filter.cpp -test_ip_filter_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_piece_picker_SOURCES = main.cpp test_piece_picker.cpp -test_piece_picker_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_storage_SOURCES = main.cpp setup_transfer.cpp test_storage.cpp -test_storage_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_buffer_SOURCES = main.cpp test_buffer.cpp -test_buffer_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_metadata_extension_SOURCES = main.cpp setup_transfer.cpp test_metadata_extension.cpp -test_metadata_extension_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_swarm_SOURCES = main.cpp setup_transfer.cpp test_swarm.cpp -test_swarm_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_pe_crypto_SOURCES = main.cpp setup_transfer.cpp test_pe_crypto.cpp -test_pe_crypto_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_primitives_SOURCES = main.cpp test_primitives.cpp -test_primitives_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_bandwidth_limiter_SOURCES = main.cpp test_bandwidth_limiter.cpp -test_bandwidth_limiter_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_torrent_SOURCES = main.cpp test_torrent.cpp -test_torrent_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la - -test_transfer_SOURCES = main.cpp test_transfer.cpp -test_transfer_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la +EXTRA_PROGRAMS = $(test_programs) noinst_HEADERS = test.hpp setup_transfer.hpp +libtest_la_SOURCES = main.cpp setup_transfer.cpp + +test_lsd_SOURCES = test_lsd.cpp +test_http_connection_SOURCES = test_http_connection.cpp +test_web_seed_SOURCES = test_web_seed.cpp +test_pex_SOURCES = test_pex.cpp +test_fast_extension_SOURCES = test_fast_extension.cpp +test_upnp_SOURCES = test_upnp.cpp +test_hasher_SOURCES = test_hasher.cpp +test_bencoding_SOURCES = test_bencoding.cpp +test_ip_filter_SOURCES = test_ip_filter.cpp +test_piece_picker_SOURCES = test_piece_picker.cpp +test_storage_SOURCES = test_storage.cpp +test_buffer_SOURCES = test_buffer.cpp +test_metadata_extension_SOURCES = test_metadata_extension.cpp +test_swarm_SOURCES = test_swarm.cpp +test_pe_crypto_SOURCES = test_pe_crypto.cpp +test_primitives_SOURCES = test_primitives.cpp +test_bandwidth_limiter_SOURCES = test_bandwidth_limiter.cpp +test_torrent_SOURCES = test_torrent.cpp +test_transfer_SOURCES = test_transfer.cpp + +LDADD = $(top_builddir)/src/libtorrent-rasterbar.la libtest.la + AM_CXXFLAGS=-ftemplate-depth-50 -I$(top_srcdir)/include -I$(top_srcdir)/include/libtorrent @DEBUGFLAGS@ @PTHREAD_CFLAGS@ -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION AM_LDFLAGS= @BOOST_SYSTEM_LIB@ @BOOST_IOSTREAMS_LIB@ @BOOST_DATE_TIME_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @PTHREAD_LIBS@ @SSL_LDFLAGS@ @SSL_LIBS@ diff --git a/zlib/Makefile.am b/zlib/Makefile.am index 8b1bc1781..b3796840a 100644 --- a/zlib/Makefile.am +++ b/zlib/Makefile.am @@ -1,4 +1,7 @@ +if ENABLE_SHIPPED_ZLIB +# no indent here! - BSD make issue noinst_LTLIBRARIES = libzlib.la +endif libzlib_la_SOURCES = adler32.c compress.c crc32.c deflate.c \ gzio.c infback.c inffast.c inflate.c \