~ubuntu-branches/ubuntu/trusty/monit/trusty-proposed

« back to all changes in this revision

Viewing changes to .pc/11_enable_hurd.patch/configure.ac

  • Committer: Package Import Robot
  • Author(s): Sergey B Kirpichev
  • Date: 2012-12-11 16:06:27 UTC
  • Revision ID: package-import@ubuntu.com-20121211160627-5x45vpkpqb41yuz6
Tags: 1:5.5-3
* Fix FTBFS for i386 and kfreebsd-i386: patch 10
* Enable building on Hurd: patch 11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Process this file with bootstrap to produce a configure script.
 
2
 
 
3
# autoconf requirement
 
4
AC_PREREQ([2.53])
 
5
 
 
6
# Note: in  case of beta subversion, use underscore "_" rather then dash "-"
 
7
# since RPM doesn't allow dash in Version
 
8
# Example: 5.0_beta2
 
9
AC_INIT([monit], [5.5], [monit-general@nongnu.org])
 
10
AC_CONFIG_AUX_DIR(config)
 
11
AC_CONFIG_MACRO_DIR([m4])
 
12
AM_INIT_AUTOMAKE
 
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])
 
16
 
 
17
 
 
18
# ------------------------------------------------------------------------
 
19
# Programs 
 
20
# ------------------------------------------------------------------------
 
21
 
 
22
AC_PROG_CC
 
23
AC_PROG_INSTALL
 
24
AC_PROG_MAKE_SET
 
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/])
 
30
        fi
 
31
fi
 
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/])
 
37
        fi
 
38
fi
 
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.])
 
44
        fi
 
45
else
 
46
        d=`date  '+%B %d. %Y'`
 
47
        POD2MANFLAGS="--center 'User Commands' --release '${d}' --date='www.mmonit.com' --lax"
 
48
        AC_SUBST([POD2MANFLAGS])
 
49
fi
 
50
 
 
51
 
 
52
# ------------------------------------------------------------------------
 
53
# Libtool 
 
54
# ------------------------------------------------------------------------
 
55
 
 
56
AC_DISABLE_STATIC
 
57
AC_PROG_LIBTOOL
 
58
 
 
59
 
 
60
# ---------------------------------------------------------------------------
 
61
# Build options
 
62
# ---------------------------------------------------------------------------
 
63
 
 
64
AC_ARG_ENABLE(optimized,
 
65
        AS_HELP_STRING([--enable-optimized],
 
66
                [Build software optimized]),
 
67
    [
 
68
        CFLAGS=`echo $CFLAGS|sed 's/-O.//'`
 
69
        if test "x$enableval" = "xyes" ; then
 
70
                CFLAGS=`echo $CFLAGS|sed 's/-g//'`
 
71
                CFLAGS="$CFLAGS -O3"
 
72
                OPTIMIZED=1
 
73
        else
 
74
                OPTIMIZED=0
 
75
        fi
 
76
    ],
 
77
    [
 
78
        OPTIMIZED=0
 
79
    ]
 
80
)
 
81
 
 
82
 
 
83
# ------------------------------------------------------------------------
 
84
# Libraries 
 
85
# ------------------------------------------------------------------------
 
86
 
 
87
# Check for libraries
 
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])])
 
93
 
 
94
AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_ERROR([POSIX thread library is required])])
 
95
 
 
96
# ------------------------------------------------------------------------
 
97
# Header files 
 
98
# ------------------------------------------------------------------------
 
99
 
 
100
AC_HEADER_STDC
 
101
AC_HEADER_SYS_WAIT
 
102
AC_HEADER_STAT
 
103
AC_HEADER_TIME
 
