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