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