104
 
 
105
AC_CHECK_HEADERS([ \
 
106
        alloca.h \
 
107
        arpa/inet.h \
 
108
        asm/page.h \
 
109
        asm/param.h \
 
110
        cf.h \
 
111
        crt_externs.h \
 
112
        ctype.h \
 
113
        crypt.h \
 
114
        dirent.h \
 
115
        errno.h \
 
116
        execinfo.h \
 
117
        fcntl.h \
 
118
        getopt.h \
 
119
        glob.h \
 
120
        grp.h \
 
121
        kvm.h \
 
122
        paths.h \
 
123
        kstat.h \
 
124
        sys/protosw.h \
 
125
        limits.h \
 
126
        loadavg.h \
 
127
        locale.h \
 
128
        mach/host_info.h \
 
129
        mach/mach.h \
 
130
        mach/mach_host.h \
 
131
        memory.h \
 
132
        mntent.h \
 
133
        netdb.h \
 
134
        sys/socket.h \
 
135
        netinet/in.h \
 
136
        netinet/in_systm.h \
 
137
        pam/pam_appl.h \
 
138
        security/pam_appl.h \
 
139
        poll.h \
 
140
        procfs.h \
 
141
        sys/procfs.h \
 
142
        procinfo.h \
 
143
        pthread.h \
 
144
        pwd.h \
 
145
        regex.h \
 
146
        setjmp.h \
 
147
        signal.h \
 
148
        stdarg.h \
 
149
        stddef.h \
 
150
        stdio.h \
 
151
        string.h \
 
152
        strings.h \
 
153
        stropts.h \
 
154
        sys/cfgodm.h \
 
155
        sys/cfgdb.h \
 
156
        sys/dk.h \
 
157
        sys/dkstat.h \
 
158
        sys/filio.h \
 
159
        sys/ioctl.h \
 
160
        sys/loadavg.h \
 
161
        sys/lock.h \
 
162
        sys/mnttab.h \
 
163
        sys/mutex.h \
 
164
        sys/nlist.h \
 
165
        sys/param.h \
 
166
        sys/pstat.h \
 
167
        sys/queue.h \
 
168
        sys/resource.h \
 
169
        sys/statfs.h \
 
170
        sys/statvfs.h \
 
171
        sys/sysinfo.h \
 
172
        sys/systemcfg.h \
 
173
        sys/time.h \
 
174
        sys/tree.h \
 
175
        sys/types.h \
 
176
        sys/un.h \
 
177
        sys/utsname.h \
 
178
        sys/vmmeter.h \
 
179
        sys/vfs.h \
 
180
        syslog.h \
 
181
        unistd.h \
 
182
        uvm/uvm.h \
 
183
        uvm/uvm_extern.h \
 
184
        vm/vm.h \
 
185
        ])
 
186
 
 
187
AC_CHECK_HEADERS([ \
 
188
        libperfstat.h \
 
189
        ],
 
190
        [],
 
191
        [],
 
192
        [
 
193
         #ifdef HAVE_SYS_PROTOSW_H
 
194
         #include <sys/protosw.h>
 
195
         #endif
 
196
        ])
 
197
 
 
198
AC_CHECK_HEADERS([ \
 
199
        netinet/ip.h \
 
200
        ],
 
201
        [],
 
202
        [],
 
203
        [
 
204
         #ifdef HAVE_SYS_TYPES_H
 
205
         #include <sys/types.h>
 
206
         #endif
 
207
         #if HAVE_NETINET_IN_SYSTM_H
 
208
         #include <netinet/in_systm.h>
 
209
         #endif
 
210
         #if HAVE_NETINET_IN_SYSTM_H
 
211
         #include <netinet/in.h>
 
212
         #endif
 
213
        ])
 
214
 
 
215
AC_CHECK_HEADERS([ \
 
216
        net/if.h \
 
217
        netinet/ip_icmp.h \
 
218
        ],
 
219
        [],
 
220
        [],
 
221
        [
 
222
         #ifdef HAVE_SYS_TYPES_H
 
223
         #include <sys/types.h>
 
224
         #endif
 
225
         #if HAVE_SYS_SOCKET_H
 
226
         #include <sys/socket.h>
 
227
         #endif
 
228
         #if HAVE_NETINET_IN_SYSTM_H
 
229
         #include <netinet/in.h>
 
230
         #endif
 
231
         #if HAVE_NETINET_IN_SYSTM_H
 
232
         #include <netinet/in_systm.h>
 
233
         #endif
 
234
         #if HAVE_NETINET_IP_H
 
235
         #include <netinet/ip.h>
 
236
         #endif
 
237
        ])
 
238
 
 
239
AC_CHECK_HEADERS([ \
 
240
        sys/sysctl.h \
 
241
        sys/mount.h \
 
242
        sys/proc.h \
 
243
        sys/swap.h \
 
244
        sys/ucred.h \
 
245
        sys/user.h \
 
246
        ],
 
247
        [],
 
248
        [],
 
249
        [
 
250
         #ifdef HAVE_SYS_PARAM_H
 
251
         #include <sys/param.h>
 
252
         #endif
 
253
        ])
 
