# # # delete "m4/acx_pthread.m4" # # delete "m4/fexception.m4" # # delete "m4/iconv_translit.m4" # # delete "m4/localeworks.m4" # # rename "unix/tester-check-net.c" # to "unix/tester-check-net.cc" # # rename "win32/tester-check-net.c" # to "win32/tester-check-net.cc" # # patch "Makefile.am" # from [68922e8a2ac3ffdc44beb70e1f19edbbce81fb87] # to [f5d25d295ce2bd1d3e1b6d5843bb313f47bf85ad] # # patch "configure.ac" # from [37e13f648719c7c26544e5c7ca4731a876a90b7a] # to [e27653ba44e893769adda20d2893066c5794a40b] # # patch "m4/idna.m4" # from [872520e948a6d41fe8125b80d28be163e7ff21dd] # to [0cb3b0c4f97d671687d8c598a861da6c4251a337] # # patch "m4/lua.m4" # from [09465ea2453b0825e0ec0b59330623ca8557d463] # to [540f33b0a84a5b84954ca8009da344cd0fc54da0] # # patch "m4/pcre.m4" # from [5834a1532786ed7a44d97af05c20862467309f69] # to [c6a9c84977b64cc0c429bcd35f8c3c4a2a92559f] # # patch "m4/pkg.m4" # from [00d26b2809771125b8ee9704c1750571fdc8ebdb] # to [94d4df6a698e3c43f053751d09ab5db9d0d21d36] # # patch "m4/sqlite.m4" # from [8d69b0c9ea450c3ca5a613308e6c079d33e49b24] # to [f9e2bcde9bd413bcea00274d80083535a67e37e5] # # patch "m4/xgettextflag.m4" # from [130341eed562b24ddab1338d14d1993620fa08ec] # to [3f26fb55040040cc1eb11338520b7daa1d1595f3] # # patch "mkstemp.cc" # from [7f6d4d917c23c237bf9c38d98ecc916c76a8d1d9] # to [781d66d6fa92ae43c127446c04997e71fb24de8f] # # patch "unix/tester-check-net.cc" # from [bb758c2b16c6a1978a5a96f4ddd204b6feac6e37] # to [093f6aa88a8aafd110387c0f9df09afc1c44185d] # # patch "win32/tester-check-net.cc" # from [939b4453fe11bc0e1883797f0052ca45f760ea1a] # to [898174e2fc36137c9e27823ad89633df94c46066] # ============================================================ --- Makefile.am 68922e8a2ac3ffdc44beb70e1f19edbbce81fb87 +++ Makefile.am f5d25d295ce2bd1d3e1b6d5843bb313f47bf85ad @@ -83,8 +83,8 @@ MOST_SOURCES = \ cycle_detector.hh randomfile.hh adler32.hh \ randomizer.cc randomizer.hh \ netio.hh gettext.h \ - package_revision.c package_revision.h \ - package_full_revision.c package_full_revision.h \ + package_revision.cc package_revision.h \ + package_full_revision.cc package_full_revision.h \ option.cc option.hh options.cc options.hh options_list.hh \ specialized_lexical_cast.cc lexical_cast.hh \ i18n.h parallel_iter.hh safe_map.hh pch.hh current_exception.hh @@ -170,13 +170,13 @@ mtn_SOURCES = $(MOST_SOURCES) monotone.c dist_bin_SCRIPTS = mtnopt mtn_SOURCES = $(MOST_SOURCES) monotone.cc -nodist_mtn_SOURCES = std_hooks.c schema.c +nodist_mtn_SOURCES = std_hooks.cc schema.cc unit_tester_SOURCES = $(UNIT_TEST_SOURCES) $(UNIT_TEST_SRC_SUPPORT) unit_tester_LDADD = $(UNIT_TEST_OBJ_SUPPORT) tester_SOURCES = tester.cc transforms.cc gzip.cc -nodist_tester_SOURCES = testlib.c +nodist_tester_SOURCES = testlib.cc tester_LDADD = $(addprefix mtn-, $(patsubst %.cc, %.$(OBJEXT), \ $(filter %.cc, $(SANITY_CORE_SOURCES) $(LUAEXT_SOURCES) \ pcrewrap.cc))) @@ -245,12 +245,12 @@ if WIN32_PLATFORM unit_tester_LDADD += -lshfolder -lws2_32 -lintl -liconv -liphlpapi lib3rdparty_a_CPPFLAGS += -DWIN32 tester_SOURCES += win32/tester-plaf.cc - check_net_SOURCES = win32/tester-check-net.c + check_net_SOURCES = win32/tester-check-net.cc else libplatform_a_SOURCES += $(UNIX_PLATFORM_SOURCES) mtn_SOURCES += unix/main.cc tester_SOURCES += unix/tester-plaf.cc - check_net_SOURCES = unix/tester-check-net.c + check_net_SOURCES = unix/tester-check-net.cc endif if MISSING_INET_PTON @@ -480,8 +480,8 @@ $(srcdir)/package.m4: $(top_srcdir)/conf # 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 \ - package_revision.c package_full_revision.c \ +CLEAN_SOURCES = std_hooks.cc testlib.cc schema.cc \ + package_revision.cc package_full_revision.cc \ package_revision_raw.txt \ package_full_revision.txt package_full_revision_raw.txt @@ -494,17 +494,17 @@ txt2c: txt2c.cc chmod 0755 address@hidden(EXEEXT) # FIXME: should use stamp files. -%.c: %.sql txt2c +%.cc: %.sql txt2c ./txt2c $(TXT2CFLAGS) --no-static $< $(*F) >address@hidden cmp -s address@hidden $@ || mv -f address@hidden $@ rm -f address@hidden -%.c: %.lua txt2c +%.cc: %.lua txt2c ./txt2c $(TXT2CFLAGS) --no-static $< $(*F) >address@hidden cmp -s address@hidden $@ || mv -f address@hidden $@ rm -f address@hidden -%.c: %.txt txt2c +%.cc: %.txt txt2c ./txt2c $(TXT2CFLAGS) --no-static $< $(*F) >address@hidden cmp -s address@hidden $@ || mv -f address@hidden $@ rm -f address@hidden @@ -514,9 +514,9 @@ txt2c: txt2c.cc cp $< $@ # This construct causes --strip-trailing to be applied only when -# generating package_revision.c. +# generating package_revision.cc. TXT2CFLAGS = -package_revision.c : TXT2CFLAGS = --strip-trailing +package_revision.cc : TXT2CFLAGS = --strip-trailing # This is phony, so that we always try to rebuild it. If it succeeds # in calculating changes, it produces its target; otherwise, its ============================================================ --- configure.ac 37e13f648719c7c26544e5c7ca4731a876a90b7a +++ configure.ac e27653ba44e893769adda20d2893066c5794a40b @@ -6,19 +6,44 @@ AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([1.9 tar-ustar std-options]) AC_CONFIG_SRCDIR([app_state.cc]) AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([util/mtnopt]) +AC_CONFIG_FILES([Makefile po/Makefile.in util/mtnopt]) +AC_LANG([C++]) -# 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_CC_FEXCEPTIONS +# Operating system categorization. Don't add more entries to this +# case statement if you can possibly avoid it. +AC_CANONICAL_HOST +AC_MSG_CHECKING([category of operating system]) -# ??? Shouldn't be necessary (anymore). -test "z$GCC" = "zyes" && CFLAGS="$CFLAGS -fno-strict-aliasing" -test "z$GXX" = "zyes" && CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" +case "$host" in + # Unclear what should be done with Interix and Cygwin. + # The old test would have succeeded on both so I'm including both. + *-mingw32 | *-pc-pw32 | *-pc-mks | *-winnt | *-cygwin | *-interix ) + AC_MSG_RESULT([Windows]) + AM_CONDITIONAL(WIN32_PLATFORM, true) + AC_DEFINE(os_err_t, unsigned int, + [Define as the best type to hold an OS error code.]) + ;; + + *-aix* ) + AC_MSG_RESULT([AIX]) + + AM_CONDITIONAL(WIN32_PLATFORM, false) + AC_DEFINE(os_err_t, int, + [Define as the best type to hold an OS error code.]) + LDFLAGS="$LDFLAGS -Wl,-bexpfull" + ;; + + * ) + AC_MSG_RESULT([Unix]) + + AM_CONDITIONAL(WIN32_PLATFORM, false) + AC_DEFINE(os_err_t, int, + [Define as the best type to hold an OS error code.]) + ;; +esac + +# Checks for programs. AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_CXX_WARNINGS @@ -26,86 +51,36 @@ AC_PROG_RANLIB AC_PROG_RANLIB -AM_GNU_GETTEXT([external]) -AC_PROG_XGETTEXT_FLAG_OPTION -AM_GNU_GETTEXT_VERSION(0.11.5) -AM_ICONV +dnl Note: the gettext checks do not work if AC_LANG(C++) is in effect, +dnl due to the C++ compiler objecting to the very sloppy code that is +dnl used to generate link-time references to gettext functions. This +dnl is the only remaining use of the C compiler in the entire package. +dnl Note 2: if you *don't* put AM_ICONV in here then AM_GNU_GETTEXT +dnl thinks it needs to stick -liconv in LIBS! -# 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_CONFIG_COMMANDS([default-2], [[ -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//'`" - test -n "$as_me" && echo "$as_me: fixing $target" || echo "fixing $target" - mtn_tmp="${target}.tmp" - sed -e 's/^MSGMERGE =.*$/MSGMERGE = false/' \ - -e 's/^MSGMERGE_UPDATE =.*$/MSGMERGE_UPDATE = true/' \ - "$target" > "$mtn_tmp" - mv -f "$mtn_tmp" "$target" ;; - esac -done -]], [[]]) +AC_LANG([C]) +AM_ICONV +AM_GNU_GETTEXT([external], [need-ngettext]) +AM_GNU_GETTEXT_VERSION(0.11.5) +AC_PROG_XGETTEXT_FLAG_OPTION +AC_LANG([C++]) # Do library checks as early as possible so we bail out quickly if # one is missing. AC_SEARCH_LIBS([deflate], [z], , AC_MSG_FAILURE([zlib is required])) +BOOST_VERSION_CHECK +BOOST_VERSION_SPECIFIC_BUGS + +MTN_FIND_BOTAN +MTN_FIND_IDNA MTN_FIND_LUA MTN_FIND_PCRE MTN_FIND_SQLITE -MTN_FIND_IDNA -AC_LANG([C++]) -MTN_FIND_BOTAN -BOOST_VERSION_CHECK -BOOST_VERSION_SPECIFIC_BUGS MTN_NETXX_DEPENDENCIES -AC_LANG([C]) -# C language features - -AC_CACHE_CHECK([whether this is Windows], - ac_win32, [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef WIN32 - #include - #endif]], - [[HANDLE h; DWORD d;]])], - [ac_win32=yes], - [ac_win32=no]) -]) -if test "$ac_win32" = "yes"; then - AM_CONDITIONAL(WIN32_PLATFORM, true) - AC_DEFINE(os_err_t, unsigned int, [OS-specific error type]) -else - AM_CONDITIONAL(WIN32_PLATFORM, false) - AC_DEFINE(os_err_t, int, [OS-specific error type]) -fi - -AC_CACHE_CHECK([whether this is AIX], - ac_aix, [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef _AIX - #error "This is not AIX" - #endif]], - [[int i;]])], - [ac_aix=yes], - [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. dnl It's hard these days to get AC_CHECK_HEADERS to check for just one dnl header which should compile fine with no dependencies. @@ -113,12 +88,8 @@ dnl (A line with nothing but a # on it i dnl pointless nowadays. This is the best thing I can come up with. dnl (A line with nothing but a # on it is ignored by the preprocessor.) -AC_CHECK_HEADERS([fcntl.h netinet/in.h],,, [#]) +AC_CHECK_HEADERS([cxxabi.h fcntl.h netinet/in.h],,, [#]) -AC_LANG([C++]) -# This header may not be visible to the C compiler. -AC_CHECK_HEADERS([cxxabi.h],,, [#]) - # check for language features and compiler bugs AC_CXX_TYPEOF AC_CXX_EXTERN_TEMPLATE @@ -159,8 +130,6 @@ AC_CHECK_MEMBERS([struct dirent.d_type], # Checks for library functions. # We don't do anything especially clever with mmap so we don't need the # complicated check for it. -AC_FUNC_LOCALE_WORKS -AC_FUNC_ICONV_TRANSLIT AC_CHECK_FUNCS([__cxa_current_exception_type __cxa_demangle dirfd \ fstatat mkdtemp mmap putenv setenv strptime unsetenv]) ============================================================ --- m4/idna.m4 872520e948a6d41fe8125b80d28be163e7ff21dd +++ m4/idna.m4 0cb3b0c4f97d671687d8c598a861da6c4251a337 @@ -19,7 +19,6 @@ AC_DEFUN([MTN_FIND_IDNA], # AC_MSG_NOTICE([using libidn compile flags: "$libidn_CFLAGS"]) # AC_MSG_NOTICE([using libidn link flags: "$libidn_LIBS"]) - AC_LANG_ASSERT([C]) AC_CACHE_CHECK([whether the libidn library is usable], ac_cv_lib_libidn_works, [save_LIBS="$LIBS" ============================================================ --- m4/lua.m4 09465ea2453b0825e0ec0b59330623ca8557d463 +++ m4/lua.m4 540f33b0a84a5b84954ca8009da344cd0fc54da0 @@ -45,12 +45,8 @@ AC_DEFUN([MTN_FIND_LUA], LIBS="$LIBS $lua_LIBS" CPPFLAGS="$CPPFLAGS $lua_CFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM( + [#include ], [ - #include - #include - #include - ], - [ lua_State *st; #if LUA_VERSION_NUM != 501 ============================================================ --- m4/pcre.m4 5834a1532786ed7a44d97af05c20862467309f69 +++ m4/pcre.m4 c6a9c84977b64cc0c429bcd35f8c3c4a2a92559f @@ -31,7 +31,6 @@ AC_DEFUN([MTN_FIND_PCRE], # AC_MSG_NOTICE([using pcre link flags: "$pcre_LIBS"]) # Wherever we got the settings from, make sure they work. - AC_LANG_ASSERT([C]) AC_CACHE_CHECK([whether the pcre library is usable], ac_cv_lib_pcre_works, [save_LIBS="$LIBS" save_CPPFLAGS="$CPPFLAGS" ============================================================ --- m4/pkg.m4 00d26b2809771125b8ee9704c1750571fdc8ebdb +++ m4/pkg.m4 94d4df6a698e3c43f053751d09ab5db9d0d21d36 @@ -146,7 +146,7 @@ _PKG_TEXT _PKG_TEXT -To get pkg-config, see .])], +To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS ============================================================ --- m4/sqlite.m4 8d69b0c9ea450c3ca5a613308e6c079d33e49b24 +++ m4/sqlite.m4 f9e2bcde9bd413bcea00274d80083535a67e37e5 @@ -19,7 +19,6 @@ AC_DEFUN([MTN_FIND_SQLITE], # AC_MSG_NOTICE([using sqlite3 compile flags: "$sqlite3_CFLAGS"]) # AC_MSG_NOTICE([using sqlite3 link flags: "$sqlite3_LIBS"]) - AC_LANG_ASSERT([C]) AC_CACHE_CHECK([whether the sqlite3 library is usable], ac_cv_lib_sqlite3_works, [save_LIBS="$LIBS" ============================================================ --- m4/xgettextflag.m4 130341eed562b24ddab1338d14d1993620fa08ec +++ m4/xgettextflag.m4 3f26fb55040040cc1eb11338520b7daa1d1595f3 @@ -1,9 +1,15 @@ # Check whether xgettext supports the --flag option. If it does not, # we forcibly override XGETTEXT_OPTIONS in po/Makefile.in to prevent -# its being used. (See po/Makevars for further explanation.) +# its being used. (See po/Makevars for further explanation.) We also +# unconditionally prevent auto-regeneration of the .po files when the +# sources change, because the translators do not want auto-regenerated +# .po files checked in (it makes extra work for them). # # Yes, this is a big hack, but due to the way po/Makefile is # generated, there is no other way to do this in a dynamic fashion. +# +# Note lame hardwiring of AC_CONFIG_COMMANDS first argument to not +# collide with the gettext macros. AC_DEFUN([AC_PROG_XGETTEXT_FLAG_OPTION], [AC_CACHE_CHECK([whether xgettext supports --flag], @@ -14,9 +20,26 @@ AC_DEFUN([AC_PROG_XGETTEXT_FLAG_OPTION], then ac_cv_prog_xgettext_flag_option=yes else ac_cv_prog_xgettext_flag_option=no fi]) - AC_CONFIG_FILES([po/Makefile.in], - [if test $xgettext_flag_option = no; then - echo 'XGETTEXT_OPTIONS = $(XGETTEXT_OPTIONS_NO_FLAG)' >>po/Makefile.in - fi], - [xgettext_flag_option=$ac_cv_prog_xgettext_flag_option]) + AC_CONFIG_COMMANDS([[default-2]], [[ + 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//'`" + test -n "$as_me" && echo "$as_me: fixing $target" || echo "fixing $target" + mtn_tmp="${target}.tmp" + sed -e 's/^MSGMERGE =.*$/MSGMERGE = false/' \ + -e 's/^MSGMERGE_UPDATE =.*$/MSGMERGE_UPDATE = true/' \ + "$target" > "$mtn_tmp" + if test $xgettext_flag_option = no; then + echo 'XGETTEXT_OPTIONS = $(XGETTEXT_OPTIONS_NO_FLAG)' >>"$mtn_tmp" + fi + mv -f "$mtn_tmp" "$target" ;; + esac + done + ]], + [[xgettext_flag_option=$ac_cv_prog_xgettext_flag_option]]) ]) ============================================================ --- mkstemp.cc 7f6d4d917c23c237bf9c38d98ecc916c76a8d1d9 +++ mkstemp.cc 781d66d6fa92ae43c127446c04997e71fb24de8f @@ -162,7 +162,6 @@ monotone_mkstemp(string & tmpl) } #ifdef BUILD_UNIT_TESTS -#include "base.hh" #include "sanity.hh" #include "unit_tests.hh" ============================================================ --- unix/tester-check-net.c bb758c2b16c6a1978a5a96f4ddd204b6feac6e37 +++ unix/tester-check-net.cc 093f6aa88a8aafd110387c0f9df09afc1c44185d @@ -16,13 +16,15 @@ will exit unsuccessfully and produce diagnostics on stderr. */ #include "config.h" +#include + #if defined HAVE_SOCKET && defined HAVE_NETINET_IN_H -#include #include #include #include #include +#include #include #include ============================================================ --- win32/tester-check-net.c 939b4453fe11bc0e1883797f0052ca45f760ea1a +++ win32/tester-check-net.cc 898174e2fc36137c9e27823ad89633df94c46066 @@ -1,5 +1,5 @@ /* Stub - needs implementing. See lua-testsuite.lua (very end) for rationale, - and unix/tester-check-net.c for behavior to emulate. */ + and unix/tester-check-net.cc for behavior to emulate. */ int main(void) { return 0;