]> granicus.if.org Git - cronie/blob - configure.ac
do not log carriage return
[cronie] / configure.ac
1 AC_INIT([cronie],[1.5.4],[mmaslano@redhat.com,tmraz@fedoraproject.org])
2 AC_CONFIG_HEADER([config.h])
3 AC_PREREQ(2.60)
4
5 AM_INIT_AUTOMAKE([subdir-objects])
6
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
8                             [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
9
10 AC_CANONICAL_HOST
11
12 dnl Checks for programs.
13
14 AC_PROG_CC
15 AC_PROG_INSTALL
16 AC_PROG_LN_S
17
18 dnl Check for _GNU_SOURCE
19 AC_USE_SYSTEM_EXTENSIONS
20
21 AC_CHECK_HEADERS( \
22         dirent.h \
23         fcntl.h \
24         getopt.h \
25         glob.h \
26         limits.h \
27         paths.h \
28         pty.h \
29         selinux/selinux.h \
30         stddef.h \
31         stdint.h \
32         sys/audit.h \
33         sys/inotify.h \
34         sys/stat.h \
35         sys/stream.h \
36         sys/stropts.h \
37         sys/time.h \
38         sys/timers.h \
39         sys/types.h \
40         sys/cdefs.h \
41         sys/fcntl.h \
42         time.h \
43         unistd.h \
44         util.h \
45         utime.h \
46 )
47
48 AC_CHECK_FUNCS( \
49        fcntl \
50        lockf \
51        flock \
52        fchown \
53        fchgrp \
54 )
55
56 dnl Checks for typedefs, structures, and compiler characteristics.
57 AC_C_CONST
58 AC_TYPE_SIGNAL
59 AC_TYPE_UID_T
60 AC_TYPE_MODE_T
61 AC_TYPE_OFF_T
62 AC_TYPE_PID_T
63 AC_TYPE_SIZE_T
64 AC_STRUCT_TM
65 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
66
67 dnl Checking for programs
68
69 AC_ARG_WITH([editor],
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])
75 ])
76 AC_DEFINE_UNQUOTED([EDITOR], ["$editor_defined"], [default editor])
77
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) ])],
81 [ case "$withval" in
82   no)
83     AC_MSG_ERROR(Need DAEMON_USERNAME.)
84     ;;
85   yes)
86     DAEMON_USERNAME=daemon
87     AC_MSG_RESULT(daemon)
88     ;;
89   *)
90     DAEMON_USERNAME="$withval";
91     AC_MSG_RESULT($withval)
92     ;;
93     esac ],
94     DAEMON_USERNAME=daemon
95     AC_MSG_RESULT(daemon)
96 )
97 AC_SUBST(DAEMON_USERNAME)
98
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) ])],
102 [ case "$withval" in
103   no)
104     AC_MSG_ERROR(Need DAEMON_GROUPNAME.)
105     ;;
106   yes)
107     DAEMON_GROUPNAME=daemon
108     AC_MSG_RESULT(daemon)
109     ;;
110   *)
111     DAEMON_GROUPNAME="$withval";
112     AC_MSG_RESULT($withval)
113     ;;
114     esac ],
115     DAEMON_GROUPNAME=daemon
116     AC_MSG_RESULT(daemon)
117 )
118 AC_SUBST(DAEMON_GROUPNAME)
119
120 # Check whether inotify is accepted
121 AC_ARG_WITH(inotify,
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)
127      fi
128    ]
129 )
130
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"
135 fi
136
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"
140 fi
141
142 AC_ARG_ENABLE(bsd, BSD_STRING(--enable-bsd,Build cronie with BSD specific parts))
143
144 # Check whether user wants SELinux support
145 SELINUX_MSG="no"
146 LIBSELINUX=""
147 AC_ARG_WITH(selinux,
148         [AS_HELP_STRING([--with-selinux], [Enable SELinux support])],
149         [ if test "x$withval" != "xno" ; then
150                 saved_LIBS="$LIBS"
151                 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
152                 SELINUX_MSG="yes"
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)
157                 LIBS="$saved_LIBS"
158                 AC_SUBST(LIBSELINUX)
159         fi ]
160 )
161
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])])
164
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
170         AC_MSG_ERROR(
171           [Contradicting --with/without-pam and --enable/disable-pam options.])
172 fi
173
174 AM_CONDITIONAL([PAM], [test "$with_pam" != no])
175
176 if test "$with_pam" != no; then
177         AC_DEFINE(WITH_PAM, 1, [Define if you want to enable PAM support])
178         pam_appl_h_found=no
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])
183
184         saved_LIBS="$LIBS"
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])
188         LIBS="$saved_LIBS"
189
190         case $libdl_found:" $LIBS " in #(
191         *" -ldl "*) LIBPAM= ;; #(
192         yes:*) LIBPAM=-ldl ;; # libdl found, but is not in $LIBS
193         esac
194         AC_SUBST([LIBPAM], ["-lpam $LIBPAM"])
195 fi
196
197 AC_DEFINE(DEBUGGING,1,[Code will be built with debug info.])
198
199 AC_DEFINE(MAILARG,"/usr/sbin/sendmail",[There will be path to sendmail.])
200
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.])
210
211 AC_DEFINE(SYSLOG,1,[Using syslog for log messages.])
212
213 AC_DEFINE(CAPITALIZE_FOR_PS, 1, [if you have a tm_gmtoff member in struct tm])
214
215 # Check whether user wants Linux audit support
216 AC_ARG_WITH(audit,
217         [AS_HELP_STRING([--with-audit], [Enable audit trails])],
218         [ if test "x$withval" != "xno" ; then
219                 saved_LIBS="$LIBS"
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.))
224                 LIBS="$saved_LIBS"
225                 AC_SUBST(LIBAUDIT)
226         fi ]
227 )
228
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.])]
234 )
235
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
241         $1='$3'
242 fi
243 ])
244
245 AC_DEFUN([ANACRON_CONF_VAR],
246 [AC_ARG_VAR([$1], [$2 @<:@$3@:>@])
247 if test "$$1" = ""; then
248             $1='$3'
249                 fi
250 ])
251
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])
255
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])
261 fi
262
263 AC_CONFIG_FILES([Makefile])
264 AC_OUTPUT
265