summaryrefslogtreecommitdiff
path: root/APACHE_1_3_42/src/include/ap_config.h
blob: cac8084f1b1c4df0d5b929c60701d7c9df9ac129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef AP_CONFIG_H
#define AP_CONFIG_H

#ifdef __cplusplus
extern "C" {
#endif

/*
 * ap_config.h: system-dependant #defines and includes...
 * See PORTING for a listing of what they mean
 */

#include "ap_mmn.h"		/* MODULE_MAGIC_NUMBER_ */

/*
 * Support for platform dependent autogenerated defines
 */
#if !defined(WIN32) && !defined(NETWARE) && !defined(TPF)
#include "ap_config_auto.h"
#endif

#if defined(WIN32) || defined(NETWARE)
/* not available under WIN32, so provide important entries manually */
#undef HAVE_UNISTD_H
#endif

/* Have to include sys/stat.h before ../win32/os.h so we can override
stat() properly */
#ifndef NETWARE
#include <sys/types.h>
#endif
#include <sys/stat.h>


/* So that we can use inline on some critical functions, and use
 * GNUC attributes (such as to get -Wall warnings for printf-like
 * functions).  Only do this in gcc 2.7 or later ... it may work
 * on earlier stuff, but why chance it.
 *
 * We've since discovered that the gcc shipped with NeXT systems
 * as "cc" is completely broken.  It claims to be __GNUC__ and so
 * on, but it doesn't implement half of the things that __GNUC__
 * means.  In particular it's missing inline and the __attribute__
 * stuff.  So we hack around it.  PR#1613. -djg
 */
#if !defined(__GNUC__) || __GNUC__ < 2 || \
    (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
    defined(NEXT)
#define ap_inline
#define __attribute__(__x)
#define ENUM_BITFIELD(e,n,w)  signed int n : w
#else
#define ap_inline __inline__
#define USE_GNU_INLINE
#define ENUM_BITFIELD(e,n,w)  e n : w
#endif

#include "os.h"

/* Define one of these according to your system. */
#if defined(MINT)
typedef int rlim_t;
#define JMP_BUF sigjmp_buf
#define NO_LONG_DOUBLE
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#define _BSD_SOURCE
#define EAGAIN EWOULDBLOCK
int initgroups (char *, int);     
char *crypt (const char *pw, const char *salt);
int gethostname (char *name, int namelen);

#elif defined(MPE)
#include <sys/times.h>
#define NO_SETSID
#define NO_KILLPG
#define NO_WRITEV
#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
/* 
   UID/GID isn't a native concept for MPE, and it's definitely not a 100%
   Unix implementation.  There isn't a traditional superuser concept either,
   so we're forced to liberalize SHM security a bit so the parent & children
   can communicate when they're running with different UIDs within the same
   GID (the GID will *always* be the same on MPE).  Thus the weird SHM_R and
   SHM_W below.
*/
#define SHM_R 0440  /* Read permission */
#define SHM_W 0220  /* Write permission */
#define NEED_INITGROUPS
#define NEED_STRCASECMP
#define NEED_STRDUP
#define NEED_STRNCASECMP
extern void GETPRIVMODE();
extern void GETUSERMODE();
extern char *inet_ntoa();
#define NO_SLACK
#define S_IEXEC  S_IXUSR
#define S_IREAD  S_IRUSR
#define S_IWRITE S_IWUSR
#define PF_INET  AF_INET
#define HAVE_FCNTL_SERIALIZED_ACCEPT

#elif defined(SUNOS4)
#define HAVE_GMTOFF 1
#undef NO_KILLPG
#undef NO_SETSID
char *crypt(const char *pw, const char *salt);
char *mktemp(char *);
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#include <sys/time.h>
#define NEED_STRERROR
typedef int rlim_t;
#define memmove(a,b,c) bcopy(b,a,c)
#define NO_LINGCLOSE
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#define NEED_DIFFTIME
#define HAVE_SYSLOG 1

#elif defined(SOLARIS2)
#undef HAVE_GMTOFF
#define NO_KILLPG
#undef NO_SETSID
#define bzero(a,b) memset(a,0,b)
#define HAVE_SYSVSEM_SERIALIZED_ACCEPT
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_PTHREAD_SERIALIZED_ACCEPT
#if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \
    !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
#define USE_FCNTL_SERIALIZED_ACCEPT
#endif
#define NEED_UNION_SEMUN
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
int gethostname(char *name, int namelen);
#define HAVE_SYSLOG 1
#define SYS_SIGLIST _sys_siglist
#define AP_ENABLE_EXCEPTION_HOOK
#define NONBLOCK_WHEN_MULTI_LISTEN

#elif defined(IRIX)
#undef HAVE_GMTOFF
/* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
 * there's some weird conflict with non-BSD signals */
#define NO_KILLPG
#undef NO_SETSID
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_USLOCK_SERIALIZED_ACCEPT
#define HAVE_SYSVSEM_SERIALIZED_ACCEPT
#if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \
    !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \
    !defined(USE_SYSVSEM_SERIALIZED_ACCEPT)
#define USE_FCNTL_SERIALIZED_ACCEPT
#endif
#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
#define HAVE_MMAP 1
#define USE_MMAP_FILES
#define NO_LONG_DOUBLE
#define NO_LINGCLOSE
#define HAVE_SYSLOG 1
#define NONBLOCK_WHEN_MULTI_LISTEN

#elif defined(HIUX)
#undef HAVE_GMTOFF
#define NO_KILLPG
#undef NO_SETSID
#ifndef _HIUX_SOURCE
#define _HIUX_SOURCE
#endif
#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
#define SELECT_NEEDS_CAST
#define HAVE_SYSLOG 1

#elif defined(HPUX11)
#ifndef _HPUX_SOURCE
#define _HPUX_SOURCE
#endif
#define HAVE_SHMGET
#define USE_SHMGET_SCOREBOARD
#undef  HAVE_GMTOFF
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_MMAP
#define USE_MMAP_FILES
#define NO_KILLPG
#undef  NO_SETSID
#define HAVE_SYSLOG
#define AP_ENABLE_EXCEPTION_HOOK

#elif defined(HPUX) || defined(HPUX10)
#undef HAVE_GMTOFF
#define NO_KILLPG
#undef NO_SETSID
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#ifndef _HPUX_SOURCE
#define _HPUX_SOURCE
#endif
#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
#define HAVE_SYSLOG 1
#ifndef HPUX10
#define SELECT_NEEDS_CAST
typedef int rlim_t;
#endif

#elif defined(AIX)
#undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#ifndef __ps2__
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#define HAVE_SYSLOG 1
#ifndef DEFAULT_GROUP
#define DEFAULT_GROUP "nobody"
#endif
#endif
#ifndef DEFAULT_USER
#define DEFAULT_USER "nobody"
#endif
#ifdef NEED_RLIM_T
typedef int rlim_t;
#endif
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_SYSVSEM_SERIALIZED_ACCEPT
#define NEED_UNION_SEMUN
#if AIX >= 430
#define HAVE_PTHREAD_SERIALIZED_ACCEPT
#endif
#define USE_FCNTL_SERIALIZED_ACCEPT
#if AIX >= 432
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT 
#endif
#ifdef USEBCOPY
#define memmove(a,b,c) bcopy(b,a,c)
#endif
#if AIX >= 510
#define NET_SIZE_T socklen_t
#elif AIX >= 420
#define NET_SIZE_T size_t
#endif
#define AP_ENABLE_EXCEPTION_HOOK
#define NONBLOCK_WHEN_MULTI_LISTEN

#elif defined(ULTRIX)
/* we don't want to use sys/resource.h under
   Ultrix although this header exists. */
#undef HAVE_SYS_RESOURCE_H
#define HAVE_GMTOFF 1
#undef NO_KILLPG
#undef NO_SETSID
#define ULTRIX_BRAIN_DEATH
#define NEED_STRDUP
/* If you have Ultrix 4.3, and are using cc, const is broken */
#ifndef __ultrix__		/* Hack to check for pre-Ultrix 4.4 cc */
#define const			/* Not implemented */
#endif

#elif defined(OSF1)
#define HAVE_GMTOFF 1
#undef NO_KILLPG
#undef NO_SETSID
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#define NO_LONG_DOUBLE
#define HAVE_SYSLOG 1
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
#define NONBLOCK_WHEN_MULTI_LISTEN

#elif defined(PARAGON)
#define HAVE_GMTOFF 1
#undef NO_KILLPG
#undef NO_SETSID
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#define NO_LONG_DOUBLE
#define HAVE_SYSLOG 1
typedef int rlim_t;

#elif defined(SEQUENT)
#define DEFAULT_USER "nobody"
#define DEFAULT_GROUP "nobody"
#define NO_SHMGET 1
#define HAVE_MMAP 1
#define HAVE_SYSLOG 1
#define USE_MMAP_FILES 1
#define USE_MMAP_SCOREBOARD 1
#define HAVE_FCNTL_SERIALIZED_ACCEPT 1
#define JMP_BUF sigjmp_buf
#undef NO_SETSID
#if SEQUENT < 40
typedef int rlim_t;
#define NO_GETTIMEOFDAY
#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
#include <sys/times.h>
#endif
#if SEQUENT < 42
#define NEED_STRCASECMP
#define NEED_STRNCASECMP
#endif
#if SEQUENT < 44
#define NO_KILLPG 1
#define NET_SIZE_T int
#endif
#if SEQUENT >= 44
#undef NO_KILLPG
#define NET_SIZE_T size_t
#endif

#elif defined(NEXT)
typedef unsigned short mode_t;
typedef int rlim_t;
#define HAVE_GMTOFF 1
#undef NO_KILLPG
#define NO_SETSID
#define NEED_STRDUP
#define NO_LINGCLOSE
#undef _POSIX_SOURCE
#ifndef FD_CLOEXEC
#define FD_CLOEXEC 1
#endif
#ifndef S_ISDIR
#define S_ISDIR(m)      (((m)&(S_IFMT)) == (S_IFDIR))
#endif
#ifndef S_ISREG
#define S_ISREG(m)      (((m)&(S_IFMT)) == (S_IFREG))
#endif
#ifndef S_IXUSR
#define S_IXUSR 00100
#endif
#ifndef S_IRGRP
#define S_IRGRP 00040
#endif
#ifndef S_IXGRP
#define S_IXGRP 00010
#endif
#ifndef S_IROTH
#define S_IROTH 00004
#endif
#ifndef S_IXOTH
#define S_IXOTH 00001
#endif
#ifndef S_IRUSR
#define S_IRUSR S_IREAD
#endif
#ifndef S_IWUSR
#define S_IWUSR S_IWRITE
#endif
#ifndef S_IWGRP
#define S_IWGRP	000020
#endif
#ifndef S_IWOTH
#define S_IWOTH 000002
#endif

#define STDIN_FILENO  0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2

/* PR#2293 fix */
#define	ap_wait_t	union wait
#define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
#define WEXITSTATUS(status)     (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1)
#define WTERMSIG(status)	(int)( (status).w_termsig )

typedef int pid_t;
#define USE_LONGJMP
#define NO_USE_SIGACTION
#define HAVE_SYSLOG 1

#if defined(__DYNAMIC__)
#define HAVE_DYLD
#define DYLD_CANT_UNLOAD
#endif

#elif defined(DARWIN) /* Darwin (Mac OS) */
#undef PLATFORM
#define PLATFORM "Darwin"
#define HAVE_DYLD
#define HAVE_GMTOFF
#define HAVE_MMAP
#define USE_MMAP_FILES
#define USE_MMAP_SCOREBOARD
#ifdef MAC_OS_X_SERVER
#define MAP_TMPFILE
#endif /* MAC_OS_X_SERVER */
#define HAVE_RESOURCE
#define HAVE_SNPRINTF
#define JMP_BUF jmp_buf
#define USE_LONGJMP
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define USE_FLOCK_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
#define AP_ENABLE_EXCEPTION_HOOK

#elif defined(LINUX)

#if LINUX > 1
#include <features.h>

/* libc4 systems probably still work, it probably doesn't define
 *  __GNU_LIBRARY__
 * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__
 * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as
 * "deprecated in favour of __GLIBC__"; the value 6 will never be changed.
 * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have
 * __GLIBC__ < 2
 * all glibc based systems need crypt.h
 */
#if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
#include <crypt.h>
#endif

/* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t *
 * there's no way to discern between these two libraries.  But using int should
 * be portable because otherwise these libs would be hopelessly broken with
 * reams of existing networking code.  We'll use socklen_t * for 2.1.x and
 * later.
 *
 * int works for all the earlier libs, and is picked up by default later.
 */
#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
#define NET_SIZE_T socklen_t
#endif

#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
#define HAVE_MMAP 1
#define USE_MMAP_FILES

#if LINUX > 20
/* see Pine.LNX.4.21.0011041233550.1897-100000@twinlark.arctic.org
 * in new-httpd archives for performance numbers indicating these
 * are the right choices for linux 2.2.x and later
 */
#define HAVE_SYSVSEM_SERIALIZED_ACCEPT
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT 
#include <sys/sem.h>
#if _SEM_SEMUN_UNDEFINED
#define NEED_UNION_SEMUN
#endif
#else
#define USE_FCNTL_SERIALIZED_ACCEPT
#endif

#define SYS_SIGLIST	_sys_siglist

#else
#define USE_FCNTL_SERIALIZED_ACCEPT
#endif

#undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#undef NEED_STRDUP
#include <sys/time.h>
#define HAVE_SYSLOG 1

/* glibc 2.1 and later finally define rlim_t */
#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
typedef int rlim_t;
#endif
#define AP_ENABLE_EXCEPTION_HOOK

#elif defined(SCO)
#undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define NEED_INITGROUPS
#define NO_WRITEV
#include <sys/time.h>
#define HAVE_SYSLOG 1
#undef HAVE_SYS_RESOURCE_H

#elif defined(ATHEOS)

#include <features.h>
#include <crypt.h>
#include <sys/time.h>

#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define USE_FCNTL_SERIALIZED_ACCEPT

#undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#undef NEED_STRDUP
#define HAVE_SYSLOG 1

#ifdef PLATFORM
#undef PLATFORM
#endif
#define PLATFORM "AtheOS"

#elif defined(SCO5)

#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#define SecureWare
#define HAVE_SYSLOG 1

/* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
   consts. Sigh. */
extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, unsigned);

#elif defined(AUX3)
/* These are to let -Wall compile more cleanly */
extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, unsigned);
extern int set42sig(), getopt(), getpeername(), bzero();
extern int listen(), bind(), socket(), getsockname();
extern int accept(), gethostname(), connect(), lstat();
extern int select(), killpg(), shutdown();
extern int initgroups(), setsockopt();
extern char *shmat();
extern int shmctl();
extern int shmget();
extern char *sbrk();
extern char *crypt();
#include <sys/time.h>
#undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define NEED_STRDUP
/* fcntl() locking is expensive with NFS */
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
/*
 * NOTE: If when you run Apache under A/UX and you get a warning
 * that httpd couldn't move break, then the below value for
 * MOVEBREAK (64megs) is too large for your setup. Try reducing
 * to 0x2000000 which is still PLENTY of space. I doubt if
 * even on heavy systems sbrk() would be called at all...
 */
