forked from cherokee/webserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1671 lines (1433 loc) · 45.7 KB
/
configure.in
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
dnl -*- mode: m4-mode -*-
dnl Process this file with autoconf to produce a configure script.
AC_COPYRIGHT([
Copyright (C) 2001-2012 Alvaro Lopez Ortega
This program is free software; you can redistribute it and/or
modify it under the terms of version 2 of the GNU General Public
License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
])
dnl require autoconf 2.60
AC_PREREQ([2.60])
dnl Version
m4_define([cherokee_major_version], [1])
m4_define([cherokee_minor_version], [2])
m4_define([cherokee_micro_version], [102])
m4_define([cherokee_version], m4_format('%s.%s.%s', cherokee_major_version, cherokee_minor_version, cherokee_micro_version))
dnl Init autoconf and automake
AC_INIT([cherokee], [cherokee_version], [http://bugs.cherokee-project.com/], [cherokee])
AC_CONFIG_SRCDIR([cherokee/server.c])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([no-define])
dnl Define version
AC_DEFINE(PACKAGE_MAJOR_VERSION, "cherokee_major_version", [Version string])
AC_DEFINE(PACKAGE_MINOR_VERSION, "cherokee_minor_version", [Version string])
AC_DEFINE(PACKAGE_MICRO_VERSION, "cherokee_micro_version", [Version string])
PACKAGE_MAJOR_VERSION="cherokee_major_version"
PACKAGE_MINOR_VERSION="cherokee_minor_version"
PACKAGE_MICRO_VERSION="cherokee_micro_version"
AC_SUBST(PACKAGE_MAJOR_VERSION)
AC_SUBST(PACKAGE_MINOR_VERSION)
AC_SUBST(PACKAGE_MICRO_VERSION)
dnl Define library soname
CHEROKEE_AGE=0
CHEROKEE_CURRENT=0
CHEROKEE_REVISION=1
AC_SUBST(CHEROKEE_AGE)
AC_SUBST(CHEROKEE_CURRENT)
AC_SUBST(CHEROKEE_REVISION)
AC_DEFINE_UNQUOTED(CHEROKEE_CONFIG_ARGS, "$ac_configure_args", [configure arguments])
dnl Check the SVN revision
AC_ARG_ENABLE(beta, AC_HELP_STRING([--enable-beta], [Enable beta development]),
is_beta="$enableval", is_beta="no")
if test x"$is_beta" = "xyes"; then
dnl Figure revision
today=`date +'%y%m%d'`
git_hash=`git log -1 --pretty=tformat:%h`
PACKAGE_PATCH_VERSION="b${today}_${git_hash}"
dnl Redefine versions
PACKAGE_VERSION="$PACKAGE_MAJOR_VERSION.$PACKAGE_MINOR_VERSION.$PACKAGE_MICRO_VERSION$PACKAGE_PATCH_VERSION"
AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "${PACKAGE_VERSION}", [Package version])
VERSION="$PACKAGE_MAJOR_VERSION.$PACKAGE_MINOR_VERSION.$PACKAGE_MICRO_VERSION$PACKAGE_PATCH_VERSION"
AC_DEFINE(VERSION, $VERSION, [Software version])
else
PACKAGE_PATCH_VERSION=""
fi
dnl Path version
AC_SUBST(PACKAGE_PATCH_VERSION)
AC_DEFINE_UNQUOTED(PACKAGE_PATCH_VERSION, "${PACKAGE_PATCH_VERSION}", [Version string])
dnl Initial CFLAGS
AC_MSG_CHECKING(initial CFLAGS)
AC_MSG_RESULT($CFLAGS)
dnl Check for CPU / vendor / OS
AC_CANONICAL_HOST
os_string="UNIX"
so_suffix=so
mod_suffix=$so_suffix
AC_MSG_CHECKING([host platform characteristics])
case "$host" in
*-*-mingw*|*-*-cygwin*)
so_suffix=DLL
mod_suffix=$so_suffix
os_string="Win32"
libdl=
;;
*-*-linux*)
libdl="-ldl"
;;
*-*-solaris*)
AC_DEFINE(SOLARIS, 1, [It is Solaris])
setenv_is_threadsafe="yes"
libdl="-ldl"
;;
*-*-hpux*)
libdl="-ldl"
;;
*-*-aix*)
libdl="-ldl"
;;
*-*-irix6*)
AC_DEFINE(IRIX, 1, [It is SGI Irix])
setenv_is_threadsafe="yes"
libdl="-ldl"
;;
*-*-*freebsd*|*-*-*openbsd*|*-*-*netbsd*|*-*-*dragonfly*)
libdl=
;;
*-*-darwin*)
so_suffix=dylib
mod_suffix=so
libdl="-ldl"
;;
*)
AC_MSG_WARN([*** Please add $host to configure.in checks!])
libdl="-ldl"
;;
esac
AC_MSG_RESULT(ok)
AC_MSG_CHECKING([L2 cache line size])
case "$host_cpu" in
i386|i486)
CPU_CACHE_LINE=32
;;
i586|i686)
CPU_CACHE_LINE=64
;;
i786)
CPU_CACHE_LINE=128
;;
athlon)
CPU_CACHE_LINE=64
;;
x86_64)
CPU_CACHE_LINE=64
;;
sparc*)
CPU_CACHE_LINE=64
;;
powerpc)
CPU_CACHE_LINE=128
;;
*)
CPU_CACHE_LINE=128
;;
esac
AC_DEFINE_UNQUOTED(CPU_CACHE_LINE, $CPU_CACHE_LINE, [L2 cache line size])
AC_MSG_RESULT($CPU_CACHE_LINE)
dnl
dnl OS string
dnl
AC_ARG_ENABLE(os_string, AC_HELP_STRING([--enable-os-string=STR], [Set a customized OS type string]), [os_string="$enableval"])
AC_DEFINE_UNQUOTED(OS_TYPE, "${os_string}", [OS type])
AM_CONDITIONAL(PLATFORM_WIN32, test x"$os_string" = "xWin32")
dnl
dnl Tracing
dnl
AC_ARG_ENABLE(trace, AC_HELP_STRING([--enable-trace], [Enable trace facility]),
[enable_trace="$enableval"
AC_DEFINE(TRACE_ENABLED, 1, [Trace facility])
], [enable_trace="no"])
dnl
dnl Backtraces
dnl
AC_ARG_ENABLE(backtraces, AC_HELP_STRING([--enable-backtraces], [Enable backtraces on error]),
[enable_backtraces="$enableval"
AC_DEFINE(BACKTRACES_ENABLED, 1, [Backtracing facility])
], [enable_backtraces="no"])
dnl
dnl Dynamic library loading library
dnl
LIBS="$LIBS $libdl"
AC_DEFINE_UNQUOTED(SO_SUFFIX, "${so_suffix}", [Dynamic loading libraries extension])
AC_DEFINE_UNQUOTED(MOD_SUFFIX, "${mod_suffix}", [Dynamic modules extension])
dnl
dnl Libtool options
dnl
if test "$os_string" != "Win32"; then
# libtool option to control which symbols are exported
# right now, symbols starting with _ are not exported
LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
else
LIBTOOL_EXPORT_OPTIONS=
fi
AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
dnl Set the Version
AM_INIT_AUTOMAKE(cherokee, $VERSION)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)
AC_SUBST(VERSION)
dnl Initialize Libtool
m4_ifdef([LT_INIT],
[LT_INIT([dlopen shared static win32-dll])],
[AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
])
dnl Paths
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL
AC_PATH_PROG(cherokeepath, cherokee)
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_VPRINTF
AC_C_CONST
AC_C_BIGENDIAN
AC_C_INLINE
if test "$ac_cv_c_inline" != no; then
AC_DEFINE(HAVE_INLINE, 1, [Compile supports inline])
fi
dnl
dnl Check for headers
dnl
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(endian.h machine/endian.h sys/machine.h sys/endian.h sys/isa_defs.h sys/utsname.h sys/poll.h poll.h )
AC_CHECK_HEADERS(sys/socket.h sys/un.h netinet/in.h arpa/inet.h netinet/tcp.h sys/ioctl.h fcntl.h sys/ofcntl.h sys/time.h)
AC_CHECK_HEADERS(sys/resource.h resource.h unistd.h syslog.h stdint.h inttypes.h error.h pwd.h sys/uio.h)
AC_CHECK_HEADERS(pthread.h netdb.h stdarg.h sys/filio.h sys/varargs.h sys/select.h sys/mman.h sys/uio.h grp.h winsock.h)
AC_CHECK_HEADERS(winsock.h winsock2.h sched.h execinfo.h)
AC_SYS_LARGEFILE
AC_SIZE_T
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_STRUCT_ST_RDEV
AC_CHECK_TYPE(ino_t, unsigned)
AC_CHECK_TYPE(loff_t, off_t)
AC_CHECK_TYPE(offset_t, loff_t)
AC_CHECK_TYPE(ssize_t, int)
AC_CHECK_TYPE(wchar_t, unsigned short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(sig_atomic_t)
AC_CHECK_SIZEOF(time_t)
AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
AC_TRY_RUN([#include <stdio.h>
main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
if test x"$samba_cv_have_longlong" = x"yes"; then
AC_DEFINE(HAVE_LONGLONG,1,[Whether the host supports long long'])
fi
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_FORK
AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir readdir_r flockfile funlockfile strnstr backtrace random srandom srandomdev)
FW_CHECK_PWD
FW_CHECK_GRP
AC_CHECK_MEMBER(struct tm.tm_gmtoff,
AC_DEFINE([HAVE_STRUCT_TM_GMTOFF],[1],[gmtoff in struct tm]),,[#include <time.h>])
AH_BOTTOM([
/* Give us an unsigned 32-bit data type. */
#if SIZEOF_UNSIGNED_LONG==4
#define UWORD32 unsigned long
#elif SIZEOF_UNSIGNED_INT==4
#define UWORD32 unsigned int
#else
#error I do not know what to use for a UWORD32.
#endif
])
dnl Find socket()
dnl Likely combinations:
dnl -lsocket [ -lnsl_s | -lnsl ]
dnl -linet
AC_CHECK_LIB(ws2_32, main)
AC_CHECK_LIB(advapi32, main)
AC_CHECK_FUNC(socket, :, [
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(net, main)
AC_CHECK_LIB(nsl_s, main)
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(inet, socket)
AC_CHECK_LIB(gen, main)
])
AC_SEARCH_LIBS(accept, socket)
AC_SEARCH_LIBS(bind, socket)
AC_SEARCH_LIBS(listen, socket)
AC_SEARCH_LIBS(setsockopt, socket)
dnl
dnl Check for fd events inspect functions
dnl
AC_CHECK_FUNC(poll, have_poll=yes)
AC_CHECK_FUNC(kqueue, have_kqueue=yes)
AC_CHECK_FUNC(select, have_select=yes)
if test "x-$have_select" != "x-yes" -a "x-$ac_cv_header_winsock2_h" = "x-yes"; then
AC_MSG_CHECKING([for select in ws2_32])
AC_TRY_LINK([#include <winsock2.h>],
[select(0,0,0,0,0)],
[AC_MSG_RESULT(yes)
have_win32_select=yes],
[AC_MSG_RESULT(no)])
fi
dnl
dnl Epoll
dnl
AC_CHECK_HEADER(sys/epoll.h, have_epoll_include=yes, have_epoll_include=no)
AC_ARG_ENABLE(epoll, AC_HELP_STRING([--disable-epoll],[Disable epoll() support]),
wants_epoll="$enableval", wants_epoll="yes")
have_epoll=no
if test "x$have_epoll_include" = "xyes" && test "x$wants_epoll" = "xyes"; then
AC_MSG_CHECKING(for epoll system call)
AC_RUN_IFELSE([
#include <stdint.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/epoll.h>
#include <unistd.h>
int epoll_create (int size) {
return (syscall(__NR_epoll_create, size));
}
int main (int argc, char **argv) {
int epfd;
epfd = epoll_create(256);
exit (epfd == -1 ? 1 : 0);
}
],
have_epoll=yes,
have_epoll=no,
have_epoll=yes)
AC_MSG_RESULT($have_epoll)
fi
dnl
dnl Solaris 10: Event ports
dnl
AC_CHECK_HEADER(port.h, have_port_include=yes, have_port_include=no)
have_port=no
if test "x$have_port_include" = "xyes"; then
AC_MSG_CHECKING(for event ports support)
AC_RUN_IFELSE([
#include <stdint.h>
#include <unistd.h>
#include <port.h>
int main (int argc, char **argv) {
int port;
port = port_create();
exit (port < 0 ? 1 : 0);
}
],
have_port=yes,
have_port=no,
have_port=cross)
AC_MSG_RESULT($have_port)
fi
if test "$have_epoll" = yes; then
AC_DEFINE(HAVE_EPOLL, 1, [Have epoll])
fi
AM_CONDITIONAL(COMPILE_EPOLL, test x"$have_epoll" = "xyes")
if test "$have_kqueue" = yes; then
AC_DEFINE(HAVE_KQUEUE, 1, [Have kqueue])
fi
AM_CONDITIONAL(COMPILE_KQUEUE, test x"$have_kqueue" = "xyes")
if test "$have_port" = yes; then
AC_DEFINE(HAVE_PORT, 1, [Have event ports])
fi
AM_CONDITIONAL(COMPILE_PORT, test x"$have_port" = "xyes")
if test "$have_poll" = yes; then
AC_DEFINE(HAVE_POLL, 1, [Have poll])
fi
AM_CONDITIONAL(COMPILE_POLL, test x"$have_poll" = "xyes")
if test "$have_win32_select" = yes; then
AC_DEFINE(HAVE_WIN32_SELECT, 1, [Have Win32 select])
fi
AM_CONDITIONAL(COMPILE_WIN32_SELECT, test x"$have_win32_select" = "xyes")
if test "$have_select" = yes; then
AC_DEFINE(HAVE_SELECT, 1, [Have select])
fi
AM_CONDITIONAL(COMPILE_SELECT, test x"$have_select" = "xyes" -a x"$have_win32_select" != "xyes")
dnl
dnl Check for inet_pton. We have our own, but on Solaris the version in
dnl libresolv is more lenient in ways that Solaris's internal DNS resolution
dnl code requires, so if we use our own *and* link with libresolv (which may
dnl be forced by Perl) DNS resolution fails.
dnl
AC_SEARCH_LIBS(inet_pton, [socket nsl resolv])
AC_CHECK_FUNCS(inet_pton inet_ntop inet_addr)
AC_SEARCH_LIBS(gethostbyname, [socket nsl resolv])
AC_CHECK_FUNCS(gethostbyname gethostbyname_r)
AC_CHECK_HEADER(sys/utsname.h)
AC_CHECK_FUNCS(gethostname uname)
dnl
dnl Check for inet_addr
dnl
AC_SEARCH_LIBS(inet_addr, xnet)
AC_CHECK_FUNCS(inet_addr)
dnl
dnl TCP_CORK
dnl
HYDRA_TCP_CORK
HYDRA_TCP_NOPUSH
dnl
dnl Check for GNU getopt_long()
dnl
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_FUNC(getopt_long, have_getopt_long="yes")
AM_CONDITIONAL(HAVE_GETOPT_LONG, test "x$have_getopt_long" = "xyes")
dnl
dnl Pthread
dnl
with_pthread="yes"
have_pthread="no"
AC_ARG_ENABLE(pthread, AC_HELP_STRING([--disable-pthread],[Disable threading support]),
with_pthread="$enableval", with_pthread="yes")
AM_CONDITIONAL(USE_PTHREAD, test "x$with_pthread" = "xyes")
if test "x$with_pthread" = "xyes"
then
dnl
dnl Basic checkings (c&p'ed from squid)
dnl
AC_MSG_CHECKING([for special a pthread case])
oldcflags="$CFLAGS"
CFLAGS="$CFLAGS -D_REENTRANT"
PTHREAD_CFLAGS="-D_REENTRANT"
case "$host" in
i386-unknown-freebsd*)
if test "$GCC" = "yes" ; then
if test -z "$PRESET_LDFLAGS"; then
PTHREAD_LIBS="-pthread"
have_pthread="yes"
fi
fi
AC_MSG_RESULT([-pthread])
;;
*-solaris2.*)
if test "$GCC" = "yes" ; then
CFLAGS="$CFLAGS -pthreads"
PTHREAD_CFLAGS="-pthreads"
AC_MSG_RESULT([-pthreads])
else
CFLAGS="$CFLAGS -mt"
PTHREAD_CFLAGS="-mt"
AC_MSG_RESULT([-mt])
fi
have_pthread="yes"
;;
*)
AC_MSG_RESULT([no])
;;
esac
if test "$have_pthread" != "yes"; then
AC_CHECK_LIB(pthread, main, have_pthread=yes, have_pthread=no)
if test "$have_pthread" = "yes"; then
PTHREAD_LIBS="-lpthread"
fi
fi
dnl
dnl More detailed checks on the pthread support
dnl
AC_MSG_CHECKING([for pthread_rwlock_t support])
have_pthread_rwlock_t=yes
AC_TRY_COMPILE([#include <pthread.h>],
[pthread_rwlock_t rwlock; pthread_rwlock_init( &rwlock, NULL);],
compiled=yes, compiled=no)
if test "$compiled" = "yes"; then
AC_MSG_RESULT([ok])
else
dnl Didn't find rwlock_t.
dnl Try defining _XOPEN_SOURCE=500
dnl
oldcflags2="$CFLAGS"
CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500"
AC_TRY_COMPILE([#include <pthread.h>],
[pthread_rwlock_t rwlock; pthread_rwlock_init( &rwlock, NULL);],
compiled=yes, compiled=no)
if test "$compiled" = "yes"; then
AC_MSG_RESULT([-D_XOPEN_SOURCE=500])
PTHREAD_CFLAGS="-D_XOPEN_SOURCE=500"
else
have_pthread_rwlock_t=no
AC_MSG_RESULT([no])
fi
CFLAGS="$oldcflags2"
fi
if test "$have_pthread_rwlock_t" = "yes"; then
AC_DEFINE(HAVE_PTHREAD_RWLOCK_T, 1, [Define if your pthread library includes pthread_rwlock_t])
else
AC_MSG_ERROR([pthread_rwlock_t support missing])
fi
AC_CHECK_FUNC(pthread_attr_setschedpolicy, have_pthread_attr_setschedpolicy=yes)
if test x"$have_pthread_attr_setschedpolicy" = "xyes"; then
AC_DEFINE(HAVE_PTHREAD_SETSCHEDPOLICY, 1, [Pthread support pthread_attr_setschedpolicy])
fi
save_LIBS="$LIBS"
LIBS="$LIBS $PTHREAD_LIBS"
AC_CHECK_FUNCS(pthread_mutexattr_settype pthread_mutexattr_setkind_np)
dnl
dnl Yield
dnl
AC_CHECK_FUNCS(sched_yield, , [
AC_CHECK_LIB(rt, sched_yield, [
AC_DEFINE(HAVE_SCHED_YIELD)
PTHREAD_LIBS="$PTHREAD_LIBS -lrt"
],[
AC_CHECK_LIB(posix4, sched_yield, [
AC_DEFINE(HAVE_SCHED_YIELD)
PTHREAD_LIBS="$PTHREAD_LIBS -lposix4"
])])
])
LIBS="$save_LIBS"
CFLAGS="$oldcflags"
fi
if test "$have_pthread" = "yes"; then
AC_DEFINE(HAVE_PTHREAD, 1, [Have pthread support])
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
fi
dnl
dnl Is setenv() threadsafe?
dnl
if test "$setenv_is_threadsafe" = "yes"; then
AC_DEFINE(SETENV_IS_THREADSAFE, 1, [setenv function is thread safe])
fi
dnl
dnl Check for vsyslog
dnl
AC_CHECK_FUNCS(syslog vsyslog strsep strcasestr memmove strerror bcopy strlcat)
dnl
dnl Check for Glib (usually Linux)
dnl
AC_PREPROC_IFELSE([
#include <features.h>
#ifndef __GLIBC__
chokeme
#endif
], [
AC_DEFINE([HAVE_GLIBC], [1], [Define to 1 if you have glibc.])
AC_DEFINE([_GNU_SOURCE], [1], [Define to 1 if you have glibc.])
])
dnl
dnl Does this platform require array notation to assign to a va_list?
dnl If cross-compiling, we assume va_list is "normal". If this breaks
dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
dnl also just to be sure.
dnl
AC_MSG_CHECKING(whether va_list assignments need array notation)
AC_CACHE_VAL(ac_cv_valistisarray,
[AC_TRY_RUN([#include <stdlib.h>
#include <stdarg.h>
void foo(int i, ...) {
va_list ap1, ap2;
va_start(ap1, i);
ap2 = ap1;
if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123) { exit(1); }
va_end(ap1); va_end(ap2);
}
int main()
{ foo(0, 123); return(0); }],
[ac_cv_valistisarray=false],
[ac_cv_valistisarray=true],
[ac_cv_valistisarray=false])])
if test "$ac_cv_valistisarray" = true ; then
AC_DEFINE(HAVE_VA_LIST_AS_ARRAY,,[va_list works copying an array])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check if the global variable `timezone' exists. If so, define
dnl HAVE_INT_TIMEZONE.
dnl
AC_STRUCT_TIMEZONE
AC_MSG_CHECKING(for global timezone)
AC_TRY_LINK([#include <time.h>],
[int res; res = timezone / 60;],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INT_TIMEZONE,, [Set to 1 if you have the global variable timezone])],
AC_MSG_RESULT(no))
dnl
dnl Check for RTDL constants (from Haskell code)
dnl
dnl ** check for libdl & RTLD_NEXT
dnl ** sometimes RTLD_NEXT is hidden in #ifdefs we really don't wan to set
AC_MSG_CHECKING(for RTLD_NEXT from dlfcn.h)
AC_EGREP_CPP(yes,
[
#include <dlfcn.h>
#ifdef RTLD_NEXT
yes
#endif
], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_RTLDNEXT,,[Have RTDL_NEXT])
HaveRtldNext=YES
], [
AC_MSG_RESULT(no)
HaveRtldNext=NO
])
AC_SUBST(HaveRtldNext)
dnl ** RTLD_LOCAL isn't available on cygwin or openbsd
AC_MSG_CHECKING(for RTLD_LOCAL from dlfcn.h)
AC_EGREP_CPP(yes,
[
#include <dlfcn.h>
#ifdef RTLD_LOCAL
yes
#endif
], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_RTLDLOCAL,,[Have RTDL_LOCAL])
HaveRtldLocal=YES
], [
AC_MSG_RESULT(no)
HaveRtldLocal=NO
])
AC_SUBST(HaveRtldLocal)
dnl ** RTLD_GLOBAL isn't available on openbsd
AC_MSG_CHECKING(for RTLD_GLOBAL from dlfcn.h)
AC_EGREP_CPP(yes,
[
#include <dlfcn.h>
#ifdef RTLD_GLOBAL
yes
#endif
], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_RTLDGLOBAL,,[Have RTDL_GLOBAL])
HaveRtldGlobal=YES
], [
AC_MSG_RESULT(no)
HaveRtldGlobal=NO
])
AC_SUBST(HaveRtldGlobal)
dnl ** RTLD_NOW isn't available on openbsd
AC_MSG_CHECKING(for RTLD_NOW from dlfcn.h)
AC_EGREP_CPP(yes,
[
#include <dlfcn.h>
#ifdef RTLD_NOW
yes
#endif
], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_RTLDNOW,,[Have RTDL_NOW])
HaveRtldNow=YES
], [
AC_MSG_RESULT(no)
HaveRtldNow=NO
])
AC_SUBST(HaveRtldNow)
dnl
dnl Check of off64_t
dnl
AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
AC_TRY_RUN([
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <stdio.h>
#include <sys/stat.h>
main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
AC_DEFINE(HAVE_OFF64_T,1,[Whether off64_t is available])
fi
dnl
dnl SYSV Semaphores
dnl
AC_CHECK_HEADER(sys/sem.h, sysv_sem=yes, sysv_sem=no)
if test "x$sysv_sem" = "xyes"; then
AC_CHECK_FUNC(semget, , sysv_sem=no)
AC_CHECK_FUNC(semop, , sysv_sem=no)
AC_CHECK_FUNC(semctl, , sysv_sem=no)
fi
if test "x$sysv_sem" = xyes; then
AC_DEFINE(HAVE_SYSV_SEMAPHORES, 1, [Define to 1 to use SYSV semaphores])
fi
AM_CONDITIONAL(USE_SYSV_SEMAPHORES, test "x$sysv_sem" = xyes)
dnl union semun
dnl
AC_MSG_CHECKING([for union semun])
AC_CACHE_VAL(ac_cv_struct_semun, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>;
],[
union semun semdat;
],
ac_cv_struct_semun=yes,
ac_cv_struct_semun=no
)
])
AC_MSG_RESULT($ac_cv_struct_semun)
if test "$ac_cv_struct_semun" = "yes"; then
AC_DEFINE(HAVE_SEMUN, 1, [Define if sys/sem.h defines struct semun])
fi
# From etr_socket_nsl.m4
ETR_SOCKET_NSL
# From sendfile_samba.m4
SENDFILE_CHECK
# readdir_r()
LIBWWW_READDIR_R_TYPE
dnl
dnl IPv6 Support
dnl I got this mostly from Apache's tests
dnl
AC_ARG_ENABLE(ipv6,
AC_HELP_STRING([--disable-ipv6], [Disable IPv6 support]),
[ if test "$enableval" = "no"; then
disabled_ipv6=1
fi ],
[ disabled_ipv6=0 ] )
AC_SEARCH_LIBS(getaddrinfo, socket inet6)
AC_SEARCH_LIBS(getnameinfo, socket inet6)
AC_SEARCH_LIBS(gai_strerror, socket inet6)
AC_CHECK_FUNC(gai_strerror)
APR_CHECK_WORKING_GETADDRINFO
APR_CHECK_WORKING_GETNAMEINFO
AC_ACME_SOCKADDR_UN
AC_ACME_SOCKADDR_IN6
AC_ACME_SOCKADDR_STORAGE
AC_MSG_CHECKING(if the system supports IPv6)
have_ipv6="no"
if test "$disabled_ipv6" = 1; then
AC_MSG_RESULT([no -- disabled by user])
else
if test "x$ac_cv_acme_sockaddr_in6" = "xyes"; then
if test "x$ac_cv_working_getaddrinfo" = "xyes"; then
if test "x$ac_cv_working_getnameinfo" = "xyes"; then
have_ipv6="yes"
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6 support.])
else
AC_MSG_RESULT([no -- no getnameinfo])
fi
else
AC_MSG_RESULT([no -- no working getaddrinfo])
fi
else
AC_MSG_RESULT([no -- no sockaddr_in6])
fi
fi
dnl
dnl Test whether SO_RCVTIMEO is broken
dnl
AC_CACHE_CHECK([whether setsockopt(SO_RCVTIMEO) is broken],
ac_cv_so_rcvtimeo_broken, [dnl
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
#if defined(HAVE_SYS_SOCKET_H)
#include <sys/socket.h>
#endif
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
int main(void) {
int fd;
int ret;
struct timeval new_tv;
/* Open the socket (INET/TCP).*/
fd = socket(AF_INET, SOCK_STREAM, 0);
/* set the timeout for the incoming queue */
/* 1 second for example */
new_tv.tv_sec = 1;
new_tv.tv_usec = 0;
ret = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &new_tv, sizeof(new_tv));
return ret;
}
]])],[ac_cv_so_rcvtimeo_broken=no],[ac_cv_so_rcvtimeo_broken=yes],[ac_cv_so_rcvtimeo_broken=cross])])
if test x"$ac_cv_so_rcvtimeo_broken" = x"yes"; then
AC_DEFINE(HAVE_BROKEN_SO_RCVTIMEO, 1, [Define if setsockopt(SO_RCVTIMEO) is broken])
fi
dnl
dnl Look for socklen_t
dnl
AC_MSG_CHECKING([for socklen_t])
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[socklen_t len = 42; return 0;],
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no
)
if test $ac_cv_type_socklen_t != yes; then
AC_DEFINE(socklen_t, int, [Substitute for socklen_t])
AC_MSG_RESULT(int)
else
AC_MSG_RESULT(yes)
fi
dnl
dnl Check of __func__ and co..
dnl
AC_MSG_CHECKING([whether our compiler supports __func__])
AC_TRY_COMPILE([],
[const char *cp = __func__;],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
AC_TRY_COMPILE([],
[const char *cp = __FUNCTION__;],
AC_MSG_RESULT([yes])
AC_DEFINE(__func__, __FUNCTION__,
[Define to appropriate substitue if compiler doesnt have __func__]),
AC_MSG_RESULT([no])
AC_DEFINE(__func__, __FILE__,
[Define to appropriate substitue if compiler doesnt have __func__])))
dnl
dnl Temporal directory
dnl
AC_ARG_ENABLE(tmpdir, AC_HELP_STRING([--enable-tmpdir=DIR],[default directory for temporary files]))
AC_MSG_CHECKING(directory to use for temporary files)
if test -n "$enable_tmpdir"; then
tmpdir="$enable_tmpdir"
elif test -n "$TMPDIR"; then
tmpdir="$TMPDIR"
elif test -n "$TMP"; then
tmpdir="$TMP"
elif test -n "$TEMP"; then
tmpdir="$TEMP"
elif test -d "c:/"; then
tmpdir="c:/"
else
tmpdir="/tmp"
fi
dnl No temp dir
if ! test -d $tmpdir ; then
AC_MSG_ERROR($tmpdir does not exist)
fi
dnl Handle MacOS X messy tmp dirs
case "$tmpdir" in
/var/folders*)
tmpdir='/tmp'
;;
esac
AC_MSG_RESULT($tmpdir)
AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir", [Temporal directory])
dnl
dnl Check for pcre library
dnl
have_pcre="built-in"
AC_ARG_ENABLE(internal_pcre,
AC_HELP_STRING([--enable-internal-pcre],[Enable internal PCRE]),
use_internal_pcre="$enableval", use_internal_pcre="no")
if test "x$use_internal_pcre" != "xyes"; then
AC_CHECK_LIB(pcre, pcre_compile, have_pcre_lib=yes, have_pcre_lib=no)
AC_CHECK_HEADER(pcre.h, have_pcre_include=yes, have_pcre_include=no)
if test "$have_pcre_lib $have_pcre_include" = "yes yes"; then
have_pcre="yes"