Implemented support for EOF operation on FCGI::Stream handle
[catagits/fcgi2.git] / configure.in
index 14cea9b..211af56 100755 (executable)
-dnl     $Id: configure.in,v 1.5 2001/09/01 00:57:59 robs Exp $
+dnl     $Id: configure.in,v 1.27 2003/06/22 02:15:10 robs Exp $
 dnl
 dnl     This file is an input file used by the GNU "autoconf" program to
 dnl     generate the file "configure", which is run during the build
 dnl     to configure the system for the local environment.
 
-# This file and the script it generates is used by both the devkit
-# and the Perl FCGI module.  Although each has slightly different
-# requirements, this allows the build environment to maintained by one
-# file set.  The FCGI build is idendified by the presence of the
-# file FCGI.XL.  If its not found, its consider a devkit build.
-
 AC_INIT
+AM_INIT_AUTOMAKE(fcgi, 2.4.1)
 
-if test -f "FCGI.XL"; then
-       FCGI_BUILD='true'
-fi
-
-if test "$FCGI_BUILD"; then
-       AC_CONFIG_HEADER([fcgi_config.h])
-else
-       AC_CONFIG_HEADER([include/fcgi_config.h])
-fi
+AM_CONFIG_HEADER(fcgi_config.h)
 
 AC_PROG_CC
 AC_PROG_CPP 
 AC_PROG_INSTALL 