#define MOVEBREAK		0x4000000
#define NO_LINGCLOSE
#define NO_SLACK
#define HAVE_SYSLOG 1
#undef HAVE_SYS_RESOURCE_H	/* exists but does not provide *rlimit funcs */

#elif defined(SVR4)
#define NO_KILLPG
#undef  NO_SETSID
#undef NEED_STRDUP
#ifndef MPRAS
#define NEED_STRCASECMP
#ifndef ENCORE
#define NEED_STRNCASECMP
#endif /* ENCORE */
#endif /* MPRAS */
#define bzero(a,b) memset(a,0,b)
/* A lot of SVR4 systems need this */
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#ifdef SNI
#define HAVE_SYSVSEM_SERIALIZED_ACCEPT
#endif
#ifndef USE_SYSVSEM_SERIALIZED_ACCEPT
#define USE_FCNTL_SERIALIZED_ACCEPT
#endif
#define HAVE_SYSLOG 1
#define NET_SIZE_T size_t
#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
#ifdef _OSD_POSIX /* BS2000-POSIX mainframe needs initgroups */
#define NEED_HASHBANG_EMUL /* execve() doesn't start shell scripts by default */
#define _KMEMUSER          /* Enable SHM_R/SHM_W defines in <shm.h> */
#define AP_ENABLE_EXCEPTION_HOOK
#undef NEED_STRCASECMP
#undef NEED_STRNCASECMP
#undef bzero
#endif /*_OSD_POSIX*/