254
 
 
255
AC_CHECK_HEADERS([ \
 
256
        machine/vmparam.h \
 
257
        vm/pmap.h \
 
258
        machine/pmap.h \
 
259
        vm/vm_map.h \
 
260
        vm/vm_object.h \
 
261
        ],
 
262
        [],
 
263
        [],
 
264
        [
 
265
         #ifdef HAVE_SYS_PARAM_H
 
266
         #include <sys/param.h>
 
267
         #endif
 
268
         #ifdef HAVE_SYS_QUEUE_H
 
269
         #include <sys/queue.h>
 
270
         #endif
 
271
         #ifdef HAVE_SYS_LOCK_H
 
272
         #include <sys/lock.h>
 
273
         #endif
 
274
         #ifdef HAVE_SYS_MUTEX_H
 
275
         #include <sys/mutex.h>
 
276
         #endif
 
277
         #ifdef HAVE_VM_VM_H
 
278
         #include <vm/vm.h>
 
279
         #endif
 
280
         #ifdef HAVE_VM_PMAP_H
 
281
         #include <vm/pmap.h>
 
282
         #endif
 
283
        ])
 
284
 
 
285
AC_CHECK_HEADERS([ \
 
286
        sys/resourcevar.h \
 
287
        ],
 
288
        [],
 
289
        [],
 
290
        [
 
291
         #ifdef HAVE_SYS_TIME_H
 
292
         #include <sys/time.h>
 
293
         #endif
 
294
         #ifdef HAVE_SYS_RESOURCE_H
 
295
         #include <sys/resource.h>
 
296
         #endif
 
297
        ])
 
298
 
 
299
AC_CHECK_HEADERS([ \
 
300
        uvm/uvm_map.h \
 
301
        uvm/uvm_pmap.h \
 
302
        uvm/uvm_object.h \
 
303
        ],
 
304
        [],
 
305
        [],
 
306
        [
 
307
         #ifdef HAVE_SYS_TIME_H
 
308
         #include <sys/time.h>
 
309
         #endif
 
310
         #ifdef HAVE_SYS_LOCK_H
 
311
         #include <sys/lock.h>
 
312
         #endif
 
313
         #ifdef HAVE_SYS_TREE_H
 
314
         #include <sys/tree.h>
 
315
         #endif
 
316
         #ifdef HAVE_UVM_UVM_EXTERN_H
 
317
         #include <uvm/uvm_extern.h>
 
318
         #endif
 
319
        ])
 
320
 
 
321
# Check for types.
 
322
AC_TYPE_MODE_T
 
323
AC_TYPE_PID_T
 
324
AC_TYPE_SIZE_T
 
325
AC_TYPE_PID_T
 
326
AC_TYPE_SIGNAL
 
327
 
 
328
# Check for structures.
 
329
AC_STRUCT_TM
 
330
AC_CHECK_MEMBERS([struct tm.tm_gmtoff])
 
331
 
 
332
 
 
333
# ------------------------------------------------------------------------
 
334
# Functions 
 
335
# ------------------------------------------------------------------------
 
336
 
 
337
# Checks for library functions.
 
338
AC_FUNC_ERROR_AT_LINE
 
339
AC_FUNC_FORK
 
340
AC_FUNC_STAT
 
341
AC_FUNC_STRFTIME
 
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)
 
350
 
 
351
# Check for SOL_IP
 
352
AC_MSG_CHECKING(for SOL_IP)
 
353
AC_TRY_COMPILE([
 
354
        #include <netdb.h>
 
355
        #include <sys/socket.h>], 
 
356
        [int level = SOL_IP;], 
 
357
        [AC_MSG_RESULT(yes)
 
358
        AC_DEFINE([HAVE_SOL_IP], [1], [Define to 1 if SOL_IP is defined.])], 
 
359
        [AC_MSG_RESULT(no)])
 
360
 
 
361
AC_MSG_CHECKING(for va_copy)
 
362
AC_TRY_LINK([
 
363
        #include <stdarg.h>
 
364
], [
 
365
        va_list ap;
 
366
        va_list ap_copy;
 
367
        va_copy(ap, ap_copy);
 
368
], [
 
369
        AC_MSG_RESULT(yes)
 
370
        AC_DEFINE([HAVE_VA_COPY], [1], [Define to 1 if VA_COPY is defined.])
 
371
], [
 
372
        AC_MSG_RESULT(no)
 
373
])
 
374
 
 
375
 
 
376
# ------------------------------------------------------------------------
 
377
# Compiler 
 
378
# ------------------------------------------------------------------------
 
379
 
 
380
# Compiler characteristics
 
381
AC_C_CONST
 
382
AC_C_BIGENDIAN
 
383
 
 
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";
 
388
        # Add C99 support
 
389
        CFLAGS="$CFLAGS -D_GNU_SOURCE -std=c99"
 
390
        # does this compiler support -Wno-pointer-sign ?
 
391
        svd_CFLAGS="$CFLAGS"
 
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 ?
 
395
        svd_CFLAGS="$CFLAGS"
 
396
        CFLAGS="-Wno-address $CFLAGS"
 
397
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [], [CFLAGS="$svd_CFLAGS"])
 
