-
Notifications
You must be signed in to change notification settings - Fork 83
/
configure.ac
273 lines (234 loc) · 8.23 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
AC_INIT([cronie],[1.7.2])
AC_CONFIG_HEADERS([config.h])
AC_PREREQ([2.64])
AM_INIT_AUTOMAKE([subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
dnl Check for _GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS
AC_CHECK_HEADERS( \
dirent.h \
fcntl.h \
getopt.h \
glob.h \
limits.h \
paths.h \
pty.h \
selinux/selinux.h \
stddef.h \
stdint.h \
sys/audit.h \
sys/inotify.h \
sys/stat.h \
sys/stream.h \
sys/stropts.h \
sys/time.h \
sys/timers.h \
sys/types.h \
sys/cdefs.h \
time.h \
unistd.h \
util.h \
utime.h \
)
AC_CHECK_FUNCS( \
fcntl \
lockf \
flock \
fchown \
fchgrp \
)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
dnl Checking for programs
AC_ARG_WITH([editor],
[AS_HELP_STRING([--with-editor=EDITOR],[path to default editor])],
[editor_defined="$with_editor"],
[editor_defined="no"])
AS_IF([test "x$editor_defined" = "xno"], [
AC_PATH_PROG([editor_defined], [vi], [/usr/bin/vi])
])
AC_DEFINE_UNQUOTED([EDITOR], ["$editor_defined"], [default editor])
AC_MSG_CHECKING(username to run under)
AC_ARG_WITH(daemon_username,
[AS_HELP_STRING([--with-daemon_username=DAEMON_USERNAME], [Username to run under (default daemon) ])],
[ case "$withval" in
no)
AC_MSG_ERROR(Need DAEMON_USERNAME.)
;;
yes)
DAEMON_USERNAME=daemon
AC_MSG_RESULT(daemon)
;;
*)
DAEMON_USERNAME="$withval";
AC_MSG_RESULT($withval)
;;
esac ],
DAEMON_USERNAME=daemon
AC_MSG_RESULT(daemon)
)
AC_SUBST(DAEMON_USERNAME)
AC_MSG_CHECKING(groupname to run under)
AC_ARG_WITH(daemon_groupname,
[AS_HELP_STRING([--with-daemon_groupname=DAEMON_GROUPNAME], [Groupname to run under (default daemon) ])],
[ case "$withval" in
no)
AC_MSG_ERROR(Need DAEMON_GROUPNAME.)
;;
yes)
DAEMON_GROUPNAME=daemon
AC_MSG_RESULT(daemon)
;;
*)
DAEMON_GROUPNAME="$withval";
AC_MSG_RESULT($withval)
;;
esac ],
DAEMON_GROUPNAME=daemon
AC_MSG_RESULT(daemon)
)
AC_SUBST(DAEMON_GROUPNAME)
# Check whether inotify is accepted
AC_ARG_WITH(inotify,
[AS_HELP_STRING([--with-inotify], [ Enable inotify support])],
[ if test "x$withval" != "xno" ; then
AC_DEFINE(WITH_INOTIFY,1,[Define if you want inotify support.])
AC_CHECK_HEADER([sys/inotify.h], , AC_MSG_ERROR(Inotify support requires sys/inotify.h header))
AC_CHECK_FUNCS(inotify_init inotify_add_watch)
fi
]
)
AC_ARG_ENABLE(pie,CRONIE_HELP_STRING(--enable-pie,Build cronie as a Position Independent Executable))
if test "x$enable_pie" = xyes; then
CFLAGS="$CFLAGS -fPIE -DPIE"
LDFLAGS="$LDFLAGS -pie"
fi
AC_ARG_ENABLE(relro,CRONIE_HELP_STRING(--enable-relro,Build cronie with relro flag))
if test "x$enable_relro" = xyes; then
LDFLAGS="$LDFLAGS -Wl,-z,relro -Wl,-z,now"
fi
AC_ARG_ENABLE(bsd, BSD_STRING(--enable-bsd,Build cronie with BSD specific parts))
# Check whether user wants SELinux support
SELINUX_MSG="no"
LIBSELINUX=""
AC_ARG_WITH(selinux,
[AS_HELP_STRING([--with-selinux], [Enable SELinux support])],
[ if test "x$withval" != "xno" ; then
saved_LIBS="$LIBS"
AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
SELINUX_MSG="yes"
AC_CHECK_HEADER([selinux/selinux.h], ,AC_MSG_ERROR(SELinux support requires selinux.h header))
AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
AC_MSG_ERROR(SELinux support requires libselinux library))
AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
LIBS="$saved_LIBS"
AC_SUBST(LIBSELINUX)
fi ]
)
AC_ARG_WITH(pam, [AS_HELP_STRING([--with-pam], [Build with PAM support])])
AC_ARG_ENABLE(pam, [AS_HELP_STRING([--enable-pam], [Alias for --with-pam])])
# Check that with_pam and enable_pam are consistent.
# If neither one is set, the default is "no."
if test -z "$with_pam"; then
with_pam=${enable_pam:-no}
elif test -n "$enable_pam" && test "$with_pam" != "$enable_pam"; then
AC_MSG_ERROR(
[Contradicting --with/without-pam and --enable/disable-pam options.])
fi
AM_CONDITIONAL([PAM], [test "$with_pam" != no])
if test "$with_pam" != no; then
AC_DEFINE(WITH_PAM, 1, [Define if you want to enable PAM support])
pam_appl_h_found=no
AC_CHECK_HEADERS([pam/pam_appl.h security/pam_appl.h],
[pam_appl_h_found=yes])
test "$pam_appl_h_found" = yes ||
AC_MSG_ERROR([PAM headers not found])
saved_LIBS="$LIBS"
AC_CHECK_LIB([dl], [dlopen], [libdl_found=yes], [libdl_found=no])
AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
AC_CHECK_FUNCS([pam_getenvlist pam_putenv])
LIBS="$saved_LIBS"
case $libdl_found:" $LIBS " in #(
*" -ldl "*) LIBPAM= ;; #(
yes:*) LIBPAM=-ldl ;; # libdl found, but is not in $LIBS
esac
AC_SUBST([LIBPAM], ["-lpam $LIBPAM"])
fi
AC_DEFINE(DEBUGGING,1,[Code will be built with debug info.])
AC_DEFINE(MAILARG,"/usr/sbin/sendmail",[There will be path to sendmail.])
AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f %s",
[-i = don't terminate on "." by itself
-Fx = Set full-name of sender
-odi = Option Deliverymode Interactive
-oem = Option Errors Mailedtosender
-oi = Ignore "." alone on a line
-t = Get recipient from headers
-f %s = Envelope sender address
-d = undocumented but common flag.])
AC_DEFINE(SYSLOG,1,[Using syslog for log messages.])
AC_DEFINE(CAPITALIZE_FOR_PS, 1, [if you have a tm_gmtoff member in struct tm])
# Check whether user wants Linux audit support
AC_ARG_WITH(audit,
[AS_HELP_STRING([--with-audit], [Enable audit trails])],
[ if test "x$withval" != "xno" ; then
saved_LIBS="$LIBS"
AC_DEFINE(WITH_AUDIT,1,[Define if you want Audit trails.])
AC_CHECK_HEADER([libaudit.h], ,AC_MSG_ERROR(Audit trails requires libaudit.h header))
AC_CHECK_LIB(audit, audit_open, [ LIBAUDIT="-laudit" ],
AC_MSG_ERROR(Audit support needs audit libraries.))
LIBS="$saved_LIBS"
AC_SUBST(LIBAUDIT)
fi ]
)
AC_ARG_ENABLE(syscrontab,
[AS_HELP_STRING([--enable-syscrontab], [Build cronie with system crontab enabled.])],
[ if test "x$enableval" != xno; then
AC_DEFINE(ENABLE_SYSCRONTAB,1,[Define if you want system crontab.])
fi ], [AC_DEFINE(ENABLE_SYSCRONTAB,1,[Define if you want system crontab.])]
)
dnl CRONIE_VAR_DEFAULT (VAR, DESCRIPTION, DEFAULT)
dnl --------------------------------------------
AC_DEFUN([CRONIE_CONF_VAR],
[AC_ARG_VAR([$1], [$2 @<:@$3@:>@])
if test "$$1" = ""; then
$1='$3'
fi
])
AC_DEFUN([ANACRON_CONF_VAR],
[AC_ARG_VAR([$1], [$2 @<:@$3@:>@])
if test "$$1" = ""; then
$1='$3'
fi
])
CRONIE_CONF_VAR([SYSCRONTAB], [the current working directory of the running daemon], [${sysconfdir}/crontab])
CRONIE_CONF_VAR([SYS_CROND_DIR], [the current working directory of the running daemon], [${sysconfdir}/cron.d])
CRONIE_CONF_VAR([SPOOL_DIR], [the directory where all the user cron tabs reside], [${localstatedir}/spool/cron])
AC_ARG_ENABLE([anacron], [AS_HELP_STRING([--disable-anacron], [Do not build anacron.])], [], [enable_anacron=yes])
AM_CONDITIONAL([ANACRON], [test "$enable_anacron" = yes])
if test "$enable_anacron" != no; then
ANACRON_CONF_VAR([ANACRON_SPOOL_DIR],[The path for anacron locks.],[${localstatedir}/spool/anacron])
ANACRON_CONF_VAR([ANACRONTAB],[The anacron table for regular jobs.],[${sysconfdir}/anacrontab])
dnl obstack.h is part of GLIBC and may not be present on other systems,
dnl eg. musl and AIX. There, we static link in our own copy.
AC_CHECK_HEADER(obstack.h, [have_obstack=yes], [have_obstack=no], [])
fi
AM_CONDITIONAL([NEED_OBSTACK], [test "$have_obstack" = no])
AS_IF([test "$enable_anacron" != no && test "$have_obstack" = no], [
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/obstack"
])
AM_CONDITIONAL(HAS_RUNSTATE, [test x$runstatedir != x])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT