author | Michael Krelin <hacker@klever.net> | 2008-06-25 21:24:53 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-06-25 21:24:53 (UTC) |
commit | 2744ea9808c3a6c50f8be78a9a71f6d3b2ba7e00 (patch) (unidiff) | |
tree | a9c124efee2b4edbeaeb646f1b94928bdc4e8c4c | |
parent | 04aac0e097992df01e17fbbb62a5a7d9682bcea9 (diff) | |
download | libopkele-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>
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | include/opkele/tidy.h | 11 | ||||
-rw-r--r-- | lib/discovery.cc | 3 |
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 | |||
@@ -136,43 +136,44 @@ LIBCURL_CHECK_CONFIG(,,,[ | |||
136 | AC_MSG_ERROR([no required libcurl library. get one from http://curl.haxx.se/]) | 136 | AC_MSG_ERROR([no required libcurl library. get one from http://curl.haxx.se/]) |
137 | ]) | 137 | ]) |
138 | 138 | ||
139 | AC_CHECK_HEADER([expat.h],[ | 139 | 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 | ||
152 | AC_CHECK_HEADER([tidy.h],[ | 152 | AC_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 | ||
165 | if test -n "$PCRE_LIBS" -a -n "$PCRE_CFLAGS" ; then | 166 | if 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 | : |
169 | else | 170 | else |
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 | ]) |
173 | fi | 174 | fi |
174 | 175 | ||
175 | PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=true],[have_sqlite3=false]) | 176 | PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=true],[have_sqlite3=false]) |
176 | AM_CONDITIONAL([HAVE_SQLITE3],[$have_sqlite3]) | 177 | AM_CONDITIONAL([HAVE_SQLITE3],[$have_sqlite3]) |
177 | PKG_CHECK_MODULES([KINGATE],[kingate-plaincgi],[have_kingate=true],[have_kingate=false]) | 178 | PKG_CHECK_MODULES([KINGATE],[kingate-plaincgi],[have_kingate=true],[have_kingate=false]) |
178 | AM_CONDITIONAL([HAVE_KINGATE],[$have_kingate]) | 179 | AM_CONDITIONAL([HAVE_KINGATE],[$have_kingate]) |
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,22 +1,29 @@ | |||
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 | ||
8 | namespace opkele { | 15 | namespace 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 | ||
19 | inline operator const TidyBuffer&(void) const { return _x; } | 26 | inline operator const TidyBuffer&(void) const { return _x; } |
20 | inline operator TidyBuffer&(void) { return _x; } | 27 | inline operator TidyBuffer&(void) { return _x; } |
21 | 28 | ||
22 | inline operator const char*(void) const { return (const char*)_x.bp; } | 29 | inline operator const char*(void) const { return (const char*)_x.bp; } |
diff --git a/lib/discovery.cc b/lib/discovery.cc index 3b90977..d1989ec 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc | |||
@@ -1,29 +1,30 @@ | |||
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 | ||
17 | namespace opkele { | 18 | namespace 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; |
26 | 27 | ||
27 | static const struct service_type_t { | 28 | static const struct service_type_t { |
28 | const char *uri; | 29 | const char *uri; |
29 | const char *forceid; | 30 | const char *forceid; |