398
fi
 
399
 
 
400
 
 
401
# ------------------------------------------------------------------------
 
402
# Paths 
 
403
# ------------------------------------------------------------------------
 
404
 
 
405
# Find the right directory to put the root-mode PID file in
 
406
AC_MSG_CHECKING([pid file location])
 
407
if test -d "/run"
 
408
then
 
409
        piddir="/run"
 
410
elif test -d "/var/run"
 
411
    piddir="/var/run"
 
412
elif test -d "/etc"
 
413
then
 
414
        piddir="/etc"
 
415
fi
 
416
 
 
417
AC_DEFINE_UNQUOTED([PIDDIR], "$piddir",
 
418
          [Define to the pid storage directory.])
 
419
AC_MSG_RESULT([$piddir])
 
420
 
 
421
# Test mounted filesystem description file
 
422
if test -f "/etc/mtab"
 
423
then
 
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])
 
427
fi
 
428
 
 
429
# ------------------------------------------------------------------------
 
430
# Architecture/OS detection
 
431
# ------------------------------------------------------------------------
 
432
 
 
433
# Backward compatibility until we get ride of arch settings
 
434
architecture=`uname`
 
435
if test "$architecture" = "SunOS" 
 
436
then
 
437
   ARCH="SOLARIS"
 
438
   CFLAGS="$CFLAGS -D _REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__ -m64"
 
439
   LDFLAGS="$LDFLAGS -m64"
 
440
   test_kstat="true"
 
441
   AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
 
442
   if test `uname -m` = "i86pc"
 
443
   then
 
444
      if test "x$GCC" = "xyes"
 
445
      then
 
446
            CFLAGS="$CFLAGS -mtune=opteron"
 
447
            LDFLAGS="$LDFLAGS -mtune=opteron"
 
448
      else
 
449
            CFLAGS="$CFLAGS -xarch=sse2"
 
450
            LDFLAGS="$LDFLAGS -xarch=sse2"
 
451
      fi
 
452
   else
 
453
      if test "x$GCC" = "xyes"
 
454
      then
 
455
            CFLAGS="$CFLAGS -mtune=v9"
 
456
            LDFLAGS="$LDFLAGS -mtune=v9"
 
457
      else
 
458
            CFLAGS="$CFLAGS -xarch=sparc"
 
459
            LDFLAGS="$LDFLAGS -xarch=sparc"
 
460
      fi
 
461
   fi
 
462
elif test "$architecture" = "Linux" 
 
463
then
 
464
   ARCH="LINUX"
 
465
   CFLAGS="$CFLAGS -D _REENTRANT"
 
466
   LDFLAGS="$LDFLAGS -rdynamic"
 
467
   if test `uname -r | awk -F '.' '{print$1$2}'` -ge "26"
 
468
   then
 
469
        AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
 
470
   fi
 
471
elif test "$architecture" = "HP-UX"
 
472
then
 
473
   ARCH="HPUX"
 
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"
 
477
then
 
478
   ARCH="OPENBSD"
 
479
   CFLAGS="$CFLAGS -D _REENTRANT"
 
480
   test_kvm="true"
 
481
   use_pam=0 # No PAM on OpenBSD (supports BSD Auth API instead of PAM)
 
482
elif test "$architecture" = "FreeBSD"
 
483
then
 
484
   ARCH="FREEBSD"
 
485
   CFLAGS="$CFLAGS -D _REENTRANT"
 
486
   test_kvm="true"
 
487
elif test "$architecture" = "GNU/kFreeBSD"
 
