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