]> git.ipfire.org Git - thirdparty/util-linux.git/blame - configure.ac
lib,cpuset: fix compiler warning [-Wuninitialized]
[thirdparty/util-linux.git] / configure.ac
CommitLineData
38c75b59
SK
1AC_INIT(util-linux,
2 m4_esyscmd([tools/git-version-gen .tarball-version]),
3 kzak@redhat.com)
baf39af1 4
7fc9786b 5AC_PREREQ(2.60)
48d7b13a
KZ
6
7AC_CONFIG_AUX_DIR(config)
b12991dd 8AC_CONFIG_MACRO_DIR([m4])
48d7b13a 9
488c033f 10AM_INIT_AUTOMAKE([-Wall foreign 1.10 dist-bzip2 -Wno-portability])
48d7b13a 11
eb35c251
GJ
12m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
13 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
14
48d7b13a
KZ
15AC_CONFIG_SRCDIR(mount/mount.c)
16
15a9b48c
SK
17AC_PREFIX_DEFAULT([/usr])
18
33b0be6d
KZ
19dnl version details from <major>.<minor>[-<suffix>]
20PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}')
21PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{print $2}' \
22 | awk -F- '{print $1}')
23PACKAGE_VERSION_RELEASE=0
a0948ffe 24
33b0be6d
KZ
25dnl libblkid version
26LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
60a5833b 27LIBBLKID_DATE="29-Aug-2011"
dc2b8d87
KZ
28LIBBLKID_LT_MAJOR=1
29LIBBLKID_LT_MINOR=1
30LIBBLKID_LT_MICRO=0
31LIBBLKID_VERSION_INFO=`expr $LIBBLKID_LT_MAJOR + $LIBBLKID_LT_MINOR`:$LIBBLKID_LT_MICRO:$LIBBLKID_LT_MINOR
a0948ffe 32
f6076f55
KZ
33dnl libuuid version
34LIBUUID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
dc2b8d87
KZ
35LIBUUID_LT_MAJOR=1
36LIBUUID_LT_MINOR=3
37LIBUUID_LT_MICRO=0
38LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR
f6076f55 39
f1cde479
KZ
40dnl libmount version
41LIBMOUNT_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
42LIBMOUNT_LT_MAJOR=1
43LIBMOUNT_LT_MINOR=1
44LIBMOUNT_LT_MICRO=0
45LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR
46
15a9b48c
SK
47# Check whether exec_prefix=/usr:
48case $exec_prefix:$prefix in
49NONE:NONE | NONE:/usr | /usr:*)
50 AC_MSG_NOTICE([Default --exec-prefix detected.])
51 case $bindir in
52 '${exec_prefix}/bin') bindir=/bin
53 AC_MSG_NOTICE([ --bindir defaults to /bin]) ;;
54 esac
55 case $sbindir in
56 '${exec_prefix}/sbin') sbindir=/sbin
57 AC_MSG_NOTICE([ --sbindir defaults to /sbin]) ;;
971f57f6
KZ
58 esac
59 case $libdir in
60 '${exec_prefix}/lib') libdir=/lib
61 AC_MSG_NOTICE([ --libdir defaults to /lib]) ;;
15a9b48c
SK
62 esac ;;
63esac
48d7b13a 64
cb5212e2 65libdirname=`basename "$libdir"`
b0a0d7d5
KZ
66AC_SUBST([libdirname])
67
996fb358 68# The original default values of {bin,sbin,lib}dir
aaf3e8f5 69usrbin_execdir='${exec_prefix}/bin'
30688dde 70AC_SUBST([usrbin_execdir])
996fb358 71
aaf3e8f5 72usrsbin_execdir='${exec_prefix}/sbin'
30688dde 73AC_SUBST([usrsbin_execdir])
996fb358 74
aaf3e8f5 75usrlib_execdir='${exec_prefix}/'$libdirname
30688dde 76AC_SUBST([usrlib_execdir])
996fb358 77
31c9c1c4 78AM_PROG_CC_C_O
48d7b13a 79AC_PROG_CC_STDC
240f7101 80AC_GNU_SOURCE
a6996860 81AC_CANONICAL_HOST
85b4c147 82AC_C_CONST
e79829db 83AC_C_VOLATILE
fbaec83b 84AC_C_BIGENDIAN
b12991dd
KZ
85
86dnl libtool-2
87LT_INIT
48d7b13a 88
fd0f4132
SK
89m4_ifndef([PKG_PROG_PKG_CONFIG],
90 [m4_fatal([Could not locate the pkg-config autoconf
91 macros. These are usually located in /usr/share/aclocal/pkg.m4.
92 If your macros are in a different location, try setting the
93 environment variable AL_OPTS="-I/other/macro/dir" before running
94 ./autogen.sh or autoreconf again.])])
d06d028a
KZ
95PKG_PROG_PKG_CONFIG
96
22aa5166
KZ
97GTK_DOC_CHECK([1.10])
98AC_PATH_PROG([XSLTPROC], [xsltproc])
99
8c182554
KZ
100linux_os=no
101case ${host_os} in
102 *linux*)
103 linux_os=yes
104 ;;
105esac
49ccbae6 106AM_CONDITIONAL([LINUX], test "x$linux_os" = xyes)
8c182554 107
48d7b13a
KZ
108AC_PATH_PROG(PERL, perl)
109
110AC_SYS_LARGEFILE
111
e460a5bf 112AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
48d7b13a
KZ
113#ifdef HAVE_LINUX_COMPILER_H
114#include <linux/compiler.h>
115#endif
116])
bf962c0a 117AC_CHECK_HEADERS(
a0948ffe
KZ
118 [err.h \
119 errno.h \
120 getopt.h \
a0948ffe
KZ
121 linux/fd.h \
122 linux/tiocl.h \
123 linux/version.h \
b832c2fe 124 linux/falloc.h \
55113b15 125 linux/cdrom.h \
b832c2fe 126 fcntl.h \
8b7f16fc 127 locale.h \
754fed0c
KZ
128 stdint.h \
129 inttypes.h \
0bf9d41d 130 paths.h \
a0948ffe 131 pty.h \
607c2a72 132 mntent.h \
754fed0c
KZ
133 net/if.h \
134 net/if_dl.h \
135 netinet/in.h \
bf962c0a 136 rpcsvc/nfs_prot.h \
a0948ffe 137 stdlib.h \
363ce071 138 asm/io.h \
a0948ffe
KZ
139 sys/disk.h \
140 sys/disklabel.h \
141 sys/ioctl.h \
3edaa201 142 sys/ioccom.h \
bf962c0a 143 sys/io.h \
754fed0c 144 sys/time.h \
a0948ffe
KZ
145 sys/mkdev.h \
146 sys/prctl.h \
147 sys/queue.h \
754fed0c 148 sys/sockio.h \
2a7c1f70
KZ
149 sys/socket.h \
150 sys/syscall.h \
754fed0c
KZ
151 sys/file.h \
152 sys/ioctl.h \
a0948ffe
KZ
153 sys/stat.h \
154 sys/types.h \
754fed0c 155 sys/un.h \
a0948ffe 156 sys/user.h \
754fed0c 157 sys/resource.h \
a0948ffe 158 unistd.h ])
dc61d398 159
fd67be31
SK
160AC_CHECK_HEADERS([linux/raw.h],
161 [AM_CONDITIONAL([HAVE_RAW], [true])],
162 [AM_CONDITIONAL([HAVE_RAW], [false])])
48d7b13a 163
dc61d398
KZ
164AC_CHECK_HEADERS([langinfo.h],
165 [AM_CONDITIONAL([HAVE_LANGINFO], [true])],
166 [AM_CONDITIONAL([HAVE_LANGINFO], [false])])
167
168
a88057d9
TP
169AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
170
2a7c1f70
KZ
171AC_CHECK_DECL([llseek],
172 [AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1,
173 [Define to 1 if have llseek prototype])],
174 [],
175 [#include <unistd.h>])
176
177AC_CHECK_DECL([lseek64],
178 [AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
179 [Define to 1 if have lseek64 prototype])],
180 [],
181 [#define _LARGEFILE_SOURCE
182 #define _LARGEFILE64_SOURCE
183 #include <unistd.h>])
184
bf962c0a
SK
185AC_CHECK_FUNCS(
186 [inet_aton \
eb76ca98
FG
187 err \
188 errx \
b7ce600d 189 futimens \
2a7c1f70 190 fstat64 \
bf962c0a
SK
191 fsync \
192 getdomainname \
e27a08ab 193 get_current_dir_name \
437fa54f 194 usleep \
bf962c0a
SK
195 nanosleep \
196 personality \
197 updwtmp \
3ac22f7a 198 jrand48 \
bf962c0a 199 lchown \
a0948ffe
KZ
200 llseek \
201 lseek64 \
202 strtoull \
754fed0c
KZ
203 sysconf \
204 getdtablesize \
a804f444 205 getexecname \
754fed0c 206 getrlimit \
a1504d8b 207 sigqueue \
754fed0c 208 srandom \
69045d3d
KZ
209 setresgid \
210 setresuid \
69b7e41e
KZ
211 strndup \
212 strnlen \
213 strnchr \
fc7aeb09 214 inotify_init \
a0948ffe 215 prctl \
a67bb3bf 216 posix_fadvise \
acf6ab6f 217 getmntinfo \
a0948ffe 218 __secure_getenv \
eb76ca98
FG
219 warn \
220 warnx \
bf962c0a 221 rpmatch])
48d7b13a 222AC_FUNC_FSEEKO
48d7b13a 223
940fd28c
KZ
224AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
225
465e9973
ST
226AC_CHECK_FUNCS([ioperm iopl], [have_io=yes])
227AM_CONDITIONAL([BUILD_HWCLOCK], test "x$have_io" = xyes -o "x$linux_os" = xyes)
228
754fed0c
KZ
229AC_CHECK_MEMBER(struct sockaddr.sa_len,
230 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
231 [#include <sys/types.h>
232 #include <sys/socket.h>])
233
60cc9f94
FG
234SOCKET_LIBS=
235AC_SEARCH_LIBS([gethostbyname], [nsl],
236 [if test x"$ac_cv_search_gethostbyname" != x"none required"; then
237 SOCKET_LIBS="$SOCKET_LIBS -lnsl";
238 fi])
239AC_SEARCH_LIBS([socket], [socket],
240 [if test x"$ac_cv_search_socket" != x"none required"; then
241 SOCKET_LIBS="$SOCKET_LIBS -lsocket";
242 fi])
243AC_SUBST([SOCKET_LIBS])
244
d58c47d9
FG
245
246have_dirfd=no
247AC_CHECK_FUNCS([dirfd], [have_dirfd=yes], [have_dirfd=no])
248if test x"$have_dirfd" = xno ; then
249 AC_CHECK_DECLS([dirfd],
250 [have_dirfd=yes], [have_dirfd=no],
251 [#include <sys/types.h>
252 #include <dirent.h>])
253fi
254
255have_ddfd=no
256if test x"$have_dirfd" = xno ; then
257 AC_CHECK_MEMBERS([DIR.dd_fd],
258 [have_ddfd=yes], [have_ddfd=no],
259 [#include <sys/types.h>
260 #include <dirent.h>])
261fi
262
263case "$have_dirfd:$have_ddfd" in
264no:no)
265 AC_MSG_ERROR([cannot find a method to get filedescriptor of directory]) ;;
266esac
267
268
a804f444
FG
269AC_MSG_CHECKING(whether program_invocation_short_name is defined)
270AC_TRY_COMPILE([#include <argp.h>],
271 [program_invocation_short_name = "test";],
272 AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1,
273 [Define if program_invocation_short_name is defined])
274 AC_MSG_RESULT(yes),
275 AC_MSG_RESULT(no))
276
277AC_MSG_CHECKING([whether __progname is defined])
278AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
279 [if (*__progname == 0) return;])],
280 AC_DEFINE(HAVE___PROGNAME, 1, [Define if __progname is defined])
281 AC_MSG_RESULT(yes),
282 AC_MSG_RESULT(no))
283
8569410c 284dnl Static compilation
642f01a3 285m4_define([UTIL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid])
8569410c
SK
286
287AC_ARG_ENABLE([static-programs],
288 [AS_HELP_STRING([--enable-static-programs=LIST],
289 [link static the programs in LIST (comma-separated,
290 supported for ]m4_defn([UTIL_STATIC_PROGRAMS])[)])])
291
292case $enable_static_programs in
293yes) enable_static_programs=m4_quote(UTIL_STATIC_PROGRAMS) ;;
294no) enable_static_programs= ;;
295esac
296
8569410c
SK
297dnl Set all the individual AM_CONDITIONALs
298m4_foreach([UTIL_PRG], m4_defn([UTIL_STATIC_PROGRAMS]), [
299 case ,$enable_static_programs, in
300 *,UTIL_PRG,*) static_[]UTIL_PRG=yes ;;
301 esac
302 AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UTIL_PRG),
49ccbae6 303 [test "x$static_[]UTIL_PRG" = xyes])
8569410c
SK
304])
305
f910b559
KZ
306dnl UTIL_PKG_STATIC(VARIABLE, MODULES)
307dnl ----------------------------------
308AC_DEFUN([UTIL_PKG_STATIC], [
309 if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then
310 $1=`pkg-config --libs --static "$2"`
311 else
312 AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
313 fi
314])
315
40cc242e
KZ
316dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1]))
317dnl The VARSUFFIX is optional and overrides the default behaviour. For example:
318dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX
319dnl UTIL_CHECK_LIB(yyy, func) generates have_yyy and HAVE_LIBYYY
fd67be31
SK
320dnl ---------------------------------
321AC_DEFUN([UTIL_CHECK_LIB], [
40cc242e
KZ
322 m4_define([suffix], m4_default([$3],$1))
323 [have_]suffix=yes
324 m4_ifdef([$3],
325 [AC_CHECK_LIB([$1], [$2], [AC_DEFINE(AS_TR_CPP([HAVE_LIB]suffix), 1)], [[have_]suffix=no])],
326 [AC_CHECK_LIB([$1], [$2], [], [[have_]suffix=no])])
327 AM_CONDITIONAL(AS_TR_CPP([HAVE_]suffix), [test [$have_]suffix = yes])
fd67be31 328])
9dc801d2 329
6fed18f2
KZ
330dnl UTIL_SET_FLAGS(CFLAGS, CPPFLAGS, LDFLAGS)
331AC_DEFUN([UTIL_SET_FLAGS], [
332 old_CFLAGS="$CFLAGS"
333 old_CPPFLAGS="$CPPFLAGS"
334 old_LDFLAGS="$LDFLAGS"
335 CFLAGS="$CFLAGS $1"
336 CPPFLAGS="$CPPFLAGS $2"
337 LDFLAGS="$LDFLAGS $3"
338])
339
340dnl UTIL_RESTORE_FLAGS()
341AC_DEFUN([UTIL_RESTORE_FLAGS], [
342 CFLAGS="$old_CFLAGS"
343 CPPFLAGS="$old_CPPFLAGS"
344 LDFLAGS="$old_LDFLAGS"
345])
346
347
d7a01582 348AX_CHECK_TLS
3ac22f7a 349
f910b559
KZ
350AC_ARG_ENABLE([mount],
351 AS_HELP_STRING([--disable-mount], [do not build mount utilities]),
352 [], enable_mount=check
353)
354build_mount=yes
355if test "x$enable_mount" = xcheck; then
356 if test "x$linux_os" = xno; then
357 AC_MSG_WARN([non-linux system; do not build mount utilities])
358 build_mount=no
359 fi
360elif test "x$enable_mount" = xno; then
361 build_mount=no
362fi
363AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes)
364
365
366AC_ARG_ENABLE([fsck],
6c2a09b3
KZ
367 AS_HELP_STRING([--disable-fsck], [do not build fsck]),
368 [], enable_fsck=yes
f910b559
KZ
369)
370AM_CONDITIONAL(BUILD_FSCK, test "x$enable_fsck" = xyes)
371
372
b98ae9c2 373AC_ARG_ENABLE([partx],
2023ccc4 374 AS_HELP_STRING([--disable-partx], [do not build addpart, delpart, partx]),
b98ae9c2
KZ
375 [], enable_partx=check
376)
377build_partx=yes
378if test "x$enable_partx" = xcheck; then
379 if test "x$linux_os" = xno; then
380 AC_MSG_WARN([non-linux system; do not build partx utilities])
381 build_partx=no
382 fi
383elif test "x$enable_partx" = xno; then
384 build_partx=no
385fi
386AM_CONDITIONAL(BUILD_PARTX, test "x$build_partx" = xyes)
387
388
17afb032
KZ
389AC_ARG_ENABLE([libuuid],
390 AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]),
391 [], enable_libuuid=yes
392)
dc2b8d87
KZ
393AC_SUBST([LIBUUID_VERSION])
394AC_SUBST([LIBUUID_VERSION_INFO])
17afb032 395AM_CONDITIONAL(BUILD_LIBUUID, test "x$enable_libuuid" = xyes)
9dc801d2 396
403e2d0c 397if test "x$enable_libuuid" = xyes; then
17afb032
KZ
398 AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.])
399else
400 AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
401fi
48d7b13a 402
d06d028a 403
2ec884ac
KZ
404AC_ARG_ENABLE([uuidd],
405 AS_HELP_STRING([--disable-uuidd], [do not build the uuid daemon]),
406 [], enable_uuidd=auto
407)
408
e6adc771 409case "$enable_uuidd:$enable_libuuid" in
2ec884ac
KZ
410yes:no)
411 AC_MSG_ERROR([cannot enable uuidd when libuuid is disabled]) ;;
412auto:*)
e6adc771 413 enable_uuidd=$enable_libuuid ;;
2ec884ac
KZ
414esac
415if test "x$enable_uuidd" = xyes; then
416 AC_DEFINE(HAVE_UUIDD, 1, [Define to 1 if you want to use uuid daemon.])
417fi
418AM_CONDITIONAL(BUILD_UUIDD, test "x$enable_uuidd" = xyes)
419
420
f910b559
KZ
421AC_ARG_ENABLE([libblkid],
422 AS_HELP_STRING([--disable-libblkid], [do not build libblkid and blkid utilities]),
423 [], enable_libblkid=yes
40f07ff7 424)
033cf439 425AC_SUBST([LIBBLKID_DATE])
dc2b8d87
KZ
426AC_SUBST([LIBBLKID_VERSION])
427AC_SUBST([LIBBLKID_VERSION_INFO])
f910b559
KZ
428AM_CONDITIONAL(BUILD_LIBBLKID, test "x$enable_libblkid" = xyes)
429AC_DEFINE_UNQUOTED(LIBBLKID_VERSION, "$LIBBLKID_VERSION", [libblkid version string])
430AC_DEFINE_UNQUOTED(LIBBLKID_DATE, "$LIBBLKID_DATE", [libblkid date string])
b446754d 431
b1ef3ad6 432if test "x$enable_libblkid" = xyes; then
d06d028a 433 AC_DEFINE(HAVE_LIBBLKID, 1, [Define to 1 if you have the -lblkid.])
7177d32e 434else
f910b559 435 if test "x$build_mount" = xyes; then
601d12fb 436 AC_MSG_ERROR([libblkid is needed to build util-linux mount])
607c2a72 437 fi
f910b559 438 if test "x$enable_fsck" = xyes; then
601d12fb 439 AC_MSG_ERROR([libblkid is needed to build util-linux fsck])
64754af9 440 fi
b98ae9c2
KZ
441 if test "x$build_partx" = xyes; then
442 AC_MSG_ERROR([libblkid is needed to build util-linux partx])
443 fi
64754af9 444fi
f910b559 445
f1cde479
KZ
446
447AC_ARG_ENABLE([libmount],
448 AS_HELP_STRING([--disable-libmount], [do not build libmount]),
a2b3d040 449 [], enable_libmount=check
f1cde479 450)
a2b3d040
KZ
451build_libmount=yes
452if test "x$enable_libmount" = xcheck; then
453 if test "x$linux_os" = xno; then
454 AC_MSG_WARN([non-linux system; do not build libmount])
455 build_libmount=no
456 fi
457elif test "x$enable_libmount" = xno; then
458 build_libmount=no
459fi
8e368761 460
a2b3d040 461case "$enable_libblkid:$build_libmount" in
8e368761
KZ
462no:yes)
463 AC_MSG_ERROR([cannot enable libmount when libblkid is disabled]) ;;
464esac
465
f1cde479
KZ
466AC_SUBST([LIBMOUNT_VERSION])
467AC_SUBST([LIBMOUNT_VERSION_INFO])
f4ab4ae8 468AC_DEFINE_UNQUOTED(LIBMOUNT_VERSION, "$LIBMOUNT_VERSION", [libmount version string])
a2b3d040 469AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_libmount" = xyes)
f1cde479
KZ
470
471
37ef0439
KZ
472AC_ARG_ENABLE([libmount-mount],
473 AS_HELP_STRING([--enable-libmount-mount], [link mount(8) with libmount (EXPERIMENTAL)]),
474 [], enable_libmount_mount=no
475)
476
a2b3d040 477case "$build_libmount:$enable_libmount_mount" in
37ef0439
KZ
478no:yes)
479 AC_MSG_ERROR([cannot link mount(8) with libmount when libmount is disabled]) ;;
480yes:yes)
481 AC_DEFINE(HAVE_LIBMOUNT_MOUNT, 1, [use libmount for mount(8)])
482esac
483AM_CONDITIONAL(BUILD_LIBMOUNT_MOUNT, test "x$enable_libmount_mount" = xyes)
484
485
0164c245 486AC_ARG_ENABLE([mountpoint],
2023ccc4 487 AS_HELP_STRING([--disable-mountpoint], [do not build mountpoint]),
3d92ed40 488 [], enable_mountpoint=check
0164c245 489)
3d92ed40
KZ
490
491build_mountpoint=yes
492if test "x$enable_mountpoint" = xcheck; then
493 if test "x$build_libmount" = xno; then
494 AC_MSG_WARN([libmount disabled; do not build mountpoint])
495 build_mountpoint=no
496 fi
497elif test "x$enable_mountpoint" = xno; then
498 build_mountpoint=no
499fi
500
501case "$build_libmount:$build_mountpoint" in
0164c245
KZ
502no:yes)
503 AC_MSG_ERROR([cannot enable mountpoint when libmount is disabled]) ;;
504esac
3d92ed40 505AM_CONDITIONAL(BUILD_MOUNTPOINT, test "x$build_mountpoint" = xyes)
0164c245
KZ
506
507
17afb032
KZ
508UTIL_CHECK_LIB(util, openpty)
509UTIL_CHECK_LIB(termcap, tgetnum)
8569410c 510
8eeb575c 511AM_GNU_GETTEXT_VERSION([0.14.1])
48d7b13a 512AM_GNU_GETTEXT([external])
49ccbae6 513if test -d "$srcdir/po"
8eeb575c 514then
1b4a3d89 515 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
8eeb575c
KZ
516else
517 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"
518fi
48d7b13a 519
08d64aa2
KZ
520AC_ARG_WITH([ncurses],
521 AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
522 (--without-ncurses disables all ncurses(w) support)]),
523 [], with_ncurses=auto
524)
525AM_CONDITIONAL(HAVE_NCURSES, false)
526
527if test "x$with_ncurses" != xno; then
528 have_ncurses=no
529 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
530 if test "x$with_ncurses" = xauto; then
9ea8ac37 531 UTIL_CHECK_LIB(ncursesw, initscr, ncurses)
08d64aa2 532 if test "x$have_ncurses" = xyes; then
30c97bb8 533 AC_CHECK_HEADERS([ncursesw/ncurses.h])
08d64aa2
KZ
534 NCURSES_LIBS="-lncursesw"
535 fi
536 fi
49ccbae6 537 if test "x$have_ncurses" = xno; then
9ea8ac37 538 UTIL_CHECK_LIB(ncurses, initscr)
49ccbae6 539 if test "x$have_ncurses" = xyes; then
08d64aa2
KZ
540 NCURSES_LIBS="-lncurses"
541 fi
542 fi
543 ])
49ccbae6 544 if test "x$have_ncurses" = xno; then
08d64aa2
KZ
545 AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
546 fi
547fi
548AC_SUBST([NCURSES_LIBS])
549
48d7b13a 550
48d7b13a 551AC_ARG_WITH([slang],
7fa4f112 552 AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
271d98e0 553 [], with_slang=no
48d7b13a
KZ
554)
555
46e71118
AM
556have_tinfo=no
557AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes])
49ccbae6 558AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes)
46e71118 559
fd67be31 560use_slang=no
49ccbae6 561if test "x$with_slang" = xyes; then
965b4900
KZ
562 AC_CHECK_HEADERS([slang.h slang/slang.h])
563 AC_CHECK_HEADERS([slcurses.h slang/slcurses.h],
564 [use_slang=yes], [], [
565#ifdef HAVE_SLANG_H
566#include <slang.h>
567#elif defined(HAVE_SLANG_SLANG_H)
568#include <slang/slang.h>
569#endif
570])
49ccbae6 571 if test "x$use_slang" = xno; then
48d7b13a
KZ
572 AC_MSG_ERROR([slang selected but slcurses.h not found])
573 fi
574fi
49ccbae6 575AM_CONDITIONAL(USE_SLANG, test "x$use_slang" = xyes)
48d7b13a
KZ
576
577
f0bc3fa0
KZ
578AC_ARG_WITH([utempter],
579 AS_HELP_STRING([--with-utempter], [compile script(1) with libutempter]),
580 [], with_utempter=no
581)
582
583if test "x$with_utempter" = xyes; then
584 UTIL_CHECK_LIB(utempter, utempter_add_record)
585 if test "x$have_utempter" = xno; then
586 AC_MSG_ERROR([utempter selected but libutempter not found])
587 fi
588else
589 AM_CONDITIONAL(HAVE_UTEMPTER, false)
590fi
591
0aeb57ac
FG
592# on Solaris, you can't mix and match standards, since we use c99
593# aparently at this stage, XOPEN_SOURCE will conflict. As workaround,
594# check for crypt.h and use that without XOPEN_SOURCE.
595AC_CHECK_HEADERS([crypt.h])
cf002530 596AC_LINK_IFELSE([AC_LANG_PROGRAM([[
0aeb57ac
FG
597#ifdef HAVE_CRYPT_H
598#include <crypt.h>
599#else
48d7b13a
KZ
600#define _XOPEN_SOURCE
601#include <unistd.h>
0aeb57ac 602#endif
cf002530 603]], [[
48d7b13a 604char *c = crypt("abc","pw");
cf002530 605]])],[],[
48d7b13a 606 LIBS="$LIBS -lcrypt"
cf002530 607 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
0aeb57ac
FG
608 #ifdef HAVE_CRYPT_H
609 #include <crypt.h>
610 #else
48d7b13a
KZ
611 #define _XOPEN_SOURCE
612 #include <unistd.h>
0aeb57ac 613 #endif
cf002530 614 ]], [[
48d7b13a 615 char *c = crypt("abc","pw");
cf002530 616 ]])],[
48d7b13a
KZ
617 AC_DEFINE(NEED_LIBCRYPT, 1, [Do we need -lcrypt?])
618 need_libcrypt=yes
619 ],[
620 AC_MSG_ERROR([crypt() is not available])
621 ])
48d7b13a
KZ
622])
623
49ccbae6 624AM_CONDITIONAL(NEED_LIBCRYPT, test "x$need_libcrypt" = xyes)
48d7b13a 625
869829e4
GJ
626AC_CHECK_TYPES([union semun], [], [], [[
627#include <sys/sem.h>
628]])
5be1c033 629AC_CHECK_TYPES(loff_t)
869829e4
GJ
630
631
cf002530 632AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
633#include <wchar.h>
634#include <wctype.h>
635#include <stdio.h>
cf002530 636]], [[
48d7b13a
KZ
637 wchar_t wc;
638 wint_t w;
639 w = fgetwc(stdin);
640 if (w == WEOF) exit(1);
641 wc = w;
642 fputwc(wc,stdout);
cf002530
SK
643]])],
644[AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?)
645])
48d7b13a
KZ
646
647
72065909
MF
648dnl UTIL_CHECK_SYSCALL(SYSCALL, FALLBACK, ...)
649dnl Only specify FALLBACK if the SYSCALL
650dnl you're checking for is a "newish" one
651dnl -------------------------------------
652AC_DEFUN([UTIL_CHECK_SYSCALL], [
653 dnl This macro uses host_cpu.
654 AC_REQUIRE([AC_CANONICAL_HOST])
655 AC_CACHE_CHECK([for syscall $1],
656 [util_cv_syscall_$1],
657 [_UTIL_SYSCALL_CHECK_DECL([SYS_$1],
658 [syscall=SYS_$1],
659 [dnl Our libc failed use, so see if we can get the kernel
660 dnl headers to play ball ...
661 _UTIL_SYSCALL_CHECK_DECL([_NR_$1],
662 [syscall=_NR_$1],
663 [
664 syscall=no
49ccbae6 665 if test "x$linux_os" = xyes; then
8c182554
KZ
666 case $host_cpu in
667 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shift($@))
668 esac
669 fi
72065909
MF
670 ])
671 ])
672 util_cv_syscall_$1=$syscall
673 ])
49ccbae6 674 AM_CONDITIONAL([HAVE_]m4_toupper($1), [test "x$util_cv_syscall_$1" != xno])
72065909
MF
675 case $util_cv_syscall_$1 in #(
676 no) AC_MSG_WARN([Unable to detect syscall $1.]) ;;
677 SYS_*) ;;
678 *) AC_DEFINE_UNQUOTED([SYS_$1], [$util_cv_syscall_$1],
679 [Fallback syscall number for $1]) ;;
680 esac
681])
682
683dnl _UTIL_SYSCALL_CHECK_DECL(SYMBOL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
684dnl Check if SYMBOL is declared, using the headers needed for syscall checks.
685dnl -------------------------------------
686m4_define([_UTIL_SYSCALL_CHECK_DECL],
687[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
688#include <sys/syscall.h>
689#include <unistd.h>
72065909
MF
690]], [[int test = $1;]])],
691[$2], [$3])
692])
48d7b13a 693
72065909
MF
694dnl _UTIL_CHECK_SYSCALL_FALLBACK(PATTERN, VALUE, ...)
695dnl Helper macro to create the body for the above `case'.
696dnl -------------------------------------
697m4_define([_UTIL_CHECK_SYSCALL_FALLBACK],
698[m4_ifval([$1],
699 [#(
700 $1) syscall="$2" ;;dnl
701 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shiftn(2, $@))])dnl
702])
48d7b13a 703
72065909
MF
704
705UTIL_CHECK_SYSCALL([pivot_root])
706UTIL_CHECK_SYSCALL([sched_getaffinity])
707UTIL_CHECK_SYSCALL([ioprio_set],
708 [alpha], [442],
709 [i*86], [289],
710 [ia64*], [1274],
711 [powerpc*], [273],
712 [s390*], [282],
713 [sparc*], [196],
447ae7b8 714 [sh*], [288],
72065909
MF
715 [x86_64*], [251])
716UTIL_CHECK_SYSCALL([ioprio_get],
717 [alpha], [443],
718 [i*86], [290],
719 [ia64*], [1275],
720 [powerpc*], [274],
721 [s390*], [283],
722 [sparc*], [218],
447ae7b8 723 [sh*], [289],
72065909 724 [x86_64*], [252])
19a224ad 725
d46a5499
KZ
726dnl fallocate could be available as libc function or as syscall only
727UTIL_CHECK_SYSCALL([fallocate])
b832c2fe
YD
728
729dnl check for valid fallocate() function
730dnl with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
731dnl when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
732dnl and program can't be linked.
733dnl AC_CHECK_FUNC can't catch such errors since it's redefining
734dnl function prototype.
735AC_MSG_CHECKING([for valid fallocate() function])
736AC_LINK_IFELSE([
737AC_LANG_PROGRAM([[
738#ifdef HAVE_UNISTD_H
739# include <unistd.h>
740#endif
741#ifdef HAVE_SYS_TYPES_H
742# include <sys/types.h>
743#endif
744#ifdef HAVE_LINUX_FALLOC_H
745# include <linux/falloc.h>
746#endif
747#ifdef HAVE_FCNTL_H
748# include <fcntl.h>
749#endif
750]],[[
751 long ret;
752
753 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
754
755 if (ret != 0) {
756 return 1;
757 }
758 ]])],[
759AC_MSG_RESULT([yes])
760AC_DEFINE(HAVE_FALLOCATE,1,[Have valid fallocate() function])],[
761AC_MSG_RESULT([no])])
19a224ad 762
4205f1fd
MG
763dnl unshare could be available as libc function or as syscall only
764UTIL_CHECK_SYSCALL([unshare])
765AC_CHECK_FUNCS([unshare])
766
cf002530 767AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
768#include <time.h>
769#include <unistd.h>
cf002530 770]], [[
48d7b13a
KZ
771 int a = 0;
772 struct tm *tm = localtime(0);
773 if (a == -1) /* false */
774 sleep(tm->tm_gmtoff);
cf002530
SK
775]])],
776[AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?])
777])
48d7b13a 778
30e8b186
KZ
779AC_CHECK_MEMBERS([struct termios.c_line],,,
780 [[#include <termios.h>]])
781
6c2f2b9d
KZ
782AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
783 [#include <sys/stat.h>])
784
2d281745 785AC_CHECK_DECLS([
70eebc40 786 UNAME26,
2d281745
KZ
787 ADDR_NO_RANDOMIZE,
788 FDPIC_FUNCPTRS,
789 MMAP_PAGE_ZERO,
790 ADDR_COMPAT_LAYOUT,
791 READ_IMPLIES_EXEC,
792 ADDR_LIMIT_32BIT,
793 WHOLE_SECONDS,
794 STICKY_TIMEOUTS,
795 ADDR_LIMIT_3GB], [], [], [#include <linux/personality.h>])
48d7b13a 796
22d36665 797AC_CHECK_HEADERS([sys/swap.h])
b3425806
SK
798
799AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
800[[
b3425806
SK
801#ifdef HAVE_SYS_SWAP_H
802# include <sys/swap.h>
803#endif
804#include <unistd.h>
805]],
806[[swapon("/dev/null", 0);]])],
807[AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
808],
809[AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
810])
811
812
ee32c514
KZ
813AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
814#include <sched.h>
815]])
816
817AM_CONDITIONAL(HAVE_CPU_SET_T, [test "x$have_cpu_set_t" = xyes])
818
819AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
820#include <sched.h>
821]])
822
823
e782f1d4
KZ
824dnl UTIL_SET_ARCH(ARCHNAME, PATTERN)
825dnl ---------------------------------
826AC_DEFUN([UTIL_SET_ARCH], [
827 cpu_$1=false
828 case "$host" in
829 $2) cpu_$1=true ;;
830 esac
49ccbae6 831 AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test "x$cpu_$1" = xtrue])
e782f1d4 832])
48d7b13a 833
e782f1d4
KZ
834UTIL_SET_ARCH(I86, i?86-*)
835UTIL_SET_ARCH(86_64, x86_64*)
836UTIL_SET_ARCH(IA64, ia64*)
837UTIL_SET_ARCH(S390, s390*)
838UTIL_SET_ARCH(SPARC, sparc*)
839UTIL_SET_ARCH(PPC, ppc*|powerpc*)
840UTIL_SET_ARCH(M68K, m68*)
841UTIL_SET_ARCH(MIPS, mips*)
eeadb4f4 842UTIL_SET_ARCH(HPPA, hppa*)
48d7b13a 843
6a97809b
KZ
844AC_ARG_ENABLE([arch],
845 AS_HELP_STRING([--enable-arch], [do build arch]),
846 [], enable_arch=no
847)
49ccbae6 848AM_CONDITIONAL(BUILD_ARCH, test "x$enable_arch" = xyes)
48d7b13a 849
4a8962f3
KZ
850AC_ARG_ENABLE([ddate],
851 AS_HELP_STRING([--enable-ddate], [do build ddate]),
852 [], enable_date=no
853)
854AM_CONDITIONAL(BUILD_DDATE, test "x$enable_ddate" = xyes)
855
48d7b13a 856AC_ARG_ENABLE([agetty],
7fa4f112 857 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
271d98e0 858 [], enable_agetty=yes
48d7b13a 859)
49ccbae6 860AM_CONDITIONAL(BUILD_AGETTY, test "x$enable_agetty" = xyes)
48d7b13a 861
9cb68977 862AC_ARG_ENABLE([cramfs],
7fa4f112 863 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
271d98e0 864 [], enable_cramfs=check
9cb68977
KZ
865)
866
49ccbae6 867if test "x$enable_cramfs" = xno; then
fd67be31
SK
868 build_cramfs=no
869else
870 build_cramfs=yes
871 dnl Trick: leave the third parameter empty to get the default action.
872 AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
873 case $enable_cramfs:$build_cramfs in
874 yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
875 esac
9cb68977 876fi
49ccbae6 877AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
9cb68977 878
7f7126d7
KZ
879build_lsblk=yes
880if test "x$have_openat" = xno; then
881 AC_MSG_WARN([openat() function not found; do not build lsblk])
882 build_lsblk=no
b875d536 883elif test "x$linux_os" = xno; then
7f7126d7
KZ
884 AC_MSG_WARN([non-linux system; do not build lsblk])
885 build_lsblk=no
886fi
887AM_CONDITIONAL(BUILD_LSBLK, test "x$build_lsblk" = xyes)
9cb68977 888
bd671347
KZ
889AC_ARG_ENABLE([switch_root],
890 AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
940fd28c 891 [], enable_switch_root=check
bd671347 892)
940fd28c
KZ
893if test "x$enable_switch_root" = xno; then
894 build_switch_root=no
895else
896 build_switch_root=yes
897 case $enable_switch_root:$linux_os in
898 yes:no) AC_MSG_ERROR([switch_root selected for non-linux system]);;
899 check:no) AC_MSG_WARN([non-linux system; do not build switch_root])
900 build_switch_root=no;;
901 esac
902 if test "x$build_switch_root" = xyes; then
903 case $enable_switch_root:$have_openat in
904 yes:no) AC_MSG_ERROR([switch_root selected but openat() function not found]);;
905 check:no) AC_MSG_WARN([openat() function not found; do not build switch_root])
906 build_switch_root=no;;
907 esac
908 fi
909fi
910AM_CONDITIONAL(BUILD_SWITCH_ROOT, test "x$build_switch_root" = xyes)
bd671347
KZ
911
912
11125e7a
KZ
913AC_ARG_ENABLE([pivot_root],
914 AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
915 [], enable_pivot_root=check
916)
917if test "x$enable_pivot_root" = xno; then
918 build_pivot_root=no
919else
920 build_pivot_root=yes
921 case $enable_pivot_root:$linux_os in
922 yes:no) AC_MSG_ERROR([pivot_root selected for non-linux system]);;
923 check:no) AC_MSG_WARN([non-linux system; do not build pivot_root])
924 build_pivot_root=no;;
925 esac
926 if test "x$build_pivot_root" = xyes; then
927 case $enable_pivot_root:$util_cv_syscall_pivot_root in
928 yes:no) AC_MSG_ERROR([pivot_root selected but pivot_root syscall not found]);;
929 check:no) AC_MSG_WARN([pivot_root syscall not found; do not build pivot_root])
930 build_pivot_root=no;;
931 esac
932 fi
933fi
4a2ecf0a 934AM_CONDITIONAL(BUILD_PIVOT_ROOT, test "x$build_pivot_root" = xyes)
11125e7a
KZ
935
936
937AC_ARG_ENABLE([fallocate],
938 AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
939 [], enable_fallocate=check
940)
941if test "x$enable_fallocate" = xno; then
942 build_fallocate=no
943else
944 build_fallocate=yes
945 case $enable_fallocate:$linux_os in
946 yes:no) AC_MSG_ERROR([fallocate selected for non-linux system]);;
947 check:no) AC_MSG_WARN([non-linux system; do not build fallocate])
948 build_fallocate=no;;
949 esac
950 if test "x$build_fallocate" = xyes; then
951 case $enable_fallocate:$util_cv_syscall_fallocate in
952 yes:no) AC_MSG_ERROR([fallocate selected but fallocate syscall not found]);;
953 check:no) AC_MSG_WARN([fallocate syscall not found; do not build fallocate])
954 build_fallocate=no;;
955 esac
956 fi
957fi
958AM_CONDITIONAL(BUILD_FALLOCATE, test "x$build_fallocate" = xyes)
959
960
961AC_ARG_ENABLE([unshare],
962 AS_HELP_STRING([--disable-unshare], [do not build unshare]),
963 [], enable_unshare=check
964)
965if test "x$enable_unshare" = xno; then
966 build_unshare=no
967else
968 build_unshare=yes
969 case $enable_unshare:$linux_os in
970 yes:no) AC_MSG_ERROR([unshare selected for non-linux system]);;
971 check:no) AC_MSG_WARN([non-linux system; do not build unshare])
972 build_unshare=no;;
973 esac
974 if test "x$build_unshare" = xyes; then
975 case $enable_unshare:$util_cv_syscall_unshare in
976 yes:no) AC_MSG_ERROR([unshare selected but unshare syscall not found]);;
977 check:no) AC_MSG_WARN([unshare syscall not found; do not build unshare])
978 build_unshare=no;;
979 esac
980 fi
981fi
982AM_CONDITIONAL(BUILD_UNSHARE, test "x$build_unshare" = xyes)
983
984
985
48d7b13a 986AC_ARG_ENABLE([elvtune],
7fa4f112 987 AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
271d98e0 988 [], enable_elvtune=no
48d7b13a 989)
49ccbae6 990AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes)
48d7b13a 991
48d7b13a 992AC_ARG_ENABLE([kill],
7fa4f112 993 AS_HELP_STRING([--enable-kill], [build kill]),
271d98e0 994 [], enable_kill=no
48d7b13a 995)
49ccbae6 996AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
48d7b13a
KZ
997
998
999AC_ARG_ENABLE([last],
7fa4f112 1000 AS_HELP_STRING([--enable-last], [build last]),
271d98e0 1001 [], enable_last=no
48d7b13a 1002)
49ccbae6 1003AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes)
48d7b13a 1004
c135a8bd
SK
1005AC_ARG_ENABLE([line],
1006 AS_HELP_STRING([--enable-line], [build line]),
1007 [], enable_line=no
1008)
1009AM_CONDITIONAL(BUILD_LINE, test "x$enable_line" = xyes)
48d7b13a
KZ
1010
1011AC_ARG_ENABLE([mesg],
7fa4f112 1012 AS_HELP_STRING([--enable-mesg], [build mesg]),
271d98e0 1013 [], enable_mesg=no
48d7b13a 1014)
49ccbae6 1015AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes)
48d7b13a
KZ
1016
1017
48d7b13a 1018AC_ARG_ENABLE([raw],
7fa4f112 1019 AS_HELP_STRING([--enable-raw], [build raw]),
271d98e0 1020 [], enable_raw=no
48d7b13a 1021)
49ccbae6 1022AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes)
48d7b13a
KZ
1023
1024
48d7b13a 1025AC_ARG_ENABLE([rename],
7fa4f112 1026 AS_HELP_STRING([--disable-rename], [do not build rename]),
271d98e0 1027 [], enable_rename=yes
48d7b13a 1028)
49ccbae6 1029AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes)
48d7b13a
KZ
1030
1031
1032AC_ARG_ENABLE([reset],
7fa4f112 1033 AS_HELP_STRING([--enable-reset], [build reset]),
271d98e0 1034 [], enable_reset=no
48d7b13a 1035)
49ccbae6 1036AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes)
48d7b13a
KZ
1037
1038
1039AC_ARG_ENABLE([login-utils],
7fa4f112 1040 AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
271d98e0 1041 [], enable_login_utils=no
48d7b13a 1042)
49ccbae6 1043AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes)
48d7b13a 1044
9cb68977 1045AC_ARG_WITH([pam],
7fa4f112 1046 [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
9cb68977 1047
fd67be31 1048AM_CONDITIONAL(HAVE_PAM, false)
49ccbae6 1049if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then
fd67be31
SK
1050 AC_CHECK_HEADERS([security/pam_misc.h],
1051 [AM_CONDITIONAL(HAVE_PAM, true)],
49ccbae6 1052 [if test "x$with_pam" = xyes; then
fd67be31
SK
1053 AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
1054 fi
1055 ])
9cb68977 1056fi
9cb68977
KZ
1057
1058AC_ARG_WITH([selinux],
7fa4f112 1059 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
271d98e0 1060 [], with_selinux=no
9cb68977
KZ
1061)
1062
49ccbae6 1063if test "x$with_selinux" = xno; then
fd67be31
SK
1064 AM_CONDITIONAL(HAVE_SELINUX, false)
1065else
1066 UTIL_CHECK_LIB(selinux, getprevcon)
49ccbae6 1067 case "$with_selinux:$have_selinux" in
fd67be31
SK
1068 yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
1069 esac
9cb68977 1070fi
9cb68977 1071
49ccbae6 1072if test "x$have_selinux" = xyes; then
8569410c
SK
1073 SELINUX_LIBS="-lselinux -lsepol"
1074 SELINUX_LIBS_STATIC="-lselinux -lsepol"
28d39b6d
KZ
1075 old_LDFLAGS="$LDFLAGS"
1076 LDFLAGS="$LDFLAGS $SELINUX_LIBS"
1077 # This function is missing in old libselinux 1.xx versions
1078 AC_CHECK_FUNCS([security_get_initial_context])
1079 LDFLAGS="$old_LDFLAGS"
8569410c
SK
1080fi
1081AC_SUBST([SELINUX_LIBS])
1082AC_SUBST([SELINUX_LIBS_STATIC])
9cb68977 1083
bbae9cb0 1084AC_ARG_WITH([audit],
7fa4f112 1085 AS_HELP_STRING([--with-audit], [compile with audit support]),
271d98e0 1086 [], with_audit=no
bbae9cb0
KZ
1087)
1088
49ccbae6 1089if test "x$with_audit" = xno; then
fd67be31
SK
1090 AM_CONDITIONAL(HAVE_AUDIT, false)
1091else
1092 UTIL_CHECK_LIB(audit, audit_log_user_message)
49ccbae6 1093 case "$with_audit:$have_audit" in
fd67be31
SK
1094 yes:no)
1095 AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
1096 ;;
1097 esac
bbae9cb0 1098fi
bbae9cb0 1099
48d7b13a 1100AC_ARG_ENABLE([schedutils],
7fa4f112 1101 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
271d98e0 1102 [], enable_schedutils=yes
48d7b13a 1103)
49ccbae6 1104AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes)
48d7b13a
KZ
1105
1106
1107AC_ARG_ENABLE([wall],
7fa4f112 1108 AS_HELP_STRING([--disable-wall], [do not build wall]),
271d98e0 1109 [], enable_wall=yes
48d7b13a 1110)
49ccbae6 1111AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes)
48d7b13a
KZ
1112
1113
1114AC_ARG_ENABLE([write],
7fa4f112 1115 AS_HELP_STRING([--enable-write], [build write]),
271d98e0 1116 [], enable_write=no
48d7b13a 1117)
49ccbae6 1118AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes)
48d7b13a
KZ
1119
1120
1121AC_ARG_ENABLE([chsh-only-listed],
7fa4f112 1122 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
271d98e0 1123 [], enable_chsh_only_listed=yes
48d7b13a
KZ
1124)
1125
49ccbae6 1126if test "x$enable_chsh_only_listed" = xyes; then
48d7b13a
KZ
1127 AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
1128fi
1129
1130
1131AC_ARG_ENABLE([login-chown-vcs],
7fa4f112 1132 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
271d98e0 1133 [], enable_login_chown_vcs=no
48d7b13a
KZ
1134)
1135
49ccbae6 1136if test "x$enable_login_chown_vcs" = xyes; then
48d7b13a
KZ
1137 AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
1138fi
1139
1140
1141AC_ARG_ENABLE([login-stat-mail],
7fa4f112 1142 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
271d98e0 1143 [], enable_login_stat_mail=no
48d7b13a
KZ
1144)
1145
49ccbae6 1146if test "x$enable_login_stat_mail" = xyes; then
48d7b13a
KZ
1147 AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
1148fi
1149
1150
1151AC_ARG_ENABLE([pg-bell],
7fa4f112 1152 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
271d98e0 1153 [], enable_pg_bell=yes
48d7b13a
KZ
1154)
1155
49ccbae6 1156if test "x$enable_pg_bell" = xyes; then
48d7b13a
KZ
1157 AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
1158fi
1159
1160
1161AC_ARG_ENABLE([require-password],
7fa4f112 1162 AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
271d98e0 1163 [], enable_require_password=yes
48d7b13a
KZ
1164)
1165
49ccbae6 1166if test "x$enable_require_password" = xyes; then
48d7b13a
KZ
1167 AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
1168fi
1169
1170
bb4cb69d
MF
1171AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
1172AC_ARG_ENABLE([fs-paths-default],
1173 AS_HELP_STRING([--enable-fs-paths-default=paths], [default search path for fs helpers @<:@FS_PATHS_DEFAULT@:>@]),
1174 [case "$enableval" in
1175 yes) fs_paths_defaults="FS_PATHS_DEFAULT" ;;
1176 no) fs_paths_defaults="" ;;
1177 *) fs_paths_defaults="$enableval" ;;
1178 esac],
1179 [fs_paths_defaults="FS_PATHS_DEFAULT"]
1180)
1181AC_ARG_ENABLE([fs-paths-extra],
1182 AS_HELP_STRING([--enable-fs-paths-extra=paths], [additional search paths for fs helpers]),
1183 [case "$enableval" in
1184 yes|no) fs_paths_extra="" ;;
1185 *) fs_paths_extra="$enableval" ;;
1186 esac],
1187 [fs_paths_extra=""]
1188)
1189fs_paths="$fs_paths_defaults"
1190if test "x$fs_paths_extra" != "x"; then
1191 if test "x$fs_paths" != "x"; then
1192 fs_paths="${fs_paths}:"
1193 fi
1194 fs_paths="${fs_paths}${fs_paths_extra}"
1195fi
1196AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
1197
1198
48d7b13a 1199AC_ARG_ENABLE([use-tty-group],
7fa4f112 1200 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
271d98e0 1201 [], enable_use_tty_group=yes
48d7b13a 1202)
49ccbae6 1203AM_CONDITIONAL(USE_TTY_GROUP, test "x$enable_use_tty_group" = xyes)
48d7b13a 1204
49ccbae6 1205if test "x$enable_use_tty_group" = xyes; then
48d7b13a
KZ
1206 AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
1207fi
1208
f3831bbd
KZ
1209AC_ARG_ENABLE([makeinstall-chown],
1210 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
1211 [], enable_makeinstall_chown=yes
1212)
49ccbae6 1213AM_CONDITIONAL(MAKEINSTALL_DO_CHOWN, test "x$enable_makeinstall_chown" = xyes)
f3831bbd 1214
4c24a7ae
KZ
1215AC_ARG_ENABLE([makeinstall-setuid],
1216 AS_HELP_STRING([--disable-makeinstall-setuid], [do not do setuid chmod operations during "make install"]),
1217 [], enable_makeinstall_setuid=yes
1218)
1219AM_CONDITIONAL(MAKEINSTALL_DO_SETUID, test "x$enable_makeinstall_setuid" = xyes)
1220
06bcee19 1221
1f10890f
SK
1222AC_ARG_VAR([SUID_CFLAGS],
1223 [CFLAGS used for binaries which are usually with the suid bit])
1224AC_ARG_VAR([SUID_LDFLAGS],
1225 [LDFLAGS used for binaries which are usually with the suid bit])
06bcee19 1226
9cb68977 1227LIBS=""
48d7b13a 1228
48d7b13a
KZ
1229
1230AC_CONFIG_HEADERS(config.h)
1231
8eeb575c 1232AC_CONFIG_FILES([
8eeb575c 1233disk-utils/Makefile
562218e6 1234fdisk/Makefile
607c2a72 1235fsck/Makefile
8eeb575c
KZ
1236getopt/Makefile
1237hwclock/Makefile
562218e6 1238include/Makefile
d00ed891 1239lib/Makefile
8eeb575c 1240login-utils/Makefile
20ad4963 1241Makefile
f331598a 1242man/ru/Makefile
20ad4963 1243misc-utils/chkdupexe:misc-utils/chkdupexe.pl
8eeb575c
KZ
1244misc-utils/Makefile
1245mount/Makefile
1246partx/Makefile
1247po/Makefile.in
1248schedutils/Makefile
8fb4efae
KZ
1249libblkid/blkid.pc
1250libblkid/Makefile
1251libblkid/docs/Makefile
1252libblkid/docs/version.xml
1253libblkid/src/Makefile
1254libblkid/src/blkid.h
1255libblkid/src/superblocks/Makefile
1256libblkid/src/topology/Makefile
1257libblkid/src/partitions/Makefile
1258libblkid/samples/Makefile
2aefc0a8
KZ
1259libmount/mount.pc
1260libmount/Makefile
1261libmount/src/Makefile
1262libmount/src/libmount.h
1263libmount/docs/Makefile
1264libmount/docs/version.xml
1265libmount/samples/Makefile
83d20837
KZ
1266libuuid/uuid.pc
1267libuuid/Makefile
1268libuuid/man/Makefile
1269libuuid/src/Makefile
8eeb575c 1270sys-utils/Makefile
c0f20acb 1271term-utils/Makefile
e83446da 1272tests/commands.sh
20ad4963
KZ
1273tests/helpers/Makefile
1274tests/Makefile
1275text-utils/Makefile
8eeb575c 1276])
48d7b13a 1277
996fb358 1278
48d7b13a 1279AC_OUTPUT