#elif defined(UW)
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#if UW < 700
#define NO_LINGCLOSE
#define NO_KILLPG
#else
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
#endif
#undef  NO_SETSID
#undef NEED_STRDUP
#define NEED_STRCASECMP
#define NEED_STRNCASECMP
#define bzero(a,b) memset(a,0,b)
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#define HAVE_SHMGET 1
#undef USE_SHMGET_SCOREBOARD	/* force use of mmap() scoreboard */
#include <sys/time.h>
#if UW >= 200
#define _POSIX_SOURCE
#endif
#define NET_SIZE_T size_t
#define HAVE_SYSLOG 1

#elif defined(DGUX)
#define NO_KILLPG
#undef  NO_SETSID
#undef NEED_STRDUP
#ifdef _IX86_DG
#undef NEED_STRCASECMP
#undef NEED_STRNCASECMP
#else
#define NEED_STRCASECMP
#define NEED_STRNCASECMP
#endif
#define bzero(a,b) memset(a,0,b)
/* A lot of SVR4 systems need this */
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define ap_inet_addr inet_network
#define HAVE_SYSLOG 1

#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD)
#define HAVE_GMTOFF 1
#undef NO_KILLPG
#undef NO_SETSID
#define HAVE_SYSLOG 1
#ifndef DEFAULT_USER
#define DEFAULT_USER "nobody"
#endif
#ifndef DEFAULT_GROUP
#define DEFAULT_GROUP "nogroup"
#endif
#define HAVE_SHMGET 1
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#if defined(__OpenBSD__)
#define HAVE_SYSVSEM_SERIALIZED_ACCEPT
#define USE_SYSVSEM_SERIALIZED_ACCEPT
#include <sys/param.h>
#if (OpenBSD >= 199912)
#define NET_SIZE_T socklen_t
#endif
#endif
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT

