]> granicus.if.org Git - fcron/blob - configure.in
Merge branch 'master' of ssh://git.tuxfamily.org/gitroot/fcron/fcron
[fcron] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3
4 dnl ---------------------------------------------------------------------
5 dnl Initial settings
6 dnl ---------------------------------------------------------------------
7
8 AC_INIT(allow.c)
9 AC_CONFIG_HEADER(config.h)
10 AC_PREREQ(2.57)
11 m4_include([m4/ax_lib_readline.m4])
12
13 vers="3.2.0"
14 vers_quoted="\"$vers\""
15 AC_DEFINE_UNQUOTED(VERSION, $vers)
16 AC_DEFINE_UNQUOTED(VERSION_QUOTED, $vers_quoted)
17 VERSION="$vers"
18 AC_SUBST(VERSION)
19
20 copyright_quoted="\"2000-2014\""
21 AC_DEFINE_UNQUOTED(COPYRIGHT_QUOTED, $copyright_quoted)
22
23
24 dnl ---------------------------------------------------------------------
25 dnl Check for programs, header files, types, etc (autoconf builtins)
26 dnl ---------------------------------------------------------------------
27
28 dnl Checks for programs.
29 AC_PROG_CC
30 AC_PATH_PROGS(MAKE, $MAKE gmake make, $PATH:/local/bin:/usr/local/bin:/opt/TWWfsw/bin:/opt/sfw/bin)
31 AC_MSG_CHECKING(if make is actually GNU Make)
32 if test x"$MAKE" = x; then
33   AC_MSG_ERROR(Cannot locate a make utility, 1)
34 elif $MAKE --version 2>/dev/null |grep "^GNU Make" >/dev/null; then
35   AC_MSG_RESULT(yes)
36 else
37   AC_MSG_RESULT(no)
38   AC_MSG_ERROR($MAKE is not GNU Make.
39 Please install GNU Make or adjust your PATH so that GNU make can be found
40 before any others., 1)
41 fi
42 AC_PROG_INSTALL
43 AC_PROG_LN_S
44 AC_PATH_PROGS(STRIP, $STRIP strip, /usr/css/bin:$PATH:/local/bin:/usr/local/bin:/opt/TWWfsw/bin:/opt/sfw/bin)
45
46 dnl Checks for libraries.
47
48 dnl Checks for header files.
49 AC_HEADER_DIRENT
50 AC_HEADER_STDC
51 AC_HEADER_SYS_WAIT
52 AC_CHECK_HEADERS(fcntl.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h)
53 AC_CHECK_HEADERS(errno.h sys/fcntl.h getopt.h limits.h)
54 AC_CHECK_HEADERS(stdarg.h)
55 AC_CHECK_HEADERS(termios.h)
56 AC_CHECK_HEADERS(strings.h)
57 AC_CHECK_HEADERS(sys/types.h sys/socket.h sys/un.h)
58 AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h crypt.h shadow.h libaudit.h)
59 AC_CHECK_HEADERS(sys/resource.h)
60 AC_CHECK_HEADERS(grp.h)
61
62 AC_CHECK_SIZEOF(time_t)
63
64 dnl Checks for typedefs, structures, and compiler characteristics.
65 AC_C_CONST
66 AC_TYPE_PID_T
67 AC_TYPE_SIZE_T
68 AC_HEADER_TIME
69 AC_STRUCT_TM
70 AC_TYPE_UID_T
71
72 dnl Define sizeof constants
73 AC_CHECK_SIZEOF(pid_t)
74 AC_CHECK_SIZEOF(time_t)
75 AC_CHECK_SIZEOF(short int)
76 AC_CHECK_SIZEOF(int)
77 AC_CHECK_SIZEOF(long int)
78 AC_CHECK_SIZEOF(long long int)
79
80 dnl Checks for library functions.
81 AC_PROG_GCC_TRADITIONAL
82 AC_FUNC_MEMCMP
83 AC_TYPE_SIGNAL
84 AC_FUNC_STRFTIME
85 AC_FUNC_WAIT3
86 AC_CHECK_LIB(xnet, shutdown)
87 AC_CHECK_LIB(selinux, getcon, [selinuxavail=1], [selinuxavail=0])
88 AC_CHECK_LIB(audit, audit_open, [auditavail=1], [auditavail=0])
89 AX_LIB_READLINE
90 AC_CHECK_FUNC(getloadavg, [getloadavg=1], [getloadavg=0])
91 AC_CHECK_LIB(kstat, kstat_open, [kstat=1], [kstat=0])
92 if test $getloadavg -eq 1; then
93 dnl Nothing to do ...
94   AC_FUNC_GETLOADAVG
95   AC_MSG_CHECKING(function to use for lavg* options)  
96   AC_MSG_RESULT(getloadavg())
97 elif test $kstat -eq 1;  then
98   AC_MSG_CHECKING(function to use for lavg* options)  
99   LIBS="$LIBS -lkstat"
100   AC_LIBOBJ([getloadavg])
101   AC_DEFINE_UNQUOTED(HAVE_KSTAT, 1)
102   AC_MSG_RESULT(kstat)
103 else
104 dnl Try to use the /proc/loadavg file ...
105   AC_FUNC_GETLOADAVG
106   AC_MSG_CHECKING(function to use for lavg* options)  
107   AC_MSG_RESULT(/proc/loadavg)
108 fi
109 AC_CHECK_FUNCS(getcwd gettimeofday mktime putenv strerror setenv unsetenv gethostname)
110 AC_CHECK_FUNCS(getopt_long)
111 AC_CHECK_FUNCS(mkstemp)
112 AC_CHECK_FUNCS(flock lockf)
113 AC_CHECK_FUNCS(setlinebuf)
114 AC_CHECK_FUNCS(signal)
115 AC_CHECK_FUNCS(sigset)
116
117 AC_CHECK_FUNCS(seteuid, [seteuid=1], [seteuid=0])
118 AC_CHECK_FUNCS(setegid, [setegid=1], [setegid=0])
119 AC_CHECK_FUNCS(setresuid, [setresuid=1], [setresuid=0])
120 AC_CHECK_FUNCS(setresgid, [setresgid=1], [setresgid=0])
121 if test \( \( $seteuid -eq 1 \) -a \( $setegid -eq 1 \) \) -o \( \( "$setresuid" -eq 1 \) -a \( "$setresgid" -eq 1 \) \) ; then
122   has_euid=1
123 else
124   has_euid=0
125 fi
126
127 AC_CHECK_FUNCS(setpriority)
128
129 AC_SEARCH_LIBS([getspnam],[shadow sec], [AC_DEFINE_UNQUOTED(HAVE_GETSPNAM, 1)], [])
130
131 AC_CHECK_FUNCS(crypt, [crypt=1], [crypt=0])
132 if test "$crypt" -eq "0"; then
133   AC_CHECK_LIB(crypt, crypt, [crypt=1], [crypt=0])
134   if test "$crypt" -eq "1"; then
135     LIBS="$LIBS -lcrypt"
136   fi
137 fi
138 if test "$crypt" -eq "1"; then
139   AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1)
140 fi
141
142
143 dnl --- sockets
144 dnl Check for post-Reno style struct sockaddr
145 AC_CACHE_CHECK([for sa_len],
146   ac_cv_sa_len,
147 [AC_TRY_COMPILE([#include <sys/types.h>
148 #include <sys/socket.h>], [int main(void) {
149  struct sockaddr t;t.sa_len = 0;}],
150   ac_cv_sa_len=yes,ac_cv_sa_len=no)])
151 if test $ac_cv_sa_len = yes; then
152   AC_DEFINE(HAVE_SA_LEN)
153 fi
154
155 dnl --- Socket authentication
156 AC_CHECK_HEADERS(cred.h sys/cred.h ucred.h sys/ucred.h)
157 AC_CHECK_FUNCS(getpeerucred) dnl Solaris 10 onward
158 AC_CHECK_FUNCS(getpeereid) dnl OpenBSD/FreeBSD
159
160 dnl ---------------------------------------------------------------------
161 dnl Check for fcron more specific stuffs (paths, progs, ...)
162 dnl ---------------------------------------------------------------------
163
164 fcron_enable_checks=yes
165 AC_ARG_ENABLE(checks,
166 [  --disable-checks   Don't verify that programs exist on the host ], dnl '
167 [ case "$enableval" in 
168    no)
169      fcron_enable_checks=no
170      ;;
171    yes)
172      fcron_enable_checks=yes
173      ;;
174    *)
175      AC_MSG_WARN([Bad value for --disable-checks])
176      ;;
177   esac
178 ])
179      
180
181 dnl ---------------------------------------------------------------------
182 dnl Programs ...
183
184 AC_PATH_PROG(FOUND_SENDMAIL, sendmail, , $PATH:/usr/lib:/usr/sbin )
185 SENDMAIL=
186 USE_SENDMAIL=1
187 AC_MSG_CHECKING([actual sendmail to use])
188 AC_ARG_WITH(sendmail, [  --with-sendmail=PATH   Path to sendmail.],
189 [ case "$withval" in
190   no)  USE_SENDMAIL=0 ;;
191   yes) ;;
192   *)   SENDMAIL=$withval ;;
193   esac ],
194 )
195
196 if test "$USE_SENDMAIL" != "1" ; then
197   AC_MSG_RESULT([disabled])
198   AC_MSG_WARN([Without sendmail you will not get the output of the jobs by mail])
199 elif test -n "$SENDMAIL" ; then
200   dnl The user defined a sendmail program to use:
201   if test ! -x "$SENDMAIL" ; then
202     dnl ... but it is not an executable file!
203     AC_MSG_RESULT([$SENDMAIL])
204     AC_MSG_ERROR([File $SENDMAIL is not an executable file])
205   else
206     dnl ... and it is valid
207     AC_MSG_RESULT([$SENDMAIL])
208   fi
209 elif test -z "$FOUND_SENDMAIL" ; then
210   dnl The user didn't defined a program to use, and we didn't find one automatically
211   AC_MSG_RESULT([not found])
212   AC_MSG_ERROR([Empty sendmail path or cannot determine path to sendmail: try option --with-sendmail=PATH])
213 else
214   dnl Use the automatically found sendmail program:
215   SENDMAIL="$FOUND_SENDMAIL"
216   AC_MSG_RESULT([$SENDMAIL])
217 fi
218
219 AC_SUBST([SENDMAIL])
220 if test "$USE_SENDMAIL" = "1"; then
221   AC_DEFINE([USE_SENDMAIL])
222 fi
223
224 AC_PATH_PROG(FOUND_FCRON_SHELL, sh, , $PATH)
225 FCRON_SHELL=
226 AC_MSG_CHECKING([default shell to use to run a job])
227 AC_ARG_WITH(shell,
228 [  --with-shell=PATH    Path to default shell (by default, path to sh).],
229 [ case "$withval" in
230   no)
231     AC_MSG_ERROR(Need a default shell)
232     ;;
233   yes)
234     ;;
235   *)
236     FCRON_SHELL=$withval
237     if test $fcron_enable_checks = 'yes' -a ! -x "$withval"; then
238       AC_MSG_ERROR([
239 File $withval is not an executable file])
240     fi
241     ;;
242   esac ]
243 )
244 if test x"$FCRON_SHELL" = x ; then
245   FCRON_SHELL=$FOUND_FCRON_SHELL
246   if test "$FOUND_FCRON_SHELL" = "" ; then
247      AC_MSG_ERROR([
248 Cannot determine path to sh: try option --with-shell=PATH])
249   fi
250 fi
251
252 AC_MSG_RESULT([$FCRON_SHELL])
253 AC_SUBST([FCRON_SHELL])
254
255 AC_PATH_PROG(FOUND_FCRON_EDITOR, vi)
256 FCRON_EDITOR=
257 AC_MSG_CHECKING([editor to use for fcrontab])
258 AC_ARG_WITH(editor,
259 [  --with-editor=PATH   Path to default editor (by default, path to vi).],
260 [ case "$withval" in
261   no)
262     AC_MSG_ERROR([Need a default editor])
263     ;;
264   yes)
265     ;;
266   *)
267     FCRON_EDITOR=$withval
268     if test $fcron_enable_checks = 'yes' -a ! -x "$withval"; then
269       AC_MSG_ERROR([
270 File $withval is not an executable file])
271     fi
272     ;;
273   esac ]
274 )
275
276 if test x"$FCRON_EDITOR" = x; then
277   FCRON_EDITOR=$FOUND_FCRON_EDITOR
278   if test x"$FCRON_EDITOR" = x ; then
279     AC_MSG_ERROR([
280 Cannot determine path to vi: try option --with-editor=PATH])
281   fi
282 fi
283
284 AC_MSG_RESULT([$FCRON_EDITOR])
285 AC_SUBST([FCRON_EDITOR])
286
287 dnl ---------------------------------------------------------------------
288 dnl Paths ...
289
290 PIDDIR="${localstatedir}/run"
291 AC_MSG_CHECKING(location of pid files)
292 AC_ARG_WITH(piddir,
293 [  --with-piddir=PATH   Directory containing pid files.],
294 [ case "$withval" in
295   no)
296     AC_MSG_ERROR([Need PIDDIR.])
297     ;;
298   yes)
299     ;;
300   *)
301     PIDDIR=$withval
302     ;;
303   esac ]
304 )
305 AC_MSG_RESULT([$PIDDIR])
306 PIDFILE="${PIDDIR}/fcron.pid"
307 REBOOT_LOCK="${PIDDIR}/fcron.reboot"
308 AC_SUBST(PIDDIR)
309 AC_SUBST(PIDFILE)
310 AC_SUBST(REBOOT_LOCK)
311
312 FIFODIR="${localstatedir}/run"
313 AC_MSG_CHECKING(location of fifo files)
314 AC_ARG_WITH(fifodir,
315 [  --with-fifodir=PATH  Directory containing fifo files.],
316 [ case "$withval" in
317   no)
318     AC_MSG_ERROR(Need FIFODIR.)
319     ;;
320   yes)
321     ;;
322   *)
323     FIFODIR=$withval
324     ;;
325   esac]
326 )
327 AC_MSG_RESULT([$FIFODIR])
328 FIFOFILE="${FIFODIR}/fcron.fifo"
329 AC_SUBST(FIFODIR)
330 AC_SUBST(FIFOFILE)
331
332 sp="${localstatedir}/spool/fcron"
333 AC_MSG_CHECKING(location of spool directory)
334 AC_ARG_WITH(spooldir,
335 [  --with-spooldir=PATH Directory containing fcron spool (default PREFIX/var/spool/fcron).],
336 [ case "$withval" in
337   no)
338     AC_MSG_ERROR(Need SPOOLDIR.)
339     ;;
340   yes)
341     ;;
342   *)
343     sp="$withval"
344     ;;
345   esac ]
346 )
347 AC_MSG_RESULT($sp)
348 FCRONTABS="$sp"
349 AC_DEFINE_UNQUOTED(FCRONTABS, "$sp")
350 AC_SUBST(FCRONTABS)
351
352 if test \( $getloadavg -eq 0 \) -a \( $kstat -eq 0 \); then
353 proc=/proc
354 AC_MSG_CHECKING(proc directory)
355 AC_ARG_WITH(proc,
356 [  --with-proc=PATH     Directory where linux procfs is mounted (default /proc).],
357 [ case "$withval" in
358   no)
359     AC_MSG_WARN([
360 Without proc, you won't be able to use the lavg* options 
361 ])
362     AC_DEFINE(NOLOADAVG)
363     ;;
364   yes)
365     ;;
366   *)
367     proc=$withval
368     ;;
369   esac ]
370 )
371
372 if test "$withval" != "no" -a $fcron_enable_checks = 'yes'; then
373   if test -f "$proc/loadavg"; then :
374   else
375        AC_MSG_WARN([
376 Cannot determine value for proc directory: try option --with-proc=PATH])
377        AC_MSG_ERROR(Use --with-proc=no to disable the lavg* options)
378   fi
379 fi
380
381 AC_MSG_RESULT($proc)
382 PROC=$proc
383 AC_DEFINE_UNQUOTED(PROC, "$proc")
384 fi
385
386 docdir="${datadir}/doc"
387 AC_MSG_CHECKING(location of doc directory)
388 AC_ARG_WITH(docdir,
389 [  --with-docdir=PATH   Directory containing documentation.],
390 [ case "$withval" in
391   no)
392     AC_MSG_ERROR(Need DOCDIR.)
393     ;;
394   yes)
395     ;;
396   *)
397     docdir="$withval"
398     ;;
399   esac ])
400
401 AC_MSG_RESULT($docdir)
402 DOCDIR="$docdir"
403 AC_SUBST(DOCDIR)
404
405
406 dnl systemd init system
407 SYSTEMD_DIR="no"
408
409 AC_CHECK_PROGS(PKG_CONFIG, $PKG_CONFIG pkg-config, , $PATH:/local/bin:/usr/local/bin:/opt/sfw/bin)
410 AC_MSG_CHECKING(for systemd)
411 AC_ARG_WITH([systemdsystemunitdir],
412 [ --with-systemdsystemunitdir=DIR   Directory for systemd service files.],
413 [], [ if test "x" != "x$PKG_CONFIG"; then
414     with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
415   fi])
416 if test "x$with_systemdsystemunitdir" != xno; then
417    if test "x" != "x$with_systemdsystemunitdir"; then
418        SYSTEMD_DIR="$with_systemdsystemunitdir"
419        AC_MSG_RESULT(yes)
420    else
421        AC_MSG_RESULT(no)
422    fi
423 else
424    AC_MSG_RESULT(disabled)
425 fi
426 AC_SUBST(SYSTEMD_DIR)
427
428
429 dnl ---------------------------------------------------------------------
430 dnl Users and groups ...
431
432 AC_MSG_CHECKING(run non-privileged)
433 AC_ARG_WITH(run-non-privileged,
434 [ --with-run-non-privileged=[yes|no]    Run fcron without root's rights (see FAQ !)],
435 [ case "$withval" in
436   no)
437     run_non_privileged=0
438     AC_MSG_RESULT(no)
439     ;;
440   yes)
441     run_non_privileged=1
442     AC_MSG_RESULT(yes)
443     AC_MSG_WARN([
444
445 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
446 WARNING : 
447         This option allows a non privileged user to run fcron. When used,
448         fcron does not change its rights before running a job (i.e.,
449         if joe runs fcron, every job will run as joe).
450         It means that YOU SHOULD NOT RUN FCRON AS A PRIVILEGED USER WHEN
451         COMPILED WITH THIS OPTION or you'll have a serious security hole.
452 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
453
454 ])
455     AC_DEFINE(RUN_NON_PRIVILEGED)
456     RUN_NON_PRIVILEGED=1
457     AC_SUBST(RUN_NON_PRIVILEGED)
458     bootinstall=0
459     fcrondyn=0
460     usepam=0
461     useselinux=0
462     useaudit=0
463     ;;
464   *)
465     AC_MSG_ERROR(Invalid argument : please use 'yes' or 'no'.)
466     ;;
467   esac],
468   run_non_privileged=0
469   AC_MSG_RESULT(no)
470 )
471
472
473 if test "$fcrondyn" = ""; then
474   fcrondyn=1
475 fi
476 AC_MSG_CHECKING(if fcrondyn should be compiled)
477 AC_ARG_WITH(fcrondyn,
478 [ --with-fcrondyn=[yes|no]      Compile (or not) fcrondyn (default: yes).],
479 [ case "$withval" in
480   no)
481     fcrondyn=0
482     AC_MSG_RESULT(no)
483     ;;
484   yes)
485     if test "$crypt" -eq 1; then
486       fcrondyn=1
487       AC_MSG_RESULT(yes)
488     else
489       AC_MSG_ERROR(Need a crypt() function.)
490     fi
491     ;;
492   *)
493     AC_MSG_ERROR(Must be set to either "yes" or "no".)
494     ;;
495   esac ],
496   if test "$fcrondyn" = "1" && test "$crypt" -eq 1; then
497     AC_MSG_RESULT(yes)
498   else
499     fcrondyn=0
500     AC_MSG_RESULT(no)
501   fi
502 )
503 FCRONDYN="$fcrondyn"
504 if test "$fcrondyn" = 1; then
505   AC_DEFINE_UNQUOTED(FCRONDYN, "$fcrondyn")
506   AC_SUBST(FCRONDYN)
507 fi
508
509 AC_MSG_CHECKING([root's username])
510 rootname=root
511 AC_ARG_WITH(rootname,
512 [ --with-rootname=USERNAME      Root's username (default root) ],
513 [ case "$withval" in
514   no)
515     AC_MSG_ERROR([Need rootname.])
516     ;;
517   yes)
518     ;;
519   *)
520         rootname=$withval
521     ;;
522   esac 
523 ])
524
525 if test $fcron_enable_checks = 'yes'; then
526
527    rootuid=`$srcdir/script/has_usrgrp.pl -user $rootname -printuid`
528    if test "x$rootuid" = "x"; then
529     AC_MSG_ERROR([
530 Invalid root's username or cannot determine root's username: try option --with-rootname=USERNAME])
531   fi
532 fi
533 AC_MSG_RESULT([$rootname])
534
535
536 AC_MSG_CHECKING([root's groupname])
537 AC_ARG_WITH(rootgroup,
538 [ --with-rootgroup=GROUPNAME    Root's groupname (default root (or wheel)) ],
539 [ case "$withval" in
540   no)
541     AC_MSG_ERROR(Need rootgroup.)
542     ;;
543   yes)
544     ;;
545   *)
546     rootgroup=$withval
547     ;;
548     esac ]
549 )
550
551 if test $fcron_enable_checks = 'yes'; then
552
553   if test x"$rootgroup" = x; then
554     # rootgroup not defined: test a few possibilities
555     rgid=`$srcdir/script/has_usrgrp.pl -group root -printgid`
556     wgid=`$srcdir/script/has_usrgrp.pl -group wheel -printgid`
557     if test "x$rgid" != "x"; then
558         rootgid=$rgid
559         rootgroup=root
560     elif test "x$wgid" != "x"; then
561         rootgid=$wgid
562         rootgroup=wheel
563     else
564         AC_MSG_ERROR([
565 Cannot determine root's groupname: try option --with-rootgroup=GROUPNAME])
566     fi
567   else
568     # rootgroup defined: check it
569     rootgid=`$srcdir/script/has_usrgrp.pl -group $rootgroup -printgid`
570     if test "x$rootgid" = "x"; then
571         AC_MSG_ERROR([
572 Cannot determine root's groupname: try option --with-rootgroup=GROUPNAME])
573     fi
574   fi
575
576 else
577   # no check: use values given by user or default values
578   if test x"$rootgroup" = x ; then
579     rootgroup=root
580   fi
581
582 fi
583
584 AC_MSG_RESULT([$rootgroup])
585
586 ROOTNAME="$rootname"
587 AC_SUBST(ROOTNAME)
588 AC_DEFINE_UNQUOTED(ROOTNAME, "$rootname")
589 ROOTGROUP="$rootgroup"
590 AC_SUBST(ROOTGROUP)
591 AC_DEFINE_UNQUOTED(ROOTGROUP, "$rootgroup")
592
593
594 username="$rootname"
595 groupname="$rootgroup"
596
597 AC_MSG_CHECKING(username to run fcrontab under)
598 AC_ARG_WITH(username,
599 [ --with-username=USERNAME      Username to run fcrontab under (default fcron) ],
600 [ case "$withval" in
601   no)
602     AC_MSG_ERROR(Need USERNAME.)
603     ;;
604   yes)
605     if test "$has_euid" -eq 1 ; then
606         username=fcron
607     fi
608     AC_MSG_RESULT($username)
609     ;;
610   *)
611     if test "$has_euid" -eq 1 ; then
612         username="$withval";
613         AC_MSG_RESULT($username)
614         if test "$withval" = "$rootname" && test "$RUN_NON_PRIVILEGED" != "1"; then
615             AC_MSG_ERROR([
616
617 Running fcrontab setuid root is NOT secure and would completely break
618 the security model of fcron. You must use a different user name.
619 ])
620             has_euid=0
621         fi
622     else
623         AC_MSG_RESULT($username)
624         AC_MSG_WARN(username must be $rootname as your system has no seteuid)
625     fi
626     ;;
627     esac ],
628     if test "$has_euid" -eq 1 ; then
629         username=fcron
630     fi
631     AC_MSG_RESULT($username)
632 )
633
634 AC_MSG_CHECKING(groupname to run fcrontab under)
635 AC_ARG_WITH(groupname,
636 [ --with-groupname=GROUPNAME    Groupname to run fcrontab under (default fcron) ],
637 [ case "$withval" in
638   no)
639     AC_MSG_ERROR(Need GROUPNAME.)
640     ;;
641   yes)
642     if test "$has_euid" -eq 1 ; then
643         groupname=fcron
644     fi
645     AC_MSG_RESULT($groupname)
646     ;;
647   *)
648     if test "$has_euid" -eq 1 ; then
649         groupname="$withval";
650         AC_MSG_RESULT($groupname)
651     else
652         AC_MSG_RESULT($groupname)
653         AC_MSG_WARN(groupname must be $rootgroup as username is $username)
654     fi
655     ;;
656     esac ],
657     if test "$has_euid" -eq 1 ; then
658         groupname=fcron
659     fi
660     AC_MSG_RESULT($groupname)
661 )
662
663 USERNAME="$username"
664 AC_SUBST(USERNAME)
665 AC_DEFINE_UNQUOTED(USERNAME, "$username")
666 GROUPNAME="$groupname"
667 AC_SUBST(GROUPNAME)
668 AC_DEFINE_UNQUOTED(GROUPNAME, "$groupname")
669
670
671 if test "$has_euid" -eq 1 ; then
672   AC_DEFINE(USE_SETE_ID)
673 fi
674
675
676
677 sysfcrontab="systab"
678 use_sysfcrontab=1
679 AC_MSG_CHECKING(use a system fcrontab)
680 AC_ARG_WITH(sysfcrontab,
681 [ --with-sysfcrontab=NAME       Use (or not) a system fcrontab (default: yes)],
682 [ case "$withval" in
683   no)
684     use_sysfcrontab=0
685     AC_MSG_RESULT(no)
686     ;;
687   yes)
688     AC_MSG_RESULT(yes)
689     ;;
690   *)
691     sysfcrontab="$withval"
692     AC_MSG_RESULT($sysfcrontab)
693   esac ],
694   AC_MSG_RESULT(yes)
695 )
696 if test "$use_sysfcrontab" -eq 1 ; then
697   AC_DEFINE_UNQUOTED(SYSFCRONTAB, "$sysfcrontab")
698   SYSFCRONTAB="$sysfcrontab"
699   AC_SUBST(SYSFCRONTAB)
700 fi
701
702
703 dnl ---------------------------------------------------------------------
704 dnl Misc ...
705
706 AC_ARG_WITH(debug,
707 [  --with-debug=CFLAGS  Use default debug flags or CFLAGS if given to compile fcron in debug mode.],
708 [ case "$withval" in
709   no)
710     cflags="-O2 -Wall"
711     debug="0"
712     ;;
713   yes)
714     cflags="-DDEBUG -g -Wall -DFOREGROUND -DMALLOC_CHECK_=2 -Wpointer-arith -Wstrict-prototypes"
715     bootinstall=0
716     debug="1"
717     ;;
718   *)
719     cflags="$withval"
720     debug="1"
721     ;;
722   esac ],
723     cflags="-O2 -Wall"
724     debug="0"
725 )
726 DEBUG=$debug
727 AC_SUBST(DEBUG)
728
729
730 if test "$bootinstall" = ""; then
731   bootinstall=1
732 fi
733 AC_MSG_CHECKING(install interactively a boot script)
734 AC_ARG_WITH(boot-install,
735 [  --with-boot-install=[yes|no] Install (interactively) a boot script (default: yes).],
736 [ case "$withval" in
737   no)
738     bootinstall=0
739     AC_MSG_RESULT(no)
740     ;;
741   yes)
742     bootinstall=1
743     AC_MSG_RESULT(yes)
744     ;;
745   *)
746     AC_MSG_ERROR(Must be set to either "yes" or "no".)
747     ;;
748   esac ],
749     if test "$bootinstall" = "1"; then
750       AC_MSG_RESULT(yes)
751     else
752       AC_MSG_RESULT(no)
753     fi
754 )
755 BOOTINSTALL="$bootinstall"
756 AC_DEFINE_UNQUOTED(BOOTINSTALL, "$bootinstall")
757 AC_SUBST(BOOTINSTALL)
758
759
760 AC_ARG_WITH(cflags,
761 [  --with-cflags=CFLAGS Use CFLAGS flags to compile fcron.],
762 [ case "$withval" in
763   no)
764     AC_MSG_ERROR(Need an explicit value for --with-cflags.)
765     ;;
766   yes)
767     AC_MSG_ERROR(Need an explicit value for --with-cflags.)
768     ;;
769   *)
770     cflags="$withval"
771     ;;
772   esac ],
773 )
774 CFLAGS=$cflags
775 AC_DEFINE_UNQUOTED(CFLAGS, "$cflags")
776
777
778 AC_MSG_CHECKING(automatic answer to make install's questions)
779 AC_ARG_WITH(answer-all,
780 [  --with-answer-all=[yes|no]   Answer the argument to every make install's questions.],
781 [ case "$withval" in
782   no)
783     answerall=0
784     AC_MSG_RESULT(yes (answer "no"))
785     ;;
786   yes)
787     answerall=1
788     AC_MSG_RESULT(yes (answer "yes"))
789     ;;
790   *)
791     AC_MSG_ERROR(Must be set to either "yes" or "no".)
792     ;;
793   esac ],
794     answerall=2
795     AC_MSG_RESULT(no)
796 )
797 ANSWERALL="$answerall"
798 AC_DEFINE_UNQUOTED(ANSWERALL, "$answerall")
799 AC_SUBST(ANSWERALL)
800
801
802 AC_MSG_CHECKING(if audit trails should be enabled if available)
803 AC_ARG_WITH(audit,
804 [ --with-audit=[yes|no] Enable (or not) audit trails if available (default: yes).],
805 [ case "$withval" in
806   no)
807     useaudit=0
808     ;;
809   yes)
810     useaudit=1
811     ;;
812   *)
813     AC_MSG_ERROR(Must be set to either "yes" or "no".)
814     ;;
815   esac ]
816 )
817 if test useaudit = "0"; then
818   AC_MSG_RESULT(no)
819 elif test "$useaudit" = "1" && test "$auditavail" != 1; then
820   useaudit=0
821   AC_MSG_RESULT(not available)
822   AC_MSG_ERROR([
823   You requested audit trails to be enabled, but libaudit was not found.
824 ])
825 elif test "$auditavail" = 1; then
826   useaudit=1
827   AC_MSG_RESULT(yes)
828   LIBS="$LIBS -laudit"
829   AC_DEFINE(WITH_AUDIT)
830 else
831   useaudit=0
832   AC_MSG_RESULT(no)
833 fi
834
835
836 if test "$usepam" = ""; then
837   usepam=1
838 fi
839 AC_MSG_CHECKING(if pam should be used if available)
840 AC_ARG_WITH(pam,
841 [ --with-pam=[yes|no]   Use (or not) PAM if available (default: yes).],
842 [ case "$withval" in
843   no)
844     usepam=0
845     AC_MSG_RESULT(no)
846     ;;
847   yes)
848     AC_MSG_RESULT(yes)
849     AC_CHECK_LIB(pam, pam_acct_mgmt)
850     ;;
851   *)
852     AC_MSG_ERROR(Must be set to either "yes" or "no".)
853     ;;
854   esac ],
855   if test "$usepam" = "1"; then 
856     AC_MSG_RESULT(yes)
857     AC_CHECK_LIB(pam, pam_acct_mgmt)
858   else
859     usepam=0
860     AC_MSG_RESULT(no)
861   fi    
862 )
863 if test "$usepam" != "0" && echo "$LIBS" | grep -- "-lpam" > /dev/null ; then
864   usepam=1
865 else
866   usepam=0
867 fi
868 USEPAM="$usepam"
869 AC_SUBST(USEPAM)
870
871
872 if test "$useselinux" = ""; then
873   useselinux=1
874 fi
875 AC_MSG_CHECKING(if SELinux should be used)
876 AC_ARG_WITH(selinux,
877 [ --with-selinux=[yes|no]       Use (or not) SELinux (default: yes).],
878 [ case "$withval" in
879   no)
880     useselinux=0
881     AC_MSG_RESULT(no)
882     ;;
883   yes)
884     if test "$selinuxavail" -eq 1; then
885         useselinux=1
886         AC_MSG_RESULT(yes)
887     else
888         AC_MSG_RESULT(not available)
889         AC_MSG_ERROR([
890   You requested the use of SELinux, but SELinux is considered 
891   as not available by configure script.
892 ])
893     fi
894     ;;
895   *)
896     AC_MSG_ERROR(Must be set to either "yes" or "no".)
897     ;;
898   esac ],
899   if test "$useselinux" != "0" && test "$selinuxavail" -eq 1; then
900     useselinux=1
901     AC_MSG_RESULT(yes)
902   else
903     useselinux=0
904     AC_MSG_RESULT(not available)
905   fi
906 )
907 if test "$useselinux" -eq 1; then
908   LIBS="$LIBS -lselinux"
909   AC_DEFINE(WITH_SELINUX)
910   CFLAGS="$CFLAGS -I/usr/include/selinux"
911 fi
912
913
914 dnl ---------------------------------------------------------------------
915 dnl DocBook
916
917 AC_PATH_PROG(JADE,openjade)
918 if test -z "$JADE"; then
919         AC_PATH_PROG(JADE,jade)
920 fi
921
922 AC_PATH_PROG(DB2MAN,docbook2man)
923 if test -z "$DB2MAN"; then
924         AC_PATH_PROG(DB2MAN,db2man)
925 fi
926 AC_MSG_CHECKING(Looking for docbook2man converter)
927 AC_ARG_WITH(db2man,
928 [ --with-db2man=PATH(or 'no')   set PATH to a docbook2man converter.],
929 [ case "$withval" in
930   no) 
931     DB2MAN=""
932     AC_MSG_RESULT(none)
933     ;;
934   yes)
935     AC_MSG_ERROR(Must be set to PATH or "no".)
936     ;;
937   *)
938     if test ! -x "$withval"; then
939       AC_MSG_ERROR($withval is not an exe file.)
940     fi
941     DB2MAN="$withval"
942     AC_MSG_RESULT($withval)
943     ;;
944   esac ],
945   AC_MSG_RESULT(default: $DB2MAN)
946 )
947 AC_SUBST(DB2MAN)
948
949 AC_PATH_PROG(NSGMLS, nsgmls)
950 AC_PATH_PROG(SGMLSPL, sgmlspl)
951
952 DB2MAN_SPEC="/usr/share/sgml/docbook/utils-0.6.9/helpers/docbook2man-spec.pl"
953
954 AC_MSG_CHECKING(Looking for docbook2man-spec file)
955 AC_ARG_WITH(db2man-spec,
956 [ --with-db2man-spec=PATH       set the PATH to docbook2man-spec file
957                                 (needed if no db2man converter is set).],
958 [ case "$withval" in
959   no) 
960     DB2MAN_SPEC=""
961     AC_MSG_RESULT(none)
962     ;;
963   yes)
964     AC_MSG_ERROR(Must be set to PATH or "no".)
965     ;;
966   *)
967     if test ! -f "$withval"; then
968       AC_MSG_ERROR($withval is not a file.)
969     fi
970     DB2MAN_SPEC="$withval"
971     AC_MSG_RESULT($withval)
972     ;;
973   esac ],
974   AC_MSG_RESULT(default)
975 )
976 AC_SUBST(DB2MAN_SPEC)
977
978 if test -x "$DB2MAN"; then
979   DB2MAN_BEFORE="$DB2MAN"
980   DB2MAN_AFTER=""
981 else
982   if test \( \( -f "$DB2MAN_SPEC" \) -a \( -x "$NSGMLS" \) \
983           -a \( -x "$SGMLSPL" \) \); then
984     DB2MAN_BEFORE="$NSGMLS"
985     DB2MAN_AFTER="2> /dev/null | $SGMLSPL $DB2MAN_SPEC"
986   else
987     DB2MAN_BEFORE=""
988     DB2MAN_AFTER=""
989   fi
990 fi
991 AC_SUBST(DB2MAN_BEFORE)
992 AC_SUBST(DB2MAN_AFTER)
993
994
995 DSSSL_DIR="/usr/share/sgml/docbook/stylesheet/dsssl/modular"
996
997 AC_MSG_CHECKING(Looking for dsssl stylsheets)
998 AC_ARG_WITH(dsssl-dir,
999 [ --with-dsssl-dir=DIR  change the default location of DSSSL stylesheets.],
1000 [ case "$withval" in
1001   no) 
1002     DSSSL_DIR=""
1003     AC_MSG_RESULT(none)
1004     ;;
1005   yes)
1006     AC_MSG_ERROR(Must be set to DIR or "no".)
1007     ;;
1008   *)
1009     if test ! -f "$withval/html/docbook.dsl"; then
1010       AC_MSG_ERROR($withval/html/docbook.dsl does not exist.)
1011     fi
1012     DSSSL_DIR="$withval"
1013     AC_MSG_RESULT($withval)
1014     ;;
1015   esac ],
1016   AC_MSG_RESULT(default)
1017   if test ! -f "$DSSSL_DIR/html/docbook.dsl"; then
1018     AC_MSG_WARN([
1019
1020 $DSSSL_DIR/html/docbook.dsl does not exist. You will probably not be able to generate the documentation from the DocBook source files.])
1021     AC_MSG_WARN([Use --with-dsssl-dir to specify a directory.
1022 ])
1023   fi
1024 )
1025 AC_SUBST(DSSSL_DIR)
1026
1027
1028 dnl ---------------------------------------------------------------------
1029 dnl Final settings
1030 dnl ---------------------------------------------------------------------
1031
1032
1033 AC_OUTPUT(Makefile doc/Makefile doc/stylesheets/fcron-doc.dsl)
1034
1035
1036 dnl ---------------------------------------------------------------------
1037 dnl Info for user
1038 dnl ---------------------------------------------------------------------
1039
1040 echo
1041 echo "Summary :"
1042 echo "-------"
1043 echo
1044 echo -n "run in debug mode by default :      "
1045 if test "$debug" -eq "1"; then
1046         echo "yes"
1047 else
1048         echo "no"
1049 fi
1050
1051 echo -n "Audit trails :                      "
1052 if test "$useaudit" -eq 1; then
1053         echo "yes"
1054 else
1055         echo "no"
1056 fi
1057
1058 echo -n "PAM :                               "
1059 if test "$usepam" -eq 1; then
1060         echo "yes"
1061 else
1062         echo "no"
1063 fi
1064
1065 echo -n "SELinux :                           "
1066 if test "$useselinux" -eq 1; then
1067         echo "yes"
1068 else
1069         echo "no"
1070 fi
1071
1072 echo -n "Readline :                          "
1073 if test "$ax_cv_lib_readline" = "no"; then
1074         echo "no"
1075 else
1076         echo "yes"
1077 fi
1078
1079
1080 echo -n "Run without root's rights :         "
1081 if test "$run_non_privileged" -eq 1; then
1082         echo "yes"
1083 else
1084         echo "no"
1085 fi
1086
1087 echo -n "Load average support :              "
1088 if test "$getloadavg" -eq 1 -o -n "$proc"; then
1089         echo "yes"
1090 else
1091         echo "no"
1092 fi
1093
1094 echo -n "compile fcrondyn :                  "
1095 if test "$fcrondyn" -eq 1; then
1096         echo "yes"
1097 else
1098         echo "no"
1099 fi
1100
1101 echo "fcron's user (resp. group) name :   $username (resp. $groupname)"
1102
1103 echo -n "sysfcrontab :                       "
1104 if test "$use_sysfcrontab" -eq 1; then
1105         echo "yes ($sysfcrontab)"
1106 else
1107         echo "no"
1108 fi
1109
1110 echo "prefix:                             $prefix"
1111 echo "exec_prefix:                        $exec_prefix"
1112 echo "datarootdir:                        $datarootdir"
1113 echo "bin dir:                            $bindir"
1114 echo "sbin dir:                           $sbindir"
1115 echo "spool dir:                          $sp"
1116 echo "etc dir:                            $sysconfdir"
1117 echo "doc dir:                            $docdir"
1118 echo "man dir:                            $mandir "
1119
1120
1121 echo
1122 echo "You can now run '$MAKE' to compile"
1123 echo "and then (as root) '$MAKE install' to install fcron."
1124 echo