1 AC_INIT(util-linux-ng, 2.14-rc2, kzak@redhat.com)
5 AC_CONFIG_AUX_DIR(config)
7 AM_INIT_AUTOMAKE([check-news -Wall foreign 1.9 dist-bzip2])
9 AC_CONFIG_SRCDIR(mount/mount.c)
11 AC_PREFIX_DEFAULT([/usr])
13 # Check whether exec_prefix=/usr:
14 case $exec_prefix:$prefix in
15 NONE:NONE | NONE:/usr | /usr:*)
16 AC_MSG_NOTICE([Default --exec-prefix detected.])
18 '${exec_prefix}/bin') bindir=/bin
19 AC_MSG_NOTICE([ --bindir defaults to /bin]) ;;
22 '${exec_prefix}/sbin') sbindir=/sbin
23 AC_MSG_NOTICE([ --sbindir defaults to /sbin]) ;;
37 AM_CONDITIONAL([LINUX], test "x$linux_os" = xyes)
39 AC_PATH_PROG(PERL, perl)
40 AC_PATH_PROG(BLKID, blkid, [], [$PATH:/sbin])
41 AC_PATH_PROG(VOLID, vol_id, [], [$PATH:/lib/udev])
45 AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
46 #ifdef HAVE_LINUX_COMPILER_H
47 #include <linux/compiler.h>
61 AC_CHECK_HEADERS([linux/raw.h],
62 [AM_CONDITIONAL([HAVE_RAW], [true])],
63 [AM_CONDITIONAL([HAVE_RAW], [false])])
69 get_current_dir_name \
78 dnl Static compilation
79 m4_define([UTIL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk])
81 AC_ARG_ENABLE([static-programs],
82 [AS_HELP_STRING([--enable-static-programs=LIST],
83 [link static the programs in LIST (comma-separated,
84 supported for ]m4_defn([UTIL_STATIC_PROGRAMS])[)])])
86 case $enable_static_programs in
87 yes) enable_static_programs=m4_quote(UTIL_STATIC_PROGRAMS) ;;
88 no) enable_static_programs= ;;
91 if test "$enable_static_programs" != ""; then
92 AC_CACHE_CHECK([whether linker accepts -static],
94 [SAVE_LDFLAGS="$LDFLAGS"
95 LDFLAGS="$LDFLAGS -static"
96 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
100 ]])], [static_cv_option=yes],[static_cv_option=no])
101 LDFLAGS="$SAVE_LDFLAGS"
103 if test "x$static_cv_option" = xno; then
104 AC_MSG_ERROR([the linker does not accept option -static])
107 AC_SUBST([LDFLAGS_STATIC], [-static])
109 dnl Set all the individual AM_CONDITIONALs
110 m4_foreach([UTIL_PRG], m4_defn([UTIL_STATIC_PROGRAMS]), [
111 case ,$enable_static_programs, in
112 *,UTIL_PRG,*) static_[]UTIL_PRG=yes ;;
114 AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UTIL_PRG),
115 [test "x$static_[]UTIL_PRG" = xyes])
120 dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1]))
121 dnl The VARSUFFIX is optional and overrides the default behaviour. For example:
122 dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX
123 dnl UTIL_CHECK_LIB(yyy, func) generates have_yyy and HAVE_LIBYYY
124 dnl ---------------------------------
125 AC_DEFUN([UTIL_CHECK_LIB], [
126 m4_define([suffix], m4_default([$3],$1))
129 [AC_CHECK_LIB([$1], [$2], [AC_DEFINE(AS_TR_CPP([HAVE_LIB]suffix), 1)], [[have_]suffix=no])],
130 [AC_CHECK_LIB([$1], [$2], [], [[have_]suffix=no])])
131 AM_CONDITIONAL(AS_TR_CPP([HAVE_]suffix), [test [$have_]suffix = yes])
134 UTIL_CHECK_LIB(uuid, uuid_is_null)
135 if test "x$have_uuid" = xno; then
136 AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
139 UTIL_CHECK_LIB(util, openpty)
140 UTIL_CHECK_LIB(termcap, tgetnum)
142 AC_ARG_WITH([fsprobe],
143 [AS_HELP_STRING([--with-fsprobe], [library to guess filesystems (blkid|volume_id), default is blkid])],
144 [], [with_fsprobe=blkid]
147 AM_CONDITIONAL(HAVE_BLKID, false)
148 AM_CONDITIONAL(HAVE_VOLUME_ID, false)
152 if test "x$with_fsprobe" = xblkid; then
153 UTIL_CHECK_LIB(blkid, blkid_known_fstype)
154 elif test "x$with_fsprobe" = xvolume_id; then
155 UTIL_CHECK_LIB(volume_id, volume_id_encode_string)
158 if test "x$have_blkid" = xno && test "x$have_volume_id" = xno; then
159 AC_MSG_ERROR([blkid or volume_id is needed to build util-linux-ng.])
162 dnl UTIL_PKG_STATIC(VARIABLE, MODULES)
163 dnl ----------------------------------
164 AC_DEFUN([UTIL_PKG_STATIC], [
165 if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then
166 $1=`pkg-config --libs --static "$2"`
168 AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
172 # These default values should work in most cases:
173 : ${BLKID_LIBS='-lblkid'}
174 : ${VOLUMEID_LIBS='-lvolume_id'}
176 # ... but for static build, we need to consult pkg-config:
177 if test -n "$enable_static_programs"; then
178 case $with_fsprobe in
179 blkid) UTIL_PKG_STATIC([BLKID_LIBS_STATIC], [blkid]) ;;
180 volume_id) UTIL_PKG_STATIC([VOLUMEID_LIBS_STATIC], [libvolume_id]) ;;
184 AC_ARG_VAR([BLKID_LIBS], [-l options for linking dynamically with blkid])
185 AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid])
186 AC_ARG_VAR([VOLUMEID_LIBS], [-l options for linking dynamically with volume_id])
187 AC_ARG_VAR([VOLUMEID_LIBS_STATIC], [-l options for linking statically with volume_id])
190 AM_GNU_GETTEXT_VERSION([0.14.1])
191 AM_GNU_GETTEXT([external])
192 if test -d "$srcdir/po"
194 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
196 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"
199 AC_ARG_WITH([ncurses],
200 AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
201 (--without-ncurses disables all ncurses(w) support)]),
202 [], with_ncurses=auto
204 AM_CONDITIONAL(HAVE_NCURSES, false)
206 if test "x$with_ncurses" != xno; then
208 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
209 if test "x$with_ncurses" = xauto; then
210 UTIL_CHECK_LIB(ncursesw, tputs, ncurses)
211 if test "x$have_ncurses" = xyes; then
212 NCURSES_LIBS="-lncursesw"
215 if test "x$have_ncurses" = xno; then
216 UTIL_CHECK_LIB(ncurses, tputs)
217 if test "x$have_ncurses" = xyes; then
218 NCURSES_LIBS="-lncurses"
222 if test "x$have_ncurses" = xno; then
223 AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
226 AC_SUBST([NCURSES_LIBS])
230 AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
235 AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes])
236 AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes)
239 if test "x$with_slang" = xyes; then
240 AC_CHECK_HEADERS([slcurses.h slang/slcurses.h], [use_slang=yes])
241 if test "x$use_slang" = xno; then
242 AC_MSG_ERROR([slang selected but slcurses.h not found])
245 AM_CONDITIONAL(USE_SLANG, test "x$use_slang" = xyes)
248 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
249 #define _XOPEN_SOURCE
252 char *c = crypt("abc","pw");
255 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
256 #define _XOPEN_SOURCE
259 char *c = crypt("abc","pw");
261 AC_DEFINE(NEED_LIBCRYPT, 1, [Do we need -lcrypt?])
264 AC_MSG_ERROR([crypt() is not available])
268 AM_CONDITIONAL(NEED_LIBCRYPT, test "x$need_libcrypt" = xyes)
270 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
275 [AC_DEFINE(HAVE___PROGNAME, 1, Do we have __progname?)
279 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
287 if (w == WEOF) exit(1);
291 [AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?)
295 dnl UTIL_CHECK_SYSCALL(SYSCALL, FALLBACK, ...)
296 dnl Only specify FALLBACK if the SYSCALL
297 dnl you're checking for is a "newish" one
298 dnl -------------------------------------
299 AC_DEFUN([UTIL_CHECK_SYSCALL], [
300 dnl This macro uses host_cpu.
301 AC_REQUIRE([AC_CANONICAL_HOST])
302 AC_CACHE_CHECK([for syscall $1],
303 [util_cv_syscall_$1],
304 [_UTIL_SYSCALL_CHECK_DECL([SYS_$1],
306 [dnl Our libc failed use, so see if we can get the kernel
307 dnl headers to play ball ...
308 _UTIL_SYSCALL_CHECK_DECL([_NR_$1],
312 if test "x$linux_os" = xyes; then
314 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shift($@))
319 util_cv_syscall_$1=$syscall
321 AM_CONDITIONAL([HAVE_]m4_toupper($1), [test "x$util_cv_syscall_$1" != xno])
322 case $util_cv_syscall_$1 in #(
323 no) AC_MSG_WARN([Unable to detect syscall $1.]) ;;
325 *) AC_DEFINE_UNQUOTED([SYS_$1], [$util_cv_syscall_$1],
326 [Fallback syscall number for $1]) ;;
330 dnl _UTIL_SYSCALL_CHECK_DECL(SYMBOL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
331 dnl Check if SYMBOL is declared, using the headers needed for syscall checks.
332 dnl -------------------------------------
333 m4_define([_UTIL_SYSCALL_CHECK_DECL],
334 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
335 #include <sys/syscall.h>
337 ]], [[int test = $1;]])],
341 dnl _UTIL_CHECK_SYSCALL_FALLBACK(PATTERN, VALUE, ...)
342 dnl Helper macro to create the body for the above `case'.
343 dnl -------------------------------------
344 m4_define([_UTIL_CHECK_SYSCALL_FALLBACK],
347 $1) syscall="$2" ;;dnl
348 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shiftn(2, $@))])dnl
352 UTIL_CHECK_SYSCALL([pivot_root])
353 UTIL_CHECK_SYSCALL([sched_getaffinity])
354 UTIL_CHECK_SYSCALL([ioprio_set],
363 UTIL_CHECK_SYSCALL([ioprio_get],
374 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
379 struct tm *tm = localtime(0);
380 if (a == -1) /* false */
381 sleep(tm->tm_gmtoff);
383 [AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?])
395 ADDR_LIMIT_3GB], [], [], [#include <linux/personality.h>])
397 AC_CHECK_HEADERS([sys/swap.h])
399 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
401 #ifdef HAVE_SYS_SWAP_H
402 # include <sys/swap.h>
406 [[swapon("/dev/null", 0);]])],
407 [AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
409 [AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
413 dnl UTIL_SET_ARCH(ARCHNAME, PATTERN)
414 dnl ---------------------------------
415 AC_DEFUN([UTIL_SET_ARCH], [
420 AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test "x$cpu_$1" = xtrue])
423 UTIL_SET_ARCH(I86, i?86-*)
424 UTIL_SET_ARCH(86_64, x86_64*)
425 UTIL_SET_ARCH(IA64, ia64*)
426 UTIL_SET_ARCH(S390, s390*)
427 UTIL_SET_ARCH(SPARC, sparc*)
428 UTIL_SET_ARCH(PPC, ppc*|powerpc*)
429 UTIL_SET_ARCH(M68K, m68*)
430 UTIL_SET_ARCH(MIPS, mips*)
431 UTIL_SET_ARCH(HPPA, hppa*)
433 AC_ARG_ENABLE([arch],
434 AS_HELP_STRING([--enable-arch], [do build arch]),
437 AM_CONDITIONAL(BUILD_ARCH, test "x$enable_arch" = xyes)
439 AC_ARG_ENABLE([agetty],
440 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
441 [], enable_agetty=yes
443 AM_CONDITIONAL(BUILD_AGETTY, test "x$enable_agetty" = xyes)
445 AC_ARG_ENABLE([cramfs],
446 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
447 [], enable_cramfs=check
450 if test "x$enable_cramfs" = xno; then
454 dnl Trick: leave the third parameter empty to get the default action.
455 AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
456 case $enable_cramfs:$build_cramfs in
457 yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
460 AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
463 AC_ARG_ENABLE([elvtune],
464 AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
465 [], enable_elvtune=no
467 AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes)
470 AC_ARG_ENABLE([init],
471 AS_HELP_STRING([--enable-init], [build simpleinit, shutdown, initctl]),
474 AM_CONDITIONAL(BUILD_INIT, test "x$enable_init" = xyes)
477 AC_ARG_ENABLE([kill],
478 AS_HELP_STRING([--enable-kill], [build kill]),
481 AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
484 AC_ARG_ENABLE([last],
485 AS_HELP_STRING([--enable-last], [build last]),
488 AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes)
491 AC_ARG_ENABLE([mesg],
492 AS_HELP_STRING([--enable-mesg], [build mesg]),
495 AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes)
498 AC_ARG_ENABLE([partx],
499 AS_HELP_STRING([--enable-partx], [build addpart, delpart, partx]),
502 AM_CONDITIONAL(BUILD_PARTX, test "x$enable_partx" = xyes)
506 AS_HELP_STRING([--enable-raw], [build raw]),
509 AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes)
512 AC_ARG_ENABLE([rdev],
513 AS_HELP_STRING([--enable-rdev], [build rdev on i386]),
516 AM_CONDITIONAL(BUILD_RDEV, test "x$enable_rdev" = xyes)
519 AC_ARG_ENABLE([rename],
520 AS_HELP_STRING([--disable-rename], [do not build rename]),
521 [], enable_rename=yes
523 AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes)
526 AC_ARG_ENABLE([reset],
527 AS_HELP_STRING([--enable-reset], [build reset]),
530 AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes)
533 AC_ARG_ENABLE([login-utils],
534 AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
535 [], enable_login_utils=no
537 AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes)
540 [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
542 AM_CONDITIONAL(HAVE_PAM, false)
543 if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then
544 AC_CHECK_HEADERS([security/pam_misc.h],
545 [AM_CONDITIONAL(HAVE_PAM, true)],
546 [if test "x$with_pam" = xyes; then
547 AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
552 AC_ARG_WITH([selinux],
553 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
557 if test "x$with_selinux" = xno; then
558 AM_CONDITIONAL(HAVE_SELINUX, false)
560 UTIL_CHECK_LIB(selinux, getprevcon)
561 case "$with_selinux:$have_selinux" in
562 yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
566 if test "x$have_selinux" = xyes; then
567 SELINUX_LIBS="-lselinux -lsepol"
568 SELINUX_LIBS_STATIC="-lselinux -lsepol"
570 AC_SUBST([SELINUX_LIBS])
571 AC_SUBST([SELINUX_LIBS_STATIC])
574 AS_HELP_STRING([--with-audit], [compile with audit support]),
578 if test "x$with_audit" = xno; then
579 AM_CONDITIONAL(HAVE_AUDIT, false)
581 UTIL_CHECK_LIB(audit, audit_log_user_message)
582 case "$with_audit:$have_audit" in
584 AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
590 AC_ARG_ENABLE([schedutils],
591 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
592 [], enable_schedutils=yes
594 AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes)
597 AC_ARG_ENABLE([wall],
598 AS_HELP_STRING([--disable-wall], [do not build wall]),
601 AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes)
604 AC_ARG_ENABLE([write],
605 AS_HELP_STRING([--enable-write], [build write]),
608 AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes)
611 AC_ARG_ENABLE([chsh-only-listed],
612 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
613 [], enable_chsh_only_listed=yes
616 if test "x$enable_chsh_only_listed" = xyes; then
617 AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
621 AC_ARG_ENABLE([login-chown-vcs],
622 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
623 [], enable_login_chown_vcs=no
626 if test "x$enable_login_chown_vcs" = xyes; then
627 AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
631 AC_ARG_ENABLE([login-stat-mail],
632 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
633 [], enable_login_stat_mail=no
636 if test "x$enable_login_stat_mail" = xyes; then
637 AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
641 AC_ARG_ENABLE([pg-bell],
642 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
643 [], enable_pg_bell=yes
646 if test "x$enable_pg_bell" = xyes; then
647 AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
651 AC_ARG_ENABLE([require-password],
652 AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
653 [], enable_require_password=yes
656 if test "x$enable_require_password" = xyes; then
657 AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
661 AC_ARG_ENABLE([use-tty-group],
662 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
663 [], enable_use_tty_group=yes
665 AM_CONDITIONAL(USE_TTY_GROUP, test "x$enable_use_tty_group" = xyes)
667 if test "x$enable_use_tty_group" = xyes; then
668 AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
671 AC_ARG_ENABLE([makeinstall-chown],
672 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
673 [], enable_makeinstall_chown=yes
675 AM_CONDITIONAL(MAKEINSTALL_DO_CHOWN, test "x$enable_makeinstall_chown" = xyes)
678 AC_ARG_VAR([SUID_CFLAGS],
679 [CFLAGS used for binaries which are usually with the suid bit])
680 AC_ARG_VAR([SUID_LDFLAGS],
681 [LDFLAGS used for binaries which are usually with the suid bit])
686 AC_CONFIG_HEADERS(config.h)
705 tests/helpers/Makefile
707 misc-utils/chkdupexe:misc-utils/chkdupexe.pl