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