#elif defined(UTS21)
#undef HAVE_GMTOFF
#undef NO_KILLPG
#define NO_SETSID
#define NEED_WAITPID
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#define HAVE_SYSLOG 1
#define USE_LONGJMP
#define JMP_BUF jmp_buf
#define NO_USE_SIGACTION
#define NEED_STRERROR
#define NEED_STRSTR
#define NEED_HASHBANG_EMUL
#define NDELAY_PIPE_RETURNS_ZERO
#define NO_DATA NO_ADDRESS
#define	ap_wait_t		union wait
#define WEXITSTATUS(status)	(int)((status).w_retcode)
#define WTERMSIG(status)	(int)((status).w_termsig)
#define strftime(buf,bufsize,fmt,tm)    ascftime(buf,fmt,tm)
#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
#include <sys/types.h>
#include <sys/time.h>     

#elif defined(APOLLO)
#undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define HAVE_SYSLOG 1

#elif defined(__FreeBSD__) || defined(__bsdi__)
#if defined(__FreeBSD__)
#include <osreldate.h>
#endif
#define HAVE_GMTOFF 1
#undef NO_KILLPG
#undef NO_SETSID
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#ifndef DEFAULT_USER
#define DEFAULT_USER "nobody"
#endif
#ifndef DEFAULT_GROUP
#define DEFAULT_GROUP "nogroup"
#endif
#if defined(__bsdi__) || \
(defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
typedef quad_t rlim_t;
#endif
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
#define HAVE_SYSLOG 1
#define SYS_SIGLIST sys_siglist
#if (defined(__FreeBSD_version) && (__FreeBSD_version >= 400000))
#define NET_SIZE_T socklen_t
#endif

#elif defined(QNX)
#ifndef crypt
char *crypt(const char *pw, const char *salt);
#endif
#ifndef initgroups
int initgroups(char *, int);
#endif
#ifndef strncasecmp
#define strncasecmp strnicmp
#endif
#undef NO_KILLPG
#undef NO_SETSID
#define NEED_INITGROUPS
#define NEED_SELECT_H
#define NEED_PROCESS_H
#include <unix.h>
#define HAVE_MMAP 1
#define USE_POSIX_SCOREBOARD
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
#define HAVE_SYSLOG 1

#elif defined(LYNXOS)
#undef HAVE_GMTOFF
#undef USE_MMAP_SCOREBOARD
#undef USE_SHMGET_SCOREBOARD
#undef HAVE_FCNTL_SERIALIZED_ACCEPT
#undef HAVE_FLOCK_SERIALIZED_ACCEPT
#define HAVE_NONE_SERIALIZED_ACCEPT
#define USE_LONGJMP
#undef NO_KILLPG
#undef NO_SETSID
#undef NO_USE_SIGACTION
#undef NO_LINGCLOSE
extern char *crypt(char *pw, char *salt);
typedef int rlim_t;
#define HAVE_SYSLOG 1

#elif defined(UXPDS)
#undef NEED_STRCASECMP
#undef NEED_STRNCASECMP
#undef NEED_STRDUP
#undef HAVE_GMTOFF
#define NO_KILLPG
#undef NO_SETSID
#define bzero(a,b) memset(a,0,b)
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#define HAVE_SYSLOG 1

#elif defined(OS2)
/* Defines required for EMX OS/2 port. */
#define NO_KILLPG
#define NEED_STRCASECMP
#define NEED_STRNCASECMP
#define NEED_PROCESS_H
#define NO_SETSID
#define NO_TIMES
#define CASE_BLIND_FILESYSTEM
/* Add some drive name support */
#define chdir _chdir2
#include <sys/time.h>
#define MAXSOCKETS 2048
#define USE_OS2_SCOREBOARD
#define NO_RELIABLE_PIPED_LOGS
#define HAVE_OS2SEM_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
#define NO_SLACK
#define FOPEN_REQUIRES_T

#elif defined(__MACHTEN__)
typedef int rlim_t;
#undef NO_KILLPG
#define NO_SETSID
#define HAVE_GMTOFF 1
#ifndef __MACHTEN_PPC__
#ifndef __MACHTEN_68K__
#define __MACHTEN_68K__
#endif
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#define NO_USE_SIGACTION
#define JMP_BUF sigjmp_buf
#define USE_LONGJMP
#undef NEED_STRDUP
#else
#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#endif

/* Convex OS v11 */
#elif defined(CONVEXOS11)
#undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#undef NEED_STRDUP
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#define HAVE_SYSLOG 1

#define NO_TIMEZONE
#include <stdio.h>
#include <sys/types.h>
typedef int rlim_t;

#elif defined(ISC)
#include <net/errno.h>
#define NO_KILLPG
#undef NO_SETSID
#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_SYSLOG 1

#elif defined(NEWSOS)
#define HAVE_SHMGET 1
#define USE_SHMGET_SCOREBOARD
#define USE_LONGJMP
#define NO_SETSID
#define NO_USE_SIGACTION
#define NEED_WAITPID
#define NO_OTHER_CHILD
#define HAVE_SYSLOG 1
#include <sys/time.h>
#include <stdlib.h>
#include <sys/types.h>
typedef int pid_t;
typedef int rlim_t;
typedef int mode_t;

#elif defined(RISCIX)
#include <sys/time.h>
typedef int rlim_t;
#define NO_USE_SIGACTION
#define USE_LONGJMP
#define NEED_STRCASECMP
#define NEED_STRNCASECMP
#define NEED_STRDUP

#elif defined(BEOS)
#undef PLATFORM
#define PLATFORM "BeOS"
#include <stddef.h>
#include <kernel/OS.h>

#define HAVE_BEOS_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT

#define NO_WRITEV
#define NO_KILLPG
#define NEED_INITGROUPS
#define PF_INET AF_INET
#define S_IEXEC S_IXUSR

#elif defined(BONE)
#undef PLATFORM
#define PLATFORM "BeOS BONE"
#include <kernel/OS.h>

#define NO_KILLPG
#define NEED_INITGROUPS
#define S_IEXEC S_IXUSR
#define HAVE_BEOS_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT

#elif defined(_CX_SX)
#define JMP_BUF sigjmp_buf
#include <sys/types.h>
#include <sys/time.h>

#elif defined(WIN32)

/* All windows stuff is now in os/win32/os.h */

#elif defined(TPF) /* IBM Transaction Processing Facility operating system */

/* All TPF definitions are now in os/tpf/os.h */

#elif defined(__TANDEM)
#define NO_WRITEV
#define NO_KILLPG
#define NEED_INITGROUPS
#define NO_SLACK

#elif defined(OS390)                /* IBM OS/390 Operating System      */
#define HAVE_MMAP
#define HAVE_SHMGET
#define USE_SHMGET_SCOREBOARD
#define USE_MMAP_FILES
#define NEED_UNION_SEMUN
#define HAVE_SYSVSEM_SERIALIZED_ACCEPT
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define _POSIX_SOURCE
#include <signal.h>
#ifdef SIGDUMP  /* SIGDUMP is not defined by OS/390 v1r2 */
#define NSIG SIGDUMP+1
#else
#define NSIG 40
#endif
#define JMP_BUF sigjmp_buf
#define _XOPEN_SOURCE_EXTENDED 1
#define _OPEN_MSGQ_EXT
#define _XOPEN_SOURCE
#define SHM_R S_IRUSR
#define SHM_W S_IWUSR
#include <sys/time.h>
#include <sys/types.h>
#include <sys/msg.h>
#include <sys/socket.h>
#define NET_SIZE_T size_t
#define NEED_HASHBANG_EMUL
#define NONBLOCK_WHEN_MULTI_LISTEN

#elif defined(CYGWIN)               /* Cygwin 1.x POSIX layer for Win32 */
#define SYSTEM_UID 18
#define JMP_BUF jmp_buf
#define NO_KILLPG
#define NO_SETSID
#define USE_LONGJMP
#define GDBM_STATIC
#define HAVE_MMAP 1
#define USE_MMAP_SCOREBOARD
#define USE_MMAP_FILES
#define HAVE_SYSLOG 1
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_PTHREAD_SERIALIZED_ACCEPT
#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
#if !defined(USE_FCNTL_SERIALIZED_ACCEPT)
#define USE_PTHREAD_SERIALIZED_ACCEPT
#endif

#elif defined(NETWARE)
#define NONBLOCK_WHEN_MULTI_LISTEN

#else
/* Unknown system - Edit these to match */
#ifdef BSD
#define HAVE_GMTOFF 1
#else
#undef HAVE_GMTOFF
#endif
/* NO_KILLPG is set on systems that don't have killpg */
#undef NO_KILLPG
/* NO_SETSID is set on systems that don't have setsid */
#undef NO_SETSID
/* NEED_STRDUP is set on stupid systems that don't have strdup. */
#undef NEED_STRDUP
#endif

#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */

/* stuff marked API_EXPORT is part of the API, and intended for use
 * by modules
 */
#ifndef API_EXPORT
#define API_EXPORT(type)    type
#endif

/* Stuff marked API_EXPORT_NONSTD is part of the API, and intended for
 * use by modules.  The difference between API_EXPORT and
 * API_EXPORT_NONSTD is that the latter is required for any functions
 * which use varargs or are used via indirect function call.  This
 * is to accomodate the two calling conventions in windows dlls.
 */
#ifndef API_EXPORT_NONSTD
#define API_EXPORT_NONSTD(type)    type
#endif

#ifndef MODULE_VAR_EXPORT
#define MODULE_VAR_EXPORT
#endif
#ifndef API_VAR_EXPORT
#define API_VAR_EXPORT
#endif

/* modules should not used functions marked CORE_EXPORT
 * or CORE_EXPORT_NONSTD */
#ifndef CORE_EXPORT
#define CORE_EXPORT	API_EXPORT
#endif
#ifndef CORE_EXPORT_NONSTD
#define CORE_EXPORT_NONSTD	API_EXPORT_NONSTD
#endif

/* On Darwin, symbols that conflict with loaded dylibs
 * (eg. System framework) need to be declared as private symbols with
 * __private_extern__.
 * For other systems, make that a no-op.
 */
#if defined(DARWIN) && defined(__DYNAMIC__)
#define ap_private_extern __private_extern__
#else
#define ap_private_extern
#endif

/*
 * The particular directory style your system supports. If you have dirent.h
 * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include 
 * that file and define DIR_TYPE to be dirent. Otherwise, if you have 
 * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
 * file. If you have neither, I'm confused.
 */

#ifndef NETWARE
#include <sys/types.h>
#endif
#include <stdarg.h>

#if !defined(NEXT) && !defined(WIN32)
#include <dirent.h>
#define DIR_TYPE dirent
#elif !defined(WIN32)
#include <sys/dir.h>
#define DIR_TYPE direct
#else
#define DIR_TYPE dirent
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __TANDEM
#include <strings.h>
#endif
#include "ap_ctype.h"
#if !defined(MPE) && !defined(WIN32) && !defined(TPF41) && !defined(__TANDEM) && !defined(NETWARE)
#include <sys/file.h>
#endif
#if !defined(WIN32) && !defined(NETWARE)
#include <sys/socket.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif /* HAVE_SYS_SELECT_H */
#ifndef TPF41
#include <netinet/in.h>
#endif /* ndef TPF41 */
#if defined(OS390) && !defined(NO_ADDRESS)
#define NO_ADDRESS NO_DATA  /* Not defined properly by OS/390 v1r2 */
#endif
#include <netdb.h>
#include <sys/ioctl.h>
#if !defined(MPE) && !defined(BEOS) && !defined(TPF41)
#include <arpa/inet.h>		/* for inet_ntoa */
#endif
#include <sys/wait.h>
#include <pwd.h>
#include <grp.h>
#include <fcntl.h>
#ifndef BEOS
#define closesocket(s) close(s)
#endif
#ifndef O_BINARY
#define O_BINARY (0)
#endif
#endif /* ndef WIN32 */

#include <limits.h>
#include <time.h>		/* for ctime */
#ifdef WIN32
#define strftime(s,max,format,tm)  os_strftime(s,max,format,tm)
#endif
#include <signal.h>
#ifdef NETWARE
#undef SIGKILL
#undef SA_NOCLDSTOP
#undef SIGALRM
#undef SIGCHILD
#undef SIGCONT
#undef SIGHUP
#undef SIGPIPE
#undef SIGQUIT
#undef SIGSTOP
#undef SIGTSTP
#undef SIGTTIN
#undef SIGTTOU
#undef SIGUSR1
#undef SIGUSR2
#undef SIG_BLOCK
#undef SIG_SETMASK
#undef SIG_UNBLOCK
#endif
#if defined(TPF41) && defined(NSIG)
#undef NSIG
#endif
#include <errno.h>
#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF41) && !defined(NETWARE) && !defined(MPE)
#include <memory.h>
#endif

#ifdef NEED_PROCESS_H
#include <process.h>
#endif

#if defined(WIN32) || defined(USE_HSREGEX)
#include "hsregex.h"
#else
#include <regex.h>
#endif

#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#ifdef SUNOS4
int getrlimit(int, struct rlimit *);
int setrlimit(int, struct rlimit *);
#endif
#endif
#ifdef USE_MMAP_SCOREBOARD
#if !defined(OS2) && !defined(WIN32)
/* This file is not needed for OS/2 */
#include <sys/mman.h>
#endif
#endif
#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
#define MAP_ANON MAP_ANONYMOUS
#endif

#if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
#undef USE_MMAP_FILES
#endif

#if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
#undef USE_MMAP_SCOREBOARD
#endif

#if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET))
#undef USE_SHMGET_SCOREBOARD
#endif

/* A USE_FOO_SERIALIZED_ACCEPT implies a HAVE_FOO_SERIALIZED_ACCEPT */
#if defined(USE_USLOCK_SERIALIZED_ACCEPT) && !defined(HAVE_USLOCK_SERIALIZED_ACCEPT)
#define HAVE_USLOCK_SERIALIZED_ACCEPT
#endif
#if defined(USE_PTHREAD_SERIALIZED_ACCEPT) && !defined(HAVE_PTHREAD_SERIALIZED_ACCEPT)
#define HAVE_PTHREAD_SERIALIZED_ACCEPT
#endif
#if defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && !defined(HAVE_SYSVSEM_SERIALIZED_ACCEPT)
#define HAVE_SYSVSEM_SERIALIZED_ACCEPT
#endif
#if defined(USE_FCNTL_SERIALIZED_ACCEPT) && !defined(HAVE_FCNTL_SERIALIZED_ACCEPT)
#define HAVE_FCNTL_SERIALIZED_ACCEPT
#endif
#if defined(USE_FLOCK_SERIALIZED_ACCEPT) && !defined(HAVE_FLOCK_SERIALIZED_ACCEPT)
#define HAVE_FLOCK_SERIALIZED_ACCEPT
#endif
#if defined(USE_OS2SEM_SERIALIZED_ACCEPT) && !defined(HAVE_OS2SEM_SERIALIZED_ACCEPT)
#define HAVE_OS2SEM_SERIALIZED_ACCEPT
#endif
#if defined(USE_TPF_CORE_SERIALIZED_ACCEPT) && !defined(HAVE_TPF_CORE_SERIALIZED_ACCEPT)
#define HAVE_TPF_CORE_SERIALIZED_ACCEPT
#endif
#if defined(USE_BEOS_SERIALIZED_ACCEPT) && !defined(HAVE_BEOS_SERIALIZED_ACCEPT)
#define HAVE_BEOS_SERIALIZED_ACCEPT
#endif
#if defined(USE_NONE_SERIALIZED_ACCEPT) && !defined(HAVE_NONE_SERIALIZED_ACCEPT)
#define HAVE_NONE_SERIALIZED_ACCEPT
#endif

#ifndef LOGNAME_MAX
#define LOGNAME_MAX 25
#endif

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

#ifdef ultrix
#define ULTRIX_BRAIN_DEATH
#endif

#ifndef S_ISLNK
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#endif

#ifndef INADDR_NONE
#define INADDR_NONE ((unsigned long) -1)
#endif

/*
 * Replace signal function with sigaction equivalent
 */
#ifndef NO_USE_SIGACTION
typedef void Sigfunc(int);

#if defined(SIG_IGN) && !defined(SIG_ERR)
#define SIG_ERR ((Sigfunc *)-1)
#endif

/*
 * For some strange reason, QNX defines signal to signal. Eliminate it.
 */
#ifdef signal
#undef signal
#endif
#define signal(s,f)	ap_signal(s,f)
Sigfunc *signal(int signo, Sigfunc * func);
#endif

#include <setjmp.h>

#if defined(USE_LONGJMP)
#define ap_longjmp(x, y)        longjmp((x), (y))
#define ap_setjmp(x)            setjmp(x)
#ifndef JMP_BUF
#define JMP_BUF jmp_buf
#endif
#else
#define ap_longjmp(x, y)        siglongjmp((x), (y))
#define ap_setjmp(x)            sigsetjmp((x), 1)
#ifndef JMP_BUF
#define JMP_BUF sigjmp_buf
#endif
#endif

/* Majority of os's want to verify FD_SETSIZE */
#if !defined(WIN32) && !defined(TPF) && !defined(NETWARE)
#define CHECK_FD_SETSIZE
#endif

#ifdef USE_TPF_SELECT
#define ap_select(_a, _b, _c, _d, _e)	\
	tpf_select(_a, _b, _c, _d, _e)
#elif defined(SELECT_NEEDS_CAST)
#define ap_select(_a, _b, _c, _d, _e)   \
    select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e))
