]> git.ipfire.org Git - thirdparty/util-linux.git/blame - configure.ac
taskset: Accept 0 pid for current process
[thirdparty/util-linux.git] / configure.ac
CommitLineData
034d378b 1AC_INIT([util-linux],
38c75b59 2 m4_esyscmd([tools/git-version-gen .tarball-version]),
4230b2d4 3 [kzak@redhat.com], [],
033b5a52 4 [https://www.kernel.org/pub/linux/utils/util-linux/])
baf39af1 5
b0e6b25e 6
4230b2d4 7AC_PREREQ([2.64])
48d7b13a 8
034d378b 9AC_CONFIG_AUX_DIR([config])
b12991dd 10AC_CONFIG_MACRO_DIR([m4])
eaf70198 11dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
4230b2d4 12dnl the compiler (like LT_INIT) to avoid autoconf errors.
eaf70198 13AC_USE_SYSTEM_EXTENSIONS
a527a360 14AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
48d7b13a 15
eb35c251 16m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
f06b4328 17 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
316795fc 18m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
eb35c251 19
034d378b 20AC_CONFIG_SRCDIR([sys-utils/mount.c])
15a9b48c
SK
21AC_PREFIX_DEFAULT([/usr])
22
33b0be6d
KZ
23dnl version details from <major>.<minor>[-<suffix>]
24PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}')
0f0972ac 25PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{
c25b7d8a 26 sub("-.*","",$2); print $2}')
c42a6d4d 27PACKAGE_VERSION_RELEASE=$(echo $PACKAGE_VERSION | awk -F. '{
c25b7d8a 28 sub("-.*","",$3); print $3 ~ /^@<:@0-9@:>@+$/ ? $3 : 0}')
a0948ffe 29
33b0be6d
KZ
30dnl libblkid version
31LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
82368a0c 32LIBBLKID_DATE="18-Mar-2025"
dc2b8d87
KZ
33LIBBLKID_LT_MAJOR=1
34LIBBLKID_LT_MINOR=1
35LIBBLKID_LT_MICRO=0
36LIBBLKID_VERSION_INFO=`expr $LIBBLKID_LT_MAJOR + $LIBBLKID_LT_MINOR`:$LIBBLKID_LT_MICRO:$LIBBLKID_LT_MINOR
a0948ffe 37
f6076f55
KZ
38dnl libuuid version
39LIBUUID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
dc2b8d87
KZ
40LIBUUID_LT_MAJOR=1
41LIBUUID_LT_MINOR=3
42LIBUUID_LT_MICRO=0
43LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR
f6076f55 44
c2e299d0
SS
45dnl liblastlog2 version
46LIBLASTLOG2_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
476c8614
SS
47LIBLASTLOG2_LT_MAJOR=2
48LIBLASTLOG2_LT_MINOR=0
c2e299d0
SS
49LIBLASTLOG2_LT_MICRO=0
50LIBLASTLOG2_VERSION_INFO=`expr $LIBLASTLOG2_LT_MAJOR + $LIBLASTLOG2_LT_MINOR`:$LIBLASTLOG2_LT_MICRO:$LIBLASTLOG2_LT_MINOR
51
f1cde479
KZ
52dnl libmount version
53LIBMOUNT_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
54LIBMOUNT_LT_MAJOR=1
55LIBMOUNT_LT_MINOR=1
56LIBMOUNT_LT_MICRO=0
57LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR
58
1a4d989e
OO
59dnl libsmartcols version
60LIBSMARTCOLS_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
61LIBSMARTCOLS_LT_MAJOR=1
62LIBSMARTCOLS_LT_MINOR=1
63LIBSMARTCOLS_LT_MICRO=0
64LIBSMARTCOLS_VERSION_INFO=`expr $LIBSMARTCOLS_LT_MAJOR + $LIBSMARTCOLS_LT_MINOR`:$LIBSMARTCOLS_LT_MICRO:$LIBSMARTCOLS_LT_MINOR
65
0bb4c979
KZ
66dnl libfdisk version
67LIBFDISK_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
68LIBFDISK_LT_MAJOR=1
69LIBFDISK_LT_MINOR=1
70LIBFDISK_LT_MICRO=0
71LIBFDISK_VERSION_INFO=`expr $LIBFDISK_LT_MAJOR + $LIBFDISK_LT_MINOR`:$LIBFDISK_LT_MICRO:$LIBFDISK_LT_MINOR
72
15a9b48c 73# Check whether exec_prefix=/usr:
9f57e6e8
SK
74AS_CASE([$exec_prefix:$prefix],
75[NONE:NONE | NONE:/usr | /usr:*],
76 [AC_MSG_NOTICE([Default --exec-prefix detected.])
17794746
KZ
77 AS_CASE([$bindir], ['${exec_prefix}/bin'], [bindir=/bin; AC_MSG_NOTICE([ --bindir defaults to /bin]) ])
78 AS_CASE([$sbindir], ['${exec_prefix}/sbin'], [sbindir=/sbin; AC_MSG_NOTICE([ --sbindir defaults to /sbin])])
79 AS_CASE([$libdir], ['${exec_prefix}/lib'], [libdir=/lib; AC_MSG_NOTICE([ --libdir defaults to /lib]) ])
f40e316f 80 AS_CASE([$libdir], ['${exec_prefix}/lib64'],[libdir=/lib64; AC_MSG_NOTICE([ --libdir defaults to /lib64]) ])
9f57e6e8
SK
81 ]
82)
83
3d289965
KZ
84# Check whether prefix=/usr
85AS_CASE([$prefix],
86[NONE | /usr],
87 [AC_MSG_NOTICE([Default --prefix detected.])
88 AS_CASE([$localstatedir], [NONE | '${prefix}/var' | "${prefix}"/var ],
89 [localstatedir=/var; AC_MSG_NOTICE([ --localstatedir defaults to /var])])
90 AS_CASE([$sysconfdir], [NONE | '${prefix}/etc' | "${prefix}"/etc ],
91 [sysconfdir=/etc; AC_MSG_NOTICE([ --sysconfdir defaults to /etc])])
92
93 ]
94)
107b2fbe
KZ
95AC_SUBST([localstatedir])
96
8df54559
AH
97
98# default for old versions without $runstatedir
99AS_IF([test x"$runstatedir" = x], [runstatedir='${localstatedir}/run'])
100
101# our default if $localstatedir unchanged
102AS_CASE([$localstatedir:$runstatedir],
103 [NONE:'${localstatedir}/run' | /var:'${localstatedir}/run' | NONE:'/run' ],
104 [runstatedir=/run; AC_MSG_NOTICE([ --runstatedir defaults to /run])]
9f57e6e8 105)
8df54559 106AC_SUBST([runstatedir])
07a16b9d 107
b0a0d7d5 108
996fb358 109# The original default values of {bin,sbin,lib}dir
aaf3e8f5 110usrbin_execdir='${exec_prefix}/bin'
30688dde 111AC_SUBST([usrbin_execdir])
996fb358 112
aaf3e8f5 113usrsbin_execdir='${exec_prefix}/sbin'
30688dde 114AC_SUBST([usrsbin_execdir])
996fb358 115
9f57e6e8 116AS_CASE([$libdir],
b2b61efc 117 ['${exec_prefix}/'* | '${prefix}/'* | /usr/* | "${prefix}"/* ],
9f57e6e8
SK
118 [usrlib_execdir=$libdir],
119 [usrlib_execdir='${exec_prefix}'$libdir]
120)
30688dde 121AC_SUBST([usrlib_execdir])
996fb358 122
9c787eaa
KZ
123securelib_execdir='${libdir}/security'
124AC_SUBST([securelib_execdir])
8c03e75c 125
1a02c7a7 126# static configuration maintained by packages (e.g. /usr/lib)
c2409b55
KZ
127AC_ARG_VAR([SYSCONFSTATICDIR],
128 [Path to static system configuration, default ${prefix}/lib])
129AS_IF([test "x$SYSCONFSTATICDIR" = x],
130 [sysconfstaticdir='${prefix}/lib'],
131 [sysconfstaticdir=$SYSCONFSTATICDIR])
132AC_SUBST([sysconfstaticdir])
133
4230b2d4 134AC_PROG_CC
31c9c1c4 135AM_PROG_CC_C_O
18336d16 136AC_PROG_MKDIR_P
30d7f61f 137AC_PROG_YACC
7e8bf34a 138AC_PROG_SED
cf4f9ec8
KZ
139
140# Don't use autotools integrated LEX/YACC support for libsmartcols
141AC_PATH_PROG([FLEX], [flex])
142AC_PATH_PROG([BISON], [bison])
143
a6996860 144AC_CANONICAL_HOST
85b4c147 145AC_C_CONST
e79829db 146AC_C_VOLATILE
b12991dd 147
0e60bc9b 148dnl Compiler warnings
b1b54edf 149UL_WARN_ADD([-fno-common])
9dc72d0b 150UL_WARN_ADD([-Wall])
0e60bc9b 151UL_WARN_ADD([-Wextra])
c25b7d8a
SK
152
153UL_WARN_ADD([-Waddress-of-packed-member])
154UL_WARN_ADD([-Wdiscarded-qualifiers])
4230d576 155UL_WARN_ADD([-Wembedded-directive])
c25b7d8a
SK
156UL_WARN_ADD([-Wextra-semi])
157UL_WARN_ADD([-Wformat-security])
158UL_WARN_ADD([-Wimplicit-function-declaration])
b1b54edf
KZ
159UL_WARN_ADD([-Wmissing-declarations])
160UL_WARN_ADD([-Wmissing-parameter-type])
161UL_WARN_ADD([-Wmissing-prototypes])
c25b7d8a 162UL_WARN_ADD([-Wnested-externs])
0e60bc9b 163UL_WARN_ADD([-Wno-missing-field-initializers])
9df5ac34 164UL_WARN_ADD([-Wold-style-definition])
c25b7d8a 165UL_WARN_ADD([-Wpointer-arith])
b1b54edf 166UL_WARN_ADD([-Wredundant-decls])
0e60bc9b 167UL_WARN_ADD([-Wsign-compare])
c25b7d8a 168UL_WARN_ADD([-Wstrict-prototypes])
0e60bc9b
KZ
169UL_WARN_ADD([-Wtype-limits])
170UL_WARN_ADD([-Wuninitialized])
b1b54edf
KZ
171UL_WARN_ADD([-Wunused-but-set-parameter])
172UL_WARN_ADD([-Wunused-but-set-variable])
0e60bc9b 173UL_WARN_ADD([-Wunused-parameter])
0e60bc9b 174UL_WARN_ADD([-Wunused-result])
bec5c9db 175UL_WARN_ADD([-Wunused-variable])
a52f9bdd 176UL_WARN_ADD([-Wvla])
2a91b213 177UL_WARN_ADD([-Walloca])
63c80c4c
KZ
178
179AC_ARG_ENABLE([werror],
180 AS_HELP_STRING([--enable-werror], [make all compiler warnings into errors]),
181 [], [enable_werror=no]
182)
183AS_IF([test "x$enable_werror" = xyes], [
184 UL_WARN_ADD([-Werror])
185],[
186 UL_WARN_ADD([-Werror=sequence-point])
187])
188
0e60bc9b
KZ
189AC_SUBST([WARN_CFLAGS])
190
63c80c4c 191
034d378b 192UL_WARN_ADD([-Wno-clobbered], [BSD_WARN_CFLAGS])
7697771d 193AC_SUBST([BSD_WARN_CFLAGS])
4f9d999a
KZ
194
195UL_WARN_ADD([-Wno-cast-function-type], [PYTHON_WARN_CFLAGS])
196AC_SUBST([PYTHON_WARN_CFLAGS])
197
b97cc9a8
KZ
198
199AC_ARG_ENABLE([asan],
200 AS_HELP_STRING([--enable-asan], [compile with Address Sanitizer]),
201 [], [enable_asan=no]
202)
2afbcec5 203AS_IF([test "x$enable_asan" = xyes], [
b97cc9a8 204 UL_WARN_ADD([-fsanitize=address])
ef61c093 205 ASAN_LDFLAGS="-fsanitize=address"
b97cc9a8 206])
ef61c093 207AC_SUBST([ASAN_LDFLAGS])
b97cc9a8 208
e6a4d8cc
EV
209AC_ARG_ENABLE([ubsan],
210 AS_HELP_STRING([--enable-ubsan], [compile with UBsan]),
211 [], [enable_ubsan=no]
212)
213AS_IF([test "x$enable_ubsan" = xyes], [
214 UL_WARN_ADD([-fsanitize=undefined])
215 UBSAN_LDFLAGS="-fsanitize=undefined"
216])
217AC_SUBST([UBSAN_LDFLAGS])
218
ccdc47b7
EV
219AC_ARG_ENABLE([fuzzing-engine],
220 AS_HELP_STRING([--enable-fuzzing-engine], [compile with fuzzing engine]),
221 [], [enable_fuzzing_engine=no]
222)
948182f4 223AS_IF([test "x$enable_fuzzing_engine" = xyes && test "x$LIB_FUZZING_ENGINE" = x], [
75196cd8
EV
224 UL_WARN_ADD([-fno-omit-frame-pointer])
225 UL_WARN_ADD([-gline-tables-only])
226 UL_WARN_ADD([-fsanitize=fuzzer-no-link])
227 FUZZING_ENGINE_LDFLAGS="-fsanitize=fuzzer-no-link"
228])
229AC_SUBST([FUZZING_ENGINE_LDFLAGS])
ccdc47b7 230AC_PROG_CXX
75196cd8
EV
231AM_CONDITIONAL([FUZZING_ENGINE], [test "x$enable_fuzzing_engine" = xyes])
232AM_CONDITIONAL([OSS_FUZZ], [test "x$LIB_FUZZING_ENGINE" != x])
ccdc47b7 233
b4b8f8c2
FS
234AC_ARG_ENABLE([coverage],
235 AS_HELP_STRING([--enable-coverage], [compile with gcov]),
236 [], [enable_coverage=no]
237)
238AS_IF([test "x$enable_coverage" = xyes], [
239 UL_WARN_ADD([--coverage])
240 COVERAGE_LDFLAGS="--coverage"
241])
242AC_SUBST([COVERAGE_LDFLAGS])
243AM_CONDITIONAL([WITH_COVERAGE], [test "x$enable_coverage" = xyes])
244
b12991dd
KZ
245dnl libtool-2
246LT_INIT
48d7b13a 247
3719bf8d
RM
248dnl check supported linker flags
249AX_CHECK_VSCRIPT
250
fd0f4132
SK
251m4_ifndef([PKG_PROG_PKG_CONFIG],
252 [m4_fatal([Could not locate the pkg-config autoconf
253 macros. These are usually located in /usr/share/aclocal/pkg.m4.
254 If your macros are in a different location, try setting the
255 environment variable AL_OPTS="-I/other/macro/dir" before running
bf2603c7 256 ./autogen.sh or autoreconf again. Make sure pkg-config is installed.])])
d06d028a 257PKG_PROG_PKG_CONFIG
99f95a1e 258PKG_INSTALLDIR(['${usrlib_execdir}/pkgconfig'])
d06d028a 259
22aa5166
KZ
260GTK_DOC_CHECK([1.10])
261AC_PATH_PROG([XSLTPROC], [xsltproc])
236421a4
KZ
262
263
8c182554 264linux_os=no
8026fa9b 265bsd_os=no
bdf3ff72 266gnu_os=no
8026fa9b
KZ
267AS_CASE([${host_os}],
268 [*linux*],
269 [linux_os=yes],
40733239
RM
270 [*darwin*],
271 [darwin_os=yes],
8026fa9b 272 [*bsd*],
bdf3ff72
ZL
273 [bsd_os=yes],
274 [gnu*],
275 [gnu_os=yes])
034d378b 276AM_CONDITIONAL([LINUX], [test "x$linux_os" = xyes])
40733239 277AM_CONDITIONAL([DARWIN], [test "x$darwin_os" = xyes])
8026fa9b 278AM_CONDITIONAL([BSD], [test "x$bsd_os" = xyes])
bdf3ff72 279AM_CONDITIONAL([HURD], [test "x$gnu_os" = xyes])
8026fa9b 280
40733239
RM
281AS_IF([test "x$darwin_os" = xyes], [
282 AC_DEFINE([_DARWIN_C_SOURCE], [1], [Enable MAP_ANON in sys/mman.h on Mac OS X])
283])
8c182554 284
3c6e292c 285dnl define ARCH_<NAME> conditionals
034d378b
SK
286UL_SET_ARCH([I86], [i?86-*])
287UL_SET_ARCH([86_64], [x86_64*])
288UL_SET_ARCH([IA64], [ia64*])
289UL_SET_ARCH([S390], [s390*])
290UL_SET_ARCH([SPARC], [sparc*])
291UL_SET_ARCH([PPC], [ppc*|powerpc*])
292UL_SET_ARCH([M68K], [m68*])
293UL_SET_ARCH([MIPS], [mips*])
f319e301 294UL_SET_ARCH([HPPA], [hppa*|parisc*])
3c6e292c 295
48d7b13a 296AC_SYS_LARGEFILE
2c656779 297AC_HEADER_ASSERT
f69eba17 298AC_STRUCT_TIMEZONE
f6e7a21c
TW
299UL_YEAR2038_INIT
300AC_SYS_YEAR2038_RECOMMENDED
48d7b13a 301
f8d75a66 302dnl Don't forget to maintain alternatively allowed versions in autogen.sh!
91c520bc 303AM_GNU_GETTEXT_VERSION([0.18.3])
09734b00 304AM_GNU_GETTEXT([external])
3013eb9d
SK
305
306AS_IF([test -d "$srcdir/po"], [
307 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
c25b7d8a
SK
308], [dnl echo $ALL_LINGUAS | sed 's/ /\n/g' | sort -u | column -xc 72 -o ' ' | sed 's/^/\t/'
309 ALL_LINGUAS="
310 af am ar as be bg bn bn_IN ca
311 cs cy da de el en_GB es et eu_ES
312 fa fi fr gl gu he hi hr hu
313 hy id is it ja ka kn ko ku
314 lo lt lv mk ml mr ms my nb
315 nl nn no nso or pa pl pt pt_BR
316 ro ru si sk sl sq sr sr@Latn sv
317 ta te th tr uk ur vi zh_CN zh_TW
318 zu
319"])
09734b00 320
e460a5bf 321AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
48d7b13a
KZ
322#ifdef HAVE_LINUX_COMPILER_H
323#include <linux/compiler.h>
324#endif
325])
f06b4328
SK
326AC_CHECK_HEADERS([ \
327 asm/io.h \
c25b7d8a
SK
328 byteswap.h \
329 endian.h \
f06b4328 330 err.h \
a0948ffe 331 errno.h \
f06b4328 332 fcntl.h \
a0948ffe 333 getopt.h \
f06b4328 334 inttypes.h \
6578ced7 335 lastlog.h \
77835be2 336 libutil.h \
ba05b9ff 337 linux/audit.h \
0c44599f 338 linux/bpf.h \
647f80e4 339 linux/blkzoned.h \
5a971329 340 linux/btrfs.h \
c25b7d8a 341 linux/capability.h \
f06b4328
SK
342 linux/cdrom.h \
343 linux/falloc.h \
a0948ffe 344 linux/fd.h \
c25b7d8a 345 linux/fiemap.h \
ae015d71 346 linux/landlock.h \
f4d700d7 347 linux/kcmp.h \
c25b7d8a 348 linux/net_namespace.h \
d652d4c6 349 linux/nsfs.h \
627428a9 350 linux/pr.h \
f06b4328 351 linux/raw.h \
8de1ec20 352 linux/seccomp.h \
c25b7d8a 353 linux/securebits.h \
a0948ffe
KZ
354 linux/tiocl.h \
355 linux/version.h \
c25b7d8a 356 linux/watchdog.h \
259bed15 357 linux/if_alg.h \
8b7f16fc 358 locale.h \
607c2a72 359 mntent.h \
6a2b05d8 360 mqueue.h \
754fed0c 361 net/if_dl.h \
c25b7d8a 362 net/if.h \
f06b4328
SK
363 netinet/in.h \
364 paths.h \
365 pty.h \
fe2c9909 366 security/pam_appl.h \
dd3bbc9c 367 security/pam_modules.h \
6a2b05d8 368 semaphore.h \
c25b7d8a 369 shadow.h \
f06b4328 370 stdint.h \
78288764 371 stdio_ext.h \
a0948ffe 372 stdlib.h \
78914c80 373 sys/auxv.h \
a0948ffe
KZ
374 sys/disk.h \
375 sys/disklabel.h \
c25b7d8a 376 sys/endian.h \
f06b4328 377 sys/file.h \
f06b4328
SK
378 sys/ioccom.h \
379 sys/ioctl.h \
c25b7d8a 380 sys/io.h \
a0948ffe 381 sys/mkdev.h \
6a2b05d8 382 sys/mman.h \
ac1c53e4 383 sys/mount.h \
4ebac79f 384 sys/param.h \
84732a88 385 sys/pidfd.h \
a0948ffe 386 sys/prctl.h \
f06b4328 387 sys/resource.h \
c25b7d8a 388 sys/sendfile.h \
651b25cd 389 sys/signalfd.h \
2a7c1f70 390 sys/socket.h \
f06b4328 391 sys/sockio.h \
a0948ffe 392 sys/stat.h \
3671d4a8 393 sys/statfs.h \
f06b4328
SK
394 sys/swap.h \
395 sys/syscall.h \
c25b7d8a 396 sys/sysmacros.h \
f06b4328 397 sys/time.h \
87ee2658 398 sys/timex.h \
00c505d9 399 sys/ttydefaults.h \
a0948ffe 400 sys/types.h \
ac1c53e4 401 sys/ucred.h \
754fed0c 402 sys/un.h \
3671d4a8 403 sys/vfs.h \
40b119b9 404 sys/xattr.h \
f06b4328 405 unistd.h \
77835be2 406 utmp.h \
b4b919fe 407 utmpx.h \
f06b4328 408])
dc61d398 409
a0357292
KZ
410# There is a collision in old kernel-headers. The both files mount.h and fs.h
411# define MS_* macros. Fixed by kernel commit e462ec50cb5fad19f6003a3d8087f4a0945dd2b1.
412#
413AC_CHECK_HEADERS([linux/fs.h ], [], [],
414 [#ifdef HAVE_SYS_MOUNT_H
415 # include <linux/fs.h>
416 # include <sys/mount.h>
417 #endif
418])
419
5502e73d
MM
420AC_CHECK_HEADERS([linux/mount.h ], [], [],
421 [#ifdef HAVE_LINUX_MOUNT_H
422 # include <linux/mount.h>
423 #endif
424])
425
db4e2645
KZ
426AC_CHECK_HEADERS([linux/gsmmux.h ], [], [],
427 [#ifdef LINUX_GSMMUX_H
428 # include <linux/gsmmux.h>
429 #endif
430])
431
fe2c9909
WJ
432AC_CHECK_HEADERS([security/pam_misc.h],
433 [AM_CONDITIONAL([HAVE_LINUXPAM], [true])],
434 [AM_CONDITIONAL([HAVE_LINUXPAM], [false])], [
435#ifdef HAVE_SECURITY_PAM_APPL_H
436#include <security/pam_appl.h>
437#endif
438])
439
e5ad3a6a
SK
440AC_CHECK_DECLS([BLK_ZONE_REP_CAPACITY], [], [], [
441 #include <linux/blkzoned.h>
442])
443
627428a9 444AC_CHECK_DECLS([PR_REP_CAPACITY], [], [], [
445 #include <linux/pr.h>
446])
447
fe2c9909
WJ
448AC_CHECK_HEADERS([security/openpam.h], [], [], [
449#ifdef HAVE_SECURITY_PAM_APPL_H
450#include <security/pam_appl.h>
451#endif
452])
453
a67387b7 454AC_CHECK_HEADERS([langinfo.h],
ac660b80
ZJS
455 [AM_CONDITIONAL([HAVE_LANGINFO_H], [true])],
456 [AM_CONDITIONAL([HAVE_LANGINFO_H], [false])])
a67387b7 457
4e12a62e
RL
458AC_MSG_CHECKING([whether langinfo.h defines ALTMON_x constants])
459AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
460 #include <langinfo.h>
461]], [[
462 char *str;
463 str = nl_langinfo (ALTMON_1);
464 str = nl_langinfo (ALTMON_2);
465 str = nl_langinfo (ALTMON_3);
466 str = nl_langinfo (ALTMON_4);
467 str = nl_langinfo (ALTMON_5);
468 str = nl_langinfo (ALTMON_6);
469 str = nl_langinfo (ALTMON_7);
470 str = nl_langinfo (ALTMON_8);
471 str = nl_langinfo (ALTMON_9);
472 str = nl_langinfo (ALTMON_10);
473 str = nl_langinfo (ALTMON_11);
474 str = nl_langinfo (ALTMON_12);
475]])], [
476 AC_MSG_RESULT([yes])
477 AC_DEFINE([HAVE_LANGINFO_ALTMON], [1],
478 [Define if langinfo.h defines ALTMON_x constants])
479], [
480 AC_MSG_RESULT([no])
481])
482
483
484AC_MSG_CHECKING([whether langinfo.h defines _NL_ABALTMON_x constants])
485AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
486 #include <langinfo.h>
487]], [[
488 char *str;
489 str = nl_langinfo (_NL_ABALTMON_1);
490 str = nl_langinfo (_NL_ABALTMON_2);
491 str = nl_langinfo (_NL_ABALTMON_3);
492 str = nl_langinfo (_NL_ABALTMON_4);
493 str = nl_langinfo (_NL_ABALTMON_5);
494 str = nl_langinfo (_NL_ABALTMON_6);
495 str = nl_langinfo (_NL_ABALTMON_7);
496 str = nl_langinfo (_NL_ABALTMON_8);
497 str = nl_langinfo (_NL_ABALTMON_9);
498 str = nl_langinfo (_NL_ABALTMON_10);
499 str = nl_langinfo (_NL_ABALTMON_11);
500 str = nl_langinfo (_NL_ABALTMON_12);
501]])], [
502 AC_MSG_RESULT([yes])
503 AC_DEFINE([HAVE_LANGINFO_NL_ABALTMON], [1],
504 [Define if langinfo.h defines _NL_ABALTMON_x constants])
505], [
506 AC_MSG_RESULT([no])
507])
508
509
16ba8d58
KZ
510dnl Convert some ac_cv_header_* variables to have_*
511dnl
ba05b9ff 512have_linux_audit_h=$ac_cv_header_linux_audit_h
70bb5345 513have_linux_blkzoned_h=$ac_cv_header_linux_blkzoned_h
5a971329 514have_linux_btrfs_h=$ac_cv_header_linux_btrfs_h
c25b7d8a 515have_linux_capability_h=$ac_cv_header_linux_capability_h
f4d700d7 516have_linux_kcmp_h=$ac_cv_header_linux_kcmp_h
5502e73d 517have_linux_mount_h=$ac_cv_header_linux_mount_h
627428a9 518have_linux_pr_h=$ac_cv_header_linux_pr_h
16ba8d58 519have_linux_raw_h=$ac_cv_header_linux_raw_h
8de1ec20 520have_linux_seccomp_h=$ac_cv_header_linux_seccomp_h
48469f90 521have_linux_securebits_h=$ac_cv_header_linux_securebits_h
c25b7d8a 522have_linux_version_h=$ac_cv_header_linux_version_h
5b0289b9 523have_linux_watchdog_h=$ac_cv_header_linux_watchdog_h
c25b7d8a
SK
524have_pty_h=$ac_cv_header_pty_h
525have_security_openpam_h=$ac_cv_header_security_openpam_h
fe2c9909 526have_security_pam_appl_h=$ac_cv_header_security_pam_appl_h
ff0cb84d 527have_security_pam_misc_h=$ac_cv_header_security_pam_misc_h
dd3bbc9c 528have_security_pam_modules_h=$ac_cv_header_security_pam_modules_h
d00c10ed 529have_shadow_h=$ac_cv_header_shadow_h
651b25cd 530have_sys_signalfd_h=$ac_cv_header_sys_signalfd_h
b4b919fe 531have_utmpx_h=$ac_cv_header_utmpx_h
94c8821b 532have_mntent_h=$ac_cv_header_mntent_h
0c44599f
KZ
533have_sys_vfs_h=$ac_cv_header_sys_vfs_h
534have_linux_bpf_h=$ac_cv_header_linux_bpf_h
a67387b7 535
8a931412
KZ
536AS_CASE([$linux_os:$have_linux_version_h],
537 [yes:no],
538 [AC_MSG_ERROR([kernel headers required on Linux])]
539)
540
a67387b7
KZ
541AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
542#include <time.h>
543#include <unistd.h>
544]], [[
545 int a = 0;
546 struct tm *tm = localtime(0);
547 if (a == -1) /* false */
f06b4328 548 sleep(tm->tm_gmtoff);
a67387b7 549]])],
034d378b 550[AC_DEFINE([HAVE_TM_GMTOFF], [1], [Does struct tm have a field tm_gmtoff?])
a67387b7
KZ
551])
552
10efb9ea 553AC_CHECK_TYPES([struct mount_attr], [], [], [[#include <linux/mount.h>]])
0120be6f 554AC_CHECK_TYPES([enum fsconfig_command], [], [], [[#include <linux/mount.h>]])
013e0db4 555
a67387b7
KZ
556AC_CHECK_MEMBERS([struct termios.c_line],,,
557 [[#include <termios.h>]])
558
559AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
c0136ac0
KZ
560 [[#include <sys/stat.h>]])
561
7d679f29 562AC_CHECK_TYPES([struct statx], [], [], [[#include <sys/stat.h>]])
c0136ac0 563AC_CHECK_MEMBERS([struct statx.stx_mnt_id],,,
7d679f29 564 [[#include <sys/stat.h>]])
a67387b7 565
a88057d9
TP
566AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
567
0e9b73d3 568AC_CHECK_DECL([environ],
034d378b 569 [AC_DEFINE([HAVE_ENVIRON_DECL], [1],
0e9b73d3
SK
570 [Define to 1 if have **environ prototype])],
571)
572
573AC_CHECK_DECL([strsignal],
034d378b 574 [AC_DEFINE([HAVE_STRSIGNAL_DECL], [1],
0e9b73d3
SK
575 [Define to 1 if have strsignal function prototype])],
576)
577
036d7274
KZ
578AC_CHECK_DECL([BPF_OBJ_NAME_LEN],
579 [have_bpf_obj_name_len=yes], [have_bpf_obj_name_len=no],
580 [#include <linux/bpf.h>])
ae08e490
MY
581AC_CHECK_DECL([BPF_TAG_SIZE],
582 [have_bpf_tag_size=yes], [have_bpf_tag_size=no],
583 [#include <linux/bpf.h>])
036d7274 584
1eb16fd7
KZ
585AC_CHECK_DECL([TIOCGLCKTRMIOS],
586 [have_tiocglcktrmios=yes], [have_tiocglcktrmios=no],
c25b7d8a 587 [#include <sys/ioctl.h>])
1eb16fd7
KZ
588AC_CHECK_DECL([SOCK_CLOEXEC],
589 [have_sock_cloexec=yes], [have_sock_cloexec=no],
590 [#include <sys/types.h>
c25b7d8a 591 #include <sys/socket.h>])
1eb16fd7
KZ
592AC_CHECK_DECL([SOCK_NONBLOCK],
593 [have_sock_nonblock=yes], [have_sock_nonblock=no],
594 [#include <sys/types.h>
c25b7d8a 595 #include <sys/socket.h>])
1eb16fd7
KZ
596AC_CHECK_DECL([SO_PASSCRED],
597 [have_so_passcred=yes], [have_so_passcred=no],
598 [#include <sys/types.h>
c25b7d8a 599 #include <sys/socket.h>])
1eb16fd7 600
4153f6ba
MY
601AC_CHECK_DECLS([VMADDR_CID_LOCAL], [], [], [
602 #include <sys/socket.h>
603 #include <linux/vm_sockets.h>])
604
f06b4328 605AC_CHECK_FUNCS([ \
c214cbeb 606 cachestat \
75efef98 607 clearenv \
f0649c0d 608 close_range \
c08396c7 609 eaccess \
eb76ca98
FG
610 err \
611 errx \
87583438 612 explicit_bzero \
c25b7d8a
SK
613 __fpending \
614 __fpurge \
615 fpurge \
d9b022bd 616 fnmatch \
0120be6f
KZ
617 fsconfig \
618 fsmount \
619 fsopen \
620 fspick \
bf962c0a 621 fsync \
78914c80 622 getauxval \
bf962c0a 623 getdomainname \
f06b4328
SK
624 getdtablesize \
625 getexecname \
626 getmntinfo \
cc01c2dc 627 getrandom \
f06b4328 628 getrlimit \
c829aebc 629 getsgnam \
1cf6e936 630 getttynam \
f06b4328 631 inotify_init \
3ac22f7a 632 jrand48 \
ae015d71
TW
633 landlock_create_ruleset \
634 landlock_add_rule \
635 landlock_restrict_self \
bf962c0a 636 lchown \
3854515c
KZ
637 lgetxattr \
638 llistxattr \
a0948ffe 639 llseek \
670b10ae 640 newlocale \
02887b73 641 mempcpy \
4d751c00 642 mkostemp \
013e0db4
CB
643 move_mount \
644 mount_setattr \
f06b4328 645 nanosleep \
7d3a07d8 646 ntp_gettime \
013e0db4 647 open_tree \
f06b4328 648 personality \
55c7120a 649 pidfd_getfd \
6e6b9a1d
SK
650 pidfd_open \
651 pidfd_send_signal \
f06b4328
SK
652 posix_fadvise \
653 prctl \
9c7955da 654 qsort_r \
0322c9cd 655 reallocarray \
cd094a05 656 renameat2 \
f06b4328 657 rpmatch \
485a8bfa 658 scandirat \
c25b7d8a
SK
659 sched_setattr \
660 sched_setscheduler \
661 __secure_getenv \
662 secure_getenv \
360cdaa6 663 sendfile \
30fbf2f6 664 setprogname \
69045d3d
KZ
665 setresgid \
666 setresuid \
f06b4328
SK
667 sigqueue \
668 srandom \
30c59d67 669 statx \
f06b4328 670 strnchr \
69b7e41e
KZ
671 strndup \
672 strnlen \
670b10ae 673 strtod_l \
f06b4328 674 sysconf \
88e0f3df 675 sysinfo \
b72a75e9 676 timegm \
f06b4328 677 usleep \
670b10ae 678 uselocale \
c25b7d8a 679 utimensat \
31f85fce 680 vwarnx \
eb76ca98
FG
681 warn \
682 warnx \
f06b4328 683])
48d7b13a 684AC_FUNC_FSEEKO
48d7b13a 685
90d5285d 686AC_CHECK_FUNCS([futimens], [have_futimens=yes])
c25b7d8a 687AC_CHECK_FUNCS([getusershell], [have_getusershell=yes],[have_getusershell=no])
90d5285d 688AC_CHECK_FUNCS([inotify_init1], [have_inotify_init1=yes])
c25b7d8a
SK
689AC_CHECK_FUNCS([ioperm iopl], [have_io=yes])
690AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
f9c4d138 691AC_CHECK_FUNCS([open_memstream], [have_open_memstream=yes],[have_open_memstream=no])
e52b58e6 692AC_CHECK_FUNCS([reboot], [have_reboot=yes],[have_reboot=no])
227ebea7 693AC_CHECK_FUNCS([updwtmpx updwtmpx], [have_gnu_utmpx=yes], [have_gnu_utmpx=no])
465e9973 694
dc049516 695AM_CONDITIONAL([HAVE_OPENAT], [test "x$have_openat" = xyes])
ae015d71 696AM_CONDITIONAL([HAVE_LINUX_LANDLOCK_H], [test "x$ac_cv_header_linux_landlock_h" = xyes])
dc049516 697
7a3b35b9
KZ
698have_setns_syscall="yes"
699UL_CHECK_SYSCALL([setns])
700AS_IF([test "x$ul_cv_syscall_setns" = xno], [
701 have_setns_syscall="no"
702])
feda4342 703
55c7120a 704UL_CHECK_SYSCALL([pidfd_getfd])
6e6b9a1d
SK
705UL_CHECK_SYSCALL([pidfd_open])
706UL_CHECK_SYSCALL([pidfd_send_signal])
f0649c0d 707UL_CHECK_SYSCALL([close_range])
0120be6f
KZ
708UL_CHECK_SYSCALL([fsconfig])
709UL_CHECK_SYSCALL([fsmount])
710UL_CHECK_SYSCALL([fsopen])
711UL_CHECK_SYSCALL([fspick])
e087a188 712UL_CHECK_SYSCALL([mount_setattr])
0120be6f
KZ
713UL_CHECK_SYSCALL([move_mount])
714UL_CHECK_SYSCALL([open_tree])
715
9040c090
KZ
716AS_IF([test "x$ul_cv_syscall_fsconfig" = xno ||
717 test "x$ul_cv_syscall_fsmount" = xno ||
718 test "x$ul_cv_syscall_fsopen" = xno ||
719 test "x$ul_cv_syscall_fspick" = xno ||
720 test "x$ul_cv_syscall_mount_setattr" = xno ||
721 test "x$ul_cv_syscall_move_mount" = xno ||
722 test "x$ul_cv_syscall_open_tree" = xno],
723 [
724 have_mountfd_api="no"
725 ],[
726 have_mountfd_api="yes"
604eee0e
KZ
727 AC_DEFINE([HAVE_MOUNTFD_API], [1], [Define to 1 if you want to use mount API based on FDs.])
728 ])
729
730
731UL_CHECK_SYSCALL([statmount])
732UL_CHECK_SYSCALL([listmount])
733
734AS_IF([test "x$ul_cv_syscall_statmount" = xno ||
735 test "x$ul_cv_syscall_listmount" = xno],
736 [
737 have_statmount_api="no"
738 ],[
739 have_statmount_api="yes"
740 AC_DEFINE([HAVE_STATMOUNT_API], [1], [Define to 1 if you want to use statmount API.])
9040c090
KZ
741 ])
742
e087a188 743
feda4342
KZ
744AC_CHECK_FUNCS([isnan], [],
745 [AC_CHECK_LIB([m], [isnan], [MATH_LIBS="-lm"])]
4953018e 746 [AC_CHECK_LIB([m], [__isnan], [MATH_LIBS="-lm"])]
feda4342
KZ
747)
748AC_SUBST([MATH_LIBS])
749
750
378543e1 751dnl lib/mononotic.c may require -lrt
254743e4
KZ
752AC_CHECK_FUNCS([clock_gettime], [],
753 [AC_CHECK_LIB([rt], [clock_gettime], [REALTIME_LIBS="-lrt"])]
754)
bd9b94d1 755
254743e4 756have_timer="no"
f07a82c9 757AC_CHECK_FUNCS([timer_create],
7944a03c 758 [have_timer="yes"],
254743e4
KZ
759 [AC_CHECK_LIB([rt], [timer_create], [
760 have_timer="yes"
761 REALTIME_LIBS="-lrt"
f2458cf9 762 AC_DEFINE([HAVE_TIMER_CREATE], [1], [Define if timer_create exist in -lrt])
bf6be9f5
LT
763 ],[
764 AC_SEARCH_LIBS([timer_create], [rt], [
765 AC_MSG_RESULT(yes)
766 have_timer="yes"
767 REALTIME_LIBS="-lrt -lpthread"
f2458cf9 768 AC_DEFINE([HAVE_TIMER_CREATE], [1], [Define if timer_create exist in -lrt -lpthread])
bf6be9f5
LT
769 ],[], [-lpthread]
770 )
9a558f9c 771 ])]
254743e4 772)
8fc4a886 773
f07a82c9
KZ
774AC_SUBST([REALTIME_LIBS])
775
6df5acf9
KZ
776AS_IF([test x"$have_timer" = xno], [
777 AC_CHECK_FUNCS([setitimer], [have_timer="yes"], [have_timer="no"])
778])
779
f07a82c9 780
103fac07
KZ
781AC_CHECK_LIB([pthread], [pthread_atfork], [
782 PTHREAD_LIBS="-lpthread"
783 AC_DEFINE([HAVE_LIBPTHREAD], [1], [Define if libpthred exist])
784])
785AC_SUBST([PTHREAD_LIBS])
786
787
f07a82c9
KZ
788AC_CHECK_LIB([rtas], [rtas_get_sysparm], [
789 RTAS_LIBS="-lrtas"
f2458cf9 790 AC_DEFINE([HAVE_LIBRTAS], [1], [Define if librtas exists])
f07a82c9
KZ
791])
792AC_SUBST([RTAS_LIBS])
793
8fc4a886 794
034d378b 795AC_CHECK_MEMBER([struct sockaddr.sa_len],
f2458cf9 796 AC_DEFINE([HAVE_SA_LEN], [1], [Define if struct sockaddr contains sa_len]), [],
754fed0c
KZ
797 [#include <sys/types.h>
798 #include <sys/socket.h>])
799
60cc9f94 800SOCKET_LIBS=
60cc9f94 801AC_SEARCH_LIBS([socket], [socket],
3013eb9d
SK
802 [AS_IF([test x"$ac_cv_search_socket" != x"none required"],
803 [SOCKET_LIBS="$SOCKET_LIBS -lsocket"])
804])
60cc9f94
FG
805AC_SUBST([SOCKET_LIBS])
806
d58c47d9
FG
807
808have_dirfd=no
809AC_CHECK_FUNCS([dirfd], [have_dirfd=yes], [have_dirfd=no])
3013eb9d 810AS_IF([test x"$have_dirfd" = xno], [
d58c47d9
FG
811 AC_CHECK_DECLS([dirfd],
812 [have_dirfd=yes], [have_dirfd=no],
813 [#include <sys/types.h>
814 #include <dirent.h>])
3013eb9d 815])
d58c47d9
FG
816
817have_ddfd=no
3013eb9d 818AS_IF([test x"$have_dirfd" = xno], [
d58c47d9
FG
819 AC_CHECK_MEMBERS([DIR.dd_fd],
820 [have_ddfd=yes], [have_ddfd=no],
821 [#include <sys/types.h>
822 #include <dirent.h>])
3013eb9d 823])
d58c47d9 824
948182f4 825AM_CONDITIONAL([HAVE_DIRFD], [test "x$have_dirfd" = xyes || test "x$have_ddfd" = xyes])
d58c47d9 826
8fabaa8b
MC
827have_fts_open=no
828AC_CHECK_FUNCS([fts_open], [have_fts_open=yes], [have_fts_open=no])
829AM_CONDITIONAL([HAVE_FTS_OPEN], [test "x$have_fts_open" = xyes])
830
330555c4
MY
831MQ_LIBS=
832AC_CHECK_LIB([rt], [mq_open], [MQ_LIBS="-lrt"])
833AC_SUBST([MQ_LIBS])
d58c47d9 834
d6abf168
SK
835AC_MSG_CHECKING([whether program_invocation_short_name is defined])
836AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
37edac9a 837 #include <errno.h>
d6abf168
SK
838]], [[
839 program_invocation_short_name = "test";
840]])], [
841 AC_MSG_RESULT([yes])
842 AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
843 [Define if program_invocation_short_name is defined])
844], [
845 AC_MSG_RESULT([no])
846])
847
a804f444
FG
848
849AC_MSG_CHECKING([whether __progname is defined])
850AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
cf582a2e 851 [if (*__progname == 0) return 1;])],
034d378b
SK
852 AC_DEFINE([HAVE___PROGNAME], [1], [Define if __progname is defined])
853 AC_MSG_RESULT([yes]),
854 AC_MSG_RESULT([no]))
a804f444 855
a0cf9105
LB
856AC_CHECK_DECL([IOC_OPAL_GET_STATUS],
857 [AC_DEFINE([HAVE_OPAL_GET_STATUS], [1],
858 [Define to 1 if OPAL status ioctl is defined])],,
859 [#include <linux/sed-opal.h>])
860
8569410c 861dnl Static compilation
44bf6d80 862m4_define([UL_STATIC_PROGRAMS], [blkid, fdisk, losetup, mount, nsenter, partx, sfdisk, umount, unshare])
8569410c
SK
863
864AC_ARG_ENABLE([static-programs],
865 [AS_HELP_STRING([--enable-static-programs=LIST],
866 [link static the programs in LIST (comma-separated,
132ea941 867 supported for ]m4_defn([UL_STATIC_PROGRAMS])[)])])
8569410c 868
9f57e6e8
SK
869AS_CASE([$enable_static_programs],
870 [yes],
d924b10b 871 [enable_static_programs=m4_quote(UL_STATIC_PROGRAMS)],
9f57e6e8
SK
872 [no],
873 [enable_static_programs=]
874)
8569410c 875
8569410c 876dnl Set all the individual AM_CONDITIONALs
132ea941 877m4_foreach([UL_PRG], m4_defn([UL_STATIC_PROGRAMS]), [
9f57e6e8
SK
878 AS_CASE([,$enable_static_programs,],
879 [*,UL_PRG,*], [static_[]UL_PRG=yes]
880 )
d924b10b 881 AS_IF([test "x$static_[]UL_PRG" = xyes], [AC_MSG_NOTICE([enable static build: UL_PRG.])])
132ea941
KZ
882 AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UL_PRG),
883 [test "x$static_[]UL_PRG" = xyes])
8569410c
SK
884])
885
08b1c219
KZ
886
887AC_ARG_ENABLE([all-programs],
888 AS_HELP_STRING([--disable-all-programs], [disable everything, might be overridden by --enable-<name>]),
889 [], [enable_all_programs=undefined]
890)
891
892AS_CASE([$enable_all_programs],
7477f356 893 [yes], [AC_MSG_WARN([force to build all programs by default])
c25b7d8a 894 ul_default_estate=check],
22a900a9 895 [no], [AC_MSG_WARN([disable all programs and man pages by default])
c25b7d8a 896 ul_default_estate=no]
08b1c219
KZ
897)
898
899
22a900a9
KZ
900AC_ARG_ENABLE([asciidoc],
901 AS_HELP_STRING([--disable-asciidoc], [do not generate man pages from asciidoc]),
902 [], [UL_DEFAULT_ENABLE([asciidoc], [check])]
903)
904UL_BUILD_INIT([asciidoc])
905UL_REQUIRES_PROGRAM([asciidoc], [ASCIIDOCTOR], [asciidoctor], [man pages])
906AM_CONDITIONAL([ENABLE_ASCIIDOC], [test "x$build_asciidoc" = xyes])
a5b09369 907have_asciidoctor_failure_level=no
25a70dcb
TW
908AS_IF([test "x$build_asciidoc" = xyes], [
909 AC_MSG_CHECKING([whether ${ASCIIDOCTOR} supports --failure-level])
910 AS_IF([${ASCIIDOCTOR} --help | grep failure-level >/dev/null 2>&1 ], [
911 AC_MSG_RESULT([yes])
a5b09369 912 have_asciidoctor_failure_level=yes
25a70dcb
TW
913 ], [
914 AC_MSG_RESULT([no])
25a70dcb
TW
915 ])
916])
a5b09369 917AM_CONDITIONAL([HAVE_ASCIIDOCTOR_FAILURE_LEVEL], [test "x$have_asciidoctor_failure_level" = xyes])
22a900a9 918
1a30b2bd
KZ
919have_manpages=no
920AS_IF([test -f "$srcdir/sys-utils/mount.8"], [
921 AC_MSG_NOTICE([re-use already generated man-pages.])
922 have_manpages=yes]
923)
924AM_CONDITIONAL([HAVE_MANPAGES], [test "x$have_manpages" = xyes])
925
22a900a9 926
8f5fff53 927AC_ARG_ENABLE([poman],
ff875284 928 AS_HELP_STRING([--disable-poman], [do not generate translated man pages]),
9acfc349 929 [], [UL_DEFAULT_ENABLE([poman], [check])]
8f5fff53
KZ
930)
931UL_BUILD_INIT([poman])
932UL_REQUIRES_PROGRAM([poman], [PO4A], [po4a], [translated man pages])
5e42ec32 933AM_CONDITIONAL([ENABLE_POMAN], [test "x$build_poman" = xyes])
8f5fff53
KZ
934
935
d7a01582 936AX_CHECK_TLS
3ac22f7a 937
37a11e1a 938have_pty=no
17d71034
KZ
939AC_ARG_WITH([util], AS_HELP_STRING([--without-util], [compile without libutil]),
940 [], [with_util=auto]
941)
942AS_IF([test "x$with_util" = xno], [
943 AM_CONDITIONAL([HAVE_UTIL], [false])
944 have_util=no
945], [
946 UL_CHECK_LIB([util], [openpty])
947])
948
948182f4 949AS_IF([test "x$have_pty_h" = xyes && test "x$have_sys_signalfd_h" = xyes && test "x$have_util" = xyes], [
6954895c
KZ
950 AM_CONDITIONAL([HAVE_PTY], [true])
951 AC_DEFINE([HAVE_PTY], [1], [have PTY support])
37a11e1a 952 have_pty=yes
6954895c
KZ
953], [
954 AM_CONDITIONAL([HAVE_PTY], [false])
955])
17d71034 956
3aecf79d
KZ
957AC_CHECK_TYPES([union semun], [], [], [[
958#include <sys/sem.h>
959]])
034d378b 960AC_CHECK_TYPES([loff_t])
3aecf79d 961
4cb6fea5
KZ
962
963AC_ARG_ENABLE([widechar],
964 AS_HELP_STRING([--disable-widechar], [do not compile wide character support]),
965 [], [enable_widechar=check]
966)
967UL_BUILD_INIT([widechar])
968UL_REQUIRES_COMPILE([widechar], [[
969 #include <wchar.h>
970 #include <wctype.h>
971 #include <stdio.h>
1632856e 972 #include <stdlib.h>
4cb6fea5
KZ
973 ]], [[
974 wchar_t wc;
975 wint_t w;
976 w = fgetwc(stdin);
977 if (w == WEOF) exit(1);
978 wc = w;
979 fputwc(wc,stdout);
980 ]],
981 [wchar_t support])
982
983AS_IF([test "x$build_widechar" = xyes ], [
984 AC_DEFINE([HAVE_WIDECHAR], [1], [Do we have wide character support?])
3aecf79d
KZ
985])
986
4cb6fea5 987
3aecf79d
KZ
988AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
989#include <sched.h>
990]])
991
034d378b 992AM_CONDITIONAL([HAVE_CPU_SET_T], [test "x$have_cpu_set_t" = xyes])
3aecf79d 993
b09bc508
MF
994AC_CHECK_TYPES([sighandler_t], [], [], [[
995#include <signal.h>
996]])
997
82390c03
MY
998# checking sigset_t defined in the kernel header in
999# asm/signal.h. tests/helpers/test_mkfds_ppoll.c expects the RAW sigset_t
1000# is defined in the header file.
1001# However, a slightly older arch/parisc doesn't export the type.
1002# See https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=487fa28fa8b60417642ac58e8beda6e2509d18f9
1003AC_CHECK_TYPES([sigset_t], [], [], [[
1004#include <asm/signal.h>
1005]])
1006
3aecf79d
KZ
1007AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
1008#include <sched.h>
1009]])
1010
8d35bdc9 1011# on Solaris, you can't mix and match standards, since we use c99
218b1dd6 1012# apparently at this stage, XOPEN_SOURCE will conflict. As workaround,
8d35bdc9 1013# check for crypt.h and use that without XOPEN_SOURCE.
8229ed2f 1014have_crypt=no
8d35bdc9
KZ
1015AC_CHECK_HEADERS([crypt.h])
1016AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1017#ifdef HAVE_CRYPT_H
1018#include <crypt.h>
1019#else
1020#define _XOPEN_SOURCE
1021#include <unistd.h>
1022#endif
1023]], [[
1024char *c = crypt("abc","pw");
70c364b4
JN
1025]])],[
1026 have_libcrypt=no
1027 have_crypt=yes
1028],[
75cba8d5 1029 UL_SET_LIBS([-lcrypt])
637cc045 1030 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
8d35bdc9
KZ
1031 #ifdef HAVE_CRYPT_H
1032 #include <crypt.h>
1033 #else
1034 #define _XOPEN_SOURCE
1035 #include <unistd.h>
1036 #endif
1037 ]], [[
1038 char *c = crypt("abc","pw");
1039 ]])],[
8d35bdc9 1040 have_libcrypt=yes
8229ed2f 1041 have_crypt=yes
8d35bdc9 1042 ],[
8229ed2f 1043 AC_MSG_WARN([crypt() is not available])
8d35bdc9 1044 ])
75cba8d5 1045 UL_RESTORE_LIBS
8d35bdc9 1046])
034d378b 1047AM_CONDITIONAL([HAVE_LIBCRYPT], [test "x$have_libcrypt" = xyes])
8d35bdc9 1048
13f5473e 1049
75ad4910
KZ
1050AC_ARG_WITH([selinux],
1051 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
034d378b 1052 [], [with_selinux=no]
75ad4910
KZ
1053)
1054
3013eb9d 1055AS_IF([test "x$with_selinux" = xno], [
034d378b 1056 AM_CONDITIONAL([HAVE_SELINUX], [false])
3013eb9d 1057], [
ca27216a 1058 PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.5], [have_selinux=yes], [have_selinux=no])
9f57e6e8
SK
1059 AS_CASE([$with_selinux:$have_selinux],
1060 [yes:no], [AC_MSG_ERROR([SELinux selected but libselinux not found or too old])]
1061 )
3013eb9d 1062 AS_IF([test "x$have_selinux" = xyes], [
1468eda6
KZ
1063 AC_DEFINE([HAVE_LIBSELINUX], [1], [Define if SELinux is available])
1064 UL_PKG_STATIC([SELINUX_LIBS_STATIC], [libselinux])
1065 AM_CONDITIONAL([HAVE_SELINUX], [true])
1066
75cba8d5 1067 UL_SET_LIBS([$SELINUX_LIBS])
312f04f4
KZ
1068 # This function is missing in old libselinux 1.xx versions
1069 AC_CHECK_FUNCS([security_get_initial_context])
75cba8d5 1070 UL_RESTORE_LIBS
3013eb9d
SK
1071 ])
1072])
75ad4910
KZ
1073AC_SUBST([SELINUX_LIBS])
1074AC_SUBST([SELINUX_LIBS_STATIC])
1075
0273afda 1076
75ad4910
KZ
1077AC_ARG_WITH([audit],
1078 AS_HELP_STRING([--with-audit], [compile with audit support]),
034d378b 1079 [], [with_audit=no]
75ad4910
KZ
1080)
1081
3013eb9d 1082AS_IF([test "x$with_audit" = xno], [
034d378b 1083 AM_CONDITIONAL([HAVE_AUDIT], [false])
3013eb9d 1084], [
034d378b 1085 UL_CHECK_LIB([audit], [audit_log_user_message])
9f57e6e8
SK
1086 AS_CASE([$with_audit:$have_audit],
1087 [yes:no],
1088 [AC_MSG_ERROR([Audit selected but libaudit not found (or does not support audit_log_user_message())])]
1089 )
3013eb9d 1090])
75ad4910
KZ
1091
1092AC_ARG_WITH([udev], AS_HELP_STRING([--without-udev], [compile without udev support]),
034d378b 1093 [], [with_udev=auto]
75ad4910
KZ
1094)
1095
3013eb9d 1096AS_IF([test "x$with_udev" = xno], [
034d378b 1097 AM_CONDITIONAL([HAVE_UDEV], [false])
3013eb9d 1098], [
034d378b 1099 UL_CHECK_LIB([udev], [udev_new])
9f57e6e8
SK
1100 AS_CASE([$with_udev:$have_udev],
1101 [yes:no],
1102 [AC_MSG_ERROR([udev selected but libudev not found])]
1103 )
3013eb9d 1104])
75ad4910 1105
2b8f22bd 1106
4ffcc7a9
KZ
1107dnl wide-char ncurses
1108AC_ARG_WITH([ncursesw],
95a89bd3 1109 AS_HELP_STRING([--without-ncursesw], [do not build with wide-char ncurses]),
4ffcc7a9
KZ
1110 [], [with_ncursesw=auto]
1111)
1112have_ncursesw=no
3cc8a9f4 1113have_ncursesw_header=no
23aa09d7
KZ
1114
1115AS_CASE([$with_ncursesw:$build_widechar],
1116 [yes:no],
1117 [AC_MSG_ERROR([wide-char support disabled, but wide-char ncurses required])],
1118 [auto:no],
1119 [
1120 AC_MSG_WARN([wide-char support disabled, disabling wide-char ncurses])
1121 with_ncursesw=no
1122 ]
1123)
4ffcc7a9 1124AS_IF([test "x$with_ncursesw" != xno], [
e5cc93b5
KZ
1125 UL_NCURSES_CHECK([ncursesw])
1126 AS_IF([test "x$have_ncursesw" = xyes], [
3947ca4c
KZ
1127 AC_CHECK_HEADERS([ncursesw/ncurses.h], [have_ncursesw_header=yes])
1128 AC_CHECK_HEADERS([ncursesw/term.h])
87c26ce5
KZ
1129
1130 # Define HAVE_NCURSES_H only if check for HAVE_NCURSESW_NCURSES_H is
1131 # unsuccessful to avoid too many *_H permitations in config.h
1132 AS_IF([test "x$have_ncursesw_header" = xno], [
1133 AC_CHECK_HEADERS([ncurses.h], [have_ncursesw_header=yes])
1134 AC_CHECK_HEADERS([term.h])
1135 ])
3cc8a9f4
KZ
1136 AS_IF([test "x$have_ncursesw_header" = xno], [have_ncursesw=no])
1137 ])
1138 AS_IF([test "x$have_ncursesw" = xyes], [
f1512be8 1139 CURSES_LIB_NAME="ncursesw"
3cc8a9f4 1140 AC_DEFINE([HAVE_LIBNCURSESW], [1], [Define if ncursesw library available])
e5cc93b5 1141 ])
4ffcc7a9
KZ
1142])
1143AS_CASE([$with_ncursesw:$have_ncursesw],
1144 [yes:no], [AC_MSG_ERROR([ncursesw selected, but library not found])])
2b8f22bd 1145
43cc76e2 1146
4ffcc7a9
KZ
1147dnl non-wide ncurses
1148AC_ARG_WITH([ncurses],
95a89bd3 1149 AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses]),
4ffcc7a9
KZ
1150 [], [with_ncurses=auto]
1151)
1152have_ncurses=no
3cc8a9f4 1153have_ncurses_header=no
18dae5d8
KZ
1154AS_CASE([$with_ncurses:$build_widechar],
1155 [yes:yes], [AC_MSG_ERROR([wide-char support enabled, but non-wide ncurses selects])])
1156
948182f4 1157AS_IF([test "x$have_ncursesw" = xno && test "x$with_ncurses" != xno ], [
e5cc93b5
KZ
1158 UL_NCURSES_CHECK([ncurses])
1159 AS_IF([test "x$have_ncurses" = xyes], [
87c26ce5
KZ
1160 AC_CHECK_HEADERS([ncurses/ncurses.h], [have_ncurses_header=yes])
1161 AC_CHECK_HEADERS([ncurses/term.h])
1162
1163 # Define HAVE_NCURSES_H only if check for HAVE_NCURSES_NCURSES_H is
1164 # unsuccessful to avoid too many *_H permitations in config.h
1165 AS_IF([test "x$have_ncurses_header" = xno], [
1166 AC_CHECK_HEADERS([ncurses.h], [have_ncurses_header=yes])
1167 AC_CHECK_HEADERS([term.h])
1168 ])
3cc8a9f4
KZ
1169 AS_IF([test "x$have_ncurses_header" = xno], [have_ncurses=no])
1170 ])
1171 AS_IF([test "x$have_ncurses" = xyes], [
4ffcc7a9 1172 CURSES_LIB_NAME="ncurses"
3cc8a9f4 1173 AC_DEFINE([HAVE_LIBNCURSES], [1], [Define if ncurses library available])
e5cc93b5 1174 ])
3013eb9d 1175])
4ffcc7a9
KZ
1176AS_CASE([$with_ncurses:$have_ncurses],
1177 [yes:no], [AC_MSG_ERROR([ncurses selected, but library not found])])
1178
2b8f22bd 1179AC_SUBST([NCURSES_CFLAGS])
75ad4910 1180AC_SUBST([NCURSES_LIBS])
948182f4 1181AM_CONDITIONAL([HAVE_NCURSES], [test "x$have_ncursesw" = xyes || test "x$have_ncurses" = xyes])
75ad4910
KZ
1182
1183
1184AC_ARG_WITH([slang],
4ffcc7a9 1185 AS_HELP_STRING([--with-slang], [compile cfdisk with slang rather than ncurses]),
034d378b 1186 [], [with_slang=no]
75ad4910 1187)
50ea6795 1188have_slang=no
3013eb9d 1189AS_IF([test "x$with_slang" = xyes], [
75ad4910
KZ
1190 AC_CHECK_HEADERS([slang.h slang/slang.h])
1191 AC_CHECK_HEADERS([slcurses.h slang/slcurses.h],
50ea6795 1192 [have_slang=yes], [], [
75ad4910
KZ
1193#ifdef HAVE_SLANG_H
1194#include <slang.h>
1195#elif defined(HAVE_SLANG_SLANG_H)
1196#include <slang/slang.h>
1197#endif
1198])
3013eb9d 1199 AS_IF([test "x$have_slang" = xno], [
f1512be8
KZ
1200 AC_MSG_ERROR([slang selected but slcurses.h not found])],
1201 [CURSES_LIB_NAME=slang
3013eb9d
SK
1202 ])
1203])
034d378b 1204AM_CONDITIONAL([HAVE_SLANG], [test "x$have_slang" = xyes])
50ea6795 1205
50ea6795 1206
948182f4 1207AS_IF([test "x$have_slang" = xyes || test "x$have_ncursesw" = xyes || test "x$have_ncurses" = xyes], [
f1512be8
KZ
1208 AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, [
1209 AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1,
7556c944
KZ
1210 [Define if curses library has the use_default_colors().])
1211 ])
1212 AC_CHECK_LIB([$CURSES_LIB_NAME], resizeterm, [
1213 AC_DEFINE(HAVE_RESIZETERM, 1,
1214 [Define if curses library has the resizeterm().])
f1512be8
KZ
1215 ])
1216])
1217
50ea6795 1218
17d71034
KZ
1219AC_ARG_WITH([tinfo], AS_HELP_STRING([--without-tinfo], [compile without libtinfo]),
1220 [], [with_tinfo=auto]
1221)
1222have_tinfo=no
ad442a81 1223have_tinfow=no
17d71034 1224AS_IF([test "x$with_tinfo" != xno], [
ad442a81
KZ
1225 AS_IF([test "x$have_ncursesw" = xyes], [
1226 UL_TINFO_CHECK([tinfow])
1227 ])
1228 AS_IF([test "x$have_tinfow" = xno], [
1229 UL_TINFO_CHECK([tinfo])
17d71034 1230 ])
2b8f22bd
MF
1231])
1232AC_SUBST([TINFO_LIBS])
0b28c2ec 1233AC_SUBST([TINFO_LIBS_STATIC])
ccf92e6d 1234AC_SUBST([TINFO_CFLAGS])
948182f4
IM
1235AM_CONDITIONAL([HAVE_TINFO], [test "x$have_tinfo" = xyes || test "x$have_tinfow" = xyes])
1236AS_IF([test "x$have_tinfo" = xyes || test "x$have_tinfow" = xyes], [
ad442a81 1237 AC_DEFINE(HAVE_LIBTINFO, 1, [Define if libtinfo or libtinfow available.])
4310faf9 1238])
75ad4910
KZ
1239
1240
0b28c2ec 1241AC_ARG_WITH([readline],
95a89bd3 1242 AS_HELP_STRING([--without-readline], [do not build with GNU Readline support]),
0b28c2ec
KZ
1243 [], [with_readline=auto]
1244)
1245
1246AS_IF([test "x$with_readline" = xno], [
1247 AM_CONDITIONAL([HAVE_READLINE], [false])
1248], [
1249 UL_CHECK_LIB([readline], [readline])
1250 AS_CASE([$with_readline:$have_readline],
1251 [yes:no],
1252 [AC_MSG_ERROR([readline selected but libreadline not found ])],
1253 [*:yes],
1254 [READLINE_LIBS="-lreadline"
1255 READLINE_LIBS_STATIC="-lreadline $TINFO_LIBS_STATIC"]
1256 )
1257])
1258AC_SUBST([READLINE_LIBS])
1259AC_SUBST([READLINE_LIBS_STATIC])
1260
1261
75ad4910
KZ
1262AC_ARG_WITH([utempter],
1263 AS_HELP_STRING([--with-utempter], [compile script(1) with libutempter]),
034d378b 1264 [], [with_utempter=no]
75ad4910
KZ
1265)
1266
3013eb9d 1267AS_IF([test "x$with_utempter" = xyes], [
034d378b 1268 UL_CHECK_LIB([utempter], [utempter_add_record])
3013eb9d 1269 AS_IF([test "x$have_utempter" = xno], [
75ad4910 1270 AC_MSG_ERROR([utempter selected but libutempter not found])
3013eb9d
SK
1271 ])
1272], [
034d378b 1273 AM_CONDITIONAL([HAVE_UTEMPTER], [false])
3013eb9d 1274])
75ad4910
KZ
1275
1276
1dbbde66
KZ
1277dnl
1278dnl libuuid
1279dnl
17afb032
KZ
1280AC_ARG_ENABLE([libuuid],
1281 AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]),
08b1c219 1282 [], [UL_DEFAULT_ENABLE([libuuid], [yes])]
17afb032 1283)
fa7be20e 1284UL_BUILD_INIT([libuuid])
dc2b8d87
KZ
1285AC_SUBST([LIBUUID_VERSION])
1286AC_SUBST([LIBUUID_VERSION_INFO])
fa7be20e 1287AM_CONDITIONAL(BUILD_LIBUUID, test "x$build_libuuid" = xyes)
9dc801d2 1288
3e584e85
RM
1289AC_ARG_ENABLE([libuuid-force-uuidd],
1290 AS_HELP_STRING([--enable-libuuid-force-uuidd], [support uuidd even though the daemon is not built]),
1291 [], [enable_libuuid_force_uuidd=no]
1292)
1293
13985252 1294AS_IF([test "x$build_libuuid" = xyes], [
17afb032 1295 AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.])
3013eb9d 1296])
48d7b13a 1297
c2e299d0
SS
1298dnl
1299dnl liblastlog2
1300dnl
1301AC_ARG_ENABLE([liblastlog2],
1302 AS_HELP_STRING([--disable-liblastlog2], [do not build liblastlog2 and lastlog2 utilities]),
dd3bbc9c 1303 [], [UL_DEFAULT_ENABLE([liblastlog2], [yes])]
c2e299d0 1304)
dd3bbc9c
KZ
1305UL_BUILD_INIT([liblastlog2])
1306
1307have_sqlite3=no
1308AS_IF([test "x$build_liblastlog2" = xyes], [
1309 PKG_CHECK_MODULES([SQLITE3], [sqlite3], [have_sqlite3=yes], [have_sqlite3=no])
1310])
1311UL_REQUIRES_HAVE([liblastlog2], [sqlite3], [sqlite3 library])
1312AC_SUBST([SQLITE3_LIBS])
1313
c2e299d0
SS
1314AC_SUBST([LIBLASTLOG2_VERSION])
1315AC_SUBST([LIBLASTLOG2_VERSION_INFO])
1316AC_DEFINE_UNQUOTED([LIBLASTLOG2_VERSION], ["$LIBLASTLOG2_VERSION"], [liblastlog2 version string])
dd3bbc9c
KZ
1317AM_CONDITIONAL([BUILD_LIBLASTLOG2], [test "x$build_liblastlog2" = xyes])
1318AM_CONDITIONAL([BUILD_LIBLASTLOG2_TESTS], [test "x$build_liblastlog2" = xyes && test "x$enable_static" = xyes])
ede518f4
KZ
1319AS_IF([test "x$build_liblastlog2" = xyes], [
1320 AC_DEFINE([HAVE_LIBLASTLOG2], [1], [Define to 1 if you have the -lblkid.])
1321])
dd3bbc9c
KZ
1322
1323
1324AC_ARG_ENABLE([pam_lastlog2],
1325 AS_HELP_STRING([--disable-pam-lastlog2], [do not build PAM lastlog2 module]),
1326 [], [UL_DEFAULT_ENABLE([pam_lastlog2], [check])]
1327)
1328UL_BUILD_INIT([pam_lastlog2])
1329UL_REQUIRES_BUILD([pam_lastlog2], [liblastlog2])
1330UL_REQUIRES_HAVE([pam_lastlog2], [security_pam_modules_h], [pam_modules.h header file])
1331AM_CONDITIONAL([BUILD_PAM_LASTLOG2], [test "x$build_pam_lastlog2" = xyes])
c2e299d0 1332
c2e299d0 1333
1dbbde66
KZ
1334dnl
1335dnl libblkid
1336dnl
f910b559 1337AC_ARG_ENABLE([libblkid],
1d12ed57 1338 AS_HELP_STRING([--disable-libblkid], [do not build libblkid and many related utilities]),
dc049516 1339 [], [UL_DEFAULT_ENABLE([libblkid], [check])]
40f07ff7 1340)
61a074f7 1341UL_BUILD_INIT([libblkid])
dc049516 1342UL_REQUIRES_HAVE([libblkid], [openat], [openat functions])
a68ed87f 1343UL_REQUIRES_HAVE([libblkid], [dirfd,ddfd], [dirfd or ddfd function])
033cf439 1344AC_SUBST([LIBBLKID_DATE])
dc2b8d87
KZ
1345AC_SUBST([LIBBLKID_VERSION])
1346AC_SUBST([LIBBLKID_VERSION_INFO])
034d378b
SK
1347AC_DEFINE_UNQUOTED([LIBBLKID_VERSION], ["$LIBBLKID_VERSION"], [libblkid version string])
1348AC_DEFINE_UNQUOTED([LIBBLKID_DATE], ["$LIBBLKID_DATE"], [libblkid date string])
3013eb9d 1349AS_IF([test "x$build_libblkid" = xyes], [
034d378b 1350 AC_DEFINE([HAVE_LIBBLKID], [1], [Define to 1 if you have the -lblkid.])
3013eb9d 1351])
034d378b 1352AM_CONDITIONAL([BUILD_LIBBLKID], [test "x$build_libblkid" = xyes])
948182f4 1353AM_CONDITIONAL([BUILD_LIBBLKID_TESTS], [test "x$build_libblkid" = xyes && test "x$enable_static" = xyes])
f910b559 1354
1dbbde66
KZ
1355dnl
1356dnl libmount
1357dnl
f1cde479
KZ
1358AC_ARG_ENABLE([libmount],
1359 AS_HELP_STRING([--disable-libmount], [do not build libmount]),
08b1c219 1360 [], [UL_DEFAULT_ENABLE([libmount], [check])]
f1cde479 1361)
61a074f7 1362UL_BUILD_INIT([libmount])
13f5473e 1363UL_REQUIRES_BUILD([libmount], [libblkid])
a68ed87f 1364UL_REQUIRES_HAVE([libmount], [dirfd,ddfd], [dirfd or ddfd function])
94c8821b 1365UL_REQUIRES_HAVE([libmount], [mntent_h], [mntent.h header file])
0c44599f 1366UL_REQUIRES_HAVE([libmount], [sys_vfs_h], [sys/vfs.h header file])
034d378b 1367AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
948182f4 1368AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes && test "x$enable_static" = xyes])
30c34afb 1369AS_IF([test "x$build_libmount" = xyes], [
7a3b35b9
KZ
1370 AC_DEFINE(HAVE_LIBMOUNT, 1, [Define if libmount available.])
1371 AS_IF([test "x$have_setns_syscall" = "xyes"], [
1372 AC_DEFINE([USE_LIBMOUNT_SUPPORT_NAMESPACES], [1], [Define to 1 if want to support namepaces.])
1373 ],[
1374 AC_MSG_WARN([libmount will be compiled without namespaces support])
1375 ])
30c34afb 1376])
8e368761 1377
f1cde479 1378AC_SUBST([LIBMOUNT_VERSION])
10e1d2e5
SH
1379AC_SUBST([LIBMOUNT_MAJOR_VERSION], $PACKAGE_VERSION_MAJOR)
1380AC_SUBST([LIBMOUNT_MINOR_VERSION], $PACKAGE_VERSION_MINOR)
1381AC_SUBST([LIBMOUNT_PATCH_VERSION], $PACKAGE_VERSION_RELEASE)
f1cde479 1382AC_SUBST([LIBMOUNT_VERSION_INFO])
034d378b 1383AC_DEFINE_UNQUOTED([LIBMOUNT_VERSION], ["$LIBMOUNT_VERSION"], [libmount version string])
13f5473e 1384
9040c090
KZ
1385AC_ARG_ENABLE([libmount-mountfd-support],
1386 AS_HELP_STRING([--disable-libmount-mountfd-support], [do not use new mount API based on FDs]),
1387 [], [enable_libmount_mountfd_support=check]
1388)
1389UL_BUILD_INIT([libmount_mountfd_support])
1390UL_REQUIRES_BUILD([libmount_mountfd_support], [libmount])
1391UL_REQUIRES_LINUX([libmount_mountfd_support])
1392UL_REQUIRES_HAVE([libmount_mountfd_support], [mountfd_api], [mount FDs based API])
5502e73d 1393UL_REQUIRES_HAVE([libmount_mountfd_support], [linux_mount_h], [linux/mount.h])
9040c090
KZ
1394AS_IF([test "x$build_libmount_mountfd_support" = xyes ], [
1395 AC_DEFINE([USE_LIBMOUNT_MOUNTFD_SUPPORT], [1], [Enable support for new mount FD based kernel API])
1396])
1397
1398
1a4d989e
OO
1399dnl
1400dnl libsmartcols
1401dnl
1402AC_ARG_ENABLE([libsmartcols],
1403 AS_HELP_STRING([--disable-libsmartcols], [do not build libsmartcols]),
08b1c219 1404 [], [UL_DEFAULT_ENABLE([libsmartcols], [yes])]
1a4d989e
OO
1405)
1406UL_BUILD_INIT([libsmartcols])
1a4d989e 1407AM_CONDITIONAL([BUILD_LIBSMARTCOLS], [test "x$build_libsmartcols" = xyes])
1a4d989e
OO
1408
1409AC_SUBST([LIBSMARTCOLS_VERSION])
1410AC_SUBST([LIBSMARTCOLS_VERSION_INFO])
1411AC_DEFINE_UNQUOTED([LIBSMARTCOLS_VERSION], ["$LIBSMARTCOLS_VERSION"], [libsmartcols version string])
1412
1413
eb6a03f3 1414dnl
0bb4c979 1415dnl libfdisk
eb6a03f3 1416dnl
0bb4c979
KZ
1417AC_ARG_ENABLE([libfdisk],
1418 AS_HELP_STRING([--disable-libfdisk], [do not build libfdisk]),
1419 [], [UL_DEFAULT_ENABLE([libfdisk], [check])]
1420)
1421UL_BUILD_INIT([libfdisk])
eb6a03f3 1422UL_REQUIRES_BUILD([libfdisk], [libuuid])
034d378b 1423AM_CONDITIONAL([BUILD_LIBFDISK], [test "x$build_libfdisk" = xyes])
948182f4 1424AM_CONDITIONAL([BUILD_LIBFDISK_TESTS], [test "x$build_libfdisk" = xyes && test "x$enable_static" = xyes])
0bb4c979 1425
ed79557e
KZ
1426AS_IF([test "x$build_libblkid" = xyes],
1427 [LIBFDISK_PC_REQUIRES="uuid blkid"],[LIBFDISK_PC_REQUIRES="uuid"])
1428AC_SUBST([LIBFDISK_PC_REQUIRES])
1429
0bb4c979 1430AC_SUBST([LIBFDISK_VERSION])
791da22d
KZ
1431AC_SUBST([LIBFDISK_MAJOR_VERSION], $PACKAGE_VERSION_MAJOR)
1432AC_SUBST([LIBFDISK_MINOR_VERSION], $PACKAGE_VERSION_MINOR)
1433AC_SUBST([LIBFDISK_PATCH_VERSION], $PACKAGE_VERSION_RELEASE)
0bb4c979
KZ
1434AC_SUBST([LIBFDISK_VERSION_INFO])
1435AC_DEFINE_UNQUOTED([LIBFDISK_VERSION], ["$LIBFDISK_VERSION"], [libfdisk version string])
1436
eb6a03f3 1437
9c7431fd
CS
1438AC_ARG_ENABLE([fdisks],
1439 AS_HELP_STRING([--disable-fdisks], [do not build fdisk(8), sfdisk(8) and cfdisk(8)]),
1440 [], [UL_DEFAULT_ENABLE([fdisks], [check])]
1441)
1442enable_fdisk=$enable_fdisks
1443enable_sfdisk=$enable_fdisks
1444enable_cfdisk=$enable_fdisks
1445
1446UL_BUILD_INIT([fdisk])
dc049516 1447UL_REQUIRES_HAVE([fdisk], [openat], [openat functions])
a68ed87f 1448UL_REQUIRES_HAVE([fdisk], [dirfd,ddfd], [dirfd or ddfd function])
eb6a03f3 1449UL_REQUIRES_BUILD([fdisk], [libfdisk])
d44115f3 1450UL_REQUIRES_BUILD([fdisk], [libsmartcols])
034d378b 1451AM_CONDITIONAL([BUILD_FDISK], [test "x$build_fdisk" = xyes])
eb6a03f3
KZ
1452
1453
9c7431fd 1454UL_BUILD_INIT([sfdisk])
dc049516 1455UL_REQUIRES_HAVE([sfdisk], [openat], [openat functions])
a68ed87f 1456UL_REQUIRES_HAVE([sfdisk], [dirfd,ddfd], [dirfd or ddfd function])
9c1f9dd3
KZ
1457UL_REQUIRES_BUILD([sfdisk], [libfdisk])
1458UL_REQUIRES_BUILD([sfdisk], [libsmartcols])
ecc6047e
KZ
1459AM_CONDITIONAL([BUILD_SFDISK], [test "x$build_sfdisk" = xyes])
1460
1461
9c7431fd 1462UL_BUILD_INIT([cfdisk])
08b1c219
KZ
1463UL_REQUIRES_BUILD([cfdisk], [libfdisk])
1464UL_REQUIRES_BUILD([cfdisk], [libsmartcols])
9dd55a04 1465UL_REQUIRES_HAVE([cfdisk], [open_memstream], [open_memstream function])
4ffcc7a9 1466UL_REQUIRES_HAVE([cfdisk], [ncursesw,slang,ncurses], [ncursesw, ncurses or slang library])
08b1c219
KZ
1467AM_CONDITIONAL([BUILD_CFDISK], [test "x$build_cfdisk" = xyes])
1468
1469
434b07a0
KZ
1470AC_ARG_ENABLE([mount],
1471 AS_HELP_STRING([--disable-mount], [do not build mount(8) and umount(8)]),
08b1c219 1472 [], [UL_DEFAULT_ENABLE([mount], [check])]
ecdba5dd 1473)
434b07a0 1474UL_BUILD_INIT([mount])
53e8c16e 1475UL_REQUIRES_LINUX([mount])
434b07a0 1476UL_REQUIRES_BUILD([mount], [libmount])
034d378b 1477AM_CONDITIONAL([BUILD_MOUNT], [test "x$build_mount" = xyes])
ecdba5dd
KZ
1478
1479
bafe1a75
KZ
1480AC_ARG_ENABLE([losetup],
1481 AS_HELP_STRING([--disable-losetup], [do not build losetup]),
08b1c219 1482 [], [UL_DEFAULT_ENABLE([losetup], [check])]
bafe1a75
KZ
1483)
1484UL_BUILD_INIT([losetup])
1485UL_REQUIRES_LINUX([losetup])
7477f356 1486UL_REQUIRES_BUILD([losetup], [libsmartcols])
034d378b 1487AM_CONDITIONAL([BUILD_LOSETUP], [test "x$build_losetup" = xyes])
bafe1a75 1488
0624d840
KZ
1489AC_ARG_ENABLE([zramctl],
1490 AS_HELP_STRING([--disable-zramctl], [do not build zramctl]),
1491 [], [UL_DEFAULT_ENABLE([zramctl], [check])]
1492)
1493UL_BUILD_INIT([zramctl])
1494UL_REQUIRES_LINUX([zramctl])
1495UL_REQUIRES_BUILD([zramctl], [libsmartcols])
1496AM_CONDITIONAL([BUILD_ZRAMCTL], [test "x$build_zramctl" = xyes])
bafe1a75 1497
1dbbde66
KZ
1498AC_ARG_ENABLE([fsck],
1499 AS_HELP_STRING([--disable-fsck], [do not build fsck]),
08b1c219 1500 [], [UL_DEFAULT_ENABLE([fsck], [check])]
1dbbde66 1501)
61a074f7 1502UL_BUILD_INIT([fsck])
a7b585ea 1503UL_REQUIRES_BUILD([fsck], [libmount])
034d378b 1504AM_CONDITIONAL([BUILD_FSCK], [test "x$build_fsck" = xyes])
1dbbde66
KZ
1505
1506
1507AC_ARG_ENABLE([partx],
1508 AS_HELP_STRING([--disable-partx], [do not build addpart, delpart, partx]),
08b1c219 1509 [], [UL_DEFAULT_ENABLE([partx], [check])]
1dbbde66 1510)
61a074f7 1511UL_BUILD_INIT([partx])
ecde2536
KZ
1512UL_REQUIRES_LINUX([partx])
1513UL_REQUIRES_BUILD([partx], [libblkid])
08b1c219 1514UL_REQUIRES_BUILD([partx], [libsmartcols])
034d378b 1515AM_CONDITIONAL([BUILD_PARTX], [test "x$build_partx" = xyes])
1dbbde66
KZ
1516
1517
1dbbde66
KZ
1518AC_ARG_ENABLE([uuidd],
1519 AS_HELP_STRING([--disable-uuidd], [do not build the uuid daemon]),
08b1c219 1520 [], [UL_DEFAULT_ENABLE([uuidd], [check])]
1dbbde66 1521)
61a074f7 1522UL_BUILD_INIT([uuidd])
bcdab497 1523UL_REQUIRES_BUILD([uuidd], [libuuid])
651b25cd
RM
1524UL_REQUIRES_HAVE([uuidd], [timer], [timer_create function])
1525UL_REQUIRES_HAVE([uuidd], [sys_signalfd_h], [sys/signalfd.h header])
2afbcec5 1526AS_IF([test "x$build_uuidd" = xyes || test "x$enable_libuuid_force_uuidd" = xyes], [
034d378b 1527 AC_DEFINE([HAVE_UUIDD], [1], [Define to 1 if you want to use uuid daemon.])
3013eb9d 1528])
034d378b 1529AM_CONDITIONAL([BUILD_UUIDD], [test "x$build_uuidd" = xyes])
1dbbde66
KZ
1530
1531
5ec1108c 1532AC_ARG_ENABLE([uuidgen],
1533 AS_HELP_STRING([--disable-uuidgen], [do not build uuidgen]),
1534 [], [UL_DEFAULT_ENABLE([uuidgen], [check])]
1535)
1536UL_BUILD_INIT([uuidgen])
1b15cbd1
KZ
1537UL_REQUIRES_BUILD([uuidgen], [libuuid])
1538AM_CONDITIONAL([BUILD_UUIDGEN], [test "x$build_uuidgen" = xyes])
1539
83893f26
SK
1540UL_BUILD_INIT([uuidparse], [check])
1541UL_REQUIRES_BUILD([uuidparse], [libuuid])
1542UL_REQUIRES_BUILD([uuidparse], [libsmartcols])
1543AM_CONDITIONAL([BUILD_UUIDPARSE], [test "x$build_uuidparse" = xyes])
1544
5ec1108c 1545AC_ARG_ENABLE([blkid],
1546 AS_HELP_STRING([--disable-blkid], [do not build blkid(8)]),
1547 [], [UL_DEFAULT_ENABLE([blkid], [check])]
1548)
1549UL_BUILD_INIT([blkid])
15a2c741
KZ
1550UL_REQUIRES_BUILD([blkid], [libblkid])
1551AM_CONDITIONAL([BUILD_BLKID], [test "x$build_blkid" = xyes])
1552
1553UL_BUILD_INIT([findfs], [check])
1554UL_REQUIRES_BUILD([findfs], [libblkid])
1555AM_CONDITIONAL([BUILD_FINDFS], [test "x$build_findfs" = xyes])
1556
a76cd5f6
SV
1557AC_ARG_ENABLE([wipefs],
1558 AS_HELP_STRING([--disable-wipefs], [do not build wipefs]),
1559 [], [UL_DEFAULT_ENABLE([wipefs], [check])]
1560)
1561UL_BUILD_INIT([wipefs])
15a2c741 1562UL_REQUIRES_BUILD([wipefs], [libblkid])
d9921b2a 1563UL_REQUIRES_BUILD([wipefs], [libsmartcols])
15a2c741
KZ
1564AM_CONDITIONAL([BUILD_WIPEFS], [test "x$build_wipefs" = xyes])
1565
1566UL_BUILD_INIT([findmnt], [check])
1567UL_REQUIRES_BUILD([findmnt], [libmount])
169b4a8c 1568UL_REQUIRES_BUILD([findmnt], [libblkid])
15a2c741
KZ
1569UL_REQUIRES_BUILD([findmnt], [libsmartcols])
1570AM_CONDITIONAL([BUILD_FINDMNT], [test "x$build_findmnt" = xyes])
1571
1b15cbd1 1572
0164c245 1573AC_ARG_ENABLE([mountpoint],
2023ccc4 1574 AS_HELP_STRING([--disable-mountpoint], [do not build mountpoint]),
08b1c219 1575 [], [UL_DEFAULT_ENABLE([mountpoint], [check])]
0164c245 1576)
61a074f7 1577UL_BUILD_INIT([mountpoint])
a9127bc1 1578UL_REQUIRES_BUILD([mountpoint], [libmount])
034d378b 1579AM_CONDITIONAL([BUILD_MOUNTPOINT], [test "x$build_mountpoint" = xyes])
0164c245
KZ
1580
1581
10e56b49
KZ
1582AC_ARG_ENABLE([fallocate],
1583 AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
08b1c219 1584 [], [UL_DEFAULT_ENABLE([fallocate], [check])]
10e56b49 1585)
61a074f7 1586UL_BUILD_INIT([fallocate])
10e56b49
KZ
1587UL_REQUIRES_LINUX([fallocate])
1588UL_REQUIRES_SYSCALL_CHECK([fallocate], [UL_CHECK_SYSCALL([fallocate])])
034d378b 1589AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])
10e56b49 1590
3013eb9d 1591AS_IF([test "x$build_fallocate" = xyes], [
10e56b49
KZ
1592 dnl check for valid fallocate() function
1593 dnl with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
1594 dnl when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
1595 dnl and program can't be linked.
1596 dnl AC_CHECK_FUNC can't catch such errors since it's redefining
1597 dnl function prototype.
1598 AC_MSG_CHECKING([for valid fallocate() function])
1599 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
b832c2fe
YD
1600#ifdef HAVE_UNISTD_H
1601# include <unistd.h>
1602#endif
1603#ifdef HAVE_SYS_TYPES_H
1604# include <sys/types.h>
1605#endif
1606#ifdef HAVE_LINUX_FALLOC_H
1607# include <linux/falloc.h>
1608#endif
1609#ifdef HAVE_FCNTL_H
1610# include <fcntl.h>
1611#endif
1612]],[[
1613 long ret;
b832c2fe 1614 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
b832c2fe
YD
1615 if (ret != 0) {
1616 return 1;
1617 }
1618 ]])],[
10e56b49 1619 AC_MSG_RESULT([yes])
034d378b 1620 AC_DEFINE([HAVE_FALLOCATE], [1], [Have valid fallocate() function])],[
10e56b49 1621 AC_MSG_RESULT([no])])
3013eb9d 1622])
10e56b49 1623
833f9a7a
DC
1624AS_IF([test "x$build_fallocate" = xyes], [
1625 dnl check for valid posix_fallocate() function
1626 AC_MSG_CHECKING([for valid posix_fallocate() function])
1627 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1628#ifdef HAVE_UNISTD_H
1629# include <unistd.h>
1630#endif
1631#ifdef HAVE_SYS_TYPES_H
1632# include <sys/types.h>
1633#endif
1634#ifdef HAVE_LINUX_FALLOC_H
1635# include <linux/falloc.h>
1636#endif
1637#ifdef HAVE_FCNTL_H
1638# include <fcntl.h>
1639#endif
1640]],[[
1641 long ret;
1642 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
1643 if (ret != 0) {
1644 return 1;
1645 }
1646 ]])],[
1647 AC_MSG_RESULT([yes])
1648 AC_DEFINE([HAVE_POSIX_FALLOCATE], [1], [Have valid posix_fallocate() function])],[
1649 AC_MSG_RESULT([no])])
1650])
1651
19a224ad 1652
a2ea6670
KZ
1653AC_ARG_ENABLE([unshare],
1654 AS_HELP_STRING([--disable-unshare], [do not build unshare]),
08b1c219 1655 [], [UL_DEFAULT_ENABLE([unshare], [check])]
a2ea6670 1656)
61a074f7 1657UL_BUILD_INIT([unshare])
a2ea6670
KZ
1658UL_REQUIRES_LINUX([unshare])
1659UL_REQUIRES_SYSCALL_CHECK([unshare], [UL_CHECK_SYSCALL([unshare])])
2c2ff2ed 1660UL_REQUIRES_HAVE([unshare], [linux_capability_h], [linux/capability.h header file])
034d378b 1661AM_CONDITIONAL([BUILD_UNSHARE], [test "x$build_unshare" = xyes])
01e94325
KZ
1662
1663AC_MSG_CHECKING([for valid unshare() function])
1664AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1665#include <sched.h>
1666]],[[
1667 int ret;
1668 ret = unshare(0);
1669 if (ret != 0) {
1670 return 1;
1671 }
1672 ]])],[
1673 AC_MSG_RESULT([yes])
1674 AC_DEFINE([HAVE_UNSHARE], [1], [Have valid unshare() function])],
1675[
1676 AC_MSG_RESULT([no])
1677])
1678
b3425806 1679
f8aa8e94
EB
1680AC_ARG_ENABLE([nsenter],
1681 AS_HELP_STRING([--disable-nsenter], [do not build nsenter]),
08b1c219 1682 [], [UL_DEFAULT_ENABLE([nsenter], [check])]
f8aa8e94
EB
1683)
1684UL_BUILD_INIT([nsenter])
1685UL_REQUIRES_LINUX([nsenter])
7a3b35b9 1686UL_REQUIRES_HAVE([nsenter], [setns_syscall], [setns syscall])
034d378b 1687AM_CONDITIONAL([BUILD_NSENTER], [test "x$build_nsenter" = xyes])
01e94325
KZ
1688
1689AC_MSG_CHECKING([for valid setns() function])
1690AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1691#include <sched.h>
1692#include <errno.h>
1693]],[[
1694 int ret;
1695 ret = setns(0, 0);
1696 if (ret != EINVAL && ret != EBADF && ret != EPERM) {
1697 return 1;
1698 }
1699 ]])],[
1700 AC_MSG_RESULT([yes])
1701 AC_DEFINE([HAVE_SETNS], [1], [Have valid setns() function])],
1702[
1703 AC_MSG_RESULT([no])
1704])
b3425806 1705
17d71034
KZ
1706
1707AC_ARG_WITH([cap_ng],
801afcb0 1708 AS_HELP_STRING([--without-cap-ng], [compile without libcap-ng]),
17d71034
KZ
1709 [], [with_cap_ng=auto]
1710)
801afcb0
MF
1711AS_IF([test "x$with_cap_ng" = xno], [
1712 AM_CONDITIONAL([HAVE_CAP_NG], [false])
1713 have_cap_ng=no
1714],[
17d71034
KZ
1715 UL_CHECK_LIB([cap-ng], [capng_apply], [cap_ng])
1716])
1717
1718
5600c405
AL
1719AC_ARG_ENABLE([setpriv],
1720 AS_HELP_STRING([--disable-setpriv], [do not build setpriv]),
08b1c219 1721 [], [UL_DEFAULT_ENABLE([setpriv], [check])]
5600c405
AL
1722)
1723UL_BUILD_INIT([setpriv])
1724UL_REQUIRES_LINUX([setpriv])
8de1ec20 1725UL_REQUIRES_HAVE([setpriv], [linux_seccomp_h], [linux/seccomp.h header file])
2c2ff2ed
KZ
1726UL_REQUIRES_HAVE([setpriv], [linux_securebits_h], [linux/securebits.h header file])
1727UL_REQUIRES_HAVE([setpriv], [linux_capability_h], [linux/capability.h header file])
e1b8ba20 1728UL_REQUIRES_HAVE([setpriv], [cap_ng], [libcap-ng library])
034d378b 1729AM_CONDITIONAL([BUILD_SETPRIV], [test "x$build_setpriv" = xyes])
5600c405 1730
04ae85a7
RM
1731AC_ARG_ENABLE([hardlink],
1732 AS_HELP_STRING([--disable-hardlink], [do not build hardlink]),
1733 [], [UL_DEFAULT_ENABLE([hardlink], [check])]
1734)
1735UL_BUILD_INIT([hardlink])
1736AM_CONDITIONAL([BUILD_HARDLINK], [test "x$build_hardlink" = xyes])
5600c405 1737
43989bad 1738
539feec1
ML
1739AC_ARG_ENABLE([eject],
1740 AS_HELP_STRING([--disable-eject], [do not build eject]),
08b1c219 1741 [], [UL_DEFAULT_ENABLE([eject], [check])]
539feec1
ML
1742)
1743UL_BUILD_INIT([eject])
1744UL_REQUIRES_LINUX([eject])
7770e7df 1745UL_REQUIRES_BUILD([eject], [libmount])
034d378b 1746AM_CONDITIONAL([BUILD_EJECT], [test "x$build_eject" = xyes])
539feec1
ML
1747
1748
48d7b13a 1749AC_ARG_ENABLE([agetty],
7fa4f112 1750 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
d00c10ed 1751 [], [UL_DEFAULT_ENABLE([agetty], [check])]
48d7b13a 1752)
61a074f7 1753UL_BUILD_INIT([agetty])
b4b919fe 1754UL_REQUIRES_HAVE([agetty], [utmpx_h], [utmpx.h header])
73afd3f8 1755UL_REQUIRES_HAVE([agetty], [gnu_utmpx], [GNU utmpx functions])
034d378b 1756AM_CONDITIONAL([BUILD_AGETTY], [test "x$build_agetty" = xyes])
948182f4 1757AS_IF([test "x$have_futimens" = xyes && test "x$have_inotify_init1" = xyes ], [
90d5285d
KZ
1758 AC_DEFINE([AGETTY_RELOAD], [1], [Enable agetty --reload feature])
1759],[
1760 AC_MSG_WARN([futimens or inotify_init1 not found; agetty(8) will not provide ---reload functionality])
1761])
0fc74be1 1762
48d7b13a 1763
1eb16fd7 1764AC_ARG_ENABLE([plymouth_support],
c89edac5 1765 AS_HELP_STRING([--disable-plymouth_support], [do not care about plymouth in sulogin(8) and agetty(8)]),
d67f61c0 1766 [], [enable_plymouth_support=check]
1eb16fd7
KZ
1767)
1768UL_BUILD_INIT([plymouth_support])
1769UL_REQUIRES_HAVE([plymouth_support], [tiocglcktrmios], [TIOCGLCKTRMIOS flag])
1770UL_REQUIRES_HAVE([plymouth_support], [sock_cloexec], [SOCK_CLOEXEC flag])
1771UL_REQUIRES_HAVE([plymouth_support], [sock_nonblock], [SOCK_NONBLOCK flag])
1772UL_REQUIRES_HAVE([plymouth_support], [so_passcred], [SO_PASSCRED flag])
1773AM_CONDITIONAL([USE_PLYMOUTH_SUPPORT], [test "x$build_plymouth_support" = xyes])
1774AS_IF([test "x$build_plymouth_support" = xyes ], [
c89edac5 1775 AC_DEFINE([USE_PLYMOUTH_SUPPORT], [1], [Enable plymouth support feature for sulogin and agetty])
1eb16fd7
KZ
1776])
1777
1778
17d71034
KZ
1779AC_ARG_WITH([libz],
1780 AS_HELP_STRING([--without-libz], [compile without libz]),
1781 [], [with_libz=auto]
1782)
1783AS_IF([test "x$with_libz" = xno], [have_z=no], [
1784 AC_CHECK_LIB([z], [crc32], [have_z=yes], [have_z=no])
1785])
1786
09070e1a
SK
1787AC_ARG_WITH([libmagic],
1788 AS_HELP_STRING([--without-libmagic], [compile without libmagic]),
1789 [], [with_libmagic=auto]
1790)
1791AS_IF([test "x$with_libmagic" = xno], [have_magic=no], [
1792 AC_CHECK_LIB([magic], [magic_open], [
263381dd
MM
1793 AC_CHECK_HEADER(magic.h, [
1794 AC_DEFINE([HAVE_MAGIC], [1], [Define to 1 if you have the libmagic present.])
1795 MAGIC_LIBS="-lmagic"
1796 ])
09070e1a
SK
1797 ])
1798])
1799AC_SUBST([MAGIC_LIBS])
1800
17d71034 1801
9cb68977 1802AC_ARG_ENABLE([cramfs],
7fa4f112 1803 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
08b1c219 1804 [], [UL_DEFAULT_ENABLE([cramfs], [check])]
9cb68977 1805)
61a074f7 1806UL_BUILD_INIT([cramfs])
d81b5a52 1807UL_REQUIRES_HAVE([cramfs], [z], [z library])
034d378b 1808AM_CONDITIONAL([BUILD_CRAMFS], [test "x$build_cramfs" = xyes])
9cb68977 1809
a13cdb7a 1810
8d6f0bae 1811AC_ARG_ENABLE([bfs],
834fc88c 1812 AS_HELP_STRING([--disable-bfs], [do not build mkfs.bfs]),
08b1c219 1813 [], [UL_DEFAULT_ENABLE([bfs], [yes])]
834fc88c
KZ
1814)
1815UL_BUILD_INIT([bfs])
034d378b 1816AM_CONDITIONAL([BUILD_BFS], [test "x$build_bfs" = xyes])
834fc88c
KZ
1817
1818
3d9fdac5
KZ
1819AC_ARG_ENABLE([minix],
1820 AS_HELP_STRING([--disable-minix], [do not build fsck.minix, mkfs.minix]),
08b1c219 1821 [], [UL_DEFAULT_ENABLE([minix], [yes])]
3d9fdac5
KZ
1822)
1823UL_BUILD_INIT([minix])
1824AM_CONDITIONAL([BUILD_MINIX], [test "x$build_minix" = xyes])
1825
1826
8d6f0bae 1827AC_ARG_ENABLE([fdformat],
13b26e3c
SK
1828 AS_HELP_STRING([--enable-fdformat], [build fdformat]),
1829 [], [UL_DEFAULT_ENABLE([fdformat], [no])]
8d6f0bae
KZ
1830)
1831UL_BUILD_INIT([fdformat])
1832UL_REQUIRES_LINUX([fdformat])
034d378b 1833AM_CONDITIONAL([BUILD_FDFORMAT], [test "x$build_fdformat" = xyes])
8d6f0bae
KZ
1834
1835
6acf31ac
KZ
1836AC_ARG_ENABLE([hwclock],
1837 AS_HELP_STRING([--disable-hwclock], [do not build hwclock]),
08b1c219 1838 [], [UL_DEFAULT_ENABLE([hwclock], [check])]
6acf31ac
KZ
1839)
1840have_linuxdummy=$linux_os
1841
1842UL_BUILD_INIT([hwclock])
1843UL_REQUIRES_HAVE([hwclock], [io, linuxdummy], [ioperm iopl function or Linux])
034d378b 1844AM_CONDITIONAL([BUILD_HWCLOCK], [test "x$build_hwclock" = xyes])
e09ebf22 1845
b1062292 1846AC_ARG_ENABLE([hwclock_cmos],
88bc304b 1847 AS_HELP_STRING([--disable-hwclock-cmos], [do not use CMOS clock]),
b1062292 1848 [], [enable_hwclock_cmos=check]
88bc304b 1849)
b1062292
KZ
1850UL_BUILD_INIT([hwclock_cmos])
1851UL_REQUIRES_BUILD([hwclock_cmos], [hwclock])
1852UL_REQUIRES_ARCH([hwclock_cmos], [i?86-*,x86_64*])
1853AM_CONDITIONAL([USE_HWCLOCK_CMOS], [test "x$build_hwclock_cmos" = xyes])
1854AS_IF([test "x$build_hwclock_cmos" = xyes ], [
1855 AC_DEFINE([USE_HWCLOCK_CMOS], [1], [Define to 1 if want to use CMOS clock.])
88bc304b
CS
1856])
1857
e8c21c89
KZ
1858AC_ARG_ENABLE([hwclock_gplv3],
1859 AS_HELP_STRING([--disable-hwclock-gplv3], [do not use datetime parsing GPLv3 code]),
1860 [], [enable_hwclock_gplv3=yes]
1861)
1862AM_CONDITIONAL([USE_HWCLOCK_GPLv3_DATETIME], [test "x$enable_hwclock_gplv3" = xyes])
1863AS_IF([test "x$enable_hwclock_gplv3" = xyes ], [
1864 AC_DEFINE([USE_HWCLOCK_GPLv3_DATETIME], [1], [use datetime parsing GPLv3 code to hwclock])
1865])
1866
88bc304b 1867
5ec1108c 1868AC_ARG_ENABLE([mkfs],
1869 AS_HELP_STRING([--disable-mkfs], [do not build mkfs(8)]),
1870 [], [UL_DEFAULT_ENABLE([mkfs], [check])]
1871)
1872UL_BUILD_INIT([mkfs])
ecc6047e
KZ
1873AM_CONDITIONAL([BUILD_MKFS], [test "x$build_mkfs" = xyes])
1874
1875UL_BUILD_INIT([isosize], [yes])
1876AM_CONDITIONAL([BUILD_ISOSIZE], [test "x$build_isosize" = xyes])
1877
3d9fdac5 1878
5ec1108c 1879AC_ARG_ENABLE([fstrim],
1880 AS_HELP_STRING([--disable-fstrim], [do not build fstrim(8)]),
1881 [], [UL_DEFAULT_ENABLE([fstrim], [check])]
1882)
1883UL_BUILD_INIT([fstrim])
7b040214
KZ
1884UL_REQUIRES_LINUX([fstrim])
1885UL_REQUIRES_BUILD([fstrim], [libmount])
1886AM_CONDITIONAL([BUILD_FSTRIM], [test "x$build_fstrim" = xyes])
1887
1888
5ec1108c 1889AC_ARG_ENABLE([swapon],
1890 AS_HELP_STRING([--disable-swapon], [do not build swapon(8) and swapoff(8)]),
1891 [], [UL_DEFAULT_ENABLE([swapon], [check])]
1892)
1893UL_BUILD_INIT([swapon])
143635c9 1894UL_REQUIRES_LINUX([swapon])
cf9b16f1
KZ
1895UL_REQUIRES_SYSCALL_CHECK([swapon], [UL_CHECK_SYSCALL([swapon])], [swapon])
1896UL_REQUIRES_SYSCALL_CHECK([swapon], [UL_CHECK_SYSCALL([swapoff])], [swapoff])
143635c9 1897UL_REQUIRES_BUILD([swapon], [libblkid])
7770e7df 1898UL_REQUIRES_BUILD([swapon], [libmount])
7477f356 1899UL_REQUIRES_BUILD([swapon], [libsmartcols])
034d378b 1900AM_CONDITIONAL([BUILD_SWAPON], [test "x$build_swapon" = xyes])
cf9b16f1
KZ
1901AC_CHECK_FUNCS([swapon])
1902AC_CHECK_FUNCS([swapoff])
143635c9
KZ
1903
1904
d87ac5c6
HL
1905AC_ARG_ENABLE([lsblk],
1906 AS_HELP_STRING([--disable-lsblk], [do not build lsblk]),
1907 [], [UL_DEFAULT_ENABLE([lsblk], [check])]
1908)
1909UL_BUILD_INIT([lsblk])
a13cdb7a
KZ
1910UL_REQUIRES_LINUX([lsblk])
1911UL_REQUIRES_BUILD([lsblk], [libblkid])
9554f7ab 1912UL_REQUIRES_BUILD([lsblk], [libmount])
7477f356 1913UL_REQUIRES_BUILD([lsblk], [libsmartcols])
034d378b 1914AM_CONDITIONAL([BUILD_LSBLK], [test "x$build_lsblk" = xyes])
9cb68977 1915
a3d3b770 1916
5ec1108c 1917AC_ARG_ENABLE([lscpu],
1918 AS_HELP_STRING([--disable-lscpu], [do not build lscpu]),
1919 [], [UL_DEFAULT_ENABLE([lscpu], [check])]
1920)
1921UL_BUILD_INIT([lscpu])
da396d88 1922UL_REQUIRES_LINUX([lscpu])
7477f356 1923UL_REQUIRES_BUILD([lscpu], [libsmartcols])
da396d88 1924UL_REQUIRES_HAVE([lscpu], [cpu_set_t], [cpu_set_t type])
034d378b 1925AM_CONDITIONAL([BUILD_LSCPU], [test "x$build_lscpu" = xyes])
da396d88 1926
f2c3f2c7
AP
1927AC_ARG_ENABLE([lsfd],
1928 AS_HELP_STRING([--disable-lsfd], [do not build lsfd]),
1929 [], [UL_DEFAULT_ENABLE([lsfd], [check])]
1930)
1931UL_BUILD_INIT([lsfd])
128beb71
MY
1932UL_REQUIRES_LINUX([lsfd])
1933UL_REQUIRES_BUILD([lsfd], [libsmartcols])
0c44599f 1934UL_REQUIRES_HAVE([lsfd], [linux_bpf_h], [linux/bpf.h header file])
036d7274 1935UL_REQUIRES_HAVE([lsfd], [bpf_obj_name_len], [BPF_OBJ_NAME_LEN macro in linux/bpf.h])
ae08e490 1936UL_REQUIRES_HAVE([lsfd], [bpf_tag_size], [BPF_TAG_SIZE macro in linux/bpf.h])
128beb71 1937AM_CONDITIONAL([BUILD_LSFD], [test "x$build_lsfd" = xyes])
a3d3b770 1938
50e6f15b
RM
1939AC_ARG_ENABLE([lslogins],
1940 AS_HELP_STRING([--disable-lslogins], [do not build lslogins]),
1941 [], [UL_DEFAULT_ENABLE([lslogins], [check])]
1942)
1943UL_BUILD_INIT([lslogins])
ab1cfad5 1944UL_REQUIRES_BUILD([lslogins], [libsmartcols])
d00c10ed 1945UL_REQUIRES_HAVE([lslogins], [shadow_h], [shadow.h header])
b4b919fe 1946UL_REQUIRES_HAVE([lslogins], [utmpx_h], [utmpx.h header])
73afd3f8 1947UL_REQUIRES_HAVE([lslogins], [gnu_utmpx], [GNU utmpx functions])
ab1cfad5
OO
1948AM_CONDITIONAL([BUILD_LSLOGINS], [test "x$build_lslogins" = xyes])
1949
1950
61a074f7 1951UL_BUILD_INIT([chcpu], [check])
da396d88
KZ
1952UL_REQUIRES_LINUX([chcpu])
1953UL_REQUIRES_HAVE([chcpu], [cpu_set_t], [cpu_set_t type])
034d378b 1954AM_CONDITIONAL([BUILD_CHCPU], [test "x$build_chcpu" = xyes])
da396d88 1955
a13cdb7a 1956
7fcccbdf
KZ
1957AC_ARG_ENABLE([wdctl],
1958 AS_HELP_STRING([--disable-wdctl], [do not build wdctl]),
08b1c219 1959 [], [UL_DEFAULT_ENABLE([wdctl], [check])]
7fcccbdf
KZ
1960)
1961UL_BUILD_INIT([wdctl])
5b0289b9 1962UL_REQUIRES_LINUX([wdctl])
7477f356 1963UL_REQUIRES_BUILD([wdctl], [libsmartcols])
5b0289b9 1964UL_REQUIRES_HAVE([wdctl], [linux_watchdog_h], [linux/watchdog.h header file])
034d378b 1965AM_CONDITIONAL([BUILD_WDCTL], [test "x$build_wdctl" = xyes])
5b0289b9
KZ
1966
1967
54dbc8cf
KZ
1968UL_BUILD_INIT([swaplabel], [check])
1969UL_REQUIRES_BUILD([swaplabel], [libblkid])
034d378b 1970AM_CONDITIONAL([BUILD_SWAPLABEL], [test "x$build_swaplabel" = xyes])
54dbc8cf
KZ
1971
1972
ecc6047e
KZ
1973UL_BUILD_INIT([mkswap], [yes])
1974AM_CONDITIONAL([BUILD_MKSWAP], [test "x$build_mkswap" = xyes])
948182f4 1975AS_IF([test "x$build_mkswap" = xyes && test "x$build_libuuid" != xyes], [
08b1c219
KZ
1976 AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
1977])
ecc6047e 1978
328eb445
KZ
1979
1980AC_ARG_ENABLE([cal],
1981 AS_HELP_STRING([--disable-cal], [do not build cal]),
1982 [], [UL_DEFAULT_ENABLE([cal], [check])]
1983)
1984UL_BUILD_INIT([cal])
1b15cbd1
KZ
1985AM_CONDITIONAL([BUILD_CAL], [test "x$build_cal" = xyes])
1986
50e6f15b
RM
1987AC_ARG_ENABLE([logger],
1988 AS_HELP_STRING([--disable-logger], [do not build logger]),
1989 [], [UL_DEFAULT_ENABLE([logger], [check])]
1990)
1991UL_BUILD_INIT([logger])
1b15cbd1
KZ
1992AM_CONDITIONAL([BUILD_LOGGER], [test "x$build_logger" = xyes])
1993
4c838e6c 1994UL_BUILD_INIT([look], [yes])
1b15cbd1
KZ
1995AM_CONDITIONAL([BUILD_LOOK], [test "x$build_look" = xyes])
1996
1997UL_BUILD_INIT([mcookie], [yes])
1998AM_CONDITIONAL([BUILD_MCOOKIE], [test "x$build_mcookie" = xyes])
1999
2000UL_BUILD_INIT([namei], [yes])
2001AM_CONDITIONAL([BUILD_NAMEI], [test "x$build_namei" = xyes])
2002
c9ab7387
AH
2003matriplet="$($CC -print-multiarch 2>/dev/null || true)"
2004if test "x$matriplet" != "x"; then
2005 AC_DEFINE_UNQUOTED([MULTIARCHTRIPLET], ["$matriplet"],
2006 ["Multi-arch triplet for whereis library search path"])
2007fi
b7fc158a
SN
2008AC_ARG_ENABLE([whereis],
2009 AS_HELP_STRING([--disable-whereis], [do not build whereis]),
2010 [], [UL_DEFAULT_ENABLE([whereis], [check])]
2011)
2012UL_BUILD_INIT([whereis])
1b15cbd1
KZ
2013AM_CONDITIONAL([BUILD_WHEREIS], [test "x$build_whereis" = xyes])
2014
c221578e
NS
2015AC_ARG_ENABLE([pipesz],
2016 AS_HELP_STRING([--disable-pipesz], [do not build pipesz]),
62604365 2017 [], [UL_DEFAULT_ENABLE([pipesz], [check])]
c221578e
NS
2018)
2019UL_BUILD_INIT([pipesz])
2020UL_REQUIRES_LINUX([pipesz])
2021AM_CONDITIONAL([BUILD_PIPESZ], [test "x$build_pipesz" = xyes])
2022
642e1c69
MY
2023UL_BUILD_INIT([fadvise], [check])
2024UL_REQUIRES_LINUX([fadvise])
2025AM_CONDITIONAL([BUILD_FADVISE], [test "x$build_fadvise" = xyes])
2026
c0d75916
FS
2027AC_ARG_ENABLE([waitpid],
2028 AS_HELP_STRING([--disable-waitpid], [do not build waitpid]),
58c16c84 2029 [], [UL_DEFAULT_ENABLE([waitpid], [check])]
c0d75916
FS
2030)
2031UL_BUILD_INIT([waitpid])
550d32c4 2032UL_REQUIRES_LINUX([waitpid])
ffdd75cc 2033UL_REQUIRES_SYSCALL_CHECK([waitpid], [UL_CHECK_SYSCALL([pidfd_open])], [pidfd_open])
550d32c4
TW
2034AM_CONDITIONAL([BUILD_WAITPID], [test "x$build_waitpid" = xyes])
2035
ba05b9ff
KZ
2036AC_ARG_ENABLE([enosys],
2037 AS_HELP_STRING([--disable-enosys], [do not build enosys]),
2038 [], [UL_DEFAULT_ENABLE([enosys], [check])]
2039)
2040UL_BUILD_INIT([enosys])
cba52cc1 2041UL_REQUIRES_LINUX([enosys])
ba05b9ff 2042UL_REQUIRES_HAVE([enosys], [linux_audit_h], [linux/audit.h header file])
8de1ec20 2043UL_REQUIRES_HAVE([enosys], [linux_seccomp_h], [linux/seccomp.h header file])
3e0bbb12
TW
2044AS_IF([test "x$build_enosys" = xyes], [
2045 AC_MSG_CHECKING([for valid audit arch])
2046 AC_COMPILE_IFELSE(
2047 [AC_LANG_PROGRAM([[#include "${srcdir}/include/audit-arch.h"]])],
2048 [AC_MSG_RESULT([yes])],
2049 [AC_MSG_RESULT([no])
2050 build_enosys=no
2051 ])
2052])
cba52cc1
TW
2053AM_CONDITIONAL([BUILD_ENOSYS], [test "x$build_enosys" = xyes])
2054
22c41e99
KZ
2055UL_BUILD_INIT([lsclocks], [check])
2056UL_REQUIRES_LINUX([lsclocks])
956ccf25 2057UL_REQUIRES_BUILD([lsclocks], [libsmartcols])
e9ddea79
TW
2058AM_CONDITIONAL([BUILD_LSCLOCKS], [test "x$build_lsclocks" = xyes])
2059
3adaaa15
KZ
2060UL_BUILD_INIT([getopt], [yes])
2061AM_CONDITIONAL([BUILD_GETOPT], [test "x$build_getopt" = xyes])
2062
ecc6047e
KZ
2063
2064UL_BUILD_INIT([blockdev], [check])
2065UL_REQUIRES_LINUX([blockdev])
2066AM_CONDITIONAL([BUILD_BLOCKDEV], [test "x$build_blockdev" = xyes])
2067
2068
945ac250
KZ
2069UL_BUILD_INIT([prlimit], [check])
2070UL_REQUIRES_LINUX([prlimit])
7477f356 2071UL_REQUIRES_BUILD([prlimit], [libsmartcols])
945ac250 2072UL_REQUIRES_SYSCALL_CHECK([prlimit], [UL_CHECK_SYSCALL([prlimit64])], [prlimit64])
034d378b 2073AM_CONDITIONAL([BUILD_PRLIMIT], [test "x$build_prlimit" = xyes])
3013eb9d 2074AS_IF([test "x$build_prlimit" = xyes], [
01e94325
KZ
2075 dnl check for valid prlimit() function
2076 AC_MSG_CHECKING([for valid prlimit() function])
2077 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2078#include <sys/types.h>
2079#include <sys/time.h>
2080#include <sys/resource.h>
2081#include <stddef.h>
2082]],[[
2083 int ret;
2084 ret = prlimit(0, RLIMIT_AS, NULL, NULL);
2085 if (ret != 0) {
2086 return 1;
2087 }
2088 ]])],[
2089 AC_MSG_RESULT([yes])
2090 AC_DEFINE([HAVE_PRLIMIT], [1], [Have valid prlimit() function])],[
2091 AC_MSG_RESULT([no])])
3013eb9d 2092])
945ac250
KZ
2093
2094
01e94325 2095
3dc02ef4
DB
2096UL_BUILD_INIT([lslocks], [check])
2097UL_REQUIRES_LINUX([lslocks])
ec1204dc 2098UL_REQUIRES_BUILD([lslocks], [libmount])
7477f356 2099UL_REQUIRES_BUILD([lslocks], [libsmartcols])
034d378b 2100AM_CONDITIONAL([BUILD_LSLOCKS], [test "x$build_lslocks" = xyes])
3dc02ef4
DB
2101
2102
bd671347
KZ
2103AC_ARG_ENABLE([switch_root],
2104 AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
08b1c219 2105 [], [UL_DEFAULT_ENABLE([switch_root], [check])]
bd671347 2106)
61a074f7 2107UL_BUILD_INIT([switch_root])
a3d3b770
KZ
2108UL_REQUIRES_LINUX([switch_root])
2109UL_REQUIRES_HAVE([switch_root], [openat], [openat function])
a68ed87f 2110UL_REQUIRES_HAVE([switch_root], [dirfd,ddfd], [dirfd or ddfd function])
034d378b 2111AM_CONDITIONAL([BUILD_SWITCH_ROOT], [test "x$build_switch_root" = xyes])
bd671347
KZ
2112
2113
11125e7a
KZ
2114AC_ARG_ENABLE([pivot_root],
2115 AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
08b1c219 2116 [], [UL_DEFAULT_ENABLE([pivot_root], [check])]
11125e7a 2117)
61a074f7 2118UL_BUILD_INIT([pivot_root])
5cbbdfbf 2119UL_REQUIRES_LINUX([pivot_root])
9f632667 2120UL_REQUIRES_SYSCALL_CHECK([pivot_root], [UL_CHECK_SYSCALL([pivot_root])])
034d378b 2121AM_CONDITIONAL([BUILD_PIVOT_ROOT], [test "x$build_pivot_root" = xyes])
11125e7a
KZ
2122
2123
c12fc5e1 2124UL_BUILD_INIT([flock], [check])
3001923b 2125UL_REQUIRES_HAVE([flock], [timer], [timer_create/setitimer function])
205dbb7a
KZ
2126AM_CONDITIONAL([BUILD_FLOCK], [test "x$build_flock" = xyes])
2127
bdfe4601 2128
cad2d1ac
HC
2129AC_ARG_ENABLE([lsmem],
2130 AS_HELP_STRING([--disable-lsmem], [do not build lsmem]),
bdfe4601 2131 [], [UL_DEFAULT_ENABLE([lsmem], [check])]
cad2d1ac
HC
2132)
2133UL_BUILD_INIT([lsmem])
bdfe4601 2134UL_REQUIRES_LINUX([lsmem])
8b7f00a8 2135UL_REQUIRES_BUILD([lsmem], [libsmartcols])
cad2d1ac
HC
2136AM_CONDITIONAL([BUILD_LSMEM], [test "x$build_lsmem" = xyes])
2137
bdfe4601 2138
30e1ea8b
HC
2139AC_ARG_ENABLE([chmem],
2140 AS_HELP_STRING([--disable-chmem], [do not build chmem]),
bdfe4601 2141 [], [UL_DEFAULT_ENABLE([chmem], [check])]
30e1ea8b
HC
2142)
2143UL_BUILD_INIT([chmem])
bdfe4601 2144UL_REQUIRES_LINUX([chmem])
30e1ea8b
HC
2145AM_CONDITIONAL([BUILD_CHMEM], [test "x$build_chmem" = xyes])
2146
27704d22
PP
2147AC_CHECK_FUNCS([shm_open], [], [
2148 AC_CHECK_LIB([rt], [shm_open], [POSIXIPC_LIBS="-lrt"])
2149])
2150AC_CHECK_FUNCS([sem_close], [], [
2151 AC_CHECK_LIB([pthread], [sem_close], [POSIXIPC_LIBS="$POSIXIPC_LIBS -lpthread"])
2152])
2153AC_SUBST([POSIXIPC_LIBS])
205dbb7a 2154
45020b67
KZ
2155AC_ARG_ENABLE([ipcmk],
2156 AS_HELP_STRING([--disable-ipcmk], [do not build ipcmk]),
2157 [], [UL_DEFAULT_ENABLE([ipcmk], [check])]
2158)
2159UL_BUILD_INIT([ipcmk])
2160UL_EXCLUDE_ARCH([ipcmk], [*darwin*])
2161AM_CONDITIONAL([BUILD_IPCMK], [test "x$build_ipcmk" = xyes])
bdfe4601 2162
42a4a152
RM
2163AC_ARG_ENABLE([ipcrm],
2164 AS_HELP_STRING([--disable-ipcrm], [do not build ipcrm]),
45020b67 2165 [], [UL_DEFAULT_ENABLE([ipcrm], [check])]
42a4a152
RM
2166)
2167UL_BUILD_INIT([ipcrm])
45020b67 2168UL_EXCLUDE_ARCH([ipcrm], [*darwin*])
205dbb7a
KZ
2169AM_CONDITIONAL([BUILD_IPCRM], [test "x$build_ipcrm" = xyes])
2170
42a4a152
RM
2171AC_ARG_ENABLE([ipcs],
2172 AS_HELP_STRING([--disable-ipcs], [do not build ipcs]),
45020b67 2173 [], [UL_DEFAULT_ENABLE([ipcs], [check])]
42a4a152
RM
2174)
2175UL_BUILD_INIT([ipcs])
45020b67 2176UL_EXCLUDE_ARCH([ipcs], [*darwin*])
205dbb7a
KZ
2177AM_CONDITIONAL([BUILD_IPCS], [test "x$build_ipcs" = xyes])
2178
a0f62b0b 2179
4f6610f5
SK
2180AC_ARG_ENABLE([irqtop],
2181 AS_HELP_STRING([--disable-irqtop], [do not build irqtop]),
c61470c7 2182 [], [UL_DEFAULT_ENABLE([irqtop], [check])]
4f6610f5
SK
2183)
2184UL_BUILD_INIT([irqtop])
fa8c5cd5 2185UL_REQUIRES_LINUX([irqtop])
a0f62b0b
KZ
2186UL_REQUIRES_BUILD([irqtop], [libsmartcols])
2187UL_REQUIRES_HAVE([irqtop], [open_memstream], [open_memstream function])
2188UL_REQUIRES_HAVE([irqtop], [ncursesw,slang,ncurses], [ncursesw, ncurses or slang library])
4f6610f5
SK
2189AM_CONDITIONAL([BUILD_IRQTOP], [test "x$build_irqtop" = xyes])
2190
a0f62b0b
KZ
2191AC_ARG_ENABLE([lsirq],
2192 AS_HELP_STRING([--disable-lsirq], [do not build lsirq]),
c61470c7 2193 [], [UL_DEFAULT_ENABLE([lsirq], [check])]
a0f62b0b
KZ
2194)
2195UL_BUILD_INIT([lsirq])
2196UL_REQUIRES_LINUX([lsirq])
2197UL_REQUIRES_BUILD([lsirq], [libsmartcols])
2198AM_CONDITIONAL([BUILD_LSIRQ], [test "x$build_lsirq" = xyes])
2199
2200
8fa223da
KZ
2201UL_BUILD_INIT([choom], [check])
2202UL_REQUIRES_LINUX([choom])
2203AM_CONDITIONAL([BUILD_CHOOM], [test "x$build_choom" = xyes])
2204
9d20ffda
KZ
2205UL_BUILD_INIT([lsipc], [check])
2206UL_REQUIRES_LINUX([lsipc])
2207UL_REQUIRES_BUILD([lsipc], [libsmartcols])
2208AM_CONDITIONAL([BUILD_LSIPC], [test "x$build_lsipc" = xyes])
2209
dcf8f3b4
FF
2210AC_ARG_ENABLE([lsns],
2211 AS_HELP_STRING([--disable-lsns], [do not build lsns]),
2212 [], [UL_DEFAULT_ENABLE([lsns], [check])]
2213)
2214UL_BUILD_INIT([lsns])
8a204562
KZ
2215UL_REQUIRES_LINUX([lsns])
2216UL_REQUIRES_BUILD([lsns], [libsmartcols])
4b328279 2217UL_REQUIRES_BUILD([lsns], [libmount])
8a204562
KZ
2218AM_CONDITIONAL([BUILD_LSNS], [test "x$build_lsns" = xyes])
2219
205dbb7a
KZ
2220UL_BUILD_INIT([renice], [yes])
2221AM_CONDITIONAL([BUILD_RENICE], [test "x$build_renice" = xyes])
2222
3d47ab05
KZ
2223
2224AC_ARG_ENABLE([rfkill],
2225 AS_HELP_STRING([--disable-rfkill], [do not build rfkill]),
271552c7 2226 [], [UL_DEFAULT_ENABLE([rfkill], [check])]
3d47ab05
KZ
2227)
2228UL_BUILD_INIT([rfkill])
367f4080 2229UL_REQUIRES_LINUX([rfkill])
b3849c66 2230UL_REQUIRES_BUILD([rfkill], [libsmartcols])
c0d78c90
SK
2231AM_CONDITIONAL([BUILD_RFKILL], [test "x$build_rfkill" = xyes])
2232
3d47ab05 2233
f092076f
DDM
2234UL_BUILD_INIT([setpgid], [yes])
2235AM_CONDITIONAL([BUILD_SETPGID], [test "x$build_setpgid" = xyes])
2236
205dbb7a
KZ
2237UL_BUILD_INIT([setsid], [yes])
2238AM_CONDITIONAL([BUILD_SETSID], [test "x$build_setsid" = xyes])
2239
2240UL_BUILD_INIT([readprofile], [check])
2241UL_REQUIRES_LINUX([readprofile])
2242AM_CONDITIONAL([BUILD_READPROFILE], [test "x$build_readprofile" = xyes])
2243
42aa4cd4
HL
2244AC_ARG_ENABLE([dmesg],
2245 AS_HELP_STRING([--disable-dmesg], [do not build dmesg]),
2246 [], [UL_DEFAULT_ENABLE([dmesg], [check])]
2247)
2248UL_BUILD_INIT([dmesg])
205dbb7a
KZ
2249UL_REQUIRES_LINUX([dmesg])
2250AM_CONDITIONAL([BUILD_DMESG], [test "x$build_dmesg" = xyes])
2251
2252UL_BUILD_INIT([ctrlaltdel], [check])
2253UL_REQUIRES_LINUX([ctrlaltdel])
e52b58e6
CTV
2254dnl we assume reboot() to be the 1-argument variant, because even considering
2255dnl widely used alternative C libraries like uclibc, dietlibc and musl,
2256dnl reboot() with multiple arguments is yet only found in glibc versions
2257dnl earlier than 2.x.
9dd55a04 2258UL_REQUIRES_HAVE([ctrlaltdel], [reboot], [reboot function])
205dbb7a
KZ
2259AM_CONDITIONAL([BUILD_CTRLALTDEL], [test "x$build_ctrlaltdel" = xyes])
2260
b6252de2
KZ
2261AC_ARG_ENABLE([exch],
2262 AS_HELP_STRING([--disable-exch], [do not build exch]),
2263 [], [UL_DEFAULT_ENABLE([exch], [check])]
2264)
cd094a05
MY
2265UL_BUILD_INIT([exch])
2266UL_REQUIRES_LINUX([exch])
b6252de2 2267UL_REQUIRES_SYSCALL_CHECK([exch], [UL_CHECK_SYSCALL([renameat2])])
cd094a05
MY
2268AM_CONDITIONAL([BUILD_EXCH], [test "x$build_exch" = xyes])
2269
a921a7de
MY
2270UL_BUILD_INIT([fincore], [check])
2271UL_REQUIRES_LINUX([fincore])
3e37d7b7 2272UL_REQUIRES_BUILD([fincore], [libsmartcols])
a921a7de
MY
2273AM_CONDITIONAL([BUILD_FINCORE], [test "x$build_fincore" = xyes])
2274
205dbb7a
KZ
2275UL_BUILD_INIT([fsfreeze], [check])
2276UL_REQUIRES_LINUX([fsfreeze])
2277AM_CONDITIONAL([BUILD_FSFREEZE], [test "x$build_fsfreeze" = xyes])
2278
2279UL_BUILD_INIT([blkdiscard], [check])
2280UL_REQUIRES_LINUX([blkdiscard])
2281AM_CONDITIONAL([BUILD_BLKDISCARD], [test "x$build_blkdiscard" = xyes])
2282
1ad8ef91
KZ
2283UL_BUILD_INIT([blkzone], [check])
2284UL_REQUIRES_LINUX([blkzone])
2285UL_REQUIRES_HAVE([blkzone], [linux_blkzoned_h], [linux/blkzoned.h header])
2286AM_CONDITIONAL([BUILD_BLKZONE], [test "x$build_blkzone" = xyes])
2287
627428a9 2288UL_BUILD_INIT([blkpr], [check])
2289UL_REQUIRES_LINUX([blkpr])
2290UL_REQUIRES_HAVE([blkpr], [linux_pr_h], [linux/pr.h header])
2291AM_CONDITIONAL([BUILD_BLKPR], [test "x$build_blkpr" = xyes])
2292
205dbb7a
KZ
2293UL_BUILD_INIT([ldattach], [check])
2294UL_REQUIRES_LINUX([ldattach])
2295AM_CONDITIONAL([BUILD_LDATTACH], [test "x$build_ldattach" = xyes])
2296
2297UL_BUILD_INIT([rtcwake], [check])
2298UL_REQUIRES_LINUX([rtcwake])
2299AM_CONDITIONAL([BUILD_RTCWAKE], [test "x$build_rtcwake" = xyes])
2300
2301UL_BUILD_INIT([setarch], [check])
2302UL_REQUIRES_LINUX([setarch])
2303AM_CONDITIONAL([BUILD_SETARCH], [test "x$build_setarch" = xyes])
2304
d4b58873
KZ
2305
2306# build_scriptutils= is just configure-only variable to control
2307# script, scriptreplay and scriptlive
2308AC_ARG_ENABLE([scriptutils],
2309 AS_HELP_STRING([--disable-scriptutils], [do not build script, scriptreplay and scriptlive]),
2310 [], [UL_DEFAULT_ENABLE([scriptutils], [check])]
2311)
2312
2313UL_ENABLE_ALIAS([script], [scriptutils])
2314UL_BUILD_INIT([script])
870235d0 2315UL_REQUIRES_HAVE([script], [pty], [openpty function (libutil)])
3f91b990
KZ
2316AM_CONDITIONAL([BUILD_SCRIPT], [test "x$build_script" = xyes])
2317
d4b58873
KZ
2318UL_ENABLE_ALIAS([scriptreplay], [scriptutils])
2319UL_BUILD_INIT([scriptreplay])
3f91b990
KZ
2320AM_CONDITIONAL([BUILD_SCRIPTREPLAY], [test "x$build_scriptreplay" = xyes])
2321
d4b58873
KZ
2322UL_ENABLE_ALIAS([scriptlive], [scriptutils])
2323UL_BUILD_INIT([scriptlive])
870235d0 2324UL_REQUIRES_HAVE([scriptlive], [pty], [openpty function (libutil)])
33869e5a
KZ
2325AM_CONDITIONAL([BUILD_SCRIPTLIVE], [test "x$build_scriptlive" = xyes])
2326
d4b58873 2327
45f943a4
AR
2328AC_ARG_ENABLE([bits],
2329 AS_HELP_STRING([--disable-bits], [do not build bits]),
2330 [], [UL_DEFAULT_ENABLE([bits], [check])])
2331UL_BUILD_INIT([bits])
2332UL_REQUIRES_HAVE([bits], [cpu_set_t], [cpu_set_t type])
6e1301d5
RJ
2333AM_CONDITIONAL([BUILD_BITS], [test "x$build_bits" = xyes])
2334
8886d84e
TW
2335UL_BUILD_INIT([col], [check])
2336UL_REQUIRES_COMPILE([col], [#include <limits.h>], [__GLIBC__], [building for glibc])
cb45354e
KZ
2337AM_CONDITIONAL([BUILD_COL], [test "x$build_col" = xyes])
2338
2339UL_BUILD_INIT([colcrt], [yes])
2340AM_CONDITIONAL([BUILD_COLCRT], [test "x$build_colcrt" = xyes])
2341
2342UL_BUILD_INIT([colrm], [yes])
2343AM_CONDITIONAL([BUILD_COLRM], [test "x$build_colrm" = xyes])
2344
38d69192
KZ
2345UL_BUILD_INIT([column], [check])
2346UL_REQUIRES_BUILD([column], [libsmartcols])
cb45354e
KZ
2347AM_CONDITIONAL([BUILD_COLUMN], [test "x$build_column" = xyes])
2348
37641f24
RM
2349AC_ARG_ENABLE([hexdump],
2350 AS_HELP_STRING([--disable-hexdump], [do not build hexdump]),
2351 [], [UL_DEFAULT_ENABLE([hexdump], [check])]
2352)
2353UL_BUILD_INIT([hexdump])
cb45354e
KZ
2354AM_CONDITIONAL([BUILD_HEXDUMP], [test "x$build_hexdump" = xyes])
2355
2356UL_BUILD_INIT([rev], [yes])
2357AM_CONDITIONAL([BUILD_REV], [test "x$build_rev" = xyes])
2358
3f91b990 2359
1342ffcb
SK
2360AC_ARG_ENABLE([tunelp],
2361 AS_HELP_STRING([--enable-tunelp], [build tunelp]),
08b1c219 2362 [], [UL_DEFAULT_ENABLE([tunelp], [no])]
1342ffcb
SK
2363)
2364UL_BUILD_INIT([tunelp])
2365UL_REQUIRES_LINUX([tunelp])
034d378b 2366AM_CONDITIONAL([BUILD_TUNELP], [test "x$build_tunelp" = xyes])
1342ffcb
SK
2367
2368
48d7b13a 2369AC_ARG_ENABLE([kill],
4be753aa 2370 AS_HELP_STRING([--disable-kill], [do not build kill]),
08b1c219 2371 [], [UL_DEFAULT_ENABLE([kill], [check])]
48d7b13a 2372)
61a074f7 2373UL_BUILD_INIT([kill])
4be753aa 2374UL_REQUIRES_LINUX([kill])
034d378b 2375AM_CONDITIONAL([BUILD_KILL], [test "x$build_kill" = xyes])
48d7b13a 2376
ce602720 2377
48d7b13a 2378AC_ARG_ENABLE([last],
ce602720 2379 AS_HELP_STRING([--disable-last], [do not build last]),
08b1c219 2380 [], [UL_DEFAULT_ENABLE([last], [check])]
48d7b13a 2381)
61a074f7 2382UL_BUILD_INIT([last])
b4b919fe 2383UL_REQUIRES_HAVE([last], [utmpx_h], [utmpx.h header])
73afd3f8 2384UL_REQUIRES_HAVE([last], [gnu_utmpx], [GNU utmpx functions])
034d378b 2385AM_CONDITIONAL([BUILD_LAST], [test "x$build_last" = xyes])
2dc68529 2386
48d7b13a 2387
78d5ceac 2388AC_ARG_ENABLE([utmpdump],
c9b53461 2389 AS_HELP_STRING([--disable-utmpdump], [do not build utmpdump]),
d00c10ed 2390 [], [UL_DEFAULT_ENABLE([utmpdump], [check])]
78d5ceac
KZ
2391)
2392UL_BUILD_INIT([utmpdump])
b4b919fe 2393UL_REQUIRES_HAVE([utmpdump], [utmpx_h], [utmpx.h header])
73afd3f8 2394UL_REQUIRES_HAVE([utmpdump], [gnu_utmpx], [GNU utmpx functions])
034d378b 2395AM_CONDITIONAL([BUILD_UTMPDUMP], [test "x$build_utmpdump" = xyes])
78d5ceac
KZ
2396
2397
c135a8bd
SK
2398AC_ARG_ENABLE([line],
2399 AS_HELP_STRING([--enable-line], [build line]),
08b1c219 2400 [], [UL_DEFAULT_ENABLE([line], [no])]
c135a8bd 2401)
61a074f7 2402UL_BUILD_INIT([line])
034d378b 2403AM_CONDITIONAL([BUILD_LINE], [test "x$build_line" = xyes])
2dc68529 2404
48d7b13a
KZ
2405
2406AC_ARG_ENABLE([mesg],
5c0b406d 2407 AS_HELP_STRING([--disable-mesg], [do not build mesg]),
08b1c219 2408 [], [UL_DEFAULT_ENABLE([mesg], [yes])]
48d7b13a 2409)
61a074f7 2410UL_BUILD_INIT([mesg])
034d378b 2411AM_CONDITIONAL([BUILD_MESG], [test "x$build_mesg" = xyes])
48d7b13a
KZ
2412
2413
48d7b13a 2414AC_ARG_ENABLE([raw],
5c0b406d 2415 AS_HELP_STRING([--disable-raw], [do not build raw]),
08b1c219 2416 [], [UL_DEFAULT_ENABLE([raw], [check])]
48d7b13a 2417)
61a074f7 2418UL_BUILD_INIT([raw])
16ba8d58
KZ
2419UL_REQUIRES_LINUX([raw])
2420UL_REQUIRES_HAVE([raw], [linux_raw_h], [raw.h header file])
034d378b 2421AM_CONDITIONAL([BUILD_RAW], [test "x$build_raw" = xyes])
48d7b13a
KZ
2422
2423
48d7b13a 2424AC_ARG_ENABLE([rename],
7fa4f112 2425 AS_HELP_STRING([--disable-rename], [do not build rename]),
08b1c219 2426 [], [UL_DEFAULT_ENABLE([rename], [yes])]
48d7b13a 2427)
61a074f7 2428UL_BUILD_INIT([rename])
034d378b 2429AM_CONDITIONAL([BUILD_RENAME], [test "x$build_rename" = xyes])
48d7b13a
KZ
2430
2431
cc76731e
KZ
2432AC_ARG_ENABLE([vipw],
2433 AS_HELP_STRING([--enable-vipw], [build vipw]),
08b1c219 2434 [], [UL_DEFAULT_ENABLE([vipw], [no])]
48d7b13a 2435)
cc76731e 2436UL_BUILD_INIT([vipw])
d00c10ed 2437UL_REQUIRES_HAVE([vipw], [shadow_h], [shadow.h header])
034d378b 2438AM_CONDITIONAL([BUILD_VIPW], [test "x$build_vipw" = xyes])
9cb68977 2439
c94b3604 2440
aec9ecbd
KZ
2441AC_ARG_ENABLE([newgrp],
2442 AS_HELP_STRING([--enable-newgrp], [build newgrp]),
08b1c219 2443 [], [UL_DEFAULT_ENABLE([newgrp], [no])]
aec9ecbd
KZ
2444)
2445UL_BUILD_INIT([newgrp])
8229ed2f 2446UL_REQUIRES_HAVE([newgrp], [crypt], [crypt function])
034d378b 2447AM_CONDITIONAL([BUILD_NEWGRP], [test "x$build_newgrp" = xyes])
aec9ecbd
KZ
2448
2449
d86918b6 2450AC_ARG_WITH([user], AS_HELP_STRING([--without-user], [compile without libuser (remote chsh)]),
034d378b 2451 [], [with_user=check]
7e4714f2 2452)
6e93c52f 2453have_user=no
3013eb9d 2454AS_IF([test "x$with_user" != xno], [
2771954b 2455 PKG_CHECK_MODULES(LIBUSER,[libuser >= 0.58], [have_user=yes], [have_user=no])
9f57e6e8
SK
2456 AS_CASE([$with_user:$have_user],
2457 [yes:no],
2458 [AC_MSG_ERROR([user selected but libuser not found])],
2459 [*:yes],
2460 [AC_DEFINE([HAVE_LIBUSER], [1], [Define if libuser is available])]
2461 )
1f6ec24c
KZ
2462 # temporary solution, libuser has stupid .pc where are exported all
2463 # private dependencies to Requires: instead of Requires.private:
3013eb9d 2464 AS_IF([test "x$have_user" = xyes], [
1f6ec24c 2465 LIBUSER_LIBS=-luser
3013eb9d
SK
2466 ])
2467])
034d378b 2468AM_CONDITIONAL([HAVE_USER], [test "x$have_user" = xyes])
7e4714f2 2469
d86918b6
KZ
2470AC_ARG_ENABLE([chfn-chsh-password],
2471 AS_HELP_STRING([--disable-chfn-chsh-password], [do not require the user to enter the password in chfn and chsh]),
034d378b 2472 [], [enable_chfn_chsh_password=yes]
d86918b6
KZ
2473)
2474
2475AC_ARG_ENABLE([chfn-chsh],
f205a073 2476 AS_HELP_STRING([--disable-chfn-chsh], [do not build chfn and chsh]),
9a4e9c9d 2477 [], [UL_DEFAULT_ENABLE([chfn_chsh], [check])]
d86918b6
KZ
2478)
2479UL_BUILD_INIT([chfn_chsh])
d00c10ed 2480UL_REQUIRES_HAVE([chfn_chsh], [shadow_h], [shadow.h header])
49a3d609 2481UL_REQUIRES_HAVE([chfn_chsh], [getusershell], [getusershell function])
d86918b6 2482
948182f4 2483AS_IF([test "x$enable_chfn_chsh_password" = xyes || test "x$have_user" = xyes], [
fe2c9909 2484 UL_REQUIRES_HAVE([chfn_chsh], [security_pam_appl_h], [PAM header file])
034d378b 2485 AC_DEFINE([CHFN_CHSH_PASSWORD], [1], [Should chfn and chsh require the user to enter the password?])
3013eb9d 2486])
034d378b
SK
2487AM_CONDITIONAL([BUILD_CHFN_CHSH], [test "x$build_chfn_chsh" = xyes])
2488AM_CONDITIONAL([CHFN_CHSH_PASSWORD], [test "x$enable_chfn_chsh_password" = xyes])
d86918b6
KZ
2489
2490AC_ARG_ENABLE([chsh-only-listed],
5c0b406d
BS
2491 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
2492 [], enable_chsh_only_listed=yes
d86918b6 2493)
7e4714f2 2494
3013eb9d
SK
2495AS_IF([test "x$enable_chsh_only_listed" = xyes], [
2496 AC_DEFINE([ONLY_LISTED_SHELLS], [1], [Should chsh allow only shells in /etc/shells?])
2497])
71681ee5 2498
2c8a3e16 2499
e7614a07
KZ
2500AC_ARG_ENABLE([login],
2501 AS_HELP_STRING([--disable-login], [do not build login]),
08b1c219 2502 [], [UL_DEFAULT_ENABLE([login], [check])]
e7614a07
KZ
2503)
2504UL_BUILD_INIT([login])
fe2c9909
WJ
2505UL_REQUIRES_HAVE([login], [security_pam_appl_h], [PAM header file])
2506UL_REQUIRES_HAVE([login], [security_pam_misc_h, security_openpam_h], [PAM conversation functions])
b4b919fe 2507UL_REQUIRES_HAVE([login], [utmpx_h], [utmpx.h header])
73afd3f8 2508UL_REQUIRES_HAVE([login], [gnu_utmpx], [GNU utmpx functions])
034d378b 2509AM_CONDITIONAL([BUILD_LOGIN], [test "x$build_login" = xyes])
e7614a07 2510
71681ee5
KZ
2511AC_ARG_ENABLE([login-chown-vcs],
2512 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
034d378b 2513 [], [enable_login_chown_vcs=no]
71681ee5
KZ
2514)
2515
3013eb9d 2516AS_IF([test "x$enable_login_chown_vcs" = xyes], [
034d378b 2517 AC_DEFINE([LOGIN_CHOWN_VCS], [1], [Should login chown /dev/vcsN?])
3013eb9d 2518])
71681ee5
KZ
2519
2520AC_ARG_ENABLE([login-stat-mail],
2521 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
034d378b 2522 [], [enable_login_stat_mail=no]
71681ee5
KZ
2523)
2524
3013eb9d 2525AS_IF([test "x$enable_login_stat_mail" = xyes], [
034d378b 2526 AC_DEFINE([LOGIN_STAT_MAIL], [1], [Should login stat() the mailbox?])
3013eb9d 2527])
71681ee5 2528
e8b6e4ea
SS
2529AC_ARG_ENABLE([login-lastlog],
2530 AS_HELP_STRING([--enable-login-lastlog], [program login writes lastlog entries]),
2531 [], [enable_login_lastlogin=no]
2532)
2533
2534AS_IF([test "x$enable_login_lastlogin" != xno], [
2535 AC_DEFINE([USE_LOGIN_LASTLOG],
2536 [1],
2537 [Define if program login writes lastlog entries])
2538])
e7614a07 2539
88407b93
KZ
2540AC_ARG_ENABLE([nologin],
2541 AS_HELP_STRING([--disable-nologin], [do not build nologin]),
08b1c219 2542 [], [UL_DEFAULT_ENABLE([nologin], [yes])]
88407b93
KZ
2543)
2544UL_BUILD_INIT([nologin])
2545AM_CONDITIONAL([BUILD_NOLOGIN], [test "x$build_nologin" = xyes])
2546
2547
e7614a07
KZ
2548AC_ARG_ENABLE([sulogin],
2549 AS_HELP_STRING([--disable-sulogin], [do not build sulogin]),
d00c10ed 2550 [], [UL_DEFAULT_ENABLE([sulogin], [check])]
e7614a07
KZ
2551)
2552UL_BUILD_INIT([sulogin])
8229ed2f 2553UL_REQUIRES_HAVE([sulogin], [crypt], [crypt function])
d00c10ed 2554UL_REQUIRES_HAVE([sulogin], [shadow_h], [shadow.h header])
034d378b 2555AM_CONDITIONAL([BUILD_SULOGIN], [test "x$build_sulogin" = xyes])
e7614a07 2556
f17f5f48 2557
ff4c5555
KZ
2558AC_ARG_ENABLE([su],
2559 AS_HELP_STRING([--disable-su], [do not build su]),
08b1c219 2560 [], [UL_DEFAULT_ENABLE([su], [check])]
ff4c5555
KZ
2561)
2562UL_BUILD_INIT([su])
fe2c9909 2563UL_REQUIRES_HAVE([su], [security_pam_appl_h], [PAM header file])
b4b919fe 2564UL_REQUIRES_HAVE([su], [utmpx_h], [utmpx.h header])
73afd3f8 2565UL_REQUIRES_HAVE([su], [gnu_utmpx], [GNU utmpx functions])
034d378b 2566AM_CONDITIONAL([BUILD_SU], [test "x$build_su" = xyes])
ff4c5555
KZ
2567
2568
7ec6adb1
KZ
2569AC_ARG_ENABLE([runuser],
2570 AS_HELP_STRING([--disable-runuser], [do not build runuser]),
08b1c219 2571 [], [UL_DEFAULT_ENABLE([runuser], [check])]
7ec6adb1
KZ
2572)
2573UL_BUILD_INIT([runuser])
fe2c9909 2574UL_REQUIRES_HAVE([runuser], [security_pam_appl_h], [PAM header file])
b4b919fe 2575UL_REQUIRES_HAVE([runuser], [utmpx_h], [utmpx.h header])
73afd3f8 2576UL_REQUIRES_HAVE([runuser], [gnu_utmpx], [GNU utmpx functions])
034d378b 2577AM_CONDITIONAL([BUILD_RUNUSER], [test "x$build_runuser" = xyes])
7ec6adb1
KZ
2578
2579
53b22add
KZ
2580AC_ARG_ENABLE([ul],
2581 AS_HELP_STRING([--disable-ul], [do not build ul]),
08b1c219 2582 [], [UL_DEFAULT_ENABLE([ul], [check])]
53b22add
KZ
2583)
2584UL_BUILD_INIT([ul])
3cc8a9f4 2585UL_REQUIRES_HAVE([ul], [ncursesw, ncurses], [ncursesw or ncurses libraries])
034d378b 2586AM_CONDITIONAL([BUILD_UL], [test "x$build_ul" = xyes])
53b22add
KZ
2587
2588
2589AC_ARG_ENABLE([more],
2590 AS_HELP_STRING([--disable-more], [do not build more]),
08b1c219 2591 [], [UL_DEFAULT_ENABLE([more], [check])]
53b22add
KZ
2592)
2593UL_BUILD_INIT([more])
3cc8a9f4 2594UL_REQUIRES_HAVE([more], [ncursesw, ncurses], [ncursesw or ncurses libraries])
83efe346 2595UL_REQUIRES_HAVE([more], [sys_signalfd_h], [sys/signalfd.h header])
034d378b 2596AM_CONDITIONAL([BUILD_MORE], [test "x$build_more" = xyes])
53b22add
KZ
2597
2598
2599AC_ARG_ENABLE([pg],
00971cca
SK
2600 AS_HELP_STRING([--enable-pg], [build pg]),
2601 [], [UL_DEFAULT_ENABLE([pg], [no])]
53b22add
KZ
2602)
2603UL_BUILD_INIT([pg])
4b439e2d 2604UL_REQUIRES_HAVE([pg], [ncursesw, ncurses], [ncursesw or ncurses library])
034d378b 2605AM_CONDITIONAL([BUILD_PG], [test "x$build_pg" = xyes])
53b22add
KZ
2606
2607
d78d0409
KZ
2608AC_ARG_ENABLE([setterm],
2609 AS_HELP_STRING([--disable-setterm], [do not build setterm]),
08b1c219 2610 [], [UL_DEFAULT_ENABLE([setterm], [check])]
d78d0409
KZ
2611)
2612UL_BUILD_INIT([setterm])
2613UL_REQUIRES_LINUX([setterm])
4b439e2d 2614UL_REQUIRES_HAVE([setterm], [ncursesw, ncurses], [ncursesw or ncurses library])
034d378b 2615AM_CONDITIONAL([BUILD_SETTERM], [test "x$build_setterm" = xyes])
d78d0409 2616
d6ace0b8 2617# build_schedutils= is just configure-only variable to control
b46a82a0 2618# ionice, taskset, coresched and chrt
48d7b13a 2619AC_ARG_ENABLE([schedutils],
b46a82a0 2620 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, taskset, coresched]),
fc72f51e 2621 [], [UL_DEFAULT_ENABLE([schedutils], [check])]
48d7b13a 2622)
17d5e11b 2623
6f2eb034
KZ
2624
2625UL_ENABLE_ALIAS([ionice], [schedutils])
2626UL_BUILD_INIT([ionice])
17d5e11b
KZ
2627UL_REQUIRES_SYSCALL_CHECK([ionice],
2628 [UL_CHECK_SYSCALL([ioprio_set],
f06b4328
SK
2629 [alpha], [442],
2630 [i*86], [289],
2631 [ia64*], [1274],
2632 [powerpc*], [273],
2633 [s390*], [282],
2634 [sparc*], [196],
2635 [sh*], [288],
2636 [x86_64*], [251])],
17d5e11b
KZ
2637 [ioprio_set])
2638
2639UL_REQUIRES_SYSCALL_CHECK([ionice],
2640 [UL_CHECK_SYSCALL([ioprio_get],
f06b4328
SK
2641 [alpha], [443],
2642 [i*86], [290],
2643 [ia64*], [1275],
2644 [powerpc*], [274],
2645 [s390*], [283],
2646 [sparc*], [218],
2647 [sh*], [289],
2648 [x86_64*], [252])],
17d5e11b
KZ
2649 [ioprio_get])
2650
034d378b 2651AM_CONDITIONAL([BUILD_IONICE], [test "x$build_ionice" = xyes])
17d5e11b 2652
6f2eb034
KZ
2653
2654UL_ENABLE_ALIAS([taskset], [schedutils])
2655UL_BUILD_INIT([taskset])
e21e6d26 2656UL_REQUIRES_HAVE([taskset], [cpu_set_t], [cpu_set_t type])
17d5e11b
KZ
2657UL_REQUIRES_SYSCALL_CHECK([taskset],
2658 [UL_CHECK_SYSCALL([sched_getaffinity])],
2659 [sched_getaffinity])
034d378b 2660AM_CONDITIONAL([BUILD_TASKSET], [test "x$build_taskset" = xyes])
48d7b13a 2661
ee20c303 2662
b46a82a0
TR
2663UL_ENABLE_ALIAS([coresched], [schedutils])
2664UL_BUILD_INIT([coresched])
2665UL_REQUIRES_SYSCALL_CHECK([coresched],
2666 [UL_CHECK_SYSCALL([prctl])],
2667 [prctl])
2668AM_CONDITIONAL([BUILD_CORESCHED], [test "x$build_coresched" = xyes])
2669
2670
ee20c303
RM
2671have_schedsetter=no
2672AS_IF([test "x$ac_cv_func_sched_setscheduler" = xyes], [have_schedsetter=yes],
2673 [test "x$ac_cv_func_sched_setattr" = xyes], [have_schedsetter=yes])
2674
6f2eb034
KZ
2675UL_ENABLE_ALIAS([chrt], [schedutils])
2676UL_BUILD_INIT([chrt])
ee20c303 2677UL_REQUIRES_HAVE([chrt], [schedsetter], [sched_set functions])
d6ace0b8
KZ
2678AM_CONDITIONAL([BUILD_CHRT], [test "x$build_chrt" = xyes])
2679
15167589
KZ
2680AS_IF([test "x$build_chrt" = xyes], [
2681 UL_CHECK_SYSCALL([sched_setattr])
2682])
2683
f59654bb
QY
2684UL_ENABLE_ALIAS([uclampset], [schedutils])
2685UL_BUILD_INIT([uclampset])
82643a9b
KZ
2686UL_REQUIRES_SYSCALL_CHECK([uclampset],
2687 [UL_CHECK_SYSCALL([sched_setattr])], [sched_setattr])
f59654bb
QY
2688AM_CONDITIONAL([BUILD_UCLAMPSET], [test "x$build_uclampset" = xyes])
2689
48d7b13a
KZ
2690
2691AC_ARG_ENABLE([wall],
7fa4f112 2692 AS_HELP_STRING([--disable-wall], [do not build wall]),
d00c10ed 2693 [], [UL_DEFAULT_ENABLE([wall], [check])]
48d7b13a 2694)
8fc8888b 2695UL_BUILD_INIT([wall])
b4b919fe 2696UL_REQUIRES_HAVE([wall], [utmpx_h], [utmpx.h header])
034d378b 2697AM_CONDITIONAL([BUILD_WALL], [test "x$build_wall" = xyes])
48d7b13a
KZ
2698
2699
2700AC_ARG_ENABLE([write],
7fa4f112 2701 AS_HELP_STRING([--enable-write], [build write]),
08b1c219 2702 [], [UL_DEFAULT_ENABLE([write], [no])]
48d7b13a 2703)
61a074f7 2704UL_BUILD_INIT([write])
b4b919fe 2705UL_REQUIRES_HAVE([write], [utmpx_h], [utmpx.h header])
73afd3f8 2706UL_REQUIRES_HAVE([write], [gnu_utmpx], [GNU utmpx functions])
034d378b 2707AM_CONDITIONAL([BUILD_WRITE], [test "x$build_write" = xyes])
48d7b13a
KZ
2708
2709
5a971329 2710AC_ARG_WITH([btrfs],
95a89bd3 2711 AS_HELP_STRING([--without-btrfs], [do not build with btrfs support]),
5a971329
KZ
2712 [], [with_btrfs=check]
2713)
2714have_btrfs=no
2715AS_IF([test "x$with_btrfs" != xno], [
2716 AS_CASE([$with_btrfs:$have_linux_btrfs_h],
2717 [yes:no],
2718 [AC_MSG_ERROR([btrfs selected but linux/btrfs.h not found])],
2719 [check:no],
2720 [AC_MSG_WARN([linux/btrfs.h not found, do not build with btrfs support])],
2721 [*:yes],
2722 [have_btrfs=yes
2723 AC_DEFINE([HAVE_BTRFS_SUPPORT], [1], [Define if btrfs stuff is available])]
2724 )
2725])
2726AM_CONDITIONAL([HAVE_BTRFS], [test "x$have_btrfs" = xyes])
2727
2728
ebff016a 2729AC_ARG_WITH([systemd],
95a89bd3 2730 AS_HELP_STRING([--without-systemd], [do not build with systemd support]),
ebff016a
KZ
2731 [], [with_systemd=check]
2732)
2733
2734have_systemd=no
2735AS_IF([test "x$with_systemd" != xno], [
2736 # new version -- all libsystemd-* libs merged into libsystemd
2737 PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], [have_systemd=no])
2738 # old versions
2739 AS_IF([test "x$have_systemd" != "xyes"], [
2740 PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
2741 [have_systemd_daemon=yes], [have_systemd_daemon=no])
2742 PKG_CHECK_MODULES([SYSTEMD_JOURNAL], [libsystemd-journal],
2743 [have_systemd_journal=yes], [have_systemd_journal=no])
948182f4 2744 AS_IF([test "x$have_systemd_daemon" = "xyes" && test "x$have_systemd_journal" = "xyes" ],[
ebff016a 2745 have_systemd=yes])
ea45d34c 2746 ])
ebff016a
KZ
2747 AS_CASE([$with_systemd:$have_systemd],
2748 [yes:no],
2749 [AC_MSG_ERROR([systemd expected but libsystemd not found])],
2750 [*:yes],
2751 AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Define if libsystemd is available])
b66b5b97 2752 AC_DEFINE([USE_SYSTEMD], [1], [Define if systemd support is wanted ])
87fcd95a 2753 AC_CHECK_DECLS([sd_session_get_username], [], [], [#include <systemd/sd-login.h>])
488aac1b
YW
2754 AC_CHECK_DECLS([sd_device_new_from_syspath], [], [], [#include <systemd/sd-device.h>])
2755 AC_CHECK_DECLS([sd_device_open], [], [], [#include <systemd/sd-device.h>])
ebff016a 2756 )
3013eb9d 2757])
ebff016a
KZ
2758AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$have_systemd" = xyes])
2759
bbe289c4 2760
1b68c379 2761AC_ARG_WITH([systemdsystemunitdir],
95a89bd3 2762 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [directory for systemd unit files (requires systemd support)]),
f6d3f34a 2763 [], [
7a95313c 2764 AS_IF([test "x$have_systemd" = xyes], [
f6d3f34a
KZ
2765 PKG_CHECK_VAR([with_systemdsystemunitdir], [systemd], [systemdsystemunitdir],
2766 [],
2767 [with_systemdsystemunitdir=no])
7a95313c
KZ
2768 ])
2769])
3013eb9d 2770AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
1b68c379 2771 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
3013eb9d 2772])
1b68c379 2773
c2e299d0
SS
2774AC_ARG_WITH([tmpfilesdir],
2775 AS_HELP_STRING([--with-tmpfilesdir=DIR], [directory for tmpfiles. See tmpfiles.d(5) for details]),
2776 [], [
2777 AS_IF([test "x$have_systemd" = xyes], [
2778 PKG_CHECK_VAR([with_tmpfilesdir], [systemd], [tmpfilesdir],
2779 [],
2780 [with_tmpfilesdir=no])
2781 ])
2782])
2783AS_IF([test "x$with_tmpfilesdir" != "xno"], [
2784 AC_SUBST([tmpfilesdir], [$with_tmpfilesdir])
2785])
bbe289c4 2786
20fd4690
KZ
2787
2788AC_ARG_WITH([sysusersdir],
2789 AS_HELP_STRING([--with-sysusersdir=DIR], [directory for sysusers. See sysusers.d(5) for details]),
2790 [], [
2791 AS_IF([test "x$have_systemd" = xyes], [
2792 PKG_CHECK_VAR([with_sysusersdir], [systemd], [sysusersdir],
2793 [],
2794 [with_sysusersdir=no])
2795 ])
2796])
2797AS_IF([test "x$with_sysusersdir" != "xno"], [
2798 AC_SUBST([sysusersdir], [$with_sysusersdir])
2799])
2800
b8095d25
KZ
2801AC_ARG_WITH([smack],
2802 AS_HELP_STRING([--with-smack], [build with SMACK support]),
2803 [], [with_smack=no]
2804)
2805AS_IF([test "x$with_smack" = xyes], [
2806 AC_DEFINE([HAVE_SMACK], [1], [Add SMACK support])
2807])
2808
9e584ff3
TK
2809AC_ARG_WITH([econf],
2810 AS_HELP_STRING([--without-econf], [do not use libeconf]),
2811 [], [with_econf=check]
2812)
2813
2814have_econf=no
2815AS_IF([test "x$with_econf" != xno], [
830d73c3
KZ
2816 PKG_CHECK_MODULES([ECONF], [libeconf],
2817 [have_econf=yes
2818 AC_CHECK_LIB([econf], [econf_readConfig], [
2819 AC_DEFINE([HAVE_ECONF_READCONFIG], [1], [Define if econf_readConfig exist in -leconf])
2820 ])
2821 ],
2822 [have_econf=no]
2823 )
2824 AS_CASE([$with_econf:$have_econf],
9e584ff3
TK
2825 [yes:no],
2826 [AC_MSG_ERROR([libeconf expected but libeconf not found])],
2827 [*:yes],
2828 AC_DEFINE([HAVE_LIBECONF], [1], [Define if libeconf is available])
2829 )
2830])
2831AM_CONDITIONAL([HAVE_ECONF], [test "x$have_econf" = xyes])
2832
fee99106 2833AC_ARG_WITH([vendordir],
cb776288 2834 AS_HELP_STRING([--with-vendordir=DIR], [Directory for distribution provided configuration files]),
fee99106 2835 [], []
9e584ff3 2836)
fee99106
KZ
2837AC_SUBST([vendordir], [$with_vendordir])
2838AM_CONDITIONAL([USE_VENDORDIR], [test "x$with_vendordir" != x])
2839AS_IF([test "x$with_vendordir" != x], [
2840 AC_DEFINE([USE_VENDORDIR], [1], [Define to 1 to use vendordir])
2841])
9e584ff3 2842
b8095d25 2843
ece777e9
KZ
2844AC_ARG_ENABLE([bash-completion],
2845 AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]),
034d378b 2846 [], [enable_bash_completion=yes]
ece777e9
KZ
2847)
2848
034d378b 2849AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes])
ece777e9 2850
f6d3f34a
KZ
2851AC_ARG_WITH([bashcompletiondir],
2852 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
2853 [], [
2854 AS_IF([test "x$enable_bash_completion" = xyes], [
2855 PKG_CHECK_VAR([with_bashcompletiondir], [bash-completion], [completionsdir],
2856 [],
2857 [with_bashcompletiondir=${datadir}/bash-completion/completions])
2858 ])
2859])
140e4c7b
KZ
2860AS_IF([test "x$enable_bash_completion" = xyes], [
2861 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
2862])
f6d3f34a 2863
9cc36e9f 2864
d78df0ac 2865AC_ARG_WITH([python],
4c54effb
KZ
2866 AS_HELP_STRING([--without-python], [do not build python bindings, use --with-python={2,3} to force version]),
2867 [], [with_python=check withval=check]
d78df0ac 2868)
8e5c4675 2869
d78df0ac 2870have_python=no
b2ae8c57 2871have_libpython=no
8e5c4675
KZ
2872AS_IF([test "x$with_python" != xno], [
2873 # We follow distributions default and look for PKG module name "python"
2874 # (minimal version is 2) but if major version is explicitly specified by
2875 # --with-python=2 or --with-python=3 then we look for PKG module "python2" or
2876 # "python3".
948182f4 2877 AS_IF([test "x$withval" != xno && test "x$withval" != xyes && test "x$withval" != xcheck],
0b567ae5 2878 [pymajor="$withval"; PYTHON=python${pymajor}], [pymajor="2"])
b2ae8c57
KZ
2879
2880 # check for python interpreter
0b567ae5 2881 AM_PATH_PYTHON([$pymajor], [have_python=yes], [have_python=no])
8e5c4675
KZ
2882 AS_CASE([$with_python:$have_python],
2883 [yes:no],
b2ae8c57 2884 [AC_MSG_ERROR([python selected but python interpreter not found])],
4c54effb 2885 [check:no],
b2ae8c57 2886 [AC_MSG_WARN([python interpreter not found, do not build python bindings])],
4c54effb 2887 [*:yes],
b2ae8c57 2888 # check for python development stuff
c6cdefd7
TW
2889 [
2890 PKG_CHECK_MODULES([PYTHON], [python-$PYTHON_VERSION], [have_libpython=yes], [have_libpython=no])
2891
2892 # https://github.com/util-linux/util-linux/issues/2366
2893 AX_COMPARE_VERSION([$PYTHON_VERSION], [ge], [3.12], [
2894 UL_WARN_ADD([-Wno-error=redundant-decls], [PYTHON_CFLAGS])
2895 ])
2896 ]
8e5c4675 2897 )
d78df0ac
KZ
2898])
2899
da0ec90b
KZ
2900
2901AC_ARG_ENABLE([pylibmount],
2902 AS_HELP_STRING([--disable-pylibmount], [do not build pylibmount]),
2903 [], [UL_DEFAULT_ENABLE([pylibmount], [check])]
2904)
2905UL_BUILD_INIT([pylibmount])
b2ae8c57 2906UL_REQUIRES_HAVE([pylibmount], [libpython], [libpython])
da0ec90b 2907UL_REQUIRES_BUILD([pylibmount], [libmount])
d78df0ac
KZ
2908AM_CONDITIONAL([BUILD_PYLIBMOUNT], [test "x$build_pylibmount" = "xyes"])
2909
324330ac
FB
2910# We need to introduce a verbatim dependency into the Makefile, without automake
2911# trying to interpret it, so push it as a AM_SUBST_NOTMAKE variable.
20dc72d8 2912verbatim_extra_dependency='
324330ac
FB
2913
2914# pylibmountexec module must be installed after usrlib_exec libraries,
2915# otherwise the libtool relink step will fail to find libmount.la and
2916# will try -lmount which is possibly not available.
2917install-pylibmountexecLTLIBRARIES: install-usrlib_execLTLIBRARIES
9c787eaa 2918install-securelib_execLTLIBRARIES: install-usrlib_execLTLIBRARIES
324330ac
FB
2919
2920'
20dc72d8
TW
2921AC_SUBST([verbatim_extra_dependency])
2922AM_SUBST_NOTMAKE([verbatim_extra_dependency])
d78df0ac 2923
48d7b13a 2924AC_ARG_ENABLE([pg-bell],
7fa4f112 2925 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
034d378b 2926 [], [enable_pg_bell=yes]
48d7b13a
KZ
2927)
2928
3013eb9d 2929AS_IF([test "x$enable_pg_bell" = xyes], [
034d378b 2930 AC_DEFINE([PG_BELL], [1], [Should pg ring the bell on invalid keys?])
3013eb9d 2931])
48d7b13a
KZ
2932
2933
bb4cb69d
MF
2934AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
2935AC_ARG_ENABLE([fs-paths-default],
2936 AS_HELP_STRING([--enable-fs-paths-default=paths], [default search path for fs helpers @<:@FS_PATHS_DEFAULT@:>@]),
9f57e6e8
SK
2937 [AS_CASE([$enableval],
2938 [yes], [fs_paths_defaults="FS_PATHS_DEFAULT"],
2939 [no], [fs_paths_defaults=""],
2940 [fs_paths_defaults="$enableval"]
2941 )],
bb4cb69d
MF
2942 [fs_paths_defaults="FS_PATHS_DEFAULT"]
2943)
2944AC_ARG_ENABLE([fs-paths-extra],
2945 AS_HELP_STRING([--enable-fs-paths-extra=paths], [additional search paths for fs helpers]),
9f57e6e8
SK
2946 [AS_CASE([$enableval],
2947 [yes|no], [fs_paths_extra=""],
2948 [fs_paths_extra="$enableval"]
2949 )],
bb4cb69d
MF
2950 [fs_paths_extra=""]
2951)
2952fs_paths="$fs_paths_defaults"
3013eb9d
SK
2953AS_IF([test "x$fs_paths_extra" != "x"], [
2954 AS_IF([test "x$fs_paths" != "x"], [
bb4cb69d 2955 fs_paths="${fs_paths}:"
3013eb9d 2956 ])
bb4cb69d 2957 fs_paths="${fs_paths}${fs_paths_extra}"
3013eb9d 2958])
bb4cb69d
MF
2959AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
2960
2961
48d7b13a 2962AC_ARG_ENABLE([use-tty-group],
7fa4f112 2963 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
034d378b 2964 [], [enable_use_tty_group=yes]
48d7b13a 2965)
034d378b 2966AM_CONDITIONAL([USE_TTY_GROUP], [test "x$enable_use_tty_group" = xyes])
48d7b13a 2967
3013eb9d 2968AS_IF([test "x$enable_use_tty_group" = xyes], [
034d378b 2969 AC_DEFINE([USE_TTY_GROUP], [1], [Should wall and write be installed setgid tty?])
3013eb9d 2970])
48d7b13a 2971
ab6478ef
WF
2972
2973AC_ARG_ENABLE([sulogin-emergency-mount],
479d50bd
DR
2974 AS_HELP_STRING([--enable-sulogin-emergency-mount],
2975 [use emergency mount of /dev and /proc for sulogin]),
034d378b 2976 [], [enable_sulogin_emergency_mount=no]
ab6478ef
WF
2977)
2978
3013eb9d 2979AS_IF([test "x$enable_sulogin_emergency_mount" = xyes], [
89c7c6ea
KZ
2980 AS_IF([test "x$linux_os" = xyes], [ ],
2981 [AC_MSG_ERROR([--enable-sulogin-emergency-mount selected for non-linux system])])
034d378b 2982 AC_DEFINE([USE_SULOGIN_EMERGENCY_MOUNT], [1],
3c560686 2983 [Should sulogin use an emergency mount of /dev and /proc?])
3013eb9d 2984])
ab6478ef
WF
2985
2986
f71d1104
KZ
2987AC_ARG_ENABLE([usrdir-path],
2988 AS_HELP_STRING([--enable-usrdir-path], [use only /usr paths in PATH env. variable (recommended on systems with /bin -> /usr/bin symlinks)]),
2989 [], [enable_usrdir_path=no]
2990)
2991
2afbcec5 2992AS_IF([test "x$enable_usrdir_path" = xyes], [
f71d1104
KZ
2993 AC_DEFINE([USE_USRDIR_PATHS_ONLY], [1], [Define to 1 to remove /bin and /sbin from PATH env.variable])
2994])
2995
2996
f3831bbd
KZ
2997AC_ARG_ENABLE([makeinstall-chown],
2998 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
034d378b 2999 [], [enable_makeinstall_chown=yes]
f3831bbd 3000)
034d378b 3001AM_CONDITIONAL([MAKEINSTALL_DO_CHOWN], [test "x$enable_makeinstall_chown" = xyes])
f3831bbd 3002
81f55ab9 3003
4c24a7ae
KZ
3004AC_ARG_ENABLE([makeinstall-setuid],
3005 AS_HELP_STRING([--disable-makeinstall-setuid], [do not do setuid chmod operations during "make install"]),
034d378b 3006 [], [enable_makeinstall_setuid=yes]
4c24a7ae 3007)
034d378b 3008AM_CONDITIONAL([MAKEINSTALL_DO_SETUID], [test "x$enable_makeinstall_setuid" = xyes])
4c24a7ae 3009
06bcee19 3010
5a391c15
KZ
3011AC_ARG_ENABLE([makeinstall-tty-setgid],
3012 AS_HELP_STRING([--disable-makeinstall-tty-setgid], [do not setgid for wall, and write during "make install"]),
3013 [], [enable_makeinstall_tty_setgid=yes]
3014)
3015AM_CONDITIONAL([MAKEINSTALL_DO_TTY_SETGID], [test "x$enable_makeinstall_tty_setgid" = xyes])
3016
3017
3018
81f55ab9
KZ
3019AC_ARG_ENABLE([colors-default],
3020 AS_HELP_STRING([--disable-colors-default], [do not colorize output from utils by default]),
3021 [], [enable_colors_default=yes]
3022)
3023AS_IF([test "x$enable_colors_default" = xyes], [
3024 AC_DEFINE([USE_COLORS_BY_DEFAULT], [1], [Enables colorized output from utils by default])
3025])
3026
3027
e6a49887
LB
3028AC_ARG_WITH([cryptsetup],
3029 AS_HELP_STRING([--with-cryptsetup], [compile with cryptsetup support]),
3030 [], [with_cryptsetup=no]
3031)
3032
3033AS_IF([test "x$with_cryptsetup" = xno], [
3034 AM_CONDITIONAL([HAVE_CRYPTSETUP], [false])
488fd4c3 3035 AM_CONDITIONAL([CRYPTSETUP_VIA_DLOPEN], [false])
e6a49887
LB
3036], [
3037 PKG_CHECK_MODULES([CRYPTSETUP], [libcryptsetup],
3038 [AC_DEFINE([HAVE_CRYPTSETUP], [1], [Define if cryptsetup is available])
3039 UL_PKG_STATIC([CRYPTSETUP_LIBS_STATIC], [libcryptsetup])
3040 AM_CONDITIONAL([HAVE_CRYPTSETUP], [true])
123b1a67
LB
3041 SAVE_CFLAGS="$CFLAGS"
3042 CFLAGS="$CRYPTSETUP_CFLAGS $CFLAGS"
3043 SAVE_LIBS="$LIBS"
3044 LIBS="$CRYPTSETUP_LIBS $LIBS"
3045 AC_CHECK_LIB([cryptsetup], [crypt_activate_by_signed_key], [
f2458cf9 3046 AC_DEFINE([HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY], [1], [Define if crypt_activate_by_signed_key exist in -lcryptsetup])
123b1a67 3047 ])
488fd4c3
LB
3048 AS_IF([test "x$with_cryptsetup" = xdlopen], [
3049 LIBS="-ldl $LIBS"
3050 AC_CHECK_LIB([dl], [dlsym], [
3051 AC_DEFINE([CRYPTSETUP_VIA_DLOPEN], [1], [Define if cryptsetup is to be loaded via dlopen])
3052 AM_CONDITIONAL([CRYPTSETUP_VIA_DLOPEN], [true])
3053 ], [AC_MSG_ERROR([libdl required to build with cryptsetup support])])
3054 ], [
3055 AM_CONDITIONAL([CRYPTSETUP_VIA_DLOPEN], [false])
3056 ])
123b1a67
LB
3057 CFLAGS="$SAVE_CFLAGS"
3058 LIBS="$SAVE_LIBS"
e6a49887
LB
3059 have_cryptsetup=yes],
3060 [have_cryptsetup=no
488fd4c3
LB
3061 AM_CONDITIONAL([HAVE_CRYPTSETUP], [false])
3062 AM_CONDITIONAL([CRYPTSETUP_VIA_DLOPEN], [false])
3063 ])
e6a49887
LB
3064
3065 AS_CASE([$with_cryptsetup:$have_cryptsetup],
3066 [yes:no], [AC_MSG_WARN([cryptsetup selected but libcryptsetup not found])]
3067 )
3068])
3069AC_SUBST([CRYPTSETUP_LIBS])
3070AC_SUBST([CRYPTSETUP_LIBS_STATIC])
3071
3072
1f10890f
SK
3073AC_ARG_VAR([SUID_CFLAGS],
3074 [CFLAGS used for binaries which are usually with the suid bit])
3075AC_ARG_VAR([SUID_LDFLAGS],
3076 [LDFLAGS used for binaries which are usually with the suid bit])
06bcee19 3077
03d00d49
KZ
3078AC_ARG_VAR([DAEMON_CFLAGS],
3079 [CFLAGS used for binaries which are usually executed as daemons])
3080AC_ARG_VAR([DAEMON_LDFLAGS],
3081 [LDFLAGS used for binaries which are usually executed as daemons])
3082
3083AC_ARG_VAR([SOLIB_CFLAGS],
3084 [CFLAGS used for shared libraries])
3085AC_ARG_VAR([SOLIB_LDFLAGS],
3086 [LDFLAGS used for shared libraries])
3087
2ad21963
KZ
3088AC_ARG_VAR([ADJTIME_PATH],
3089 [Path to hwclock adjtime file, default /etc/adjtime])
3090AS_IF([test "x$ADJTIME_PATH" = x], [ADJTIME_PATH="/etc/adjtime"])
3091AC_DEFINE_UNQUOTED([CONFIG_ADJTIME_PATH], "$ADJTIME_PATH", [Path to hwclock adjtime file])
3092
0cc63f0b
TW
3093if test "x${build_alias}" != "x${host_alias}"; then
3094 AC_MSG_NOTICE([setting link_all_deplibs=unknown for libtool])
3095 # work around Debian patch to libtool breaking cross-compiles
3096 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702737
3097 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=297726
3098 link_all_deplibs=unknown
3099fi
3100
2ad21963 3101
9cb68977 3102LIBS=""
48d7b13a 3103
48d7b13a 3104
034d378b 3105AC_CONFIG_HEADERS([config.h])
48d7b13a 3106
d4baf92e
KZ
3107#
3108# Don't use configure.ac to replace install paths! See Makefile PATHFILES for
3109# more details.
3110#
8eeb575c 3111AC_CONFIG_FILES([
f06b4328 3112Makefile
31a938ac 3113libblkid/docs/Makefile
8fb4efae 3114libblkid/docs/version.xml
8fb4efae 3115libblkid/src/blkid.h
705854f3
KZ
3116libfdisk/docs/Makefile
3117libfdisk/docs/version.xml
3118libfdisk/src/libfdisk.h
31a938ac 3119libmount/docs/Makefile
2aefc0a8 3120libmount/docs/version.xml
f06b4328 3121libmount/src/libmount.h
1d90bcb1
OO
3122libsmartcols/docs/Makefile
3123libsmartcols/docs/version.xml
1a4d989e 3124libsmartcols/src/libsmartcols.h
f06b4328 3125po/Makefile.in
8eeb575c 3126])
48d7b13a
KZ
3127
3128AC_OUTPUT
4e1073c2
KZ
3129
3130AC_MSG_RESULT([
a73035dc 3131 ${PACKAGE} ${VERSION}
4e1073c2 3132
a73035dc
KZ
3133 prefix: ${prefix}
3134 exec prefix: ${exec_prefix}
4e1073c2 3135
a73035dc
KZ
3136 bindir: ${bindir}
3137 sbindir: ${sbindir}
3138 libdir: ${libdir}
3139 usrbin_execdir: ${usrbin_execdir}
3140 usrsbin_execdir: ${usrsbin_execdir}
3141 usrlib_execdir: ${usrlib_execdir}
3d289965 3142
a73035dc
KZ
3143 localstatedir: ${localstatedir}
3144 runstatedir: ${runstatedir}
3145 includedir: ${includedir}
3146 sysconfdir: ${sysconfdir}
3147 sysconfstaticdir: ${sysconfstaticdir}
3d289965 3148
a73035dc 3149 vendordir: ${with_vendordir}
4e1073c2 3150
a73035dc
KZ
3151 Python: ${PYTHON}
3152 Python version: ${PYTHON_VERSION}
3153 Python libs: ${pyexecdir}
8e5c4675 3154
a73035dc
KZ
3155 Bash completions: ${with_bashcompletiondir}
3156 Systemd support: ${have_systemd}
3157 Systemd unitdir: ${with_systemdsystemunitdir}
c2e299d0 3158 tmpfilesdir: ${with_tmpfilesdir}
a73035dc
KZ
3159 libeconf support: ${have_econf}
3160 Btrfs support: ${have_btrfs}
dd3bbc9c 3161 lastlog2 support: ${build_liblastlog2}
a73035dc 3162 Wide-char support: ${build_widechar}
034ca748 3163 libcryptsetup support: ${have_cryptsetup}
3745d4a9 3164
a73035dc
KZ
3165 Manual pages: ${build_asciidoc}
3166 Manual pages translated: ${build_poman}
4e1073c2 3167
8519f4dd 3168 compiler: ${CC} / ${CXX}
a73035dc
KZ
3169 suid cflags: ${SUID_CFLAGS}
3170 ldflags: ${LDFLAGS}
3171 suid ldflags: ${SUID_LDFLAGS}
3172 ASAN enabled: ${enable_asan}
b4b8f8c2
FS
3173 Fuzzing enabled: ${enable_fuzzing_engine}
3174 Coverage enabled ${enable_coverage}
22a900a9 3175
a73035dc
KZ
3176 cflags: ${CFLAGS}
3177
3178 warnings:
4e1073c2
KZ
3179
3180${WARN_CFLAGS}
b4b84389 3181
a73035dc 3182 Type 'make' or 'make <utilname>' to compile.
4e1073c2 3183])