fix shell compatibility (bash)
[catagits/fcgi2.git] / configure.in
index 8c1a15f..ec47136 100755 (executable)
-dnl     $Id: configure.in,v 1.2 1999/08/02 15:51:05 skimo Exp $
+dnl     $Id: configure.in,v 1.18 2001/11/21 16:32:55 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.
-dnl
 
-AC_INIT(libfcgi/fcgiapp.c)
-#--------------------------------------------------------------------
-#  Perform common OMI configuration. This will include:
-#      1) Choosing compiler and associated build options.
-#      2) Checking for various common build associated programs.
-#      3) Determining the best build options for this platform.
-#      4) Checking for certain common header files.
-#      5) Checking for exports/global switch.
-#      6) Importing OMI dependencies (header files, libraries, and binaries).
-#       7) Checking for existence of various system libraries and routines.
-#--------------------------------------------------------------------
-OMI_CONFIG
+AC_INIT
+AM_INIT_AUTOMAKE(fcgi, 2.2.1)
 
-AC_CONFIG_HEADER(include/fcgi_config.h)
-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),
-   AC_MSG_RESULT(no))
+AM_CONFIG_HEADER(fcgi_config.h)
 
-#--------------------------------------------------------------------
-#  What extra libraries do we need for this platform?
-#--------------------------------------------------------------------
+AC_PROG_CC
+AC_PROG_CPP 
+AC_PROG_INSTALL 
+AC_PROG_LIBTOOL
 
-AC_CHECK_FUNCS(strerror strtol)
+AC_PROG_CXX
 
-AC_REPLACE_FUNCS(strerror strtol)
+dnl autoconf defaults CXX to 'g++', so its unclear whether it exists/works
+AC_MSG_CHECKING([whether $CXX works])
+AC_LANG_CPLUSPLUS
+AC_TRY_COMPILE([#include <iostream.h>], [istream is(NULL);], 
+               [CXX_WORKS=1]
+               [AC_MSG_RESULT(yes)], 
+               [AC_MSG_RESULT(no)])
+AC_LANG_C
 
-#--------------------------------------------------------------------
-#       Include sys/select.h if it exists and if it supplies things
-#       that appear to be useful and aren't already in sys/types.h.
-#       This appears to be true only on the RS/6000 under AIX.  Some
-#       systems like OSF/1 have a sys/select.h that's of no use, and
-#       other systems like SCO UNIX have a sys/select.h that's
-#       pernicious.  If "fd_set" isn't defined anywhere then set a
-#       special flag.
-#--------------------------------------------------------------------
+if test -n "${CXX_WORKS}"; then
+       LIBFCGIXX=libfcgi++.la
+       ECHO_CPP=echo-cpp${EXEEXT}
+fi
+AC_SUBST(LIBFCGIXX)
+AC_SUBST(ECHO_CPP)
 
-AC_MSG_CHECKING(for fd_set in in sys/types.h)
-AC_TRY_LINK([#include <sys/types.h>],
-   [fd_set readMask, writeMask;],
-   AC_MSG_RESULT(yes),
-   AC_MSG_RESULT(no)
-   AC_MSG_CHECKING(for fd_mask in in sys/select.h)
-   AC_HEADER_EGREP(fd_mask,
-      sys/select.h,
-      AC_MSG_RESULT(yes)
-      AC_DEFINE(HAVE_SYS_SELECT_H),
-      AC_MSG_RESULT(no)
-      AC_DEFINE(NO_FD_SET)))
+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_MSG_CHECKING(for fpos in stdio.h)
-AC_EGREP_HEADER(fpos_t,
-   stdio.h,
-   AC_MSG_RESULT(yes)
-   AC_DEFINE(HAVE_FPOS),
-   AC_MSG_RESULT(no))
+AC_SUBST(threaded)
+AC_CHECK_LIB([pthread],          [main], 
+       [AC_DEFINE([HAVE_LIBPTHREAD], [1],
+                          [Define if you have the pthread library])
+        AC_SUBST([HAVE_LIBPTHREAD])
+         threaded='threaded$(EXEEXT)']) 
+ac_cv_lib_pthread=ac_cv_lib_pthread_main
 
-AC_HAVE_HEADERS(windows.h)
-AC_HAVE_HEADERS(sys/socket.h, [have_sys_socket=yes])
-AC_HAVE_HEADERS(winsock.h)
-AC_HAVE_HEADERS(netdb.h)
-AC_HAVE_HEADERS(netinet/in.h)
-AC_HAVE_HEADERS(arpa/inet.h)
-AC_HAVE_HEADERS(strings.h)
-AC_HAVE_HEADERS(sys/time.h)
+FCGI_COMMON_CHECKS
 
-if test "x$have_sys_socket" = "xyes"; 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),
-       AC_MSG_RESULT(no))
-fi
+AC_REPLACE_FUNCS([strerror])
 
-#--------------------------------------------------------------------
-#  Do we need cross-process locking on this platform?
-#--------------------------------------------------------------------
-AC_MSG_CHECKING("if this machine needs cross-process locking")
-case "`uname -sr`" in
-    IRIX\ 5.*) 
-       AC_DEFINE(USE_LOCKING)
-       AC_MSG_RESULT(yes)
-    ;;
-    SunOS\ 5.*)        
-       AC_DEFINE(USE_LOCKING)
-       AC_MSG_RESULT(yes)
-    ;;
-    UNIX_System_V\ 4.0)
-       AC_DEFINE(USE_LOCKING)
-       AC_MSG_RESULT(yes)
-    ;;
-    *)
-       AC_MSG_RESULT(no)
-    ;;
-esac
+AC_C_INLINE
 
 #--------------------------------------------------------------------
-#  Does va_arg(arg, long double) crash the compiler?
-#  hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler)
+#  This is a little hokie in that it avoids including config.guess
+#  and config.sub in the distribution, but its been working so far.
+#  Windows builds don't run configure so we should be safe fixing
+#  this to 'unix' (at least for now).
 #--------------------------------------------------------------------
-AC_MSG_CHECKING(if 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_DEFINE(HAVE_VA_ARG_LONG_DOUBLE_BUG)
-   AC_MSG_RESULT(yes))
+SYSTEM=unix
+AC_SUBST([SYSTEM])
 
-#--------------------------------------------------------------------
-#  What's the target system?
-#--------------------------------------------------------------------
-case "$PLATFORM_CLASS" in
-    WINDOWS)   
-       SYSTEM="win32"
-    ;;
-    UNIX)      
-       SYSTEM="unix"
-    ;;
-esac
+if test "$GCC"; then
+       CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
+fi
 
-AC_SUBST(SYSTEM)
-AC_OUTPUT(Makefile FastCGI.mak
-         libfcgi/Makefile libfcgi/libfcgi.mak
-         cgi-fcgi/Makefile cgi-fcgi/cgi-fcgi.mak
-         examples/Makefile )
+AC_CONFIG_FILES(Makefile
+               cgi-fcgi/Makefile
+               include/Makefile
+               libfcgi/Makefile
+               examples/Makefile)
 
+AC_OUTPUT