Seeing as there is no glib-standard way to parse URIs, an external library is needed. This commit introduces another program in compat/ and a stanza in ./configure to test if uriparser is there. Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com> --- Makefile.local | 2 +- compat/have_uriparser.c | 17 +++++++++++++++++ configure | 23 ++++++++++++++++++++--- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 compat/have_uriparser.c diff --git a/Makefile.local b/Makefile.local index a890df2..084f44e 100644 --- a/Makefile.local +++ b/Makefile.local @@ -41,7 +41,7 @@ PV_FILE=bindings/python/notmuch/version.py # Smash together user's values with our extra values FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags) FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags) -FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Lutil -lutil -Llib -lnotmuch $(AS_NEEDED_LDFLAGS) $(GMIME_LDFLAGS) $(TALLOC_LDFLAGS) +FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Lutil -lutil -Llib -lnotmuch $(AS_NEEDED_LDFLAGS) $(GMIME_LDFLAGS) $(TALLOC_LDFLAGS) $(URIPARSER_LDFLAGS) FINAL_NOTMUCH_LINKER = CC ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1) FINAL_NOTMUCH_LDFLAGS += $(CONFIGURE_LDFLAGS) diff --git a/compat/have_uriparser.c b/compat/have_uriparser.c new file mode 100644 index 0000000..d79e51d --- /dev/null +++ b/compat/have_uriparser.c @@ -0,0 +1,17 @@ +#include <uriparser/Uri.h> + +int +main (int argc, char *argv[]) +{ + UriParserStateA state; + UriUriA uri; + char *uriS = NULL; + + state.uri = &uri; + if (uriParseUriA (&state, uriS) != URI_SUCCESS) { + /* Failure */ + uriFreeUriMembersA (&uri); + } + + return 0; +} diff --git a/configure b/configure index 3fad424..80aa13c 100755 --- a/configure +++ b/configure @@ -313,6 +313,19 @@ else errors=$((errors + 1)) fi +printf "Checking for uriparser... " +if ${CC} -o compat/have_uriparser "$srcdir"/compat/have_uriparser.c -luriparser > /dev/null 2>&1 +then + printf "Yes.\n" + uriparser_ldflags="-luriparser" + have_uriparser=1 +else + printf "No.\n" + have_uriparser=0 + errors=$((errors + 1)) +fi +rm -f compat/have_uriparser + printf "Checking for valgrind development files... " if pkg-config --exists valgrind; then printf "Yes.\n" @@ -431,11 +444,11 @@ case a simple command will install everything you need. For example: On Debian and similar systems: - sudo apt-get install libxapian-dev libgmime-2.6-dev libtalloc-dev + sudo apt-get install libxapian-dev libgmime-2.6-dev libtalloc-dev liburiparser-dev Or on Fedora and similar systems: - sudo yum install xapian-core-devel gmime-devel libtalloc-devel + sudo yum install xapian-core-devel gmime-devel libtalloc-devel uriparser-devel On other systems, similar commands can be used, but the details of the package names may be different. @@ -669,6 +682,9 @@ GMIME_LDFLAGS = ${gmime_ldflags} TALLOC_CFLAGS = ${talloc_cflags} TALLOC_LDFLAGS = ${talloc_ldflags} +# Flags needed to link against uriparser +URIPARSER_LDFLAGS = ${uriparser_ldflags} + # Flags needed to have linker set rpath attribute RPATH_LDFLAGS = ${rpath_ldflags} @@ -698,5 +714,6 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\ \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\ -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) -CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS) +CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS) \\ + \$(URIPARSER_LDFLAGS) EOF -- 1.7.9.5