-AC_PROG_RANLIB
-AC_CHECK_TOOL([AR], [ar], [ar])
-
-AC_CHECK_LIB([nsl],       [main]) ac_cv_lib_nsl=ac_cv_lib_nsl_main
-AC_CHECK_LIB([resolv],    [main]) ac_cv_lib_resolv=ac_cv_lib_resolv_main
-AC_CHECK_LIB([socket],           [main]) ac_cv_lib_socket=ac_cv_lib_socket_main
-AC_CHECK_LIB([dnet_stub], [main]) ac_cv_lib_dnet_stub=ac_cv_lib_dnet_stub_main
-AC_CHECK_LIB([ieee],     [main]) ac_cv_lib_ieee=ac_cv_lib_ieee_main
-
-AC_CHECK_LIB([pthread],          [main], 
-       [AC_DEFINE([HAVE_LIBPTHREAD], [1],
-                          [Define if you have the pthread library])
-        AC_SUBST([HAVE_LIBPTHREAD])]) 
-ac_cv_lib_pthread=ac_cv_lib_pthread_main
-
-AC_CHECK_TYPE([ssize_t], [int]) 
-
-AC_MSG_CHECKING([for sun_len in sys/un.h])
-AC_EGREP_HEADER([sun_len], [sys/un.h],
-    [AC_MSG_RESULT([yes])
-     AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1],
-                  [Define if sockaddr_un in sys/un.h contains a sun_len component])],
-    AC_MSG_RESULT([no]))
+AC_PROG_LIBTOOL
+
+AC_PROG_CXX
+
+AC_LANG([C++])
+
+dnl autoconf defaults CXX to 'g++', so its unclear whether it exists/works
+AC_MSG_CHECKING([whether $CXX works])
+AC_TRY_COMPILE([#include <iostream>], 
+               [std::cout << "ok";], 
+               [AC_MSG_RESULT(yes)
+                LIBFCGIXX=libfcgi++.la
+                ECHO_CPP=echo-cpp${EXEEXT}
+                AC_MSG_CHECKING([whether cin has a streambuf assignment operator])
+                AC_TRY_COMPILE([#include <iostream>], 
+                               [cin = static_cast<streambuf *>(0);], 
+                               [AC_MSG_RESULT(yes)
+                                AC_DEFINE([HAVE_IOSTREAM_WITHASSIGN_STREAMBUF],  [1], 
+                                          [Define if cin/cout/cerr has a streambuf assignment operator])],
+                               [AC_MSG_RESULT(no)]) 
+                AC_MSG_CHECKING([whether char_type is defined in the context of streambuf])
+                AC_TRY_COMPILE([#include <iostream>],
+                               [class fcgi_streambuf : public std::streambuf { char_type ct; }],
+                               [AC_MSG_RESULT(yes)
+                                AC_DEFINE([HAVE_STREAMBUF_CHAR_TYPE], [1], 
+                                          [Define if char_type is defined in the context of streambuf])],
+                               [AC_MSG_RESULT(no)])],
+               [AC_MSG_RESULT(no)])
+AC_SUBST(LIBFCGIXX)
+AC_SUBST(ECHO_CPP)
+
+AC_LANG([C])
+
+AC_CHECK_LIB([nsl],       [gethostbyname])
+AC_CHECK_LIB([socket],    [socket]) 
+
+ACX_PTHREAD([THREADED=threaded${EXEEXT}])
+AC_SUBST([THREADED])
+
+FCGI_COMMON_CHECKS
 
 AC_REPLACE_FUNCS([strerror])
 
-AC_MSG_CHECKING([for fpos_t in stdio.h])
-AC_EGREP_HEADER([fpos_t], [stdio.h],
-    [AC_MSG_RESULT([yes])
-     AC_DEFINE([HAVE_FPOS], [1], [Define if the fpos_t typedef is in stdio.h])],
-    AC_MSG_RESULT([no]))
-
-AC_CHECK_HEADERS([sys/socket.h netdb.h netinet/in.h arpa/inet.h sys/time.h limits.h sys/param.h unistd.h])
-
-AC_MSG_CHECKING([for a fileno() prototype in stdio.h])
-AC_EGREP_HEADER([fileno], [stdio.h], 
-       [AC_MSG_RESULT([yes]) 
-        AC_DEFINE([HAVE_FILENO_PROTO], [1], 
-                      [Define if there's a fileno() prototype in stdio.h])],
-       AC_MSG_RESULT([no]))
-
-if test "$HAVE_SYS_SOCKET_H"; then
-    AC_MSG_CHECKING([for socklen_t in sys/socket.h])
-    AC_EGREP_HEADER([socklen_t], [sys/socket.h],
-        [AC_MSG_RESULT([yes])
-         AC_DEFINE([HAVE_SOCKLEN], [1],
-                          [Define if the socklen_t typedef is in sys/socket.h])],
-       AC_MSG_RESULT([no]))
-fi
-
-#--------------------------------------------------------------------
-#  Do we need cross-process locking on this platform?
-#--------------------------------------------------------------------
-AC_MSG_CHECKING([whether cross-process locking is required by accept()])
-case "`uname -sr`" in
-    IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0)       
-               AC_MSG_RESULT([yes])
-               AC_DEFINE([USE_LOCKING], [1], 
-                                 [Define if cross-process locking is required by accept()])
-       ;;
-    *)
-               AC_MSG_RESULT([no])
-           ;;
-esac
-
-#--------------------------------------------------------------------
-#  Does va_arg(arg, long double) crash the compiler?
-#  hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler)
-#--------------------------------------------------------------------
-AC_MSG_CHECKING([whether va_arg(arg, long double) crashes the compiler])
-AC_TRY_COMPILE([#include <stdarg.h>],
-   [long double lDblArg; va_list arg; lDblArg = va_arg(arg, long double);],
-   AC_MSG_RESULT([no]),
-   [AC_MSG_RESULT([yes])
-    AC_DEFINE([HAVE_VA_ARG_LONG_DOUBLE_BUG], [1],
-                         [Define if va_arg(arg, long double) crashes the compiler])])
-
-AC_C_CONST 
 AC_C_INLINE
 
 #--------------------------------------------------------------------
@@ -114,24 +66,12 @@ AC_C_INLINE
 SYSTEM=unix
 AC_SUBST([SYSTEM])
 
-L=a
-AC_SUBST([L])
-
-if test "$GCC"; then
-       CCDEFS="$CCDEFS -Wall -Wmissing-prototypes"
-fi
+AC_PROG_CC_WARNINGS
 
-AC_SUBST([CCDEFS])
-
-AC_OBJEXT
-AC_SUBST([EXEEXT]) 
-
-if test -z "$FCGI_BUILD"; then
-       AC_CONFIG_FILES([Makefile 
-                                        libfcgi/Makefile 
-                                        cgi-fcgi/Makefile 
-                                        examples/Makefile])
-fi
+AC_CONFIG_FILES([Makefile
+                 cgi-fcgi/Makefile
+                 include/Makefile
+                 libfcgi/Makefile
+                 examples/Makefile])
 
 AC_OUTPUT
-