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