Add
[catagits/fcgi2.git] / configure.in
1 dnl     $Id: configure.in,v 1.5 2001/09/01 00:57:59 robs Exp $
2 dnl
3 dnl     This file is an input file used by the GNU "autoconf" program to
4 dnl     generate the file "configure", which is run during the build
5 dnl     to configure the system for the local environment.
6
7 # This file and the script it generates is used by both the devkit
8 # and the Perl FCGI module.  Although each has slightly different
9 # requirements, this allows the build environment to maintained by one
10 # file set.  The FCGI build is idendified by the presence of the
11 # file FCGI.XL.  If its not found, its consider a devkit build.
12
13 AC_INIT
14
15 if test -f "FCGI.XL"; then
16         FCGI_BUILD='true'
17 fi
18
19 if test "$FCGI_BUILD"; then
20         AC_CONFIG_HEADER([fcgi_config.h])
21 else
22         AC_CONFIG_HEADER([include/fcgi_config.h])
23 fi
24
25 AC_PROG_CC
26 AC_PROG_CPP 
27 AC_PROG_INSTALL 
28 AC_PROG_RANLIB
29 AC_CHECK_TOOL([AR], [ar], [ar])
30
31 AC_CHECK_LIB([nsl],       [main]) ac_cv_lib_nsl=ac_cv_lib_nsl_main
32 AC_CHECK_LIB([resolv],    [main]) ac_cv_lib_resolv=ac_cv_lib_resolv_main
33 AC_CHECK_LIB([socket],    [main]) ac_cv_lib_socket=ac_cv_lib_socket_main
34 AC_CHECK_LIB([dnet_stub], [main]) ac_cv_lib_dnet_stub=ac_cv_lib_dnet_stub_main
35 AC_CHECK_LIB([ieee],      [main]) ac_cv_lib_ieee=ac_cv_lib_ieee_main
36
37 AC_CHECK_LIB([pthread],   [main], 
38         [AC_DEFINE([HAVE_LIBPTHREAD], [1],
39                            [Define if you have the pthread library])
40          AC_SUBST([HAVE_LIBPTHREAD])]) 
41 ac_cv_lib_pthread=ac_cv_lib_pthread_main
42
43 AC_CHECK_TYPE([ssize_t], [int]) 
44
45 AC_MSG_CHECKING([for sun_len in sys/un.h])
46 AC_EGREP_HEADER([sun_len], [sys/un.h],
47     [AC_MSG_RESULT([yes])
48      AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1],
49                    [Define if sockaddr_un in sys/un.h contains a sun_len component])],
50     AC_MSG_RESULT([no]))
51
52 AC_REPLACE_FUNCS([strerror])
53
54 AC_MSG_CHECKING([for fpos_t in stdio.h])
55 AC_EGREP_HEADER([fpos_t], [stdio.h],
56     [AC_MSG_RESULT([yes])
57      AC_DEFINE([HAVE_FPOS], [1], [Define if the fpos_t typedef is in stdio.h])],
58     AC_MSG_RESULT([no]))
59
60 AC_CHECK_HEADERS([sys/socket.h netdb.h netinet/in.h arpa/inet.h sys/time.h limits.h sys/param.h unistd.h])
61
62 AC_MSG_CHECKING([for a fileno() prototype in stdio.h])
63 AC_EGREP_HEADER([fileno], [stdio.h], 
64         [AC_MSG_RESULT([yes]) 
65          AC_DEFINE([HAVE_FILENO_PROTO], [1], 
66                        [Define if there's a fileno() prototype in stdio.h])],
67         AC_MSG_RESULT([no]))
68
69 if test "$HAVE_SYS_SOCKET_H"; then
70     AC_MSG_CHECKING([for socklen_t in sys/socket.h])
71     AC_EGREP_HEADER([socklen_t], [sys/socket.h],
72         [AC_MSG_RESULT([yes])
73          AC_DEFINE([HAVE_SOCKLEN], [1],
74                            [Define if the socklen_t typedef is in sys/socket.h])],
75        AC_MSG_RESULT([no]))
76 fi
77
78 #--------------------------------------------------------------------
79 #  Do we need cross-process locking on this platform?
80 #--------------------------------------------------------------------
81 AC_MSG_CHECKING([whether cross-process locking is required by accept()])
82 case "`uname -sr`" in
83     IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0)        
84                 AC_MSG_RESULT([yes])
85                 AC_DEFINE([USE_LOCKING], [1], 
86                                   [Define if cross-process locking is required by accept()])
87         ;;
88     *)
89                 AC_MSG_RESULT([no])
90             ;;
91 esac
92
93 #--------------------------------------------------------------------
94 #  Does va_arg(arg, long double) crash the compiler?
95 #  hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler)
96 #--------------------------------------------------------------------
97 AC_MSG_CHECKING([whether va_arg(arg, long double) crashes the compiler])
98 AC_TRY_COMPILE([#include <stdarg.h>],
99    [long double lDblArg; va_list arg; lDblArg = va_arg(arg, long double);],
100    AC_MSG_RESULT([no]),
101    [AC_MSG_RESULT([yes])
102     AC_DEFINE([HAVE_VA_ARG_LONG_DOUBLE_BUG], [1],
103                           [Define if va_arg(arg, long double) crashes the compiler])])
104
105 AC_C_CONST 
106 AC_C_INLINE
107
108 #--------------------------------------------------------------------
109 #  This is a little hokie in that it avoids including config.guess
110 #  and config.sub in the distribution, but its been working so far.
111 #  Windows builds don't run configure so we should be safe fixing
112 #  this to 'unix' (at least for now).
113 #--------------------------------------------------------------------
114 SYSTEM=unix
115 AC_SUBST([SYSTEM])
116
117 L=a
118 AC_SUBST([L])
119
120 if test "$GCC"; then
121         CCDEFS="$CCDEFS -Wall -Wmissing-prototypes"
122 fi
123
124 AC_SUBST([CCDEFS])
125
126 AC_OBJEXT
127 AC_SUBST([EXEEXT]) 
128
129 if test -z "$FCGI_BUILD"; then
130         AC_CONFIG_FILES([Makefile 
131                                          libfcgi/Makefile 
132                                          cgi-fcgi/Makefile 
133                                          examples/Makefile])
134 fi
135
136 AC_OUTPUT
137