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