]> git.ipfire.org Git - thirdparty/util-linux.git/blame - configure.ac
setarch: add --uname-2.6 option for personality flag UNAME26
[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"
e13d44a1 27LIBBLKID_DATE="17-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
cf002530 626AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a 627#include <stdio.h>
cf002530 628]], [[
48d7b13a 629printf(__progname);
cf002530
SK
630]])],
631[AC_DEFINE(HAVE___PROGNAME, 1, Do we have __progname?)
632])
48d7b13a
KZ
633
634
869829e4
GJ
635AC_CHECK_TYPES([union semun], [], [], [[
636#include <sys/sem.h>
637]])
5be1c033 638AC_CHECK_TYPES(loff_t)
869829e4
GJ
639
640
cf002530 641AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
642#include <wchar.h>
643#include <wctype.h>
644#include <stdio.h>
cf002530 645]], [[
48d7b13a
KZ
646 wchar_t wc;
647 wint_t w;
648 w = fgetwc(stdin);
649 if (w == WEOF) exit(1);
650 wc = w;
651 fputwc(wc,stdout);
cf002530
SK
652]])],
653[AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?)
654])
48d7b13a
KZ
655
656
72065909
MF
657dnl UTIL_CHECK_SYSCALL(SYSCALL, FALLBACK, ...)
658dnl Only specify FALLBACK if the SYSCALL
659dnl you're checking for is a "newish" one
660dnl -------------------------------------
661AC_DEFUN([UTIL_CHECK_SYSCALL], [
662 dnl This macro uses host_cpu.
663 AC_REQUIRE([AC_CANONICAL_HOST])
664 AC_CACHE_CHECK([for syscall $1],
665 [util_cv_syscall_$1],
666 [_UTIL_SYSCALL_CHECK_DECL([SYS_$1],
667 [syscall=SYS_$1],
668 [dnl Our libc failed use, so see if we can get the kernel
669 dnl headers to play ball ...
670 _UTIL_SYSCALL_CHECK_DECL([_NR_$1],
671 [syscall=_NR_$1],
672 [
673 syscall=no
49ccbae6 674 if test "x$linux_os" = xyes; then
8c182554
KZ
675 case $host_cpu in
676 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shift($@))
677 esac
678 fi
72065909
MF
679 ])
680 ])
681 util_cv_syscall_$1=$syscall
682 ])
49ccbae6 683 AM_CONDITIONAL([HAVE_]m4_toupper($1), [test "x$util_cv_syscall_$1" != xno])
72065909
MF
684 case $util_cv_syscall_$1 in #(
685 no) AC_MSG_WARN([Unable to detect syscall $1.]) ;;
686 SYS_*) ;;
687 *) AC_DEFINE_UNQUOTED([SYS_$1], [$util_cv_syscall_$1],
688 [Fallback syscall number for $1]) ;;
689 esac
690])
691
692dnl _UTIL_SYSCALL_CHECK_DECL(SYMBOL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
693dnl Check if SYMBOL is declared, using the headers needed for syscall checks.
694dnl -------------------------------------
695m4_define([_UTIL_SYSCALL_CHECK_DECL],
696[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
697#include <sys/syscall.h>
698#include <unistd.h>
72065909
MF
699]], [[int test = $1;]])],
700[$2], [$3])
701])
48d7b13a 702
72065909
MF
703dnl _UTIL_CHECK_SYSCALL_FALLBACK(PATTERN, VALUE, ...)
704dnl Helper macro to create the body for the above `case'.
705dnl -------------------------------------
706m4_define([_UTIL_CHECK_SYSCALL_FALLBACK],
707[m4_ifval([$1],
708 [#(
709 $1) syscall="$2" ;;dnl
710 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shiftn(2, $@))])dnl
711])
48d7b13a 712
72065909
MF
713
714UTIL_CHECK_SYSCALL([pivot_root])
715UTIL_CHECK_SYSCALL([sched_getaffinity])
716UTIL_CHECK_SYSCALL([ioprio_set],
717 [alpha], [442],
718 [i*86], [289],
719 [ia64*], [1274],
720 [powerpc*], [273],
721 [s390*], [282],
722 [sparc*], [196],
447ae7b8 723 [sh*], [288],
72065909
MF
724 [x86_64*], [251])
725UTIL_CHECK_SYSCALL([ioprio_get],
726 [alpha], [443],
727 [i*86], [290],
728 [ia64*], [1275],
729 [powerpc*], [274],
730 [s390*], [283],
731 [sparc*], [218],
447ae7b8 732 [sh*], [289],
72065909 733 [x86_64*], [252])
19a224ad 734
d46a5499
KZ
735dnl fallocate could be available as libc function or as syscall only
736UTIL_CHECK_SYSCALL([fallocate])
b832c2fe
YD
737
738dnl check for valid fallocate() function
739dnl with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
740dnl when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
741dnl and program can't be linked.
742dnl AC_CHECK_FUNC can't catch such errors since it's redefining
743dnl function prototype.
744AC_MSG_CHECKING([for valid fallocate() function])
745AC_LINK_IFELSE([
746AC_LANG_PROGRAM([[
747#ifdef HAVE_UNISTD_H
748# include <unistd.h>
749#endif
750#ifdef HAVE_SYS_TYPES_H
751# include <sys/types.h>
752#endif
753#ifdef HAVE_LINUX_FALLOC_H
754# include <linux/falloc.h>
755#endif
756#ifdef HAVE_FCNTL_H
757# include <fcntl.h>
758#endif
759]],[[
760 long ret;
761
762 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
763
764 if (ret != 0) {
765 return 1;
766 }
767 ]])],[
768AC_MSG_RESULT([yes])
769AC_DEFINE(HAVE_FALLOCATE,1,[Have valid fallocate() function])],[
770AC_MSG_RESULT([no])])
19a224ad 771
4205f1fd
MG
772dnl unshare could be available as libc function or as syscall only
773UTIL_CHECK_SYSCALL([unshare])
774AC_CHECK_FUNCS([unshare])
775
cf002530 776AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
777#include <time.h>
778#include <unistd.h>
cf002530 779]], [[
48d7b13a
KZ
780 int a = 0;
781 struct tm *tm = localtime(0);
782 if (a == -1) /* false */
783 sleep(tm->tm_gmtoff);
cf002530
SK
784]])],
785[AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?])
786])
48d7b13a 787
30e8b186
KZ
788AC_CHECK_MEMBERS([struct termios.c_line],,,
789 [[#include <termios.h>]])
790
6c2f2b9d
KZ
791AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
792 [#include <sys/stat.h>])
793
2d281745 794AC_CHECK_DECLS([
70eebc40 795 UNAME26,
2d281745
KZ
796 ADDR_NO_RANDOMIZE,
797 FDPIC_FUNCPTRS,
798 MMAP_PAGE_ZERO,
799 ADDR_COMPAT_LAYOUT,
800 READ_IMPLIES_EXEC,
801 ADDR_LIMIT_32BIT,
802 WHOLE_SECONDS,
803 STICKY_TIMEOUTS,
804 ADDR_LIMIT_3GB], [], [], [#include <linux/personality.h>])
48d7b13a 805
22d36665 806AC_CHECK_HEADERS([sys/swap.h])
b3425806
SK
807
808AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
809[[
b3425806
SK
810#ifdef HAVE_SYS_SWAP_H
811# include <sys/swap.h>
812#endif
813#include <unistd.h>
814]],
815[[swapon("/dev/null", 0);]])],
816[AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
817],
818[AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
819])
820
821
ee32c514
KZ
822AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
823#include <sched.h>
824]])
825
826AM_CONDITIONAL(HAVE_CPU_SET_T, [test "x$have_cpu_set_t" = xyes])
827
828AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
829#include <sched.h>
830]])
831
832
e782f1d4
KZ
833dnl UTIL_SET_ARCH(ARCHNAME, PATTERN)
834dnl ---------------------------------
835AC_DEFUN([UTIL_SET_ARCH], [
836 cpu_$1=false
837 case "$host" in
838 $2) cpu_$1=true ;;
839 esac
49ccbae6 840 AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test "x$cpu_$1" = xtrue])
e782f1d4 841])
48d7b13a 842
e782f1d4
KZ
843UTIL_SET_ARCH(I86, i?86-*)
844UTIL_SET_ARCH(86_64, x86_64*)
845UTIL_SET_ARCH(IA64, ia64*)
846UTIL_SET_ARCH(S390, s390*)
847UTIL_SET_ARCH(SPARC, sparc*)
848UTIL_SET_ARCH(PPC, ppc*|powerpc*)
849UTIL_SET_ARCH(M68K, m68*)
850UTIL_SET_ARCH(MIPS, mips*)
eeadb4f4 851UTIL_SET_ARCH(HPPA, hppa*)
48d7b13a 852
6a97809b
KZ
853AC_ARG_ENABLE([arch],
854 AS_HELP_STRING([--enable-arch], [do build arch]),
855 [], enable_arch=no
856)
49ccbae6 857AM_CONDITIONAL(BUILD_ARCH, test "x$enable_arch" = xyes)
48d7b13a 858
4a8962f3
KZ
859AC_ARG_ENABLE([ddate],
860 AS_HELP_STRING([--enable-ddate], [do build ddate]),
861 [], enable_date=no
862)
863AM_CONDITIONAL(BUILD_DDATE, test "x$enable_ddate" = xyes)
864
48d7b13a 865AC_ARG_ENABLE([agetty],
7fa4f112 866 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
271d98e0 867 [], enable_agetty=yes
48d7b13a 868)
49ccbae6 869AM_CONDITIONAL(BUILD_AGETTY, test "x$enable_agetty" = xyes)
48d7b13a 870
9cb68977 871AC_ARG_ENABLE([cramfs],
7fa4f112 872 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
271d98e0 873 [], enable_cramfs=check
9cb68977
KZ
874)
875
49ccbae6 876if test "x$enable_cramfs" = xno; then
fd67be31
SK
877 build_cramfs=no
878else
879 build_cramfs=yes
880 dnl Trick: leave the third parameter empty to get the default action.
881 AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
882 case $enable_cramfs:$build_cramfs in
883 yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
884 esac
9cb68977 885fi
49ccbae6 886AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
9cb68977 887
7f7126d7
KZ
888build_lsblk=yes
889if test "x$have_openat" = xno; then
890 AC_MSG_WARN([openat() function not found; do not build lsblk])
891 build_lsblk=no
b875d536 892elif test "x$linux_os" = xno; then
7f7126d7
KZ
893 AC_MSG_WARN([non-linux system; do not build lsblk])
894 build_lsblk=no
895fi
896AM_CONDITIONAL(BUILD_LSBLK, test "x$build_lsblk" = xyes)
9cb68977 897
bd671347
KZ
898AC_ARG_ENABLE([switch_root],
899 AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
940fd28c 900 [], enable_switch_root=check
bd671347 901)
940fd28c
KZ
902if test "x$enable_switch_root" = xno; then
903 build_switch_root=no
904else
905 build_switch_root=yes
906 case $enable_switch_root:$linux_os in
907 yes:no) AC_MSG_ERROR([switch_root selected for non-linux system]);;
908 check:no) AC_MSG_WARN([non-linux system; do not build switch_root])
909 build_switch_root=no;;
910 esac
911 if test "x$build_switch_root" = xyes; then
912 case $enable_switch_root:$have_openat in
913 yes:no) AC_MSG_ERROR([switch_root selected but openat() function not found]);;
914 check:no) AC_MSG_WARN([openat() function not found; do not build switch_root])
915 build_switch_root=no;;
916 esac
917 fi
918fi
919AM_CONDITIONAL(BUILD_SWITCH_ROOT, test "x$build_switch_root" = xyes)
bd671347
KZ
920
921
11125e7a
KZ
922AC_ARG_ENABLE([pivot_root],
923 AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
924 [], enable_pivot_root=check
925)
926if test "x$enable_pivot_root" = xno; then
927 build_pivot_root=no
928else
929 build_pivot_root=yes
930 case $enable_pivot_root:$linux_os in
931 yes:no) AC_MSG_ERROR([pivot_root selected for non-linux system]);;
932 check:no) AC_MSG_WARN([non-linux system; do not build pivot_root])
933 build_pivot_root=no;;
934 esac
935 if test "x$build_pivot_root" = xyes; then
936 case $enable_pivot_root:$util_cv_syscall_pivot_root in
937 yes:no) AC_MSG_ERROR([pivot_root selected but pivot_root syscall not found]);;
938 check:no) AC_MSG_WARN([pivot_root syscall not found; do not build pivot_root])
939 build_pivot_root=no;;
940 esac
941 fi
942fi
4a2ecf0a 943AM_CONDITIONAL(BUILD_PIVOT_ROOT, test "x$build_pivot_root" = xyes)
11125e7a
KZ
944
945
946AC_ARG_ENABLE([fallocate],
947 AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
948 [], enable_fallocate=check
949)
950if test "x$enable_fallocate" = xno; then
951 build_fallocate=no
952else
953 build_fallocate=yes
954 case $enable_fallocate:$linux_os in
955 yes:no) AC_MSG_ERROR([fallocate selected for non-linux system]);;
956 check:no) AC_MSG_WARN([non-linux system; do not build fallocate])
957 build_fallocate=no;;
958 esac
959 if test "x$build_fallocate" = xyes; then
960 case $enable_fallocate:$util_cv_syscall_fallocate in
961 yes:no) AC_MSG_ERROR([fallocate selected but fallocate syscall not found]);;
962 check:no) AC_MSG_WARN([fallocate syscall not found; do not build fallocate])
963 build_fallocate=no;;
964 esac
965 fi
966fi
967AM_CONDITIONAL(BUILD_FALLOCATE, test "x$build_fallocate" = xyes)
968
969
970AC_ARG_ENABLE([unshare],
971 AS_HELP_STRING([--disable-unshare], [do not build unshare]),
972 [], enable_unshare=check
973)
974if test "x$enable_unshare" = xno; then
975 build_unshare=no
976else
977 build_unshare=yes
978 case $enable_unshare:$linux_os in
979 yes:no) AC_MSG_ERROR([unshare selected for non-linux system]);;
980 check:no) AC_MSG_WARN([non-linux system; do not build unshare])
981 build_unshare=no;;
982 esac
983 if test "x$build_unshare" = xyes; then
984 case $enable_unshare:$util_cv_syscall_unshare in
985 yes:no) AC_MSG_ERROR([unshare selected but unshare syscall not found]);;
986 check:no) AC_MSG_WARN([unshare syscall not found; do not build unshare])
987 build_unshare=no;;
988 esac
989 fi
990fi
991AM_CONDITIONAL(BUILD_UNSHARE, test "x$build_unshare" = xyes)
992
993
994
48d7b13a 995AC_ARG_ENABLE([elvtune],
7fa4f112 996 AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
271d98e0 997 [], enable_elvtune=no
48d7b13a 998)
49ccbae6 999AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes)
48d7b13a 1000
48d7b13a 1001AC_ARG_ENABLE([kill],
7fa4f112 1002 AS_HELP_STRING([--enable-kill], [build kill]),
271d98e0 1003 [], enable_kill=no
48d7b13a 1004)
49ccbae6 1005AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
48d7b13a
KZ
1006
1007
1008AC_ARG_ENABLE([last],
7fa4f112 1009 AS_HELP_STRING([--enable-last], [build last]),
271d98e0 1010 [], enable_last=no
48d7b13a 1011)
49ccbae6 1012AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes)
48d7b13a 1013
c135a8bd
SK
1014AC_ARG_ENABLE([line],
1015 AS_HELP_STRING([--enable-line], [build line]),
1016 [], enable_line=no
1017)
1018AM_CONDITIONAL(BUILD_LINE, test "x$enable_line" = xyes)
48d7b13a
KZ
1019
1020AC_ARG_ENABLE([mesg],
7fa4f112 1021 AS_HELP_STRING([--enable-mesg], [build mesg]),
271d98e0 1022 [], enable_mesg=no
48d7b13a 1023)
49ccbae6 1024AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes)
48d7b13a
KZ
1025
1026
48d7b13a 1027AC_ARG_ENABLE([raw],
7fa4f112 1028 AS_HELP_STRING([--enable-raw], [build raw]),
271d98e0 1029 [], enable_raw=no
48d7b13a 1030)
49ccbae6 1031AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes)
48d7b13a
KZ
1032
1033
48d7b13a 1034AC_ARG_ENABLE([rename],
7fa4f112 1035 AS_HELP_STRING([--disable-rename], [do not build rename]),
271d98e0 1036 [], enable_rename=yes
48d7b13a 1037)
49ccbae6 1038AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes)
48d7b13a
KZ
1039
1040
1041AC_ARG_ENABLE([reset],
7fa4f112 1042 AS_HELP_STRING([--enable-reset], [build reset]),
271d98e0 1043 [], enable_reset=no
48d7b13a 1044)
49ccbae6 1045AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes)
48d7b13a
KZ
1046
1047
1048AC_ARG_ENABLE([login-utils],
7fa4f112 1049 AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
271d98e0 1050 [], enable_login_utils=no
48d7b13a 1051)
49ccbae6 1052AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes)
48d7b13a 1053
9cb68977 1054AC_ARG_WITH([pam],
7fa4f112 1055 [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
9cb68977 1056
fd67be31 1057AM_CONDITIONAL(HAVE_PAM, false)
49ccbae6 1058if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then
fd67be31
SK
1059 AC_CHECK_HEADERS([security/pam_misc.h],
1060 [AM_CONDITIONAL(HAVE_PAM, true)],
49ccbae6 1061 [if test "x$with_pam" = xyes; then
fd67be31
SK
1062 AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
1063 fi
1064 ])
9cb68977 1065fi
9cb68977
KZ
1066
1067AC_ARG_WITH([selinux],
7fa4f112 1068 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
271d98e0 1069 [], with_selinux=no
9cb68977
KZ
1070)
1071
49ccbae6 1072if test "x$with_selinux" = xno; then
fd67be31
SK
1073 AM_CONDITIONAL(HAVE_SELINUX, false)
1074else
1075 UTIL_CHECK_LIB(selinux, getprevcon)
49ccbae6 1076 case "$with_selinux:$have_selinux" in
fd67be31
SK
1077 yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
1078 esac
9cb68977 1079fi
9cb68977 1080
49ccbae6 1081if test "x$have_selinux" = xyes; then
8569410c
SK
1082 SELINUX_LIBS="-lselinux -lsepol"
1083 SELINUX_LIBS_STATIC="-lselinux -lsepol"
28d39b6d
KZ
1084 old_LDFLAGS="$LDFLAGS"
1085 LDFLAGS="$LDFLAGS $SELINUX_LIBS"
1086 # This function is missing in old libselinux 1.xx versions
1087 AC_CHECK_FUNCS([security_get_initial_context])
1088 LDFLAGS="$old_LDFLAGS"
8569410c
SK
1089fi
1090AC_SUBST([SELINUX_LIBS])
1091AC_SUBST([SELINUX_LIBS_STATIC])
9cb68977 1092
bbae9cb0 1093AC_ARG_WITH([audit],
7fa4f112 1094 AS_HELP_STRING([--with-audit], [compile with audit support]),
271d98e0 1095 [], with_audit=no
bbae9cb0
KZ
1096)
1097
49ccbae6 1098if test "x$with_audit" = xno; then
fd67be31
SK
1099 AM_CONDITIONAL(HAVE_AUDIT, false)
1100else
1101 UTIL_CHECK_LIB(audit, audit_log_user_message)
49ccbae6 1102 case "$with_audit:$have_audit" in
fd67be31
SK
1103 yes:no)
1104 AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
1105 ;;
1106 esac
bbae9cb0 1107fi
bbae9cb0 1108
48d7b13a 1109AC_ARG_ENABLE([schedutils],
7fa4f112 1110 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
271d98e0 1111 [], enable_schedutils=yes
48d7b13a 1112)
49ccbae6 1113AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes)
48d7b13a
KZ
1114
1115
1116AC_ARG_ENABLE([wall],
7fa4f112 1117 AS_HELP_STRING([--disable-wall], [do not build wall]),
271d98e0 1118 [], enable_wall=yes
48d7b13a 1119)
49ccbae6 1120AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes)
48d7b13a
KZ
1121
1122
1123AC_ARG_ENABLE([write],
7fa4f112 1124 AS_HELP_STRING([--enable-write], [build write]),
271d98e0 1125 [], enable_write=no
48d7b13a 1126)
49ccbae6 1127AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes)
48d7b13a
KZ
1128
1129
1130AC_ARG_ENABLE([chsh-only-listed],
7fa4f112 1131 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
271d98e0 1132 [], enable_chsh_only_listed=yes
48d7b13a
KZ
1133)
1134
49ccbae6 1135if test "x$enable_chsh_only_listed" = xyes; then
48d7b13a
KZ
1136 AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
1137fi
1138
1139
1140AC_ARG_ENABLE([login-chown-vcs],
7fa4f112 1141 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
271d98e0 1142 [], enable_login_chown_vcs=no
48d7b13a
KZ
1143)
1144
49ccbae6 1145if test "x$enable_login_chown_vcs" = xyes; then
48d7b13a
KZ
1146 AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
1147fi
1148
1149
1150AC_ARG_ENABLE([login-stat-mail],
7fa4f112 1151 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
271d98e0 1152 [], enable_login_stat_mail=no
48d7b13a
KZ
1153)
1154
49ccbae6 1155if test "x$enable_login_stat_mail" = xyes; then
48d7b13a
KZ
1156 AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
1157fi
1158
1159
1160AC_ARG_ENABLE([pg-bell],
7fa4f112 1161 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
271d98e0 1162 [], enable_pg_bell=yes
48d7b13a
KZ
1163)
1164
49ccbae6 1165if test "x$enable_pg_bell" = xyes; then
48d7b13a
KZ
1166 AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
1167fi
1168
1169
1170AC_ARG_ENABLE([require-password],
7fa4f112 1171 AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
271d98e0 1172 [], enable_require_password=yes
48d7b13a
KZ
1173)
1174
49ccbae6 1175if test "x$enable_require_password" = xyes; then
48d7b13a
KZ
1176 AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
1177fi
1178
1179
bb4cb69d
MF
1180AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
1181AC_ARG_ENABLE([fs-paths-default],
1182 AS_HELP_STRING([--enable-fs-paths-default=paths], [default search path for fs helpers @<:@FS_PATHS_DEFAULT@:>@]),
1183 [case "$enableval" in
1184 yes) fs_paths_defaults="FS_PATHS_DEFAULT" ;;
1185 no) fs_paths_defaults="" ;;
1186 *) fs_paths_defaults="$enableval" ;;
1187 esac],
1188 [fs_paths_defaults="FS_PATHS_DEFAULT"]
1189)
1190AC_ARG_ENABLE([fs-paths-extra],
1191 AS_HELP_STRING([--enable-fs-paths-extra=paths], [additional search paths for fs helpers]),
1192 [case "$enableval" in
1193 yes|no) fs_paths_extra="" ;;
1194 *) fs_paths_extra="$enableval" ;;
1195 esac],
1196 [fs_paths_extra=""]
1197)
1198fs_paths="$fs_paths_defaults"
1199if test "x$fs_paths_extra" != "x"; then
1200 if test "x$fs_paths" != "x"; then
1201 fs_paths="${fs_paths}:"
1202 fi
1203 fs_paths="${fs_paths}${fs_paths_extra}"
1204fi
1205AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
1206
1207
48d7b13a 1208AC_ARG_ENABLE([use-tty-group],
7fa4f112 1209 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
271d98e0 1210 [], enable_use_tty_group=yes
48d7b13a 1211)
49ccbae6 1212AM_CONDITIONAL(USE_TTY_GROUP, test "x$enable_use_tty_group" = xyes)
48d7b13a 1213
49ccbae6 1214if test "x$enable_use_tty_group" = xyes; then
48d7b13a
KZ
1215 AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
1216fi
1217
f3831bbd
KZ
1218AC_ARG_ENABLE([makeinstall-chown],
1219 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
1220 [], enable_makeinstall_chown=yes
1221)
49ccbae6 1222AM_CONDITIONAL(MAKEINSTALL_DO_CHOWN, test "x$enable_makeinstall_chown" = xyes)
f3831bbd 1223
4c24a7ae
KZ
1224AC_ARG_ENABLE([makeinstall-setuid],
1225 AS_HELP_STRING([--disable-makeinstall-setuid], [do not do setuid chmod operations during "make install"]),
1226 [], enable_makeinstall_setuid=yes
1227)
1228AM_CONDITIONAL(MAKEINSTALL_DO_SETUID, test "x$enable_makeinstall_setuid" = xyes)
1229
06bcee19 1230
1f10890f
SK
1231AC_ARG_VAR([SUID_CFLAGS],
1232 [CFLAGS used for binaries which are usually with the suid bit])
1233AC_ARG_VAR([SUID_LDFLAGS],
1234 [LDFLAGS used for binaries which are usually with the suid bit])
06bcee19 1235
9cb68977 1236LIBS=""
48d7b13a 1237
48d7b13a
KZ
1238
1239AC_CONFIG_HEADERS(config.h)
1240
8eeb575c 1241AC_CONFIG_FILES([
8eeb575c 1242disk-utils/Makefile
562218e6 1243fdisk/Makefile
607c2a72 1244fsck/Makefile
8eeb575c
KZ
1245getopt/Makefile
1246hwclock/Makefile
562218e6 1247include/Makefile
d00ed891 1248lib/Makefile
8eeb575c 1249login-utils/Makefile
20ad4963 1250Makefile
f331598a 1251man/ru/Makefile
20ad4963 1252misc-utils/chkdupexe:misc-utils/chkdupexe.pl
8eeb575c
KZ
1253misc-utils/Makefile
1254mount/Makefile
1255partx/Makefile
1256po/Makefile.in
1257schedutils/Makefile
8fb4efae
KZ
1258libblkid/blkid.pc
1259libblkid/Makefile
1260libblkid/docs/Makefile
1261libblkid/docs/version.xml
1262libblkid/src/Makefile
1263libblkid/src/blkid.h
1264libblkid/src/superblocks/Makefile
1265libblkid/src/topology/Makefile
1266libblkid/src/partitions/Makefile
1267libblkid/samples/Makefile
2aefc0a8
KZ
1268libmount/mount.pc
1269libmount/Makefile
1270libmount/src/Makefile
1271libmount/src/libmount.h
1272libmount/docs/Makefile
1273libmount/docs/version.xml
1274libmount/samples/Makefile
83d20837
KZ
1275libuuid/uuid.pc
1276libuuid/Makefile
1277libuuid/man/Makefile
1278libuuid/src/Makefile
8eeb575c 1279sys-utils/Makefile
c0f20acb 1280term-utils/Makefile
e83446da 1281tests/commands.sh
20ad4963
KZ
1282tests/helpers/Makefile
1283tests/Makefile
1284text-utils/Makefile
8eeb575c 1285])
48d7b13a 1286
996fb358 1287
48d7b13a 1288AC_OUTPUT