1
# Process this file with bootstrap to produce a configure script.
6
# Note: in case of beta subversion, use underscore "_" rather then dash "-"
7
# since RPM doesn't allow dash in Version
9
AC_INIT([monit], [5.5], [monit-general@nongnu.org])
10
AC_CONFIG_AUX_DIR(config)
11
AC_CONFIG_MACRO_DIR([m4])
13
AC_CONFIG_SRCDIR([src/monit.c])
14
AC_CONFIG_SUBDIRS([libmonit])
15
AC_CONFIG_COMMANDS([libtool_patch],[test `uname` = "OpenBSD" && perl -p -i -e "s/deplibs_check_method=.*/deplibs_check_method=pass_all/g" libtool])
18
# ------------------------------------------------------------------------
20
# ------------------------------------------------------------------------
25
AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [no], [$PATH:/usr/local/bin:/usr/bin])
26
if test "x$YACC" = "xno"; then
27
# Require bison unless y.tab.c already is built
28
if test ! -f src/y.tab.c; then
29
AC_MSG_ERROR([Monit require bison, byacc or yacc. Download bison from http://www.gnu.org/software/bison/])
32
AC_PATH_PROG([FLEX], [flex], [no], [$PATH:/usr/local/bin:/usr/bin])
33
if test "x$FLEX" = "xno"; then
34
# Require flex unless lex.yy.c already is built
35
if test ! -f src/lex.yy.c; then
36
AC_MSG_RESULT([flex is required. Download from http://www.gnu.org/software/flex/])
39
AC_PATH_PROG([POD2MAN], [pod2man], [no], [$PATH:/usr/local/bin:/usr/bin])
40
if test "x$POD2MAN" = "xno"; then
41
# Require pod2man unless monit.1 already is built
42
if test ! -f monit.1; then
43
AC_MSG_ERROR([pod2man is required to build the monit.1 man file.])
47
POD2MANFLAGS="--center 'User Commands' --release '${d}' --date='www.mmonit.com' --lax"
48
AC_SUBST([POD2MANFLAGS])
52
# ------------------------------------------------------------------------
54
# ------------------------------------------------------------------------
60
# ---------------------------------------------------------------------------
62
# ---------------------------------------------------------------------------
64
AC_ARG_ENABLE(optimized,
65
AS_HELP_STRING([--enable-optimized],
66
[Build software optimized]),
68
CFLAGS=`echo $CFLAGS|sed 's/-O.//'`
69
if test "x$enableval" = "xyes" ; then
70
CFLAGS=`echo $CFLAGS|sed 's/-g//'`
83
# ------------------------------------------------------------------------
85
# ------------------------------------------------------------------------
88
AC_CHECK_LIB([socket], [socket])
89
AC_CHECK_LIB([inet], [socket])
90
AC_CHECK_LIB([nsl], [inet_addr])
91
AC_CHECK_LIB([resolv], [inet_aton])
92
AC_CHECK_LIB([c], [crypt], [:], [AC_CHECK_LIB([crypt], [crypt])])
94
AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_ERROR([POSIX thread library is required])])
96
# ------------------------------------------------------------------------
98
# ------------------------------------------------------------------------
138
security/pam_appl.h \
193
#ifdef HAVE_SYS_PROTOSW_H
194
#include <sys/protosw.h>
204
#ifdef HAVE_SYS_TYPES_H
205
#include <sys/types.h>
207
#if HAVE_NETINET_IN_SYSTM_H
208
#include <netinet/in_systm.h>
210
#if HAVE_NETINET_IN_SYSTM_H
211
#include <netinet/in.h>
222
#ifdef HAVE_SYS_TYPES_H
223
#include <sys/types.h>
225
#if HAVE_SYS_SOCKET_H
226
#include <sys/socket.h>
228
#if HAVE_NETINET_IN_SYSTM_H
229
#include <netinet/in.h>
231
#if HAVE_NETINET_IN_SYSTM_H
232
#include <netinet/in_systm.h>
234
#if HAVE_NETINET_IP_H
235
#include <netinet/ip.h>
250
#ifdef HAVE_SYS_PARAM_H
251
#include <sys/param.h>
265
#ifdef HAVE_SYS_PARAM_H
266
#include <sys/param.h>
268
#ifdef HAVE_SYS_QUEUE_H
269
#include <sys/queue.h>
271
#ifdef HAVE_SYS_LOCK_H
272
#include <sys/lock.h>
274
#ifdef HAVE_SYS_MUTEX_H
275
#include <sys/mutex.h>
280
#ifdef HAVE_VM_PMAP_H
291
#ifdef HAVE_SYS_TIME_H
292
#include <sys/time.h>
294
#ifdef HAVE_SYS_RESOURCE_H
295
#include <sys/resource.h>
307
#ifdef HAVE_SYS_TIME_H
308
#include <sys/time.h>
310
#ifdef HAVE_SYS_LOCK_H
311
#include <sys/lock.h>
313
#ifdef HAVE_SYS_TREE_H
314
#include <sys/tree.h>
316
#ifdef HAVE_UVM_UVM_EXTERN_H
317
#include <uvm/uvm_extern.h>
328
# Check for structures.
330
AC_CHECK_MEMBERS([struct tm.tm_gmtoff])
333
# ------------------------------------------------------------------------
335
# ------------------------------------------------------------------------
337
# Checks for library functions.
338
AC_FUNC_ERROR_AT_LINE
342
AC_CHECK_FUNCS(statfs)
343
AC_CHECK_FUNCS(statvfs)
344
AC_CHECK_FUNCS(setlocale)
345
AC_CHECK_FUNCS(getaddrinfo)
346
AC_CHECK_FUNCS(syslog)
347
AC_CHECK_FUNCS(vsyslog)
348
AC_CHECK_FUNCS(backtrace)
349
AC_CHECK_FUNCS(getloadavg)
352
AC_MSG_CHECKING(for SOL_IP)
355
#include <sys/socket.h>],
356
[int level = SOL_IP;],
358
AC_DEFINE([HAVE_SOL_IP], [1], [Define to 1 if SOL_IP is defined.])],
361
AC_MSG_CHECKING(for va_copy)
367
va_copy(ap, ap_copy);
370
AC_DEFINE([HAVE_VA_COPY], [1], [Define to 1 if VA_COPY is defined.])
376
# ------------------------------------------------------------------------
378
# ------------------------------------------------------------------------
380
# Compiler characteristics
384
# If the compiler is gcc, tune warnings and make the char type unsigned
385
# and enable C99 support
386
if test "x$GCC" = "xyes"; then
387
CFLAGS="$CFLAGS -Wall -Wunused -Wno-unused-label -funsigned-char";
389
CFLAGS="$CFLAGS -D_GNU_SOURCE -std=c99"
390
# does this compiler support -Wno-pointer-sign ?
392
CFLAGS="-Wno-pointer-sign $CFLAGS"
393
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [], [CFLAGS="$svd_CFLAGS"])
394
# does this compiler support -Wno-address ?
396
CFLAGS="-Wno-address $CFLAGS"
397
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [], [CFLAGS="$svd_CFLAGS"])
401
# ------------------------------------------------------------------------
403
# ------------------------------------------------------------------------
405
# Find the right directory to put the root-mode PID file in
406
AC_MSG_CHECKING([pid file location])
410
elif test -d "/var/run"
417
AC_DEFINE_UNQUOTED([PIDDIR], "$piddir",
418
[Define to the pid storage directory.])
419
AC_MSG_RESULT([$piddir])
421
# Test mounted filesystem description file
422
if test -f "/etc/mtab"
424
AC_DEFINE([HAVE_MTAB], 1, [Define to 1 if you have /etc/mtab])
425
elif test -f "/etc/mnttab"; then
426
AC_DEFINE([HAVE_MNTTAB], 1, [Define to 1 if you have /etc/mnttab])
429
# ------------------------------------------------------------------------
430
# Architecture/OS detection
431
# ------------------------------------------------------------------------
433
# Backward compatibility until we get ride of arch settings
435
if test "$architecture" = "SunOS"
438
CFLAGS="$CFLAGS -D _REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__ -m64"
439
LDFLAGS="$LDFLAGS -m64"
441
AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
442
if test `uname -m` = "i86pc"
444
if test "x$GCC" = "xyes"
446
CFLAGS="$CFLAGS -mtune=opteron"
447
LDFLAGS="$LDFLAGS -mtune=opteron"
449
CFLAGS="$CFLAGS -xarch=sse2"
450
LDFLAGS="$LDFLAGS -xarch=sse2"
453
if test "x$GCC" = "xyes"
455
CFLAGS="$CFLAGS -mtune=v9"
456
LDFLAGS="$LDFLAGS -mtune=v9"
458
CFLAGS="$CFLAGS -xarch=sparc"
459
LDFLAGS="$LDFLAGS -xarch=sparc"
462
elif test "$architecture" = "Linux"
465
CFLAGS="$CFLAGS -D _REENTRANT"
466
LDFLAGS="$LDFLAGS -rdynamic"
467
if test `uname -r | awk -F '.' '{print$1$2}'` -ge "26"
469
AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
471
elif test "$architecture" = "HP-UX"
474
CFLAGS="$CFLAGS -D _REENTRANT"
475
AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
476
elif test "$architecture" = "OpenBSD"
479
CFLAGS="$CFLAGS -D _REENTRANT"
481
use_pam=0 # No PAM on OpenBSD (supports BSD Auth API instead of PAM)
482
elif test "$architecture" = "FreeBSD"
485
CFLAGS="$CFLAGS -D _REENTRANT"
487
elif test "$architecture" = "GNU/kFreeBSD"
490
CFLAGS="$CFLAGS -D _REENTRANT"
492
elif test "$architecture" = "NetBSD"
495
CFLAGS="$CFLAGS -D _REENTRANT"
497
elif test "$architecture" = "Darwin"
500
CFLAGS="$CFLAGS -DREENTRANT -no-cpp-precomp -DNEED_SOCKLEN_T_DEFINED"
502
LIBS="$LIBS -framework System -multiply_defined suppress"
503
elif test "$architecture" = "AIX"
506
CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT"
511
LIBS="$LIBS -lperfstat"
512
AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
514
AC_MSG_WARN([Architecture not supported: ${architecture}])
515
CFLAGS="$CFLAGS -D _REENTRANT"
520
# ------------------------------------------------------------------------
522
# ------------------------------------------------------------------------
526
if test "$test_kvm"; then
532
LIBS="$LIBS $kvm_libs"
536
if test "$test_kstat"; then
537
AC_CHECK_LIB([kstat],
539
[kstat_libs="-lkstat"])
540
if test "$kstat_libs"
542
LIBS="$LIBS $kstat_libs"
547
# ------------------------------------------------------------------------
549
# ------------------------------------------------------------------------
551
# Check if we want to have large files support
552
AC_MSG_CHECKING([for large files support])
553
AC_ARG_WITH(largefiles,
554
[ --without-largefiles disable large files support (default: enabled)],
556
dnl Check the withvalue
557
if test "x$withval" = "xno" ; then
559
AC_MSG_RESULT([disabled])
561
if test "x$withval" = "xyes" ; then
563
AC_MSG_RESULT([enabled])
567
if test `uname` = "AIX"
570
AC_MSG_RESULT([disabled])
573
AC_MSG_RESULT([enabled])
578
# Settings for largefiles support
579
if test "$use_largefiles" = 1; then
584
# ------------------------------------------------------------------------
586
# ------------------------------------------------------------------------
588
AC_MSG_CHECKING([for PAM support])
590
[ --without-pam disable the use of pam (default: enabled)],
592
dnl Check the withvalue
593
if test "x$withval" = "xno" ; then
595
AC_MSG_RESULT([disabled])
597
if test "x$withval" = "xyes" ; then
599
AC_MSG_RESULT([enabled])
603
if test "x$use_pam" = "x" ; then
605
AC_MSG_RESULT([enabled])
610
if test "$use_pam" = "1"; then
611
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])])
615
# ------------------------------------------------------------------------
617
# ------------------------------------------------------------------------
619
# Check for ssl includes
620
checksslincldir() { :
621
if test -f "$1/openssl/ssl.h"; then
628
# Check for ssl libraries
629
checkssllibdirdynamic() { :
630
CRYPTOLIB=`ls -1 $1/libcrypto.so* $1/libcrypto.dylib* 2>/dev/null | wc -l`
631
SSLLIB=`ls -1 $1/libssl.so* $1/libssl.dylib* 2>/dev/null | wc -l`
632
if test "(" $CRYPTOLIB -gt 0 -a $SSLLIB -gt 0 ")"
640
checkssllibdirstatic() { :
641
if test "(" -f "$1/libcrypto.a" ")" -a \
642
"(" -f "$1/libssl.a" ")" ; then
649
# Check if we want to have SSL
651
AC_MSG_CHECKING([for static SSL support])
653
AC_ARG_WITH(ssl-static,
654
[ --with-ssl-static=DIR location of SSL installation],
656
dnl Check the specified location only
657
for dir in "$withval" "$withval/include"; do
658
checksslincldir "$dir"
660
for dir in "$withval" "$withval/lib"; do
661
checkssllibdirstatic "$dir" && break 2
664
LDFLAGS="`echo $LDFLAGS | sed -e 's/-rdynamic/-ldl/g'`"
665
AC_MSG_RESULT([enabled])
666
AC_DEFINE([HAVE_OPENSSL], 1, [Define to 1 if you have openssl.])
669
CFLAGS="$CFLAGS -I$sslincldir"
670
LIBS="$LIBS $ssllibdir/libssl.a $ssllibdir/libcrypto.a"
674
AC_MSG_RESULT([disabled])
678
if test "$use_sslstatic" = "0"
680
AC_MSG_CHECKING([for SSL support])
683
[ --without-ssl disable the use of ssl (default: enabled)],
685
dnl Check the withvalue
686
if test "x$withval" = "xno" ; then
688
AC_MSG_RESULT([disabled])
690
if test "x$withval" = "xyes" ; then
692
AC_MSG_RESULT([enabled])
697
AC_MSG_RESULT([enabled])
702
# Check for SSL directory
703
if test "$use_ssl" = "1"; then
706
[ --with-ssl-dir=DIR location of SSL installation],
708
dnl Check the specified location only
709
for dir in "$withval" "$withval/include"; do
710
checksslincldir "$dir"
712
for dir in "$withval" "$withval/lib"; do
713
checkssllibdirdynamic "$dir" && break 2
718
AC_MSG_CHECKING([for SSL include directory])
719
AC_ARG_WITH(ssl-incl-dir,
720
[ --with-ssl-incl-dir=DIR location of installed SSL include files],
722
dnl Check the specified location only
723
checksslincldir "$withval"
726
if test -z "$sslincldir"; then
727
dnl Search default locations of SSL includes
728
for maindir in /usr /usr/local /usr/lib /usr/pkg /var /opt /usr/sfw /opt/csw /opt/freeware; do
729
for dir in "$maindir/include"\
730
"$maindir/include/openssl"\
731
"$maindir/include/ssl"\
732
"$maindir/ssl/include"; do
733
checksslincldir $dir && break 2
739
if test -z "$sslincldir"; then
740
AC_MSG_RESULT([Not found])
742
echo "Couldn't find your SSL header files."
743
echo "Use --with-ssl-incl-dir option to fix this problem or disable"
744
echo "the SSL support with --without-ssl"
748
AC_MSG_RESULT([$sslincldir])
750
AC_MSG_CHECKING([for SSL library directory])
751
AC_ARG_WITH(ssl-lib-dir,
752
[ --with-ssl-lib-dir=DIR location of installed SSL library files],
754
dnl Check the specified location only
755
checkssllibdirdynamic "$withval"
758
if test -z "$ssllibdir"; then
759
dnl Search default locations of SSL libraries
769
for dir in $maindir \
773
$maindir/lib/openssl \
777
$maindir/lib/64/openssl \
778
$maindir/lib/64/ssl \
779
$maindir/ssl/lib/64 \
781
$maindir/lib64/openssl \
784
`eval echo $libdir`; do
785
checkssllibdirdynamic $dir && break 2
791
if test -z "$ssllibdir"; then
792
AC_MSG_RESULT([Not found])
794
echo "Couldn't find your SSL library files."
795
echo "Use --with-ssl-lib-dir option to fix this problem or disable the"
796
echo "SSL support with --without-ssl"
800
AC_MSG_RESULT([$ssllibdir])
802
AC_DEFINE([HAVE_OPENSSL], 1, [Define to 1 if you have openssl.])
807
# Add SSL includes and libraries
808
if test "$sslincldir" -a "$ssllibdir"
810
if test "x$ARCH" = "xDARWIN"; then
811
# Darwin already knows about ssldirs
812
LIBS="$LIBS -lssl -lcrypto"
813
elif test -f "/usr/kerberos/include/krb5.h"; then
814
# Redhat 9 compilation fix:
815
CFLAGS="$CFLAGS -I$sslincldir -I/usr/kerberos/include"
816
LIBS="$LIBS -L$ssllibdir -lssl -lcrypto"
818
CFLAGS="$CFLAGS -I$sslincldir"
819
LIBS="$LIBS -L$ssllibdir -lssl -lcrypto"
824
# ------------------------------------------------------------------------
826
# ------------------------------------------------------------------------
829
/* Mask out GCC __attribute__ extension for non-gcc compilers. */
831
#define __attribute__(x)
835
AC_CONFIG_HEADER([src/config.h])
836
AC_CONFIG_FILES([Makefile])
837
AC_CONFIG_FILES([contrib/monit.upstart])
838
AC_CONFIG_FILES([contrib/monit.service])
843
echo "Monit Build Information:"
845
echo " Architecture: ${ARCH}"
846
if test "$use_sslstatic" = "1" -o "$use_ssl" = "1"; then
847
echo " SSL include directory: ${sslincldir}"
848
echo " SSL library directory: ${ssllibdir}"
850
echo " Compiler flags: ${CFLAGS}"
851
echo " Linker flags: ${LIBS}"
852
echo " pid file location: ${piddir}"
853
echo " Install directory: ${prefix}"
857
+------------------------------------------------------------+
859
| This is Open Source Software and use is subject to the GNU |
860
| AFFERO GENERAL PUBLIC LICENSE version 3, available in this |
861
| distribution in the file COPYING. |
863
| By continuing this installation process, you are bound by |
864
| the terms of this license agreement. If you do not agree |
865
| with the terms of this license, you must abort the |
866
| installation process at this point. |
867
+------------------------------------------------------------+
868
| Monit has been configured with the following options: |
871
if test "$use_pam" = "1"; then
872
echo "| PAM support: ENABLED |"
874
echo "| PAM support: DISABLED |"
876
if test "$use_sslstatic" = "1" -o "$use_ssl" = "1"; then
877
echo "| SSL support: ENABLED |"
879
echo "| SSL support: DISABLED |"
881
if test "$use_largefiles" = "1"; then
882
echo "| Large files support: ENABLED |"
884
echo "| Large files support: DISABLED |"
886
if test "x1" = "x$OPTIMIZED"; then
887
echo "| Optimized: ENABLED |"
889
echo "| Optimized: DISABLED |"
891
echo "+------------------------------------------------------------+"