summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2008-06-25 21:24:53 (UTC)
committer Michael Krelin <hacker@klever.net>2008-06-25 21:24:53 (UTC)
commit2744ea9808c3a6c50f8be78a9a71f6d3b2ba7e00 (patch) (unidiff)
treea9c124efee2b4edbeaeb646f1b94928bdc4e8c4c
parent04aac0e097992df01e17fbbb62a5a7d9682bcea9 (diff)
downloadlibopkele-2744ea9808c3a6c50f8be78a9a71f6d3b2ba7e00.zip
libopkele-2744ea9808c3a6c50f8be78a9a71f6d3b2ba7e00.tar.gz
libopkele-2744ea9808c3a6c50f8be78a9a71f6d3b2ba7e00.tar.bz2
improved detection of htmltidy for debian and co.
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--configure.ac5
-rw-r--r--include/opkele/tidy.h11
-rw-r--r--lib/discovery.cc3
3 files changed, 14 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 0aa1272..a66e53d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,35 +140,36 @@ AC_CHECK_HEADER([expat.h],[
140 AC_CHECK_LIB([expat],[XML_ParserCreate],[ 140 AC_CHECK_LIB([expat],[XML_ParserCreate],[
141 EXPAT_LIBS=-lexpat 141 EXPAT_LIBS=-lexpat
142 EXPAT_CFLAGS= 142 EXPAT_CFLAGS=
143 AC_SUBST([EXPAT_LIBS]) 143 AC_SUBST([EXPAT_LIBS])
144 AC_SUBST([EXPAT_CFLAGS]) 144 AC_SUBST([EXPAT_CFLAGS])
145 ],[ 145 ],[
146 AC_MSG_ERROR([no required expat library. get one from http://expat.sourceforge.net/]) 146 AC_MSG_ERROR([no required expat library. get one from http://expat.sourceforge.net/])
147 ]) 147 ])
148],[ 148],[
149 AC_MSG_ERROR([no required expat library. get one from http://expat.sourceforge.net/]) 149 AC_MSG_ERROR([no required expat library. get one from http://expat.sourceforge.net/])
150]) 150])
151 151
152AC_CHECK_HEADER([tidy.h],[ 152AC_CHECK_HEADERS([tidy.h tidy/tidy.h],[
153 AC_CHECK_LIB([tidy],[tidyParseBuffer],[ 153 AC_CHECK_LIB([tidy],[tidyParseBuffer],[
154 TIDY_LIBS=-ltidy 154 TIDY_LIBS=-ltidy
155 TIDY_CFLAGS= 155 TIDY_CFLAGS=
156 AC_SUBST([TIDY_LIBS]) 156 AC_SUBST([TIDY_LIBS])
157 AC_SUBST([TIDY_CFLAGS]) 157 AC_SUBST([TIDY_CFLAGS])
158 ],[ 158 ],[
159 AC_MSG_ERROR([no required htmltidy library found. get one from http://tidy.sourceforge.net/]) 159 AC_MSG_ERROR([no required htmltidy library found. get one from http://tidy.sourceforge.net/])
160 ]) 160 ])
161],[ 161],[
162 AC_MSG_ERROR([no required htmltidy library found. get one from http://tidy.sourceforge.net/]) 162 test "$ac_header" = "tidy/tidy.h" \
163 && AC_MSG_ERROR([no required htmltidy library found. get one from http://tidy.sourceforge.net/])
163]) 164])
164 165
165if test -n "$PCRE_LIBS" -a -n "$PCRE_CFLAGS" ; then 166if test -n "$PCRE_LIBS" -a -n "$PCRE_CFLAGS" ; then
166 AC_SUBST([PCRE_CFLAGS]) 167 AC_SUBST([PCRE_CFLAGS])
167 AC_SUBST([PCRE_LIBS]) 168 AC_SUBST([PCRE_LIBS])
168 : 169 :
169else 170else
170 PKG_CHECK_MODULES([PCRE],[libpcre],,[ 171 PKG_CHECK_MODULES([PCRE],[libpcre],,[
171 AC_MSG_ERROR([no libpcre found, go get it at http://www.pcre.org/]) 172 AC_MSG_ERROR([no libpcre found, go get it at http://www.pcre.org/])
172 ]) 173 ])
173fi 174fi
174 175
diff --git a/include/opkele/tidy.h b/include/opkele/tidy.h
index 888e7d4..059656d 100644
--- a/include/opkele/tidy.h
+++ b/include/opkele/tidy.h
@@ -1,18 +1,25 @@
1#ifndef __OPKELE_TIDY_H 1#ifndef __OPKELE_TIDY_H
2#define __OPKELE_TIDY_H 2#define __OPKELE_TIDY_H
3 3
4#include <cassert> 4#include <cassert>
5#include <tidy.h> 5#ifdef HAVE_TIDY_H
6#include <buffio.h> 6# include <tidy.h>
7# include <buffio.h>
8#elif HAVE_TIDY_TIDY_H
9# include <tidy/tidy.h>
10# include <tidy/buffio.h>
11#else
12# error "Don't know where to look for htmltidy headers"
13#endif
7 14
8namespace opkele { 15namespace opkele {
9 namespace util { 16 namespace util {
10 17
11 class tidy_buf_t { 18 class tidy_buf_t {
12 public: 19 public:
13 TidyBuffer _x; 20 TidyBuffer _x;
14 21
15 tidy_buf_t() { tidyBufInit(&_x); } 22 tidy_buf_t() { tidyBufInit(&_x); }
16 virtual ~tidy_buf_t() throw() { 23 virtual ~tidy_buf_t() throw() {
17 tidyBufFree(&_x); } 24 tidyBufFree(&_x); }
18 25
diff --git a/lib/discovery.cc b/lib/discovery.cc
index 3b90977..d1989ec 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -1,25 +1,26 @@
1#include <list> 1#include <list>
2#include <opkele/curl.h> 2#include <opkele/curl.h>
3#include <opkele/expat.h> 3#include <opkele/expat.h>
4#include <opkele/uris.h> 4#include <opkele/uris.h>
5#include <opkele/discovery.h> 5#include <opkele/discovery.h>
6#include <opkele/exception.h> 6#include <opkele/exception.h>
7#include <opkele/util.h> 7#include <opkele/util.h>
8#include <opkele/tidy.h>
9#include <opkele/data.h> 8#include <opkele/data.h>
10#include <opkele/debug.h> 9#include <opkele/debug.h>
11 10
12#include "config.h" 11#include "config.h"
13 12
13#include <opkele/tidy.h>
14
14#define XRDS_HEADER "X-XRDS-Location" 15#define XRDS_HEADER "X-XRDS-Location"
15#define CT_HEADER "Content-Type" 16#define CT_HEADER "Content-Type"
16 17
17namespace opkele { 18namespace opkele {
18 using std::list; 19 using std::list;
19 using xrd::XRD_t; 20 using xrd::XRD_t;
20 using xrd::service_t; 21 using xrd::service_t;
21 22
22 /* TODO: the whole discovery thing needs cleanup and optimization due to 23 /* TODO: the whole discovery thing needs cleanup and optimization due to
23 * many changes of concept. */ 24 * many changes of concept. */
24 25
25 static const size_t max_html = 16384; 26 static const size_t max_html = 16384;