-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
1019 lines (933 loc) · 28.5 KB
/
configure.ac
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
# Process this file with bootstrap to produce a configure script.
# autoconf requirement
AC_PREREQ([2.53])
# Note: in case of beta subversion, use underscore "_" rather then dash "-"
# since RPM doesn't allow dash in Version
# Example: 5.0_beta2
AC_INIT([monit], [5.15], [[email protected]])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/monit.c])
AC_CONFIG_SUBDIRS([libmonit])
AC_CONFIG_COMMANDS([libtool_patch],[test `uname` = "OpenBSD" && perl -p -i -e "s/deplibs_check_method=.*/deplibs_check_method=pass_all/g" libtool])
AC_CONFIG_COMMANDS([monitrc], [chmod 600 monitrc])
# ------------------------------------------------------------------------
# Programs
# ------------------------------------------------------------------------
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [no], [$PATH:/usr/local/bin:/usr/bin])
if test "x$YACC" = "xno"; then
# Require bison unless y.tab.c already is built
if test ! -f src/y.tab.c; then
AC_MSG_ERROR([Monit require bison, byacc or yacc. Download bison from http://www.gnu.org/software/bison/])
fi
fi
AC_PATH_PROG([FLEX], [flex], [no], [$PATH:/usr/local/bin:/usr/bin])
if test "x$FLEX" = "xno"; then
# Require flex unless lex.yy.c already is built
if test ! -f src/lex.yy.c; then
AC_MSG_ERROR([flex is required. Download from http://www.gnu.org/software/flex/])
fi
fi
AC_PATH_PROG([POD2MAN], [pod2man], [no], [$PATH:/usr/local/bin:/usr/bin])
if test "x$POD2MAN" = "xno"; then
# Require pod2man unless monit.1 already is built
if test ! -f monit.1; then
AC_MSG_ERROR([pod2man is required to build the monit.1 man file.])
fi
else
d=`date '+%B %d. %Y'`
POD2MANFLAGS="--center 'User Commands' --release '${d}' --date='www.mmonit.com' --lax"
AC_SUBST([POD2MANFLAGS])
fi
# ------------------------------------------------------------------------
# Libtool
# ------------------------------------------------------------------------
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
# ---------------------------------------------------------------------------
# Build options
# ---------------------------------------------------------------------------
AC_ARG_ENABLE(optimized,
AS_HELP_STRING([--enable-optimized],
[Build software optimized]),
[
CFLAGS=`echo $CFLAGS|sed 's/-O.* //'`
if test "x$enableval" = "xyes" ; then
CFLAGS=`echo $CFLAGS|sed 's/-g//'`
CFLAGS="$CFLAGS -O3"
OPTIMIZED=1
else
OPTIMIZED=0
fi
],
[
OPTIMIZED=0
]
)
# ------------------------------------------------------------------------
# Libraries
# ------------------------------------------------------------------------
# Check for libraries
AC_CHECK_LIB([socket], [socket])
AC_CHECK_LIB([inet], [socket])
AC_CHECK_LIB([nsl], [inet_addr])
AC_CHECK_LIB([resolv], [inet_aton])
AC_CHECK_LIB([c], [crypt], [:], [AC_CHECK_LIB([crypt], [crypt])])
AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_ERROR([POSIX thread library is required])])
# ------------------------------------------------------------------------
# Header files
# ------------------------------------------------------------------------
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_STAT
AC_HEADER_TIME
AC_CHECK_HEADERS([ \
alloca.h \
arpa/inet.h \
asm/page.h \
asm/param.h \
cf.h \
crt_externs.h \
ctype.h \
crypt.h \
dirent.h \
errno.h \
execinfo.h \
fcntl.h \
getopt.h \
glob.h \
grp.h \
ifaddrs.h \
kvm.h \
paths.h \
kstat.h \
zone.h \
sys/protosw.h \
limits.h \
loadavg.h \
locale.h \
mach/boolean.h \
mach/host_info.h \
mach/mach.h \
mach/mach_host.h \
memory.h \
mntent.h \
netdb.h \
sys/socket.h \
netinet/in.h \
netinet/tcp.h \
netinet/in_systm.h \
pam/pam_appl.h \
security/pam_appl.h \
poll.h \
procfs.h \
sys/procfs.h \
procinfo.h \
pthread.h \
pwd.h \
regex.h \
setjmp.h \
signal.h \
stdarg.h \
stddef.h \
stdio.h \
string.h \
strings.h \
stropts.h \
sys/cfgodm.h \
sys/cfgdb.h \
sys/dk.h \
sys/dkstat.h \
sys/filio.h \
sys/ioctl.h \
sys/loadavg.h \
sys/lock.h \
sys/mnttab.h \
sys/mutex.h \
sys/nlist.h \
sys/param.h \
sys/pstat.h \
sys/queue.h \
sys/resource.h \
sys/sched.h \
sys/statfs.h \
sys/statvfs.h \
sys/sysinfo.h \
sys/systemcfg.h \
sys/time.h \
sys/tree.h \
sys/types.h \
sys/un.h \
sys/utsname.h \
sys/vmmeter.h \
sys/vm_usage.h \
sys/vfs.h \
syslog.h \
unistd.h \
uvm/uvm_extern.h \
uvm/uvm_param.h \
vm/vm.h \
])
AC_CHECK_HEADERS([ \
libperfstat.h \
],
[],
[],
[
#ifdef HAVE_SYS_PROTOSW_H
#include <sys/protosw.h>
#endif
])
AC_CHECK_HEADERS([ \
netinet/ip.h \
],
[],
[],
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in.h>
#endif
])
AC_CHECK_HEADERS([ \
net/if.h \
netinet/ip_icmp.h \
],
[],
[],
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IP_H
#include <netinet/ip.h>
#endif
])
AC_CHECK_HEADERS([ \
netinet/icmp6.h \
],
[],
[],
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_NETINET_IP_H
#include <netinet/in.h>
#endif
])
AC_CHECK_HEADERS([ \
sys/sysctl.h \
sys/mount.h \
sys/proc.h \
sys/swap.h \
sys/ucred.h \
sys/user.h \
],
[],
[],
[
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
])
AC_CHECK_HEADERS([ \
machine/vmparam.h \
vm/pmap.h \
machine/pmap.h \
vm/vm_map.h \
vm/vm_object.h \
],
[],
[],
[
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_QUEUE_H
#include <sys/queue.h>
#endif
#ifdef HAVE_SYS_LOCK_H
#include <sys/lock.h>
#endif
#ifdef HAVE_SYS_MUTEX_H
#include <sys/mutex.h>
#endif
#ifdef HAVE_VM_VM_H
#include <vm/vm.h>
#endif
#ifdef HAVE_VM_PMAP_H
#include <vm/pmap.h>
#endif
])
AC_CHECK_HEADERS([ \
sys/resourcevar.h \
],
[],
[],
[
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
])
AC_CHECK_HEADERS([ \
uvm/uvm_map.h \
uvm/uvm_pmap.h \
uvm/uvm_object.h \
],
[],
[],
[
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_LOCK_H
#include <sys/lock.h>
#endif
#ifdef HAVE_SYS_TREE_H
#include <sys/tree.h>
#endif
#ifdef HAVE_UVM_UVM_EXTERN_H
#include <uvm/uvm_extern.h>
#endif
])
AC_CHECK_HEADERS([ \
uvm/uvm.h \
],
[],
[],
[
#ifdef HAVE_SYS_MUTEX_H
#include <sys/mutex.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_UVM_UVM_PARAM_H
#include <uvm/uvm_param.h>
#endif
])
# ------------------------------------------------------------------------
# Types
# ------------------------------------------------------------------------
AC_CHECK_TYPES([boolean_t], [], [],
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_MACH_BOOLEAN_H
#include <mach/boolean.h>
#endif
#ifdef HAVE_UVM_UVM_PARAM_H
#include <uvm/uvm_param.h>
#endif
#ifdef HAVE_VM_VM_H
#include <vm/vm.h>
#endif
])
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
# Check for structures.
AC_STRUCT_TM
AC_CHECK_MEMBERS([struct tm.tm_gmtoff])
# ------------------------------------------------------------------------
# Functions
# ------------------------------------------------------------------------
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(statfs)
AC_CHECK_FUNCS(statvfs)
AC_CHECK_FUNCS(setlocale)
AC_CHECK_FUNCS(getaddrinfo)
AC_CHECK_FUNCS(syslog)
AC_CHECK_FUNCS(vsyslog)
AC_CHECK_FUNCS(backtrace)
AC_CHECK_FUNCS(getloadavg)
AC_CHECK_FUNCS(getopt_long)
AC_MSG_CHECKING(for va_copy)
AC_TRY_LINK([
#include <stdarg.h>
], [
va_list ap;
va_list ap_copy;
va_copy(ap, ap_copy);
], [
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_VA_COPY], [1], [Define to 1 if VA_COPY is defined.])
], [
AC_MSG_RESULT(no)
])
# ------------------------------------------------------------------------
# Compiler
# ------------------------------------------------------------------------
# Compiler characteristics
AC_C_CONST
AC_C_BIGENDIAN
# If the compiler is gcc, tune warnings and make the char type unsigned
# and enable C99 support
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall -Wunused -Wno-unused-label -funsigned-char";
# Add C99 support
CFLAGS="$CFLAGS -D_GNU_SOURCE -std=c99"
# does this compiler support -Wno-pointer-sign ?
svd_CFLAGS="$CFLAGS"
CFLAGS="-Wno-pointer-sign $CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [], [CFLAGS="$svd_CFLAGS"])
# does this compiler support -Wno-address ?
svd_CFLAGS="$CFLAGS"
CFLAGS="-Wno-address $CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [], [CFLAGS="$svd_CFLAGS"])
fi
# ------------------------------------------------------------------------
# IPv6 Support
# ------------------------------------------------------------------------
AC_MSG_CHECKING(for IPv6 support)
AC_CACHE_VAL(ac_cv_ipv6,
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
/* Make sure the definitions for AF_INET6 and struct sockaddr_in6
* are defined, and that we can actually create an IPv6 TCP socket.*/
main()
{
int fd;
struct sockaddr_in6 foo;
fd = socket(AF_INET6, SOCK_STREAM, 0);
exit(fd >= 0 ? 0 : 1);
}],
ac_cv_ipv6=yes,
ac_cv_ipv6=no,
ac_cv_ipv6=no))
AC_MSG_RESULT($ac_cv_ipv6)
if test $ac_cv_ipv6 = yes ; then
AC_DEFINE([HAVE_IPV6], 1, [Define to 1 if the system supports IPv6])
fi
# ------------------------------------------------------------------------
# Paths
# ------------------------------------------------------------------------
# Find the right directory to put the root-mode PID file in
AC_MSG_CHECKING([pid file location])
if test -d "/run"
then
piddir="/run"
elif test -d "/var/run"; then
piddir="/var/run"
elif test -d "/etc"; then
piddir="/etc"
fi
AC_DEFINE_UNQUOTED([PIDDIR], "$piddir",
[Define to the pid storage directory.])
AC_MSG_RESULT([$piddir])
# Test mounted filesystem description file
if test -f "/etc/mtab"
then
AC_DEFINE([HAVE_MTAB], 1, [Define to 1 if you have /etc/mtab])
elif test -f "/etc/mnttab"; then
AC_DEFINE([HAVE_MNTTAB], 1, [Define to 1 if you have /etc/mnttab])
fi
# ------------------------------------------------------------------------
# Architecture/OS detection
# ------------------------------------------------------------------------
# Backward compatibility until we get ride of arch settings
architecture=`uname`
if test "$architecture" = "SunOS"
then
ARCH="SOLARIS"
CFLAGS="$CFLAGS -D _REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__ -m64"
LDFLAGS="$LDFLAGS -m64"
test_kstat="true"
AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
if test `uname -m` = "i86pc"
then
if test "x$GCC" = "xyes"
then
CFLAGS="$CFLAGS -mtune=opteron"
LDFLAGS="$LDFLAGS -mtune=opteron"
else
CFLAGS="$CFLAGS -xarch=sse2"
LDFLAGS="$LDFLAGS -xarch=sse2"
fi
else
if test "x$GCC" = "xyes"
then
CFLAGS="$CFLAGS -mtune=v9"
LDFLAGS="$LDFLAGS -mtune=v9"
else
CFLAGS="$CFLAGS -xarch=sparc"
LDFLAGS="$LDFLAGS -xarch=sparc"
fi
fi
elif test "$architecture" = "Linux"
then
ARCH="LINUX"
CFLAGS="$CFLAGS -D _REENTRANT"
LDFLAGS="$LDFLAGS -rdynamic"
if test `uname -r | awk -F '.' '{print$1$2}'` -ge "26"
then
AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
fi
elif test "$architecture" = "HP-UX"
then
ARCH="HPUX"
CFLAGS="$CFLAGS -D _REENTRANT -D _INCLUDE_XOPEN_SOURCE -D _INCLUDE_XOPEN_SOURCE_EXTENDED -D _XOPEN_SOURCE_EXTENDED -D _INCLUDE_HPUX_SOURCE"
AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
elif test "$architecture" = "OpenBSD"
then
ARCH="OPENBSD"
CFLAGS="$CFLAGS -D _REENTRANT"
test_kvm="true"
use_pam=0 # No PAM on OpenBSD (supports BSD Auth API instead of PAM)
elif test "$architecture" = "FreeBSD"
then
ARCH="FREEBSD"
CFLAGS="$CFLAGS -D _REENTRANT"
test_kvm="true"
elif test "$architecture" = "GNU/kFreeBSD"
then
ARCH="FREEBSD"
CFLAGS="$CFLAGS -D _REENTRANT"
test_kvm="true"
elif test "$architecture" = "NetBSD"
then
ARCH="NETBSD"
CFLAGS="$CFLAGS -D _REENTRANT"
test_kvm="true"
elif test "$architecture" = "Darwin"
then
ARCH="DARWIN"
CFLAGS="$CFLAGS -DREENTRANT -no-cpp-precomp -DNEED_SOCKLEN_T_DEFINED"
test_kvm="true"
LIBS="$LIBS -framework System -multiply_defined suppress"
elif test "$architecture" = "AIX"
then
ARCH="AIX"
CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT"
LIBS="$LIBS -lodm"
# AIX v. 5.2
LIBS="$LIBS -lcfg"
# AIX v. 5.3
LIBS="$LIBS -lperfstat"
AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
else
AC_MSG_WARN([Architecture not supported: ${architecture}])
CFLAGS="$CFLAGS -D _REENTRANT"
ARCH="UNKNOWN"
fi
AC_SUBST(ARCH)
# ------------------------------------------------------------------------
# Resource code
# ------------------------------------------------------------------------
# Test for kvm libs
kvm_libs=""
if test "$test_kvm"; then
AC_CHECK_LIB([kvm],
[kvm_open],
[kvm_libs="-lkvm"])
if test "$kvm_libs"
then
LIBS="$LIBS $kvm_libs"
fi
fi
kstat_libs=""
if test "$test_kstat"; then
AC_CHECK_LIB([kstat],
[kstat_open],
[kstat_libs="-lkstat"])
if test "$kstat_libs"
then
LIBS="$LIBS $kstat_libs"
fi
fi
# ------------------------------------------------------------------------
# Large files code
# ------------------------------------------------------------------------
# Check if we want to have large files support
AC_MSG_CHECKING([for large files support])
AC_ARG_WITH(largefiles,
[ --without-largefiles disable large files support (default: enabled)],
[
dnl Check the withvalue
if test "x$withval" = "xno" ; then
use_largefiles=0
AC_MSG_RESULT([disabled])
fi
if test "x$withval" = "xyes" ; then
use_largefiles=1
AC_MSG_RESULT([enabled])
fi
],
[
if test `uname` = "AIX"
then
use_largefiles=0
AC_MSG_RESULT([disabled])
else
use_largefiles=1
AC_MSG_RESULT([enabled])
fi
]
)
# Settings for largefiles support
if test "$use_largefiles" = 1; then
AC_SYS_LARGEFILE
fi
# ------------------------------------------------------------------------
# PAM Code
# ------------------------------------------------------------------------
AC_MSG_CHECKING([for PAM support])
AC_ARG_WITH(pam,
[ --without-pam disable the use of pam (default: enabled)],
[
dnl Check the withvalue
if test "x$withval" = "xno" ; then
use_pam=0
AC_MSG_RESULT([disabled])
fi
if test "x$withval" = "xyes" ; then
use_pam=1
AC_MSG_RESULT([enabled])
fi
],
[
if test "$use_pam" = "0"; then
AC_MSG_RESULT([disabled])
else
use_pam=1
AC_MSG_RESULT([enabled])
fi
]
)
if test "$use_pam" = "1"; then
AC_CHECK_LIB([pam], [pam_start], [], [AC_MSG_ERROR([PAM enabled but headers or library not found, install the PAM development support or run configure --without-pam])])
fi
# ------------------------------------------------------------------------
# SSL Code
# ------------------------------------------------------------------------
# Check for ssl includes
checksslincldir() { :
if test -f "$1/openssl/ssl.h"; then
sslincldir="$1"
return 0
fi
return 1
}
# Check for ssl libraries
checkssllibdirdynamic() { :
CRYPTOLIB=`ls -1 $1/libcrypto.so* $1/libcrypto.dylib* 2>/dev/null | wc -l`
SSLLIB=`ls -1 $1/libssl.so* $1/libssl.dylib* 2>/dev/null | wc -l`
if test "(" $CRYPTOLIB -gt 0 -a $SSLLIB -gt 0 ")"
then
ssllibdir="$1"
return 0
fi
return 1
}
checkssllibdirstatic() { :
if test "(" -f "$1/libcrypto.a" ")" -a \
"(" -f "$1/libssl.a" ")" ; then
ssllibdir="$1"
return 0
fi
return 1
}
# Check if we want to have SSL
AC_MSG_CHECKING([for static SSL support])
AC_ARG_WITH(ssl-static,
[ --with-ssl-static=DIR location of SSL installation],
[
dnl Check the specified location only
for dir in "$withval" "$withval/include"; do
checksslincldir "$dir"
done
for dir in "$withval" "$withval/lib"; do
checkssllibdirstatic "$dir" && break
done
use_sslstatic=1
LDFLAGS="`echo $LDFLAGS | sed -e 's/-rdynamic/-ldl/g'`"
AC_MSG_RESULT([enabled])
AC_DEFINE([HAVE_OPENSSL], 1, [Define to 1 if you have openssl.])
AC_SUBST(sslincldir)
AC_SUBST(ssllibdir)
CFLAGS="$CFLAGS -I$sslincldir"
LIBS="$LIBS $ssllibdir/libssl.a $ssllibdir/libcrypto.a"
],
[
use_sslstatic=0
AC_MSG_RESULT([disabled])
]
)
if test "$use_sslstatic" = "0"
then
AC_MSG_CHECKING([for SSL support])
AC_ARG_WITH(ssl,
[ --without-ssl disable the use of ssl (default: enabled)],
[
dnl Check the withvalue
if test "x$withval" = "xno" ; then
use_ssl=0
AC_MSG_RESULT([disabled])
fi
if test "x$withval" = "xyes" ; then
use_ssl=1
AC_MSG_RESULT([enabled])
fi
],
[
use_ssl=1
AC_MSG_RESULT([enabled])
]
)
# Check for SSL directory
if test "$use_ssl" = "1"; then
AC_ARG_WITH(ssl-dir,
[ --with-ssl-dir=DIR location of SSL installation],
[
dnl Check the specified location only
for dir in "$withval" "$withval/include"; do
checksslincldir "$dir"
done
for dir in "$withval" "$withval/lib"; do
checkssllibdirdynamic "$dir" && break
done
]
)
AC_MSG_CHECKING([for SSL include directory])
AC_ARG_WITH(ssl-incl-dir,
[ --with-ssl-incl-dir=DIR location of installed SSL include files],
[
dnl Check the specified location only
checksslincldir "$withval"
],
[
if test -z "$sslincldir"; then
dnl Search default locations of SSL includes
for maindir in /usr /usr/local /usr/lib /usr/pkg /var /opt /usr/sfw /opt/csw /opt/freeware; do
for dir in "$maindir/include"\
"$maindir/include/openssl"\
"$maindir/include/ssl"\
"$maindir/ssl/include"; do
checksslincldir $dir && break 2
done
done
fi
]
)
if test -z "$sslincldir"; then
AC_MSG_RESULT([Not found])
echo
echo "Couldn't find your SSL header files."
echo "Use --with-ssl-incl-dir option to fix this problem or disable"
echo "the SSL support with --without-ssl"
echo
exit 1
fi
AC_MSG_RESULT([$sslincldir])
AC_MSG_CHECKING([for SSL library directory])
AC_ARG_WITH(ssl-lib-dir,
[ --with-ssl-lib-dir=DIR location of installed SSL library files],
[
dnl Check the specified location only
checkssllibdirdynamic "$withval"
],
[
if test -z "$ssllibdir"; then
dnl Search default locations of SSL libraries
for maindir in "" \
/usr \
/usr/local \
/usr/pkg \
/var \
/opt \
/usr/sfw \
/opt/csw \
/opt/freeware; do
for dir in $maindir \
$maindir/openssl \
$maindir/ssl \
$maindir/lib \
$maindir/lib/openssl \
$maindir/lib/ssl \
$maindir/ssl/lib \
$maindir/lib/64 \
$maindir/lib/64/openssl \
$maindir/lib/64/ssl \
$maindir/ssl/lib/64 \
$maindir/lib64 \
$maindir/lib64/openssl \
$maindir/lib64/ssl \
$maindir/ssl/lib64 \
$maindir/lib/${build} \
$maindir/lib/${build_alias}; do
checkssllibdirdynamic $dir && break 2
done
done
fi
]
)
if test -z "$ssllibdir"; then
AC_MSG_RESULT([Not found])
dnl Let the compiler find the library using default paths
AC_CHECK_LIB([ssl], [SSL_library_init], [], [AC_MSG_ERROR([Could not find SSL library, please use --with-ssl-lib-dir option or disabled the SSL support using --without-ssl])])
AC_CHECK_LIB([crypto],[CRYPTO_new_ex_data], [], [AC_MSG_ERROR([Could not find SSL library, please use --with-ssl-lib-dir option or disabled the SSL support using --without-ssl])])
else
AC_MSG_RESULT([$ssllibdir])
fi
AC_DEFINE([HAVE_OPENSSL], 1, [Define to 1 if you have openssl.])
AC_SUBST(sslincldir)
AC_SUBST(ssllibdir)
fi
# Add SSL includes and libraries
if test "$sslincldir" -a "$ssllibdir"
then
if test "x$ARCH" = "xDARWIN"; then
# Darwin already knows about ssldirs
LIBS="$LIBS -lssl -lcrypto"
elif test -f "/usr/kerberos/include/krb5.h"; then
# Redhat 9 compilation fix:
CFLAGS="$CFLAGS -I$sslincldir -I/usr/kerberos/include"
LIBS="$LIBS -L$ssllibdir -lssl -lcrypto"
else
CFLAGS="$CFLAGS -I$sslincldir"
LIBS="$LIBS -L$ssllibdir -lssl -lcrypto"
fi
fi
fi
# Check TLS version
if test "$use_sslstatic" = "1" -o "$use_ssl" = "1"; then
if test "x$sslincldir" != "x"; then
CFLAGS="$CFLAGS -I$sslincldir"
fi
if test "x$ssllibdir" != "x"; then
LIBS="$LIBS -L$ssllibdir"
fi
AC_MSG_CHECKING([for TLSv1.1])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [TLSv1_1_method()])],
[tlsv11=yes],
[tlsv11=no])
AC_MSG_RESULT($tlsv11)
if test "$tlsv11" = "yes" ; then
AC_DEFINE([HAVE_TLSV1_1], 1, [Define to 1 if you have openssl with TLSv1.1])
fi
AC_MSG_CHECKING([for TLSv1.2])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [TLSv1_2_method()])],
[tlsv12=yes],
[tlsv12=no])
AC_MSG_RESULT($tlsv12)
if test "$tlsv12" = "yes" ; then
AC_DEFINE([HAVE_TLSV1_2], 1, [Define to 1 if you have openssl with TLSv1.2])
fi
AC_MSG_CHECKING([for EC_KEY support])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [EC_KEY_new_by_curve_name(0)])],
[ec=yes],
[ec=no])
AC_MSG_RESULT($ec)
if test "$ec" = "yes" ; then
AC_DEFINE([HAVE_EC_KEY], 1, [Define to 1 if you have openssl with EC_KEY])
fi
AC_MSG_CHECKING([for ASN1_TIME_diff support])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [ASN1_TIME_diff(0, 0, 0, 0)])],
[asn1timediff=yes],
[asn1timediff=no])
AC_MSG_RESULT($asn1timediff)
if test "$asn1timediff" = "yes" ; then
AC_DEFINE([HAVE_ASN1_TIME_DIFF], 1, [Define to 1 if you have openssl with ASN1_TIME_diff])
fi
fi
# ------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------
AH_BOTTOM([
/* Mask out GCC __attribute__ extension for non-gcc compilers. */
#ifndef __GNUC__
#define __attribute__(x)
#endif
])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([system/startup/monit.upstart])
AC_CONFIG_FILES([system/startup/monit.service])
AC_OUTPUT
echo
echo "Monit Build Information:"
echo
echo " Architecture: ${ARCH}"
if test "$use_sslstatic" = "1" -o "$use_ssl" = "1"; then
echo " SSL include directory: ${sslincldir}"
echo " SSL library directory: ${ssllibdir}"
fi
echo " Compiler flags: ${CFLAGS}"
echo " Linker flags: ${LIBS}"
echo " pid file location: ${piddir}"
echo " Install directory: ${prefix}"
echo
cat <<EOT
+------------------------------------------------------------+
| License: |
| This is Open Source Software and use is subject to the GNU |
| AFFERO GENERAL PUBLIC LICENSE version 3, available in this |
| distribution in the file COPYING. |
| |
| By continuing this installation process, you are bound by |
| the terms of this license agreement. If you do not agree |
| with the terms of this license, you must abort the |
| installation process at this point. |
+------------------------------------------------------------+
| Monit has been configured with the following options: |
| |
EOT
if test "$use_pam" = "1"; then
echo "| PAM support: ENABLED |"