# # # patch "Makefile.am" # from [fedc7408b6e6a7adbe30ef90698ad174679b7992] # to [68922e8a2ac3ffdc44beb70e1f19edbbce81fb87] # # patch "configure.ac" # from [a9f210410433092e6e117d86536442a246f4ff5d] # to [37e13f648719c7c26544e5c7ca4731a876a90b7a] # # patch "m4/botan.m4" # from [fbd01796c67e82be2e1209b3b4026f80c9572b56] # to [52b67093d34c2df48b8b124d9ec4149b1f6268ee] # # patch "m4/idna.m4" # from [5cf3b79652678da089668a065b31e5250607cf08] # to [872520e948a6d41fe8125b80d28be163e7ff21dd] # # patch "m4/inaddrnone.m4" # from [6d2e490259f61df17bba07694c595bd9726254c3] # to [52ce7862f2d1bbb566c2a97c0483439284fba51b] # # patch "m4/lua.m4" # from [29724cbb56455f56e0c3ba25ee352714ad1f3660] # to [09465ea2453b0825e0ec0b59330623ca8557d463] # # patch "m4/numeric_vocab.m4" # from [5aaf4a059f3482cf88ea01688362392811fd9ae5] # to [5276a2eacf683db1a894edae1d0053a6fe9a506c] # # patch "m4/pcre.m4" # from [9219b9e2c8a8131caa363bb9813dab7c109aaebb] # to [5834a1532786ed7a44d97af05c20862467309f69] # # patch "m4/sqlite.m4" # from [7c86e923f30ef5f02d2a9a426e8a3643b893addd] # to [8d69b0c9ea450c3ca5a613308e6c079d33e49b24] # ============================================================ --- Makefile.am fedc7408b6e6a7adbe30ef90698ad174679b7992 +++ Makefile.am 68922e8a2ac3ffdc44beb70e1f19edbbce81fb87 @@ -187,6 +187,7 @@ lib3rdparty_a_SOURCES = $(BOOST_SANDBOX_ libplatform_a_SOURCES = platform.hh tester-plaf.hh lib3rdparty_a_SOURCES = $(BOOST_SANDBOX_SOURCES) \ $(NETXX_SOURCES) +lib3rdparty_a_CPPFLAGS = # may be augmented in conditionals htmldir = $(datadir)/doc/monotone html_DATA = monotone.html @@ -220,43 +221,23 @@ SUFFIXES = .gch SUFFIXES = .gch -AM_CPPFLAGS = -# is/was NDEBUG here just for sqlite? -AM_CFLAGS = $(AM_CPPFLAGS) -DNDEBUG -AM_CXXFLAGS = $(AM_CPPFLAGS) -AM_LDFLAGS = +EXTERNAL_CPPFLAGS = $(pcre_CFLAGS) $(botan_CFLAGS) \ + $(lua_CFLAGS) $(sqlite3_CFLAGS) $(libidn_CFLAGS) +EXTERNAL_LIBS = $(BOOSTLIBS) $(LIBICONV) $(LIBINTL) \ + $(pcre_LIBS) $(botan_LIBS) $(lua_LIBS) $(sqlite3_LIBS) \ + $(libidn_LIBS) -lib3rdparty_a_CPPFLAGS = -lib3rdparty_a_CFLAGS = $(AM_CFLAGS) $(LIB3RDPARTY_CFLAGS) -lib3rdparty_a_CXXFLAGS = $(AM_CXXFLAGS) $(LIB3RDPARTY_CXXFLAGS) +mtn_CPPFLAGS = $(EXTERNAL_CPPFLAGS) +mtn_CXXFLAGS = $(PCH_FLAGS) +mtn_LDADD = libplatform.a lib3rdparty.a $(EXTERNAL_LIBS) -mtn_LDFLAGS = -mtn_CPPFLAGS = -I$(top_srcdir)/lua $(PCRE_FLAGS) $(BOTAN_CPPFLAGS) \ - $(LUA_CFLAGS) $(SQLITE3_CPPFLAGS) $(LIBIDN_CPPFLAGS) -mtn_CFLAGS = $(AM_CFLAGS) $(MTN_CFLAGS) -mtn_CXXFLAGS = $(AM_CXXFLAGS) $(PCH_FLAGS) $(MTN_CXXFLAGS) -mtn_LDADD = libplatform.a lib3rdparty.a $(BOOSTLIBS) $(LIBICONV) $(LIBINTL) \ - $(PCRE_LIBS) $(BOTAN_LIBS) $(LUA_LIBS) $(SQLITE3_LIBS) \ - $(LIBIDN_LIBS) +unit_tester_CPPFLAGS = -DBUILD_UNIT_TESTS $(EXTERNAL_CPPFLAGS) +unit_tester_CXXFLAGS = $(PCH_FLAGS) +unit_tester_LDADD += libplatform.a lib3rdparty.a $(EXTERNAL_LIBS) -unit_tester_LDFLAGS = -unit_tester_CPPFLAGS = -DBUILD_UNIT_TESTS -I$(top_srcdir)/lua $(PCRE_FLAGS) \ - $(BOTAN_CPPFLAGS) $(LUA_CFLAGS) $(SQLITE3_CPPFLAGS) \ - $(LIBIDN_CPPFLAGS) -unit_tester_CXXFLAGS = $(AM_CXXFLAGS) $(PCH_FLAGS) -unit_tester_LDADD += libplatform.a lib3rdparty.a \ - $(BOOSTLIBS) $(LIBICONV) $(LIBINTL) $(PCRE_LIBS) \ - $(BOTAN_LIBS) $(LUA_LIBS) $(SQLITE3_LIBS) \ - $(LIBIDN_LIBS) +tester_CPPFLAGS = $(EXTERNAL_CPPFLAGS) +tester_LDADD += libplatform.a lib3rdparty.a $(EXTERNAL_LIBS) -tester_LDFLAGS = -tester_CPPFLAGS = -I$(top_srcdir)/lua $(PCRE_FLAGS) $(BOTAN_CPPFLAGS) \ - $(LUA_CFLAGS) $(SQLITE3_CPPFLAGS) $(LIBIDN_CPPFLAGS) -tester_CXXFLAGS = $(AM_CXXFLAGS) -tester_LDADD += libplatform.a lib3rdparty.a $(BOOSTLIBS) $(LIBICONV) \ - $(LIBINTL) $(PCRE_LIBS) $(BOTAN_LIBS) $(LUA_LIBS) \ - $(SQLITE3_LIBS) $(LIBIDN_LIBS) - if WIN32_PLATFORM libplatform_a_SOURCES += $(WIN32_PLATFORM_SOURCES) mtn_SOURCES += win32/main.cc ============================================================ --- configure.ac a9f210410433092e6e117d86536442a246f4ff5d +++ configure.ac 37e13f648719c7c26544e5c7ca4731a876a90b7a @@ -2,10 +2,10 @@ AC_PREREQ(2.58) # Process this file with autoconf to produce a configure script. AC_PREREQ(2.58) -AC_INIT(monotone, 0.43dev, address@hidden) +AC_INIT([monotone], [0.43dev], address@hidden) AM_INIT_AUTOMAKE([1.9 tar-ustar std-options]) AC_CONFIG_SRCDIR([app_state.cc]) -AM_CONFIG_HEADER([config.h]) +AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([util/mtnopt]) @@ -13,30 +13,74 @@ AM_PROG_CC_C_O 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_CC_FEXCEPTIONS +# ??? Shouldn't be necessary (anymore). +test "z$GCC" = "zyes" && CFLAGS="$CFLAGS -fno-strict-aliasing" +test "z$GXX" = "zyes" && CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" + AC_PROG_CXX +AC_PROG_CXXCPP AC_PROG_CXX_WARNINGS AC_PROG_CXX_PCH AC_PROG_RANLIB -# ??? Shouldn't be necessary (anymore). -test "z$GCC" = "zyes" && CFLAGS="$CFLAGS -fno-strict-aliasing" -test "z$GXX" = "zyes" && CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" +AM_GNU_GETTEXT([external]) +AC_PROG_XGETTEXT_FLAG_OPTION +AM_GNU_GETTEXT_VERSION(0.11.5) +AM_ICONV -AC_C_CONST -AC_C_INLINE -AC_CC_FEXCEPTIONS +# 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 +]], [[]]) +# 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])) + +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_TRY_COMPILE([#ifdef WIN32 + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef WIN32 #include - #endif], - [HANDLE h; DWORD d;], - ac_win32=yes, - ac_win32=no) + #endif]], + [[HANDLE h; DWORD d;]])], + [ac_win32=yes], + [ac_win32=no]) ]) if test "$ac_win32" = "yes"; then AM_CONDITIONAL(WIN32_PLATFORM, true) @@ -48,12 +92,12 @@ AC_CACHE_CHECK([whether this is AIX], AC_CACHE_CHECK([whether this is AIX], ac_aix, [ - AC_TRY_COMPILE([#ifndef _AIX + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef _AIX #error "This is not AIX" - #endif], - [int i;], - ac_aix=yes, - ac_aix=no) + #endif]], + [[int i;]])], + [ac_aix=yes], + [ac_aix=no]) ]) if test "$ac_aix" = "yes"; then AM_CONDITIONAL(AIX_PLATFORM, true) @@ -63,46 +107,17 @@ fi 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 +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. +dnl Using AC_INCLUDES_DEFAULT triggers a whole bunch of tests that are +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.) -# gettext is nominally a library, but its tests don't work in C++ mode. -AM_GNU_GETTEXT([external]) -AM_GNU_GETTEXT_VERSION(0.11.5) -AM_ICONV -AC_PROG_XGETTEXT_FLAG_OPTION +AC_CHECK_HEADERS([fcntl.h netinet/in.h],,, [#]) -# 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 -]) - AC_LANG([C++]) # This header may not be visible to the C compiler. -AC_CHECK_HEADERS([cxxabi.h],,, [AC_INCLUDES_DEFAULT()]) +AC_CHECK_HEADERS([cxxabi.h],,, [#]) # check for language features and compiler bugs AC_CXX_TYPEOF @@ -116,43 +131,40 @@ MTN_NUMERIC_VOCAB # Checks for typedefs and structures. MTN_NUMERIC_VOCAB -AC_TYPE_OFF_T -AC_TYPE_SIZE_T -AC_TYPE_PID_T +dnl we don't use the stock AC_TYPE_* macros because of the AC_INCLUDES_DEFAULT +dnl problem described above. + +AC_CHECK_TYPE([off_t], + [], + [AC_DEFINE([off_t], [long int], + [Define to `long int' if ]) + +AC_CHECK_TYPE([pid_t], + [], + [AC_DEFINE([pid_t], [int], + [Define to `int' if ]) + AC_CHECK_MEMBERS([struct stat.st_ctim.tv_nsec, - struct stat.st_mtim.tv_nsec, - struct stat.st_ctimespec.tv_nsec, - struct stat.st_mtimespec.tv_nsec, - struct stat.st_ctimensec, - struct stat.st_mtimensec]) -AC_CHECK_MEMBERS([struct dirent.d_type], , ,[#include ]) + struct stat.st_mtim.tv_nsec, + struct stat.st_ctimespec.tv_nsec, + struct stat.st_mtimespec.tv_nsec, + struct stat.st_ctimensec, + struct stat.st_mtimensec], + [], [], [#include ]) +AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [#include ]) # Checks for library functions. -AC_FUNC_STAT -AC_FUNC_MMAP +# 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([atexit memset mkstemp strptime lrint \ - __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])) +AC_CHECK_FUNCS([__cxa_current_exception_type __cxa_demangle dirfd \ + fstatat mkdtemp mmap putenv setenv strptime unsetenv]) -MTN_FIND_LUA -MTN_FIND_PCRE -MTN_FIND_BOTAN -MTN_FIND_SQLITE -MTN_FIND_IDNA - -# check for all things boost-related -BOOST_VERSION_CHECK -BOOST_VERSION_SPECIFIC_BUGS - -# more complex library checks -MTN_NETXX_DEPENDENCIES - # allow compiling with different flags/optimisation # for monotone versus libs, useful for testing. # only makes sense if CFLAGS="" or CXXFLAGS="" ============================================================ --- m4/botan.m4 fbd01796c67e82be2e1209b3b4026f80c9572b56 +++ m4/botan.m4 52b67093d34c2df48b8b124d9ec4149b1f6268ee @@ -4,17 +4,18 @@ AC_DEFUN([MTN_FIND_BOTAN], AC_DEFUN([MTN_FIND_BOTAN], [ - AC_MSG_CHECKING([for Botan]) + AC_LANG_ASSERT([C++]) + AC_MSG_CHECKING([for botan]) if test -n "`type -p botan-config`"; then - BOTAN_VERSION="`botan-config --version`" - BOTAN_CPPFLAGS="`botan-config --cflags`" - BOTAN_LIBS="`botan-config --libs`" + botan_VERSION="`botan-config --version`" + botan_CFLAGS="`botan-config --cflags`" + botan_LIBS="`botan-config --libs`" found_botan=yes - # make sure we have to do with a supported botan version + # make sure we have a supported botan version save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOTAN_CPPFLAGS" + CPPFLAGS="$CPPFLAGS $botan_CFLAGS" AC_PREPROC_IFELSE([ #include @@ -29,7 +30,7 @@ AC_DEFUN([MTN_FIND_BOTAN], [botan_version_match=no]) if test $botan_version_match = no; then AC_MSG_RESULT([no]) - AC_MSG_ERROR([Your botan library is too old ($BOTAN_VERSION).]) + AC_MSG_ERROR([Your botan library is version $botan_VERSION, which is too old]) fi # check against unknown versions from the future and warn @@ -43,21 +44,20 @@ AC_DEFUN([MTN_FIND_BOTAN], [botan_version_match=no]) CPPFLAGS="$save_CPPFLAGS" - AC_MSG_RESULT([yes (version $BOTAN_VERSION)]) + AC_MSG_RESULT([yes (version $botan_VERSION)]) if test $botan_version_match = no; then AC_MSG_WARN([Your botan library version ($BOTAN_VERSION) is newer than expected. Monotone might not build cleanly.]) fi - # AC_MSG_NOTICE([using botan compile flags: "$BOTAN_CPPFLAGS"]) - # AC_MSG_NOTICE([using botan link flags: "$BOTAN_LIBS"]) + # AC_MSG_NOTICE([using botan compile flags: "$botan_CFLAGS"]) + # AC_MSG_NOTICE([using botan link flags: "$botan_LIBS"]) - AC_SUBST(BOTAN_LIBS) - AC_SUBST(BOTAN_CPPFLAGS) + AC_SUBST(botan_CFLAGS) + AC_SUBST(botan_LIBS) else found_botan=no AC_MSG_RESULT([no]) AC_MSG_ERROR([Botan cannot be found.]) fi ]) - ============================================================ --- m4/idna.m4 5cf3b79652678da089668a065b31e5250607cf08 +++ m4/idna.m4 872520e948a6d41fe8125b80d28be163e7ff21dd @@ -1,56 +1,38 @@ AC_DEFUN([MTN_FIND_IDNA], AC_DEFUN([MTN_FIND_IDNA], -[ PKG_PROG_PKG_CONFIG - - # We manually test the variables here because we want them to work +[ # We manually test the variables here because we want them to work # even if pkg-config isn't installed. The use of + instead of :+ is # deliberate; the user should be able to tell us that the empty string # is the correct set of flags. (PKG_CHECK_MODULES gets this wrong!) - if test -n "${LIBIDN_CPPFLAGS+set}" || test -n "${LIBIDN_LIBS+set}"; then + if test -n "${libidn_CFLAGS+set}" || test -n "${libidn_LIBS+set}"; then found_libidn=yes else - PKG_CHECK_MODULES([LIBIDN], [libidn], + PKG_CHECK_MODULES([libidn], [libidn], [found_libidn=yes], [found_libidn=no]) - - if test $found_libidn = yes; then - # PKG_CHECK_MODULES adds LIBIDN_CFLAGS, but we want LIBIDN_CPPFLAGS - LIBIDN_CPPFLAGS="$LIBIDN_CFLAGS" - fi fi if test $found_libidn = no; then AC_MSG_RESULT([no; guessing]) - AC_CHECK_LIB([libidn], [idna_strerror], - [LIBIDN_LIBS=-lidn]) - LIBIDN_CPPFLAGS= + libidn_CFLAGS= + libidn_LIBS=-lidn fi - # AC_MSG_NOTICE([using libidn compile flags: "$LIBIDN_CPPFLAGS"]) - # AC_MSG_NOTICE([using libidn link flags: "$LIBIDN_LIBS"]) + # AC_MSG_NOTICE([using libidn compile flags: "$libidn_CFLAGS"]) + # AC_MSG_NOTICE([using libidn link flags: "$libidn_LIBS"]) - AC_SUBST(LIBIDN_CPPFLAGS) - AC_SUBST(LIBIDN_LIBS) - - AC_CACHE_CHECK([whether the libidn library is usable], ac_cv_lib_libidn_works, + AC_LANG_ASSERT([C]) + AC_CACHE_CHECK([whether the libidn library is usable], + ac_cv_lib_libidn_works, [save_LIBS="$LIBS" save_CPPFLAGS="$CPPFLAGS" - LIBS="$LIBS $LIBIDN_LIBS" - CPPFLAGS="$CPPFLAGS $LIBIDN_CPPFLAGS" + LIBS="$LIBS $libidn_LIBS" + CPPFLAGS="$CPPFLAGS $libidn_CFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM( - [ -extern "C" -{ - #include -} - ], - [ -const char * error = idna_strerror(IDNA_SUCCESS); - ])], + [#include ], + [const char * error = idna_strerror(IDNA_SUCCESS);])], [ac_cv_lib_libidn_works=yes], [ac_cv_lib_libidn_works=no]) LIBS="$save_LIBS" CPPFLAGS="$save_CPPFLAGS"]) if test $ac_cv_lib_libidn_works = no; then AC_MSG_ERROR([Your libidn library is not usable.]) fi - ]) - ============================================================ --- m4/inaddrnone.m4 6d2e490259f61df17bba07694c595bd9726254c3 +++ m4/inaddrnone.m4 52ce7862f2d1bbb566c2a97c0483439284fba51b @@ -1,18 +1,10 @@ AC_DEFUN([AC_HAVE_INADDR_NONE], AC_DEFUN([AC_HAVE_INADDR_NONE], [AC_CACHE_CHECK([whether INADDR_NONE is defined], ac_cv_have_inaddr_none, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#ifdef HAVE_SYS_TYPES_H #include -#endif -#ifdef HAVE_SYS_SOCKET_H #include -#endif -#ifdef HAVE_NETINET_IN_H #include -#endif -#ifdef HAVE_ARPA_INET_H #include -#endif ],[ unsigned long foo = INADDR_NONE; ])], ============================================================ --- m4/lua.m4 29724cbb56455f56e0c3ba25ee352714ad1f3660 +++ m4/lua.m4 09465ea2453b0825e0ec0b59330623ca8557d463 @@ -1,37 +1,28 @@ -# This is a separate macro primarily to trick autoconf into not looking -# for pkg-config. AC_DEFUN([MTN_FIND_LUA], -[ PKG_PROG_PKG_CONFIG - - # We manually test the variables here because we want them to work +[ # We manually test the variables here because we want them to work # even if pkg-config isn't installed. The use of + instead of :+ is # deliberate; the user should be able to tell us that the empty string # is the correct set of flags. (PKG_CHECK_MODULES gets this wrong!) - if test -n "${LUA_CPPFLAGS+set}" || test -n "${LUA_LIBS+set}"; then + if test -n "${lua_CFLAGS+set}" || test -n "${lua_LIBS+set}"; then found_liblua=yes else - PKG_CHECK_MODULES([LUA], [lua5.1], + PKG_CHECK_MODULES([lua], [lua5.1], [found_liblua=yes], [found_liblua=no]) # if that has not been found, we also try lua-5.1, as used on FreeBSD # for example. if test $found_liblua = no; then - PKG_CHECK_MODULES([LUA], [lua-5.1], + PKG_CHECK_MODULES([lua], [lua-5.1], [found_liblua=yes], [found_liblua=no]) fi - - if test $found_liblua = yes; then - # PKG_CHECK_MODULES adds LUA_CFLAGS, but we want LUA_CPPFLAGS - LUA_CPPFLAGS="$LUA_CFLAGS" - fi fi if test $found_liblua = no; then AC_MSG_CHECKING([for lua 5.1]) # try lua-config5x, in case we're on a system with no pkg-config if test -n "`type -p lua-config51`"; then - LUA_CPPFLAGS="`lua-config51 --include`" - LUA_LIBS="`lua-config51 --libs`" + lua_CFLAGS="`lua-config51 --include`" + lua_LIBS="`lua-config51 --libs`" found_liblua=yes AC_MSG_RESULT([yes]) fi @@ -39,32 +30,25 @@ AC_DEFUN([MTN_FIND_LUA], if test $found_liblua = no; then AC_MSG_RESULT([no; guessing]) + lua_CFLAGS= AC_CHECK_LIB([lua5.1], [lua_load], - [LUA_LIBS=-llua5.1], - [LUA_LIBS=-llua]) - LUA_CPPFLAGS= + [lua_LIBS=-llua5.1], + [lua_LIBS=-llua]) fi - # Wherever we got the settings from, make sure they work. - LUA_CPPFLAGS="`echo :$LUA_CPPFLAGS | sed -e 's/^:@<:@ @:>@*//; s/@<:@ @:>@*$//'`" - LUA_LIBS="`echo :$LUA_LIBS | sed -e 's/^:@<:@ @:>@*//; s/@<:@ @:>@*$//'`" + # AC_MSG_NOTICE([using lua compile flags: "$lua_CFLAGS"]) + # AC_MSG_NOTICE([using lua link flags: "$lua_LIBS"]) - # AC_MSG_NOTICE([using lua compile flags: "$LUA_CPPFLAGS"]) - # AC_MSG_NOTICE([using lua link flags: "$LUA_LIBS"]) - AC_CACHE_CHECK([whether the lua library is usable], ac_cv_lib_lua_works, [save_LIBS="$LIBS" save_CPPFLAGS="$CPPFLAGS" - LIBS="$LIBS $LUA_LIBS" - CPPFLAGS="$CPPFLAGS $LUA_CPPFLAGS" + LIBS="$LIBS $lua_LIBS" + CPPFLAGS="$CPPFLAGS $lua_CFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM( [ -extern "C" -{ #include #include #include -} ], [ lua_State *st; @@ -81,5 +65,4 @@ st = luaL_newstate(); if test $ac_cv_lib_lua_works = no; then AC_MSG_ERROR([Your lua library is not usable.]) fi - ]) ============================================================ --- m4/numeric_vocab.m4 5aaf4a059f3482cf88ea01688362392811fd9ae5 +++ m4/numeric_vocab.m4 5276a2eacf683db1a894edae1d0053a6fe9a506c @@ -28,8 +28,7 @@ AC_CACHE_CHECK([size of $1], [AS_TR_SH([ AC_CACHE_CHECK([size of $1], [AS_TR_SH([ac_cv_sizeof_$1])], [AC_COMPUTE_INT([AS_TR_SH([ac_cv_sizeof_$1])], [(long int)(sizeof (ac__type_sizeof_))], - [AC_INCLUDES_DEFAULT() - typedef $1 ac__type_sizeof_;], + [typedef $1 ac__type_sizeof_;], [AC_MSG_FAILURE([cannot compute sizeof ($1)], 77)])])]) AC_DEFUN([MTN_CHOOSE_USE_OF_TYPE], [ ============================================================ --- m4/pcre.m4 9219b9e2c8a8131caa363bb9813dab7c109aaebb +++ m4/pcre.m4 5834a1532786ed7a44d97af05c20862467309f69 @@ -1,30 +1,21 @@ -# This is a separate macro primarily to trick autoconf into not looking -# for pkg-config if we are using the bundled pcre. AC_DEFUN([MTN_FIND_PCRE], -[ PKG_PROG_PKG_CONFIG - - # We manually test the variables here because we want them to work +[ # We manually test the variables here because we want them to work # even if pkg-config isn't installed. The use of + instead of :+ is # deliberate; the user should be able to tell us that the empty string # is the correct set of flags. (PKG_CHECK_MODULES gets this wrong!) - if test -n "${PCRE_CPPFLAGS+set}" || test -n "${PCRE_LIBS+set}"; then + if test -n "${pcre_CFLAGS+set}" || test -n "${pcre_LIBS+set}"; then found_libpcre=yes else - PKG_CHECK_MODULES([PCRE], [libpcre], + PKG_CHECK_MODULES([pcre], [libpcre], [found_libpcre=yes], [found_libpcre=no]) - - if test $found_libpcre = yes; then - # PKG_CHECK_MODULES adds PCRE_CFLAGS, but we want PCRE_CPPFLAGS - PCRE_CPPFLAGS="$PCRE_CFLAGS"; - fi fi if test $found_libpcre = no; then # try pcre-config, in case we're on a system with no pkg-config - AC_MSG_CHECKING([for PCRE using pcre-config]) + AC_MSG_CHECKING([for pcre using pcre-config]) if test -n "`type -p pcre-config`"; then - PCRE_CPPFLAGS="`pcre-config --cflags`" - PCRE_LIBS="`pcre-config --libs`" + pcre_CFLAGS="`pcre-config --cflags`" + pcre_LIBS="`pcre-config --libs`" found_libpcre=yes AC_MSG_RESULT([yes]) fi @@ -32,22 +23,20 @@ AC_DEFUN([MTN_FIND_PCRE], if test $found_libpcre = no; then AC_MSG_RESULT([no; guessing]) - PCRE_CPPFLAGS= - PCRE_LIBS=-lpcre + pcre_CFLAGS= + pcre_LIBS=-lpcre fi - # Wherever we got the settings from, make sure they work. - PCRE_CPPFLAGS="`echo :$PCRE_CPPFLAGS | sed -e 's/^:@<:@ @:>@*//; s/@<:@ @:>@*$//'`" - PCRE_LIBS="`echo :$PCRE_LIBS | sed -e 's/^:@<:@ @:>@*//; s/@<:@ @:>@*$//'`" + # AC_MSG_NOTICE([using pcre compile flags: "$pcre_CFLAGS"]) + # AC_MSG_NOTICE([using pcre link flags: "$pcre_LIBS"]) - # AC_MSG_NOTICE([using PCRE compile flags: "$PCRE_CPPFLAGS"]) - # AC_MSG_NOTICE([using PCRE link flags: "$PCRE_LIBS"]) - - AC_CACHE_CHECK([whether the PCRE library is usable], ac_cv_lib_pcre_works, + # 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" - LIBS="$LIBS $PCRE_LIBS" - CPPFLAGS="$CPPFLAGS $PCRE_CPPFLAGS" + LIBS="$LIBS $pcre_LIBS" + CPPFLAGS="$CPPFLAGS $pcre_CFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM( [#include ], [const char *e; @@ -61,16 +50,16 @@ AC_DEFUN([MTN_FIND_PCRE], LIBS="$save_LIBS" CPPFLAGS="$save_CPPFLAGS"]) if test $ac_cv_lib_pcre_works = no; then - AC_MSG_ERROR([Your PCRE library is not usable.]) + AC_MSG_ERROR([Your pcre library is not usable.]) fi # This is deliberately not cached. - AC_MSG_CHECKING([whether the PCRE library is new enough]) + AC_MSG_CHECKING([whether the pcre library is new enough]) sed -n -e 's/#define REQUIRED_PCRE_MAJOR[ ]*/#define REQUIRED_PCRE_MAJOR /p' \ -e 's/#define REQUIRED_PCRE_MINOR[ ]*/#define REQUIRED_PCRE_MINOR /p' \ $srcdir/pcrewrap.hh > conftest.h save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $PCRE_CPPFLAGS" + CPPFLAGS="$CPPFLAGS $pcre_CFLAGS" AC_PREPROC_IFELSE([ #include "conftest.h" #include @@ -84,7 +73,6 @@ AC_DEFUN([MTN_FIND_PCRE], CPPFLAGS="$save_CPPFLAGS" if test $pcre_version_match = no; then - AC_MSG_ERROR([Your PCRE library is too old, please upgrade it.]) + AC_MSG_ERROR([Your pcre library is too old, please upgrade it.]) fi - ]) ============================================================ --- m4/sqlite.m4 7c86e923f30ef5f02d2a9a426e8a3643b893addd +++ m4/sqlite.m4 8d69b0c9ea450c3ca5a613308e6c079d33e49b24 @@ -1,63 +1,45 @@ AC_DEFUN([MTN_FIND_SQLITE], AC_DEFUN([MTN_FIND_SQLITE], -[ PKG_PROG_PKG_CONFIG - - # We manually test the variables here because we want them to work +[ # We manually test the variables here because we want them to work # even if pkg-config isn't installed. The use of + instead of :+ is # deliberate; the user should be able to tell us that the empty string # is the correct set of flags. (PKG_CHECK_MODULES gets this wrong!) - if test -n "${SQLITE3_CPPFLAGS+set}" || test -n "${SQLITE3_LIBS+set}"; then + if test -n "${sqlite3_CFLAGS+set}" || test -n "${sqlite3_LIBS+set}"; then found_sqlite3=yes else - PKG_CHECK_MODULES([SQLITE3], [sqlite3], + PKG_CHECK_MODULES([sqlite3], [sqlite3], [found_sqlite3=yes], [found_sqlite3=no]) - - if test $found_sqlite3 = yes; then - # PKG_CHECK_MODULES adds SQLITE_CFLAGS, but we want SQLITE_CPPFLAGS - SQLITE3_CPPFLAGS="$SQLITE3_CFLAGS" - fi fi if test $found_sqlite3 = no; then AC_MSG_RESULT([no; guessing]) - AC_CHECK_LIB([sqlite3], [sqlite_open], - [SQLITE3_LIBS=-lsqlite3]) - SQLITE3_CPPFLAGS= + sqlite3_CFLAGS= + sqlite3_LIBS=-lsqlite3 fi - # AC_MSG_NOTICE([using sqlite3 compile flags: "$SQLITE3_CPPFLAGS"]) - # AC_MSG_NOTICE([using sqlite3 link flags: "$SQLITE3_LIBS"]) + # AC_MSG_NOTICE([using sqlite3 compile flags: "$sqlite3_CFLAGS"]) + # AC_MSG_NOTICE([using sqlite3 link flags: "$sqlite3_LIBS"]) - AC_SUBST(SQLITE3_CPPFLAGS) - AC_SUBST(SQLITE3_LIBS) - - AC_CACHE_CHECK([whether the sqlite3 library is usable], ac_cv_lib_sqlite3_works, + AC_LANG_ASSERT([C]) + AC_CACHE_CHECK([whether the sqlite3 library is usable], + ac_cv_lib_sqlite3_works, [save_LIBS="$LIBS" save_CPPFLAGS="$CPPFLAGS" - LIBS="$LIBS $SQLITE3_LIBS" - CPPFLAGS="$CPPFLAGS $SQLITE3_CPPFLAGS" + LIBS="$LIBS $sqlite3_LIBS" + CPPFLAGS="$CPPFLAGS $sqlite3_CFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM( - [ -extern "C" -{ - #include -} - ], - [ -sqlite3 *st; + [#include ], +[sqlite3 *st; #if SQLITE_VERSION_NUMBER < 3003000 -#error Sqlite3 version mismatch +#error Sqlite3 too old #endif sqlite3_open("testfile.db", &st); -sqlite3_close(st); - ])], +sqlite3_close(st);])], [ac_cv_lib_sqlite3_works=yes], [ac_cv_lib_sqlite3_works=no]) LIBS="$save_LIBS" CPPFLAGS="$save_CPPFLAGS"]) if test $ac_cv_lib_sqlite3_works = no; then AC_MSG_ERROR([Your sqlite3 library is not usable.]) fi - ]) -