#else
#define ap_select(_a, _b, _c, _d, _e)   \
	select(_a, _b, _c, _d, _e)
#endif

#ifdef USE_TPF_ACCEPT
#define ap_accept(_fd, _sa, _ln)	tpf_accept(_fd, _sa, _ln)
#else
#define ap_accept(_fd, _sa, _ln)	accept(_fd, _sa, _ln)
#endif

#ifdef NEED_SIGNAL_INTERRUPT
#define ap_check_signals()	tpf_process_signals()
#else
#define ap_check_signals()
#endif

#ifdef ULTRIX_BRAIN_DEATH
#define ap_fdopen(d,m) fdopen((d), (char *)(m))
#else
#define ap_fdopen(d,m) fdopen((d), (m))
#endif

#ifndef ap_inet_addr
#define ap_inet_addr inet_addr
#endif

#ifdef NO_OTHER_CHILD
#define NO_RELIABLE_PIPED_LOGS
#endif

/* When the underlying OS doesn't support exec() of scripts which start
 * with a HASHBANG (#!) followed by interpreter name and args, define this.
 */
#ifdef NEED_HASHBANG_EMUL
extern int ap_execle(const char *filename, const char *arg,...);
extern int ap_execve(const char *filename, char * const argv[],
                     char * const envp[]);
