# # # rename "idna" # to "idn" # # add_file "m4/thirdparty.m4" # content [54de7d7211b19a320ebe4058db497bfff119e4f1] # # patch "Makefile.in" # from [ae54acc8e7695a62239ff945848163d6a1d9cd84] # to [ec6ab4fd18e8e6dead60ee3d3e046dc5919e899a] # # patch "autogen.sh" # from [1ed844478cc758f1c43c79a8d020610445d3fd0e] # to [809e9c6bc73efb54647b63f354f938ebd87b5abc] # # patch "configure.ac" # from [a7a508ca8f53f63f6985ca3545bfae070f8270d1] # to [4ade488d3ec2329e7b8352630e4f165817f2ac71] # # patch "lua/configure.ac" # from [6e9c0ee0de938fc3a20845355836842396f6616d] # to [33a3c316c18f054a46cffe3e9e5fefdd18272edc] # # patch "monotone/configure.ac" # from [d017750e6e09c58413f406d14ac8a879dc8417bb] # to [cd1e42d9f2fba6f0bd8e9e77ae5da915905a8361] # # patch "netxx/configure.ac" # from [b936d44a865e3b18a58cb698d63b231b140af9a1] # to [18be9d93d1c4d6a637d3439fe2846ca42140cd24] # # patch "sqlite/Makefile.am" # from [446b91c4648a05606861395c9e324ab31375506c] # to [96ac28a5b8228061eeb0d1bbef101fbf428fa634] # ============================================================ --- m4/thirdparty.m4 54de7d7211b19a320ebe4058db497bfff119e4f1 +++ m4/thirdparty.m4 54de7d7211b19a320ebe4058db497bfff119e4f1 @@ -0,0 +1,213 @@ +# Set up to use either system-provided or bundled versions of +# third-party libraries which can be probed for by pkg-config +# and/or custom *-config executables. + +# This is more complicated than it ought to be because (a) we can +# assume that each of these libraries installs either a .pc file or a +# *-config executable, but which one may vary across versions and +# installations, and (b) we can't count on the .pc file, or the +# *-config executable, to have the same name in all versions or +# installations! + +# All is not lost, however; we _can_ count on the .pc file or *-config +# executable to have a basename that matches the Perl regular +# expression /^(lib)?\Q${libname}\E(-?[0-9.]+)?(\.pc|-config)$/i, +# where ${libname} is the short name of the library. Thus, we can +# enumerate all the possibilities for any given library. This is easy +# for *-config executables (iterate over $PATH) and slightly trickier +# for .pc files (iterate over PKG_CONFIG_PATH, but also we have to +# determine pkg-config's built-in path, which is nontrivial) + +AC_DEFUN([MTN_FULL_PKG_CONFIG_PATH], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# The dummy "pkg-config" package is guaranteed to exist. +if test -n "$PKG_CONFIG"; then + FULL_PKG_CONFIG_PATH=`$PKG_CONFIG --debug pkg-config 2>&1 | + sed -ne "/^Scanning directory '/{; s///; s/'$//; p;}" | + tr "$as_nl" ':' | sed 's/:$//'` +fi +]) + +# Subroutine of MTN_3RDPARTY_LIB, for readability only. +AC_DEFUN([MTN_VERSION_AT_LEAST], +[( echo "$1"; echo "$2" ) | tr -c "$as_cr_alnum$as_nl" ' ' | +$AWK 'NR==1 { + for (i = 1; i <= NF; i++) + v[i] = $i; + NV = NF; + } + NR==2 { + for(i = 1; i <= NF; i++) + c[i] = $i; + + if (NV < NF) { + for (i = NV+1; i <= NF; i++) + v[i] = 0; + NV = NF; + } else if (NV > NF) { + for (i = NF+1; i <= NV; i++) + c[i] = 0; + } + } + END { + if (NR != 2) + print "ERROR" + else { + win = 0; + for(i=1; i<=NV; i++) { + if (c[i] > v[i]) { + win = 1; + break; + } else if (c[i] < v[i]) { + break; + } + } + if (win == 1 || i == NV+1) + print "true" + else + print "false" + } + }']) + +# MTN_3RDPARTY_LIB(libname) +# Adds to CPPFLAGS and LIBS as necessary to compile and link with LIBNAME. +AC_DEFUN([MTN_3RDPARTY_LIB], +[AC_REQUIRE([MTN_FULL_PKG_CONFIG_PATH]) +AC_REQUIRE([AC_PROG_EGREP]) +AC_REQUIRE([AC_PROG_AWK]) + +# Determine the bundled version of $1. +dnl The quotation marks in the middle of AC_INIT and m4_define ensure +dnl that they will neither expand nor trip up the unexpanded-macro check. +_libname=$1 +dnl pcre and botan are special +m4_if($1, [pcre], +[eval `sed -ne 's/^m4''_define(pcre_\(major\|minor\|prerelease\), \@<:@\(.*\)\@:>@)$/_\1="\2"/p' ${srcdir}/../pcre/configure.ac` +_version=${_major}.${_minor}${_prerelease}], +[m4_if($1, [botan], +[eval `sed -ne 's/^my \$\(\MAJOR\|MINOR\|PATCH\)_VERSION = \(.*\);/_\1=\2/p' ${srcdir}/../botan/configure.pl` +if test x${_PATCH} = x; then _PATCH=0; fi +_version=${_MAJOR}.${_MINOR}.${_PATCH}], +[_version=`grep AC''_INIT ${srcdir}/../$_libname/configure.ac | cut -d, -f2`])]) +_notfound=true + +# Try a "naive" pkg-config operation first. This also ensures that the +# ARG_VARs for the desired library are sane. +PKG_CHECK_MODULES([$1], [$1 >= $_version], + [_notfound=false + CPPFLAGS="$CPPFLAGS $[]$1[]_CFLAGS" + LIBS="$LIBS $[]$1[]_LIBS"], + [:]) + +# Second, try looking for alternative names known to pkg-config for +# the library. +if $_notfound; then + _save_IFS="$IFS" + IFS=":" + set fnord $FULL_PKG_CONFIG_PATH + shift + IFS="$_save_IFS" + + for pkgcfgdir; do + echo $pkgcfgdir/*${_libname}*.pc + done | tr ' ' "$as_nl" | + $EGREP '/(lib)?'${_libname}'(-?@<:@0-9.@:>@+)?\.pc$' > conftest.candpc + while read f; do + c=`AS_BASENAME([$f])` + c=`expr X"$c" : 'X\(.*\)\.pc'` + AC_MSG_NOTICE([trying $c]) + PKG_CHECK_MODULES([$1], [$c >= $_version], + [CPPFLAGS="$CPPFLAGS $[$1]_CFLAGS" + LIBS="$LIBS $[$1]_LIBS" + _notfound=false + break], + [:]) + done < conftest.candpc +fi + +# If that didn't find anything usable, try -config binaries. +if $_notfound; then + _save_IFS="$IFS" + IFS=":" + set fnord $PATH + shift + IFS="$_save_IFS" + + for pathdir; do + echo $pathdir/*${_libname}*-config + done | tr ' ' "$as_nl" | + $EGREP '/(lib)?'${_libname}'(-?@<:@0-9.@:>@+)?-config$' > conftest.candcfg + while read c; do + n=`AS_BASENAME([$c])` + AC_MSG_CHECKING([for $1 using $n]) + if _cvers=`$c --version 2>&AS_MESSAGE_LOG_FD` && + _ccflg=`$c --cflags 2>&AS_MESSAGE_LOG_FD` && + _clibs=`$c --libs 2>&AS_MESSAGE_LOG_FD` + then + # Accept if $_cvers >= $_version. + _goodvers=`MTN_VERSION_AT_LEAST([$_version], [$_cvers])` + case $_goodvers in + true) + _notfound=false + CPPFLAGS="$CPPFLAGS $_ccflg" + LIBS="$LIBS $_clibs" + AC_MSG_RESULT([yes]) + break ;; + false) + AC_MSG_RESULT([too old, $_cvers]) + continue ;; + ERROR) + AC_MSG_ERROR([internal error in MTN_VERSION_[]AT_LEAST]) ;; + esac + else + AC_MSG_RESULT([no]) + continue + fi + done < conftest.candcfg + + if $_notfound; then + AC_MSG_ERROR([A version of $_libname >= $_version is required]) + fi +fi +rm -f conftest.candcfg conftest.candpc +]) + +# The above concerns mean we cannot use a single PKG_CHECK_MODULES +# invocation to probe for everything, and that in turn means we have +# to do our removal of redundant -I and -L switches from the eventual +# Makefile variables that are set. + +AC_DEFUN([MTN_REMOVE_REDUNDANT_LIB_SWITCHES], +[# Remove redundant -I and -L switches from CPPFLAGS and LIBS respectively. +# CPPFLAGS is easy, because we can assume that all duplicates are redundant. +new_CPPFLAGS=" " +for s in $CPPFLAGS; do + case "$new_CPPFLAGS" in + *" $s "*) ;; + *) new_CPPFLAGS="${new_CPPFLAGS}${s} " + esac +done +CPPFLAGS="$new_CPPFLAGS" + +# LIBS is a little more complicated. Only duplicate -L switches are +# redundant; all other switches (notably -l and -Wl,thing) are not +# necessarily redundant if duplicated. Order of non-L switches is +# significant, but, fortunately, it is safe to sort all -L switches to +# the beginning. +new_LIBS_L=" " +new_LIBS_rest=" " +for s in $LIBS; do + case $s in + -L*) + case "$new_LIBS_L" in + *" $s "*) ;; + *) new_LIBS_L="${new_LIBS_L}${s} " ;; + esac ;; + *) + new_LIBS_rest="${new_LIBS_rest}${s} " ;; + esac +done +LIBS="${new_LIBS_L}${new_LIBS_rest}" +AC_MSG_NOTICE([using CPPFLAGS: $CPPFLAGS]) +AC_MSG_NOTICE([using LIBS: $LIBS]) +]) ============================================================ --- Makefile.in ae54acc8e7695a62239ff945848163d6a1d9cd84 +++ Makefile.in ec6ab4fd18e8e6dead60ee3d3e046dc5919e899a @@ -113,9 +113,7 @@ monotone/Makefile: $(srcdir)/monotone/co monotone/Makefile: $(srcdir)/monotone/configure $(srcdir)/monotone/Makefile.in \ $(LIBSTAMPS) - cd monotone && $(subsrcdir)/monotone/configure $(CONFIGARGS) \ - CPPFLAGS="-I$(blddir)/libinst/include" \ - LDFLAGS="-L$(blddir)/lib" + cd monotone && $(subsrcdir)/monotone/configure $(CONFIGARGS) $(LIBSTAMPS): libinst/%-stamp: %/Makefile $(MAKE) -C $* install ============================================================ --- autogen.sh 1ed844478cc758f1c43c79a8d020610445d3fd0e +++ autogen.sh 809e9c6bc73efb54647b63f354f938ebd87b5abc @@ -19,7 +19,7 @@ autoreconf -i "$@" (cd monotone && exec autoreconf -i "$@") # Library subdirs in alphabetical order. -(cd idna && exec autoreconf -i "$@") +(cd idn && exec autoreconf -i "$@") (cd lua && exec autoreconf -i "$@") (cd netxx && exec autoreconf -i "$@") (cd pcre && exec autoreconf -i "$@") ============================================================ --- configure.ac a7a508ca8f53f63f6985ca3545bfae070f8270d1 +++ configure.ac 4ade488d3ec2329e7b8352630e4f165817f2ac71 @@ -27,7 +27,7 @@ AC_SUBST(CONFIGARGS) AC_SUBST(CONFIGARGS) # --with-system-foo support goes here -LIBRARIES="botan idna lua netxx pcre sqlite" +LIBRARIES="botan idn lua netxx pcre sqlite" AC_SUBST(LIBRARIES) # A bunch of Makefile rules need to know whether or not to prepend "../" ============================================================ --- lua/configure.ac 6e9c0ee0de938fc3a20845355836842396f6616d +++ lua/configure.ac 33a3c316c18f054a46cffe3e9e5fefdd18272edc @@ -12,7 +12,7 @@ # This file will be replaced by the actual third-party library # configuration script for all directories where that is practical. # (It may not be practical for dead-upstream or heavily modified -# third-party libraries, e.g. netxx and idna.) It makes no attempt to +# third-party libraries, e.g. netxx and idn.) It makes no attempt to # do anything beyond the bare minimum, just like the associated # Makefile.am. ============================================================ --- monotone/configure.ac d017750e6e09c58413f406d14ac8a879dc8417bb +++ monotone/configure.ac cd1e42d9f2fba6f0bd8e9e77ae5da915905a8361 @@ -85,14 +85,14 @@ fi # 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) +MTN_3RDPARTY_LIB(botan) +MTN_3RDPARTY_LIB(idn) +MTN_3RDPARTY_LIB(lua) +MTN_3RDPARTY_LIB(netxx) +MTN_3RDPARTY_LIB(pcre) +MTN_3RDPARTY_LIB(sqlite) -dnl MTN_REMOVE_REDUNDANT_LIB_SWITCHES +MTN_REMOVE_REDUNDANT_LIB_SWITCHES # Checks for header files. ============================================================ --- netxx/configure.ac b936d44a865e3b18a58cb698d63b231b140af9a1 +++ netxx/configure.ac 18be9d93d1c4d6a637d3439fe2846ca42140cd24 @@ -12,7 +12,7 @@ # This file will be replaced by the actual third-party library # configuration script for all directories where that is practical. # (It may not be practical for dead-upstream or heavily modified -# third-party libraries, e.g. netxx and idna.) It makes no attempt to +# third-party libraries, e.g. netxx and idn.) It makes no attempt to # do anything beyond the bare minimum, just like the associated # Makefile.am. ============================================================ --- sqlite/Makefile.am 446b91c4648a05606861395c9e324ab31375506c +++ sqlite/Makefile.am 96ac28a5b8228061eeb0d1bbef101fbf428fa634 @@ -1,6 +1,6 @@ -lib_LIBRARIES = libsqlite.a +lib_LIBRARIES = libsqlite3.a include_HEADERS = sqlite3.h sqlite3ext.h -libsqlite_a_SOURCES = \ +libsqlite3_a_SOURCES = \ alter.c analyze.c attach.c auth.c btree.c btree.h btreeInt.h \ build.c callback.c complete.c date.c delete.c expr.c func.c \ hash.c hash.h insert.c keywordhash.h legacy.c loadext.c main.c \