]> git.ipfire.org Git - thirdparty/util-linux.git/blame - configure.ac
sfdisk: rename warn to my_warn
[thirdparty/util-linux.git] / configure.ac
CommitLineData
69df550f 1AC_INIT(util-linux, 2.19, 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
97ce707b 8AM_INIT_AUTOMAKE([check-news -Wall foreign 1.10 dist-bzip2])
48d7b13a 9
eb35c251
GJ
10m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
11 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
12
48d7b13a
KZ
13AC_CONFIG_SRCDIR(mount/mount.c)
14
15a9b48c
SK
15AC_PREFIX_DEFAULT([/usr])
16
33b0be6d
KZ
17dnl version details from <major>.<minor>[-<suffix>]
18PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}')
19PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{print $2}' \
20 | awk -F- '{print $1}')
21PACKAGE_VERSION_RELEASE=0
a0948ffe 22
33b0be6d
KZ
23dnl libblkid version
24LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
69df550f 25LIBBLKID_DATE="10-Feb-2011"
dc2b8d87
KZ
26LIBBLKID_LT_MAJOR=1
27LIBBLKID_LT_MINOR=1
28LIBBLKID_LT_MICRO=0
29LIBBLKID_VERSION_INFO=`expr $LIBBLKID_LT_MAJOR + $LIBBLKID_LT_MINOR`:$LIBBLKID_LT_MICRO:$LIBBLKID_LT_MINOR
a0948ffe 30
f6076f55
KZ
31dnl libuuid version
32LIBUUID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
dc2b8d87
KZ
33LIBUUID_LT_MAJOR=1
34LIBUUID_LT_MINOR=3
35LIBUUID_LT_MICRO=0
36LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR
f6076f55 37
f1cde479
KZ
38dnl libmount version
39LIBMOUNT_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
40LIBMOUNT_LT_MAJOR=1
41LIBMOUNT_LT_MINOR=1
42LIBMOUNT_LT_MICRO=0
43LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR
44
15a9b48c
SK
45# Check whether exec_prefix=/usr:
46case $exec_prefix:$prefix in
47NONE:NONE | NONE:/usr | /usr:*)
48 AC_MSG_NOTICE([Default --exec-prefix detected.])
49 case $bindir in
50 '${exec_prefix}/bin') bindir=/bin
51 AC_MSG_NOTICE([ --bindir defaults to /bin]) ;;
52 esac
53 case $sbindir in
54 '${exec_prefix}/sbin') sbindir=/sbin
55 AC_MSG_NOTICE([ --sbindir defaults to /sbin]) ;;
971f57f6
KZ
56 esac
57 case $libdir in
58 '${exec_prefix}/lib') libdir=/lib
59 AC_MSG_NOTICE([ --libdir defaults to /lib]) ;;
15a9b48c
SK
60 esac ;;
61esac
48d7b13a 62
cb5212e2 63libdirname=`basename "$libdir"`
b0a0d7d5
KZ
64AC_SUBST([libdirname])
65
996fb358 66# The original default values of {bin,sbin,lib}dir
aaf3e8f5 67usrbin_execdir='${exec_prefix}/bin'
30688dde 68AC_SUBST([usrbin_execdir])
996fb358 69
aaf3e8f5 70usrsbin_execdir='${exec_prefix}/sbin'
30688dde 71AC_SUBST([usrsbin_execdir])
996fb358 72
aaf3e8f5 73usrlib_execdir='${exec_prefix}/'$libdirname
30688dde 74AC_SUBST([usrlib_execdir])
996fb358
KZ
75
76
48d7b13a 77AC_PROG_CC_STDC
240f7101 78AC_GNU_SOURCE
a6996860 79AC_CANONICAL_HOST
85b4c147 80AC_C_CONST
e79829db 81AC_C_VOLATILE
fbaec83b 82AC_C_BIGENDIAN
b12991dd
KZ
83
84dnl libtool-2
85LT_INIT
48d7b13a 86
d06d028a
KZ
87PKG_PROG_PKG_CONFIG
88
22aa5166
KZ
89GTK_DOC_CHECK([1.10])
90AC_PATH_PROG([XSLTPROC], [xsltproc])
91
8c182554
KZ
92linux_os=no
93case ${host_os} in
94 *linux*)
95 linux_os=yes
96 ;;
97esac
49ccbae6 98AM_CONDITIONAL([LINUX], test "x$linux_os" = xyes)
8c182554 99
48d7b13a
KZ
100AC_PATH_PROG(PERL, perl)
101
102AC_SYS_LARGEFILE
103
e460a5bf 104AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
48d7b13a
KZ
105#ifdef HAVE_LINUX_COMPILER_H
106#include <linux/compiler.h>
107#endif
108])
bf962c0a 109AC_CHECK_HEADERS(
a0948ffe
KZ
110 [err.h \
111 errno.h \
112 getopt.h \
a0948ffe
KZ
113 linux/fd.h \
114 linux/tiocl.h \
115 linux/version.h \
b832c2fe 116 linux/falloc.h \
55113b15 117 linux/cdrom.h \
b832c2fe 118 fcntl.h \
8b7f16fc 119 locale.h \
754fed0c
KZ
120 stdint.h \
121 inttypes.h \
0bf9d41d 122 paths.h \
a0948ffe 123 pty.h \
607c2a72 124 mntent.h \
754fed0c
KZ
125 net/if.h \
126 net/if_dl.h \
127 netinet/in.h \
bf962c0a 128 rpcsvc/nfs_prot.h \
a0948ffe
KZ
129 stdlib.h \
130 sys/disk.h \
131 sys/disklabel.h \
132 sys/ioctl.h \
3edaa201 133 sys/ioccom.h \
bf962c0a 134 sys/io.h \
754fed0c 135 sys/time.h \
a0948ffe
KZ
136 sys/mkdev.h \
137 sys/prctl.h \
138 sys/queue.h \
754fed0c 139 sys/sockio.h \
2a7c1f70
KZ
140 sys/socket.h \
141 sys/syscall.h \
754fed0c
KZ
142 sys/file.h \
143 sys/ioctl.h \
a0948ffe
KZ
144 sys/stat.h \
145 sys/types.h \
754fed0c 146 sys/un.h \
a0948ffe 147 sys/user.h \
754fed0c 148 sys/resource.h \
a0948ffe 149 unistd.h ])
dc61d398 150
fd67be31
SK
151AC_CHECK_HEADERS([linux/raw.h],
152 [AM_CONDITIONAL([HAVE_RAW], [true])],
153 [AM_CONDITIONAL([HAVE_RAW], [false])])
48d7b13a 154
dc61d398
KZ
155AC_CHECK_HEADERS([langinfo.h],
156 [AM_CONDITIONAL([HAVE_LANGINFO], [true])],
157 [AM_CONDITIONAL([HAVE_LANGINFO], [false])])
158
159
a88057d9
TP
160AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
161
2a7c1f70
KZ
162AC_CHECK_DECL([llseek],
163 [AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1,
164 [Define to 1 if have llseek prototype])],
165 [],
166 [#include <unistd.h>])
167
168AC_CHECK_DECL([lseek64],
169 [AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
170 [Define to 1 if have lseek64 prototype])],
171 [],
172 [#define _LARGEFILE_SOURCE
173 #define _LARGEFILE64_SOURCE
174 #include <unistd.h>])
175
bf962c0a
SK
176AC_CHECK_FUNCS(
177 [inet_aton \
b7ce600d 178 futimens \
2a7c1f70 179 fstat64 \
bf962c0a
SK
180 fsync \
181 getdomainname \
e27a08ab 182 get_current_dir_name \
437fa54f 183 usleep \
bf962c0a
SK
184 nanosleep \
185 personality \
186 updwtmp \
3ac22f7a 187 jrand48 \
bf962c0a 188 lchown \
a0948ffe
KZ
189 llseek \
190 lseek64 \
191 strtoull \
754fed0c
KZ
192 sysconf \
193 getdtablesize \
a804f444 194 getexecname \
754fed0c
KZ
195 getrlimit \
196 srandom \
69045d3d
KZ
197 setresgid \
198 setresuid \
69b7e41e
KZ
199 strndup \
200 strnlen \
201 strnchr \
fc7aeb09 202 inotify_init \
a0948ffe 203 prctl \
a67bb3bf 204 posix_fadvise \
acf6ab6f 205 getmntinfo \
a0948ffe 206 __secure_getenv \
bf962c0a 207 rpmatch])
48d7b13a 208AC_FUNC_FSEEKO
48d7b13a 209
940fd28c
KZ
210AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
211
754fed0c
KZ
212AC_CHECK_MEMBER(struct sockaddr.sa_len,
213 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
214 [#include <sys/types.h>
215 #include <sys/socket.h>])
216
60cc9f94
FG
217SOCKET_LIBS=
218AC_SEARCH_LIBS([gethostbyname], [nsl],
219 [if test x"$ac_cv_search_gethostbyname" != x"none required"; then
220 SOCKET_LIBS="$SOCKET_LIBS -lnsl";
221 fi])
222AC_SEARCH_LIBS([socket], [socket],
223 [if test x"$ac_cv_search_socket" != x"none required"; then
224 SOCKET_LIBS="$SOCKET_LIBS -lsocket";
225 fi])
226AC_SUBST([SOCKET_LIBS])
227
d58c47d9
FG
228
229have_dirfd=no
230AC_CHECK_FUNCS([dirfd], [have_dirfd=yes], [have_dirfd=no])
231if test x"$have_dirfd" = xno ; then
232 AC_CHECK_DECLS([dirfd],
233 [have_dirfd=yes], [have_dirfd=no],
234 [#include <sys/types.h>
235 #include <dirent.h>])
236fi
237
238have_ddfd=no
239if test x"$have_dirfd" = xno ; then
240 AC_CHECK_MEMBERS([DIR.dd_fd],
241 [have_ddfd=yes], [have_ddfd=no],
242 [#include <sys/types.h>
243 #include <dirent.h>])
244fi
245
246case "$have_dirfd:$have_ddfd" in
247no:no)
248 AC_MSG_ERROR([cannot find a method to get filedescriptor of directory]) ;;
249esac
250
251
a804f444
FG
252AC_MSG_CHECKING(whether program_invocation_short_name is defined)
253AC_TRY_COMPILE([#include <argp.h>],
254 [program_invocation_short_name = "test";],
255 AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1,
256 [Define if program_invocation_short_name is defined])
257 AC_MSG_RESULT(yes),
258 AC_MSG_RESULT(no))
259
260AC_MSG_CHECKING([whether __progname is defined])
261AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
262 [if (*__progname == 0) return;])],
263 AC_DEFINE(HAVE___PROGNAME, 1, [Define if __progname is defined])
264 AC_MSG_RESULT(yes),
265 AC_MSG_RESULT(no))
266
8569410c 267dnl Static compilation
642f01a3 268m4_define([UTIL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid])
8569410c
SK
269
270AC_ARG_ENABLE([static-programs],
271 [AS_HELP_STRING([--enable-static-programs=LIST],
272 [link static the programs in LIST (comma-separated,
273 supported for ]m4_defn([UTIL_STATIC_PROGRAMS])[)])])
274
275case $enable_static_programs in
276yes) enable_static_programs=m4_quote(UTIL_STATIC_PROGRAMS) ;;
277no) enable_static_programs= ;;
278esac
279
8569410c
SK
280dnl Set all the individual AM_CONDITIONALs
281m4_foreach([UTIL_PRG], m4_defn([UTIL_STATIC_PROGRAMS]), [
282 case ,$enable_static_programs, in
283 *,UTIL_PRG,*) static_[]UTIL_PRG=yes ;;
284 esac
285 AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UTIL_PRG),
49ccbae6 286 [test "x$static_[]UTIL_PRG" = xyes])
8569410c
SK
287])
288
f910b559
KZ
289dnl UTIL_PKG_STATIC(VARIABLE, MODULES)
290dnl ----------------------------------
291AC_DEFUN([UTIL_PKG_STATIC], [
292 if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then
293 $1=`pkg-config --libs --static "$2"`
294 else
295 AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
296 fi
297])
298
40cc242e
KZ
299dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1]))
300dnl The VARSUFFIX is optional and overrides the default behaviour. For example:
301dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX
302dnl UTIL_CHECK_LIB(yyy, func) generates have_yyy and HAVE_LIBYYY
fd67be31
SK
303dnl ---------------------------------
304AC_DEFUN([UTIL_CHECK_LIB], [
40cc242e
KZ
305 m4_define([suffix], m4_default([$3],$1))
306 [have_]suffix=yes
307 m4_ifdef([$3],
308 [AC_CHECK_LIB([$1], [$2], [AC_DEFINE(AS_TR_CPP([HAVE_LIB]suffix), 1)], [[have_]suffix=no])],
309 [AC_CHECK_LIB([$1], [$2], [], [[have_]suffix=no])])
310 AM_CONDITIONAL(AS_TR_CPP([HAVE_]suffix), [test [$have_]suffix = yes])
fd67be31 311])
9dc801d2 312
6fed18f2
KZ
313dnl UTIL_SET_FLAGS(CFLAGS, CPPFLAGS, LDFLAGS)
314AC_DEFUN([UTIL_SET_FLAGS], [
315 old_CFLAGS="$CFLAGS"
316 old_CPPFLAGS="$CPPFLAGS"
317 old_LDFLAGS="$LDFLAGS"
318 CFLAGS="$CFLAGS $1"
319 CPPFLAGS="$CPPFLAGS $2"
320 LDFLAGS="$LDFLAGS $3"
321])
322
323dnl UTIL_RESTORE_FLAGS()
324AC_DEFUN([UTIL_RESTORE_FLAGS], [
325 CFLAGS="$old_CFLAGS"
326 CPPFLAGS="$old_CPPFLAGS"
327 LDFLAGS="$old_LDFLAGS"
328])
329
330
d7a01582 331AX_CHECK_TLS
3ac22f7a 332
f910b559
KZ
333AC_ARG_ENABLE([mount],
334 AS_HELP_STRING([--disable-mount], [do not build mount utilities]),
335 [], enable_mount=check
336)
337build_mount=yes
338if test "x$enable_mount" = xcheck; then
339 if test "x$linux_os" = xno; then
340 AC_MSG_WARN([non-linux system; do not build mount utilities])
341 build_mount=no
342 fi
343elif test "x$enable_mount" = xno; then
344 build_mount=no
345fi
346AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes)
347
348
349AC_ARG_ENABLE([fsck],
6c2a09b3
KZ
350 AS_HELP_STRING([--disable-fsck], [do not build fsck]),
351 [], enable_fsck=yes
f910b559
KZ
352)
353AM_CONDITIONAL(BUILD_FSCK, test "x$enable_fsck" = xyes)
354
355
17afb032
KZ
356AC_ARG_ENABLE([libuuid],
357 AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]),
358 [], enable_libuuid=yes
359)
dc2b8d87
KZ
360AC_SUBST([LIBUUID_VERSION])
361AC_SUBST([LIBUUID_VERSION_INFO])
17afb032
KZ
362AM_CONDITIONAL(BUILD_LIBUUID, test "x$enable_libuuid" = xyes)
363have_uuid=yes
364
365if test "x$enable_libuuid" = xno; then
366 # Check for external (e2fsprogs) libuuid
367 PKG_CHECK_MODULES(UUID, uuid, [have_uuid=yes], [have_uuid=no])
368 if test "x$have_uuid" = xno; then
369 # system without pkg-config or so, try classic check
370 AC_CHECK_LIB(uuid, uuid_is_null, [have_uuid=yes], [have_uuid=no])
371 fi
372 if test "x$have_uuid" = xyes; then
373 UTIL_SET_FLAGS($UUID_CFLAGS, $UUID_CFLAGS, $UUID_LIBS)
374 AC_CHECK_HEADERS([uuid.h uuid/uuid.h], [break], [])
375 UTIL_RESTORE_FLAGS
376 fi
377else
f910b559 378 # internal library
17afb032 379 AC_DEFINE(HAVE_UUID_H, 1, [Define to 1 if you have the <uuid.h> header file.])
9dc801d2
KZ
380fi
381
17afb032
KZ
382if test "x$have_uuid" = xyes; then
383 AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.])
384else
385 AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
386fi
387AM_CONDITIONAL(HAVE_UUID, test "x$have_uuid" = xyes)
388# default
389: ${UUID_LIBS='-luuid'}
48d7b13a 390
d06d028a 391
2ec884ac
KZ
392AC_ARG_ENABLE([uuidd],
393 AS_HELP_STRING([--disable-uuidd], [do not build the uuid daemon]),
394 [], enable_uuidd=auto
395)
396
397case "$enable_uuidd:$have_uuid" in
398yes:no)
399 AC_MSG_ERROR([cannot enable uuidd when libuuid is disabled]) ;;
400auto:*)
401 enable_uuidd=$have_uuid ;;
402esac
403if test "x$enable_uuidd" = xyes; then
404 AC_DEFINE(HAVE_UUIDD, 1, [Define to 1 if you want to use uuid daemon.])
405fi
406AM_CONDITIONAL(BUILD_UUIDD, test "x$enable_uuidd" = xyes)
407
408
f910b559
KZ
409AC_ARG_ENABLE([libblkid],
410 AS_HELP_STRING([--disable-libblkid], [do not build libblkid and blkid utilities]),
411 [], enable_libblkid=yes
40f07ff7 412)
033cf439 413AC_SUBST([LIBBLKID_DATE])
dc2b8d87
KZ
414AC_SUBST([LIBBLKID_VERSION])
415AC_SUBST([LIBBLKID_VERSION_INFO])
f910b559
KZ
416AM_CONDITIONAL(BUILD_LIBBLKID, test "x$enable_libblkid" = xyes)
417AC_DEFINE_UNQUOTED(LIBBLKID_VERSION, "$LIBBLKID_VERSION", [libblkid version string])
418AC_DEFINE_UNQUOTED(LIBBLKID_DATE, "$LIBBLKID_DATE", [libblkid date string])
419have_blkid=yes
420
421if test "x$enable_libblkid" = xno; then
422 if test "x$build_mount" = xyes || test "x$enable_fsck" = xyes; then
423 # Check for external (e2fsprogs) libblkid
424 PKG_CHECK_MODULES(BLKID, blkid, [have_blkid=yes], [have_blkid=no])
425 if test "x$have_blkid" = xno; then
426 # system without pkg-config or so, try classic check
427 AC_CHECK_LIB(blkid, blkid_get_cache, [have_blkid=yes], [have_blkid=no])
428 fi
429 if test "x$have_blkid" = xyes; then
430 UTIL_SET_FLAGS($BLKID_CFLAGS, $BLKID_CFLAGS, $BLKID_LIBS)
431 AC_CHECK_HEADERS([blkid.h blkid/blkid.h], [break], [])
432 UTIL_RESTORE_FLAGS
433 fi
434 if test -n "$enable_static_programs"; then
435 # TODO check only when mount of fsck are requested
436 UTIL_PKG_STATIC([BLKID_LIBS_STATIC], [blkid])
437 fi
7c950efa 438 fi
f910b559
KZ
439else
440 # internal library
441 AC_DEFINE(HAVE_BLKID_H, 1, [Define to 1 if you have the <blkid.h> header file.])
1a70e0cb 442 AC_DEFINE(HAVE_LIBBLKID_INTERNAL, 1, [Define to 1 if you have the in-tree libblkid.])
b446754d
KZ
443fi
444
f910b559 445if test "x$have_blkid" = xyes; then
d06d028a 446 AC_DEFINE(HAVE_LIBBLKID, 1, [Define to 1 if you have the -lblkid.])
7177d32e 447else
f910b559 448 if test "x$build_mount" = xyes; then
601d12fb 449 AC_MSG_ERROR([libblkid is needed to build util-linux mount])
607c2a72 450 fi
f910b559 451 if test "x$enable_fsck" = xyes; then
601d12fb 452 AC_MSG_ERROR([libblkid is needed to build util-linux fsck])
64754af9 453 fi
64754af9 454fi
f910b559
KZ
455AM_CONDITIONAL(HAVE_BLKID, test "x$have_blkid" = xyes)
456# default
457: ${BLKID_LIBS='-lblkid -luuid'}
8569410c 458
8569410c 459AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid])
f910b559 460
f1cde479
KZ
461
462AC_ARG_ENABLE([libmount],
463 AS_HELP_STRING([--disable-libmount], [do not build libmount]),
a2b3d040 464 [], enable_libmount=check
f1cde479 465)
a2b3d040
KZ
466build_libmount=yes
467if test "x$enable_libmount" = xcheck; then
468 if test "x$linux_os" = xno; then
469 AC_MSG_WARN([non-linux system; do not build libmount])
470 build_libmount=no
471 fi
472elif test "x$enable_libmount" = xno; then
473 build_libmount=no
474fi
8e368761 475
a2b3d040 476case "$enable_libblkid:$build_libmount" in
8e368761
KZ
477no:yes)
478 AC_MSG_ERROR([cannot enable libmount when libblkid is disabled]) ;;
479esac
480
f1cde479
KZ
481AC_SUBST([LIBMOUNT_VERSION])
482AC_SUBST([LIBMOUNT_VERSION_INFO])
f4ab4ae8 483AC_DEFINE_UNQUOTED(LIBMOUNT_VERSION, "$LIBMOUNT_VERSION", [libmount version string])
a2b3d040 484AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_libmount" = xyes)
f1cde479
KZ
485
486
37ef0439
KZ
487AC_ARG_ENABLE([libmount-mount],
488 AS_HELP_STRING([--enable-libmount-mount], [link mount(8) with libmount (EXPERIMENTAL)]),
489 [], enable_libmount_mount=no
490)
491
a2b3d040 492case "$build_libmount:$enable_libmount_mount" in
37ef0439
KZ
493no:yes)
494 AC_MSG_ERROR([cannot link mount(8) with libmount when libmount is disabled]) ;;
495yes:yes)
496 AC_DEFINE(HAVE_LIBMOUNT_MOUNT, 1, [use libmount for mount(8)])
497esac
498AM_CONDITIONAL(BUILD_LIBMOUNT_MOUNT, test "x$enable_libmount_mount" = xyes)
499
500
17afb032
KZ
501UTIL_CHECK_LIB(util, openpty)
502UTIL_CHECK_LIB(termcap, tgetnum)
8569410c 503
8eeb575c 504AM_GNU_GETTEXT_VERSION([0.14.1])
48d7b13a 505AM_GNU_GETTEXT([external])
49ccbae6 506if test -d "$srcdir/po"
8eeb575c 507then
1b4a3d89 508 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
8eeb575c
KZ
509else
510 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"
511fi
48d7b13a 512
08d64aa2
KZ
513AC_ARG_WITH([ncurses],
514 AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
515 (--without-ncurses disables all ncurses(w) support)]),
516 [], with_ncurses=auto
517)
518AM_CONDITIONAL(HAVE_NCURSES, false)
519
520if test "x$with_ncurses" != xno; then
521 have_ncurses=no
522 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
523 if test "x$with_ncurses" = xauto; then
9ea8ac37 524 UTIL_CHECK_LIB(ncursesw, initscr, ncurses)
08d64aa2 525 if test "x$have_ncurses" = xyes; then
30c97bb8 526 AC_CHECK_HEADERS([ncursesw/ncurses.h])
08d64aa2
KZ
527 NCURSES_LIBS="-lncursesw"
528 fi
529 fi
49ccbae6 530 if test "x$have_ncurses" = xno; then
9ea8ac37 531 UTIL_CHECK_LIB(ncurses, initscr)
49ccbae6 532 if test "x$have_ncurses" = xyes; then
08d64aa2
KZ
533 NCURSES_LIBS="-lncurses"
534 fi
535 fi
536 ])
49ccbae6 537 if test "x$have_ncurses" = xno; then
08d64aa2
KZ
538 AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
539 fi
540fi
541AC_SUBST([NCURSES_LIBS])
542
48d7b13a 543
48d7b13a 544AC_ARG_WITH([slang],
7fa4f112 545 AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
271d98e0 546 [], with_slang=no
48d7b13a
KZ
547)
548
46e71118
AM
549have_tinfo=no
550AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes])
49ccbae6 551AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes)
46e71118 552
fd67be31 553use_slang=no
49ccbae6 554if test "x$with_slang" = xyes; then
965b4900
KZ
555 AC_CHECK_HEADERS([slang.h slang/slang.h])
556 AC_CHECK_HEADERS([slcurses.h slang/slcurses.h],
557 [use_slang=yes], [], [
558#ifdef HAVE_SLANG_H
559#include <slang.h>
560#elif defined(HAVE_SLANG_SLANG_H)
561#include <slang/slang.h>
562#endif
563])
49ccbae6 564 if test "x$use_slang" = xno; then
48d7b13a
KZ
565 AC_MSG_ERROR([slang selected but slcurses.h not found])
566 fi
567fi
49ccbae6 568AM_CONDITIONAL(USE_SLANG, test "x$use_slang" = xyes)
48d7b13a
KZ
569
570
f0bc3fa0
KZ
571AC_ARG_WITH([utempter],
572 AS_HELP_STRING([--with-utempter], [compile script(1) with libutempter]),
573 [], with_utempter=no
574)
575
576if test "x$with_utempter" = xyes; then
577 UTIL_CHECK_LIB(utempter, utempter_add_record)
578 if test "x$have_utempter" = xno; then
579 AC_MSG_ERROR([utempter selected but libutempter not found])
580 fi
581else
582 AM_CONDITIONAL(HAVE_UTEMPTER, false)
583fi
584
0aeb57ac
FG
585# on Solaris, you can't mix and match standards, since we use c99
586# aparently at this stage, XOPEN_SOURCE will conflict. As workaround,
587# check for crypt.h and use that without XOPEN_SOURCE.
588AC_CHECK_HEADERS([crypt.h])
cf002530 589AC_LINK_IFELSE([AC_LANG_PROGRAM([[
0aeb57ac
FG
590#ifdef HAVE_CRYPT_H
591#include <crypt.h>
592#else
48d7b13a
KZ
593#define _XOPEN_SOURCE
594#include <unistd.h>
0aeb57ac 595#endif
cf002530 596]], [[
48d7b13a 597char *c = crypt("abc","pw");
cf002530 598]])],[],[
48d7b13a 599 LIBS="$LIBS -lcrypt"
cf002530 600 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
0aeb57ac
FG
601 #ifdef HAVE_CRYPT_H
602 #include <crypt.h>
603 #else
48d7b13a
KZ
604 #define _XOPEN_SOURCE
605 #include <unistd.h>
0aeb57ac 606 #endif
cf002530 607 ]], [[
48d7b13a 608 char *c = crypt("abc","pw");
cf002530 609 ]])],[
48d7b13a
KZ
610 AC_DEFINE(NEED_LIBCRYPT, 1, [Do we need -lcrypt?])
611 need_libcrypt=yes
612 ],[
613 AC_MSG_ERROR([crypt() is not available])
614 ])
48d7b13a
KZ
615])
616
49ccbae6 617AM_CONDITIONAL(NEED_LIBCRYPT, test "x$need_libcrypt" = xyes)
48d7b13a 618
cf002530 619AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a 620#include <stdio.h>
cf002530 621]], [[
48d7b13a 622printf(__progname);
cf002530
SK
623]])],
624[AC_DEFINE(HAVE___PROGNAME, 1, Do we have __progname?)
625])
48d7b13a
KZ
626
627
869829e4
GJ
628AC_CHECK_TYPES([union semun], [], [], [[
629#include <sys/sem.h>
630]])
5be1c033 631AC_CHECK_TYPES(loff_t)
869829e4
GJ
632
633
cf002530 634AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
635#include <wchar.h>
636#include <wctype.h>
637#include <stdio.h>
cf002530 638]], [[
48d7b13a
KZ
639 wchar_t wc;
640 wint_t w;
641 w = fgetwc(stdin);
642 if (w == WEOF) exit(1);
643 wc = w;
644 fputwc(wc,stdout);
cf002530
SK
645]])],
646[AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?)
647])
48d7b13a
KZ
648
649
72065909
MF
650dnl UTIL_CHECK_SYSCALL(SYSCALL, FALLBACK, ...)
651dnl Only specify FALLBACK if the SYSCALL
652dnl you're checking for is a "newish" one
653dnl -------------------------------------
654AC_DEFUN([UTIL_CHECK_SYSCALL], [
655 dnl This macro uses host_cpu.
656 AC_REQUIRE([AC_CANONICAL_HOST])
657 AC_CACHE_CHECK([for syscall $1],
658 [util_cv_syscall_$1],
659 [_UTIL_SYSCALL_CHECK_DECL([SYS_$1],
660 [syscall=SYS_$1],
661 [dnl Our libc failed use, so see if we can get the kernel
662 dnl headers to play ball ...
663 _UTIL_SYSCALL_CHECK_DECL([_NR_$1],
664 [syscall=_NR_$1],
665 [
666 syscall=no
49ccbae6 667 if test "x$linux_os" = xyes; then
8c182554
KZ
668 case $host_cpu in
669 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shift($@))
670 esac
671 fi
72065909
MF
672 ])
673 ])
674 util_cv_syscall_$1=$syscall
675 ])
49ccbae6 676 AM_CONDITIONAL([HAVE_]m4_toupper($1), [test "x$util_cv_syscall_$1" != xno])
72065909
MF
677 case $util_cv_syscall_$1 in #(
678 no) AC_MSG_WARN([Unable to detect syscall $1.]) ;;
679 SYS_*) ;;
680 *) AC_DEFINE_UNQUOTED([SYS_$1], [$util_cv_syscall_$1],
681 [Fallback syscall number for $1]) ;;
682 esac
683])
684
685dnl _UTIL_SYSCALL_CHECK_DECL(SYMBOL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
686dnl Check if SYMBOL is declared, using the headers needed for syscall checks.
687dnl -------------------------------------
688m4_define([_UTIL_SYSCALL_CHECK_DECL],
689[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
690#include <sys/syscall.h>
691#include <unistd.h>
72065909
MF
692]], [[int test = $1;]])],
693[$2], [$3])
694])
48d7b13a 695
72065909
MF
696dnl _UTIL_CHECK_SYSCALL_FALLBACK(PATTERN, VALUE, ...)
697dnl Helper macro to create the body for the above `case'.
698dnl -------------------------------------
699m4_define([_UTIL_CHECK_SYSCALL_FALLBACK],
700[m4_ifval([$1],
701 [#(
702 $1) syscall="$2" ;;dnl
703 _UTIL_CHECK_SYSCALL_FALLBACK(m4_shiftn(2, $@))])dnl
704])
48d7b13a 705
72065909
MF
706
707UTIL_CHECK_SYSCALL([pivot_root])
708UTIL_CHECK_SYSCALL([sched_getaffinity])
709UTIL_CHECK_SYSCALL([ioprio_set],
710 [alpha], [442],
711 [i*86], [289],
712 [ia64*], [1274],
713 [powerpc*], [273],
714 [s390*], [282],
715 [sparc*], [196],
447ae7b8 716 [sh*], [288],
72065909
MF
717 [x86_64*], [251])
718UTIL_CHECK_SYSCALL([ioprio_get],
719 [alpha], [443],
720 [i*86], [290],
721 [ia64*], [1275],
722 [powerpc*], [274],
723 [s390*], [283],
724 [sparc*], [218],
447ae7b8 725 [sh*], [289],
72065909 726 [x86_64*], [252])
19a224ad 727
d46a5499
KZ
728dnl fallocate could be available as libc function or as syscall only
729UTIL_CHECK_SYSCALL([fallocate])
b832c2fe
YD
730
731dnl check for valid fallocate() function
732dnl with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
733dnl when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
734dnl and program can't be linked.
735dnl AC_CHECK_FUNC can't catch such errors since it's redefining
736dnl function prototype.
737AC_MSG_CHECKING([for valid fallocate() function])
738AC_LINK_IFELSE([
739AC_LANG_PROGRAM([[
740#ifdef HAVE_UNISTD_H
741# include <unistd.h>
742#endif
743#ifdef HAVE_SYS_TYPES_H
744# include <sys/types.h>
745#endif
746#ifdef HAVE_LINUX_FALLOC_H
747# include <linux/falloc.h>
748#endif
749#ifdef HAVE_FCNTL_H
750# include <fcntl.h>
751#endif
752]],[[
753 long ret;
754
755 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
756
757 if (ret != 0) {
758 return 1;
759 }
760 ]])],[
761AC_MSG_RESULT([yes])
762AC_DEFINE(HAVE_FALLOCATE,1,[Have valid fallocate() function])],[
763AC_MSG_RESULT([no])])
19a224ad 764
4205f1fd
MG
765dnl unshare could be available as libc function or as syscall only
766UTIL_CHECK_SYSCALL([unshare])
767AC_CHECK_FUNCS([unshare])
768
cf002530 769AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
770#include <time.h>
771#include <unistd.h>
cf002530 772]], [[
48d7b13a
KZ
773 int a = 0;
774 struct tm *tm = localtime(0);
775 if (a == -1) /* false */
776 sleep(tm->tm_gmtoff);
cf002530
SK
777]])],
778[AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?])
779])
48d7b13a 780
30e8b186
KZ
781AC_CHECK_MEMBERS([struct termios.c_line],,,
782 [[#include <termios.h>]])
783
6c2f2b9d
KZ
784AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
785 [#include <sys/stat.h>])
786
2d281745
KZ
787AC_CHECK_DECLS([
788 ADDR_NO_RANDOMIZE,
789 FDPIC_FUNCPTRS,
790 MMAP_PAGE_ZERO,
791 ADDR_COMPAT_LAYOUT,
792 READ_IMPLIES_EXEC,
793 ADDR_LIMIT_32BIT,
794 WHOLE_SECONDS,
795 STICKY_TIMEOUTS,
796 ADDR_LIMIT_3GB], [], [], [#include <linux/personality.h>])
48d7b13a 797
22d36665 798AC_CHECK_HEADERS([sys/swap.h])
b3425806
SK
799
800AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
801[[
b3425806
SK
802#ifdef HAVE_SYS_SWAP_H
803# include <sys/swap.h>
804#endif
805#include <unistd.h>
806]],
807[[swapon("/dev/null", 0);]])],
808[AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
809],
810[AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
811])
812
813
ee32c514
KZ
814AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
815#include <sched.h>
816]])
817
818AM_CONDITIONAL(HAVE_CPU_SET_T, [test "x$have_cpu_set_t" = xyes])
819
820AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
821#include <sched.h>
822]])
823
824
e782f1d4
KZ
825dnl UTIL_SET_ARCH(ARCHNAME, PATTERN)
826dnl ---------------------------------
827AC_DEFUN([UTIL_SET_ARCH], [
828 cpu_$1=false
829 case "$host" in
830 $2) cpu_$1=true ;;
831 esac
49ccbae6 832 AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test "x$cpu_$1" = xtrue])
e782f1d4 833])
48d7b13a 834
e782f1d4
KZ
835UTIL_SET_ARCH(I86, i?86-*)
836UTIL_SET_ARCH(86_64, x86_64*)
837UTIL_SET_ARCH(IA64, ia64*)
838UTIL_SET_ARCH(S390, s390*)
839UTIL_SET_ARCH(SPARC, sparc*)
840UTIL_SET_ARCH(PPC, ppc*|powerpc*)
841UTIL_SET_ARCH(M68K, m68*)
842UTIL_SET_ARCH(MIPS, mips*)
eeadb4f4 843UTIL_SET_ARCH(HPPA, hppa*)
48d7b13a 844
6a97809b
KZ
845AC_ARG_ENABLE([arch],
846 AS_HELP_STRING([--enable-arch], [do build arch]),
847 [], enable_arch=no
848)
49ccbae6 849AM_CONDITIONAL(BUILD_ARCH, test "x$enable_arch" = xyes)
48d7b13a
KZ
850
851AC_ARG_ENABLE([agetty],
7fa4f112 852 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
271d98e0 853 [], enable_agetty=yes
48d7b13a 854)
49ccbae6 855AM_CONDITIONAL(BUILD_AGETTY, test "x$enable_agetty" = xyes)
48d7b13a 856
9cb68977 857AC_ARG_ENABLE([cramfs],
7fa4f112 858 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
271d98e0 859 [], enable_cramfs=check
9cb68977
KZ
860)
861
49ccbae6 862if test "x$enable_cramfs" = xno; then
fd67be31
SK
863 build_cramfs=no
864else
865 build_cramfs=yes
866 dnl Trick: leave the third parameter empty to get the default action.
867 AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
868 case $enable_cramfs:$build_cramfs in
869 yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
870 esac
9cb68977 871fi
49ccbae6 872AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
9cb68977 873
7f7126d7
KZ
874build_lsblk=yes
875if test "x$have_openat" = xno; then
876 AC_MSG_WARN([openat() function not found; do not build lsblk])
877 build_lsblk=no
878elif test "x$have_linux" = xno; then
879 AC_MSG_WARN([non-linux system; do not build lsblk])
880 build_lsblk=no
881fi
882AM_CONDITIONAL(BUILD_LSBLK, test "x$build_lsblk" = xyes)
9cb68977 883
bd671347
KZ
884AC_ARG_ENABLE([switch_root],
885 AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
940fd28c 886 [], enable_switch_root=check
bd671347 887)
940fd28c
KZ
888if test "x$enable_switch_root" = xno; then
889 build_switch_root=no
890else
891 build_switch_root=yes
892 case $enable_switch_root:$linux_os in
893 yes:no) AC_MSG_ERROR([switch_root selected for non-linux system]);;
894 check:no) AC_MSG_WARN([non-linux system; do not build switch_root])
895 build_switch_root=no;;
896 esac
897 if test "x$build_switch_root" = xyes; then
898 case $enable_switch_root:$have_openat in
899 yes:no) AC_MSG_ERROR([switch_root selected but openat() function not found]);;
900 check:no) AC_MSG_WARN([openat() function not found; do not build switch_root])
901 build_switch_root=no;;
902 esac
903 fi
904fi
905AM_CONDITIONAL(BUILD_SWITCH_ROOT, test "x$build_switch_root" = xyes)
bd671347
KZ
906
907
11125e7a
KZ
908AC_ARG_ENABLE([pivot_root],
909 AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
910 [], enable_pivot_root=check
911)
912if test "x$enable_pivot_root" = xno; then
913 build_pivot_root=no
914else
915 build_pivot_root=yes
916 case $enable_pivot_root:$linux_os in
917 yes:no) AC_MSG_ERROR([pivot_root selected for non-linux system]);;
918 check:no) AC_MSG_WARN([non-linux system; do not build pivot_root])
919 build_pivot_root=no;;
920 esac
921 if test "x$build_pivot_root" = xyes; then
922 case $enable_pivot_root:$util_cv_syscall_pivot_root in
923 yes:no) AC_MSG_ERROR([pivot_root selected but pivot_root syscall not found]);;
924 check:no) AC_MSG_WARN([pivot_root syscall not found; do not build pivot_root])
925 build_pivot_root=no;;
926 esac
927 fi
928fi
4a2ecf0a 929AM_CONDITIONAL(BUILD_PIVOT_ROOT, test "x$build_pivot_root" = xyes)
11125e7a
KZ
930
931
932AC_ARG_ENABLE([fallocate],
933 AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
934 [], enable_fallocate=check
935)
936if test "x$enable_fallocate" = xno; then
937 build_fallocate=no
938else
939 build_fallocate=yes
940 case $enable_fallocate:$linux_os in
941 yes:no) AC_MSG_ERROR([fallocate selected for non-linux system]);;
942 check:no) AC_MSG_WARN([non-linux system; do not build fallocate])
943 build_fallocate=no;;
944 esac
945 if test "x$build_fallocate" = xyes; then
946 case $enable_fallocate:$util_cv_syscall_fallocate in
947 yes:no) AC_MSG_ERROR([fallocate selected but fallocate syscall not found]);;
948 check:no) AC_MSG_WARN([fallocate syscall not found; do not build fallocate])
949 build_fallocate=no;;
950 esac
951 fi
952fi
953AM_CONDITIONAL(BUILD_FALLOCATE, test "x$build_fallocate" = xyes)
954
955
956AC_ARG_ENABLE([unshare],
957 AS_HELP_STRING([--disable-unshare], [do not build unshare]),
958 [], enable_unshare=check
959)
960if test "x$enable_unshare" = xno; then
961 build_unshare=no
962else
963 build_unshare=yes
964 case $enable_unshare:$linux_os in
965 yes:no) AC_MSG_ERROR([unshare selected for non-linux system]);;
966 check:no) AC_MSG_WARN([non-linux system; do not build unshare])
967 build_unshare=no;;
968 esac
969 if test "x$build_unshare" = xyes; then
970 case $enable_unshare:$util_cv_syscall_unshare in
971 yes:no) AC_MSG_ERROR([unshare selected but unshare syscall not found]);;
972 check:no) AC_MSG_WARN([unshare syscall not found; do not build unshare])
973 build_unshare=no;;
974 esac
975 fi
976fi
977AM_CONDITIONAL(BUILD_UNSHARE, test "x$build_unshare" = xyes)
978
979
980
48d7b13a 981AC_ARG_ENABLE([elvtune],
7fa4f112 982 AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
271d98e0 983 [], enable_elvtune=no
48d7b13a 984)
49ccbae6 985AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes)
48d7b13a
KZ
986
987
988AC_ARG_ENABLE([init],
7fa4f112 989 AS_HELP_STRING([--enable-init], [build simpleinit, shutdown, initctl]),
271d98e0 990 [], enable_init=no
48d7b13a 991)
49ccbae6 992AM_CONDITIONAL(BUILD_INIT, test "x$enable_init" = xyes)
48d7b13a
KZ
993
994
995AC_ARG_ENABLE([kill],
7fa4f112 996 AS_HELP_STRING([--enable-kill], [build kill]),
271d98e0 997 [], enable_kill=no
48d7b13a 998)
49ccbae6 999AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
48d7b13a
KZ
1000
1001
1002AC_ARG_ENABLE([last],
7fa4f112 1003 AS_HELP_STRING([--enable-last], [build last]),
271d98e0 1004 [], enable_last=no
48d7b13a 1005)
49ccbae6 1006AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes)
48d7b13a
KZ
1007
1008
1009AC_ARG_ENABLE([mesg],
7fa4f112 1010 AS_HELP_STRING([--enable-mesg], [build mesg]),
271d98e0 1011 [], enable_mesg=no
48d7b13a 1012)
49ccbae6 1013AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes)
48d7b13a
KZ
1014
1015
1016AC_ARG_ENABLE([partx],
7fa4f112 1017 AS_HELP_STRING([--enable-partx], [build addpart, delpart, partx]),
271d98e0 1018 [], enable_partx=no
48d7b13a 1019)
49ccbae6 1020AM_CONDITIONAL(BUILD_PARTX, test "x$enable_partx" = xyes)
48d7b13a
KZ
1021
1022
1023AC_ARG_ENABLE([raw],
7fa4f112 1024 AS_HELP_STRING([--enable-raw], [build raw]),
271d98e0 1025 [], enable_raw=no
48d7b13a 1026)
49ccbae6 1027AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes)
48d7b13a
KZ
1028
1029
48d7b13a 1030AC_ARG_ENABLE([rename],
7fa4f112 1031 AS_HELP_STRING([--disable-rename], [do not build rename]),
271d98e0 1032 [], enable_rename=yes
48d7b13a 1033)
49ccbae6 1034AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes)
48d7b13a
KZ
1035
1036
1037AC_ARG_ENABLE([reset],
7fa4f112 1038 AS_HELP_STRING([--enable-reset], [build reset]),
271d98e0 1039 [], enable_reset=no
48d7b13a 1040)
49ccbae6 1041AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes)
48d7b13a
KZ
1042
1043
1044AC_ARG_ENABLE([login-utils],
7fa4f112 1045 AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
271d98e0 1046 [], enable_login_utils=no
48d7b13a 1047)
49ccbae6 1048AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes)
48d7b13a 1049
9cb68977 1050AC_ARG_WITH([pam],
7fa4f112 1051 [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
9cb68977 1052
fd67be31 1053AM_CONDITIONAL(HAVE_PAM, false)
49ccbae6 1054if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then
fd67be31
SK
1055 AC_CHECK_HEADERS([security/pam_misc.h],
1056 [AM_CONDITIONAL(HAVE_PAM, true)],
49ccbae6 1057 [if test "x$with_pam" = xyes; then
fd67be31
SK
1058 AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
1059 fi
1060 ])
9cb68977 1061fi
9cb68977
KZ
1062
1063AC_ARG_WITH([selinux],
7fa4f112 1064 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
271d98e0 1065 [], with_selinux=no
9cb68977
KZ
1066)
1067
49ccbae6 1068if test "x$with_selinux" = xno; then
fd67be31
SK
1069 AM_CONDITIONAL(HAVE_SELINUX, false)
1070else
1071 UTIL_CHECK_LIB(selinux, getprevcon)
49ccbae6 1072 case "$with_selinux:$have_selinux" in
fd67be31
SK
1073 yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
1074 esac
9cb68977 1075fi
9cb68977 1076
49ccbae6 1077if test "x$have_selinux" = xyes; then
8569410c
SK
1078 SELINUX_LIBS="-lselinux -lsepol"
1079 SELINUX_LIBS_STATIC="-lselinux -lsepol"
28d39b6d
KZ
1080 old_LDFLAGS="$LDFLAGS"
1081 LDFLAGS="$LDFLAGS $SELINUX_LIBS"
1082 # This function is missing in old libselinux 1.xx versions
1083 AC_CHECK_FUNCS([security_get_initial_context])
1084 LDFLAGS="$old_LDFLAGS"
8569410c
SK
1085fi
1086AC_SUBST([SELINUX_LIBS])
1087AC_SUBST([SELINUX_LIBS_STATIC])
9cb68977 1088
bbae9cb0 1089AC_ARG_WITH([audit],
7fa4f112 1090 AS_HELP_STRING([--with-audit], [compile with audit support]),
271d98e0 1091 [], with_audit=no
bbae9cb0
KZ
1092)
1093
49ccbae6 1094if test "x$with_audit" = xno; then
fd67be31
SK
1095 AM_CONDITIONAL(HAVE_AUDIT, false)
1096else
1097 UTIL_CHECK_LIB(audit, audit_log_user_message)
49ccbae6 1098 case "$with_audit:$have_audit" in
fd67be31
SK
1099 yes:no)
1100 AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
1101 ;;
1102 esac
bbae9cb0 1103fi
bbae9cb0 1104
48d7b13a 1105AC_ARG_ENABLE([schedutils],
7fa4f112 1106 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
271d98e0 1107 [], enable_schedutils=yes
48d7b13a 1108)
49ccbae6 1109AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes)
48d7b13a
KZ
1110
1111
1112AC_ARG_ENABLE([wall],
7fa4f112 1113 AS_HELP_STRING([--disable-wall], [do not build wall]),
271d98e0 1114 [], enable_wall=yes
48d7b13a 1115)
49ccbae6 1116AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes)
48d7b13a
KZ
1117
1118
1119AC_ARG_ENABLE([write],
7fa4f112 1120 AS_HELP_STRING([--enable-write], [build write]),
271d98e0 1121 [], enable_write=no
48d7b13a 1122)
49ccbae6 1123AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes)
48d7b13a
KZ
1124
1125
1126AC_ARG_ENABLE([chsh-only-listed],
7fa4f112 1127 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
271d98e0 1128 [], enable_chsh_only_listed=yes
48d7b13a
KZ
1129)
1130
49ccbae6 1131if test "x$enable_chsh_only_listed" = xyes; then
48d7b13a
KZ
1132 AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
1133fi
1134
1135
1136AC_ARG_ENABLE([login-chown-vcs],
7fa4f112 1137 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
271d98e0 1138 [], enable_login_chown_vcs=no
48d7b13a
KZ
1139)
1140
49ccbae6 1141if test "x$enable_login_chown_vcs" = xyes; then
48d7b13a
KZ
1142 AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
1143fi
1144
1145
1146AC_ARG_ENABLE([login-stat-mail],
7fa4f112 1147 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
271d98e0 1148 [], enable_login_stat_mail=no
48d7b13a
KZ
1149)
1150
49ccbae6 1151if test "x$enable_login_stat_mail" = xyes; then
48d7b13a
KZ
1152 AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
1153fi
1154
1155
1156AC_ARG_ENABLE([pg-bell],
7fa4f112 1157 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
271d98e0 1158 [], enable_pg_bell=yes
48d7b13a
KZ
1159)
1160
49ccbae6 1161if test "x$enable_pg_bell" = xyes; then
48d7b13a
KZ
1162 AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
1163fi
1164
1165
1166AC_ARG_ENABLE([require-password],
7fa4f112 1167 AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
271d98e0 1168 [], enable_require_password=yes
48d7b13a
KZ
1169)
1170
49ccbae6 1171if test "x$enable_require_password" = xyes; then
48d7b13a
KZ
1172 AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
1173fi
1174
1175
bb4cb69d
MF
1176AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
1177AC_ARG_ENABLE([fs-paths-default],
1178 AS_HELP_STRING([--enable-fs-paths-default=paths], [default search path for fs helpers @<:@FS_PATHS_DEFAULT@:>@]),
1179 [case "$enableval" in
1180 yes) fs_paths_defaults="FS_PATHS_DEFAULT" ;;
1181 no) fs_paths_defaults="" ;;
1182 *) fs_paths_defaults="$enableval" ;;
1183 esac],
1184 [fs_paths_defaults="FS_PATHS_DEFAULT"]
1185)
1186AC_ARG_ENABLE([fs-paths-extra],
1187 AS_HELP_STRING([--enable-fs-paths-extra=paths], [additional search paths for fs helpers]),
1188 [case "$enableval" in
1189 yes|no) fs_paths_extra="" ;;
1190 *) fs_paths_extra="$enableval" ;;
1191 esac],
1192 [fs_paths_extra=""]
1193)
1194fs_paths="$fs_paths_defaults"
1195if test "x$fs_paths_extra" != "x"; then
1196 if test "x$fs_paths" != "x"; then
1197 fs_paths="${fs_paths}:"
1198 fi
1199 fs_paths="${fs_paths}${fs_paths_extra}"
1200fi
1201AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
1202
1203
48d7b13a 1204AC_ARG_ENABLE([use-tty-group],
7fa4f112 1205 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
271d98e0 1206 [], enable_use_tty_group=yes
48d7b13a 1207)
49ccbae6 1208AM_CONDITIONAL(USE_TTY_GROUP, test "x$enable_use_tty_group" = xyes)
48d7b13a 1209
49ccbae6 1210if test "x$enable_use_tty_group" = xyes; then
48d7b13a
KZ
1211 AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
1212fi
1213
f3831bbd
KZ
1214AC_ARG_ENABLE([makeinstall-chown],
1215 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
1216 [], enable_makeinstall_chown=yes
1217)
49ccbae6 1218AM_CONDITIONAL(MAKEINSTALL_DO_CHOWN, test "x$enable_makeinstall_chown" = xyes)
f3831bbd 1219
4c24a7ae
KZ
1220AC_ARG_ENABLE([makeinstall-setuid],
1221 AS_HELP_STRING([--disable-makeinstall-setuid], [do not do setuid chmod operations during "make install"]),
1222 [], enable_makeinstall_setuid=yes
1223)
1224AM_CONDITIONAL(MAKEINSTALL_DO_SETUID, test "x$enable_makeinstall_setuid" = xyes)
1225
06bcee19 1226
1f10890f
SK
1227AC_ARG_VAR([SUID_CFLAGS],
1228 [CFLAGS used for binaries which are usually with the suid bit])
1229AC_ARG_VAR([SUID_LDFLAGS],
1230 [LDFLAGS used for binaries which are usually with the suid bit])
06bcee19 1231
9cb68977 1232LIBS=""
48d7b13a 1233
48d7b13a
KZ
1234
1235AC_CONFIG_HEADERS(config.h)
1236
8eeb575c 1237AC_CONFIG_FILES([
8eeb575c 1238disk-utils/Makefile
562218e6 1239fdisk/Makefile
607c2a72 1240fsck/Makefile
8eeb575c
KZ
1241getopt/Makefile
1242hwclock/Makefile
562218e6 1243include/Makefile
5502d92b 1244simpleinit/Makefile
d00ed891 1245lib/Makefile
8eeb575c 1246login-utils/Makefile
20ad4963 1247Makefile
f331598a 1248man/ru/Makefile
20ad4963 1249misc-utils/chkdupexe:misc-utils/chkdupexe.pl
8eeb575c
KZ
1250misc-utils/Makefile
1251mount/Makefile
1252partx/Makefile
1253po/Makefile.in
1254schedutils/Makefile
20ad4963
KZ
1255shlibs/blkid/blkid.pc
1256shlibs/blkid/Makefile
1e018c15
KZ
1257shlibs/blkid/docs/Makefile
1258shlibs/blkid/docs/version.xml
20ad4963 1259shlibs/blkid/src/Makefile
033cf439 1260shlibs/blkid/src/blkid.h
219227c2 1261shlibs/blkid/src/superblocks/Makefile
cc33d693 1262shlibs/blkid/src/topology/Makefile
e4799a35 1263shlibs/blkid/src/partitions/Makefile
e21677fe 1264shlibs/blkid/samples/Makefile
f1cde479
KZ
1265shlibs/mount/mount.pc
1266shlibs/mount/Makefile
1267shlibs/mount/src/Makefile
2a1f429a 1268shlibs/mount/src/libmount.h
3d735589
KZ
1269shlibs/mount/docs/Makefile
1270shlibs/mount/docs/version.xml
97073441 1271shlibs/mount/samples/Makefile
754fed0c
KZ
1272shlibs/uuid/uuid.pc
1273shlibs/uuid/Makefile
1274shlibs/uuid/man/Makefile
1275shlibs/uuid/src/Makefile
8eeb575c 1276sys-utils/Makefile
e83446da 1277tests/commands.sh
20ad4963
KZ
1278tests/helpers/Makefile
1279tests/Makefile
1280text-utils/Makefile
8eeb575c 1281])
48d7b13a 1282
996fb358 1283
48d7b13a 1284AC_OUTPUT