/* ap_execle() is a wrapper function around ap_execve(). */
#define execle  ap_execle
#define execve(path,argv,envp)  ap_execve(path,argv,envp)
#endif

/* Finding offsets of elements within structures.
 * Taken from the X code... they've sweated portability of this stuff
 * so we don't have to.  Sigh...
 */

#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
#ifdef __STDC__
#define XtOffset(p_type,field) _Offsetof(p_type,field)
#else
#ifdef CRAY2
#define XtOffset(p_type,field) \
	(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))

#else /* !CRAY2 */

#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))

#endif /* !CRAY2 */
#endif /* __STDC__ */
#else /* ! (CRAY || __arm) */

#define XtOffset(p_type,field) \
	((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))

#endif /* !CRAY */

#ifndef XtOffsetOf
#ifdef offsetof
#define XtOffsetOf(s_type,field) offsetof(s_type,field)
#else
#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
#endif
#endif

/*
 * NET_SIZE_T exists because of shortsightedness on the POSIX committee.  BSD
 * systems used "int *" as the parameter to accept(), getsockname(),
 * getpeername() et al.  Consequently many unixes took an int * for that
 * parameter.  The POSIX committee decided that "int" was just too generic and
 * had to be replaced with size_t almost everywhere.  There's no problem with
 * that when you're passing by value.  But when you're passing by reference
 * this creates a gross source incompatibility with existing programs.  On
 * 32-bit architectures it creates only a warning.  On 64-bit architectures it
 * creates broken code -- because "int *" is a pointer to a 64-bit quantity and
 * "size_t *" is frequently a pointer to a 32-bit quantity.
 *
 * Some Unixes adopted "size_t *" for the sake of POSIX compliance.  Others
 * ignored it because it was such a broken interface.  Chaos ensued.  POSIX
 * finally woke up and decided that it was wrong and created a new type
 * socklen_t.  The only useful value for socklen_t is int, and that's how
 * everyone who has a clue implements it.  It is almost always the case that
 * NET_SIZE_T should be defined to be an int, unless the system being compiled
 * for was created in the window of POSIX madness.
 */