488
then
 
489
   ARCH="FREEBSD"
 
490
   CFLAGS="$CFLAGS -D _REENTRANT"
 
491
   test_kvm="true"
 
492
elif test "$architecture" = "NetBSD"
 
493
then
 
494
   ARCH="NETBSD"
 
495
   CFLAGS="$CFLAGS -D _REENTRANT"
 
496
   test_kvm="true"
 
497
elif test "$architecture" = "Darwin"
 
498
then
 
499
   ARCH="DARWIN"
 
500
   CFLAGS="$CFLAGS -DREENTRANT -no-cpp-precomp -DNEED_SOCKLEN_T_DEFINED"
 
501
   test_kvm="true"
 
502
   LIBS="$LIBS -framework System -multiply_defined suppress"
 
503
elif test "$architecture" = "AIX"
 
504
then
 
505
   ARCH="AIX"
 
506
   CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT"
 
507
   LIBS="$LIBS -lodm"   
 
508
   # AIX v. 5.2
 
509
   LIBS="$LIBS -lcfg"   
 
510
   # AIX v. 5.3
 
511
   LIBS="$LIBS -lperfstat"      
 
512
   AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.])
 
513
else
 
514
   AC_MSG_WARN([Architecture not supported: ${architecture}])
 
515
   CFLAGS="$CFLAGS -D _REENTRANT"
 
516
   ARCH="UNKNOWN"
 
517
fi
 
518
AC_SUBST(ARCH)
 
519
 
 
520
# ------------------------------------------------------------------------
 
521
# Resource code
 
522
# ------------------------------------------------------------------------
 
523
 
 
524
# Test for kvm libs
 
525
kvm_libs=""
 
526
if test "$test_kvm"; then
 
527
        AC_CHECK_LIB([kvm],
 
528
                     [kvm_open],
 
529
                     [kvm_libs="-lkvm"])
 
530
        if test "$kvm_libs"
 
531
        then
 
532
                LIBS="$LIBS $kvm_libs"
 
533
        fi
 
534
fi
 
535
kstat_libs=""
 
536
if test "$test_kstat"; then
 
537
        AC_CHECK_LIB([kstat],
 
538
                     [kstat_open],
 
539
                     [kstat_libs="-lkstat"])
 
540
        if test "$kstat_libs"
 
541
        then
 
542
                LIBS="$LIBS $kstat_libs"
 
543
        fi
 
544
fi
 
545
 
 
546
 
 
547
# ------------------------------------------------------------------------
 
548
# Large files code
 
549
# ------------------------------------------------------------------------
 
550
 
 
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)],
 
555
    [
 
556
        dnl Check the withvalue                
 
557
        if test "x$withval" = "xno" ; then
 
558
            use_largefiles=0
 
559
            AC_MSG_RESULT([disabled])
 
560
        fi
 
561
        if test "x$withval" = "xyes" ; then
 
562
            use_largefiles=1
 
563
            AC_MSG_RESULT([enabled])
 
564
        fi
 
565
    ],
 
566
    [
 
567
        if test `uname` = "AIX"
 
568
        then
 
569
            use_largefiles=0
 
570
            AC_MSG_RESULT([disabled])
 
571
        else
 
572
            use_largefiles=1
 
573
            AC_MSG_RESULT([enabled])
 
574
        fi
 
575
    ]
 
576
)
 
577
 
 
578
# Settings for largefiles support
 
579
if test "$use_largefiles" = 1; then
 
580
        AC_SYS_LARGEFILE
 
581
fi
 
582
 
 
583
 
 
584
# ------------------------------------------------------------------------
 
585
# PAM Code
 
586
# ------------------------------------------------------------------------
 
587
 
 
588
AC_MSG_CHECKING([for PAM support])
 
589
AC_ARG_WITH(pam,
 
590
    [  --without-pam           disable the use of pam (default: enabled)],
 
591
    [
 
592
        dnl Check the withvalue                
 
593
        if test "x$withval" = "xno" ; then
 
594
            use_pam=0
 
595
            AC_MSG_RESULT([disabled])
 
596
        fi
 
597
        if test "x$withval" = "xyes" ; then
 
598
            use_pam=1
 
599
            AC_MSG_RESULT([enabled])
 
600
        fi
 
601
    ],
 
602
    [
 
603
        if test "x$use_pam" = "x" ; then
 
604
            use_pam=1
 
605
            AC_MSG_RESULT([enabled])
 
606
        fi
 
607
    ]
 
608
)
 
