-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/plaincgi.cc | 5 |
3 files changed, 9 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 5ae7b27..b3141f1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,67 +1,70 @@ AC_INIT([kingate], [0.0.1], [kingate-bugs@klever.net]) AC_CONFIG_SRCDIR([include/kingate/cgi_gateway.h]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([dist-bzip2]) AC_PROG_INSTALL AC_PROG_AWK AC_PROG_CXX AC_PROG_CC AC_PROG_LIBTOOL AC_HEADER_STDC AC_CHECK_HEADERS([sys/types.h sys/stat.h]) +AC_CHECK_DECLS([environ],,,[ + #include <unistd.h> +]) HAVE_FCGI=false AC_LANG_PUSH(C++) AC_CHECK_HEADERS([fcgio.h],[ AC_CHECK_LIB(fcgi,FCGX_Init,[ LIBS="-lfcgi ${LIBS}" AC_CHECK_LIB([fcgi++],[main],[ LIBS="-lfcgi++ ${LIBS}" HAVE_FCGI=true ]) ]) ]) AC_LANG_POP(C++) if ! ${HAVE_FCGI} ; then AC_MSG_NOTICE([no FastCGI development kit found. It is highly recommnded that you get one. Meanwhile we will proceed without FastCGI support]) fi AM_CONDITIONAL([HAVE_FCGI],[${HAVE_FCGI}]) AC_C_CONST AC_FUNC_MALLOC AC_FUNC_REALLOC AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) AC_WITH_PKGCONFIG PKG_CHECK_MODULES([KONFORKA],[konforka],,[ AC_MSG_ERROR([no konforka library found. get one from http://kin.klever.net/konforka/]) ]) 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 kingate.pc kingate-fcgi.pc kingate-plaincgi.pc Doxyfile include/Makefile src/Makefile ]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index e5c6778..d516d37 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,25 +1,25 @@ lib_LTLIBRARIES = libkingate.la libkingate-plaincgi.la if HAVE_FCGI lib_LTLIBRARIES += libkingate-fcgi.la endif -INCLUDES = -I${top_srcdir}/include +INCLUDES = -I${top_srcdir}/include -I${top_srcdir} AM_CXXFLAGS = ${KONFORKA_CFLAGS} LDADD = ${KONFORKA_LIBS} libkingate_la_SOURCES = \ cgi_gateway.cc \ cgi_interface.cc \ util.cc libkingate_la_LDFLAGS = -version-info 1:0:0 libkingate_fcgi_la_SOURCES = \ fastcgi.cc libkingate_fcgi_la_LDFLAGS = -version-info 1:0:0 libkingate_plaincgi_la_SOURCES = \ plaincgi.cc libkingate_plaincgi_la_LDFLAGS = -version-info 1:0:0 EXTRA_DIST = ${libkingate_fcgi_la_SOURCES} diff --git a/src/plaincgi.cc b/src/plaincgi.cc index 6934748..1cb7dc6 100644 --- a/src/plaincgi.cc +++ b/src/plaincgi.cc @@ -1,27 +1,32 @@ #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include "kingate/plaincgi.h" #include "kingate/exception.h" +#include "config.h" + +#if !HAVE_DECL_ENVIRON +extern char **environ; +#endif /* HAVE_DECL_ENVIRON */ namespace kingate { plaincgi_interface::plaincgi_interface() { for(char **p = environ; *p; p++) { const char *e = strchr(*p,'='); if(!e){ // XXX: check if we have it already? metavars[*p] = string(0); }else{ int l = e-*p; e++; // XXX: check if we have it already? metavars[string(*p,l)]=e; } } } plaincgi_interface::~plaincgi_interface() { cout.flush(); cerr.flush(); } } |