reindent-20030715
[openafs.git] / src / afsweb / apache_includes / 1.3.1 / ap_config.h
1 /* ====================================================================
2  * Copyright (c) 1995-1998 The Apache Group.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer. 
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in
13  *    the documentation and/or other materials provided with the
14  *    distribution.
15  *
16  * 3. All advertising materials mentioning features or use of this
17  *    software must display the following acknowledgment:
18  *    "This product includes software developed by the Apache Group
19  *    for use in the Apache HTTP server project (http://www.apache.org/)."
20  *
21  * 4. The names "Apache Server" and "Apache Group" must not be used to
22  *    endorse or promote products derived from this software without
23  *    prior written permission. For written permission, please contact
24  *    apache@apache.org.
25  *
26  * 5. Products derived from this software may not be called "Apache"
27  *    nor may "Apache" appear in their names without prior written
28  *    permission of the Apache Group.
29  *
30  * 6. Redistributions of any form whatsoever must retain the following
31  *    acknowledgment:
32  *    "This product includes software developed by the Apache Group
33  *    for use in the Apache HTTP server project (http://www.apache.org/)."
34  *
35  * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
36  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
39  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46  * OF THE POSSIBILITY OF SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Apache Group and was originally based
51  * on public domain software written at the National Center for
52  * Supercomputing Applications, University of Illinois, Urbana-Champaign.
53  * For more information on the Apache Group and the Apache HTTP server
54  * project, please see <http://www.apache.org/>.
55  *
56  */
57
58 #ifndef AP_CONFIG_H
59 #define AP_CONFIG_H
60
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64
65 /*
66  * ap_config.h: system-dependant #defines and includes...
67  * See PORTING for a listing of what they mean
68  */
69
70 /*
71  * Support for platform dependent autogenerated defines
72  */
73 #ifndef WIN32
74 #include "ap_config_auto.h"
75 #else
76 /* not available under WIN32, so provide important entries manually */
77 #undef HAVE_UNISTD_H
78 #endif
79
80 /* Have to include sys/stat.h before ../os/win32/os.h so we can override
81 stat() properly */
82 #include <sys/types.h>
83 #include <sys/stat.h>
84
85 #ifdef WIN32
86 /* include process.h first so we can override spawn[lv]e* properly */
87 #include <process.h>
88 #include "os/win32/os.h"
89 #else
90 #include "os.h"
91 #endif
92
93 #if !defined(QNX) && !defined(MPE) && !defined(WIN32)
94 #include <sys/param.h>
95 #endif
96
97 /* Define one of these according to your system. */
98 #if defined(MINT)
99     typedef int rlim_t;
100 #define JMP_BUF sigjmp_buf
101 #define NO_LONG_DOUBLE
102 #define USE_FLOCK_SERIALIZED_ACCEPT
103 #define _BSD_SOURCE
104 #define EAGAIN EWOULDBLOCK
105     int initgroups(char *, int);
106     char *crypt(const char *pw, const char *salt);
107     int gethostname(char *name, int namelen);
108
109 #elif defined(MPE)
110 #include <sys/times.h>
111 #define NO_SETSID
112 #define NO_KILLPG
113 #define NO_WRITEV
114 #define HAVE_SHMGET 1
115 #define USE_SHMGET_SCOREBOARD
116 #define SHM_R 0400              /* Read permission */
117 #define SHM_W 0200              /* Write permission */
118 #define NEED_INITGROUPS
119 #define NEED_STRCASECMP
120 #define NEED_STRDUP
121 #define NEED_STRNCASECMP
122     extern void GETPRIVMODE();
123     extern void GETUSERMODE();
124     extern char *inet_ntoa();
125 #define NO_SLACK
126 #define NO_GETTIMEOFDAY
127 #define S_IEXEC  S_IXUSR
128 #define S_IREAD  S_IRUSR
129 #define S_IWRITE S_IWUSR
130 #define PF_INET  AF_INET
131
132 #elif defined(SUNOS4)
133 #define HAVE_GMTOFF 1
134 #undef NO_KILLPG
135 #undef NO_SETSID
136     char *crypt(const char *pw, const char *salt);
137     char *mktemp(char *template);
138 #define HAVE_MMAP 1
139 #define USE_MMAP_SCOREBOARD
140 #define USE_MMAP_FILES
141 #include <sys/time.h>
142 #define NEED_STRERROR
143     typedef int rlim_t;
144 #ifndef HAVE_MEMMOVE
145 #define memmove(a,b,c) memcpy(a, b, c)
146 #endif
147 #define NO_LINGCLOSE
148 #define USE_FLOCK_SERIALIZED_ACCEPT
149 #define NEED_DIFFTIME
150 #define HAVE_SYSLOG 1
151
152 #elif defined(SOLARIS2)
153 #undef HAVE_GMTOFF
154 #define NO_KILLPG
155 #undef NO_SETSID
156 #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \
157     !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
158 #define USE_FCNTL_SERIALIZED_ACCEPT
159 #endif
160 #define NEED_UNION_SEMUN
161 #define HAVE_MMAP 1
162 #define USE_MMAP_SCOREBOARD
163 #define USE_MMAP_FILES
164
165 /* AFS Websecure tweak to compile on Linux */
166 #if ! defined(AIX) && ! defined(HAVE_UNISTD_H)
167     int gethostname(char *name, int namelen);
168 #endif                          /* ! defined(AIX) && ! defined(HAVE_UNISTD_H) */
169
170 #define HAVE_SYSLOG 1
171 #define SYS_SIGLIST _sys_siglist
172
173 #elif defined(IRIX)
174 #undef HAVE_GMTOFF
175 /* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
176  * there's some weird conflict with non-BSD signals */
177 #define NO_KILLPG
178 #undef NO_SETSID
179 #if !defined(USE_FCNTL_SERIALIZED_ACCEPT) && !defined(USE_USLOCK_SERIALIZED_ACCEPT)
180 #define USE_SYSVSEM_SERIALIZED_ACCEPT
181 #endif
182 #define HAVE_SHMGET 1
183 #define USE_SHMGET_SCOREBOARD
184 #define HAVE_MMAP 1
185 #define USE_MMAP_FILES
186 #define NO_LONG_DOUBLE
187 #define NO_LINGCLOSE
188 #define HAVE_SYSLOG 1
189
190 #elif defined(HIUX)
191 #undef HAVE_GMTOFF
192 #define NO_KILLPG
193 #undef NO_SETSID
194 #ifndef _HIUX_SOURCE
195 #define _HIUX_SOURCE
196 #endif
197 #define HAVE_SHMGET 1
198 #define USE_SHMGET_SCOREBOARD
199 #define SELECT_NEEDS_CAST
200 #define HAVE_SYSLOG 1
201
202 #elif defined(HPUX) || defined(HPUX10)
203 #undef HAVE_GMTOFF
204 #define NO_KILLPG
205 #undef NO_SETSID
206 #define USE_FCNTL_SERIALIZED_ACCEPT
207 #ifndef _HPUX_SOURCE
208 #define _HPUX_SOURCE
209 #endif
210 #define HAVE_SHMGET 1
211 #define USE_SHMGET_SCOREBOARD
212 #define HAVE_SYSLOG 1
213 #ifndef HPUX10
214 #define SELECT_NEEDS_CAST
215     typedef int rlim_t;
216 #endif
217
218 #elif defined(HPUX11)
219 #ifndef _HPUX_SOURCE
220 #define _HPUX_SOURCE
221 #endif
222 #define HAVE_SHMGET
223 #define USE_SHMGET_SCOREBOARD
224 #undef  HAVE_GMTOFF
225 #define USE_FCNTL_SERIALIZED_ACCEPT
226 /* feeling brave?  want to try using POSIX mutexes? */
227 /* #define HAVE_MMAP */
228 /* #define USE_MMAP_SCOREBOARD */
229 /* #define USE_MMAP_FILES */
230 /* #define USE_PTHREAD_SERIALIZED_ACCEPT */
231 #define NO_KILLPG
232 #undef  NO_SETSID
233 #define HAVE_SYSLOG
234
235 #elif defined(AIX)
236 #undef HAVE_GMTOFF
237 #undef NO_KILLPG
238 #undef NO_SETSID
239 #ifndef __ps2__
240 #define HAVE_MMAP 1
241 #define USE_MMAP_SCOREBOARD
242 #define USE_MMAP_FILES
243 #define HAVE_SYSLOG 1
244 #ifndef DEFAULT_GROUP
245 #define DEFAULT_GROUP "nobody"
246 #endif
247 #endif
248 #ifndef DEFAULT_USER
249 #define DEFAULT_USER "nobody"
250 #endif
251 #ifdef NEED_RLIM_T
252     typedef int rlim_t;
253 #endif
254 #define USE_FCNTL_SERIALIZED_ACCEPT
255 #ifdef USEBCOPY
256 #define memmove(a,b,c) memcpy(a, b, c)
257 #endif
258 #if AIX >= 42
259 #define NET_SIZE_T size_t
260 #endif
261
262 #elif defined(ULTRIX)
263 #define HAVE_GMTOFF 1
264 #undef NO_KILLPG
265 #undef NO_SETSID
266 #define ULTRIX_BRAIN_DEATH
267 #define NEED_STRDUP
268 /* If you have Ultrix 4.3, and are using cc, const is broken */
269 #ifndef __ultrix__              /* Hack to check for pre-Ultrix 4.4 cc */
270 #define const                   /* Not implemented */
271 #endif
272
273 #elif defined(OSF1)
274 #define HAVE_GMTOFF 1
275 #undef NO_KILLPG
276 #undef NO_SETSID
277 #define HAVE_MMAP 1
278 #define USE_MMAP_SCOREBOARD
279 #define USE_MMAP_FILES
280 #define NO_LONG_DOUBLE
281 #define HAVE_SYSLOG 1
282 #define USE_FLOCK_SERIALIZED_ACCEPT
283 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
284
285 #elif defined(PARAGON)
286 #define HAVE_GMTOFF 1
287 #undef NO_KILLPG
288 #undef NO_SETSID
289 #define HAVE_MMAP 1
290 #define USE_MMAP_SCOREBOARD
291 #define USE_MMAP_FILES
292 #define NO_LONG_DOUBLE
293 #define HAVE_SYSLOG 1
294     typedef int rlim_t;
295
296 #elif defined(SEQUENT)
297 #define HAVE_GMTOFF 1
298 #undef NO_KILLPG
299 #define NO_SETSID
300 #define NEED_STRDUP
301 #define HAVE_SYSLOG 1
302
303 #elif defined(NEXT)
304     typedef unsigned short mode_t;
305 #define HAVE_GMTOFF 1
306 #undef NO_KILLPG
307 #define NO_SETSID
308 #define NEED_STRDUP
309 #define NO_LINGCLOSE
310 #undef _POSIX_SOURCE
311 #ifndef FD_CLOEXEC
312 #define FD_CLOEXEC 1
313 #endif
314 #ifndef S_ISDIR
315 #define S_ISDIR(m)      (((m)&(S_IFMT)) == (S_IFDIR))
316 #endif
317 #ifndef S_ISREG
318 #define S_ISREG(m)      (((m)&(S_IFMT)) == (S_IFREG))
319 #endif
320 #ifndef S_IXUSR
321 #define S_IXUSR 00100
322 #endif
323 #ifndef S_IRGRP
324 #define S_IRGRP 00040
325 #endif
326 #ifndef S_IXGRP
327 #define S_IXGRP 00010
328 #endif
329 #ifndef S_IROTH
330 #define S_IROTH 00004
331 #endif
332 #ifndef S_IXOTH
333 #define S_IXOTH 00001
334 #endif
335 #ifndef S_IRUSR
336 #define S_IRUSR S_IREAD
337 #endif
338 #ifndef S_IWUSR
339 #define S_IWUSR S_IWRITE
340 #endif
341 #ifndef S_IWGRP
342 #define S_IWGRP 000020
343 #endif
344 #ifndef S_IWOTH
345 #define S_IWOTH 000002
346 #ifndef rlim_t
347     typedef int rlim_t;
348 #endif
349     typedef u_long n_long;
350 #endif
351
352 #define STDIN_FILENO  0
353 #define STDOUT_FILENO 1
354 #define STDERR_FILENO 2
355
356 /* PR#2293 fix */
357 #define ap_wait_t       union wait
358 #define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
359 #define WEXITSTATUS(status)     (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1)
360 #define WTERMSIG(status)        (int)( (status).w_termsig )
361
362     typedef int pid_t;
363 #define USE_LONGJMP
364 #define NO_USE_SIGACTION
365 #define HAVE_SYSLOG 1
366
367 #elif defined(LINUX)
368
369 #if LINUX > 1
370 #include <features.h>
371
372 /* libc4 systems probably still work, it probably doesn't define
373  *  __GNU_LIBRARY__
374  * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__
375  * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as
376  * "deprecated in favour of __GLIBC__"; the value 6 will never be changed.
377  * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have
378  * __GLIBC__ < 2
379  * all glibc based systems need crypt.h
380  */
381 #if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
382 #include <crypt.h>
383 #endif
384
385 /* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t *
386  * there's no way to discern between these two libraries.  But using int should
387  * be portable because otherwise these libs would be hopelessly broken with
388  * reams of existing networking code.  We'll use socklen_t * for 2.1.x and
389  * later.
390  *
391  * int works for all the earlier libs, and is picked up by default later.
392  */
393 #if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
394 #define NET_SIZE_T socklen_t
395 #endif
396
397 #define HAVE_SHMGET 1
398 #define USE_SHMGET_SCOREBOARD
399 #define HAVE_MMAP 1
400 #define USE_MMAP_FILES
401
402 /* glibc 2.1 and later finally define rlim_t */
403 #if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
404     typedef int rlim_t;
405 #endif
406
407 /* flock is faster ... but hasn't been tested on 1.x systems */
408 #define USE_FLOCK_SERIALIZED_ACCEPT
409
410 #define SYS_SIGLIST     _sys_siglist
411
412 #else
413 #define USE_FCNTL_SERIALIZED_ACCEPT
414 #endif
415
416 #undef HAVE_GMTOFF
417 #undef NO_KILLPG
418 #undef NO_SETSID
419 #undef NEED_STRDUP
420 #include <sys/time.h>
421 #define HAVE_SYSLOG 1
422
423 #elif defined(SCO)
424 #undef HAVE_GMTOFF
425 #undef NO_KILLPG
426 #undef NO_SETSID
427 #define NEED_INITGROUPS
428 #define NO_WRITEV
429 #include <sys/time.h>
430 #define HAVE_SYSLOG 1
431
432 #elif defined(SCO5)
433
434 #define USE_FCNTL_SERIALIZED_ACCEPT
435 #define HAVE_MMAP 1
436 #define USE_MMAP_SCOREBOARD
437 #define USE_MMAP_FILES
438 #define SecureWare
439 #define HAVE_SYSLOG 1
440
441 /* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
442    consts. Sigh. */
443     extern int strcasecmp(const char *, const char *);
444     extern int strncasecmp(const char *, const char *, unsigned);
445
446 #elif defined(AUX3)
447 /* These are to let -Wall compile more cleanly */
448     extern int strcasecmp(const char *, const char *);
449     extern int strncasecmp(const char *, const char *, unsigned);
450     extern int set42sig(), getopt(), getpeername();
451     extern int listen(), bind(), socket(), getsockname();
452     extern int accept(), gethostname(), connect(), lstat();
453     extern int select(), killpg(), shutdown();
454     extern int initgroups(), setsockopt();
455     extern char *shmat();
456     extern int shmctl();
457     extern int shmget();
458     extern char *sbrk();
459     extern char *crypt();
460 #include <sys/time.h>
461 #undef HAVE_GMTOFF
462 #undef NO_KILLPG
463 #undef NO_SETSID
464 #define NEED_STRDUP
465 /* fcntl() locking is expensive with NFS */
466 #define USE_FLOCK_SERIALIZED_ACCEPT
467 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
468 #define HAVE_SHMGET 1
469 #define USE_SHMGET_SCOREBOARD
470 /*
471  * NOTE: If when you run Apache under A/UX and you get a warning
472  * that httpd couldn't move break, then the below value for
473  * MOVEBREAK (64megs) is too large for your setup. Try reducing
474  * to 0x2000000 which is still PLENTY of space. I doubt if
475  * even on heavy systems sbrk() would be called at all...
476  */
477 #define MOVEBREAK               0x4000000
478 #define NO_LINGCLOSE
479 #define NO_SLACK
480 #define HAVE_SYSLOG 1
481 #undef HAVE_SYS_RESOURCE_H      /* exists but does not provide *rlimit funcs */
482
483 #elif defined(SVR4)
484 #define NO_KILLPG
485 #undef  NO_SETSID
486 #undef NEED_STRDUP
487 #ifndef MPRAS
488 #define NEED_STRCASECMP
489 #ifndef ENCORE
490 #define NEED_STRNCASECMP
491 #endif                          /* ENCORE */
492 #endif                          /* MPRAS */
493 /* A lot of SVR4 systems need this */
494 #ifndef USE_SYSVSEM_SERIALIZED_ACCEPT
495 #define USE_FCNTL_SERIALIZED_ACCEPT
496 #endif
497 #define HAVE_SYSLOG 1
498 #define NET_SIZE_T size_t
499 #define HAVE_SHMGET 1
500 #define USE_SHMGET_SCOREBOARD
501 #ifdef _OSD_POSIX               /* BS2000-POSIX mainframe needs initgroups */
502 #define NEED_INITGROUPS
503 #define NEED_HASHBANG_EMUL      /* execve() doesn't start shell scripts by default */
504 #undef HAVE_SHMGET
505 #undef USE_SHMGET_SCOREBOARD
506 #undef bzero
507 #endif /*_OSD_POSIX*/
508
509 #elif defined(UW)
510 #define NO_LINGCLOSE
511 #define NO_KILLPG
512 #undef  NO_SETSID
513 #undef NEED_STRDUP
514 #define NEED_STRCASECMP
515 #define NEED_STRNCASECMP
516 #define HAVE_MMAP 1
517 #define USE_MMAP_SCOREBOARD
518 #define USE_MMAP_FILES
519 #define HAVE_SHMGET 1
520 #undef USE_SHMGET_SCOREBOARD    /* force use of mmap() scoreboard */
521 #include <sys/time.h>
522 #if UW >= 200
523 #define _POSIX_SOURCE
524 #endif
525 #define NET_SIZE_T size_t
526 #define HAVE_SYSLOG 1
527 #define USE_FCNTL_SERIALIZED_ACCEPT
528
529 #elif defined(DGUX)
530 #define NO_KILLPG
531 #undef  NO_SETSID
532 #undef NEED_STRDUP
533 #define NEED_STRCASECMP
534 #define NEED_STRNCASECMP
535 /* A lot of SVR4 systems need this */
536 #define USE_FCNTL_SERIALIZED_ACCEPT
537 #define ap_inet_addr inet_network
538 #define HAVE_SYSLOG 1
539
540 #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD)
541 #define HAVE_GMTOFF 1
542 #undef NO_KILLPG
543 #undef NO_SETSID
544 #define HAVE_SYSLOG 1
545 #ifndef DEFAULT_USER
546 #define DEFAULT_USER "nobody"
547 #endif
548 #ifndef DEFAULT_GROUP
549 #define DEFAULT_GROUP "nogroup"
550 #define HAVE_SHMGET 1
551 #define HAVE_MMAP 1
552 #define USE_MMAP_SCOREBOARD
553 #define USE_MMAP_FILES
554 #endif
555
556 #elif defined(UTS21)
557 #undef HAVE_GMTOFF
558 #undef NO_KILLPG
559 #define NO_SETSID
560 #define NEED_WAITPID
561 #define STDIN_FILENO 0
562 #define STDOUT_FILENO 1
563 #define STDERR_FILENO 2
564 #define HAVE_SYSLOG 1
565 #define USE_LONGJMP
566 #define JMP_BUF jmp_buf
567 #define NO_USE_SIGACTION
568 #define NEED_STRERROR
569 #define NEED_STRSTR
570 #define NEED_HASHBANG_EMUL
571 #define NDELAY_PIPE_RETURNS_ZERO
572 #define NO_DATA NO_ADDRESS
573 #define ap_wait_t               union wait
574 #define WEXITSTATUS(status)     (int)((status).w_retcode)
575 #define WTERMSIG(status)        (int)((status).w_termsig)
576 #define strftime(buf,bufsize,fmt,tm)    ascftime(buf,fmt,tm)
577 #include <sys/types.h>
578 #include <sys/time.h>
579
580 #elif defined(APOLLO)
581 #undef HAVE_GMTOFF
582 #undef NO_KILLPG
583 #undef NO_SETSID
584 #define HAVE_SYSLOG 1
585
586 #elif defined(__FreeBSD__) || defined(__bsdi__)
587 #if defined(__FreeBSD__)
588 #include <osreldate.h>
589 #endif
590 #define HAVE_GMTOFF 1
591 #undef NO_KILLPG
592 #undef NO_SETSID
593 #define HAVE_MMAP 1
594 #define USE_MMAP_SCOREBOARD
595 #define USE_MMAP_FILES
596 #ifndef DEFAULT_USER
597 #define DEFAULT_USER "nobody"
598 #endif
599 #ifndef DEFAULT_GROUP
600 #define DEFAULT_GROUP "nogroup"
601 #endif
602 #if defined(__bsdi__) || \
603 (defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
604     typedef quad_t rlim_t;
605 #endif
606 #define USE_FLOCK_SERIALIZED_ACCEPT
607 #define HAVE_SYSLOG 1
608 #define SYS_SIGLIST sys_siglist
609
610 #elif defined(QNX)
611 #ifndef crypt
612     char *crypt(const char *pw, const char *salt);
613 #endif
614 #ifndef initgroups
615     int initgroups(char *, int);
616 #endif
617 #ifndef strncasecmp
618 #define strncasecmp strnicmp
619 #endif
620 #undef NO_KILLPG
621 #undef NO_SETSID
622 #define NEED_INITGROUPS
623 #define NEED_SELECT_H
624 #define NEED_PROCESS_H
625 #include <unix.h>
626 #define HAVE_MMAP 1
627 #define USE_POSIX_SCOREBOARD
628 #define USE_FLOCK_SERIALIZED_ACCEPT
629 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
630 #define HAVE_SYSLOG 1
631
632 #elif defined(LYNXOS)
633 #undef HAVE_GMTOFF
634 #undef USE_MMAP_SCOREBOARD
635 #undef USE_SHMGET_SCOREBOARD
636 #undef USE_FCNTL_SERIALIZED_ACCEPT
637 #undef USE_FLOCK_SERIALIZED_ACCEPT
638 #define USE_LONGJMP
639 #undef NO_KILLPG
640 #undef NO_SETSID
641 #undef NO_USE_SIGACTION
642 #undef NO_LINGCLOSE
643     extern char *crypt(char *pw, char *salt);
644     typedef int rlim_t;
645 #define HAVE_SYSLOG 1
646
647 #elif defined(UXPDS)
648 #undef NEED_STRCASECMP
649 #undef NEED_STRNCASECMP
650 #undef NEED_STRDUP
651 #undef HAVE_GMTOFF
652 #define NO_KILLPG
653 #undef NO_SETSID
654 #define USE_FCNTL_SERIALIZED_ACCEPT
655 #define HAVE_MMAP 1
656 #define USE_MMAP_SCOREBOARD
657 #define USE_MMAP_FILES
658 #define HAVE_SYSLOG 1
659
660 #elif defined(__EMX__)
661 /* Defines required for EMX OS/2 port. */
662 #define NO_KILLPG
663 #define NEED_STRCASECMP
664 #define NEED_STRNCASECMP
665 #define NO_SETSID
666 #define NO_TIMES
667 /* ap_config_auto.h gets this wrong, force sys/select.h to be included */
668 #define HAVE_SYS_SELECT_H
669 #define CASE_BLIND_FILESYSTEM
670 /* Add some drive name support */
671 #define chdir _chdir2
672 #include <sys/time.h>
673 #define MAXSOCKETS 4096
674 #define USE_OS2_SCOREBOARD
675 #define NO_RELIABLE_PIPED_LOGS
676
677 #elif defined(__MACHTEN__)
678     typedef int rlim_t;
679 #undef NO_KILLPG
680 #define NO_SETSID
681 #define HAVE_GMTOFF 1
682 #ifndef __MACHTEN_PPC__
683 #ifndef __MACHTEN_68K__
684 #define __MACHTEN_68K__
685 #endif
686 #define USE_FLOCK_SERIALIZED_ACCEPT
687 #define NO_USE_SIGACTION
688 #define JMP_BUF sigjmp_buf
689 #define USE_LONGJMP
690 #undef NEED_STRDUP
691 #else
692 #define HAVE_SHMGET 1
693 #define USE_SHMGET_SCOREBOARD
694 #define USE_FCNTL_SERIALIZED_ACCEPT
695 #endif
696
697 /* Convex OS v11 */
698 #elif defined(CONVEXOS11)
699 #undef HAVE_GMTOFF
700 #undef NO_KILLPG
701 #undef NO_SETSID
702 #undef NEED_STRDUP
703 #define HAVE_MMAP 1
704 #define USE_MMAP_SCOREBOARD
705 #define USE_MMAP_FILES
706 #define HAVE_SYSLOG 1
707
708 #define NO_TIMEZONE
709 #include <stdio.h>
710 #include <sys/types.h>
711     typedef int rlim_t;
712
713 #elif defined(ISC)
714 #include <net/errno.h>
715 #define NO_KILLPG
716 #undef NO_SETSID
717 #define HAVE_SHMGET 1
718 #define USE_SHMGET_SCOREBOARD
719 #define USE_FCNTL_SERIALIZED_ACCEPT
720 #define HAVE_SYSLOG 1
721
722 #elif defined(NEWSOS)
723 #define HAVE_SHMGET 1
724 #define USE_SHMGET_SCOREBOARD
725 #define USE_LONGJMP
726 #define NO_SETSID
727 #define NO_USE_SIGACTION
728 #define NEED_WAITPID
729 #define NO_OTHER_CHILD
730 #define HAVE_SYSLOG 1
731 #include <sys/time.h>
732 #include <stdlib.h>
733 #include <sys/types.h>
734     typedef int pid_t;
735     typedef int rlim_t;
736     typedef int mode_t;
737
738 #elif defined(RISCIX)
739 #include <sys/time.h>
740     typedef int rlim_t;
741 #define NO_USE_SIGACTION
742 #define USE_LONGJMP
743 #define NEED_STRCASECMP
744 #define NEED_STRNCASECMP
745 #define NEED_STRDUP
746
747 #elif defined(BEOS)
748 #include <stddef.h>
749
750 #define NO_WRITEV
751 #define NO_KILLPG
752 #define NEED_INITGROUPS
753
754 #elif defined(WIN32)
755
756 /* All windows stuff is now in os/win32/os.h */
757
758 #else
759 /* Unknown system - Edit these to match */
760 #ifdef BSD
761 #define HAVE_GMTOFF 1
762 #else
763 #undef HAVE_GMTOFF
764 #endif
765 /* NO_KILLPG is set on systems that don't have killpg */
766 #undef NO_KILLPG
767 /* NO_SETSID is set on systems that don't have setsid */
768 #undef NO_SETSID
769 /* NEED_STRDUP is set on stupid systems that don't have strdup. */
770 #undef NEED_STRDUP
771 #endif
772
773 /* stuff marked API_EXPORT is part of the API, and intended for use
774  * by modules
775  */
776 #ifndef API_EXPORT
777 #define API_EXPORT(type)    type
778 #endif
779
780 /* Stuff marked API_EXPORT_NONSTD is part of the API, and intended for
781  * use by modules.  The difference between API_EXPORT and
782  * API_EXPORT_NONSTD is that the latter is required for any functions
783  * which use varargs or are used via indirect function call.  This
784  * is to accomodate the two calling conventions in windows dlls.
785  */
786 #ifndef API_EXPORT_NONSTD
787 #define API_EXPORT_NONSTD(type)    type
788 #endif
789
790 #ifndef MODULE_VAR_EXPORT
791 #define MODULE_VAR_EXPORT
792 #endif
793 #ifndef API_VAR_EXPORT
794 #define API_VAR_EXPORT
795 #endif
796
797 /* modules should not used functions marked CORE_EXPORT
798  * or CORE_EXPORT_NONSTD */
799 #ifndef CORE_EXPORT
800 #define CORE_EXPORT     API_EXPORT
801 #endif
802 #ifndef CORE_EXPORT_NONSTD
803 #define CORE_EXPORT_NONSTD      API_EXPORT_NONSTD
804 #endif
805
806 /* So that we can use inline on some critical functions, and use
807  * GNUC attributes (such as to get -Wall warnings for printf-like
808  * functions).  Only do this in gcc 2.7 or later ... it may work
809  * on earlier stuff, but why chance it.
810  *
811  * We've since discovered that the gcc shipped with NeXT systems
812  * as "cc" is completely broken.  It claims to be __GNUC__ and so
813  * on, but it doesn't implement half of the things that __GNUC__
814  * means.  In particular it's missing inline and the __attribute__
815  * stuff.  So we hack around it.  PR#1613. -djg
816  */
817 #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 7 || defined(NEXT)
818 #define ap_inline
819 #define __attribute__(__x)
820 #define ENUM_BITFIELD(e,n,w)  signed int n : w
821 #else
822 #define ap_inline __inline__
823 #define USE_GNU_INLINE
824 #define ENUM_BITFIELD(e,n,w)  e n : w
825 #endif
826
827 /*
828  * The particular directory style your system supports. If you have dirent.h
829  * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include 
830  * that file and define DIR_TYPE to be dirent. Otherwise, if you have 
831  * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
832  * file. If you have neither, I'm confused.
833  */
834
835 #include <sys/types.h>
836 #include <stdarg.h>
837
838 #if !defined(NEXT) && !defined(WIN32)
839 #include <dirent.h>
840 #define DIR_TYPE dirent
841 #elif !defined(WIN32)
842 #include <sys/dir.h>
843 #define DIR_TYPE direct
844 #else
845 #define DIR_TYPE dirent
846 #endif
847
848 #include <stdio.h>
849 #include <stdlib.h>
850 #include <string.h>
851 #include "ap_ctype.h"
852 #if !defined(MPE) && !defined(WIN32)
853 #include <sys/file.h>
854 #endif
855 #ifndef WIN32
856 #include <sys/socket.h>
857 #ifdef HAVE_SYS_SELECT_H
858 #include <sys/select.h>
859 #endif                          /* HAVE_SYS_SELECT_H */
860 #include <netinet/in.h>
861 #include <netdb.h>
862 #include <sys/ioctl.h>
863 #if !defined(MPE) && !defined(BEOS)
864 #include <arpa/inet.h>          /* for inet_ntoa */
865 #endif
866 #include <sys/wait.h>
867 #include <pwd.h>
868 #include <grp.h>
869 #include <fcntl.h>
870 #include <limits.h>
871 #define closesocket(s) close(s)
872 #ifndef O_BINARY
873 #define O_BINARY (0)
874 #endif
875
876 #else                           /* WIN32 */
877 #include <winsock.h>
878 #include <malloc.h>
879 #include <io.h>
880 #include <fcntl.h>
881 #endif                          /* ndef WIN32 */
882
883 #include <time.h>               /* for ctime */
884 #include <signal.h>
885 #include <errno.h>
886 #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT)
887 #include <memory.h>
888 #endif
889
890 #ifdef NEED_PROCESS_H
891 #include <process.h>
892 #endif
893
894 #ifdef WIN32
895 #include "include/hsregex.h"
896 #elif defined(USE_HSREGEX)
897 #include "hsregex.h"
898 #else
899 #include <regex.h>
900 #endif
901
902 #ifdef HAVE_SYS_RESOURCE_H
903 #include <sys/resource.h>
904 #ifdef SUNOS4
905     int getrlimit(int, struct rlimit *);
906     int setrlimit(int, struct rlimit *);
907 #endif
908 #endif
909 #ifdef USE_MMAP_SCOREBOARD
910 #if !defined(__EMX__) && !defined(WIN32)
911 /* This file is not needed for OS/2 */
912 #include <sys/mman.h>
913 #endif
914 #endif
915 #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
916 #define MAP_ANON MAP_ANONYMOUS
917 #endif
918
919 #if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
920 #undef USE_MMAP_FILES
921 #endif
922
923 #if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
924 #undef USE_MMAP_SCOREBOARD
925 #endif
926
927 #if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET))
928 #undef USE_SHMGET_SCOREBOARD
929 #endif
930
931 #ifndef LOGNAME_MAX
932 #define LOGNAME_MAX 25
933 #endif
934
935 #ifdef HAVE_UNISTD_H
936 #include <unistd.h>
937 #endif
938
939 #ifdef ultrix
940 #define ULTRIX_BRAIN_DEATH
941 #endif
942
943 #ifndef S_ISLNK
944 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
945 #endif
946
947 #ifndef INADDR_NONE
948 #define INADDR_NONE ((unsigned long) -1)
949 #endif
950
951 /*
952  * Replace signal function with sigaction equivalent
953  */
954 #ifndef NO_USE_SIGACTION
955     typedef void Sigfunc(int);
956
957 #if defined(SIG_IGN) && !defined(SIG_ERR)
958 #define SIG_ERR ((Sigfunc *)-1)
959 #endif
960
961 /*
962  * For some strange reason, QNX defines signal to signal. Eliminate it.
963  */
964 #ifdef signal
965 #undef signal
966 #endif
967 #define signal(s,f)     ap_signal(s,f)
968     Sigfunc *signal(int signo, Sigfunc * func);
969 #endif
970
971 #include <setjmp.h>
972
973 #if defined(USE_LONGJMP)
974 #define ap_longjmp(x, y)        longjmp((x), (y))
975 #define ap_setjmp(x)            setjmp(x)
976 #ifndef JMP_BUF
977 #define JMP_BUF jmp_buf
978 #endif
979 #else
980 #define ap_longjmp(x, y)        siglongjmp((x), (y))
981 #define ap_setjmp(x)            sigsetjmp((x), 1)
982 #ifndef JMP_BUF
983 #define JMP_BUF sigjmp_buf
984 #endif
985 #endif
986
987 #ifdef SELECT_NEEDS_CAST
988 #define ap_select(_a, _b, _c, _d, _e)   \
989     select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e))
990 #else
991 #define ap_select       select
992 #endif
993
994 #ifdef ULTRIX_BRAIN_DEATH
995 #define ap_fdopen(d,m) fdopen((d), (char *)(m))
996 #else
997 #define ap_fdopen(d,m) fdopen((d), (m))
998 #endif
999
1000 #ifndef ap_inet_addr
1001 #define ap_inet_addr inet_addr
1002 #endif
1003
1004 #ifdef NO_OTHER_CHILD
1005 #define NO_RELIABLE_PIPED_LOGS
1006 #endif
1007
1008 /* When the underlying OS doesn't support exec() of scripts which start
1009  * with a HASHBANG (#!) followed by interpreter name and args, define this.
1010  */
1011 #ifdef NEED_HASHBANG_EMUL
1012     extern int ap_execle(const char *filename, const char *arg, ...);
1013     extern int ap_execve(const char *filename, const char *argv[],
1014                          const char *envp[]);
1015 /* ap_execle() is a wrapper function around ap_execve(). */
1016 #define execle  ap_execle
1017 #define execve(path,argv,envp)  ap_execve(path,argv,envp)
1018 #endif
1019
1020 /* Finding offsets of elements within structures.
1021  * Taken from the X code... they've sweated portability of this stuff
1022  * so we don't have to.  Sigh...
1023  */
1024
1025 #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
1026 #ifdef __STDC__
1027 #define XtOffset(p_type,field) _Offsetof(p_type,field)
1028 #else
1029 #ifdef CRAY2
1030 #define XtOffset(p_type,field) \
1031         (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
1032
1033 #else                           /* !CRAY2 */
1034
1035 #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
1036
1037 #endif                          /* !CRAY2 */
1038 #endif                          /* __STDC__ */
1039 #else                           /* ! (CRAY || __arm) */
1040
1041 #define XtOffset(p_type,field) \
1042         ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
1043
1044 #endif                          /* !CRAY */
1045
1046 #ifdef offsetof
1047 #define XtOffsetOf(s_type,field) offsetof(s_type,field)
1048 #else
1049 #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
1050 #endif
1051
1052 /*
1053  * NET_SIZE_T exists because of shortsightedness on the POSIX committee.  BSD
1054  * systems used "int *" as the parameter to accept(), getsockname(),
1055  * getpeername() et al.  Consequently many unixes took an int * for that
1056  * parameter.  The POSIX committee decided that "int" was just too generic and
1057  * had to be replaced with size_t almost everywhere.  There's no problem with
1058  * that when you're passing by value.  But when you're passing by reference
1059  * this creates a gross source incompatibility with existing programs.  On
1060  * 32-bit architectures it creates only a warning.  On 64-bit architectures it
1061  * creates broken code -- because "int *" is a pointer to a 64-bit quantity and
1062  * "size_t *" is frequently a pointer to a 32-bit quantity.
1063  *
1064  * Some Unixes adopted "size_t *" for the sake of POSIX compliance.  Others
1065  * ignored it because it was such a broken interface.  Chaos ensued.  POSIX
1066  * finally woke up and decided that it was wrong and created a new type
1067  * socklen_t.  The only useful value for socklen_t is int, and that's how
1068  * everyone who has a clue implements it.  It is almost always the case that
1069  * NET_SIZE_T should be defined to be an int, unless the system being compiled
1070  * for was created in the window of POSIX madness.
1071  */
1072 #ifndef NET_SIZE_T
1073 #define NET_SIZE_T int
1074 #endif
1075
1076 /* Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD
1077  * is in use... we'd prefer to just use WCOREDUMP everywhere.
1078  */
1079 #if defined(__WCOREDUMP) && !defined(WCOREDUMP)
1080 #define WCOREDUMP __WCOREDUMP
1081 #endif
1082
1083 #ifdef SUNOS_LIB_PROTOTYPES
1084 /* Prototypes needed to get a clean compile with gcc -Wall.
1085  * Believe it or not, these do have to be declared, at least on SunOS,
1086  * because they aren't mentioned in the relevant system headers.
1087  * Sun Quality Software.  Gotta love it.  This section is not 
1088  * currently (13Nov97) used.
1089  */
1090
1091     int getopt(int, char **, char *);
1092
1093     int strcasecmp(const char *, const char *);
1094     int strncasecmp(const char *, const char *, int);
1095     int toupper(int);
1096     int tolower(int);
1097
1098     int printf(char *, ...);
1099     int fprintf(FILE *, char *, ...);
1100     int fputs(char *, FILE *);
1101     int fread(char *, int, int, FILE *);
1102     int fwrite(char *, int, int, FILE *);
1103     int fgetc(FILE *);
1104     char *fgets(char *s, int, FILE *);
1105     int fflush(FILE *);
1106     int fclose(FILE *);
1107     int ungetc(int, FILE *);
1108     int _filbuf(FILE *);        /* !!! */
1109     int _flsbuf(unsigned char, FILE *); /* !!! */
1110     int sscanf(char *, char *, ...);
1111     void setbuf(FILE *, char *);
1112     void perror(char *);
1113
1114     time_t time(time_t *);
1115     int strftime(char *, int, const char *, struct tm *);
1116
1117     int initgroups(char *, int);
1118     int wait3(int *, int, void *);      /* Close enough for us... */
1119     int lstat(const char *, struct stat *);
1120     int stat(const char *, struct stat *);
1121     int flock(int, int);
1122 #ifndef NO_KILLPG
1123     int killpg(int, int);
1124 #endif
1125     int socket(int, int, int);
1126     int setsockopt(int, int, int, const char *, int);
1127     int listen(int, int);
1128     int bind(int, struct sockaddr *, int);
1129     int connect(int, struct sockaddr *, int);
1130     int accept(int, struct sockaddr *, int *);
1131     int shutdown(int, int);
1132
1133     int getsockname(int s, struct sockaddr *name, int *namelen);
1134     int getpeername(int s, struct sockaddr *name, int *namelen);
1135     int gethostname(char *name, int namelen);
1136     void syslog(int, char *, ...);
1137     char *mktemp(char *);
1138
1139     long vfprintf(FILE *, const char *, va_list);
1140
1141 #endif                          /* SUNOS_LIB_PROTOTYPES */
1142
1143 /* The assumption is that when the functions are missing,
1144  * then there's no matching prototype available either.
1145  * Declare what is needed exactly as the replacement routines implement it.
1146  */
1147 #ifdef NEED_STRDUP
1148     extern char *strdup(const char *str);
1149 #endif
1150 #ifdef NEED_STRCASECMP
1151     extern int strcasecmp(const char *a, const char *b);
1152 #endif
1153 #ifdef NEED_STRNCASECMP
1154     extern int strncasecmp(const char *a, const char *b, int n);
1155 #endif
1156 #ifdef NEED_INITGROUPS
1157     extern int initgroups(const char *name, gid_t basegid);
1158 #endif
1159 #ifdef NEED_WAITPID
1160     extern int waitpid(pid_t pid, int *statusp, int options);
1161 #endif
1162 #ifdef NEED_STRERROR
1163     extern char *strerror(int err);
1164 #endif
1165 #ifdef NEED_DIFFTIME
1166     extern double difftime(time_t time1, time_t time0);
1167 #endif
1168
1169 #ifndef ap_wait_t
1170 #define ap_wait_t int
1171 #endif
1172
1173 #ifdef __cplusplus
1174 }
1175 #endif
1176 #endif                          /* !AP_CONFIG_H */