609
 
 
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])])
 
612
fi
 
613
 
 
614
 
 
615
# ------------------------------------------------------------------------
 
616
# SSL Code
 
617
# ------------------------------------------------------------------------
 
618
 
 
619
# Check for ssl includes
 
620
checksslincldir() { :
 
621
    if test -f "$1/openssl/ssl.h"; then
 
622
        sslincldir="$1"
 
623
        return 0
 
624
    fi
 
625
    return 1
 
626
}
 
627
 
 
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 ")"
 
633
    then
 
634
        ssllibdir="$1"
 
635
        return 0
 
636
    fi
 
637
    return 1
 
638
}
 
639
 
 
640
checkssllibdirstatic() { :
 
641
    if test "(" -f "$1/libcrypto.a" ")"  -a \
 
642
            "(" -f "$1/libssl.a" ")" ; then
 
643
        ssllibdir="$1"
 
644
        return 0
 
645
    fi
 
646
    return 1
 
647
}
 
648
 
 
649
# Check if we want to have SSL
 
650
 
 
651
AC_MSG_CHECKING([for static SSL support])
 
652
 
 
653
AC_ARG_WITH(ssl-static,
 
654
    [  --with-ssl-static=DIR       location of SSL installation],
 
655
    [
 
656
        dnl Check the specified location only
 
657
        for dir in "$withval" "$withval/include"; do
 
658
            checksslincldir "$dir"
 
659
        done
 
660
        for dir in "$withval" "$withval/lib"; do
 
661
            checkssllibdirstatic "$dir" && break 2
 
662
        done
 
663
        use_sslstatic=1
 
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.])
 
667
        AC_SUBST(sslincldir)
 
668
        AC_SUBST(ssllibdir)
 
669
        CFLAGS="$CFLAGS -I$sslincldir"
 
670
        LIBS="$LIBS $ssllibdir/libssl.a $ssllibdir/libcrypto.a"
 
671
    ],
 
672
    [
 
673
        use_sslstatic=0
 
674
        AC_MSG_RESULT([disabled])
 
675
    ]
 
676
)
 
677
 
 
678
if test "$use_sslstatic" = "0"
 
679
then
 
680
    AC_MSG_CHECKING([for SSL support])
 
681
 
 
682
    AC_ARG_WITH(ssl,
 
683
        [  --without-ssl           disable the use of ssl (default: enabled)],
 
684
        [
 
685
            dnl Check the withvalue                
 
686
            if test "x$withval" = "xno" ; then
 
687
                use_ssl=0
 
688
                AC_MSG_RESULT([disabled])
 
689
            fi
 
690
            if test "x$withval" = "xyes" ; then
 
691
                use_ssl=1
 
692
                AC_MSG_RESULT([enabled])
 
693
            fi
 
694
        ],
 
695
        [
 
696
            use_ssl=1
 
697
            AC_MSG_RESULT([enabled])
 
698
        ]
 
699
    )
 
700
 
 
701
 
 
702
    # Check for SSL directory
 
703
    if test "$use_ssl" = "1"; then
 
704
 
 
705
        AC_ARG_WITH(ssl-dir,
 
706
            [  --with-ssl-dir=DIR       location of SSL installation],
 
707
            [
 
708
                dnl Check the specified location only
 
709
                for dir in "$withval" "$withval/include"; do
 
710
                        checksslincldir "$dir"
 
711
                done
 
712
                for dir in "$withval" "$withval/lib"; do
 
713
                    checkssllibdirdynamic "$dir" && break 2
 
714
                done
 
715
            ]
 
716
        )
 
717
 
 
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],
 
721
            [
 
722
                dnl Check the specified location only
 
723
                checksslincldir "$withval"
 
724
            ],
 
725
            [
 
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
 
734
                        done
 
735
                    done
 
736
                fi
 
737
            ]
 
738
        )
 
739
        if test -z "$sslincldir"; then
 
740
            AC_MSG_RESULT([Not found])
 
741
            echo
 
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"
 
745
            echo
 
746
            exit 1
 
747
        fi
 
748
        AC_MSG_RESULT([$sslincldir])
 
749
 
 
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],
 
753
            [
 
754
                dnl Check the specified location only
 
755
                checkssllibdirdynamic "$withval"
 
756
            ],
 