#ifndef NET_SIZE_T
#define NET_SIZE_T int
#endif

/* Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD
 * is in use... we'd prefer to just use WCOREDUMP everywhere.
 */
#if defined(__WCOREDUMP) && !defined(WCOREDUMP)
#define WCOREDUMP __WCOREDUMP
#endif

#ifdef SUNOS_LIB_PROTOTYPES
/* Prototypes needed to get a clean compile with gcc -Wall.
 * Believe it or not, these do have to be declared, at least on SunOS,
 * because they aren't mentioned in the relevant system headers.
 * Sun Quality Software.  Gotta love it.  This section is not 
 * currently (13Nov97) used.
 */

int getopt(int, char **, char *);

int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, int);
int toupper(int);
int tolower(int);

int printf(char *,...);
int fprintf(FILE *, char *,...);
int fputs(char *, FILE *);
int fread(char *, int, int, FILE *);
int fwrite(char *, int, int, FILE *);
int fgetc(FILE *);
char *fgets(char *s, int, FILE*);
int fflush(FILE *);
int fclose(FILE *);
int ungetc(int, FILE *);
int _filbuf(FILE *);	/* !!! */
int _flsbuf(unsigned char, FILE *);	/* !!! */
int sscanf(char *, char *,...);
void setbuf(FILE *, char *);
void perror(char *);

