-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | lib/sitecing_util.cc | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 0da7658..b9e9b56 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -8,80 +8,82 @@ AC_PROG_AWK | |||
8 | AC_PROG_CXX | 8 | AC_PROG_CXX |
9 | AC_PROG_CC | 9 | AC_PROG_CC |
10 | AM_PROG_LEX | 10 | AM_PROG_LEX |
11 | AC_PROG_LIBTOOL | 11 | AC_PROG_LIBTOOL |
12 | 12 | ||
13 | AC_HEADER_STDC | 13 | AC_HEADER_STDC |
14 | AC_CHECK_HEADERS([stdlib.h unistd.h]) | 14 | AC_CHECK_HEADERS([stdlib.h unistd.h]) |
15 | 15 | ||
16 | AC_C_CONST | 16 | AC_C_CONST |
17 | 17 | ||
18 | AC_FUNC_MALLOC | 18 | AC_FUNC_MALLOC |
19 | AC_FUNC_REALLOC | 19 | AC_FUNC_REALLOC |
20 | 20 | ||
21 | AC_WITH_PKGCONFIG | 21 | AC_WITH_PKGCONFIG |
22 | 22 | ||
23 | PKG_CHECK_MODULES([KINGATE],[kingate],,[ | 23 | PKG_CHECK_MODULES([KINGATE],[kingate],,[ |
24 | AC_MSG_ERROR([no kingate library found, get it at http://kin.klever.net/kingate/]) | 24 | AC_MSG_ERROR([no kingate library found, get it at http://kin.klever.net/kingate/]) |
25 | ]) | 25 | ]) |
26 | HAVE_FCGI=false | 26 | HAVE_FCGI=false |
27 | HAVE_PLAINCGI=false | 27 | HAVE_PLAINCGI=false |
28 | PKG_CHECK_MODULES([KINGATE_FCGI],[kingate-fcgi],[ | 28 | PKG_CHECK_MODULES([KINGATE_FCGI],[kingate-fcgi],[ |
29 | HAVE_FCGI=true | 29 | HAVE_FCGI=true |
30 | ],[ | 30 | ],[ |
31 | AC_MSG_NOTICE([no fastcgi support in kingate library]) | 31 | AC_MSG_NOTICE([no fastcgi support in kingate library]) |
32 | ]) | 32 | ]) |
33 | PKG_CHECK_MODULES([KINGATE_PLAINCGI],[kingate-plaincgi],[ | 33 | PKG_CHECK_MODULES([KINGATE_PLAINCGI],[kingate-plaincgi],[ |
34 | HAVE_PLAINCGI=true | 34 | HAVE_PLAINCGI=true |
35 | ],[ | 35 | ],[ |
36 | AC_MSG_NOTICE([no plaincgi support in kingate library]) | 36 | AC_MSG_NOTICE([no plaincgi support in kingate library]) |
37 | ]) | 37 | ]) |
38 | if ! (${HAVE_FCGI} || ${HAVE_PLAINCGI}) ; then | 38 | if ! (${HAVE_FCGI} || ${HAVE_PLAINCGI}) ; then |
39 | AC_MSG_ERROR([not a single CGI interface supported in kingate]) | 39 | AC_MSG_ERROR([not a single CGI interface supported in kingate]) |
40 | fi | 40 | fi |
41 | AM_CONDITIONAL([HAVE_FCGI],[${HAVE_FCGI}]) | 41 | AM_CONDITIONAL([HAVE_FCGI],[${HAVE_FCGI}]) |
42 | AM_CONDITIONAL([HAVE_PLAINCGI],[${HAVE_PLAINCGI}]) | 42 | AM_CONDITIONAL([HAVE_PLAINCGI],[${HAVE_PLAINCGI}]) |
43 | 43 | ||
44 | PKG_CHECK_MODULES([DOTCONF],[dotconf],,[ | 44 | PKG_CHECK_MODULES([DOTCONF],[dotconf],,[ |
45 | AC_MSG_ERROR([no dotconf library found]) | 45 | AC_MSG_ERROR([no dotconf library found]) |
46 | ]) | 46 | ]) |
47 | 47 | ||
48 | AC_WITH_PCRE([ | 48 | AC_WITH_PCRE([ |
49 | AC_WITH_PCREPP(,[ | 49 | AC_WITH_PCREPP(,[ |
50 | AC_MSG_ERROR([no pcre++ library found]) | 50 | AC_MSG_ERROR([no pcre++ library found]) |
51 | ]) | 51 | ]) |
52 | ],[ | 52 | ],[ |
53 | AC_MSG_ERROR([no pcre library found]) | 53 | AC_MSG_ERROR([no pcre library found]) |
54 | ]) | 54 | ]) |
55 | 55 | ||
56 | AC_CHECK_FUNC([dlopen],,[ | ||
56 | AC_CHECK_LIB([dl],[dlopen],,[ | 57 | AC_CHECK_LIB([dl],[dlopen],,[ |
57 | AC_MSG_ERROR([no dlopen library found]) | 58 | AC_MSG_ERROR([no dlopen library found]) |
58 | ]) | 59 | ]) |
60 | ]) | ||
59 | 61 | ||
60 | AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) | 62 | AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) |
61 | 63 | ||
62 | WANT_DOXYGEN="yes" | 64 | WANT_DOXYGEN="yes" |
63 | AC_ARG_ENABLE([doxygen], | 65 | AC_ARG_ENABLE([doxygen], |
64 | AC_HELP_STRING([--disable-doxygen],[do not generate documentation]), | 66 | AC_HELP_STRING([--disable-doxygen],[do not generate documentation]), |
65 | [ | 67 | [ |
66 | test "${enableval}" = "no" && WANT_DOXYGEN="no" | 68 | test "${enableval}" = "no" && WANT_DOXYGEN="no" |
67 | ] | 69 | ] |
68 | ) | 70 | ) |
69 | if test "${WANT_DOXYGEN}" = "yes" ; then | 71 | if test "${WANT_DOXYGEN}" = "yes" ; then |
70 | AC_WITH_DOXYGEN | 72 | AC_WITH_DOXYGEN |
71 | AC_WITH_DOT | 73 | AC_WITH_DOT |
72 | else | 74 | else |
73 | AM_CONDITIONAL([HAVE_DOXYGEN],[false]) | 75 | AM_CONDITIONAL([HAVE_DOXYGEN],[false]) |
74 | AM_CONDITIONAL([HAVE_DOT],[false]) | 76 | AM_CONDITIONAL([HAVE_DOT],[false]) |
75 | fi | 77 | fi |
76 | 78 | ||
77 | AC_CONFIG_FILES([ | 79 | AC_CONFIG_FILES([ |
78 | Makefile | 80 | Makefile |
79 | Doxyfile | 81 | Doxyfile |
80 | sitecing.pc | 82 | sitecing.pc |
81 | include/Makefile | 83 | include/Makefile |
82 | lib/Makefile | 84 | lib/Makefile |
83 | share/Makefile | 85 | share/Makefile |
84 | src/Makefile | 86 | src/Makefile |
85 | components/Makefile | 87 | components/Makefile |
86 | ]) | 88 | ]) |
87 | AC_OUTPUT | 89 | AC_OUTPUT |
diff --git a/lib/sitecing_util.cc b/lib/sitecing_util.cc index 9b6c54e..5466b28 100644 --- a/lib/sitecing_util.cc +++ b/lib/sitecing_util.cc | |||
@@ -215,64 +215,65 @@ namespace sitecing { | |||
215 | r.erase(0,1); | 215 | r.erase(0,1); |
216 | }else{ | 216 | }else{ |
217 | rv = normalize_path((opts&origin_is_file)?dir_name(origin):origin,restrict_dotdot|strip_trailing_slash); | 217 | rv = normalize_path((opts&origin_is_file)?dir_name(origin):origin,restrict_dotdot|strip_trailing_slash); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | string::size_type lsl = rv.rfind('/'); | 220 | string::size_type lsl = rv.rfind('/'); |
221 | for(string::size_type sl=r.find('/');sl!=string::npos;sl=r.find('/')) { | 221 | for(string::size_type sl=r.find('/');sl!=string::npos;sl=r.find('/')) { |
222 | assert(sl!=0); | 222 | assert(sl!=0); |
223 | if(sl==1 && r[0]=='.') { | 223 | if(sl==1 && r[0]=='.') { |
224 | // it's a "./" | 224 | // it's a "./" |
225 | r.erase(0,2); | 225 | r.erase(0,2); |
226 | }else if(sl==2 && r[0]=='.' && r[1]=='.') { | 226 | }else if(sl==2 && r[0]=='.' && r[1]=='.') { |
227 | // we have a "../" | 227 | // we have a "../" |
228 | if(lsl==string::npos) { | 228 | if(lsl==string::npos) { |
229 | if(rv.empty() && (opts&fail_beyond_root)) | 229 | if(rv.empty() && (opts&fail_beyond_root)) |
230 | throw utility_beyond_root(CODEPOINT,"went beyond root while combining path"); | 230 | throw utility_beyond_root(CODEPOINT,"went beyond root while combining path"); |
231 | rv.clear(); | 231 | rv.clear(); |
232 | }else{ | 232 | }else{ |
233 | rv.erase(lsl); | 233 | rv.erase(lsl); |
234 | lsl = rv.rfind('/'); | 234 | lsl = rv.rfind('/'); |
235 | } | 235 | } |
236 | r.erase(0,3); | 236 | r.erase(0,3); |
237 | }else{ | 237 | }else{ |
238 | // we have a "something/" | 238 | // we have a "something/" |
239 | lsl = rv.length(); | 239 | lsl = rv.length(); |
240 | rv += '/'; | 240 | rv += '/'; |
241 | rv += r.substr(0,sl); | 241 | rv += r.substr(0,sl); |
242 | r.erase(0,sl+1); | 242 | r.erase(0,sl+1); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | if(r.empty()) | 245 | if(r.empty()) |
246 | return rv+'/'; | 246 | return rv+'/'; |
247 | if(r.length()==2 && r[0]=='.' && r[0]=='.') { | 247 | if(r.length()==2 && r[0]=='.' && r[0]=='.') { |
248 | if(lsl==string::npos) { | 248 | if(lsl==string::npos) { |
249 | if(rv.empty() & (opts&fail_beyond_root)) | 249 | if(rv.empty() & (opts&fail_beyond_root)) |
250 | throw utility_beyond_root(CODEPOINT,"went beyond root while combining path"); | 250 | throw utility_beyond_root(CODEPOINT,"went beyond root while combining path"); |
251 | return "/"; | 251 | return "/"; |
252 | }else{ | 252 | }else{ |
253 | rv.erase(lsl+1); | 253 | rv.erase(lsl+1); |
254 | return rv; | 254 | return rv; |
255 | } | 255 | } |
256 | } | 256 | } |
257 | rv += '/'; | 257 | rv += '/'; |
258 | rv += r; | 258 | rv += r; |
259 | return rv; | 259 | return rv; |
260 | } | 260 | } |
261 | 261 | ||
262 | void auto_chdir::pushdir(const string& td,bool ap) { | 262 | void auto_chdir::pushdir(const string& td,bool ap) { |
263 | char *tmp = get_current_dir_name(); | 263 | /* TODO: make use of fchdir(2) instead */ |
264 | char *tmp = getcwd(0,0); | ||
264 | assert(tmp); | 265 | assert(tmp); |
265 | saved_pwd = tmp; | 266 | saved_pwd = tmp; |
266 | free(tmp); | 267 | free(tmp); |
267 | autopop=ap; | 268 | autopop=ap; |
268 | if(chdir(td.c_str())) | 269 | if(chdir(td.c_str())) |
269 | throw konforka::exception(CODEPOINT,"failed to chdir()"); | 270 | throw konforka::exception(CODEPOINT,"failed to chdir()"); |
270 | } | 271 | } |
271 | void auto_chdir::popdir() { | 272 | void auto_chdir::popdir() { |
272 | autopop=false; | 273 | autopop=false; |
273 | if(chdir(saved_pwd.c_str())) | 274 | if(chdir(saved_pwd.c_str())) |
274 | throw konforka::exception(CODEPOINT,"failed to chdir()"); | 275 | throw konforka::exception(CODEPOINT,"failed to chdir()"); |
275 | // XXX: or should it be thrown? after all we call it from destructor... | 276 | // XXX: or should it be thrown? after all we call it from destructor... |
276 | } | 277 | } |
277 | 278 | ||
278 | } | 279 | } |