757
            [
 
758
                if test -z "$ssllibdir"; then   
 
759
                    dnl Search default locations of SSL libraries
 
760
                    for maindir in "" \
 
761
                                   /usr \
 
762
                                   /usr/local \
 
763
                                   /usr/pkg \
 
764
                                   /var \
 
765
                                   /opt \
 
766
                                   /usr/sfw \
 
767
                                   /opt/csw \
 
768
                                   /opt/freeware; do
 
769
                        for dir in $maindir \
 
770
                                   $maindir/openssl \
 
771
                                   $maindir/ssl \
 
772
                                   $maindir/lib \
 
773
                                   $maindir/lib/openssl \
 
774
                                   $maindir/lib/ssl \
 
775
                                   $maindir/ssl/lib \
 
776
                                   $maindir/lib/64 \
 
777
                                   $maindir/lib/64/openssl \
 
778
                                   $maindir/lib/64/ssl \
 
779
                                   $maindir/ssl/lib/64 \
 
780
                                   $maindir/lib64 \
 
781
                                   $maindir/lib64/openssl \
 
782
                                   $maindir/lib64/ssl \
 
783
                                   $maindir/ssl/lib64 \
 
784
                                   `eval echo $libdir`; do
 
785
                            checkssllibdirdynamic $dir && break 2
 
786
                        done
 
787
                    done
 
788
                fi
 
789
            ]
 
790
        )
 
791
        if test -z "$ssllibdir"; then
 
792
            AC_MSG_RESULT([Not found])
 
793
            echo
 
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"
 
797
            echo
 
798
            exit 1
 
799
        fi
 
800
        AC_MSG_RESULT([$ssllibdir])
 
801
 
 
802
        AC_DEFINE([HAVE_OPENSSL], 1, [Define to 1 if you have openssl.])
 
803
        AC_SUBST(sslincldir)
 
804
        AC_SUBST(ssllibdir)
 
805
    fi
 
806
 
 
807
    # Add SSL includes and libraries
 
808
    if test "$sslincldir" -a "$ssllibdir"
 
809
    then
 
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"
 
817
        else
 
818
         CFLAGS="$CFLAGS -I$sslincldir"
 
819
         LIBS="$LIBS -L$ssllibdir -lssl -lcrypto"
 
820
        fi
 
821
    fi
 
822
fi
 
823
 
 
824
# ------------------------------------------------------------------------
 
825
# Outputs
 
826
# ------------------------------------------------------------------------
 
827
 
 
828
AH_BOTTOM([
 
829
/* Mask out GCC __attribute__ extension for non-gcc compilers. */
 
830
#ifndef __GNUC__
 
831
#define __attribute__(x)
 
832
#endif
 
833
])
 
834
 
 
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])
 
839
 
 
840
AC_OUTPUT
 
841
 
 
842
echo
 
843
echo "Monit Build Information:"
 
844
echo
 
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}"
 
849
fi
 
850
echo "              Compiler flags: ${CFLAGS}"
 
851
echo "                Linker flags: ${LIBS}"
 
852
echo "           pid file location: ${piddir}"
 
853
echo "           Install directory: ${prefix}"
 
854
echo
 
855
 
 
856
cat <<EOT
 
857
+------------------------------------------------------------+
 
858
| License:                                                   |
 
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.                          |
 
862
|                                                            |
 
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:      |
 
869
|                                                            |
 
870
EOT
 
871
if test "$use_pam" = "1"; then
 
872
echo "|   PAM support:                                  ENABLED    |"
 
873
else
 
874
echo "|   PAM support:                                  DISABLED   |"
 
875
fi
 
876
if test "$use_sslstatic" = "1" -o "$use_ssl" = "1"; then
 
877
echo "|   SSL support:                                  ENABLED    |"
 
878
else
 
879
echo "|   SSL support:                                  DISABLED   |"
 
880
fi
 
881
if test "$use_largefiles" = "1"; then
 
882
echo "|   Large files support:                          ENABLED    |"
 
883
else
 
884
echo "|   Large files support:                          DISABLED   |"
 
885
fi
 
886
if test "x1" = "x$OPTIMIZED"; then
 
887
echo "|   Optimized:                                    ENABLED    |"
 
888
else
 
889
echo "|   Optimized:                                    DISABLED   |"
 
890
fi
 
891
echo "+------------------------------------------------------------+"