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