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