# # # delete "m4/acx_pthread.m4" # # delete "m4/fexception.m4" # # rename "util" # to "monotone/util" # # add_file "monotone/util/summarize-tests" # content [e735c196ed39f8499e416d8c9d6e217fce5f40a1] # # patch "monotone/Makefile.am" # from [f06315969162cb6db1546193f532bc37032946c5] # to [f23e7e126f2b4573a3de2a0e67759fef6ceac3ea] # # patch "monotone/configure.ac" # from [cc8425de224120af91e87e03321680d8c8d388c6] # to [d017750e6e09c58413f406d14ac8a879dc8417bb] # # set "monotone/util/summarize-tests" # attr "mtn:execute" # value "true" # ============================================================ --- monotone/util/summarize-tests e735c196ed39f8499e416d8c9d6e217fce5f40a1 +++ monotone/util/summarize-tests e735c196ed39f8499e416d8c9d6e217fce5f40a1 @@ -0,0 +1,54 @@ +#! /bin/sh + +# Summarize results of test suites listed on the command line. +# Based on a similar script which automake 1.9 embeds in its +# check-am rule. + +all=0 +failed=0 +error=0 + +for f in "$@"; do + all=`expr "$all" + 1` + if [ -f "$f" ]; then + s=`cat "$f"` + if [ "$s" = 0 ]; then + : + elif [ "$s" = 1 ]; then + failed=`expr "$failed" + 1` + else + error=`expr "$error" + 1` + fi + else + error=`expr "$error" + 1` + fi +done + +if [ "$failed" = 0 ] && [ "$error" = 0 ]; then + exit=0 + report="" + banner="All $all test suites passed" +else + exit=1 + report="Please report to $PACKAGE_BUGREPORT" + if [ "$error" = 0 ]; then + banner="$failed of $all test suites failed" + elif [ "$failed" = 0 ]; then + banner="$error of $all test suites malfunctioned" + else + banner="$failed of $all test suites failed and $error malfunctioned" + fi +fi + +# As far as we know there is no portable shell command that will emit +# N copies of a specified character. If you know one please tell us. +if [ ${#report} -gt ${#banner} ]; then + dashes=`echo "$report" | sed s/./=/g` +else + dashes=`echo "$banner" | sed s/./=/g` +fi + +echo "$dashes" +echo "$banner" +test -z "$report" || echo "$report" +exit "$exit" ============================================================ --- monotone/Makefile.am f06315969162cb6db1546193f532bc37032946c5 +++ monotone/Makefile.am f23e7e126f2b4573a3de2a0e67759fef6ceac3ea @@ -1,6 +1,3 @@ -AUTOMAKE_OPTIONS=subdir-objects no-dist 1.7.1 -ACLOCAL_AMFLAGS = -I ../m4 - CMD_SOURCES = \ cmd.hh cmd_netsync.cc cmd_list.cc cmd_packet.cc cmd_key_cert.cc \ cmd_merging.cc cmd_db.cc cmd_diff_log.cc cmd_ws_commit.cc \ @@ -89,12 +86,6 @@ MOST_SOURCES = \ specialized_lexical_cast.cc lexical_cast.hh \ i18n.h parallel_iter.hh safe_map.hh pch.hh current_exception.hh -BOOST_SANDBOX_SOURCES = \ - boost/circular_buffer_adaptor.hpp \ - boost/circular_buffer_base.hpp \ - boost/circular_buffer_fwd.hpp \ - boost/circular_buffer.hpp - UNIX_PLATFORM_SOURCES = \ unix/read_password.cc unix/get_system_flavour.cc \ unix/process.cc unix/terminal.cc unix/inodeprint.cc \ @@ -146,249 +137,53 @@ UNIT_TEST_OBJ_SUPPORT = \ mtn-work_migration.$(OBJEXT) # primaries - bin_PROGRAMS = mtn -noinst_PROGRAMS = txt2c -EXTRA_PROGRAMS = - bin_SCRIPTS = mtnopt mtn_SOURCES = $(MOST_SOURCES) monotone.cc nodist_mtn_SOURCES = std_hooks.c schema.c +mtn_LDADD = libplatform.a $(LIBICONV) $(LIBINTL) -unit_tester_SOURCES = $(UNIT_TEST_SOURCES) $(UNIT_TEST_SRC_SUPPORT) -unit_tester_LDADD = $(UNIT_TEST_OBJ_SUPPORT) +# build tools +noinst_PROGRAMS = txt2c -tester_SOURCES = tester.cc transforms.cc gzip.cc -nodist_tester_SOURCES = testlib.c -tester_LDADD = $(addprefix mtn-, $(patsubst %.cc, %.$(OBJEXT), \ - $(filter %.cc, $(SANITY_CORE_SOURCES) $(LUAEXT_SOURCES) \ - pcrewrap.cc))) - txt2c_SOURCES = txt2c.cc -noinst_LIBRARIES = libplatform.a -libplatform_a_SOURCES = platform.hh tester-plaf.hh +# testing tools +check_PROGRAMS = unit_tester tester -htmldir = $(datadir)/doc/monotone -html_DATA = monotone.html +unit_tester_SOURCES = $(UNIT_TEST_SOURCES) $(UNIT_TEST_SRC_SUPPORT) +unit_tester_CPPFLAGS = -DBUILD_UNIT_TESTS +unit_tester_LDADD = $(UNIT_TEST_OBJ_SUPPORT) \ + libplatform.a $(LIBICONV) $(LIBINTL) -# flags +tester_SOURCES = tester.cc transforms.cc gzip.cc pcrewrap.cc \ + $(SANITY_CORE_SOURCES) $(LUAEXT_SOURCES) +nodist_tester_SOURCES = testlib.c +tester_LDADD = libplatform.a $(LIBICONV) $(LIBINTL) -if BUILD_PCH +# platform goo +noinst_LIBRARIES = libplatform.a +libplatform_a_SOURCES = platform.hh tester-plaf.hh -PCH_SOURCE = $(srcdir)/pch.hh -# the .gch file only will be seen if it's in the same dir as the .hh file, -# so need to copy it for separate build directories -PCH_BUILD = pch-build.hh -PCH_FLAGS = -Winvalid-pch -include $(PCH_BUILD) -PCH_FILE = $(PCH_BUILD).gch -sinclude $(PCH_FILE).dep - -*.o *.lo *.obj: $(PCH_FILE) - -$(PCH_BUILD): $(PCH_SOURCE) - cp $(PCH_SOURCE) $(PCH_BUILD) - -$(PCH_FILE): $(PCH_BUILD) - $(MAKE) PCH_FLAGS= pch-file - -pch-file: - $(CXXCOMPILE) -x c++-header $(PCH_BUILD) -o $(PCH_FILE) \ - -MT $(PCH_FILE) -MD -MP -MF "./$(PCH_FILE).Tdep" \ - && mv "./$(PCH_FILE).Tdep" "./$(PCH_FILE).dep" \ - || rm "./$(PCH_FILE).Tdep" -endif - -SUFFIXES = .gch - -AM_CPPFLAGS = -AM_CFLAGS = $(AM_CPPFLAGS) -DTEMP_STORE=1 -DNDEBUG -DSQLITE_OMIT_CURSOR -DSQLITE_OMIT_LOAD_EXTENSION -DTHREADSAFE=0 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 $(SQLITE_CPPFLAGS) -AM_CXXFLAGS = $(AM_CPPFLAGS) -AM_LDFLAGS = - -mtn_LDFLAGS = -mtn_CPPFLAGS = -I$(top_srcdir)/lua -mtn_CFLAGS = $(AM_CFLAGS) $(MTN_CFLAGS) -mtn_CXXFLAGS = $(AM_CXXFLAGS) $(PCH_FLAGS) $(MTN_CXXFLAGS) -mtn_LDADD = libplatform.a $(BOOSTLIBS) $(LIBICONV) $(LIBINTL) - -unit_tester_LDFLAGS = -unit_tester_CPPFLAGS = -DBUILD_UNIT_TESTS -I$(top_srcdir)/lua -unit_tester_CXXFLAGS = $(AM_CXXFLAGS) $(PCH_FLAGS) -unit_tester_LDADD += libplatform.a \ - $(BOOSTLIBS) $(LIBICONV) $(LIBINTL) - -tester_LDFLAGS = -tester_CPPFLAGS = -I$(top_srcdir)/lua -tester_CXXFLAGS = $(AM_CXXFLAGS) -tester_LDADD += libplatform.a $(BOOSTLIBS) $(LIBICONV) $(LIBINTL) - if WIN32_PLATFORM libplatform_a_SOURCES += $(WIN32_PLATFORM_SOURCES) mtn_SOURCES += win32/main.cc + tester_SOURCES += win32/tester-plaf.cc mtn_LDADD += -lshfolder -lws2_32 -lintl -liconv -liphlpapi unit_tester_LDADD += -lshfolder -lws2_32 -lintl -liconv -liphlpapi - tester_SOURCES += win32/tester-plaf.cc else libplatform_a_SOURCES += $(UNIX_PLATFORM_SOURCES) mtn_SOURCES += unix/main.cc tester_SOURCES += unix/tester-plaf.cc endif -# i18n support +# i18n +SUBDIRS = po -datadir = @datadir@ -localedir = $(datadir)/locale -DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ - -# extra files - -PDF_FIGURES= figures/branch-heads.pdf figures/cert.pdf \ - figures/difference-between-versions.pdf \ - figures/file-id-manifest-id.pdf figures/fork.pdf \ - figures/general-workflow.pdf figures/linear-history.pdf \ - figures/local-workflow.pdf figures/manifest.pdf \ - figures/merge.pdf figures/network-workflow.pdf \ - figures/parent-child-hashes.pdf \ - figures/parent-child-names-hashes.pdf figures/parent-child.pdf \ - figures/revision-chaining.pdf figures/revision.pdf \ - figures/statement.pdf figures/three-versions.pdf \ - figures/two-branches.pdf - -PNG_FIGURES=$(addprefix $(top_builddir)/figures/,$(notdir $(PDF_FIGURES:.pdf=.png))) -EPS_FIGURES=$(addprefix $(top_builddir)/figures/,$(notdir $(PDF_FIGURES:.pdf=.eps))) -TEXI_FRAGMENTS = pcre/pcrepattern.texi pcre/pcresyntax.texi - -info_TEXINFOS = monotone.texi -EXTRA_DIST = $(PDF_FIGURES) $(PNG_FIGURES) INSTALL README.changesets \ - UPGRADE monotone.spec monotone.html texinfo.css schema.sql \ - std_hooks.lua testlib.lua lua-testsuite.lua $(srcdir)/tests \ - tester-testsuite.lua $(srcdir)/tester-tests \ - unit-testsuite.lua package.m4 package_revision.txt \ - package_full_revision_dist.txt $(wildcard $(srcdir)/m4/*.m4) \ - sqlite/keywordhash.h contrib/README contrib/monoprof.sh \ - contrib/monotone-notify.pl contrib/ciabot_monotone.py \ - contrib/monotone.el contrib/monotone-nav.el \ - contrib/monotone.bash_completion \ - contrib/monotone.zsh_completion contrib/mtbrowse.sh \ - contrib/colorize contrib/color-logs.sh contrib/color-logs.conf \ - contrib/get_stdio.pl contrib/ciabot_monotone_hookversion.py \ - contrib/Monotone.pm $(wildcard $(srcdir)/contrib/*.lua) \ - $(wildcard $(srcdir)/examples/*) \ - win32/monotone.iss win32/modpath.iss $(wildcard \ - $(srcdir)/debian/*) mac/monotone-pkg-logo.gif \ - mac/monotone.pmproj mac/package-intro.rtf audit-includes \ - $(TEXI_FRAGMENTS) - -MAKEINFOFLAGS=-I $(top_builddir) - -monotone.info: monotone.texi version.texi std_hooks.lua $(TEXI_FRAGMENTS) - -monotone.pdf: monotone.texi version.texi std_hooks.lua $(TEXI_FRAGMENTS) \ - $(PDF_FIGURES) - -monotone.dvi: monotone.texi version.texi std_hooks.lua $(TEXI_FRAGMENTS) \ - $(EPS_FIGURES) - -#%.eps: %.epsi -# mv -f $< $@ -# -#%.epsi: %.ps -# ps2epsi $< $@ - -%.eps : %.ps - ps2eps <$< >$@ - -$(top_builddir)/figures/%.ps: $(srcdir)/figures/%.pdf - mkdir -p $(top_builddir)/figures -# acroread -toPostScript -pairs $< $@ - pdftops $< $@ - -# build an OS X installer -# requires sudo since packagemaker just looks at directory permissions. -PKG_INST_ROOT = $(PWD)/$(top_builddir)/pkg_inst_root -monotone-$(PACKAGE_VERSION).pkg: monotone.pdf html - sudo rm -rf $(PKG_INST_ROOT) - rm -rf "$@" - $(MAKE) install-strip DESTDIR=$(PKG_INST_ROOT) - mkdir -p $(PKG_INST_ROOT)/Developer/Documentation/monotone - cp monotone.pdf $(PKG_INST_ROOT)/Developer/Documentation/monotone/ - cp -r html $(PKG_INST_ROOT)/Developer/Documentation/monotone/html - plutil -convert xml1 -o monotone-xml.pmproj.in $(srcdir)/mac/monotone.pmproj - sed "s/__MONOTONE_VERSION__/$(PACKAGE_VERSION)/g" \ - < monotone-xml.pmproj.in > monotone-xml.pmproj - cp $(srcdir)/mac/monotone-pkg-logo.gif $(srcdir)/mac/package-intro.rtf \ - $(srcdir)/COPYING . - mv COPYING COPYING.txt - chmod -R o-w,g-w,a+rX $(PKG_INST_ROOT) - sudo chown -R root:wheel $(PKG_INST_ROOT)/usr - sudo chown -R root:admin $(PKG_INST_ROOT)/Developer - /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker \ - -build -proj monotone-xml.pmproj -p "$@" - -# build an OS X distribution disk image -dmg: monotone-$(PACKAGE_VERSION).dmg - -monotone-$(PACKAGE_VERSION).dmg: monotone-$(PACKAGE_VERSION).pkg - rm -rf $(top_builddir)/dmg_root "$@" - mkdir $(top_builddir)/dmg_root - cp -R $^ $(top_builddir)/dmg_root/ - chmod -R a+rX $(top_builddir)/dmg_root - hdiutil create -srcfolder "$(top_builddir)/dmg_root" \ - "$@" -format UDZO -scrub -imagekey zlib-level=9 \ - -volname monotone-$(PACKAGE_VERSION) - # testsuite stuff (could this possibly be more ugly?) To get -# parallelism, we cannot use Automake's TESTS feature at all. The -# shell script embedded in the 'check-local' rule is partially -# borrowed from automake 1.9's check.am +# parallelism, we cannot use Automake's TESTS feature at all. -check-local: tester_tests.status unit_tests.status lua_tests.status - @all=0; failed=0; error=0; \ - for f in $^; do \ - all=`expr $$all + 1`; \ - if test -f $$f; then \ - s=`cat $$f`; \ - if test "$$s" = 0; then \ - :; \ - elif test "$$s" = 1; then \ - failed=`expr $$failed + 1`; \ - else \ - error=`expr $$error + 1`; \ - fi; \ - else \ - error=`expr $$error + 1`; \ - fi; \ - done; \ - if test "$$failed" = 0 && test "$$error" = 0; then \ - exit=0; \ - report=""; \ - banner="All $$all test suites passed"; \ - else \ - exit=1; \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - if test "$$error" = 0; then \ - banner="$$failed of $$all test suites failed"; \ - elif test "$$failed" = 0; then \ - banner="$$error of $$all test suites malfunctioned"; \ - else \ - banner="$$failed of $$all test suites failed" \ - banner="$$banner and $$error malfunctioned"; \ - fi; \ - fi; \ - rl=`echo $$report | wc -c`; \ - bl=`echo $$banner | wc -c`; \ - if test $$rl -gt $$bl; then \ - dashes=`echo "$$report" | sed s/./=/g`; \ - else \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - fi; \ - echo $$dashes; \ - echo $$banner; \ - test -z "$$report" || echo "$$report"; \ - exit $$exit - run_%_tests: Makefile { echo '#!/bin/sh'; \ echo 'PATH=$(top_builddir):$$PATH'; \ @@ -404,8 +199,11 @@ lua_tests.status : mtn unit_tests.status : unit_tester lua_tests.status : mtn -check_PROGRAMS = unit_tester tester +check-local: tester_tests.status unit_tests.status lua_tests.status + PACKAGE_BUGREPORT=$(PACKAGE_BUGREPORT) \ + $(SHELL) util/summarize-tests $^ + # We want the tests re-run even if the .status files already exist. # .PHONY does not work for that (bad interaction with pattern rules), # but the FORCE hack does. @@ -416,50 +214,22 @@ mostlyclean-local: mostlyclean-local: rm -rf tester_dir unit-tests html -DISTCLEANFILES = mt-stdint.h xgettext.opts pch-build.hh.gch.dep \ +DISTCLEANFILES = mt-stdint.h xgettext.opts \ run_tester_tests run_unit_tests run_lua_tests \ tester_tests.status unit_tests.status lua_tests.status -# distcheck stuff - -DISTCHECK_CONFIGURE_FLAGS = \ - --with-bundled-sqlite \ - --with-bundled-lua - -# note: these targets are all in srcdir; they are *not* built during -# the VPATH build part of distcheck (with non-writable source -# directory) but only during the initial dist stage. - -$(srcdir)/package.m4: $(top_srcdir)/configure.ac - { \ - echo '# Signature of the current package.'; \ - echo 'm4_define([AT_PACKAGE_NAME], address@hidden@])'; \ - echo 'm4_define([AT_PACKAGE_TARNAME], address@hidden@])'; \ - echo 'm4_define([AT_PACKAGE_VERSION], address@hidden@])'; \ - echo 'm4_define([AT_PACKAGE_STRING], address@hidden@])'; \ - echo 'm4_define([AT_PACKAGE_BUGREPORT], address@hidden@])'; \ - } >$(srcdir)/package.m4 - # we generate some source files to copy data into the executable # note that the only things that should go in BUILT_SOURCES are things # that need to be generated early on 'make all'; this is _not_ true of -# generated source files, but it is true for the PCH if used. +# these generated source files # package_revision.txt and package_full_revision_dist.txt are shipped # in the distribution, so don't delete them here -CLEAN_SOURCES = std_hooks.c testlib.c schema.c \ +CLEANFILES = std_hooks.c testlib.c schema.c \ package_revision.c package_full_revision.c \ package_revision_raw.txt \ package_full_revision.txt package_full_revision_raw.txt -BUILT_SOURCES = $(PCH_FILE) $(PCH_BUILD) - -CLEANFILES = $(BUILT_SOURCES) $(CLEAN_SOURCES) $(EPS_FIGURES) - -txt2c: txt2c.cc - $(CXX) $(CXXFLAGS) -o $@ $< - chmod 0755 address@hidden(EXEEXT) - # FIXME: should use stamp files. %.c: %.sql txt2c ./txt2c $(TXT2CFLAGS) --no-static $< $(*F) >address@hidden @@ -546,57 +316,6 @@ package_full_revision.txt: package_full_ rm -f $@ for SRC in $^; do ([ -f $$SRC -a ! -f $@ ] && cp -f $$SRC $@) || true; done +# This is necessary because autoreconf doesn't pay attention to +# AC_CONFIG_MACRO_DIR. +ACLOCAL_AMFLAGS = -I ../m4 -# This is a magic directive copy-and-pasted, then modified, from the -# automake 1.9 manual, section 13.4, "Checking the distribution". -# Normally, 'distcheck' does a clean build, and then afterwards runs -# 'distclean', and 'distclean' is supposed to remove everything that -# the build created. However, we have some targets -# (package_revision.txt, package_full_revision_dist.txt) that we -# distribute, but then always attempt to rebuild optimistically, and -# then if that fails fall back on the distributed versions. This -# means that 'distclean' should _not_ remove those files, since they -# are distributed, yet building the package will generate those files, -# thus automake thinks that 'distclean' _should_ remove those files, -# and 'distcheck' gets cranky if we don't. So basically what this -# line does is tell 'distcheck' to shut up and ignore those two files. -distcleancheck_listfiles = find . -type f -a ! -name package_revision.txt -a ! -name package_full_revision_dist.txt - -# the distcheck-hook checks for errors in the use of base.hh -distcheck-hook: - cd $(srcdir) && $(SHELL) audit-includes \ - $(sort $(mtn_SOURCES) $(unit_tester_SOURCES) $(tester_SOURCES) \ - $(UNIX_PLATFORM_SOURCES) $(WIN32_PLATFORM_SOURCES) \ - win32/main.cc unix/main.cc) - -# automake doesn't build html docs - -CHECK_SRCDIR_EQ_BUILDDIR=[ "`cd \"$(srcdir)\"; pwd`" = "`pwd`" -a -f ./monotone.texi ] - -.PHONY: apidocs -apidocs: - doxygen doxygen.cfg - -monotone.html: monotone.texi version.texi $(TEXI_FRAGMENTS) \ - std_hooks.lua texinfo.css - if $(CHECK_SRCDIR_EQ_BUILDDIR); then :; else \ - cp -r $(srcdir)/figures .; \ - cp $(srcdir)/texinfo.css .; \ - fi - makeinfo -I $(srcdir) --no-split --no-headers --output $@ --html $< - cp $@ address@hidden - sed -e 's,,,' address@hidden >$@ - rm -f address@hidden - -html: monotone.texi version.texi std_hooks.lua texinfo.css - if $(CHECK_SRCDIR_EQ_BUILDDIR); then :; else \ - cp -r $(srcdir)/figures .; \ - fi - mkdir -p $@ - cp -r $(srcdir)/figures $@ - cp $(srcdir)/texinfo.css $@ - makeinfo -I $(srcdir) --number-sections --html --output $@ $< - for f in $@/*.html; do \ - cp $$f $$f.bak; \ - sed -e 's,,,' $$f.bak >$$f; \ - rm -f $$f.bak; \ - done ============================================================ --- monotone/configure.ac cc8425de224120af91e87e03321680d8c8d388c6 +++ monotone/configure.ac d017750e6e09c58413f406d14ac8a879dc8417bb @@ -1,35 +1,29 @@ AC_INIT(monotone, 0.40, address@hidden # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.58) AC_INIT(monotone, 0.40, address@hidden) -AM_INIT_AUTOMAKE([1.9 tar-ustar std-options]) AC_CONFIG_AUX_DIR([..]) AC_CONFIG_MACRO_DIR([../m4]) + +AM_INIT_AUTOMAKE([1.9 foreign no-dist subdir-objects]) AC_CONFIG_SRCDIR([app_state.cc]) -AM_CONFIG_HEADER([config.h]) AC_CONFIG_FILES([Makefile]) +AC_CONFIG_HEADERS([config.h]) # Checks for programs. dnl Note: AC_PROG_CC is implied by AM_PROG_CC_C_O and in any case has dnl already been done by AM_INIT_AUTOMAKE. AM_PROG_CC_C_O -AC_PROG_GCC_TRADITIONAL AC_PROG_CXX AC_PROG_CXX_WARNINGS AC_PROG_CXX_PCH AC_PROG_RANLIB +PKG_PROG_PKG_CONFIG -# ??? Shouldn't be necessary (anymore). -test "z$GCC" = "zyes" && CFLAGS="$CFLAGS -fno-strict-aliasing" -test "z$GXX" = "zyes" && CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" - -AC_C_CONST -AC_C_INLINE -AC_CC_FEXCEPTIONS - +# Checks for host operating systems that need special treatment. AC_CACHE_CHECK([whether this is Windows], ac_win32, [ AC_TRY_COMPILE([#ifdef WIN32 @@ -57,50 +51,57 @@ if test "$ac_aix" = "yes"; then ac_aix=no) ]) if test "$ac_aix" = "yes"; then - AM_CONDITIONAL(AIX_PLATFORM, true) LDFLAGS="$LDFLAGS -Wl,-bexpfull" -else - AM_CONDITIONAL(AIX_PLATFORM, false) fi -# Checks for header files. -AC_HEADER_STDC -dnl Explicitly specifying AC_INCLUDES_DEFAULT gets autoconf not to do all -dnl the tests twice. -AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/file.h \ - sys/socket.h sys/time.h termios.h errno.h],,, - [AC_INCLUDES_DEFAULT()]) -AC_HEADER_STDBOOL +# Checks for libraries are done first because they are more likely to +# fail the configure step than anything else. -# gettext is nominally a library, but its tests don't work in C++ mode. +# zlib is easy +AC_SEARCH_LIBS([deflate], [z], , AC_MSG_FAILURE([zlib is required])) + +# gettext has its own macros (but I wish it didn't, there's all kinds +# of unnecessary junk in them) AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION(0.11.5) AM_ICONV AC_PROG_XGETTEXT_FLAG_OPTION -# Stick some logic into config.status, after the logic that -# AM_GNU_GETTEXT sticks into config.status, to annul the UPDATEPOFILES -# variable in po/Makefile. This prevents auto-regeneration of the -# .po files when the sources change, which the translators do not want. -AC_OUTPUT_COMMANDS([ - for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - target="`echo x$ac_file | sed -e 's/.in$//' -e 's/^x//'`" - mtn_tmp="${target}.tmp" - test -n "$as_me" && echo "$as_me: fixing $target" || echo "fixing $target" - sed -e 's/^MSGMERGE =.*$/MSGMERGE = false/' \ - -e 's/^MSGMERGE_UPDATE =.*$/MSGMERGE_UPDATE = true/' \ - "$target" > "$mtn_tmp" - mv -f "$mtn_tmp" "$target" ;; - esac - done -]) +# boost (test requires C++) +AC_LANG([C++]) +BOOST_VERSION_CHECK +BOOST_VERSION_SPECIFIC_BUGS +AC_LANG([C]) +# Bundled libraries. +if test -d ../libinst; then + li=`cd ../libinst && pwd` + PATH="${li}/bin:${PATH}" + PKG_CONFIG_PATH="${li}/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" + export PATH PKG_CONFIG_PATH +fi + +# All of these libraries can be probed for by some combination of +# pkg-config and foobar-config, but it's not as simple as it ought to +# be, hence the macros. + +dnl MTN_3RDPARTY_LIB(botan) +dnl MTN_3RDPARTY_LIB(idna) +dnl MTN_3RDPARTY_LIB(lua) +dnl MTN_3RDPARTY_LIB(netxx) +dnl MTN_3RDPARTY_LIB(pcre) +dnl MTN_3RDPARTY_LIB(sqlite) + +dnl MTN_REMOVE_REDUNDANT_LIB_SWITCHES + +# Checks for header files. + +dnl Explicitly specifying AC_INCLUDES_DEFAULT gets autoconf not to do all +dnl the tests twice. +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/file.h \ + sys/socket.h sys/time.h termios.h errno.h],,, + [AC_INCLUDES_DEFAULT()]) + AC_LANG([C++]) # This header may not be visible to the C compiler. AC_CHECK_HEADERS([cxxabi.h],,, [AC_INCLUDES_DEFAULT()]) @@ -138,25 +139,28 @@ AC_CHECK_FUNCS([atexit memset mkstemp st __cxa_current_exception_type __cxa_demangle \ putenv setenv unsetenv dirfd fstatat mkdtemp]) -# simple library checks -AC_SEARCH_LIBS([deflate], [z], , AC_MSG_FAILURE([zlib is required])) -MTN_LIB_PCRE +# Stick some logic into config.status, after the logic that +# AM_GNU_GETTEXT sticks into config.status, to annul the UPDATEPOFILES +# variable in po/Makefile. This prevents auto-regeneration of the +# .po files when the sources change, which the translators do not want. +AC_OUTPUT_COMMANDS([ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + target="`echo x$ac_file | sed -e 's/.in$//' -e 's/^x//'`" + mtn_tmp="${target}.tmp" + test -n "$as_me" && echo "$as_me: fixing $target" || echo "fixing $target" + sed -e 's/^MSGMERGE =.*$/MSGMERGE = false/' \ + -e 's/^MSGMERGE_UPDATE =.*$/MSGMERGE_UPDATE = true/' \ + "$target" > "$mtn_tmp" + mv -f "$mtn_tmp" "$target" ;; + esac + done +]) -# check for all things boost-related -BOOST_VERSION_CHECK -BOOST_VERSION_SPECIFIC_BUGS - -# more complex library checks -MTN_NETXX_DEPENDENCIES -MTN_SQLITE_DEPENDENCIES - -# allow compiling with different flags/optimisation -# for monotone versus libs, useful for testing. -# only makes sense if CFLAGS="" or CXXFLAGS="" -AC_SUBST(MONOTONE_CFLAGS) -AC_SUBST(MONOTONE_CXXFLAGS) -AC_SUBST(LIB3RDPARTY_CFLAGS) -AC_SUBST(LIB3RDPARTY_CXXFLAGS) - AC_OUTPUT