]> git.ipfire.org Git - thirdparty/util-linux.git/blame - configure.ac
cfdisk: fix "cannot seek on disk drive" bug
[thirdparty/util-linux.git] / configure.ac
CommitLineData
1c3af053 1AC_INIT(util-linux-ng, 2.15-rc2, kzak@redhat.com)
baf39af1 2
7fc9786b 3AC_PREREQ(2.60)
48d7b13a
KZ
4
5AC_CONFIG_AUX_DIR(config)
b12991dd 6AC_CONFIG_MACRO_DIR([m4])
48d7b13a 7
42d2a7ba 8AM_INIT_AUTOMAKE([check-news -Wall foreign 1.9 dist-bzip2])
48d7b13a
KZ
9
10AC_CONFIG_SRCDIR(mount/mount.c)
11
15a9b48c
SK
12AC_PREFIX_DEFAULT([/usr])
13
a0487b1c
KZ
14dnl blkid version definition (the library SONAME is
15dnl "libblkid.so.$BLKID_VERSION_MAJOR", see blkid/Makefile.am)
16dnl ----------------------------------------------------------
a0948ffe 17BLKID_VERSION_MAJOR=1
0152a9ea 18BLKID_VERSION_MINOR=99
a0948ffe 19BLKID_VERSION_RELEASE=0
a0487b1c 20BLKID_DATE="10-Feb-2009"
a0948ffe
KZ
21
22BLKID_VERSION=$BLKID_VERSION_MAJOR.$BLKID_VERSION_MINOR.$BLKID_VERSION_RELEASE
b12991dd 23BLKID_VERSION_INFO=`expr $BLKID_VERSION_MAJOR + $BLKID_VERSION_MINOR`:$BLKID_VERSION_RELEASE:$BLKID_VERSION_MINOR
a0948ffe 24
15a9b48c
SK
25# Check whether exec_prefix=/usr:
26case $exec_prefix:$prefix in
27NONE:NONE | NONE:/usr | /usr:*)
28 AC_MSG_NOTICE([Default --exec-prefix detected.])
29 case $bindir in
30 '${exec_prefix}/bin') bindir=/bin
31 AC_MSG_NOTICE([ --bindir defaults to /bin]) ;;
32 esac
33 case $sbindir in
34 '${exec_prefix}/sbin') sbindir=/sbin
35 AC_MSG_NOTICE([ --sbindir defaults to /sbin]) ;;
971f57f6
KZ
36 esac
37 case $libdir in
38 '${exec_prefix}/lib') libdir=/lib
39 AC_MSG_NOTICE([ --libdir defaults to /lib]) ;;
15a9b48c
SK
40 esac ;;
41esac
48d7b13a 42
b0a0d7d5
KZ
43# lib64
44case ${libdir} in
45 *lib64) libdirname=lib64 ;;
46 *) libdirname=lib
47esac
48AC_SUBST([libdirname])
49
48d7b13a 50AC_PROG_CC_STDC
240f7101 51AC_GNU_SOURCE
a6996860 52AC_CANONICAL_HOST
fbaec83b 53AC_C_BIGENDIAN
b12991dd
KZ
54
55dnl libtool-2
56LT_INIT
48d7b13a 57
d06d028a
KZ
58PKG_PROG_PKG_CONFIG
59
8c182554
KZ
60linux_os=no
61case ${host_os} in
62 *linux*)
63 linux_os=yes
64 ;;
65esac
49ccbae6 66AM_CONDITIONAL([LINUX], test "x$linux_os" = xyes)
8c182554 67
48d7b13a 68AC_PATH_PROG(PERL, perl)
3f5bda01
KZ
69AC_PATH_PROG(BLKID, blkid, [], [$PATH:/sbin])
70AC_PATH_PROG(VOLID, vol_id, [], [$PATH:/lib/udev])
48d7b13a
KZ
71
72AC_SYS_LARGEFILE
73
e460a5bf 74AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
48d7b13a
KZ
75#ifdef HAVE_LINUX_COMPILER_H
76#include <linux/compiler.h>
77#endif
78])
bf962c0a 79AC_CHECK_HEADERS(
a0948ffe
KZ
80 [err.h \
81 errno.h \
82 getopt.h \
bf962c0a 83 langinfo.h \
a0948ffe
KZ
84 linux/fd.h \
85 linux/tiocl.h \
86 linux/version.h \
8b7f16fc 87 locale.h \
607c2a72 88 stdlib.h \
a0948ffe 89 pty.h \
607c2a72 90 mntent.h \
bf962c0a 91 rpcsvc/nfs_prot.h \
a0948ffe
KZ
92 scsi/scsi.h \
93 stdlib.h \
94 sys/disk.h \
95 sys/disklabel.h \
96 sys/ioctl.h \
bf962c0a 97 sys/io.h \
a0948ffe
KZ
98 sys/mkdev.h \
99 sys/prctl.h \
100 sys/queue.h \
101 sys/stat.h \
102 sys/types.h \
103 sys/user.h \
104 unistd.h ])
fd67be31
SK
105AC_CHECK_HEADERS([linux/raw.h],
106 [AM_CONDITIONAL([HAVE_RAW], [true])],
107 [AM_CONDITIONAL([HAVE_RAW], [false])])
48d7b13a 108
bf962c0a
SK
109AC_CHECK_FUNCS(
110 [inet_aton \
111 fsync \
112 getdomainname \
e27a08ab 113 get_current_dir_name \
bf962c0a
SK
114 nanosleep \
115 personality \
116 updwtmp \
117 lchown \
a0948ffe
KZ
118 llseek \
119 lseek64 \
120 strtoull \
fc7aeb09 121 inotify_init \
a0948ffe
KZ
122 prctl \
123 __secure_getenv \
bf962c0a 124 rpmatch])
48d7b13a 125AC_FUNC_FSEEKO
48d7b13a 126
8569410c 127dnl Static compilation
642f01a3 128m4_define([UTIL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid])
8569410c
SK
129
130AC_ARG_ENABLE([static-programs],
131 [AS_HELP_STRING([--enable-static-programs=LIST],
132 [link static the programs in LIST (comma-separated,
133 supported for ]m4_defn([UTIL_STATIC_PROGRAMS])[)])])
134
135case $enable_static_programs in
136yes) enable_static_programs=m4_quote(UTIL_STATIC_PROGRAMS) ;;
137no) enable_static_programs= ;;
138esac
139
8569410c
SK
140dnl Set all the individual AM_CONDITIONALs
141m4_foreach([UTIL_PRG], m4_defn([UTIL_STATIC_PROGRAMS]), [
142 case ,$enable_static_programs, in
143 *,UTIL_PRG,*) static_[]UTIL_PRG=yes ;;
144 esac
145 AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UTIL_PRG),
49ccbae6 146 [test "x$static_[]UTIL_PRG" = xyes])
8569410c
SK
147])
148
40cc242e
KZ
149dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1]))
150dnl The VARSUFFIX is optional and overrides the default behaviour. For example:
151dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX
152dnl UTIL_CHECK_LIB(yyy, func) generates have_yyy and HAVE_LIBYYY
fd67be31
SK
153dnl ---------------------------------
154AC_DEFUN([UTIL_CHECK_LIB], [
40cc242e
KZ
155 m4_define([suffix], m4_default([$3],$1))
156 [have_]suffix=yes
157 m4_ifdef([$3],
158 [AC_CHECK_LIB([$1], [$2], [AC_DEFINE(AS_TR_CPP([HAVE_LIB]suffix), 1)], [[have_]suffix=no])],
159 [AC_CHECK_LIB([$1], [$2], [], [[have_]suffix=no])])
160 AM_CONDITIONAL(AS_TR_CPP([HAVE_]suffix), [test [$have_]suffix = yes])
fd67be31 161])
9dc801d2 162
fd67be31 163UTIL_CHECK_LIB(uuid, uuid_is_null)
49ccbae6 164if test "x$have_uuid" = xno; then
9dc801d2
KZ
165 AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
166fi
167
fd67be31
SK
168UTIL_CHECK_LIB(util, openpty)
169UTIL_CHECK_LIB(termcap, tgetnum)
48d7b13a 170
d06d028a 171
40f07ff7 172AC_ARG_WITH([fsprobe],
43ddda95 173 [AS_HELP_STRING([--with-fsprobe=LIB], [library to guess filesystems, LIB should be builtin|blkid|volume_id, default is blkid])],
baae33d0 174 [], [with_fsprobe=blkid]
40f07ff7
KZ
175)
176
d06d028a
KZ
177build_libblkid=no
178have_blkid_evaluate=no
b446754d
KZ
179have_blkid=no
180have_volume_id=no
d06d028a 181
b446754d 182if test "x$with_fsprobe" = xblkid; then
d06d028a
KZ
183 PKG_CHECK_MODULES(BLKID, blkid, [have_blkid=yes], [])
184 AC_CHECK_LIB(blkid, blkid_evaluate_spec, [have_blkid_evaluate=yes], [])
b446754d 185elif test "x$with_fsprobe" = xvolume_id; then
d06d028a 186 PKG_CHECK_MODULES(VOLUME_ID, volume_id, [have_volume_id=yes], [])
b446754d
KZ
187elif test "x$with_fsprobe" = xbuiltin; then
188 have_blkid=yes
d06d028a
KZ
189 build_libblkid=yes
190 have_blkid_evaluate=yes
191 AC_SUBST(BLKID_VERSION_MAJOR)
192 AC_SUBST(BLKID_VERSION_MINOR)
193 AC_SUBST(BLKID_VERSION_RELEASE)
194 AC_SUBST(BLKID_VERSION)
195 AC_SUBST(BLKID_VERSION_INFO)
196 AC_DEFINE_UNQUOTED(BLKID_VERSION, "$BLKID_VERSION", [libblkid version string])
197 AC_DEFINE_UNQUOTED(BLKID_DATE, "$BLKID_DATE", [libblkid date string])
b446754d
KZ
198fi
199
d06d028a
KZ
200if test "x$have_blkid" = xyes; then
201 AC_DEFINE(HAVE_LIBBLKID, 1, [Define to 1 if you have the -lblkid.])
202 if test "x$have_blkid_evaluate" = xyes; then
203 AC_DEFINE(HAVE_BLKID_EVALUATE_SPEC, 1, [Define to 1 if you have the blkid_evaluate_spec().])
204 fi
205fi
206
207AM_CONDITIONAL(HAVE_BLKID, test "x$have_blkid" = xyes)
208AM_CONDITIONAL(HAVE_VOLUME_ID, test "x$have_volume_id" = xyes)
209AM_CONDITIONAL(BUILD_LIBBLKID, test "x$build_libblkid" = xyes)
210
211
212AC_ARG_ENABLE([mount],
213 AS_HELP_STRING([--disable-mount], [do not build mount utilities]),
214 [], enable_mount=check
215)
d06d028a 216build_mount=yes
7177d32e
ABL
217if test "${enable_mount}" = "no"; then
218 build_mount=no
219elif test "x$linux_os" = xyes; then
7177d32e
ABL
220 if test "x$have_blkid" = xno && test "x$have_volume_id" = xno; then
221 AC_MSG_ERROR([blkid or volume_id is needed to build util-linux-ng mount utilities])
222 fi
223else
224 AC_MSG_WARN([non-linux system; do not build mount utilities])
225 build_mount=no
40f07ff7 226fi
7177d32e 227AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes)
48d7b13a 228
b446754d 229
607c2a72
KZ
230AC_ARG_ENABLE([fsck],
231 AS_HELP_STRING([--enable-fsck], [do build fsck]),
232 [], enable_fsck=no
233)
234if test "x$enable_fsck" = xyes; then
235 if test "x$have_blkid" = xno && test "x$have_volume_id" = xno; then
236 AC_MSG_ERROR([libblkid or libvolume_id is needed to build util-linux-ng fsck])
237 fi
238fi
239AM_CONDITIONAL(BUILD_FSCK, test "x$enable_fsck" = xyes)
240
241
64754af9
SK
242dnl UTIL_PKG_STATIC(VARIABLE, MODULES)
243dnl ----------------------------------
244AC_DEFUN([UTIL_PKG_STATIC], [
245 if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then
246 $1=`pkg-config --libs --static "$2"`
247 else
248 AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
249 fi
250])
251
8569410c 252# These default values should work in most cases:
af53f0f1 253: ${BLKID_LIBS='-lblkid -luuid'}
d06d028a 254: ${VOLUME_ID_LIBS='-lvolume_id'}
8569410c 255
64754af9
SK
256# ... but for static build, we need to consult pkg-config:
257if test -n "$enable_static_programs"; then
258 case $with_fsprobe in
259 blkid) UTIL_PKG_STATIC([BLKID_LIBS_STATIC], [blkid]) ;;
d06d028a 260 volume_id) UTIL_PKG_STATIC([VOLUME_ID_LIBS_STATIC], [libvolume_id]) ;;
64754af9
SK
261 esac
262fi
8569410c 263
8569410c 264AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid])
d06d028a 265AC_ARG_VAR([VOLUME_ID_LIBS_STATIC], [-l options for linking statically with volume_id])
8569410c
SK
266
267
8eeb575c 268AM_GNU_GETTEXT_VERSION([0.14.1])
48d7b13a 269AM_GNU_GETTEXT([external])
49ccbae6 270if test -d "$srcdir/po"
8eeb575c 271then
1b4a3d89 272 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
8eeb575c
KZ
273else
274 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"
275fi
48d7b13a 276
08d64aa2
KZ
277AC_ARG_WITH([ncurses],
278 AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
279 (--without-ncurses disables all ncurses(w) support)]),
280 [], with_ncurses=auto
281)
282AM_CONDITIONAL(HAVE_NCURSES, false)
283
284if test "x$with_ncurses" != xno; then
285 have_ncurses=no
286 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
287 if test "x$with_ncurses" = xauto; then
9ea8ac37 288 UTIL_CHECK_LIB(ncursesw, initscr, ncurses)
08d64aa2
KZ
289 if test "x$have_ncurses" = xyes; then
290 NCURSES_LIBS="-lncursesw"
291 fi
292 fi
49ccbae6 293 if test "x$have_ncurses" = xno; then
9ea8ac37 294 UTIL_CHECK_LIB(ncurses, initscr)
49ccbae6 295 if test "x$have_ncurses" = xyes; then
08d64aa2
KZ
296 NCURSES_LIBS="-lncurses"
297 fi
298 fi
299 ])
49ccbae6 300 if test "x$have_ncurses" = xno; then
08d64aa2
KZ
301 AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
302 fi
303fi
304AC_SUBST([NCURSES_LIBS])
305
48d7b13a 306
48d7b13a 307AC_ARG_WITH([slang],
7fa4f112 308 AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
271d98e0 309 [], with_slang=no
48d7b13a
KZ
310)
311
46e71118
AM
312have_tinfo=no
313AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes])
49ccbae6 314AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes)
46e71118 315
fd67be31 316use_slang=no
49ccbae6 317if test "x$with_slang" = xyes; then
fd67be31 318 AC_CHECK_HEADERS([slcurses.h slang/slcurses.h], [use_slang=yes])
49ccbae6 319 if test "x$use_slang" = xno; then
48d7b13a
KZ
320 AC_MSG_ERROR([slang selected but slcurses.h not found])
321 fi
322fi
49ccbae6 323AM_CONDITIONAL(USE_SLANG, test "x$use_slang" = xyes)
48d7b13a
KZ
324
325
cf002530 326AC_LINK_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
327#define _XOPEN_SOURCE
328#include <unistd.h>
cf002530 329]], [[
48d7b13a 330char *c = crypt("abc","pw");
cf002530 331]])],[],[
48d7b13a 332 LIBS="$LIBS -lcrypt"
cf002530 333 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
334 #define _XOPEN_SOURCE
335 #include <unistd.h>
cf002530 336 ]], [[
48d7b13a 337 char *c = crypt("abc","pw");
cf002530 338 ]])],[
48d7b13a
KZ
339 AC_DEFINE(NEED_LIBCRYPT, 1, [Do we need -lcrypt?])
340 need_libcrypt=yes
341 ],[
342 AC_MSG_ERROR([crypt() is not available])
343 ])
48d7b13a
KZ
344])
345
49ccbae6 346AM_CONDITIONAL(NEED_LIBCRYPT, test "x$need_libcrypt" = xyes)
48d7b13a 347
cf002530 348AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a 349#include <stdio.h>
cf002530 350]], [[
48d7b13a 351printf(__progname);
cf002530
SK
352]])],
353[AC_DEFINE(HAVE___PROGNAME, 1, Do we have __progname?)
354])
48d7b13a
KZ
355
356
cf002530 357AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
358#include <wchar.h>
359#include <wctype.h>
360#include <stdio.h>
cf002530 361]], [[
48d7b13a
KZ
362 wchar_t wc;
363 wint_t w;
364 w = fgetwc(stdin);
365 if (w == WEOF) exit(1);
366 wc = w;
367 fputwc(wc,stdout);
cf002530
SK
368]])],
369[AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?)
370])
48d7b13a
KZ
371
372
72065909
MF
373dnl UTIL_CHECK_SYSCALL(SYSCALL, FALLBACK, ...)
374dnl Only specify FALLBACK if the SYSCALL
375dnl you're checking for is a "newish" one
376dnl -------------------------------------
377AC_DEFUN([UTIL_CHECK_SYSCALL], [
378 dnl This macro uses host_cpu.
379 AC_REQUIRE([AC_CANONICAL_HOST])
380 AC_CACHE_CHECK([for syscall $1],
381 [util_cv_syscall_$1],
382 [_UTIL_SYSCALL_CHECK_DECL([SYS_$1],
383 [syscall=SYS_$1],
384 [dnl Our libc failed use, so see if we can get the kernel
385 dnl headers to play ball ...
386 _UTIL_SYSCALL_CHECK_DECL([_NR_$1],
387 [syscall=_NR_$1],
388 [
389 syscall=no
49ccbae6 390 if test "x$linux_os" = xyes; then
8c182554
KZ
391 case $host_cpu in
392 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shift($@))
393 esac
394 fi
72065909
MF
395 ])
396 ])
397 util_cv_syscall_$1=$syscall
398 ])
49ccbae6 399 AM_CONDITIONAL([HAVE_]m4_toupper($1), [test "x$util_cv_syscall_$1" != xno])
72065909
MF
400 case $util_cv_syscall_$1 in #(
401 no) AC_MSG_WARN([Unable to detect syscall $1.]) ;;
402 SYS_*) ;;
403 *) AC_DEFINE_UNQUOTED([SYS_$1], [$util_cv_syscall_$1],
404 [Fallback syscall number for $1]) ;;
405 esac
406])
407
408dnl _UTIL_SYSCALL_CHECK_DECL(SYMBOL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
409dnl Check if SYMBOL is declared, using the headers needed for syscall checks.
410dnl -------------------------------------
411m4_define([_UTIL_SYSCALL_CHECK_DECL],
412[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
413#include <sys/syscall.h>
414#include <unistd.h>
72065909
MF
415]], [[int test = $1;]])],
416[$2], [$3])
417])
48d7b13a 418
72065909
MF
419dnl _UTIL_CHECK_SYSCALL_FALLBACK(PATTERN, VALUE, ...)
420dnl Helper macro to create the body for the above `case'.
421dnl -------------------------------------
422m4_define([_UTIL_CHECK_SYSCALL_FALLBACK],
423[m4_ifval([$1],
424 [#(
425 $1) syscall="$2" ;;dnl
426 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shiftn(2, $@))])dnl
427])
48d7b13a 428
72065909
MF
429
430UTIL_CHECK_SYSCALL([pivot_root])
431UTIL_CHECK_SYSCALL([sched_getaffinity])
432UTIL_CHECK_SYSCALL([ioprio_set],
433 [alpha], [442],
434 [i*86], [289],
435 [ia64*], [1274],
436 [powerpc*], [273],
437 [s390*], [282],
438 [sparc*], [196],
447ae7b8 439 [sh*], [288],
72065909
MF
440 [x86_64*], [251])
441UTIL_CHECK_SYSCALL([ioprio_get],
442 [alpha], [443],
443 [i*86], [290],
444 [ia64*], [1275],
445 [powerpc*], [274],
446 [s390*], [283],
447 [sparc*], [218],
447ae7b8 448 [sh*], [289],
72065909 449 [x86_64*], [252])
19a224ad
MF
450
451
cf002530 452AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
453#include <time.h>
454#include <unistd.h>
cf002530 455]], [[
48d7b13a
KZ
456 int a = 0;
457 struct tm *tm = localtime(0);
458 if (a == -1) /* false */
459 sleep(tm->tm_gmtoff);
cf002530
SK
460]])],
461[AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?])
462])
48d7b13a 463
30e8b186
KZ
464AC_CHECK_MEMBERS([struct termios.c_line],,,
465 [[#include <termios.h>]])
466
2d281745
KZ
467AC_CHECK_DECLS([
468 ADDR_NO_RANDOMIZE,
469 FDPIC_FUNCPTRS,
470 MMAP_PAGE_ZERO,
471 ADDR_COMPAT_LAYOUT,
472 READ_IMPLIES_EXEC,
473 ADDR_LIMIT_32BIT,
474 WHOLE_SECONDS,
475 STICKY_TIMEOUTS,
476 ADDR_LIMIT_3GB], [], [], [#include <linux/personality.h>])
48d7b13a 477
22d36665 478AC_CHECK_HEADERS([sys/swap.h])
b3425806
SK
479
480AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
481[[
b3425806
SK
482#ifdef HAVE_SYS_SWAP_H
483# include <sys/swap.h>
484#endif
485#include <unistd.h>
486]],
487[[swapon("/dev/null", 0);]])],
488[AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
489],
490[AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
491])
492
493
e782f1d4
KZ
494dnl UTIL_SET_ARCH(ARCHNAME, PATTERN)
495dnl ---------------------------------
496AC_DEFUN([UTIL_SET_ARCH], [
497 cpu_$1=false
498 case "$host" in
499 $2) cpu_$1=true ;;
500 esac
49ccbae6 501 AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test "x$cpu_$1" = xtrue])
e782f1d4 502])
48d7b13a 503
e782f1d4
KZ
504UTIL_SET_ARCH(I86, i?86-*)
505UTIL_SET_ARCH(86_64, x86_64*)
506UTIL_SET_ARCH(IA64, ia64*)
507UTIL_SET_ARCH(S390, s390*)
508UTIL_SET_ARCH(SPARC, sparc*)
509UTIL_SET_ARCH(PPC, ppc*|powerpc*)
510UTIL_SET_ARCH(M68K, m68*)
511UTIL_SET_ARCH(MIPS, mips*)
eeadb4f4 512UTIL_SET_ARCH(HPPA, hppa*)
48d7b13a 513
6a97809b
KZ
514AC_ARG_ENABLE([arch],
515 AS_HELP_STRING([--enable-arch], [do build arch]),
516 [], enable_arch=no
517)
49ccbae6 518AM_CONDITIONAL(BUILD_ARCH, test "x$enable_arch" = xyes)
48d7b13a
KZ
519
520AC_ARG_ENABLE([agetty],
7fa4f112 521 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
271d98e0 522 [], enable_agetty=yes
48d7b13a 523)
49ccbae6 524AM_CONDITIONAL(BUILD_AGETTY, test "x$enable_agetty" = xyes)
48d7b13a 525
9cb68977 526AC_ARG_ENABLE([cramfs],
7fa4f112 527 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
271d98e0 528 [], enable_cramfs=check
9cb68977
KZ
529)
530
49ccbae6 531if test "x$enable_cramfs" = xno; then
fd67be31
SK
532 build_cramfs=no
533else
534 build_cramfs=yes
535 dnl Trick: leave the third parameter empty to get the default action.
536 AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
537 case $enable_cramfs:$build_cramfs in
538 yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
539 esac
9cb68977 540fi
49ccbae6 541AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
9cb68977
KZ
542
543
48d7b13a 544AC_ARG_ENABLE([elvtune],
7fa4f112 545 AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
271d98e0 546 [], enable_elvtune=no
48d7b13a 547)
49ccbae6 548AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes)
48d7b13a
KZ
549
550
551AC_ARG_ENABLE([init],
7fa4f112 552 AS_HELP_STRING([--enable-init], [build simpleinit, shutdown, initctl]),
271d98e0 553 [], enable_init=no
48d7b13a 554)
49ccbae6 555AM_CONDITIONAL(BUILD_INIT, test "x$enable_init" = xyes)
48d7b13a
KZ
556
557
558AC_ARG_ENABLE([kill],
7fa4f112 559 AS_HELP_STRING([--enable-kill], [build kill]),
271d98e0 560 [], enable_kill=no
48d7b13a 561)
49ccbae6 562AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
48d7b13a
KZ
563
564
565AC_ARG_ENABLE([last],
7fa4f112 566 AS_HELP_STRING([--enable-last], [build last]),
271d98e0 567 [], enable_last=no
48d7b13a 568)
49ccbae6 569AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes)
48d7b13a
KZ
570
571
572AC_ARG_ENABLE([mesg],
7fa4f112 573 AS_HELP_STRING([--enable-mesg], [build mesg]),
271d98e0 574 [], enable_mesg=no
48d7b13a 575)
49ccbae6 576AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes)
48d7b13a
KZ
577
578
579AC_ARG_ENABLE([partx],
7fa4f112 580 AS_HELP_STRING([--enable-partx], [build addpart, delpart, partx]),
271d98e0 581 [], enable_partx=no
48d7b13a 582)
49ccbae6 583AM_CONDITIONAL(BUILD_PARTX, test "x$enable_partx" = xyes)
48d7b13a
KZ
584
585
586AC_ARG_ENABLE([raw],
7fa4f112 587 AS_HELP_STRING([--enable-raw], [build raw]),
271d98e0 588 [], enable_raw=no
48d7b13a 589)
49ccbae6 590AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes)
48d7b13a
KZ
591
592
593AC_ARG_ENABLE([rdev],
7fa4f112 594 AS_HELP_STRING([--enable-rdev], [build rdev on i386]),
271d98e0 595 [], enable_rdev=no
48d7b13a 596)
49ccbae6 597AM_CONDITIONAL(BUILD_RDEV, test "x$enable_rdev" = xyes)
48d7b13a
KZ
598
599
600AC_ARG_ENABLE([rename],
7fa4f112 601 AS_HELP_STRING([--disable-rename], [do not build rename]),
271d98e0 602 [], enable_rename=yes
48d7b13a 603)
49ccbae6 604AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes)
48d7b13a
KZ
605
606
607AC_ARG_ENABLE([reset],
7fa4f112 608 AS_HELP_STRING([--enable-reset], [build reset]),
271d98e0 609 [], enable_reset=no
48d7b13a 610)
49ccbae6 611AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes)
48d7b13a
KZ
612
613
614AC_ARG_ENABLE([login-utils],
7fa4f112 615 AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
271d98e0 616 [], enable_login_utils=no
48d7b13a 617)
49ccbae6 618AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes)
48d7b13a 619
9cb68977 620AC_ARG_WITH([pam],
7fa4f112 621 [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
9cb68977 622
fd67be31 623AM_CONDITIONAL(HAVE_PAM, false)
49ccbae6 624if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then
fd67be31
SK
625 AC_CHECK_HEADERS([security/pam_misc.h],
626 [AM_CONDITIONAL(HAVE_PAM, true)],
49ccbae6 627 [if test "x$with_pam" = xyes; then
fd67be31
SK
628 AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
629 fi
630 ])
9cb68977 631fi
9cb68977
KZ
632
633AC_ARG_WITH([selinux],
7fa4f112 634 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
271d98e0 635 [], with_selinux=no
9cb68977
KZ
636)
637
49ccbae6 638if test "x$with_selinux" = xno; then
fd67be31
SK
639 AM_CONDITIONAL(HAVE_SELINUX, false)
640else
641 UTIL_CHECK_LIB(selinux, getprevcon)
49ccbae6 642 case "$with_selinux:$have_selinux" in
fd67be31
SK
643 yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
644 esac
9cb68977 645fi
9cb68977 646
49ccbae6 647if test "x$have_selinux" = xyes; then
8569410c
SK
648 SELINUX_LIBS="-lselinux -lsepol"
649 SELINUX_LIBS_STATIC="-lselinux -lsepol"
650fi
651AC_SUBST([SELINUX_LIBS])
652AC_SUBST([SELINUX_LIBS_STATIC])
9cb68977 653
bbae9cb0 654AC_ARG_WITH([audit],
7fa4f112 655 AS_HELP_STRING([--with-audit], [compile with audit support]),
271d98e0 656 [], with_audit=no
bbae9cb0
KZ
657)
658
49ccbae6 659if test "x$with_audit" = xno; then
fd67be31
SK
660 AM_CONDITIONAL(HAVE_AUDIT, false)
661else
662 UTIL_CHECK_LIB(audit, audit_log_user_message)
49ccbae6 663 case "$with_audit:$have_audit" in
fd67be31
SK
664 yes:no)
665 AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
666 ;;
667 esac
bbae9cb0 668fi
bbae9cb0 669
48d7b13a 670AC_ARG_ENABLE([schedutils],
7fa4f112 671 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
271d98e0 672 [], enable_schedutils=yes
48d7b13a 673)
49ccbae6 674AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes)
48d7b13a
KZ
675
676
677AC_ARG_ENABLE([wall],
7fa4f112 678 AS_HELP_STRING([--disable-wall], [do not build wall]),
271d98e0 679 [], enable_wall=yes
48d7b13a 680)
49ccbae6 681AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes)
48d7b13a
KZ
682
683
684AC_ARG_ENABLE([write],
7fa4f112 685 AS_HELP_STRING([--enable-write], [build write]),
271d98e0 686 [], enable_write=no
48d7b13a 687)
49ccbae6 688AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes)
48d7b13a
KZ
689
690
691AC_ARG_ENABLE([chsh-only-listed],
7fa4f112 692 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
271d98e0 693 [], enable_chsh_only_listed=yes
48d7b13a
KZ
694)
695
49ccbae6 696if test "x$enable_chsh_only_listed" = xyes; then
48d7b13a
KZ
697 AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
698fi
699
700
701AC_ARG_ENABLE([login-chown-vcs],
7fa4f112 702 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
271d98e0 703 [], enable_login_chown_vcs=no
48d7b13a
KZ
704)
705
49ccbae6 706if test "x$enable_login_chown_vcs" = xyes; then
48d7b13a
KZ
707 AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
708fi
709
710
711AC_ARG_ENABLE([login-stat-mail],
7fa4f112 712 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
271d98e0 713 [], enable_login_stat_mail=no
48d7b13a
KZ
714)
715
49ccbae6 716if test "x$enable_login_stat_mail" = xyes; then
48d7b13a
KZ
717 AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
718fi
719
720
721AC_ARG_ENABLE([pg-bell],
7fa4f112 722 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
271d98e0 723 [], enable_pg_bell=yes
48d7b13a
KZ
724)
725
49ccbae6 726if test "x$enable_pg_bell" = xyes; then
48d7b13a
KZ
727 AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
728fi
729
730
731AC_ARG_ENABLE([require-password],
7fa4f112 732 AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
271d98e0 733 [], enable_require_password=yes
48d7b13a
KZ
734)
735
49ccbae6 736if test "x$enable_require_password" = xyes; then
48d7b13a
KZ
737 AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
738fi
739
740
741AC_ARG_ENABLE([use-tty-group],
7fa4f112 742 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
271d98e0 743 [], enable_use_tty_group=yes
48d7b13a 744)
49ccbae6 745AM_CONDITIONAL(USE_TTY_GROUP, test "x$enable_use_tty_group" = xyes)
48d7b13a 746
49ccbae6 747if test "x$enable_use_tty_group" = xyes; then
48d7b13a
KZ
748 AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
749fi
750
f3831bbd
KZ
751AC_ARG_ENABLE([makeinstall-chown],
752 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
753 [], enable_makeinstall_chown=yes
754)
49ccbae6 755AM_CONDITIONAL(MAKEINSTALL_DO_CHOWN, test "x$enable_makeinstall_chown" = xyes)
f3831bbd 756
06bcee19 757
1f10890f
SK
758AC_ARG_VAR([SUID_CFLAGS],
759 [CFLAGS used for binaries which are usually with the suid bit])
760AC_ARG_VAR([SUID_LDFLAGS],
761 [LDFLAGS used for binaries which are usually with the suid bit])
06bcee19 762
9cb68977 763LIBS=""
48d7b13a 764
48d7b13a
KZ
765
766AC_CONFIG_HEADERS(config.h)
767
8eeb575c
KZ
768AC_CONFIG_FILES([
769Makefile
770disk-utils/Makefile
562218e6 771fdisk/Makefile
607c2a72 772fsck/Makefile
8eeb575c
KZ
773getopt/Makefile
774hwclock/Makefile
562218e6 775include/Makefile
d00ed891 776lib/Makefile
24a06aeb 777libs/Makefile
6809e7b5 778libs/blkid/blkid.pc
a0948ffe 779libs/blkid/Makefile
51410fc6 780libs/blkid/bin/Makefile
a0948ffe 781libs/blkid/src/Makefile
51410fc6 782libs/blkid/src/probers/Makefile
8eeb575c
KZ
783login-utils/Makefile
784misc-utils/Makefile
785mount/Makefile
786partx/Makefile
787po/Makefile.in
788schedutils/Makefile
789sys-utils/Makefile
790text-utils/Makefile
e83446da 791tests/Makefile
0f0584ad 792tests/helpers/Makefile
e83446da 793tests/commands.sh
cc462132 794misc-utils/chkdupexe:misc-utils/chkdupexe.pl
8eeb575c 795])
48d7b13a
KZ
796
797AC_OUTPUT