time_t time(time_t *);
int strftime(char *, int, const char *, struct tm *);

int initgroups(char *, int);
int wait3(int *, int, void *);	/* Close enough for us... */
int lstat(const char *, struct stat *);
int stat(const char *, struct stat *);
int flock(int, int);
#ifndef NO_KILLPG
int killpg(int, int);
#endif
int socket(int, int, int);
int setsockopt(int, int, int, const char *, int);
int listen(int, int);
int bind(int, struct sockaddr *, int);
int connect(int, struct sockaddr *, int);
int accept(int, struct sockaddr *, int *);
int shutdown(int, int);

int getsockname(int s, struct sockaddr *name, int *namelen);
int getpeername(int s, struct sockaddr *name, int *namelen);
int gethostname(char *name, int namelen);
void syslog(int, char *,...);
char *mktemp(char *);

int vfprintf(FILE *, const char *, va_list);

#endif /* SUNOS_LIB_PROTOTYPES */

/* The assumption is that when the functions are missing,
 * then there's no matching prototype available either.
 * Declare what is needed exactly as the replacement routines implement it.
 */
#ifdef NEED_STRDUP
extern char *strdup (const char *str);
#endif
#ifdef NEED_STRCASECMP
extern int strcasecmp (const char *a, const char *b);
#endif
#ifdef NEED_STRNCASECMP
extern int strncasecmp (const char *a, const char *b, int n);
#endif
#ifdef NEED_INITGROUPS
extern int initgroups(const char *name, gid_t basegid);
#endif
#ifdef NEED_WAITPID
extern int waitpid(pid_t pid, int *statusp, int options);
#endif
#ifdef NEED_STRERROR
extern char *strerror (int err);
#endif
#ifdef NEED_DIFFTIME
extern double difftime(time_t time1, time_t time0);
#endif

#ifndef ap_wait_t
#define ap_wait_t int
#endif

#ifdef __cplusplus
}
#endif

#endif /* !AP_CONFIG_H */