Make configure capable of being used here or from inside the perl directory.
[catagits/fcgi2.git] / configure.in
1 dnl     $Id: configure.in,v 1.4 2001/08/30 22:13:01 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
33 AC_CHECK_LIB([resolv],[main],[],[],[])ac_cv_lib_resolv=ac_cv_lib_resolv_main
34
35 AC_CHECK_LIB([socket],[main],[],[],[])ac_cv_lib_socket=ac_cv_lib_socket_main
36
37 AC_CHECK_LIB([dnet_stub],[main],[],[],[])ac_cv_lib_dnet_stub=ac_cv_lib_dnet_stub_main
38         
39 AC_CHECK_LIB([ieee],[main],[],[],[])ac_cv_lib_ieee=ac_cv_lib_ieee_main
40         
41 AC_CHECK_TYPE(ssize_t, int) 
42
43 AC_MSG_CHECKING(for sun_len in sys/un.h)
44 AC_EGREP_HEADER(sun_len,
45    sys/un.h,
46    AC_MSG_RESULT(yes)
47    AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN),
48    AC_MSG_RESULT(no))
49
50 AC_CHECK_FUNCS(strerror)
51 AC_REPLACE_FUNCS(strerror)
52
53 AC_MSG_CHECKING(for fpos in stdio.h)
54 AC_EGREP_HEADER(fpos_t,
55    stdio.h,
56    AC_MSG_RESULT(yes)
57    AC_DEFINE(HAVE_FPOS),
58    AC_MSG_RESULT(no))
59
60 AC_CHECK_HEADERS([sys/socket.h],[have_sys_socket=yes])
61 AC_CHECK_HEADERS([netdb.h])
62 AC_CHECK_HEADERS([netinet/in.h])
63 AC_CHECK_HEADERS([arpa/inet.h])
64 AC_CHECK_HEADERS([sys/time.h])
65 AC_CHECK_HEADERS([limits.h])
66
67 if test "x$have_sys_socket" = "xyes"; then
68     AC_MSG_CHECKING(for socklen_t in sys/socket.h)
69     AC_EGREP_HEADER(socklen_t,
70        sys/socket.h,
71        AC_MSG_RESULT(yes)
72        AC_DEFINE(HAVE_SOCKLEN),
73        AC_MSG_RESULT(no))
74 fi
75
76 #--------------------------------------------------------------------
77 #  Do we need cross-process locking on this platform?
78 #--------------------------------------------------------------------
79 AC_MSG_CHECKING("if this machine needs cross-process locking")
80 case "`uname -sr`" in
81     IRIX\ 5.*)  
82         AC_DEFINE(USE_LOCKING)
83         AC_MSG_RESULT(yes)
84     ;;
85     SunOS\ 5.*) 
86         AC_DEFINE(USE_LOCKING)
87         AC_MSG_RESULT(yes)
88     ;;
89     UNIX_System_V\ 4.0)
90         AC_DEFINE(USE_LOCKING)
91         AC_MSG_RESULT(yes)
92     ;;
93     *)
94         AC_MSG_RESULT(no)
95     ;;
96 esac
97
98 #--------------------------------------------------------------------
99 #  Does va_arg(arg, long double) crash the compiler?
100 #  hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler)
101 #--------------------------------------------------------------------
102 AC_MSG_CHECKING(if va_arg(arg, long double) crashes the compiler)
103 AC_TRY_COMPILE([#include <stdarg.h>],
104    [long double lDblArg; va_list arg; lDblArg = va_arg(arg, long double);],
105    AC_MSG_RESULT(no),
106    AC_DEFINE(HAVE_VA_ARG_LONG_DOUBLE_BUG)
107    AC_MSG_RESULT(yes))
108
109 AC_C_CONST 
110 AC_C_INLINE
111
112 #--------------------------------------------------------------------
113 #  This is a little hokie in that it avoids including config.guess
114 #  and config.sub in the distribution, but its been working so far.
115 #  Windows builds don't run configure so we should be safe fixing
116 #  this to 'unix' (at least for now).
117 #--------------------------------------------------------------------
118
119 SYSTEM=unix
120 AC_SUBST(SYSTEM)
121
122 L=a
123 AC_SUBST(L)
124
125 if test "$GCC"; then
126         CCDEFS="$CCDEFS -ansi -pedantic -Wall -Wmissing-prototypes"
127 fi
128
129 AC_SUBST(CCDEFS)
130
131 AC_OBJEXT 
132
133 if test -z "$FCGI_BUILD"; then
134         AC_CONFIG_FILES([Makefile 
135                                          libfcgi/Makefile 
136                                          cgi-fcgi/Makefile 
137                                          examples/Makefile])
138 fi
139
140 AC_OUTPUT
141