2 m4_esyscmd([tools/git-version-gen .tarball-version]),
7 AC_CONFIG_AUX_DIR(config)
8 AC_CONFIG_MACRO_DIR([m4])
10 AM_INIT_AUTOMAKE([-Wall foreign 1.10 dist-bzip2 -Wno-portability])
12 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
13 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
15 AC_CONFIG_SRCDIR(mount/mount.c)
17 AC_PREFIX_DEFAULT([/usr])
19 dnl version details from <major>.<minor>[-<suffix>]
20 PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}')
21 PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{print $2}' \
22 | awk -F- '{print $1}')
23 PACKAGE_VERSION_RELEASE=0
26 LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
27 LIBBLKID_DATE="19-Oct-2011"
31 LIBBLKID_VERSION_INFO=`expr $LIBBLKID_LT_MAJOR + $LIBBLKID_LT_MINOR`:$LIBBLKID_LT_MICRO:$LIBBLKID_LT_MINOR
34 LIBUUID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
38 LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR
41 LIBMOUNT_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
45 LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR
47 # Check whether exec_prefix=/usr:
48 case $exec_prefix:$prefix in
49 NONE:NONE | NONE:/usr | /usr:*)
50 AC_MSG_NOTICE([Default --exec-prefix detected.])
52 '${exec_prefix}/bin') bindir=/bin
53 AC_MSG_NOTICE([ --bindir defaults to /bin]) ;;
56 '${exec_prefix}/sbin') sbindir=/sbin
57 AC_MSG_NOTICE([ --sbindir defaults to /sbin]) ;;
60 '${exec_prefix}/lib') libdir=/lib
61 AC_MSG_NOTICE([ --libdir defaults to /lib]) ;;
65 libdirname=`basename "$libdir"`
66 AC_SUBST([libdirname])
68 # The original default values of {bin,sbin,lib}dir
69 usrbin_execdir='${exec_prefix}/bin'
70 AC_SUBST([usrbin_execdir])
72 usrsbin_execdir='${exec_prefix}/sbin'
73 AC_SUBST([usrsbin_execdir])
75 usrlib_execdir='${exec_prefix}/'$libdirname
76 AC_SUBST([usrlib_execdir])
89 m4_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.])])
98 AC_PATH_PROG([XSLTPROC], [xsltproc])
106 AM_CONDITIONAL([LINUX], test "x$linux_os" = xyes)
108 AC_PATH_PROG(PERL, perl)
112 AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
113 #ifdef HAVE_LINUX_COMPILER_H
114 #include <linux/compiler.h>
160 AC_CHECK_HEADERS([linux/raw.h],
161 [AM_CONDITIONAL([HAVE_RAW], [true])],
162 [AM_CONDITIONAL([HAVE_RAW], [false])])
164 AC_CHECK_HEADERS([langinfo.h],
165 [AM_CONDITIONAL([HAVE_LANGINFO], [true])],
166 [AM_CONDITIONAL([HAVE_LANGINFO], [false])])
169 AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
171 AC_CHECK_DECL([llseek],
172 [AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1,
173 [Define to 1 if have llseek prototype])],
175 [#include <unistd.h>])
177 AC_CHECK_DECL([lseek64],
178 [AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
179 [Define to 1 if have lseek64 prototype])],
181 [#define _LARGEFILE_SOURCE
182 #define _LARGEFILE64_SOURCE
183 #include <unistd.h>])
193 get_current_dir_name \
224 AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
226 AC_CHECK_FUNCS([ioperm iopl], [have_io=yes])
227 AM_CONDITIONAL([BUILD_HWCLOCK], test "x$have_io" = xyes -o "x$linux_os" = xyes)
229 AC_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>])
235 AC_SEARCH_LIBS([gethostbyname], [nsl],
236 [if test x"$ac_cv_search_gethostbyname" != x"none required"; then
237 SOCKET_LIBS="$SOCKET_LIBS -lnsl";
239 AC_SEARCH_LIBS([socket], [socket],
240 [if test x"$ac_cv_search_socket" != x"none required"; then
241 SOCKET_LIBS="$SOCKET_LIBS -lsocket";
243 AC_SUBST([SOCKET_LIBS])
247 AC_CHECK_FUNCS([dirfd], [have_dirfd=yes], [have_dirfd=no])
248 if 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>])
256 if 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>])
263 case "$have_dirfd:$have_ddfd" in
265 AC_MSG_ERROR([cannot find a method to get filedescriptor of directory]) ;;
269 AC_MSG_CHECKING(whether program_invocation_short_name is defined)
270 AC_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])
277 AC_MSG_CHECKING([whether __progname is defined])
278 AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
279 [if (*__progname == 0) return;])],
280 AC_DEFINE(HAVE___PROGNAME, 1, [Define if __progname is defined])
284 dnl Static compilation
285 m4_define([UTIL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid])
287 AC_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])[)])])
292 case $enable_static_programs in
293 yes) enable_static_programs=m4_quote(UTIL_STATIC_PROGRAMS) ;;
294 no) enable_static_programs= ;;
297 dnl Set all the individual AM_CONDITIONALs
298 m4_foreach([UTIL_PRG], m4_defn([UTIL_STATIC_PROGRAMS]), [
299 case ,$enable_static_programs, in
300 *,UTIL_PRG,*) static_[]UTIL_PRG=yes ;;
302 AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UTIL_PRG),
303 [test "x$static_[]UTIL_PRG" = xyes])
306 dnl UTIL_PKG_STATIC(VARIABLE, MODULES)
307 dnl ----------------------------------
308 AC_DEFUN([UTIL_PKG_STATIC], [
309 if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then
310 $1=`pkg-config --libs --static "$2"`
312 AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
316 dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1]))
317 dnl The VARSUFFIX is optional and overrides the default behaviour. For example:
318 dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX
319 dnl UTIL_CHECK_LIB(yyy, func) generates have_yyy and HAVE_LIBYYY
320 dnl ---------------------------------
321 AC_DEFUN([UTIL_CHECK_LIB], [
322 m4_define([suffix], m4_default([$3],$1))
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])
330 dnl UTIL_SET_FLAGS(CFLAGS, CPPFLAGS, LDFLAGS)
331 AC_DEFUN([UTIL_SET_FLAGS], [
333 old_CPPFLAGS="$CPPFLAGS"
334 old_LDFLAGS="$LDFLAGS"
336 CPPFLAGS="$CPPFLAGS $2"
337 LDFLAGS="$LDFLAGS $3"
340 dnl UTIL_RESTORE_FLAGS()
341 AC_DEFUN([UTIL_RESTORE_FLAGS], [
343 CPPFLAGS="$old_CPPFLAGS"
344 LDFLAGS="$old_LDFLAGS"
350 AC_ARG_ENABLE([mount],
351 AS_HELP_STRING([--disable-mount], [do not build mount utilities]),
352 [], enable_mount=check
355 if 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])
360 elif test "x$enable_mount" = xno; then
363 AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes)
366 AC_ARG_ENABLE([fsck],
367 AS_HELP_STRING([--disable-fsck], [do not build fsck]),
370 AM_CONDITIONAL(BUILD_FSCK, test "x$enable_fsck" = xyes)
373 AC_ARG_ENABLE([partx],
374 AS_HELP_STRING([--disable-partx], [do not build addpart, delpart, partx]),
375 [], enable_partx=check
378 if 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])
383 elif test "x$enable_partx" = xno; then
386 AM_CONDITIONAL(BUILD_PARTX, test "x$build_partx" = xyes)
389 AC_ARG_ENABLE([libuuid],
390 AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]),
391 [], enable_libuuid=yes
393 AC_SUBST([LIBUUID_VERSION])
394 AC_SUBST([LIBUUID_VERSION_INFO])
395 AM_CONDITIONAL(BUILD_LIBUUID, test "x$enable_libuuid" = xyes)
397 if test "x$enable_libuuid" = xyes; then
398 AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.])
400 AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
404 AC_ARG_ENABLE([uuidd],
405 AS_HELP_STRING([--disable-uuidd], [do not build the uuid daemon]),
406 [], enable_uuidd=auto
409 case "$enable_uuidd:$enable_libuuid" in
411 AC_MSG_ERROR([cannot enable uuidd when libuuid is disabled]) ;;
413 enable_uuidd=$enable_libuuid ;;
415 if test "x$enable_uuidd" = xyes; then
416 AC_DEFINE(HAVE_UUIDD, 1, [Define to 1 if you want to use uuid daemon.])
418 AM_CONDITIONAL(BUILD_UUIDD, test "x$enable_uuidd" = xyes)
421 AC_ARG_ENABLE([libblkid],
422 AS_HELP_STRING([--disable-libblkid], [do not build libblkid and blkid utilities]),
423 [], enable_libblkid=yes
425 AC_SUBST([LIBBLKID_DATE])
426 AC_SUBST([LIBBLKID_VERSION])
427 AC_SUBST([LIBBLKID_VERSION_INFO])
428 AM_CONDITIONAL(BUILD_LIBBLKID, test "x$enable_libblkid" = xyes)
429 AC_DEFINE_UNQUOTED(LIBBLKID_VERSION, "$LIBBLKID_VERSION", [libblkid version string])
430 AC_DEFINE_UNQUOTED(LIBBLKID_DATE, "$LIBBLKID_DATE", [libblkid date string])
432 if test "x$enable_libblkid" = xyes; then
433 AC_DEFINE(HAVE_LIBBLKID, 1, [Define to 1 if you have the -lblkid.])
435 if test "x$build_mount" = xyes; then
436 AC_MSG_ERROR([libblkid is needed to build util-linux mount])
438 if test "x$enable_fsck" = xyes; then
439 AC_MSG_ERROR([libblkid is needed to build util-linux fsck])
441 if test "x$build_partx" = xyes; then
442 AC_MSG_ERROR([libblkid is needed to build util-linux partx])
447 AC_ARG_ENABLE([libmount],
448 AS_HELP_STRING([--disable-libmount], [do not build libmount]),
449 [], enable_libmount=check
452 if 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])
457 elif test "x$enable_libmount" = xno; then
461 AC_DEFUN([UTIL_SCANF_TYPE_MODIFIER], [dnl
467 i = sscanf("x", $1, &s);
472 AC_MSG_CHECKING([needed scanf type modifiers])
473 AC_CACHE_VAL([scanf_cv_type_modifier],
474 AC_RUN_IFELSE([AC_LANG_SOURCE([UTIL_SCANF_TYPE_MODIFIER(["%ms"])])],
475 [scanf_cv_type_modifier=ms],
476 AC_RUN_IFELSE([AC_LANG_SOURCE([UTIL_SCANF_TYPE_MODIFIER(["%as"])])],
477 [scanf_cv_type_modifier=as],
478 [scanf_cv_type_modifier=no]
483 case "$scanf_cv_type_modifier" in
485 AC_MSG_RESULT([(%ms) yes])
486 AC_DEFINE([HAVE_SCANF_MS_MODIFIER], [1], [scanf %ms modifier]) ;;
488 AC_MSG_RESULT([(%as) yes])
489 AC_DEFINE([HAVE_SCANF_AS_MODIFIER], [1], [scanf %as modifier]) ;;
492 if "x$build_libmount" = xyes; then
493 AC_MSG_WARN([%as or %ms for sscanf() not found; do not build libmount])
499 case "$enable_libblkid:$build_libmount" in
501 AC_MSG_ERROR([cannot enable libmount when libblkid is disabled]) ;;
504 AC_SUBST([LIBMOUNT_VERSION])
505 AC_SUBST([LIBMOUNT_VERSION_INFO])
506 AC_DEFINE_UNQUOTED(LIBMOUNT_VERSION, "$LIBMOUNT_VERSION", [libmount version string])
507 AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_libmount" = xyes)
510 AC_ARG_ENABLE([libmount-mount],
511 AS_HELP_STRING([--enable-libmount-mount], [link mount(8) with libmount (EXPERIMENTAL)]),
512 [], enable_libmount_mount=no
515 case "$build_libmount:$enable_libmount_mount" in
517 AC_MSG_ERROR([cannot link mount(8) with libmount when libmount is disabled]) ;;
519 AC_DEFINE(HAVE_LIBMOUNT_MOUNT, 1, [use libmount for mount(8)])
521 AM_CONDITIONAL(BUILD_LIBMOUNT_MOUNT, test "x$enable_libmount_mount" = xyes)
524 AC_ARG_ENABLE([mountpoint],
525 AS_HELP_STRING([--disable-mountpoint], [do not build mountpoint]),
526 [], enable_mountpoint=check
530 if test "x$enable_mountpoint" = xcheck; then
531 if test "x$build_libmount" = xno; then
532 AC_MSG_WARN([libmount disabled; do not build mountpoint])
535 elif test "x$enable_mountpoint" = xno; then
539 case "$build_libmount:$build_mountpoint" in
541 AC_MSG_ERROR([cannot enable mountpoint when libmount is disabled]) ;;
543 AM_CONDITIONAL(BUILD_MOUNTPOINT, test "x$build_mountpoint" = xyes)
546 UTIL_CHECK_LIB(util, openpty)
547 UTIL_CHECK_LIB(termcap, tgetnum)
549 AM_GNU_GETTEXT_VERSION([0.14.1])
550 AM_GNU_GETTEXT([external])
551 if test -d "$srcdir/po"
553 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
555 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"
558 AC_ARG_WITH([ncurses],
559 AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
560 (--without-ncurses disables all ncurses(w) support)]),
561 [], with_ncurses=auto
563 AM_CONDITIONAL(HAVE_NCURSES, false)
565 if test "x$with_ncurses" != xno; then
567 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
568 if test "x$with_ncurses" = xauto; then
569 UTIL_CHECK_LIB(ncursesw, initscr, ncurses)
570 if test "x$have_ncurses" = xyes; then
571 AC_CHECK_HEADERS([ncursesw/ncurses.h])
572 NCURSES_LIBS="-lncursesw"
575 if test "x$have_ncurses" = xno; then
576 UTIL_CHECK_LIB(ncurses, initscr)
577 if test "x$have_ncurses" = xyes; then
578 NCURSES_LIBS="-lncurses"
582 if test "x$have_ncurses" = xno; then
583 AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
586 AC_SUBST([NCURSES_LIBS])
590 AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
595 AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes])
596 AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes)
599 if test "x$with_slang" = xyes; then
600 AC_CHECK_HEADERS([slang.h slang/slang.h])
601 AC_CHECK_HEADERS([slcurses.h slang/slcurses.h],
602 [use_slang=yes], [], [
605 #elif defined(HAVE_SLANG_SLANG_H)
606 #include <slang/slang.h>
609 if test "x$use_slang" = xno; then
610 AC_MSG_ERROR([slang selected but slcurses.h not found])
613 AM_CONDITIONAL(USE_SLANG, test "x$use_slang" = xyes)
616 AC_ARG_WITH([utempter],
617 AS_HELP_STRING([--with-utempter], [compile script(1) with libutempter]),
621 if test "x$with_utempter" = xyes; then
622 UTIL_CHECK_LIB(utempter, utempter_add_record)
623 if test "x$have_utempter" = xno; then
624 AC_MSG_ERROR([utempter selected but libutempter not found])
627 AM_CONDITIONAL(HAVE_UTEMPTER, false)
630 # on Solaris, you can't mix and match standards, since we use c99
631 # aparently at this stage, XOPEN_SOURCE will conflict. As workaround,
632 # check for crypt.h and use that without XOPEN_SOURCE.
633 AC_CHECK_HEADERS([crypt.h])
634 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
638 #define _XOPEN_SOURCE
642 char *c = crypt("abc","pw");
645 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
649 #define _XOPEN_SOURCE
653 char *c = crypt("abc","pw");
655 AC_DEFINE(NEED_LIBCRYPT, 1, [Do we need -lcrypt?])
658 AC_MSG_ERROR([crypt() is not available])
662 AM_CONDITIONAL(NEED_LIBCRYPT, test "x$need_libcrypt" = xyes)
664 AC_CHECK_TYPES([union semun], [], [], [[
667 AC_CHECK_TYPES(loff_t)
670 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
678 if (w == WEOF) exit(1);
682 [AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?)
686 dnl UTIL_CHECK_SYSCALL(SYSCALL, FALLBACK, ...)
687 dnl Only specify FALLBACK if the SYSCALL
688 dnl you're checking for is a "newish" one
689 dnl -------------------------------------
690 AC_DEFUN([UTIL_CHECK_SYSCALL], [
691 dnl This macro uses host_cpu.
692 AC_REQUIRE([AC_CANONICAL_HOST])
693 AC_CACHE_CHECK([for syscall $1],
694 [util_cv_syscall_$1],
695 [_UTIL_SYSCALL_CHECK_DECL([SYS_$1],
697 [dnl Our libc failed use, so see if we can get the kernel
698 dnl headers to play ball ...
699 _UTIL_SYSCALL_CHECK_DECL([_NR_$1],
703 if test "x$linux_os" = xyes; then
705 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shift($@))
710 util_cv_syscall_$1=$syscall
712 AM_CONDITIONAL([HAVE_]m4_toupper($1), [test "x$util_cv_syscall_$1" != xno])
713 case $util_cv_syscall_$1 in #(
714 no) AC_MSG_WARN([Unable to detect syscall $1.]) ;;
716 *) AC_DEFINE_UNQUOTED([SYS_$1], [$util_cv_syscall_$1],
717 [Fallback syscall number for $1]) ;;
721 dnl _UTIL_SYSCALL_CHECK_DECL(SYMBOL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
722 dnl Check if SYMBOL is declared, using the headers needed for syscall checks.
723 dnl -------------------------------------
724 m4_define([_UTIL_SYSCALL_CHECK_DECL],
725 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
726 #include <sys/syscall.h>
728 ]], [[int test = $1;]])],
732 dnl _UTIL_CHECK_SYSCALL_FALLBACK(PATTERN, VALUE, ...)
733 dnl Helper macro to create the body for the above `case'.
734 dnl -------------------------------------
735 m4_define([_UTIL_CHECK_SYSCALL_FALLBACK],
738 $1) syscall="$2" ;;dnl
739 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shiftn(2, $@))])dnl
743 UTIL_CHECK_SYSCALL([pivot_root])
744 UTIL_CHECK_SYSCALL([sched_getaffinity])
745 UTIL_CHECK_SYSCALL([ioprio_set],
754 UTIL_CHECK_SYSCALL([ioprio_get],
764 dnl fallocate could be available as libc function or as syscall only
765 UTIL_CHECK_SYSCALL([fallocate])
767 dnl check for valid fallocate() function
768 dnl with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
769 dnl when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
770 dnl and program can't be linked.
771 dnl AC_CHECK_FUNC can't catch such errors since it's redefining
772 dnl function prototype.
773 AC_MSG_CHECKING([for valid fallocate() function])
779 #ifdef HAVE_SYS_TYPES_H
780 # include <sys/types.h>
782 #ifdef HAVE_LINUX_FALLOC_H
783 # include <linux/falloc.h>
791 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
798 AC_DEFINE(HAVE_FALLOCATE,1,[Have valid fallocate() function])],[
799 AC_MSG_RESULT([no])])
801 dnl unshare could be available as libc function or as syscall only
802 UTIL_CHECK_SYSCALL([unshare])
803 AC_CHECK_FUNCS([unshare])
805 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
810 struct tm *tm = localtime(0);
811 if (a == -1) /* false */
812 sleep(tm->tm_gmtoff);
814 [AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?])
817 AC_CHECK_MEMBERS([struct termios.c_line],,,
818 [[#include <termios.h>]])
820 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
821 [#include <sys/stat.h>])
833 ADDR_LIMIT_3GB], [], [], [#include <linux/personality.h>])
835 AC_CHECK_HEADERS([sys/swap.h])
837 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
839 #ifdef HAVE_SYS_SWAP_H
840 # include <sys/swap.h>
844 [[swapon("/dev/null", 0);]])],
845 [AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
847 [AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
851 AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
855 AM_CONDITIONAL(HAVE_CPU_SET_T, [test "x$have_cpu_set_t" = xyes])
857 AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
862 dnl UTIL_SET_ARCH(ARCHNAME, PATTERN)
863 dnl ---------------------------------
864 AC_DEFUN([UTIL_SET_ARCH], [
869 AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test "x$cpu_$1" = xtrue])
872 UTIL_SET_ARCH(I86, i?86-*)
873 UTIL_SET_ARCH(86_64, x86_64*)
874 UTIL_SET_ARCH(IA64, ia64*)
875 UTIL_SET_ARCH(S390, s390*)
876 UTIL_SET_ARCH(SPARC, sparc*)
877 UTIL_SET_ARCH(PPC, ppc*|powerpc*)
878 UTIL_SET_ARCH(M68K, m68*)
879 UTIL_SET_ARCH(MIPS, mips*)
880 UTIL_SET_ARCH(HPPA, hppa*)
882 AC_ARG_ENABLE([arch],
883 AS_HELP_STRING([--enable-arch], [do build arch]),
886 AM_CONDITIONAL(BUILD_ARCH, test "x$enable_arch" = xyes)
888 AC_ARG_ENABLE([ddate],
889 AS_HELP_STRING([--enable-ddate], [do build ddate]),
892 AM_CONDITIONAL(BUILD_DDATE, test "x$enable_ddate" = xyes)
894 AC_ARG_ENABLE([agetty],
895 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
896 [], enable_agetty=yes
898 AM_CONDITIONAL(BUILD_AGETTY, test "x$enable_agetty" = xyes)
900 AC_ARG_ENABLE([cramfs],
901 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
902 [], enable_cramfs=check
905 if test "x$enable_cramfs" = xno; then
909 dnl Trick: leave the third parameter empty to get the default action.
910 AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
911 case $enable_cramfs:$build_cramfs in
912 yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
915 AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
918 if test "x$have_openat" = xno; then
919 AC_MSG_WARN([openat() function not found; do not build lsblk])
921 elif test "x$linux_os" = xno; then
922 AC_MSG_WARN([non-linux system; do not build lsblk])
925 AM_CONDITIONAL(BUILD_LSBLK, test "x$build_lsblk" = xyes)
927 AC_ARG_ENABLE([switch_root],
928 AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
929 [], enable_switch_root=check
931 if test "x$enable_switch_root" = xno; then
934 build_switch_root=yes
935 case $enable_switch_root:$linux_os in
936 yes:no) AC_MSG_ERROR([switch_root selected for non-linux system]);;
937 check:no) AC_MSG_WARN([non-linux system; do not build switch_root])
938 build_switch_root=no;;
940 if test "x$build_switch_root" = xyes; then
941 case $enable_switch_root:$have_openat in
942 yes:no) AC_MSG_ERROR([switch_root selected but openat() function not found]);;
943 check:no) AC_MSG_WARN([openat() function not found; do not build switch_root])
944 build_switch_root=no;;
948 AM_CONDITIONAL(BUILD_SWITCH_ROOT, test "x$build_switch_root" = xyes)
951 AC_ARG_ENABLE([pivot_root],
952 AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
953 [], enable_pivot_root=check
955 if test "x$enable_pivot_root" = xno; then
959 case $enable_pivot_root:$linux_os in
960 yes:no) AC_MSG_ERROR([pivot_root selected for non-linux system]);;
961 check:no) AC_MSG_WARN([non-linux system; do not build pivot_root])
962 build_pivot_root=no;;
964 if test "x$build_pivot_root" = xyes; then
965 case $enable_pivot_root:$util_cv_syscall_pivot_root in
966 yes:no) AC_MSG_ERROR([pivot_root selected but pivot_root syscall not found]);;
967 check:no) AC_MSG_WARN([pivot_root syscall not found; do not build pivot_root])
968 build_pivot_root=no;;
972 AM_CONDITIONAL(BUILD_PIVOT_ROOT, test "x$build_pivot_root" = xyes)
975 AC_ARG_ENABLE([fallocate],
976 AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
977 [], enable_fallocate=check
979 if test "x$enable_fallocate" = xno; then
983 case $enable_fallocate:$linux_os in
984 yes:no) AC_MSG_ERROR([fallocate selected for non-linux system]);;
985 check:no) AC_MSG_WARN([non-linux system; do not build fallocate])
988 if test "x$build_fallocate" = xyes; then
989 case $enable_fallocate:$util_cv_syscall_fallocate in
990 yes:no) AC_MSG_ERROR([fallocate selected but fallocate syscall not found]);;
991 check:no) AC_MSG_WARN([fallocate syscall not found; do not build fallocate])
996 AM_CONDITIONAL(BUILD_FALLOCATE, test "x$build_fallocate" = xyes)
999 AC_ARG_ENABLE([unshare],
1000 AS_HELP_STRING([--disable-unshare], [do not build unshare]),
1001 [], enable_unshare=check
1003 if test "x$enable_unshare" = xno; then
1007 case $enable_unshare:$linux_os in
1008 yes:no) AC_MSG_ERROR([unshare selected for non-linux system]);;
1009 check:no) AC_MSG_WARN([non-linux system; do not build unshare])
1012 if test "x$build_unshare" = xyes; then
1013 case $enable_unshare:$util_cv_syscall_unshare in
1014 yes:no) AC_MSG_ERROR([unshare selected but unshare syscall not found]);;
1015 check:no) AC_MSG_WARN([unshare syscall not found; do not build unshare])
1020 AM_CONDITIONAL(BUILD_UNSHARE, test "x$build_unshare" = xyes)
1024 AC_ARG_ENABLE([elvtune],
1025 AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
1026 [], enable_elvtune=no
1028 AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes)
1030 AC_ARG_ENABLE([kill],
1031 AS_HELP_STRING([--enable-kill], [build kill]),
1034 AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
1037 AC_ARG_ENABLE([last],
1038 AS_HELP_STRING([--enable-last], [build last]),
1041 AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes)
1043 AC_ARG_ENABLE([line],
1044 AS_HELP_STRING([--enable-line], [build line]),
1047 AM_CONDITIONAL(BUILD_LINE, test "x$enable_line" = xyes)
1049 AC_ARG_ENABLE([mesg],
1050 AS_HELP_STRING([--enable-mesg], [build mesg]),
1053 AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes)
1056 AC_ARG_ENABLE([raw],
1057 AS_HELP_STRING([--enable-raw], [build raw]),
1060 AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes)
1063 AC_ARG_ENABLE([rename],
1064 AS_HELP_STRING([--disable-rename], [do not build rename]),
1065 [], enable_rename=yes
1067 AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes)
1070 AC_ARG_ENABLE([reset],
1071 AS_HELP_STRING([--enable-reset], [build reset]),
1074 AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes)
1077 AC_ARG_ENABLE([login-utils],
1078 AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
1079 [], enable_login_utils=no
1081 AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes)
1084 [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
1086 AM_CONDITIONAL(HAVE_PAM, false)
1087 if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then
1088 AC_CHECK_HEADERS([security/pam_misc.h],
1089 [AM_CONDITIONAL(HAVE_PAM, true)],
1090 [if test "x$with_pam" = xyes; then
1091 AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
1096 AC_ARG_WITH([selinux],
1097 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
1101 if test "x$with_selinux" = xno; then
1102 AM_CONDITIONAL(HAVE_SELINUX, false)
1104 UTIL_CHECK_LIB(selinux, getprevcon)
1105 case "$with_selinux:$have_selinux" in
1106 yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
1110 if test "x$have_selinux" = xyes; then
1111 SELINUX_LIBS="-lselinux -lsepol"
1112 SELINUX_LIBS_STATIC="-lselinux -lsepol"
1113 old_LDFLAGS="$LDFLAGS"
1114 LDFLAGS="$LDFLAGS $SELINUX_LIBS"
1115 # This function is missing in old libselinux 1.xx versions
1116 AC_CHECK_FUNCS([security_get_initial_context])
1117 LDFLAGS="$old_LDFLAGS"
1119 AC_SUBST([SELINUX_LIBS])
1120 AC_SUBST([SELINUX_LIBS_STATIC])
1122 AC_ARG_WITH([audit],
1123 AS_HELP_STRING([--with-audit], [compile with audit support]),
1127 if test "x$with_audit" = xno; then
1128 AM_CONDITIONAL(HAVE_AUDIT, false)
1130 UTIL_CHECK_LIB(audit, audit_log_user_message)
1131 case "$with_audit:$have_audit" in
1133 AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
1138 AC_ARG_ENABLE([schedutils],
1139 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
1140 [], enable_schedutils=yes
1142 AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes)
1145 AC_ARG_ENABLE([wall],
1146 AS_HELP_STRING([--disable-wall], [do not build wall]),
1149 AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes)
1152 AC_ARG_ENABLE([write],
1153 AS_HELP_STRING([--enable-write], [build write]),
1156 AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes)
1159 AC_ARG_ENABLE([chsh-only-listed],
1160 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
1161 [], enable_chsh_only_listed=yes
1164 if test "x$enable_chsh_only_listed" = xyes; then
1165 AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
1169 AC_ARG_ENABLE([login-chown-vcs],
1170 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
1171 [], enable_login_chown_vcs=no
1174 if test "x$enable_login_chown_vcs" = xyes; then
1175 AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
1179 AC_ARG_ENABLE([login-stat-mail],
1180 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
1181 [], enable_login_stat_mail=no
1184 if test "x$enable_login_stat_mail" = xyes; then
1185 AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
1189 AC_ARG_ENABLE([pg-bell],
1190 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
1191 [], enable_pg_bell=yes
1194 if test "x$enable_pg_bell" = xyes; then
1195 AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
1199 AC_ARG_ENABLE([require-password],
1200 AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
1201 [], enable_require_password=yes
1204 if test "x$enable_require_password" = xyes; then
1205 AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
1209 AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
1210 AC_ARG_ENABLE([fs-paths-default],
1211 AS_HELP_STRING([--enable-fs-paths-default=paths], [default search path for fs helpers @<:@FS_PATHS_DEFAULT@:>@]),
1212 [case "$enableval" in
1213 yes) fs_paths_defaults="FS_PATHS_DEFAULT" ;;
1214 no) fs_paths_defaults="" ;;
1215 *) fs_paths_defaults="$enableval" ;;
1217 [fs_paths_defaults="FS_PATHS_DEFAULT"]
1219 AC_ARG_ENABLE([fs-paths-extra],
1220 AS_HELP_STRING([--enable-fs-paths-extra=paths], [additional search paths for fs helpers]),
1221 [case "$enableval" in
1222 yes|no) fs_paths_extra="" ;;
1223 *) fs_paths_extra="$enableval" ;;
1227 fs_paths="$fs_paths_defaults"
1228 if test "x$fs_paths_extra" != "x"; then
1229 if test "x$fs_paths" != "x"; then
1230 fs_paths="${fs_paths}:"
1232 fs_paths="${fs_paths}${fs_paths_extra}"
1234 AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
1237 AC_ARG_ENABLE([use-tty-group],
1238 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
1239 [], enable_use_tty_group=yes
1241 AM_CONDITIONAL(USE_TTY_GROUP, test "x$enable_use_tty_group" = xyes)
1243 if test "x$enable_use_tty_group" = xyes; then
1244 AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
1247 AC_ARG_ENABLE([makeinstall-chown],
1248 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
1249 [], enable_makeinstall_chown=yes
1251 AM_CONDITIONAL(MAKEINSTALL_DO_CHOWN, test "x$enable_makeinstall_chown" = xyes)
1253 AC_ARG_ENABLE([makeinstall-setuid],
1254 AS_HELP_STRING([--disable-makeinstall-setuid], [do not do setuid chmod operations during "make install"]),
1255 [], enable_makeinstall_setuid=yes
1257 AM_CONDITIONAL(MAKEINSTALL_DO_SETUID, test "x$enable_makeinstall_setuid" = xyes)
1260 AC_ARG_VAR([SUID_CFLAGS],
1261 [CFLAGS used for binaries which are usually with the suid bit])
1262 AC_ARG_VAR([SUID_LDFLAGS],
1263 [LDFLAGS used for binaries which are usually with the suid bit])
1268 AC_CONFIG_HEADERS(config.h)
1278 login-utils/Makefile
1281 misc-utils/chkdupexe:misc-utils/chkdupexe.pl
1289 libblkid/docs/Makefile
1290 libblkid/docs/version.xml
1291 libblkid/src/Makefile
1292 libblkid/src/blkid.h
1293 libblkid/src/superblocks/Makefile
1294 libblkid/src/topology/Makefile
1295 libblkid/src/partitions/Makefile
1296 libblkid/samples/Makefile
1299 libmount/src/Makefile
1300 libmount/src/libmount.h
1301 libmount/docs/Makefile
1302 libmount/docs/version.xml
1303 libmount/samples/Makefile
1306 libuuid/man/Makefile
1307 libuuid/src/Makefile
1311 tests/helpers/Makefile