1 AC_INIT([cronie],[1.5.4],[mmaslano@redhat.com,tmraz@fedoraproject.org])
2 AC_CONFIG_HEADER([config.h])
5 AM_INIT_AUTOMAKE([subdir-objects])
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
8 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
12 dnl Checks for programs.
18 dnl Check for _GNU_SOURCE
19 AC_USE_SYSTEM_EXTENSIONS
56 dnl Checks for typedefs, structures, and compiler characteristics.
65 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
67 dnl Checking for programs
70 [AC_HELP_STRING([--with-editor=EDITOR], [path to default editor])],
71 [editor_defined="$with_editor"],
72 [editor_defined="no"])
73 AS_IF([test "x$editor_defined" = "xno"], [
74 AC_PATH_PROG([editor_defined], [vi], [/usr/bin/vi])
76 AC_DEFINE_UNQUOTED([EDITOR], ["$editor_defined"], [default editor])
78 AC_MSG_CHECKING(username to run under)
79 AC_ARG_WITH(daemon_username,
80 [AS_HELP_STRING([--with-daemon_username=DAEMON_USERNAME], [Username to run under (default daemon) ])],
83 AC_MSG_ERROR(Need DAEMON_USERNAME.)
86 DAEMON_USERNAME=daemon
90 DAEMON_USERNAME="$withval";
91 AC_MSG_RESULT($withval)
94 DAEMON_USERNAME=daemon
97 AC_SUBST(DAEMON_USERNAME)
99 AC_MSG_CHECKING(groupname to run under)
100 AC_ARG_WITH(daemon_groupname,
101 [AS_HELP_STRING([--with-daemon_groupname=DAEMON_GROUPNAME], [Groupname to run under (default daemon) ])],
104 AC_MSG_ERROR(Need DAEMON_GROUPNAME.)
107 DAEMON_GROUPNAME=daemon
108 AC_MSG_RESULT(daemon)
111 DAEMON_GROUPNAME="$withval";
112 AC_MSG_RESULT($withval)
115 DAEMON_GROUPNAME=daemon
116 AC_MSG_RESULT(daemon)
118 AC_SUBST(DAEMON_GROUPNAME)
120 # Check whether inotify is accepted
122 [AS_HELP_STRING([--with-inotify], [ Enable inotify support])],
123 [ if test "x$withval" != "xno" ; then
124 AC_DEFINE(WITH_INOTIFY,1,[Define if you want inotify support.])
125 AC_CHECK_HEADER([sys/inotify.h], , AC_MSG_ERROR(Inotify support requires sys/inotify.h header))
126 AC_CHECK_FUNCS(inotify_init inotify_add_watch)
131 AC_ARG_ENABLE(pie,CRONIE_HELP_STRING(--enable-pie,Build cronie as a Position Independent Executable))
132 if test "x$enable_pie" = xyes; then
133 CFLAGS="$CFLAGS -fPIE -DPIE"
134 LDFLAGS="$LDFLAGS -pie"
137 AC_ARG_ENABLE(relro,CRONIE_HELP_STRING(--enable-relro,Build cronie with relro flag))
138 if test "x$enable_relro" = xyes; then
139 LDFLAGS="$LDFLAGS -Wl,-z,relro -Wl,-z,now"
142 AC_ARG_ENABLE(bsd, BSD_STRING(--enable-bsd,Build cronie with BSD specific parts))
144 # Check whether user wants SELinux support
148 [AS_HELP_STRING([--with-selinux], [Enable SELinux support])],
149 [ if test "x$withval" != "xno" ; then
151 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
153 AC_CHECK_HEADER([selinux/selinux.h], ,AC_MSG_ERROR(SELinux support requires selinux.h header))
154 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
155 AC_MSG_ERROR(SELinux support requires libselinux library))
156 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
162 AC_ARG_WITH(pam, [AS_HELP_STRING([--with-pam], [Build with PAM support])])
163 AC_ARG_ENABLE(pam, [AS_HELP_STRING([--enable-pam], [Alias for --with-pam])])
165 # Check that with_pam and enable_pam are consistent.
166 # If neither one is set, the default is "no."
167 if test -z "$with_pam"; then
168 with_pam=${enable_pam:-no}
169 elif test -n "$enable_pam" && test "$with_pam" != "$enable_pam"; then
171 [Contradicting --with/without-pam and --enable/disable-pam options.])
174 AM_CONDITIONAL([PAM], [test "$with_pam" != no])
176 if test "$with_pam" != no; then
177 AC_DEFINE(WITH_PAM, 1, [Define if you want to enable PAM support])
179 AC_CHECK_HEADERS([pam/pam_appl.h security/pam_appl.h],
180 [pam_appl_h_found=yes])
181 test "$pam_appl_h_found" = yes ||
182 AC_MSG_ERROR([PAM headers not found])
185 AC_CHECK_LIB([dl], [dlopen], [libdl_found=yes], [libdl_found=no])
186 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
187 AC_CHECK_FUNCS([pam_getenvlist pam_putenv])
190 case $libdl_found:" $LIBS " in #(
191 *" -ldl "*) LIBPAM= ;; #(
192 yes:*) LIBPAM=-ldl ;; # libdl found, but is not in $LIBS
194 AC_SUBST([LIBPAM], ["-lpam $LIBPAM"])
197 AC_DEFINE(DEBUGGING,1,[Code will be built with debug info.])
199 AC_DEFINE(MAILARG,"/usr/sbin/sendmail",[There will be path to sendmail.])
201 AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f %s",
202 [-i = don't terminate on "." by itself
203 -Fx = Set full-name of sender
204 -odi = Option Deliverymode Interactive
205 -oem = Option Errors Mailedtosender
206 -oi = Ignore "." alone on a line
207 -t = Get recipient from headers
208 -f %s = Envelope sender address
209 -d = undocumented but common flag.])
211 AC_DEFINE(SYSLOG,1,[Using syslog for log messages.])
213 AC_DEFINE(CAPITALIZE_FOR_PS, 1, [if you have a tm_gmtoff member in struct tm])
215 # Check whether user wants Linux audit support
217 [AS_HELP_STRING([--with-audit], [Enable audit trails])],
218 [ if test "x$withval" != "xno" ; then
220 AC_DEFINE(WITH_AUDIT,1,[Define if you want Audit trails.])
221 AC_CHECK_HEADER([libaudit.h], ,AC_MSG_ERROR(Audit trails requires libaudit.h header))
222 AC_CHECK_LIB(audit, audit_open, [ LIBAUDIT="-laudit" ],
223 AC_MSG_ERROR(Audit support needs audit libraries.))
229 AC_ARG_ENABLE(syscrontab,
230 [AS_HELP_STRING([--enable-syscrontab], [Build cronie with system crontab enabled.])],
231 [ if test "x$enableval" != xno; then
232 AC_DEFINE(ENABLE_SYSCRONTAB,1,[Define if you want system crontab.])
233 fi ], [AC_DEFINE(ENABLE_SYSCRONTAB,1,[Define if you want system crontab.])]
236 dnl CRONIE_VAR_DEFAULT (VAR, DESCRIPTION, DEFAULT)
237 dnl --------------------------------------------
238 AC_DEFUN([CRONIE_CONF_VAR],
239 [AC_ARG_VAR([$1], [$2 @<:@$3@:>@])
240 if test "$$1" = ""; then
245 AC_DEFUN([ANACRON_CONF_VAR],
246 [AC_ARG_VAR([$1], [$2 @<:@$3@:>@])
247 if test "$$1" = ""; then
252 CRONIE_CONF_VAR([SYSCRONTAB], [the current working directory of the running daemon], [${sysconfdir}/crontab])
253 CRONIE_CONF_VAR([SYS_CROND_DIR], [the current working directory of the running daemon], [${sysconfdir}/cron.d])
254 CRONIE_CONF_VAR([SPOOL_DIR], [the directory where all the user cron tabs reside], [${localstatedir}/spool/cron])
256 AC_ARG_ENABLE([anacron], [AS_HELP_STRING([--disable-anacron], [Do not build anacron.])], [], [enable_anacron=yes])
257 AM_CONDITIONAL([ANACRON], [test "$enable_anacron" = yes])
258 if test "$enable_anacron" != no; then
259 ANACRON_CONF_VAR([ANACRON_SPOOL_DIR],[The path for anacron locks.],[${localstatedir}/spool/anacron])
260 ANACRON_CONF_VAR([ANACRONTAB],[The anacron table for regular jobs.],[${sysconfdir}/anacrontab])
263 AC_CONFIG_FILES([Makefile])