author | Michael Krelin <hacker@klever.net> | 2005-02-13 22:04:58 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-02-13 22:04:58 (UTC) |
commit | 5f46976a264df39b847e3095b5babb400ab2a3e7 (patch) (side-by-side diff) | |
tree | 059b3a6031dd2f375339a27a4de25af1686b7124 | |
parent | 9aa669090e978dce5e1f4d1ca9d23a4d92208518 (diff) | |
download | sitecing-5f46976a264df39b847e3095b5babb400ab2a3e7.zip sitecing-5f46976a264df39b847e3095b5babb400ab2a3e7.tar.gz sitecing-5f46976a264df39b847e3095b5babb400ab2a3e7.tar.bz2 |
portability improvements
-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 AC_PROG_CXX AC_PROG_CC AM_PROG_LEX AC_PROG_LIBTOOL AC_HEADER_STDC AC_CHECK_HEADERS([stdlib.h unistd.h]) AC_C_CONST AC_FUNC_MALLOC AC_FUNC_REALLOC AC_WITH_PKGCONFIG PKG_CHECK_MODULES([KINGATE],[kingate],,[ AC_MSG_ERROR([no kingate library found, get it at http://kin.klever.net/kingate/]) ]) HAVE_FCGI=false HAVE_PLAINCGI=false PKG_CHECK_MODULES([KINGATE_FCGI],[kingate-fcgi],[ HAVE_FCGI=true ],[ AC_MSG_NOTICE([no fastcgi support in kingate library]) ]) PKG_CHECK_MODULES([KINGATE_PLAINCGI],[kingate-plaincgi],[ HAVE_PLAINCGI=true ],[ AC_MSG_NOTICE([no plaincgi support in kingate library]) ]) if ! (${HAVE_FCGI} || ${HAVE_PLAINCGI}) ; then AC_MSG_ERROR([not a single CGI interface supported in kingate]) fi AM_CONDITIONAL([HAVE_FCGI],[${HAVE_FCGI}]) AM_CONDITIONAL([HAVE_PLAINCGI],[${HAVE_PLAINCGI}]) PKG_CHECK_MODULES([DOTCONF],[dotconf],,[ AC_MSG_ERROR([no dotconf library found]) ]) AC_WITH_PCRE([ AC_WITH_PCREPP(,[ AC_MSG_ERROR([no pcre++ library found]) ]) ],[ AC_MSG_ERROR([no pcre library found]) ]) +AC_CHECK_FUNC([dlopen],,[ AC_CHECK_LIB([dl],[dlopen],,[ AC_MSG_ERROR([no dlopen library found]) ]) +]) AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) WANT_DOXYGEN="yes" AC_ARG_ENABLE([doxygen], AC_HELP_STRING([--disable-doxygen],[do not generate documentation]), [ test "${enableval}" = "no" && WANT_DOXYGEN="no" ] ) if test "${WANT_DOXYGEN}" = "yes" ; then AC_WITH_DOXYGEN AC_WITH_DOT else AM_CONDITIONAL([HAVE_DOXYGEN],[false]) AM_CONDITIONAL([HAVE_DOT],[false]) fi AC_CONFIG_FILES([ Makefile Doxyfile sitecing.pc include/Makefile lib/Makefile share/Makefile src/Makefile components/Makefile ]) 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 { r.erase(0,1); }else{ rv = normalize_path((opts&origin_is_file)?dir_name(origin):origin,restrict_dotdot|strip_trailing_slash); } } string::size_type lsl = rv.rfind('/'); for(string::size_type sl=r.find('/');sl!=string::npos;sl=r.find('/')) { assert(sl!=0); if(sl==1 && r[0]=='.') { // it's a "./" r.erase(0,2); }else if(sl==2 && r[0]=='.' && r[1]=='.') { // we have a "../" if(lsl==string::npos) { if(rv.empty() && (opts&fail_beyond_root)) throw utility_beyond_root(CODEPOINT,"went beyond root while combining path"); rv.clear(); }else{ rv.erase(lsl); lsl = rv.rfind('/'); } r.erase(0,3); }else{ // we have a "something/" lsl = rv.length(); rv += '/'; rv += r.substr(0,sl); r.erase(0,sl+1); } } if(r.empty()) return rv+'/'; if(r.length()==2 && r[0]=='.' && r[0]=='.') { if(lsl==string::npos) { if(rv.empty() & (opts&fail_beyond_root)) throw utility_beyond_root(CODEPOINT,"went beyond root while combining path"); return "/"; }else{ rv.erase(lsl+1); return rv; } } rv += '/'; rv += r; return rv; } void auto_chdir::pushdir(const string& td,bool ap) { - char *tmp = get_current_dir_name(); + /* TODO: make use of fchdir(2) instead */ + char *tmp = getcwd(0,0); assert(tmp); saved_pwd = tmp; free(tmp); autopop=ap; if(chdir(td.c_str())) throw konforka::exception(CODEPOINT,"failed to chdir()"); } void auto_chdir::popdir() { autopop=false; if(chdir(saved_pwd.c_str())) throw konforka::exception(CODEPOINT,"failed to chdir()"); // XXX: or should it be thrown? after all we call it from destructor... } } |