]> git.ipfire.org Git - thirdparty/util-linux.git/blame - configure.ac
libsmartcols: add basic files
[thirdparty/util-linux.git] / configure.ac
CommitLineData
034d378b 1AC_INIT([util-linux],
38c75b59 2 m4_esyscmd([tools/git-version-gen .tarball-version]),
5564a8c7
SK
3 [kzak@redhat.com],,
4 [http://www.kernel.org/pub/linux/utils/util-linux/])
baf39af1 5
034d378b 6AC_PREREQ([2.60])
48d7b13a 7
034d378b 8AC_CONFIG_AUX_DIR([config])
b12991dd 9AC_CONFIG_MACRO_DIR([m4])
eaf70198
SK
10dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
11dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
12AC_USE_SYSTEM_EXTENSIONS
333034f6 13AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax dist-bzip2 no-dist-gzip dist-xz -Wno-portability subdir-objects])
48d7b13a 14
eb35c251 15m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
f06b4328 16 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
eb35c251 17
034d378b 18AC_CONFIG_SRCDIR([sys-utils/mount.c])
15a9b48c
SK
19AC_PREFIX_DEFAULT([/usr])
20
33b0be6d
KZ
21dnl version details from <major>.<minor>[-<suffix>]
22PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}')
23PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{print $2}' \
f06b4328 24 | awk -F- '{print $1}')
33b0be6d 25PACKAGE_VERSION_RELEASE=0
a0948ffe 26
33b0be6d
KZ
27dnl libblkid version
28LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
bad3c52f 29LIBBLKID_DATE="21-Oct-2013"
dc2b8d87
KZ
30LIBBLKID_LT_MAJOR=1
31LIBBLKID_LT_MINOR=1
32LIBBLKID_LT_MICRO=0
33LIBBLKID_VERSION_INFO=`expr $LIBBLKID_LT_MAJOR + $LIBBLKID_LT_MINOR`:$LIBBLKID_LT_MICRO:$LIBBLKID_LT_MINOR
a0948ffe 34
f6076f55
KZ
35dnl libuuid version
36LIBUUID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
dc2b8d87
KZ
37LIBUUID_LT_MAJOR=1
38LIBUUID_LT_MINOR=3
39LIBUUID_LT_MICRO=0
40LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR
f6076f55 41
f1cde479
KZ
42dnl libmount version
43LIBMOUNT_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
44LIBMOUNT_LT_MAJOR=1
45LIBMOUNT_LT_MINOR=1
46LIBMOUNT_LT_MICRO=0
47LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR
48
1a4d989e
OO
49dnl libsmartcols version
50LIBSMARTCOLS_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
51LIBSMARTCOLS_LT_MAJOR=1
52LIBSMARTCOLS_LT_MINOR=1
53LIBSMARTCOLS_LT_MICRO=0
54LIBSMARTCOLS_VERSION_INFO=`expr $LIBSMARTCOLS_LT_MAJOR + $LIBSMARTCOLS_LT_MINOR`:$LIBSMARTCOLS_LT_MICRO:$LIBSMARTCOLS_LT_MINOR
55
15a9b48c 56# Check whether exec_prefix=/usr:
9f57e6e8
SK
57AS_CASE([$exec_prefix:$prefix],
58[NONE:NONE | NONE:/usr | /usr:*],
59 [AC_MSG_NOTICE([Default --exec-prefix detected.])
17794746
KZ
60 AS_CASE([$bindir], ['${exec_prefix}/bin'], [bindir=/bin; AC_MSG_NOTICE([ --bindir defaults to /bin]) ])
61 AS_CASE([$sbindir], ['${exec_prefix}/sbin'], [sbindir=/sbin; AC_MSG_NOTICE([ --sbindir defaults to /sbin])])
62 AS_CASE([$libdir], ['${exec_prefix}/lib'], [libdir=/lib; AC_MSG_NOTICE([ --libdir defaults to /lib]) ])
9f57e6e8
SK
63 ]
64)
65
66AS_CASE([$prefix:$localstatedir],
3745d4a9 67 [NONE:'${prefix}/var' | /usr:'${prefix}/var'],
9f57e6e8
SK
68 [localstatedir=/run
69 AC_MSG_NOTICE([ --localstatedir defaults to /run])
70 ]
71)
11935cd3 72AC_SUBST([localstatedir])
07a16b9d 73
b0a0d7d5 74
996fb358 75# The original default values of {bin,sbin,lib}dir
aaf3e8f5 76usrbin_execdir='${exec_prefix}/bin'
30688dde 77AC_SUBST([usrbin_execdir])
996fb358 78
aaf3e8f5 79usrsbin_execdir='${exec_prefix}/sbin'
30688dde 80AC_SUBST([usrsbin_execdir])
996fb358 81
9f57e6e8 82AS_CASE([$libdir],
3745d4a9 83 ['${exec_prefix}/'* | '${prefix}/'* | /usr/*],
9f57e6e8
SK
84 [usrlib_execdir=$libdir],
85 [usrlib_execdir='${exec_prefix}'$libdir]
86)
30688dde 87AC_SUBST([usrlib_execdir])
996fb358 88
bdf5f542 89
31c9c1c4 90AM_PROG_CC_C_O
48d7b13a 91AC_PROG_CC_STDC
a6996860 92AC_CANONICAL_HOST
85b4c147 93AC_C_CONST
e79829db 94AC_C_VOLATILE
fbaec83b 95AC_C_BIGENDIAN
b12991dd 96
0e60bc9b 97dnl Compiler warnings
b1b54edf 98UL_WARN_ADD([-fno-common])
9dc72d0b 99UL_WARN_ADD([-Wall])
b1b54edf 100UL_WARN_ADD([-Werror=sequence-point])
0e60bc9b 101UL_WARN_ADD([-Wextra])
b1b54edf
KZ
102UL_WARN_ADD([-Wmissing-declarations])
103UL_WARN_ADD([-Wmissing-parameter-type])
104UL_WARN_ADD([-Wmissing-prototypes])
0e60bc9b 105UL_WARN_ADD([-Wno-missing-field-initializers])
b1b54edf 106UL_WARN_ADD([-Wredundant-decls])
0e60bc9b
KZ
107UL_WARN_ADD([-Wsign-compare])
108UL_WARN_ADD([-Wtype-limits])
109UL_WARN_ADD([-Wuninitialized])
b1b54edf
KZ
110UL_WARN_ADD([-Wunused-but-set-parameter])
111UL_WARN_ADD([-Wunused-but-set-variable])
0e60bc9b 112UL_WARN_ADD([-Wunused-parameter])
0e60bc9b 113UL_WARN_ADD([-Wunused-result])
bec5c9db 114UL_WARN_ADD([-Wunused-variable])
dcd33c3e
KZ
115UL_WARN_ADD([-Wnested-externs])
116UL_WARN_ADD([-Wpointer-arith])
117UL_WARN_ADD([-Wstrict-prototypes])
118UL_WARN_ADD([-Wformat-security])
0e60bc9b
KZ
119AC_SUBST([WARN_CFLAGS])
120
034d378b 121UL_WARN_ADD([-Wno-clobbered], [BSD_WARN_CFLAGS])
7697771d
KZ
122AC_SUBST([BSD_WARN_CFLAGS])
123
b12991dd
KZ
124dnl libtool-2
125LT_INIT
48d7b13a 126
fd0f4132
SK
127m4_ifndef([PKG_PROG_PKG_CONFIG],
128 [m4_fatal([Could not locate the pkg-config autoconf
129 macros. These are usually located in /usr/share/aclocal/pkg.m4.
130 If your macros are in a different location, try setting the
131 environment variable AL_OPTS="-I/other/macro/dir" before running
132 ./autogen.sh or autoreconf again.])])
d06d028a
KZ
133PKG_PROG_PKG_CONFIG
134
22aa5166
KZ
135GTK_DOC_CHECK([1.10])
136AC_PATH_PROG([XSLTPROC], [xsltproc])
137
8c182554 138linux_os=no
9f57e6e8 139AS_CASE([${host_os}], [*linux*], [linux_os=yes])
034d378b 140AM_CONDITIONAL([LINUX], [test "x$linux_os" = xyes])
8c182554 141
3c6e292c 142dnl define ARCH_<NAME> conditionals
034d378b
SK
143UL_SET_ARCH([I86], [i?86-*])
144UL_SET_ARCH([86_64], [x86_64*])
145UL_SET_ARCH([IA64], [ia64*])
146UL_SET_ARCH([S390], [s390*])
147UL_SET_ARCH([SPARC], [sparc*])
148UL_SET_ARCH([PPC], [ppc*|powerpc*])
149UL_SET_ARCH([M68K], [m68*])
150UL_SET_ARCH([MIPS], [mips*])
151UL_SET_ARCH([HPPA], [hppa*])
3c6e292c 152
48d7b13a
KZ
153AC_SYS_LARGEFILE
154
0576dbd3 155AM_GNU_GETTEXT_VERSION([0.18.2])
09734b00 156AM_GNU_GETTEXT([external])
3013eb9d
SK
157
158AS_IF([test -d "$srcdir/po"], [
159 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
160], [
161 ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
162])
09734b00 163
e460a5bf 164AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
48d7b13a
KZ
165#ifdef HAVE_LINUX_COMPILER_H
166#include <linux/compiler.h>
167#endif
168])
f06b4328
SK
169AC_CHECK_HEADERS([ \
170 asm/io.h \
171 err.h \
a0948ffe 172 errno.h \
f06b4328 173 fcntl.h \
a0948ffe 174 getopt.h \
f06b4328
SK
175 inttypes.h \
176 linux/cdrom.h \
177 linux/falloc.h \
5b0289b9 178 linux/watchdog.h \
a0948ffe 179 linux/fd.h \
f06b4328 180 linux/raw.h \
a0948ffe
KZ
181 linux/tiocl.h \
182 linux/version.h \
48469f90 183 linux/securebits.h \
8b7f16fc 184 locale.h \
607c2a72 185 mntent.h \
f06b4328 186 net/if.h \
754fed0c 187 net/if_dl.h \
f06b4328
SK
188 netinet/in.h \
189 paths.h \
190 pty.h \
191 security/pam_misc.h \
192 stdint.h \
78288764 193 stdio_ext.h \
a0948ffe 194 stdlib.h \
1a1eb4e1
KZ
195 endian.h \
196 byteswap.h \
197 sys/endian.h \
a0948ffe
KZ
198 sys/disk.h \
199 sys/disklabel.h \
f06b4328 200 sys/file.h \
bf962c0a 201 sys/io.h \
f06b4328
SK
202 sys/ioccom.h \
203 sys/ioctl.h \
a0948ffe
KZ
204 sys/mkdev.h \
205 sys/prctl.h \
206 sys/queue.h \
f06b4328 207 sys/resource.h \
2a7c1f70 208 sys/socket.h \
f06b4328 209 sys/sockio.h \
a0948ffe 210 sys/stat.h \
f06b4328
SK
211 sys/swap.h \
212 sys/syscall.h \
213 sys/time.h \
00c505d9 214 sys/ttydefaults.h \
a0948ffe 215 sys/types.h \
754fed0c 216 sys/un.h \
f06b4328
SK
217 unistd.h \
218])
dc61d398 219
a67387b7
KZ
220AC_CHECK_HEADERS([langinfo.h],
221 [AM_CONDITIONAL([HAVE_LANGINFO], [true])],
222 [AM_CONDITIONAL([HAVE_LANGINFO], [false])])
223
16ba8d58
KZ
224dnl Convert some ac_cv_header_* variables to have_*
225dnl
226have_linux_raw_h=$ac_cv_header_linux_raw_h
48469f90 227have_linux_securebits_h=$ac_cv_header_linux_securebits_h
5b0289b9 228have_linux_watchdog_h=$ac_cv_header_linux_watchdog_h
ff0cb84d 229have_security_pam_misc_h=$ac_cv_header_security_pam_misc_h
48d7b13a 230
a67387b7
KZ
231
232AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
233#include <time.h>
234#include <unistd.h>
235]], [[
236 int a = 0;
237 struct tm *tm = localtime(0);
238 if (a == -1) /* false */
f06b4328 239 sleep(tm->tm_gmtoff);
a67387b7 240]])],
034d378b 241[AC_DEFINE([HAVE_TM_GMTOFF], [1], [Does struct tm have a field tm_gmtoff?])
a67387b7
KZ
242])
243
244AC_CHECK_MEMBERS([struct termios.c_line],,,
245 [[#include <termios.h>]])
246
247AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
248 [#include <sys/stat.h>])
249
a67387b7
KZ
250AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
251[[
252#ifdef HAVE_SYS_SWAP_H
253# include <sys/swap.h>
254#endif
255#include <unistd.h>
256]],
257[[swapon("/dev/null", 0);]])],
034d378b 258[AC_DEFINE([SWAPON_HAS_TWO_ARGS], [1], [Is swapon() declared with two parameters?])
a67387b7
KZ
259],
260[AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
261])
dc61d398
KZ
262
263
a88057d9
TP
264AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
265
2a7c1f70 266AC_CHECK_DECL([llseek],
034d378b 267 [AC_DEFINE([HAVE_LLSEEK_PROTOTYPE], [1],
2a7c1f70
KZ
268 [Define to 1 if have llseek prototype])],
269 [],
270 [#include <unistd.h>])
271
272AC_CHECK_DECL([lseek64],
034d378b 273 [AC_DEFINE([HAVE_LSEEK64_PROTOTYPE], [1],
2a7c1f70
KZ
274 [Define to 1 if have lseek64 prototype])],
275 [],
276 [#define _LARGEFILE_SOURCE
277 #define _LARGEFILE64_SOURCE
278 #include <unistd.h>])
279
0e9b73d3 280AC_CHECK_DECL([environ],
034d378b 281 [AC_DEFINE([HAVE_ENVIRON_DECL], [1],
0e9b73d3
SK
282 [Define to 1 if have **environ prototype])],
283)
284
285AC_CHECK_DECL([strsignal],
034d378b 286 [AC_DEFINE([HAVE_STRSIGNAL_DECL], [1],
0e9b73d3
SK
287 [Define to 1 if have strsignal function prototype])],
288)
289
f06b4328 290AC_CHECK_FUNCS([ \
78288764 291 __fpending \
075f4bfd 292 secure_getenv \
f06b4328 293 __secure_getenv \
eb76ca98
FG
294 err \
295 errx \
bf962c0a 296 fsync \
f06b4328 297 futimens \
bf962c0a 298 getdomainname \
f06b4328
SK
299 getdtablesize \
300 getexecname \
301 getmntinfo \
302 getrlimit \
303 inotify_init \
3ac22f7a 304 jrand48 \
bf962c0a 305 lchown \
a0948ffe
KZ
306 llseek \
307 lseek64 \
02887b73 308 mempcpy \
f06b4328
SK
309 nanosleep \
310 personality \
311 posix_fadvise \
312 prctl \
313 rpmatch \
485a8bfa 314 scandirat \
69045d3d
KZ
315 setresgid \
316 setresuid \
f06b4328
SK
317 sigqueue \
318 srandom \
319 strnchr \
69b7e41e
KZ
320 strndup \
321 strnlen \
f06b4328
SK
322 strtoull \
323 sysconf \
324 updwtmp \
325 usleep \
eb76ca98
FG
326 warn \
327 warnx \
f06b4328 328])
48d7b13a 329AC_FUNC_FSEEKO
48d7b13a 330
940fd28c 331AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
465e9973 332AC_CHECK_FUNCS([ioperm iopl], [have_io=yes])
465e9973 333
034d378b
SK
334AC_CHECK_MEMBER([struct sockaddr.sa_len],
335 AC_DEFINE_UNQUOTED([HAVE_SA_LEN], [1], [Define if struct sockaddr contains sa_len]), [],
754fed0c
KZ
336 [#include <sys/types.h>
337 #include <sys/socket.h>])
338
60cc9f94 339SOCKET_LIBS=
60cc9f94 340AC_SEARCH_LIBS([socket], [socket],
3013eb9d
SK
341 [AS_IF([test x"$ac_cv_search_socket" != x"none required"],
342 [SOCKET_LIBS="$SOCKET_LIBS -lsocket"])
343])
60cc9f94
FG
344AC_SUBST([SOCKET_LIBS])
345
d58c47d9
FG
346
347have_dirfd=no
348AC_CHECK_FUNCS([dirfd], [have_dirfd=yes], [have_dirfd=no])
3013eb9d 349AS_IF([test x"$have_dirfd" = xno], [
d58c47d9
FG
350 AC_CHECK_DECLS([dirfd],
351 [have_dirfd=yes], [have_dirfd=no],
352 [#include <sys/types.h>
353 #include <dirent.h>])
3013eb9d 354])
d58c47d9
FG
355
356have_ddfd=no
3013eb9d 357AS_IF([test x"$have_dirfd" = xno], [
d58c47d9
FG
358 AC_CHECK_MEMBERS([DIR.dd_fd],
359 [have_ddfd=yes], [have_ddfd=no],
360 [#include <sys/types.h>
361 #include <dirent.h>])
3013eb9d 362])
d58c47d9 363
9f57e6e8
SK
364AS_CASE([$have_dirfd:$have_ddfd],
365 [no:no],
366 [AC_MSG_ERROR([cannot find a method to get filedescriptor of directory])]
367)
d58c47d9
FG
368
369
d6abf168
SK
370AC_MSG_CHECKING([whether program_invocation_short_name is defined])
371AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
372 #include <argp.h>
373]], [[
374 program_invocation_short_name = "test";
375]])], [
376 AC_MSG_RESULT([yes])
377 AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
378 [Define if program_invocation_short_name is defined])
379], [
380 AC_MSG_RESULT([no])
381])
382
a804f444
FG
383
384AC_MSG_CHECKING([whether __progname is defined])
385AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
f06b4328 386 [if (*__progname == 0) return;])],
034d378b
SK
387 AC_DEFINE([HAVE___PROGNAME], [1], [Define if __progname is defined])
388 AC_MSG_RESULT([yes]),
389 AC_MSG_RESULT([no]))
a804f444 390
8569410c 391dnl Static compilation
132ea941 392m4_define([UL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid])
8569410c
SK
393
394AC_ARG_ENABLE([static-programs],
395 [AS_HELP_STRING([--enable-static-programs=LIST],
396 [link static the programs in LIST (comma-separated,
132ea941 397 supported for ]m4_defn([UL_STATIC_PROGRAMS])[)])])
8569410c 398
9f57e6e8
SK
399AS_CASE([$enable_static_programs],
400 [yes],
d924b10b 401 [enable_static_programs=m4_quote(UL_STATIC_PROGRAMS)],
9f57e6e8
SK
402 [no],
403 [enable_static_programs=]
404)
8569410c 405
8569410c 406dnl Set all the individual AM_CONDITIONALs
132ea941 407m4_foreach([UL_PRG], m4_defn([UL_STATIC_PROGRAMS]), [
9f57e6e8
SK
408 AS_CASE([,$enable_static_programs,],
409 [*,UL_PRG,*], [static_[]UL_PRG=yes]
410 )
d924b10b 411 AS_IF([test "x$static_[]UL_PRG" = xyes], [AC_MSG_NOTICE([enable static build: UL_PRG.])])
132ea941
KZ
412 AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UL_PRG),
413 [test "x$static_[]UL_PRG" = xyes])
8569410c
SK
414])
415
d7a01582 416AX_CHECK_TLS
3ac22f7a 417
13f5473e
KZ
418AC_DEFUN([UL_SCANF_TYPE_MODIFIER], [dnl
419# include <stdio.h>
420int main()
421{
422 int i;
423 char *s;
424 i = sscanf("x", $1, &s);
425 if (i == 1)
426 return 0;
427 return 1;
428}])
429
430AC_CACHE_VAL([scanf_cv_alloc_modifier],
431 AC_RUN_IFELSE([AC_LANG_SOURCE([UL_SCANF_TYPE_MODIFIER(["%ms"])])],
432 [scanf_cv_alloc_modifier=ms],
433 AC_RUN_IFELSE([AC_LANG_SOURCE([UL_SCANF_TYPE_MODIFIER(["%as"])])],
434 [scanf_cv_alloc_modifier=as],
435 [scanf_cv_alloc_modifier=no]
436 )
b420e279 437 ,
d0202f1c
SAS
438
439 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
440 #include <stdio.h>
695e4e1a 441 #include <unistd.h>
d0202f1c
SAS
442
443 #ifdef __GLIBC__
444
445 #if !(__GLIBC_PREREQ(2, 7))
446 #error %m is not available
447 #endif
448
695e4e1a 449 #elif defined(_POSIX_VERSION)
d0202f1c 450
695e4e1a
MF
451 #if _POSIX_VERSION < 200809L
452 #error %m is not available
453 #endif
454
455 #else
d0202f1c
SAS
456 #error Your C-library is not supported.
457 #endif
458 ])],
459 [scanf_cv_alloc_modifier=ms],
460 [scanf_cv_alloc_modifier=no])]
13f5473e
KZ
461 )
462)
463
464AC_MSG_CHECKING([scanf string alloc modifiers])
9f57e6e8
SK
465AS_CASE([$scanf_cv_alloc_modifier],
466 [ms],
467 [AC_MSG_RESULT([(%ms) yes])
468 AC_DEFINE([HAVE_SCANF_MS_MODIFIER], [1], [scanf %ms modifier])
469 have_scanf_alloc_modifier=yes],
470 [as],
471 [AC_MSG_RESULT([(%as) yes])
472 have_scanf_alloc_modifier=yes
473 AC_DEFINE([HAVE_SCANF_AS_MODIFIER], [1], [scanf %as modifier])],
474 [AC_MSG_RESULT([no])
475 have_scanf_alloc_modifier=no]
476)
13f5473e 477
034d378b
SK
478UL_CHECK_LIB([util], [openpty])
479UL_CHECK_LIB([termcap], [tgetnum])
3aecf79d
KZ
480
481AC_CHECK_TYPES([union semun], [], [], [[
482#include <sys/sem.h>
483]])
034d378b 484AC_CHECK_TYPES([loff_t])
3aecf79d
KZ
485
486AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
487#include <wchar.h>
488#include <wctype.h>
489#include <stdio.h>
490]], [[
491 wchar_t wc;
492 wint_t w;
493 w = fgetwc(stdin);
494 if (w == WEOF) exit(1);
495 wc = w;
496 fputwc(wc,stdout);
497]])],
034d378b 498[AC_DEFINE([HAVE_WIDECHAR], [1], [Do we have wide character support?])
3aecf79d
KZ
499])
500
501AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
502#include <sched.h>
503]])
504
034d378b 505AM_CONDITIONAL([HAVE_CPU_SET_T], [test "x$have_cpu_set_t" = xyes])
3aecf79d 506
b09bc508
MF
507AC_CHECK_TYPES([sighandler_t], [], [], [[
508#include <signal.h>
509]])
510
3aecf79d
KZ
511AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
512#include <sched.h>
513]])
514
8d35bdc9
KZ
515# on Solaris, you can't mix and match standards, since we use c99
516# aparently at this stage, XOPEN_SOURCE will conflict. As workaround,
517# check for crypt.h and use that without XOPEN_SOURCE.
518AC_CHECK_HEADERS([crypt.h])
519AC_LINK_IFELSE([AC_LANG_PROGRAM([[
520#ifdef HAVE_CRYPT_H
521#include <crypt.h>
522#else
523#define _XOPEN_SOURCE
524#include <unistd.h>
525#endif
526]], [[
527char *c = crypt("abc","pw");
528]])],[],[
529 LIBS="$LIBS -lcrypt"
530 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
531 #ifdef HAVE_CRYPT_H
532 #include <crypt.h>
533 #else
534 #define _XOPEN_SOURCE
535 #include <unistd.h>
536 #endif
537 ]], [[
538 char *c = crypt("abc","pw");
539 ]])],[
034d378b 540 AC_DEFINE([HAVE_LIBCRYPT], [1], [Do we need -lcrypt?])
8d35bdc9
KZ
541 have_libcrypt=yes
542 ],[
543 AC_MSG_ERROR([crypt() is not available])
544 ])
545])
034d378b 546AM_CONDITIONAL([HAVE_LIBCRYPT], [test "x$have_libcrypt" = xyes])
8d35bdc9 547
13f5473e 548
75ad4910
KZ
549AC_ARG_WITH([selinux],
550 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
034d378b 551 [], [with_selinux=no]
75ad4910
KZ
552)
553
3013eb9d 554AS_IF([test "x$with_selinux" = xno], [
034d378b 555 AM_CONDITIONAL([HAVE_SELINUX], [false])
3013eb9d 556], [
7e34c79f 557 PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.0],
034d378b 558 [AC_DEFINE([HAVE_LIBSELINUX], [1], [Define if SELinux is available])
7e34c79f 559 UL_PKG_STATIC([SELINUX_LIBS_STATIC], [libselinux])
034d378b 560 AM_CONDITIONAL([HAVE_SELINUX], [true])
7e34c79f
KZ
561 have_selinux=yes],
562 [have_selinux=no])
563
9f57e6e8
SK
564 AS_CASE([$with_selinux:$have_selinux],
565 [yes:no], [AC_MSG_ERROR([SELinux selected but libselinux not found or too old])]
566 )
312f04f4 567
3013eb9d 568 AS_IF([test "x$have_selinux" = xyes], [
312f04f4
KZ
569 UL_SET_FLAGS([], [], [$SELINUX_LIBS])
570 # This function is missing in old libselinux 1.xx versions
571 AC_CHECK_FUNCS([security_get_initial_context])
572 UL_RESTORE_FLAGS
3013eb9d
SK
573 ])
574])
75ad4910
KZ
575AC_SUBST([SELINUX_LIBS])
576AC_SUBST([SELINUX_LIBS_STATIC])
577
578AC_ARG_WITH([audit],
579 AS_HELP_STRING([--with-audit], [compile with audit support]),
034d378b 580 [], [with_audit=no]
75ad4910
KZ
581)
582
3013eb9d 583AS_IF([test "x$with_audit" = xno], [
034d378b 584 AM_CONDITIONAL([HAVE_AUDIT], [false])
3013eb9d 585], [
034d378b 586 UL_CHECK_LIB([audit], [audit_log_user_message])
9f57e6e8
SK
587 AS_CASE([$with_audit:$have_audit],
588 [yes:no],
589 [AC_MSG_ERROR([Audit selected but libaudit not found (or does not support audit_log_user_message())])]
590 )
3013eb9d 591])
75ad4910
KZ
592
593AC_ARG_WITH([udev], AS_HELP_STRING([--without-udev], [compile without udev support]),
034d378b 594 [], [with_udev=auto]
75ad4910
KZ
595)
596
3013eb9d 597AS_IF([test "x$with_udev" = xno], [
034d378b 598 AM_CONDITIONAL([HAVE_UDEV], [false])
3013eb9d 599], [
034d378b 600 UL_CHECK_LIB([udev], [udev_new])
9f57e6e8
SK
601 AS_CASE([$with_udev:$have_udev],
602 [yes:no],
603 [AC_MSG_ERROR([udev selected but libudev not found])]
604 )
3013eb9d 605])
75ad4910
KZ
606
607AC_ARG_WITH([ncurses],
608 AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
f06b4328 609 (--without-ncurses disables all ncurses(w) support)]),
034d378b 610 [], [with_ncurses=auto]
75ad4910 611)
034d378b 612AM_CONDITIONAL([HAVE_NCURSES], [false])
75ad4910 613
3013eb9d 614AS_IF([test "x$with_ncurses" != xno], [
75ad4910 615 have_ncurses=no
2b8f22bd
MF
616
617 dnl First try to find the pkg-config module.
618 PKG_CHECK_MODULES(NCURSESW, [ncursesw], [
619 have_ncurses=yes
620 NCURSES_LIBS=${NCURSESW_LIBS}
621 NCURSES_CFLAGS=${NCURSESW_CFLAGS}
622 AC_DEFINE([HAVE_LIBNCURSESW])
f1512be8 623 CURSES_LIB_NAME="ncursesw"
2b8f22bd
MF
624 ], [
625 PKG_CHECK_MODULES(NCURSES, [ncurses], [
626 have_ncurses=yes
627 AC_DEFINE([HAVE_LIBNCURSES])
f1512be8 628 CURSES_LIB_NAME="ncursesw"
2b8f22bd
MF
629 ], [:])
630 ])
631
632 AS_IF([test "x$have_ncurses" = xyes], [
633 dnl If that worked, setup the defines that the code expects.
634 save_CPPFLAGS="$CPPFLAGS"
635 CPPFLAGS="$CPPFLAGS $NCURSES_CFLAGS"
636 AC_CHECK_HEADERS([ncurses.h])
637 CPPFLAGS="$save_CPPFLAGS"
638 ], [
639 dnl If that failed, fall back to classic searching.
640 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
641 AS_IF([test "x$with_ncurses" = xauto], [
642 UL_CHECK_LIB([ncursesw], [initscr], [ncurses])
643 AS_IF([test "x$have_ncurses" = xyes], [
644 AC_CHECK_HEADERS([ncursesw/ncurses.h])
645 NCURSES_LIBS="-lncursesw"
f1512be8 646 CURSES_LIB_NAME="ncursesw"
2b8f22bd 647 ])
3013eb9d 648 ])
2b8f22bd
MF
649 AS_IF([test "x$have_ncurses" = xno], [
650 UL_CHECK_LIB(ncurses, initscr)
651 AS_IF([test "x$have_ncurses" = xyes], [
652 NCURSES_LIBS="-lncurses"
f1512be8 653 CURSES_LIB_NAME="ncurses"
2b8f22bd 654 ])
3013eb9d
SK
655 ])
656 ])
75ad4910 657 ])
2b8f22bd 658
3013eb9d 659 AS_IF([test "x$have_ncurses" = xno], [
75ad4910 660 AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
3013eb9d
SK
661 ])
662])
2b8f22bd 663AC_SUBST([NCURSES_CFLAGS])
75ad4910
KZ
664AC_SUBST([NCURSES_LIBS])
665
666
667AC_ARG_WITH([slang],
668 AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
034d378b 669 [], [with_slang=no]
75ad4910 670)
50ea6795 671have_slang=no
3013eb9d 672AS_IF([test "x$with_slang" = xyes], [
75ad4910
KZ
673 AC_CHECK_HEADERS([slang.h slang/slang.h])
674 AC_CHECK_HEADERS([slcurses.h slang/slcurses.h],
50ea6795 675 [have_slang=yes], [], [
75ad4910
KZ
676#ifdef HAVE_SLANG_H
677#include <slang.h>
678#elif defined(HAVE_SLANG_SLANG_H)
679#include <slang/slang.h>
680#endif
681])
3013eb9d 682 AS_IF([test "x$have_slang" = xno], [
f1512be8
KZ
683 AC_MSG_ERROR([slang selected but slcurses.h not found])],
684 [CURSES_LIB_NAME=slang
3013eb9d
SK
685 ])
686])
034d378b 687AM_CONDITIONAL([HAVE_SLANG], [test "x$have_slang" = xyes])
50ea6795 688
034d378b 689AM_CONDITIONAL([BUILD_CFDISK], [test "x$have_slang" = xyes -o "x$have_ncurses" = xyes])
50ea6795 690
f1512be8
KZ
691AS_IF([test "x$have_slang" = xyes -o "x$have_ncurses" = xyes], [
692 AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, [
693 AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1,
694 [Define if curses library has the use_default_colors command.])
695 ])
696])
697
50ea6795 698
ccf92e6d
KZ
699dnl Try pkg-config for libtinfo
700PKG_CHECK_MODULES(TINFO, [tinfo], [have_tinfo=yes], [
701 dnl If that failed, fall back to classic searching.
702 AC_CHECK_LIB([tinfo], [tgetent], [
703 have_tinfo=yes
704 TINFO_LIBS="-ltinfo"
705 TINFO_CFLAGS=""])
2b8f22bd
MF
706])
707AC_SUBST([TINFO_LIBS])
ccf92e6d 708AC_SUBST([TINFO_CFLAGS])
b88e6b02 709AM_CONDITIONAL([HAVE_TINFO], [test "x$have_tinfo" = xyes])
75ad4910
KZ
710
711
712AC_ARG_WITH([utempter],
713 AS_HELP_STRING([--with-utempter], [compile script(1) with libutempter]),
034d378b 714 [], [with_utempter=no]
75ad4910
KZ
715)
716
3013eb9d 717AS_IF([test "x$with_utempter" = xyes], [
034d378b 718 UL_CHECK_LIB([utempter], [utempter_add_record])
3013eb9d 719 AS_IF([test "x$have_utempter" = xno], [
75ad4910 720 AC_MSG_ERROR([utempter selected but libutempter not found])
3013eb9d
SK
721 ])
722], [
034d378b 723 AM_CONDITIONAL([HAVE_UTEMPTER], [false])
3013eb9d 724])
75ad4910
KZ
725
726
d17584b6 727AC_ARG_ENABLE([most-builds],
455fe9a0 728 AS_HELP_STRING([--enable-most-builds], [build everything other than experimental code]),
034d378b 729 [], [enable_most_builds=no]
d17584b6 730)
3013eb9d 731AS_IF([test "x$enable_most_builds" = xyes], [
3a3dcbdc 732 enable_chfn_chsh=yes
d17584b6
SK
733 enable_line=yes
734 enable_mesg=yes
3a3dcbdc 735 enable_newgrp=yes
d17584b6 736 enable_reset=yes
3a3dcbdc 737 enable_socket_activation=yes
4b670c01 738 enable_journald=yes
3a3dcbdc 739 enable_tunelp=yes
cc76731e 740 enable_vipw=yes
d17584b6 741 enable_write=yes
3745d4a9 742 with_python=yes
3013eb9d 743])
d17584b6 744
1dbbde66
KZ
745dnl
746dnl libuuid
747dnl
17afb032
KZ
748AC_ARG_ENABLE([libuuid],
749 AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]),
034d378b 750 [], [enable_libuuid=yes]
17afb032 751)
fa7be20e 752UL_BUILD_INIT([libuuid])
dc2b8d87
KZ
753AC_SUBST([LIBUUID_VERSION])
754AC_SUBST([LIBUUID_VERSION_INFO])
fa7be20e 755AM_CONDITIONAL(BUILD_LIBUUID, test "x$build_libuuid" = xyes)
9dc801d2 756
3013eb9d 757AS_IF([test "x$enable_libuuid" = xyes], [
17afb032 758 AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.])
3013eb9d 759], [
17afb032 760 AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
3013eb9d 761])
48d7b13a 762
1dbbde66
KZ
763dnl
764dnl libblkid
765dnl
f910b559 766AC_ARG_ENABLE([libblkid],
1d12ed57 767 AS_HELP_STRING([--disable-libblkid], [do not build libblkid and many related utilities]),
034d378b 768 [], [enable_libblkid=yes]
40f07ff7 769)
61a074f7 770UL_BUILD_INIT([libblkid])
033cf439 771AC_SUBST([LIBBLKID_DATE])
dc2b8d87
KZ
772AC_SUBST([LIBBLKID_VERSION])
773AC_SUBST([LIBBLKID_VERSION_INFO])
034d378b
SK
774AC_DEFINE_UNQUOTED([LIBBLKID_VERSION], ["$LIBBLKID_VERSION"], [libblkid version string])
775AC_DEFINE_UNQUOTED([LIBBLKID_DATE], ["$LIBBLKID_DATE"], [libblkid date string])
3013eb9d 776AS_IF([test "x$build_libblkid" = xyes], [
034d378b 777 AC_DEFINE([HAVE_LIBBLKID], [1], [Define to 1 if you have the -lblkid.])
3013eb9d 778])
034d378b
SK
779AM_CONDITIONAL([BUILD_LIBBLKID], [test "x$build_libblkid" = xyes])
780AM_CONDITIONAL([BUILD_LIBBLKID_TESTS], [test "x$build_libblkid" = xyes -a "x$enable_static" = xyes])
f910b559 781
1dbbde66
KZ
782dnl
783dnl libmount
784dnl
f1cde479
KZ
785AC_ARG_ENABLE([libmount],
786 AS_HELP_STRING([--disable-libmount], [do not build libmount]),
034d378b 787 [], [enable_libmount=check]
f1cde479 788)
61a074f7 789UL_BUILD_INIT([libmount])
13f5473e
KZ
790UL_REQUIRES_LINUX([libmount])
791UL_REQUIRES_BUILD([libmount], [libblkid])
792UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
034d378b
SK
793AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
794AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes -a "x$enable_static" = xyes])
8e368761 795
f1cde479
KZ
796AC_SUBST([LIBMOUNT_VERSION])
797AC_SUBST([LIBMOUNT_VERSION_INFO])
034d378b 798AC_DEFINE_UNQUOTED([LIBMOUNT_VERSION], ["$LIBMOUNT_VERSION"], [libmount version string])
13f5473e 799
f1cde479 800
1a4d989e
OO
801dnl
802dnl libsmartcols
803dnl
804AC_ARG_ENABLE([libsmartcols],
805 AS_HELP_STRING([--disable-libsmartcols], [do not build libsmartcols]),
806 [], [enable_libsmartcols=check]
807)
808UL_BUILD_INIT([libsmartcols])
809UL_REQUIRES_LINUX([libsmartcols])
810AM_CONDITIONAL([BUILD_LIBSMARTCOLS], [test "x$build_libsmartcols" = xyes])
811AM_CONDITIONAL([BUILD_LIBSMARTCOLS_TESTS], [test "x$build_libsmartcols" = xyes -a "x$enable_static" = xyes])
812
813AC_SUBST([LIBSMARTCOLS_VERSION])
814AC_SUBST([LIBSMARTCOLS_VERSION_INFO])
815AC_DEFINE_UNQUOTED([LIBSMARTCOLS_VERSION], ["$LIBSMARTCOLS_VERSION"], [libsmartcols version string])
816
817
eb6a03f3
KZ
818dnl
819dnl libfdisk is enabled all time if possible
820dnl
821UL_BUILD_INIT([libfdisk], [check])
822UL_REQUIRES_BUILD([libfdisk], [libuuid])
034d378b 823AM_CONDITIONAL([BUILD_LIBFDISK], [test "x$build_libfdisk" = xyes])
eb6a03f3
KZ
824
825UL_BUILD_INIT([fdisk], [check])
826UL_REQUIRES_BUILD([fdisk], [libfdisk])
034d378b 827AM_CONDITIONAL([BUILD_FDISK], [test "x$build_fdisk" = xyes])
eb6a03f3
KZ
828
829
434b07a0
KZ
830AC_ARG_ENABLE([mount],
831 AS_HELP_STRING([--disable-mount], [do not build mount(8) and umount(8)]),
034d378b 832 [], [enable_mount=check]
ecdba5dd 833)
434b07a0
KZ
834UL_BUILD_INIT([mount])
835UL_REQUIRES_BUILD([mount], [libmount])
034d378b 836AM_CONDITIONAL([BUILD_MOUNT], [test "x$build_mount" = xyes])
ecdba5dd
KZ
837
838
bafe1a75
KZ
839AC_ARG_ENABLE([losetup],
840 AS_HELP_STRING([--disable-losetup], [do not build losetup]),
034d378b 841 [], [enable_losetup=check]
bafe1a75
KZ
842)
843UL_BUILD_INIT([losetup])
844UL_REQUIRES_LINUX([losetup])
034d378b 845AM_CONDITIONAL([BUILD_LOSETUP], [test "x$build_losetup" = xyes])
bafe1a75
KZ
846
847
78cdc254
KZ
848AC_ARG_ENABLE([cytune],
849 AS_HELP_STRING([--disable-cytune], [do not build cytune]),
034d378b 850 [], [enable_cytune=check]
78cdc254
KZ
851)
852UL_BUILD_INIT([cytune])
853UL_REQUIRES_LINUX([cytune])
034d378b 854AM_CONDITIONAL([BUILD_CYTUNE], [test "x$build_cytune" = xyes])
78cdc254
KZ
855
856
1dbbde66
KZ
857AC_ARG_ENABLE([fsck],
858 AS_HELP_STRING([--disable-fsck], [do not build fsck]),
034d378b 859 [], [enable_fsck=check]
1dbbde66 860)
61a074f7 861UL_BUILD_INIT([fsck])
a7b585ea 862UL_REQUIRES_BUILD([fsck], [libmount])
034d378b 863AM_CONDITIONAL([BUILD_FSCK], [test "x$build_fsck" = xyes])
1dbbde66
KZ
864
865
866AC_ARG_ENABLE([partx],
867 AS_HELP_STRING([--disable-partx], [do not build addpart, delpart, partx]),
034d378b 868 [], [enable_partx=check]
1dbbde66 869)
61a074f7 870UL_BUILD_INIT([partx])
ecde2536
KZ
871UL_REQUIRES_LINUX([partx])
872UL_REQUIRES_BUILD([partx], [libblkid])
034d378b 873AM_CONDITIONAL([BUILD_PARTX], [test "x$build_partx" = xyes])
1dbbde66
KZ
874
875
1dbbde66
KZ
876AC_ARG_ENABLE([uuidd],
877 AS_HELP_STRING([--disable-uuidd], [do not build the uuid daemon]),
034d378b 878 [], [enable_uuidd=check]
1dbbde66 879)
61a074f7 880UL_BUILD_INIT([uuidd])
bcdab497 881UL_REQUIRES_BUILD([uuidd], [libuuid])
3013eb9d 882AS_IF([test "x$build_uuidd" = xyes], [
034d378b 883 AC_DEFINE([HAVE_UUIDD], [1], [Define to 1 if you want to use uuid daemon.])
3013eb9d 884])
034d378b 885AM_CONDITIONAL([BUILD_UUIDD], [test "x$build_uuidd" = xyes])
1dbbde66
KZ
886
887
0164c245 888AC_ARG_ENABLE([mountpoint],
2023ccc4 889 AS_HELP_STRING([--disable-mountpoint], [do not build mountpoint]),
034d378b 890 [], [enable_mountpoint=check]
0164c245 891)
61a074f7 892UL_BUILD_INIT([mountpoint])
a9127bc1 893UL_REQUIRES_BUILD([mountpoint], [libmount])
034d378b 894AM_CONDITIONAL([BUILD_MOUNTPOINT], [test "x$build_mountpoint" = xyes])
0164c245
KZ
895
896
10e56b49
KZ
897AC_ARG_ENABLE([fallocate],
898 AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
034d378b 899 [], [enable_fallocate=check]
10e56b49 900)
61a074f7 901UL_BUILD_INIT([fallocate])
10e56b49
KZ
902UL_REQUIRES_LINUX([fallocate])
903UL_REQUIRES_SYSCALL_CHECK([fallocate], [UL_CHECK_SYSCALL([fallocate])])
034d378b 904AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])
10e56b49 905
3013eb9d 906AS_IF([test "x$build_fallocate" = xyes], [
10e56b49
KZ
907 dnl check for valid fallocate() function
908 dnl with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
909 dnl when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
910 dnl and program can't be linked.
911 dnl AC_CHECK_FUNC can't catch such errors since it's redefining
912 dnl function prototype.
913 AC_MSG_CHECKING([for valid fallocate() function])
914 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
b832c2fe
YD
915#ifdef HAVE_UNISTD_H
916# include <unistd.h>
917#endif
918#ifdef HAVE_SYS_TYPES_H
919# include <sys/types.h>
920#endif
921#ifdef HAVE_LINUX_FALLOC_H
922# include <linux/falloc.h>
923#endif
924#ifdef HAVE_FCNTL_H
925# include <fcntl.h>
926#endif
927]],[[
928 long ret;
b832c2fe 929 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
b832c2fe
YD
930 if (ret != 0) {
931 return 1;
932 }
933 ]])],[
10e56b49 934 AC_MSG_RESULT([yes])
034d378b 935 AC_DEFINE([HAVE_FALLOCATE], [1], [Have valid fallocate() function])],[
10e56b49 936 AC_MSG_RESULT([no])])
3013eb9d 937])
10e56b49 938
19a224ad 939
a2ea6670
KZ
940AC_ARG_ENABLE([unshare],
941 AS_HELP_STRING([--disable-unshare], [do not build unshare]),
034d378b 942 [], [enable_unshare=check]
a2ea6670 943)
61a074f7 944UL_BUILD_INIT([unshare])
a2ea6670
KZ
945UL_REQUIRES_LINUX([unshare])
946UL_REQUIRES_SYSCALL_CHECK([unshare], [UL_CHECK_SYSCALL([unshare])])
034d378b 947AM_CONDITIONAL([BUILD_UNSHARE], [test "x$build_unshare" = xyes])
bdd384d1 948AC_CHECK_FUNCS([unshare])
b3425806 949
f8aa8e94
EB
950AC_ARG_ENABLE([nsenter],
951 AS_HELP_STRING([--disable-nsenter], [do not build nsenter]),
034d378b 952 [], [enable_nsenter=check]
f8aa8e94
EB
953)
954UL_BUILD_INIT([nsenter])
955UL_REQUIRES_LINUX([nsenter])
6cd4beac 956UL_REQUIRES_SYSCALL_CHECK([nsenter], [UL_CHECK_SYSCALL([setns])], [setns])
034d378b 957AM_CONDITIONAL([BUILD_NSENTER], [test "x$build_nsenter" = xyes])
bdd384d1 958AC_CHECK_FUNCS([setns])
b3425806 959
5600c405
AL
960dnl setpriv depends on libcap-ng. It would be possible to build
961dnl a version of setpriv with limited functionality without libcap-ng,
962dnl but this isn't currently supported.
963UL_CHECK_LIB([cap-ng], [capng_apply], [cap_ng])
964AC_ARG_ENABLE([setpriv],
965 AS_HELP_STRING([--disable-setpriv], [do not build setpriv]),
034d378b 966 [], [enable_setpriv=check]
5600c405
AL
967)
968UL_BUILD_INIT([setpriv])
969UL_REQUIRES_LINUX([setpriv])
48469f90 970UL_REQUIRES_HAVE([setpriv], [linux_securebits_h], [securebits.h header file])
e1b8ba20 971UL_REQUIRES_HAVE([setpriv], [cap_ng], [libcap-ng library])
034d378b 972AM_CONDITIONAL([BUILD_SETPRIV], [test "x$build_setpriv" = xyes])
5600c405
AL
973
974
539feec1
ML
975AC_ARG_ENABLE([eject],
976 AS_HELP_STRING([--disable-eject], [do not build eject]),
034d378b 977 [], [enable_eject=check]
539feec1
ML
978)
979UL_BUILD_INIT([eject])
980UL_REQUIRES_LINUX([eject])
7770e7df 981UL_REQUIRES_BUILD([eject], [libmount])
034d378b 982AM_CONDITIONAL([BUILD_EJECT], [test "x$build_eject" = xyes])
539feec1
ML
983
984
48d7b13a 985AC_ARG_ENABLE([agetty],
7fa4f112 986 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
034d378b 987 [], [enable_agetty=yes]
48d7b13a 988)
61a074f7 989UL_BUILD_INIT([agetty])
034d378b 990AM_CONDITIONAL([BUILD_AGETTY], [test "x$build_agetty" = xyes])
0fc74be1 991
48d7b13a 992
9cb68977 993AC_ARG_ENABLE([cramfs],
7fa4f112 994 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
034d378b 995 [], [enable_cramfs=check]
9cb68977 996)
61a074f7 997UL_BUILD_INIT([cramfs])
034d378b 998AC_CHECK_LIB([z], [crc32], [have_z=yes], [have_z=no])
d81b5a52 999UL_REQUIRES_HAVE([cramfs], [z], [z library])
034d378b 1000AM_CONDITIONAL([BUILD_CRAMFS], [test "x$build_cramfs" = xyes])
9cb68977 1001
a13cdb7a 1002
8d6f0bae 1003AC_ARG_ENABLE([bfs],
834fc88c 1004 AS_HELP_STRING([--disable-bfs], [do not build mkfs.bfs]),
034d378b 1005 [], [enable_bfs=yes]
834fc88c
KZ
1006)
1007UL_BUILD_INIT([bfs])
034d378b 1008AM_CONDITIONAL([BUILD_BFS], [test "x$build_bfs" = xyes])
834fc88c
KZ
1009
1010
8d6f0bae
KZ
1011AC_ARG_ENABLE([fdformat],
1012 AS_HELP_STRING([--disable-fdformat], [do not build fdformat]),
034d378b 1013 [], [enable_fdformat=check]
8d6f0bae
KZ
1014)
1015UL_BUILD_INIT([fdformat])
1016UL_REQUIRES_LINUX([fdformat])
034d378b 1017AM_CONDITIONAL([BUILD_FDFORMAT], [test "x$build_fdformat" = xyes])
8d6f0bae
KZ
1018
1019
6acf31ac
KZ
1020AC_ARG_ENABLE([hwclock],
1021 AS_HELP_STRING([--disable-hwclock], [do not build hwclock]),
034d378b 1022 [], [enable_hwclock=check]
6acf31ac
KZ
1023)
1024have_linuxdummy=$linux_os
1025
1026UL_BUILD_INIT([hwclock])
1027UL_REQUIRES_HAVE([hwclock], [io, linuxdummy], [ioperm iopl function or Linux])
034d378b 1028AM_CONDITIONAL([BUILD_HWCLOCK], [test "x$build_hwclock" = xyes])
e09ebf22
KZ
1029
1030
7b040214
KZ
1031UL_BUILD_INIT([fstrim], [check])
1032UL_REQUIRES_LINUX([fstrim])
1033UL_REQUIRES_BUILD([fstrim], [libmount])
1034AM_CONDITIONAL([BUILD_FSTRIM], [test "x$build_fstrim" = xyes])
1035
1036
143635c9
KZ
1037UL_BUILD_INIT([swapon], [check])
1038UL_REQUIRES_LINUX([swapon])
1039UL_REQUIRES_BUILD([swapon], [libblkid])
7770e7df 1040UL_REQUIRES_BUILD([swapon], [libmount])
034d378b 1041AM_CONDITIONAL([BUILD_SWAPON], [test "x$build_swapon" = xyes])
143635c9
KZ
1042
1043
61a074f7 1044UL_BUILD_INIT([lsblk], [check])
a13cdb7a
KZ
1045UL_REQUIRES_LINUX([lsblk])
1046UL_REQUIRES_BUILD([lsblk], [libblkid])
9554f7ab 1047UL_REQUIRES_BUILD([lsblk], [libmount])
034d378b 1048AM_CONDITIONAL([BUILD_LSBLK], [test "x$build_lsblk" = xyes])
9cb68977 1049
a3d3b770 1050
61a074f7 1051UL_BUILD_INIT([lscpu], [check])
da396d88
KZ
1052UL_REQUIRES_LINUX([lscpu])
1053UL_REQUIRES_HAVE([lscpu], [cpu_set_t], [cpu_set_t type])
034d378b 1054AM_CONDITIONAL([BUILD_LSCPU], [test "x$build_lscpu" = xyes])
da396d88 1055
a3d3b770 1056
61a074f7 1057UL_BUILD_INIT([chcpu], [check])
da396d88
KZ
1058UL_REQUIRES_LINUX([chcpu])
1059UL_REQUIRES_HAVE([chcpu], [cpu_set_t], [cpu_set_t type])
034d378b 1060AM_CONDITIONAL([BUILD_CHCPU], [test "x$build_chcpu" = xyes])
da396d88 1061
a13cdb7a 1062
7fcccbdf
KZ
1063AC_ARG_ENABLE([wdctl],
1064 AS_HELP_STRING([--disable-wdctl], [do not build wdctl]),
034d378b 1065 [], [enable_wdctl=check]
7fcccbdf
KZ
1066)
1067UL_BUILD_INIT([wdctl])
5b0289b9
KZ
1068UL_REQUIRES_LINUX([wdctl])
1069UL_REQUIRES_HAVE([wdctl], [linux_watchdog_h], [linux/watchdog.h header file])
034d378b 1070AM_CONDITIONAL([BUILD_WDCTL], [test "x$build_wdctl" = xyes])
5b0289b9
KZ
1071
1072
54dbc8cf
KZ
1073UL_BUILD_INIT([swaplabel], [check])
1074UL_REQUIRES_BUILD([swaplabel], [libblkid])
034d378b 1075AM_CONDITIONAL([BUILD_SWAPLABEL], [test "x$build_swaplabel" = xyes])
54dbc8cf
KZ
1076
1077
945ac250
KZ
1078UL_BUILD_INIT([prlimit], [check])
1079UL_REQUIRES_LINUX([prlimit])
1080UL_REQUIRES_SYSCALL_CHECK([prlimit], [UL_CHECK_SYSCALL([prlimit64])], [prlimit64])
034d378b 1081AM_CONDITIONAL([BUILD_PRLIMIT], [test "x$build_prlimit" = xyes])
3013eb9d 1082AS_IF([test "x$build_prlimit" = xyes], [
945ac250 1083 AC_CHECK_FUNCS([prlimit])
3013eb9d 1084])
945ac250
KZ
1085
1086
3dc02ef4
DB
1087UL_BUILD_INIT([lslocks], [check])
1088UL_REQUIRES_LINUX([lslocks])
ec1204dc 1089UL_REQUIRES_BUILD([lslocks], [libmount])
034d378b 1090AM_CONDITIONAL([BUILD_LSLOCKS], [test "x$build_lslocks" = xyes])
3dc02ef4
DB
1091
1092
bd671347
KZ
1093AC_ARG_ENABLE([switch_root],
1094 AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
034d378b 1095 [], [enable_switch_root=check]
bd671347 1096)
61a074f7 1097UL_BUILD_INIT([switch_root])
a3d3b770
KZ
1098UL_REQUIRES_LINUX([switch_root])
1099UL_REQUIRES_HAVE([switch_root], [openat], [openat function])
034d378b 1100AM_CONDITIONAL([BUILD_SWITCH_ROOT], [test "x$build_switch_root" = xyes])
bd671347
KZ
1101
1102
11125e7a
KZ
1103AC_ARG_ENABLE([pivot_root],
1104 AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
034d378b 1105 [], [enable_pivot_root=check]
11125e7a 1106)
61a074f7 1107UL_BUILD_INIT([pivot_root])
9f632667
KZ
1108UL_REQUIRES_LINUX([switch_root])
1109UL_REQUIRES_SYSCALL_CHECK([pivot_root], [UL_CHECK_SYSCALL([pivot_root])])
034d378b 1110AM_CONDITIONAL([BUILD_PIVOT_ROOT], [test "x$build_pivot_root" = xyes])
11125e7a
KZ
1111
1112
1342ffcb
SK
1113AC_ARG_ENABLE([tunelp],
1114 AS_HELP_STRING([--enable-tunelp], [build tunelp]),
034d378b 1115 [], [enable_tunelp=no]
1342ffcb
SK
1116)
1117UL_BUILD_INIT([tunelp])
1118UL_REQUIRES_LINUX([tunelp])
034d378b 1119AM_CONDITIONAL([BUILD_TUNELP], [test "x$build_tunelp" = xyes])
1342ffcb
SK
1120
1121
48d7b13a 1122AC_ARG_ENABLE([kill],
4be753aa 1123 AS_HELP_STRING([--disable-kill], [do not build kill]),
034d378b 1124 [], [enable_kill=check]
48d7b13a 1125)
61a074f7 1126UL_BUILD_INIT([kill])
4be753aa 1127UL_REQUIRES_LINUX([kill])
034d378b 1128AM_CONDITIONAL([BUILD_KILL], [test "x$build_kill" = xyes])
48d7b13a
KZ
1129
1130
ce602720
OO
1131AC_ARG_ENABLE([deprecated-last],
1132 AS_HELP_STRING([--enable-deprecated-last], [build old deprecated last]),
1133 [], [enable_deprecated_last=no]
1134)
1135UL_BUILD_INIT([deprecated_last])
ce602720
OO
1136AM_CONDITIONAL([BUILD_DEPRECATED_LAST], [test "x$build_deprecated_last" = xyes])
1137
1138
48d7b13a 1139AC_ARG_ENABLE([last],
ce602720 1140 AS_HELP_STRING([--disable-last], [do not build last]),
4d1d1233 1141 [], [enable_last=check]
48d7b13a 1142)
61a074f7 1143UL_BUILD_INIT([last])
4d1d1233 1144UL_CONFLICTS_BUILD([last], [deprecated_last], [old deprecated last version])
034d378b 1145AM_CONDITIONAL([BUILD_LAST], [test "x$build_last" = xyes])
2dc68529 1146
48d7b13a 1147
78d5ceac 1148AC_ARG_ENABLE([utmpdump],
c9b53461 1149 AS_HELP_STRING([--disable-utmpdump], [do not build utmpdump]),
034d378b 1150 [], [enable_utmpdump=yes]
78d5ceac
KZ
1151)
1152UL_BUILD_INIT([utmpdump])
034d378b 1153AM_CONDITIONAL([BUILD_UTMPDUMP], [test "x$build_utmpdump" = xyes])
78d5ceac
KZ
1154
1155
c135a8bd
SK
1156AC_ARG_ENABLE([line],
1157 AS_HELP_STRING([--enable-line], [build line]),
034d378b 1158 [], [enable_line=no]
c135a8bd 1159)
61a074f7 1160UL_BUILD_INIT([line])
034d378b 1161AM_CONDITIONAL([BUILD_LINE], [test "x$build_line" = xyes])
2dc68529 1162
48d7b13a
KZ
1163
1164AC_ARG_ENABLE([mesg],
1cc62b35
KZ
1165 AS_HELP_STRING([--disable-mesg], [do not build mesg]),
1166 [], [enable_mesg=yes]
48d7b13a 1167)
61a074f7 1168UL_BUILD_INIT([mesg])
034d378b 1169AM_CONDITIONAL([BUILD_MESG], [test "x$build_mesg" = xyes])
48d7b13a
KZ
1170
1171
48d7b13a 1172AC_ARG_ENABLE([raw],
53b22add 1173 AS_HELP_STRING([--disable-raw], [do not build raw]),
034d378b 1174 [], [enable_raw=check]
48d7b13a 1175)
61a074f7 1176UL_BUILD_INIT([raw])
16ba8d58
KZ
1177UL_REQUIRES_LINUX([raw])
1178UL_REQUIRES_HAVE([raw], [linux_raw_h], [raw.h header file])
034d378b 1179AM_CONDITIONAL([BUILD_RAW], [test "x$build_raw" = xyes])
48d7b13a
KZ
1180
1181
48d7b13a 1182AC_ARG_ENABLE([rename],
7fa4f112 1183 AS_HELP_STRING([--disable-rename], [do not build rename]),
034d378b 1184 [], [enable_rename=yes]
48d7b13a 1185)
61a074f7 1186UL_BUILD_INIT([rename])
034d378b 1187AM_CONDITIONAL([BUILD_RENAME], [test "x$build_rename" = xyes])
48d7b13a
KZ
1188
1189
1190AC_ARG_ENABLE([reset],
7fa4f112 1191 AS_HELP_STRING([--enable-reset], [build reset]),
034d378b 1192 [], [enable_reset=no]
48d7b13a 1193)
61a074f7 1194UL_BUILD_INIT([reset])
034d378b 1195AM_CONDITIONAL([BUILD_RESET], [test "x$build_reset" = xyes])
48d7b13a
KZ
1196
1197
cc76731e
KZ
1198AC_ARG_ENABLE([vipw],
1199 AS_HELP_STRING([--enable-vipw], [build vipw]),
034d378b 1200 [], [enable_vipw=no]
48d7b13a 1201)
cc76731e 1202UL_BUILD_INIT([vipw])
034d378b 1203AM_CONDITIONAL([BUILD_VIPW], [test "x$build_vipw" = xyes])
9cb68977 1204
c94b3604 1205
aec9ecbd
KZ
1206AC_ARG_ENABLE([newgrp],
1207 AS_HELP_STRING([--enable-newgrp], [build newgrp]),
034d378b 1208 [], [enable_newgrp=no]
aec9ecbd
KZ
1209)
1210UL_BUILD_INIT([newgrp])
034d378b 1211AM_CONDITIONAL([BUILD_NEWGRP], [test "x$build_newgrp" = xyes])
aec9ecbd
KZ
1212
1213
d86918b6 1214AC_ARG_WITH([user], AS_HELP_STRING([--without-user], [compile without libuser (remote chsh)]),
034d378b 1215 [], [with_user=check]
7e4714f2 1216)
6e93c52f 1217have_user=no
3013eb9d 1218AS_IF([test "x$with_user" != xno], [
2771954b 1219 PKG_CHECK_MODULES(LIBUSER,[libuser >= 0.58], [have_user=yes], [have_user=no])
9f57e6e8
SK
1220 AS_CASE([$with_user:$have_user],
1221 [yes:no],
1222 [AC_MSG_ERROR([user selected but libuser not found])],
1223 [*:yes],
1224 [AC_DEFINE([HAVE_LIBUSER], [1], [Define if libuser is available])]
1225 )
1f6ec24c
KZ
1226 # temporary solution, libuser has stupid .pc where are exported all
1227 # private dependencies to Requires: instead of Requires.private:
3013eb9d 1228 AS_IF([test "x$have_user" = xyes], [
1f6ec24c 1229 LIBUSER_LIBS=-luser
3013eb9d
SK
1230 ])
1231])
034d378b 1232AM_CONDITIONAL([HAVE_USER], [test "x$have_user" = xyes])
7e4714f2 1233
d86918b6
KZ
1234AC_ARG_ENABLE([chfn-chsh-password],
1235 AS_HELP_STRING([--disable-chfn-chsh-password], [do not require the user to enter the password in chfn and chsh]),
034d378b 1236 [], [enable_chfn_chsh_password=yes]
d86918b6
KZ
1237)
1238
1239AC_ARG_ENABLE([chfn-chsh],
1240 AS_HELP_STRING([--enable-chfn-chsh], [build chfn and chsh]),
034d378b 1241 [], [enable_chfn_chsh=no]
d86918b6
KZ
1242)
1243UL_BUILD_INIT([chfn_chsh])
1244
3013eb9d 1245AS_IF([test "x$enable_chfn_chsh_password" = xyes -o "x$have_user" = xyes], [
d86918b6 1246 UL_REQUIRES_HAVE([chfn_chsh], [security_pam_misc_h], [PAM header file])
034d378b 1247 AC_DEFINE([CHFN_CHSH_PASSWORD], [1], [Should chfn and chsh require the user to enter the password?])
3013eb9d 1248])
034d378b
SK
1249AM_CONDITIONAL([BUILD_CHFN_CHSH], [test "x$build_chfn_chsh" = xyes])
1250AM_CONDITIONAL([CHFN_CHSH_PASSWORD], [test "x$enable_chfn_chsh_password" = xyes])
d86918b6
KZ
1251
1252AC_ARG_ENABLE([chsh-only-listed],
1253AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
1254[], enable_chsh_only_listed=yes
1255)
7e4714f2 1256
3013eb9d
SK
1257AS_IF([test "x$enable_chsh_only_listed" = xyes], [
1258 AC_DEFINE([ONLY_LISTED_SHELLS], [1], [Should chsh allow only shells in /etc/shells?])
1259])
71681ee5 1260
2c8a3e16 1261
e7614a07
KZ
1262AC_ARG_ENABLE([login],
1263 AS_HELP_STRING([--disable-login], [do not build login]),
034d378b 1264 [], [enable_login=check]
e7614a07
KZ
1265)
1266UL_BUILD_INIT([login])
1267UL_REQUIRES_HAVE([login], [security_pam_misc_h], [PAM header file])
034d378b 1268AM_CONDITIONAL([BUILD_LOGIN], [test "x$build_login" = xyes])
e7614a07 1269
71681ee5
KZ
1270AC_ARG_ENABLE([login-chown-vcs],
1271 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
034d378b 1272 [], [enable_login_chown_vcs=no]
71681ee5
KZ
1273)
1274
3013eb9d 1275AS_IF([test "x$enable_login_chown_vcs" = xyes], [
034d378b 1276 AC_DEFINE([LOGIN_CHOWN_VCS], [1], [Should login chown /dev/vcsN?])
3013eb9d 1277])
71681ee5
KZ
1278
1279AC_ARG_ENABLE([login-stat-mail],
1280 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
034d378b 1281 [], [enable_login_stat_mail=no]
71681ee5
KZ
1282)
1283
3013eb9d 1284AS_IF([test "x$enable_login_stat_mail" = xyes], [
034d378b 1285 AC_DEFINE([LOGIN_STAT_MAIL], [1], [Should login stat() the mailbox?])
3013eb9d 1286])
71681ee5 1287
e7614a07 1288
88407b93
KZ
1289AC_ARG_ENABLE([nologin],
1290 AS_HELP_STRING([--disable-nologin], [do not build nologin]),
1291 [], [enable_nologin=yes]
1292)
1293UL_BUILD_INIT([nologin])
1294AM_CONDITIONAL([BUILD_NOLOGIN], [test "x$build_nologin" = xyes])
1295
1296
e7614a07
KZ
1297AC_ARG_ENABLE([sulogin],
1298 AS_HELP_STRING([--disable-sulogin], [do not build sulogin]),
034d378b 1299 [], [enable_sulogin=yes]
e7614a07
KZ
1300)
1301UL_BUILD_INIT([sulogin])
034d378b 1302AM_CONDITIONAL([BUILD_SULOGIN], [test "x$build_sulogin" = xyes])
e7614a07 1303
f17f5f48 1304
ff4c5555
KZ
1305AC_ARG_ENABLE([su],
1306 AS_HELP_STRING([--disable-su], [do not build su]),
034d378b 1307 [], [enable_su=check]
ff4c5555
KZ
1308)
1309UL_BUILD_INIT([su])
1310UL_REQUIRES_HAVE([su], [security_pam_misc_h], [PAM header file])
034d378b 1311AM_CONDITIONAL([BUILD_SU], [test "x$build_su" = xyes])
ff4c5555
KZ
1312
1313
7ec6adb1
KZ
1314AC_ARG_ENABLE([runuser],
1315 AS_HELP_STRING([--disable-runuser], [do not build runuser]),
034d378b 1316 [], [enable_runuser=check]
7ec6adb1
KZ
1317)
1318UL_BUILD_INIT([runuser])
1319UL_REQUIRES_HAVE([runuser], [security_pam_misc_h], [PAM header file])
034d378b 1320AM_CONDITIONAL([BUILD_RUNUSER], [test "x$build_runuser" = xyes])
7ec6adb1
KZ
1321
1322
53b22add
KZ
1323AC_ARG_ENABLE([ul],
1324 AS_HELP_STRING([--disable-ul], [do not build ul]),
034d378b 1325 [], [enable_ul=check]
53b22add
KZ
1326)
1327UL_BUILD_INIT([ul])
1328UL_REQUIRES_HAVE([ul], [ncurses, tinfo], [ncurses or tinfo libraries])
034d378b 1329AM_CONDITIONAL([BUILD_UL], [test "x$build_ul" = xyes])
53b22add
KZ
1330
1331
1332AC_ARG_ENABLE([more],
1333 AS_HELP_STRING([--disable-more], [do not build more]),
034d378b 1334 [], [enable_more=check]
53b22add
KZ
1335)
1336UL_BUILD_INIT([more])
1337UL_REQUIRES_HAVE([more], [ncurses, tinfo, termcap], [ncurses, tinfo or termcap libraries])
034d378b 1338AM_CONDITIONAL([BUILD_MORE], [test "x$build_more" = xyes])
53b22add
KZ
1339
1340
1341AC_ARG_ENABLE([pg],
1342 AS_HELP_STRING([--disable-pg], [do not build pg]),
034d378b 1343 [], [enable_pg=check]
53b22add
KZ
1344)
1345UL_BUILD_INIT([pg])
1346UL_REQUIRES_HAVE([pg], [ncurses], [ncurses or ncursesw library])
034d378b 1347AM_CONDITIONAL([BUILD_PG], [test "x$build_pg" = xyes])
53b22add
KZ
1348
1349
d78d0409
KZ
1350AC_ARG_ENABLE([setterm],
1351 AS_HELP_STRING([--disable-setterm], [do not build setterm]),
034d378b 1352 [], [enable_setterm=check]
d78d0409
KZ
1353)
1354UL_BUILD_INIT([setterm])
1355UL_REQUIRES_LINUX([setterm])
1356UL_REQUIRES_HAVE([setterm], [ncurses], [ncurses library])
034d378b 1357AM_CONDITIONAL([BUILD_SETTERM], [test "x$build_setterm" = xyes])
d78d0409
KZ
1358
1359
48d7b13a 1360AC_ARG_ENABLE([schedutils],
34228e69 1361 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, taskset]),
034d378b 1362 [], [enable_schedutils=yes]
48d7b13a 1363)
61a074f7 1364UL_BUILD_INIT([schedutils])
034d378b 1365AM_CONDITIONAL([BUILD_SCHEDUTILS], [test "x$build_schedutils" = xyes])
17d5e11b 1366
61a074f7 1367UL_BUILD_INIT([ionice], [check])
17d5e11b
KZ
1368UL_REQUIRES_BUILD([ionice], [schedutils])
1369UL_REQUIRES_SYSCALL_CHECK([ionice],
1370 [UL_CHECK_SYSCALL([ioprio_set],
f06b4328
SK
1371 [alpha], [442],
1372 [i*86], [289],
1373 [ia64*], [1274],
1374 [powerpc*], [273],
1375 [s390*], [282],
1376 [sparc*], [196],
1377 [sh*], [288],
1378 [x86_64*], [251])],
17d5e11b
KZ
1379 [ioprio_set])
1380
1381UL_REQUIRES_SYSCALL_CHECK([ionice],
1382 [UL_CHECK_SYSCALL([ioprio_get],
f06b4328
SK
1383 [alpha], [443],
1384 [i*86], [290],
1385 [ia64*], [1275],
1386 [powerpc*], [274],
1387 [s390*], [283],
1388 [sparc*], [218],
1389 [sh*], [289],
1390 [x86_64*], [252])],
17d5e11b
KZ
1391 [ioprio_get])
1392
034d378b 1393AM_CONDITIONAL([BUILD_IONICE], [test "x$build_ionice" = xyes])
17d5e11b 1394
61a074f7 1395UL_BUILD_INIT([taskset], [check])
17d5e11b 1396UL_REQUIRES_BUILD([taskset], [schedutils])
e21e6d26 1397UL_REQUIRES_HAVE([taskset], [cpu_set_t], [cpu_set_t type])
17d5e11b
KZ
1398UL_REQUIRES_SYSCALL_CHECK([taskset],
1399 [UL_CHECK_SYSCALL([sched_getaffinity])],
1400 [sched_getaffinity])
034d378b 1401AM_CONDITIONAL([BUILD_TASKSET], [test "x$build_taskset" = xyes])
48d7b13a
KZ
1402
1403
1404AC_ARG_ENABLE([wall],
7fa4f112 1405 AS_HELP_STRING([--disable-wall], [do not build wall]),
034d378b 1406 [], [enable_wall=yes]
48d7b13a 1407)
8fc8888b 1408UL_BUILD_INIT([wall])
034d378b 1409AM_CONDITIONAL([BUILD_WALL], [test "x$build_wall" = xyes])
48d7b13a
KZ
1410
1411
1412AC_ARG_ENABLE([write],
7fa4f112 1413 AS_HELP_STRING([--enable-write], [build write]),
034d378b 1414 [], [enable_write=no]
48d7b13a 1415)
61a074f7 1416UL_BUILD_INIT([write])
034d378b 1417AM_CONDITIONAL([BUILD_WRITE], [test "x$build_write" = xyes])
48d7b13a
KZ
1418
1419
bbe289c4
PU
1420AC_ARG_ENABLE([socket-activation],
1421 AS_HELP_STRING([--enable-socket-activation], [build uuidd with support for systemd socket activation]),
034d378b 1422 [], [enable_socket_activation=no]
bbe289c4 1423)
ea45d34c 1424have_systemd_daemon=no
3013eb9d 1425AS_IF([test "x$enable_socket_activation" = xyes], [
ea45d34c
SK
1426 PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon], [], [
1427 AC_MSG_ERROR([cannot find libsystemd-daemon support])
1428 ])
1429 have_systemd_daemon=yes
1430 AC_DEFINE([HAVE_LIBSYSTEMD_DAEMON], [1], [Define if libsystemd-daemon is available])
3013eb9d 1431])
ea45d34c 1432AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$have_systemd_daemon" = xyes])
bbe289c4 1433
1b68c379
PU
1434AC_ARG_WITH([systemdsystemunitdir],
1435 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [directory for systemd service files]),
c8498f2f 1436 [], [with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`])
1b68c379 1437
3013eb9d 1438AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
1b68c379 1439 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
3013eb9d 1440])
1b68c379 1441
bbe289c4 1442
4b670c01
SK
1443AC_ARG_ENABLE([journald],
1444 AS_HELP_STRING([--enable-journald], [add journald support to logger]),
1445 [], [enable_journald=no]
1446)
1447have_journald=no
1448AS_IF([test "x$enable_journald" = xyes], [
1449 PKG_CHECK_MODULES([SYSTEMD_JOURNAL], [libsystemd-journal], [], [
1450 AC_MSG_ERROR([cannot find libsystemd-journal support])
1451 ])
1452 have_journald=yes
1453 AC_DEFINE([HAVE_JOURNALD], [1], [Define if journald is available])
1454])
1455AM_CONDITIONAL([HAVE_JOURNALD], [test "x$have_journald" = xyes])
1456
1457
b8095d25
KZ
1458AC_ARG_WITH([smack],
1459 AS_HELP_STRING([--with-smack], [build with SMACK support]),
1460 [], [with_smack=no]
1461)
1462AS_IF([test "x$with_smack" = xyes], [
1463 AC_DEFINE([HAVE_SMACK], [1], [Add SMACK support])
1464])
1465
1466
9cc36e9f
SK
1467AC_ARG_WITH([bashcompletiondir],
1468 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
1469 [],
c8498f2f
SK
1470 [AS_IF([`$PKG_CONFIG --exists bash-completion`], [
1471 with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion`
9cc36e9f
SK
1472 ], [
1473 with_bashcompletiondir=${datadir}/bash-completion/completions
1474 ])
1475])
1476AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
1477
ece777e9
KZ
1478AC_ARG_ENABLE([bash-completion],
1479 AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]),
034d378b 1480 [], [enable_bash_completion=yes]
ece777e9
KZ
1481)
1482
034d378b 1483AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes])
ece777e9 1484
9cc36e9f 1485
d78df0ac 1486AC_ARG_WITH([python],
3745d4a9
KZ
1487 AS_HELP_STRING([--with-python], [generate python bindings, use --with-python={2,3} to force version]),
1488 [], [with_python=no]
d78df0ac 1489)
8e5c4675 1490
d78df0ac 1491have_python=no
8e5c4675
KZ
1492AS_IF([test "x$with_python" != xno], [
1493 # We follow distributions default and look for PKG module name "python"
1494 # (minimal version is 2) but if major version is explicitly specified by
1495 # --with-python=2 or --with-python=3 then we look for PKG module "python2" or
1496 # "python3".
0b567ae5
SK
1497 AS_IF([test "x$withval" != xno -a "x$withval" != xyes],
1498 [pymajor="$withval"; PYTHON=python${pymajor}], [pymajor="2"])
1499 AM_PATH_PYTHON([$pymajor], [have_python=yes], [have_python=no])
8e5c4675
KZ
1500 AS_CASE([$with_python:$have_python],
1501 [yes:no],
0b567ae5 1502 [AC_MSG_ERROR([python selected but libpython not found])]
8e5c4675 1503 )
0b567ae5 1504 PKG_CHECK_MODULES([PYTHON], [python-$PYTHON_VERSION])
d924b10b
KZ
1505
1506 UL_BUILD_INIT([pylibmount], [check])
1507 UL_REQUIRES_HAVE([pylibmount], [python], [libpython])
1508 UL_REQUIRES_BUILD([pylibmount], [libmount])
d78df0ac
KZ
1509])
1510
d78df0ac
KZ
1511AM_CONDITIONAL([BUILD_PYLIBMOUNT], [test "x$build_pylibmount" = "xyes"])
1512
1513
48d7b13a 1514AC_ARG_ENABLE([pg-bell],
7fa4f112 1515 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
034d378b 1516 [], [enable_pg_bell=yes]
48d7b13a
KZ
1517)
1518
3013eb9d 1519AS_IF([test "x$enable_pg_bell" = xyes], [
034d378b 1520 AC_DEFINE([PG_BELL], [1], [Should pg ring the bell on invalid keys?])
3013eb9d 1521])
48d7b13a
KZ
1522
1523
bb4cb69d
MF
1524AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
1525AC_ARG_ENABLE([fs-paths-default],
1526 AS_HELP_STRING([--enable-fs-paths-default=paths], [default search path for fs helpers @<:@FS_PATHS_DEFAULT@:>@]),
9f57e6e8
SK
1527 [AS_CASE([$enableval],
1528 [yes], [fs_paths_defaults="FS_PATHS_DEFAULT"],
1529 [no], [fs_paths_defaults=""],
1530 [fs_paths_defaults="$enableval"]
1531 )],
bb4cb69d
MF
1532 [fs_paths_defaults="FS_PATHS_DEFAULT"]
1533)
1534AC_ARG_ENABLE([fs-paths-extra],
1535 AS_HELP_STRING([--enable-fs-paths-extra=paths], [additional search paths for fs helpers]),
9f57e6e8
SK
1536 [AS_CASE([$enableval],
1537 [yes|no], [fs_paths_extra=""],
1538 [fs_paths_extra="$enableval"]
1539 )],
bb4cb69d
MF
1540 [fs_paths_extra=""]
1541)
1542fs_paths="$fs_paths_defaults"
3013eb9d
SK
1543AS_IF([test "x$fs_paths_extra" != "x"], [
1544 AS_IF([test "x$fs_paths" != "x"], [
bb4cb69d 1545 fs_paths="${fs_paths}:"
3013eb9d 1546 ])
bb4cb69d 1547 fs_paths="${fs_paths}${fs_paths_extra}"
3013eb9d 1548])
bb4cb69d
MF
1549AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
1550
1551
48d7b13a 1552AC_ARG_ENABLE([use-tty-group],
7fa4f112 1553 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
034d378b 1554 [], [enable_use_tty_group=yes]
48d7b13a 1555)
034d378b 1556AM_CONDITIONAL([USE_TTY_GROUP], [test "x$enable_use_tty_group" = xyes])
48d7b13a 1557
3013eb9d 1558AS_IF([test "x$enable_use_tty_group" = xyes], [
034d378b 1559 AC_DEFINE([USE_TTY_GROUP], [1], [Should wall and write be installed setgid tty?])
3013eb9d 1560])
48d7b13a 1561
ab6478ef
WF
1562
1563AC_ARG_ENABLE([sulogin-emergency-mount],
479d50bd
DR
1564 AS_HELP_STRING([--enable-sulogin-emergency-mount],
1565 [use emergency mount of /dev and /proc for sulogin]),
034d378b 1566 [], [enable_sulogin_emergency_mount=no]
ab6478ef
WF
1567)
1568
3013eb9d 1569AS_IF([test "x$enable_sulogin_emergency_mount" = xyes], [
034d378b 1570 AC_DEFINE([USE_SULOGIN_EMERGENCY_MOUNT], [1],
ab6478ef 1571 [Should sulogin use a emergency mount of /dev and /proc?])
3013eb9d 1572])
ab6478ef
WF
1573
1574
f3831bbd
KZ
1575AC_ARG_ENABLE([makeinstall-chown],
1576 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
034d378b 1577 [], [enable_makeinstall_chown=yes]
f3831bbd 1578)
034d378b 1579AM_CONDITIONAL([MAKEINSTALL_DO_CHOWN], [test "x$enable_makeinstall_chown" = xyes])
f3831bbd 1580
4c24a7ae
KZ
1581AC_ARG_ENABLE([makeinstall-setuid],
1582 AS_HELP_STRING([--disable-makeinstall-setuid], [do not do setuid chmod operations during "make install"]),
034d378b 1583 [], [enable_makeinstall_setuid=yes]
4c24a7ae 1584)
034d378b 1585AM_CONDITIONAL([MAKEINSTALL_DO_SETUID], [test "x$enable_makeinstall_setuid" = xyes])
4c24a7ae 1586
06bcee19 1587
1f10890f
SK
1588AC_ARG_VAR([SUID_CFLAGS],
1589 [CFLAGS used for binaries which are usually with the suid bit])
1590AC_ARG_VAR([SUID_LDFLAGS],
1591 [LDFLAGS used for binaries which are usually with the suid bit])
06bcee19 1592
03d00d49
KZ
1593AC_ARG_VAR([DAEMON_CFLAGS],
1594 [CFLAGS used for binaries which are usually executed as daemons])
1595AC_ARG_VAR([DAEMON_LDFLAGS],
1596 [LDFLAGS used for binaries which are usually executed as daemons])
1597
1598AC_ARG_VAR([SOLIB_CFLAGS],
1599 [CFLAGS used for shared libraries])
1600AC_ARG_VAR([SOLIB_LDFLAGS],
1601 [LDFLAGS used for shared libraries])
1602
9cb68977 1603LIBS=""
48d7b13a 1604
48d7b13a 1605
034d378b 1606AC_CONFIG_HEADERS([config.h])
48d7b13a 1607
d4baf92e
KZ
1608#
1609# Don't use configure.ac to replace install paths! See Makefile PATHFILES for
1610# more details.
1611#
8eeb575c 1612AC_CONFIG_FILES([
f06b4328 1613Makefile
31a938ac 1614libblkid/docs/Makefile
8fb4efae 1615libblkid/docs/version.xml
8fb4efae 1616libblkid/src/blkid.h
31a938ac 1617libmount/docs/Makefile
2aefc0a8 1618libmount/docs/version.xml
f06b4328 1619libmount/src/libmount.h
1a4d989e 1620libsmartcols/src/libsmartcols.h
f06b4328 1621po/Makefile.in
8eeb575c 1622])
48d7b13a
KZ
1623
1624AC_OUTPUT
4e1073c2
KZ
1625
1626AC_MSG_RESULT([
1627 ${PACKAGE} ${VERSION}
1628
1629 prefix: ${prefix}
1630 exec prefix: ${exec_prefix}
1631
1632 localstatedir: ${localstatedir}
1633 bindir: ${bindir}
1634 sbindir: ${sbindir}
1635 libdir: ${libdir}
1636 includedir: ${includedir}
4e1073c2
KZ
1637 usrbin_execdir: ${usrbin_execdir}
1638 usrsbin_execdir: ${usrsbin_execdir}
1639 usrlib_execdir: ${usrlib_execdir}
1640
1641 compiler: ${CC}
1642 cflags: ${CFLAGS}
1643 suid cflags: ${SUID_CFLAGS}
1644 ldflags: ${LDFLAGS}
1645 suid ldflags: ${SUID_LDFLAGS}
8e5c4675 1646
0b567ae5
SK
1647 Python: ${PYTHON}
1648 Python version: ${PYTHON_VERSION}
3745d4a9
KZ
1649 Python libs: ${pyexecdir}
1650
8e5c4675 1651 Bash completions: ${with_bashcompletiondir}
4e1073c2
KZ
1652
1653 warnings:
1654
1655${WARN_CFLAGS}
1656])