]> git.ipfire.org Git - thirdparty/util-linux.git/blame - configure.ac
docs: uniformize the header and footer lines in man pages
[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
KZ
794AC_CHECK_DECLS([
795 ADDR_NO_RANDOMIZE,
796 FDPIC_FUNCPTRS,
797 MMAP_PAGE_ZERO,
798 ADDR_COMPAT_LAYOUT,
799 READ_IMPLIES_EXEC,
800 ADDR_LIMIT_32BIT,
801 WHOLE_SECONDS,
802 STICKY_TIMEOUTS,
803 ADDR_LIMIT_3GB], [], [], [#include <linux/personality.h>])
48d7b13a 804
22d36665 805AC_CHECK_HEADERS([sys/swap.h])
b3425806
SK
806
807AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
808[[
b3425806
SK
809#ifdef HAVE_SYS_SWAP_H
810# include <sys/swap.h>
811#endif
812#include <unistd.h>
813]],
814[[swapon("/dev/null", 0);]])],
815[AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
816],
817[AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
818])
819
820
ee32c514
KZ
821AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
822#include <sched.h>
823]])
824
825AM_CONDITIONAL(HAVE_CPU_SET_T, [test "x$have_cpu_set_t" = xyes])
826
827AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
828#include <sched.h>
829]])
830
831
e782f1d4
KZ
832dnl UTIL_SET_ARCH(ARCHNAME, PATTERN)
833dnl ---------------------------------
834AC_DEFUN([UTIL_SET_ARCH], [
835 cpu_$1=false
836 case "$host" in
837 $2) cpu_$1=true ;;
838 esac
49ccbae6 839 AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test "x$cpu_$1" = xtrue])
e782f1d4 840])
48d7b13a 841
e782f1d4
KZ
842UTIL_SET_ARCH(I86, i?86-*)
843UTIL_SET_ARCH(86_64, x86_64*)
844UTIL_SET_ARCH(IA64, ia64*)
845UTIL_SET_ARCH(S390, s390*)
846UTIL_SET_ARCH(SPARC, sparc*)
847UTIL_SET_ARCH(PPC, ppc*|powerpc*)
848UTIL_SET_ARCH(M68K, m68*)
849UTIL_SET_ARCH(MIPS, mips*)
eeadb4f4 850UTIL_SET_ARCH(HPPA, hppa*)
48d7b13a 851
6a97809b
KZ
852AC_ARG_ENABLE([arch],
853 AS_HELP_STRING([--enable-arch], [do build arch]),
854 [], enable_arch=no
855)
49ccbae6 856AM_CONDITIONAL(BUILD_ARCH, test "x$enable_arch" = xyes)
48d7b13a 857
4a8962f3
KZ
858AC_ARG_ENABLE([ddate],
859 AS_HELP_STRING([--enable-ddate], [do build ddate]),
860 [], enable_date=no
861)
862AM_CONDITIONAL(BUILD_DDATE, test "x$enable_ddate" = xyes)
863
48d7b13a 864AC_ARG_ENABLE([agetty],
7fa4f112 865 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
271d98e0 866 [], enable_agetty=yes
48d7b13a 867)
49ccbae6 868AM_CONDITIONAL(BUILD_AGETTY, test "x$enable_agetty" = xyes)
48d7b13a 869
9cb68977 870AC_ARG_ENABLE([cramfs],
7fa4f112 871 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
271d98e0 872 [], enable_cramfs=check
9cb68977
KZ
873)
874
49ccbae6 875if test "x$enable_cramfs" = xno; then
fd67be31
SK
876 build_cramfs=no
877else
878 build_cramfs=yes
879 dnl Trick: leave the third parameter empty to get the default action.
880 AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
881 case $enable_cramfs:$build_cramfs in
882 yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
883 esac
9cb68977 884fi
49ccbae6 885AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
9cb68977 886
7f7126d7
KZ
887build_lsblk=yes
888if test "x$have_openat" = xno; then
889 AC_MSG_WARN([openat() function not found; do not build lsblk])
890 build_lsblk=no
b875d536 891elif test "x$linux_os" = xno; then
7f7126d7
KZ
892 AC_MSG_WARN([non-linux system; do not build lsblk])
893 build_lsblk=no
894fi
895AM_CONDITIONAL(BUILD_LSBLK, test "x$build_lsblk" = xyes)
9cb68977 896
bd671347
KZ
897AC_ARG_ENABLE([switch_root],
898 AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
940fd28c 899 [], enable_switch_root=check
bd671347 900)
940fd28c
KZ
901if test "x$enable_switch_root" = xno; then
902 build_switch_root=no
903else
904 build_switch_root=yes
905 case $enable_switch_root:$linux_os in
906 yes:no) AC_MSG_ERROR([switch_root selected for non-linux system]);;
907 check:no) AC_MSG_WARN([non-linux system; do not build switch_root])
908 build_switch_root=no;;
909 esac
910 if test "x$build_switch_root" = xyes; then
911 case $enable_switch_root:$have_openat in
912 yes:no) AC_MSG_ERROR([switch_root selected but openat() function not found]);;
913 check:no) AC_MSG_WARN([openat() function not found; do not build switch_root])
914 build_switch_root=no;;
915 esac
916 fi
917fi
918AM_CONDITIONAL(BUILD_SWITCH_ROOT, test "x$build_switch_root" = xyes)
bd671347
KZ
919
920
11125e7a
KZ
921AC_ARG_ENABLE([pivot_root],
922 AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
923 [], enable_pivot_root=check
924)
925if test "x$enable_pivot_root" = xno; then
926 build_pivot_root=no
927else
928 build_pivot_root=yes
929 case $enable_pivot_root:$linux_os in
930 yes:no) AC_MSG_ERROR([pivot_root selected for non-linux system]);;
931 check:no) AC_MSG_WARN([non-linux system; do not build pivot_root])
932 build_pivot_root=no;;
933 esac
934 if test "x$build_pivot_root" = xyes; then
935 case $enable_pivot_root:$util_cv_syscall_pivot_root in
936 yes:no) AC_MSG_ERROR([pivot_root selected but pivot_root syscall not found]);;
937 check:no) AC_MSG_WARN([pivot_root syscall not found; do not build pivot_root])
938 build_pivot_root=no;;
939 esac
940 fi
941fi
4a2ecf0a 942AM_CONDITIONAL(BUILD_PIVOT_ROOT, test "x$build_pivot_root" = xyes)
11125e7a
KZ
943
944
945AC_ARG_ENABLE([fallocate],
946 AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
947 [], enable_fallocate=check
948)
949if test "x$enable_fallocate" = xno; then
950 build_fallocate=no
951else
952 build_fallocate=yes
953 case $enable_fallocate:$linux_os in
954 yes:no) AC_MSG_ERROR([fallocate selected for non-linux system]);;
955 check:no) AC_MSG_WARN([non-linux system; do not build fallocate])
956 build_fallocate=no;;
957 esac
958 if test "x$build_fallocate" = xyes; then
959 case $enable_fallocate:$util_cv_syscall_fallocate in
960 yes:no) AC_MSG_ERROR([fallocate selected but fallocate syscall not found]);;
961 check:no) AC_MSG_WARN([fallocate syscall not found; do not build fallocate])
962 build_fallocate=no;;
963 esac
964 fi
965fi
966AM_CONDITIONAL(BUILD_FALLOCATE, test "x$build_fallocate" = xyes)
967
968
969AC_ARG_ENABLE([unshare],
970 AS_HELP_STRING([--disable-unshare], [do not build unshare]),
971 [], enable_unshare=check
972)
973if test "x$enable_unshare" = xno; then
974 build_unshare=no
975else
976 build_unshare=yes
977 case $enable_unshare:$linux_os in
978 yes:no) AC_MSG_ERROR([unshare selected for non-linux system]);;
979 check:no) AC_MSG_WARN([non-linux system; do not build unshare])
980 build_unshare=no;;
981 esac
982 if test "x$build_unshare" = xyes; then
983 case $enable_unshare:$util_cv_syscall_unshare in
984 yes:no) AC_MSG_ERROR([unshare selected but unshare syscall not found]);;
985 check:no) AC_MSG_WARN([unshare syscall not found; do not build unshare])
986 build_unshare=no;;
987 esac
988 fi
989fi
990AM_CONDITIONAL(BUILD_UNSHARE, test "x$build_unshare" = xyes)
991
992
993
48d7b13a 994AC_ARG_ENABLE([elvtune],
7fa4f112 995 AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
271d98e0 996 [], enable_elvtune=no
48d7b13a 997)
49ccbae6 998AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes)
48d7b13a 999
48d7b13a 1000AC_ARG_ENABLE([kill],
7fa4f112 1001 AS_HELP_STRING([--enable-kill], [build kill]),
271d98e0 1002 [], enable_kill=no
48d7b13a 1003)
49ccbae6 1004AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
48d7b13a
KZ
1005
1006
1007AC_ARG_ENABLE([last],
7fa4f112 1008 AS_HELP_STRING([--enable-last], [build last]),
271d98e0 1009 [], enable_last=no
48d7b13a 1010)
49ccbae6 1011AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes)
48d7b13a 1012
c135a8bd
SK
1013AC_ARG_ENABLE([line],
1014 AS_HELP_STRING([--enable-line], [build line]),
1015 [], enable_line=no
1016)
1017AM_CONDITIONAL(BUILD_LINE, test "x$enable_line" = xyes)
48d7b13a
KZ
1018
1019AC_ARG_ENABLE([mesg],
7fa4f112 1020 AS_HELP_STRING([--enable-mesg], [build mesg]),
271d98e0 1021 [], enable_mesg=no
48d7b13a 1022)
49ccbae6 1023AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes)
48d7b13a
KZ
1024
1025
48d7b13a 1026AC_ARG_ENABLE([raw],
7fa4f112 1027 AS_HELP_STRING([--enable-raw], [build raw]),
271d98e0 1028 [], enable_raw=no
48d7b13a 1029)
49ccbae6 1030AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes)
48d7b13a
KZ
1031
1032
48d7b13a 1033AC_ARG_ENABLE([rename],
7fa4f112 1034 AS_HELP_STRING([--disable-rename], [do not build rename]),
271d98e0 1035 [], enable_rename=yes
48d7b13a 1036)
49ccbae6 1037AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes)
48d7b13a
KZ
1038
1039
1040AC_ARG_ENABLE([reset],
7fa4f112 1041 AS_HELP_STRING([--enable-reset], [build reset]),
271d98e0 1042 [], enable_reset=no
48d7b13a 1043)
49ccbae6 1044AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes)
48d7b13a
KZ
1045
1046
1047AC_ARG_ENABLE([login-utils],
7fa4f112 1048 AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
271d98e0 1049 [], enable_login_utils=no
48d7b13a 1050)
49ccbae6 1051AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes)
48d7b13a 1052
9cb68977 1053AC_ARG_WITH([pam],
7fa4f112 1054 [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
9cb68977 1055
fd67be31 1056AM_CONDITIONAL(HAVE_PAM, false)
49ccbae6 1057if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then
fd67be31
SK
1058 AC_CHECK_HEADERS([security/pam_misc.h],
1059 [AM_CONDITIONAL(HAVE_PAM, true)],
49ccbae6 1060 [if test "x$with_pam" = xyes; then
fd67be31
SK
1061 AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
1062 fi
1063 ])
9cb68977 1064fi
9cb68977
KZ
1065
1066AC_ARG_WITH([selinux],
7fa4f112 1067 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
271d98e0 1068 [], with_selinux=no
9cb68977
KZ
1069)
1070
49ccbae6 1071if test "x$with_selinux" = xno; then
fd67be31
SK
1072 AM_CONDITIONAL(HAVE_SELINUX, false)
1073else
1074 UTIL_CHECK_LIB(selinux, getprevcon)
49ccbae6 1075 case "$with_selinux:$have_selinux" in
fd67be31
SK
1076 yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
1077 esac
9cb68977 1078fi
9cb68977 1079
49ccbae6 1080if test "x$have_selinux" = xyes; then
8569410c
SK
1081 SELINUX_LIBS="-lselinux -lsepol"
1082 SELINUX_LIBS_STATIC="-lselinux -lsepol"
28d39b6d
KZ
1083 old_LDFLAGS="$LDFLAGS"
1084 LDFLAGS="$LDFLAGS $SELINUX_LIBS"
1085 # This function is missing in old libselinux 1.xx versions
1086 AC_CHECK_FUNCS([security_get_initial_context])
1087 LDFLAGS="$old_LDFLAGS"
8569410c
SK
1088fi
1089AC_SUBST([SELINUX_LIBS])
1090AC_SUBST([SELINUX_LIBS_STATIC])
9cb68977 1091
bbae9cb0 1092AC_ARG_WITH([audit],
7fa4f112 1093 AS_HELP_STRING([--with-audit], [compile with audit support]),
271d98e0 1094 [], with_audit=no
bbae9cb0
KZ
1095)
1096
49ccbae6 1097if test "x$with_audit" = xno; then
fd67be31
SK
1098 AM_CONDITIONAL(HAVE_AUDIT, false)
1099else
1100 UTIL_CHECK_LIB(audit, audit_log_user_message)
49ccbae6 1101 case "$with_audit:$have_audit" in
fd67be31
SK
1102 yes:no)
1103 AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
1104 ;;
1105 esac
bbae9cb0 1106fi
bbae9cb0 1107
48d7b13a 1108AC_ARG_ENABLE([schedutils],
7fa4f112 1109 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
271d98e0 1110 [], enable_schedutils=yes
48d7b13a 1111)
49ccbae6 1112AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes)
48d7b13a
KZ
1113
1114
1115AC_ARG_ENABLE([wall],
7fa4f112 1116 AS_HELP_STRING([--disable-wall], [do not build wall]),
271d98e0 1117 [], enable_wall=yes
48d7b13a 1118)
49ccbae6 1119AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes)
48d7b13a
KZ
1120
1121
1122AC_ARG_ENABLE([write],
7fa4f112 1123 AS_HELP_STRING([--enable-write], [build write]),
271d98e0 1124 [], enable_write=no
48d7b13a 1125)
49ccbae6 1126AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes)
48d7b13a
KZ
1127
1128
1129AC_ARG_ENABLE([chsh-only-listed],
7fa4f112 1130 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
271d98e0 1131 [], enable_chsh_only_listed=yes
48d7b13a
KZ
1132)
1133
49ccbae6 1134if test "x$enable_chsh_only_listed" = xyes; then
48d7b13a
KZ
1135 AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
1136fi
1137
1138
1139AC_ARG_ENABLE([login-chown-vcs],
7fa4f112 1140 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
271d98e0 1141 [], enable_login_chown_vcs=no
48d7b13a
KZ
1142)
1143
49ccbae6 1144if test "x$enable_login_chown_vcs" = xyes; then
48d7b13a
KZ
1145 AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
1146fi
1147
1148
1149AC_ARG_ENABLE([login-stat-mail],
7fa4f112 1150 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
271d98e0 1151 [], enable_login_stat_mail=no
48d7b13a
KZ
1152)
1153
49ccbae6 1154if test "x$enable_login_stat_mail" = xyes; then
48d7b13a
KZ
1155 AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
1156fi
1157
1158
1159AC_ARG_ENABLE([pg-bell],
7fa4f112 1160 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
271d98e0 1161 [], enable_pg_bell=yes
48d7b13a
KZ
1162)
1163
49ccbae6 1164if test "x$enable_pg_bell" = xyes; then
48d7b13a
KZ
1165 AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
1166fi
1167
1168
1169AC_ARG_ENABLE([require-password],
7fa4f112 1170 AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
271d98e0 1171 [], enable_require_password=yes
48d7b13a
KZ
1172)
1173
49ccbae6 1174if test "x$enable_require_password" = xyes; then
48d7b13a
KZ
1175 AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
1176fi
1177
1178
bb4cb69d
MF
1179AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
1180AC_ARG_ENABLE([fs-paths-default],
1181 AS_HELP_STRING([--enable-fs-paths-default=paths], [default search path for fs helpers @<:@FS_PATHS_DEFAULT@:>@]),
1182 [case "$enableval" in
1183 yes) fs_paths_defaults="FS_PATHS_DEFAULT" ;;
1184 no) fs_paths_defaults="" ;;
1185 *) fs_paths_defaults="$enableval" ;;
1186 esac],
1187 [fs_paths_defaults="FS_PATHS_DEFAULT"]
1188)
1189AC_ARG_ENABLE([fs-paths-extra],
1190 AS_HELP_STRING([--enable-fs-paths-extra=paths], [additional search paths for fs helpers]),
1191 [case "$enableval" in
1192 yes|no) fs_paths_extra="" ;;
1193 *) fs_paths_extra="$enableval" ;;
1194 esac],
1195 [fs_paths_extra=""]
1196)
1197fs_paths="$fs_paths_defaults"
1198if test "x$fs_paths_extra" != "x"; then
1199 if test "x$fs_paths" != "x"; then
1200 fs_paths="${fs_paths}:"
1201 fi
1202 fs_paths="${fs_paths}${fs_paths_extra}"
1203fi
1204AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
1205
1206
48d7b13a 1207AC_ARG_ENABLE([use-tty-group],
7fa4f112 1208 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
271d98e0 1209 [], enable_use_tty_group=yes
48d7b13a 1210)
49ccbae6 1211AM_CONDITIONAL(USE_TTY_GROUP, test "x$enable_use_tty_group" = xyes)
48d7b13a 1212
49ccbae6 1213if test "x$enable_use_tty_group" = xyes; then
48d7b13a
KZ
1214 AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
1215fi
1216
f3831bbd
KZ
1217AC_ARG_ENABLE([makeinstall-chown],
1218 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
1219 [], enable_makeinstall_chown=yes
1220)
49ccbae6 1221AM_CONDITIONAL(MAKEINSTALL_DO_CHOWN, test "x$enable_makeinstall_chown" = xyes)
f3831bbd 1222
4c24a7ae
KZ
1223AC_ARG_ENABLE([makeinstall-setuid],
1224 AS_HELP_STRING([--disable-makeinstall-setuid], [do not do setuid chmod operations during "make install"]),
1225 [], enable_makeinstall_setuid=yes
1226)
1227AM_CONDITIONAL(MAKEINSTALL_DO_SETUID, test "x$enable_makeinstall_setuid" = xyes)
1228
06bcee19 1229
1f10890f
SK
1230AC_ARG_VAR([SUID_CFLAGS],
1231 [CFLAGS used for binaries which are usually with the suid bit])
1232AC_ARG_VAR([SUID_LDFLAGS],
1233 [LDFLAGS used for binaries which are usually with the suid bit])
06bcee19 1234
9cb68977 1235LIBS=""
48d7b13a 1236
48d7b13a
KZ
1237
1238AC_CONFIG_HEADERS(config.h)
1239
8eeb575c 1240AC_CONFIG_FILES([
8eeb575c 1241disk-utils/Makefile
562218e6 1242fdisk/Makefile
607c2a72 1243fsck/Makefile
8eeb575c
KZ
1244getopt/Makefile
1245hwclock/Makefile
562218e6 1246include/Makefile
d00ed891 1247lib/Makefile
8eeb575c 1248login-utils/Makefile
20ad4963 1249Makefile
f331598a 1250man/ru/Makefile
20ad4963 1251misc-utils/chkdupexe:misc-utils/chkdupexe.pl
8eeb575c
KZ
1252misc-utils/Makefile
1253mount/Makefile
1254partx/Makefile
1255po/Makefile.in
1256schedutils/Makefile
8fb4efae
KZ
1257libblkid/blkid.pc
1258libblkid/Makefile
1259libblkid/docs/Makefile
1260libblkid/docs/version.xml
1261libblkid/src/Makefile
1262libblkid/src/blkid.h
1263libblkid/src/superblocks/Makefile
1264libblkid/src/topology/Makefile
1265libblkid/src/partitions/Makefile
1266libblkid/samples/Makefile
2aefc0a8
KZ
1267libmount/mount.pc
1268libmount/Makefile
1269libmount/src/Makefile
1270libmount/src/libmount.h
1271libmount/docs/Makefile
1272libmount/docs/version.xml
1273libmount/samples/Makefile
83d20837
KZ
1274libuuid/uuid.pc
1275libuuid/Makefile
1276libuuid/man/Makefile
1277libuuid/src/Makefile
8eeb575c 1278sys-utils/Makefile
c0f20acb 1279term-utils/Makefile
e83446da 1280tests/commands.sh
20ad4963
KZ
1281tests/helpers/Makefile
1282tests/Makefile
1283text-utils/Makefile
8eeb575c 1284])
48d7b13a 1285
996fb358 1286
48d7b13a 1287AC_OUTPUT