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