]> git.ipfire.org Git - thirdparty/util-linux.git/blob - configure.ac
lib/strutils: move *swith() functions to private library
[thirdparty/util-linux.git] / configure.ac
1 AC_INIT([util-linux],
2 m4_esyscmd([tools/git-version-gen .tarball-version]),
3 [kzak@redhat.com],,
4 [http://www.kernel.org/pub/linux/utils/util-linux/])
5
6 AC_PREREQ([2.60])
7
8 AC_CONFIG_AUX_DIR([config])
9 AC_CONFIG_MACRO_DIR([m4])
10 dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
11 dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
12 AC_USE_SYSTEM_EXTENSIONS
13 AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax dist-bzip2 no-dist-gzip dist-xz -Wno-portability subdir-objects])
14
15 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
16 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
17
18 AC_CONFIG_SRCDIR([sys-utils/mount.c])
19 AC_PREFIX_DEFAULT([/usr])
20
21 dnl version details from <major>.<minor>[-<suffix>]
22 PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}')
23 PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{print $2}' \
24 | awk -F- '{print $1}')
25 PACKAGE_VERSION_RELEASE=0
26
27 dnl libblkid version
28 LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
29 LIBBLKID_DATE="25-Apr-2013"
30 LIBBLKID_LT_MAJOR=1
31 LIBBLKID_LT_MINOR=1
32 LIBBLKID_LT_MICRO=0
33 LIBBLKID_VERSION_INFO=`expr $LIBBLKID_LT_MAJOR + $LIBBLKID_LT_MINOR`:$LIBBLKID_LT_MICRO:$LIBBLKID_LT_MINOR
34
35 dnl libuuid version
36 LIBUUID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
37 LIBUUID_LT_MAJOR=1
38 LIBUUID_LT_MINOR=3
39 LIBUUID_LT_MICRO=0
40 LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR
41
42 dnl libmount version
43 LIBMOUNT_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
44 LIBMOUNT_LT_MAJOR=1
45 LIBMOUNT_LT_MINOR=1
46 LIBMOUNT_LT_MICRO=0
47 LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR
48
49 # Check whether exec_prefix=/usr:
50 AS_CASE([$exec_prefix:$prefix],
51 [NONE:NONE | NONE:/usr | /usr:*],
52 [AC_MSG_NOTICE([Default --exec-prefix detected.])
53 AS_CASE([$bindir], [${exec_prefix}/bin], [bindir=/bin; AC_MSG_NOTICE([ --bindir defaults to /bin]) ])
54 AS_CASE([$sbindir], [${exec_prefix}/sbin], [bindir=/sbin; AC_MSG_NOTICE([ --sbindir defaults to /sbin])])
55 AS_CASE([$libdir], [${exec_prefix}/lib], [bindir=/lib; AC_MSG_NOTICE([ --libdir defaults to /lib]) ])
56 ]
57 )
58
59 AS_CASE([$prefix:$localstatedir],
60 [NONE:${prefix}/var | /usr:${prefix}/var],
61 [localstatedir=/run
62 AC_MSG_NOTICE([ --localstatedir defaults to /run])
63 ]
64 )
65 AC_SUBST([localstatedir])
66
67
68 # The original default values of {bin,sbin,lib}dir
69 usrbin_execdir='${exec_prefix}/bin'
70 AC_SUBST([usrbin_execdir])
71
72 usrsbin_execdir='${exec_prefix}/sbin'
73 AC_SUBST([usrsbin_execdir])
74
75 AS_CASE([$libdir],
76 [${exec_prefix}/* | ${prefix}/* | /usr/*],
77 [usrlib_execdir=$libdir],
78 [usrlib_execdir='${exec_prefix}'$libdir]
79 )
80 AC_SUBST([usrlib_execdir])
81
82
83 AM_PROG_CC_C_O
84 AC_PROG_CC_STDC
85 AC_CANONICAL_HOST
86 AC_C_CONST
87 AC_C_VOLATILE
88 AC_C_BIGENDIAN
89
90 dnl Compiler warnings
91 UL_WARN_ADD([-fno-common])
92 UL_WARN_ADD([-Wall])
93 UL_WARN_ADD([-Werror=sequence-point])
94 UL_WARN_ADD([-Wextra])
95 UL_WARN_ADD([-Wmissing-declarations])
96 UL_WARN_ADD([-Wmissing-parameter-type])
97 UL_WARN_ADD([-Wmissing-prototypes])
98 UL_WARN_ADD([-Wno-missing-field-initializers])
99 UL_WARN_ADD([-Wredundant-decls])
100 UL_WARN_ADD([-Wsign-compare])
101 UL_WARN_ADD([-Wtype-limits])
102 UL_WARN_ADD([-Wuninitialized])
103 UL_WARN_ADD([-Wunused-but-set-parameter])
104 UL_WARN_ADD([-Wunused-but-set-variable])
105 UL_WARN_ADD([-Wunused-parameter])
106 UL_WARN_ADD([-Wunused-result])
107 UL_WARN_ADD([-Wunused-variable])
108 UL_WARN_ADD([-Wnested-externs])
109 UL_WARN_ADD([-Wpointer-arith])
110 UL_WARN_ADD([-Wstrict-prototypes])
111 UL_WARN_ADD([-Wformat-security])
112 AC_SUBST([WARN_CFLAGS])
113
114 UL_WARN_ADD([-Wno-clobbered], [BSD_WARN_CFLAGS])
115 AC_SUBST([BSD_WARN_CFLAGS])
116
117 dnl libtool-2
118 LT_INIT
119
120 m4_ifndef([PKG_PROG_PKG_CONFIG],
121 [m4_fatal([Could not locate the pkg-config autoconf
122 macros. These are usually located in /usr/share/aclocal/pkg.m4.
123 If your macros are in a different location, try setting the
124 environment variable AL_OPTS="-I/other/macro/dir" before running
125 ./autogen.sh or autoreconf again.])])
126 PKG_PROG_PKG_CONFIG
127
128 GTK_DOC_CHECK([1.10])
129 AC_PATH_PROG([XSLTPROC], [xsltproc])
130
131 linux_os=no
132 AS_CASE([${host_os}], [*linux*], [linux_os=yes])
133 AM_CONDITIONAL([LINUX], [test "x$linux_os" = xyes])
134
135 dnl define ARCH_<NAME> conditionals
136 UL_SET_ARCH([I86], [i?86-*])
137 UL_SET_ARCH([86_64], [x86_64*])
138 UL_SET_ARCH([IA64], [ia64*])
139 UL_SET_ARCH([S390], [s390*])
140 UL_SET_ARCH([SPARC], [sparc*])
141 UL_SET_ARCH([PPC], [ppc*|powerpc*])
142 UL_SET_ARCH([M68K], [m68*])
143 UL_SET_ARCH([MIPS], [mips*])
144 UL_SET_ARCH([HPPA], [hppa*])
145
146 AC_SYS_LARGEFILE
147
148 AM_GNU_GETTEXT_VERSION([0.14.1])
149 AM_GNU_GETTEXT([external])
150
151 AS_IF([test -d "$srcdir/po"], [
152 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
153 ], [
154 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"
155 ])
156
157 AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
158 #ifdef HAVE_LINUX_COMPILER_H
159 #include <linux/compiler.h>
160 #endif
161 ])
162 AC_CHECK_HEADERS([ \
163 asm/io.h \
164 err.h \
165 errno.h \
166 fcntl.h \
167 getopt.h \
168 inttypes.h \
169 linux/cdrom.h \
170 linux/falloc.h \
171 linux/watchdog.h \
172 linux/fd.h \
173 linux/raw.h \
174 linux/tiocl.h \
175 linux/version.h \
176 linux/securebits.h \
177 locale.h \
178 mntent.h \
179 net/if.h \
180 net/if_dl.h \
181 netinet/in.h \
182 paths.h \
183 pty.h \
184 security/pam_misc.h \
185 stdint.h \
186 stdio_ext.h \
187 stdlib.h \
188 endian.h \
189 byteswap.h \
190 sys/endian.h \
191 sys/disk.h \
192 sys/disklabel.h \
193 sys/file.h \
194 sys/io.h \
195 sys/ioccom.h \
196 sys/ioctl.h \
197 sys/mkdev.h \
198 sys/prctl.h \
199 sys/queue.h \
200 sys/resource.h \
201 sys/socket.h \
202 sys/sockio.h \
203 sys/stat.h \
204 sys/swap.h \
205 sys/syscall.h \
206 sys/time.h \
207 sys/types.h \
208 sys/un.h \
209 unistd.h \
210 ])
211
212 AC_CHECK_HEADERS([langinfo.h],
213 [AM_CONDITIONAL([HAVE_LANGINFO], [true])],
214 [AM_CONDITIONAL([HAVE_LANGINFO], [false])])
215
216 dnl Convert some ac_cv_header_* variables to have_*
217 dnl
218 have_linux_raw_h=$ac_cv_header_linux_raw_h
219 have_linux_securebits_h=$ac_cv_header_linux_securebits_h
220 have_linux_watchdog_h=$ac_cv_header_linux_watchdog_h
221 have_security_pam_misc_h=$ac_cv_header_security_pam_misc_h
222
223
224 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
225 #include <time.h>
226 #include <unistd.h>
227 ]], [[
228 int a = 0;
229 struct tm *tm = localtime(0);
230 if (a == -1) /* false */
231 sleep(tm->tm_gmtoff);
232 ]])],
233 [AC_DEFINE([HAVE_TM_GMTOFF], [1], [Does struct tm have a field tm_gmtoff?])
234 ])
235
236 AC_CHECK_MEMBERS([struct termios.c_line],,,
237 [[#include <termios.h>]])
238
239 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
240 [#include <sys/stat.h>])
241
242 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
243 [[
244 #ifdef HAVE_SYS_SWAP_H
245 # include <sys/swap.h>
246 #endif
247 #include <unistd.h>
248 ]],
249 [[swapon("/dev/null", 0);]])],
250 [AC_DEFINE([SWAPON_HAS_TWO_ARGS], [1], [Is swapon() declared with two parameters?])
251 ],
252 [AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
253 ])
254
255
256 AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
257
258 AC_CHECK_DECL([llseek],
259 [AC_DEFINE([HAVE_LLSEEK_PROTOTYPE], [1],
260 [Define to 1 if have llseek prototype])],
261 [],
262 [#include <unistd.h>])
263
264 AC_CHECK_DECL([lseek64],
265 [AC_DEFINE([HAVE_LSEEK64_PROTOTYPE], [1],
266 [Define to 1 if have lseek64 prototype])],
267 [],
268 [#define _LARGEFILE_SOURCE
269 #define _LARGEFILE64_SOURCE
270 #include <unistd.h>])
271
272 AC_CHECK_DECL([environ],
273 [AC_DEFINE([HAVE_ENVIRON_DECL], [1],
274 [Define to 1 if have **environ prototype])],
275 )
276
277 AC_CHECK_DECL([strsignal],
278 [AC_DEFINE([HAVE_STRSIGNAL_DECL], [1],
279 [Define to 1 if have strsignal function prototype])],
280 )
281
282 AC_CHECK_FUNCS([ \
283 __fpending \
284 secure_getenv \
285 __secure_getenv \
286 err \
287 errx \
288 fsync \
289 futimens \
290 getdomainname \
291 getdtablesize \
292 getexecname \
293 getmntinfo \
294 getrlimit \
295 inotify_init \
296 jrand48 \
297 lchown \
298 llseek \
299 lseek64 \
300 mempcpy \
301 nanosleep \
302 personality \
303 posix_fadvise \
304 prctl \
305 rpmatch \
306 scandirat \
307 setresgid \
308 setresuid \
309 sigqueue \
310 srandom \
311 strnchr \
312 strndup \
313 strnlen \
314 strtoull \
315 sysconf \
316 updwtmp \
317 usleep \
318 warn \
319 warnx \
320 ])
321 AC_FUNC_FSEEKO
322
323 AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
324 AC_CHECK_FUNCS([ioperm iopl], [have_io=yes])
325
326 AC_CHECK_MEMBER([struct sockaddr.sa_len],
327 AC_DEFINE_UNQUOTED([HAVE_SA_LEN], [1], [Define if struct sockaddr contains sa_len]), [],
328 [#include <sys/types.h>
329 #include <sys/socket.h>])
330
331 SOCKET_LIBS=
332 AC_SEARCH_LIBS([socket], [socket],
333 [AS_IF([test x"$ac_cv_search_socket" != x"none required"],
334 [SOCKET_LIBS="$SOCKET_LIBS -lsocket"])
335 ])
336 AC_SUBST([SOCKET_LIBS])
337
338
339 have_dirfd=no
340 AC_CHECK_FUNCS([dirfd], [have_dirfd=yes], [have_dirfd=no])
341 AS_IF([test x"$have_dirfd" = xno], [
342 AC_CHECK_DECLS([dirfd],
343 [have_dirfd=yes], [have_dirfd=no],
344 [#include <sys/types.h>
345 #include <dirent.h>])
346 ])
347
348 have_ddfd=no
349 AS_IF([test x"$have_dirfd" = xno], [
350 AC_CHECK_MEMBERS([DIR.dd_fd],
351 [have_ddfd=yes], [have_ddfd=no],
352 [#include <sys/types.h>
353 #include <dirent.h>])
354 ])
355
356 AS_CASE([$have_dirfd:$have_ddfd],
357 [no:no],
358 [AC_MSG_ERROR([cannot find a method to get filedescriptor of directory])]
359 )
360
361
362 AC_MSG_CHECKING([whether program_invocation_short_name is defined])
363 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
364 #include <argp.h>
365 ]], [[
366 program_invocation_short_name = "test";
367 ]])], [
368 AC_MSG_RESULT([yes])
369 AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
370 [Define if program_invocation_short_name is defined])
371 ], [
372 AC_MSG_RESULT([no])
373 ])
374
375
376 AC_MSG_CHECKING([whether __progname is defined])
377 AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
378 [if (*__progname == 0) return;])],
379 AC_DEFINE([HAVE___PROGNAME], [1], [Define if __progname is defined])
380 AC_MSG_RESULT([yes]),
381 AC_MSG_RESULT([no]))
382
383 dnl Static compilation
384 m4_define([UL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid])
385
386 AC_ARG_ENABLE([static-programs],
387 [AS_HELP_STRING([--enable-static-programs=LIST],
388 [link static the programs in LIST (comma-separated,
389 supported for ]m4_defn([UL_STATIC_PROGRAMS])[)])])
390
391 AS_CASE([$enable_static_programs],
392 [yes],
393 [enable_static_programs=m4_quote([UL_STATIC_PROGRAMS])],
394 [no],
395 [enable_static_programs=]
396 )
397
398 dnl Set all the individual AM_CONDITIONALs
399 m4_foreach([UL_PRG], m4_defn([UL_STATIC_PROGRAMS]), [
400 AS_CASE([,$enable_static_programs,],
401 [*,UL_PRG,*], [static_[]UL_PRG=yes]
402 )
403 AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UL_PRG),
404 [test "x$static_[]UL_PRG" = xyes])
405 ])
406
407 AX_CHECK_TLS
408
409 AC_DEFUN([UL_SCANF_TYPE_MODIFIER], [dnl
410 # include <stdio.h>
411 int main()
412 {
413 int i;
414 char *s;
415 i = sscanf("x", $1, &s);
416 if (i == 1)
417 return 0;
418 return 1;
419 }])
420
421 AC_CACHE_VAL([scanf_cv_alloc_modifier],
422 AC_RUN_IFELSE([AC_LANG_SOURCE([UL_SCANF_TYPE_MODIFIER(["%ms"])])],
423 [scanf_cv_alloc_modifier=ms],
424 AC_RUN_IFELSE([AC_LANG_SOURCE([UL_SCANF_TYPE_MODIFIER(["%as"])])],
425 [scanf_cv_alloc_modifier=as],
426 [scanf_cv_alloc_modifier=no]
427 )
428 ,
429
430 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
431 #include <stdio.h>
432
433 #ifdef __GLIBC__
434
435 #if !(__GLIBC_PREREQ(2, 7))
436 #error %m is not available
437 #endif
438
439 #else
440
441 #error Your C-library is not supported.
442 #endif
443 ])],
444 [scanf_cv_alloc_modifier=ms],
445 [scanf_cv_alloc_modifier=no])]
446 )
447 )
448
449 AC_MSG_CHECKING([scanf string alloc modifiers])
450 AS_CASE([$scanf_cv_alloc_modifier],
451 [ms],
452 [AC_MSG_RESULT([(%ms) yes])
453 AC_DEFINE([HAVE_SCANF_MS_MODIFIER], [1], [scanf %ms modifier])
454 have_scanf_alloc_modifier=yes],
455 [as],
456 [AC_MSG_RESULT([(%as) yes])
457 have_scanf_alloc_modifier=yes
458 AC_DEFINE([HAVE_SCANF_AS_MODIFIER], [1], [scanf %as modifier])],
459 [AC_MSG_RESULT([no])
460 have_scanf_alloc_modifier=no]
461 )
462
463 UL_CHECK_LIB([util], [openpty])
464 UL_CHECK_LIB([termcap], [tgetnum])
465
466 AC_CHECK_TYPES([union semun], [], [], [[
467 #include <sys/sem.h>
468 ]])
469 AC_CHECK_TYPES([loff_t])
470
471 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
472 #include <wchar.h>
473 #include <wctype.h>
474 #include <stdio.h>
475 ]], [[
476 wchar_t wc;
477 wint_t w;
478 w = fgetwc(stdin);
479 if (w == WEOF) exit(1);
480 wc = w;
481 fputwc(wc,stdout);
482 ]])],
483 [AC_DEFINE([HAVE_WIDECHAR], [1], [Do we have wide character support?])
484 ])
485
486 AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
487 #include <sched.h>
488 ]])
489
490 AM_CONDITIONAL([HAVE_CPU_SET_T], [test "x$have_cpu_set_t" = xyes])
491
492 AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
493 #include <sched.h>
494 ]])
495
496 # on Solaris, you can't mix and match standards, since we use c99
497 # aparently at this stage, XOPEN_SOURCE will conflict. As workaround,
498 # check for crypt.h and use that without XOPEN_SOURCE.
499 AC_CHECK_HEADERS([crypt.h])
500 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
501 #ifdef HAVE_CRYPT_H
502 #include <crypt.h>
503 #else
504 #define _XOPEN_SOURCE
505 #include <unistd.h>
506 #endif
507 ]], [[
508 char *c = crypt("abc","pw");
509 ]])],[],[
510 LIBS="$LIBS -lcrypt"
511 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
512 #ifdef HAVE_CRYPT_H
513 #include <crypt.h>
514 #else
515 #define _XOPEN_SOURCE
516 #include <unistd.h>
517 #endif
518 ]], [[
519 char *c = crypt("abc","pw");
520 ]])],[
521 AC_DEFINE([HAVE_LIBCRYPT], [1], [Do we need -lcrypt?])
522 have_libcrypt=yes
523 ],[
524 AC_MSG_ERROR([crypt() is not available])
525 ])
526 ])
527 AM_CONDITIONAL([HAVE_LIBCRYPT], [test "x$have_libcrypt" = xyes])
528
529
530 AC_ARG_WITH([selinux],
531 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
532 [], [with_selinux=no]
533 )
534
535 AS_IF([test "x$with_selinux" = xno], [
536 AM_CONDITIONAL([HAVE_SELINUX], [false])
537 ], [
538 PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.0],
539 [AC_DEFINE([HAVE_LIBSELINUX], [1], [Define if SELinux is available])
540 UL_PKG_STATIC([SELINUX_LIBS_STATIC], [libselinux])
541 AM_CONDITIONAL([HAVE_SELINUX], [true])
542 have_selinux=yes],
543 [have_selinux=no])
544
545 AS_CASE([$with_selinux:$have_selinux],
546 [yes:no], [AC_MSG_ERROR([SELinux selected but libselinux not found or too old])]
547 )
548
549 AS_IF([test "x$have_selinux" = xyes], [
550 UL_SET_FLAGS([], [], [$SELINUX_LIBS])
551 # This function is missing in old libselinux 1.xx versions
552 AC_CHECK_FUNCS([security_get_initial_context])
553 UL_RESTORE_FLAGS
554 ])
555 ])
556 AC_SUBST([SELINUX_LIBS])
557 AC_SUBST([SELINUX_LIBS_STATIC])
558
559 AC_ARG_WITH([audit],
560 AS_HELP_STRING([--with-audit], [compile with audit support]),
561 [], [with_audit=no]
562 )
563
564 AS_IF([test "x$with_audit" = xno], [
565 AM_CONDITIONAL([HAVE_AUDIT], [false])
566 ], [
567 UL_CHECK_LIB([audit], [audit_log_user_message])
568 AS_CASE([$with_audit:$have_audit],
569 [yes:no],
570 [AC_MSG_ERROR([Audit selected but libaudit not found (or does not support audit_log_user_message())])]
571 )
572 ])
573
574 AC_ARG_WITH([udev], AS_HELP_STRING([--without-udev], [compile without udev support]),
575 [], [with_udev=auto]
576 )
577
578 AS_IF([test "x$with_udev" = xno], [
579 AM_CONDITIONAL([HAVE_UDEV], [false])
580 ], [
581 UL_CHECK_LIB([udev], [udev_new])
582 AS_CASE([$with_udev:$have_udev],
583 [yes:no],
584 [AC_MSG_ERROR([udev selected but libudev not found])]
585 )
586 ])
587
588 AC_ARG_WITH([ncurses],
589 AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
590 (--without-ncurses disables all ncurses(w) support)]),
591 [], [with_ncurses=auto]
592 )
593 AM_CONDITIONAL([HAVE_NCURSES], [false])
594
595 AS_IF([test "x$with_ncurses" != xno], [
596 have_ncurses=no
597 AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
598 AS_IF([test "x$with_ncurses" = xauto], [
599 UL_CHECK_LIB([ncursesw], [initscr], [ncurses])
600 AS_IF([test "x$have_ncurses" = xyes], [
601 AC_CHECK_HEADERS([ncursesw/ncurses.h])
602 NCURSES_LIBS="-lncursesw"
603 ])
604 ])
605 AS_IF([test "x$have_ncurses" = xno], [
606 UL_CHECK_LIB(ncurses, initscr)
607 AS_IF([test "x$have_ncurses" = xyes], [
608 NCURSES_LIBS="-lncurses"
609 ])
610 ])
611 ])
612 AS_IF([test "x$have_ncurses" = xno], [
613 AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
614 ])
615 ])
616 AC_SUBST([NCURSES_LIBS])
617
618
619 AC_ARG_WITH([slang],
620 AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
621 [], [with_slang=no]
622 )
623 have_slang=no
624 AS_IF([test "x$with_slang" = xyes], [
625 AC_CHECK_HEADERS([slang.h slang/slang.h])
626 AC_CHECK_HEADERS([slcurses.h slang/slcurses.h],
627 [have_slang=yes], [], [
628 #ifdef HAVE_SLANG_H
629 #include <slang.h>
630 #elif defined(HAVE_SLANG_SLANG_H)
631 #include <slang/slang.h>
632 #endif
633 ])
634 AS_IF([test "x$have_slang" = xno], [
635 AC_MSG_ERROR([slang selected but slcurses.h not found])
636 ])
637 ])
638 AM_CONDITIONAL([HAVE_SLANG], [test "x$have_slang" = xyes])
639
640
641 AM_CONDITIONAL([BUILD_CFDISK], [test "x$have_slang" = xyes -o "x$have_ncurses" = xyes])
642
643
644 have_tinfo=no
645 AC_CHECK_LIB([tinfo], [tgetent], [have_tinfo=yes])
646 AM_CONDITIONAL([HAVE_TINFO], [test "x$have_tinfo" = xyes])
647
648
649 AC_ARG_WITH([utempter],
650 AS_HELP_STRING([--with-utempter], [compile script(1) with libutempter]),
651 [], [with_utempter=no]
652 )
653
654 AS_IF([test "x$with_utempter" = xyes], [
655 UL_CHECK_LIB([utempter], [utempter_add_record])
656 AS_IF([test "x$have_utempter" = xno], [
657 AC_MSG_ERROR([utempter selected but libutempter not found])
658 ])
659 ], [
660 AM_CONDITIONAL([HAVE_UTEMPTER], [false])
661 ])
662
663
664 AC_ARG_ENABLE([most-builds],
665 AS_HELP_STRING([--enable-most-builds], [build everything other than experimental code]),
666 [], [enable_most_builds=no]
667 )
668 AS_IF([test "x$enable_most_builds" = xyes], [
669 enable_chfn_chsh=yes
670 enable_line=yes
671 enable_mesg=yes
672 enable_newgrp=yes
673 enable_reset=yes
674 enable_socket_activation=yes
675 enable_tunelp=yes
676 enable_vipw=yes
677 enable_write=yes
678 ])
679
680 dnl
681 dnl libuuid
682 dnl
683 AC_ARG_ENABLE([libuuid],
684 AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]),
685 [], [enable_libuuid=yes]
686 )
687 UL_BUILD_INIT([libuuid])
688 AC_SUBST([LIBUUID_VERSION])
689 AC_SUBST([LIBUUID_VERSION_INFO])
690 AM_CONDITIONAL(BUILD_LIBUUID, test "x$build_libuuid" = xyes)
691
692 AS_IF([test "x$enable_libuuid" = xyes], [
693 AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.])
694 ], [
695 AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
696 ])
697
698 dnl
699 dnl libblkid
700 dnl
701 AC_ARG_ENABLE([libblkid],
702 AS_HELP_STRING([--disable-libblkid], [do not build libblkid and many related utilities]),
703 [], [enable_libblkid=yes]
704 )
705 UL_BUILD_INIT([libblkid])
706 AC_SUBST([LIBBLKID_DATE])
707 AC_SUBST([LIBBLKID_VERSION])
708 AC_SUBST([LIBBLKID_VERSION_INFO])
709 AC_DEFINE_UNQUOTED([LIBBLKID_VERSION], ["$LIBBLKID_VERSION"], [libblkid version string])
710 AC_DEFINE_UNQUOTED([LIBBLKID_DATE], ["$LIBBLKID_DATE"], [libblkid date string])
711 AS_IF([test "x$build_libblkid" = xyes], [
712 AC_DEFINE([HAVE_LIBBLKID], [1], [Define to 1 if you have the -lblkid.])
713 ])
714 AM_CONDITIONAL([BUILD_LIBBLKID], [test "x$build_libblkid" = xyes])
715 AM_CONDITIONAL([BUILD_LIBBLKID_TESTS], [test "x$build_libblkid" = xyes -a "x$enable_static" = xyes])
716
717 dnl
718 dnl libmount
719 dnl
720 AC_ARG_ENABLE([libmount],
721 AS_HELP_STRING([--disable-libmount], [do not build libmount]),
722 [], [enable_libmount=check]
723 )
724 UL_BUILD_INIT([libmount])
725 UL_REQUIRES_LINUX([libmount])
726 UL_REQUIRES_BUILD([libmount], [libblkid])
727 UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
728 AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
729 AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes -a "x$enable_static" = xyes])
730
731 AC_SUBST([LIBMOUNT_VERSION])
732 AC_SUBST([LIBMOUNT_VERSION_INFO])
733 AC_DEFINE_UNQUOTED([LIBMOUNT_VERSION], ["$LIBMOUNT_VERSION"], [libmount version string])
734
735
736 dnl
737 dnl libfdisk is enabled all time if possible
738 dnl
739 UL_BUILD_INIT([libfdisk], [check])
740 UL_REQUIRES_BUILD([libfdisk], [libuuid])
741 AM_CONDITIONAL([BUILD_LIBFDISK], [test "x$build_libfdisk" = xyes])
742
743 UL_BUILD_INIT([fdisk], [check])
744 UL_REQUIRES_BUILD([fdisk], [libfdisk])
745 AM_CONDITIONAL([BUILD_FDISK], [test "x$build_fdisk" = xyes])
746
747
748 AC_ARG_ENABLE([deprecated-mount],
749 AS_HELP_STRING([--enable-deprecated-mount], [build old mount utilities]),
750 [], [enable_deprecated_mount=no]
751 )
752 UL_BUILD_INIT([deprecated_mount])
753 UL_REQUIRES_LINUX([deprecated_mount])
754 UL_REQUIRES_BUILD([deprecated_mount], [libblkid])
755 AM_CONDITIONAL([BUILD_DEPRECATED_MOUNT], [test "x$build_deprecated_mount" = xyes])
756
757
758 AC_ARG_ENABLE([mount],
759 AS_HELP_STRING([--disable-mount], [do not build mount(8) and umount(8)]),
760 [], [enable_mount=check]
761 )
762 UL_BUILD_INIT([mount])
763 UL_REQUIRES_BUILD([mount], [libmount])
764 UL_CONFLICTS_BUILD([mount], [deprecated_mount], [old deprecated mount version])
765 AM_CONDITIONAL([BUILD_MOUNT], [test "x$build_mount" = xyes])
766
767
768 AC_ARG_ENABLE([losetup],
769 AS_HELP_STRING([--disable-losetup], [do not build losetup]),
770 [], [enable_losetup=check]
771 )
772 UL_BUILD_INIT([losetup])
773 UL_REQUIRES_LINUX([losetup])
774 AM_CONDITIONAL([BUILD_LOSETUP], [test "x$build_losetup" = xyes])
775
776
777 AC_ARG_ENABLE([cytune],
778 AS_HELP_STRING([--disable-cytune], [do not build cytune]),
779 [], [enable_cytune=check]
780 )
781 UL_BUILD_INIT([cytune])
782 UL_REQUIRES_LINUX([cytune])
783 AM_CONDITIONAL([BUILD_CYTUNE], [test "x$build_cytune" = xyes])
784
785
786 AC_ARG_ENABLE([fsck],
787 AS_HELP_STRING([--disable-fsck], [do not build fsck]),
788 [], [enable_fsck=check]
789 )
790 UL_BUILD_INIT([fsck])
791 UL_REQUIRES_BUILD([fsck], [libmount])
792 AM_CONDITIONAL([BUILD_FSCK], [test "x$build_fsck" = xyes])
793
794
795 AC_ARG_ENABLE([partx],
796 AS_HELP_STRING([--disable-partx], [do not build addpart, delpart, partx]),
797 [], [enable_partx=check]
798 )
799 UL_BUILD_INIT([partx])
800 UL_REQUIRES_LINUX([partx])
801 UL_REQUIRES_BUILD([partx], [libblkid])
802 AM_CONDITIONAL([BUILD_PARTX], [test "x$build_partx" = xyes])
803
804
805 AC_ARG_ENABLE([uuidd],
806 AS_HELP_STRING([--disable-uuidd], [do not build the uuid daemon]),
807 [], [enable_uuidd=check]
808 )
809 UL_BUILD_INIT([uuidd])
810 UL_REQUIRES_BUILD([uuidd], [libuuid])
811 AS_IF([test "x$build_uuidd" = xyes], [
812 AC_DEFINE([HAVE_UUIDD], [1], [Define to 1 if you want to use uuid daemon.])
813 ])
814 AM_CONDITIONAL([BUILD_UUIDD], [test "x$build_uuidd" = xyes])
815
816
817 AC_ARG_ENABLE([mountpoint],
818 AS_HELP_STRING([--disable-mountpoint], [do not build mountpoint]),
819 [], [enable_mountpoint=check]
820 )
821 UL_BUILD_INIT([mountpoint])
822 UL_REQUIRES_BUILD([mountpoint], [libmount])
823 AM_CONDITIONAL([BUILD_MOUNTPOINT], [test "x$build_mountpoint" = xyes])
824
825
826 AC_ARG_ENABLE([fallocate],
827 AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
828 [], [enable_fallocate=check]
829 )
830 UL_BUILD_INIT([fallocate])
831 UL_REQUIRES_LINUX([fallocate])
832 UL_REQUIRES_SYSCALL_CHECK([fallocate], [UL_CHECK_SYSCALL([fallocate])])
833 AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])
834
835 AS_IF([test "x$build_fallocate" = xyes], [
836 dnl check for valid fallocate() function
837 dnl with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
838 dnl when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
839 dnl and program can't be linked.
840 dnl AC_CHECK_FUNC can't catch such errors since it's redefining
841 dnl function prototype.
842 AC_MSG_CHECKING([for valid fallocate() function])
843 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
844 #ifdef HAVE_UNISTD_H
845 # include <unistd.h>
846 #endif
847 #ifdef HAVE_SYS_TYPES_H
848 # include <sys/types.h>
849 #endif
850 #ifdef HAVE_LINUX_FALLOC_H
851 # include <linux/falloc.h>
852 #endif
853 #ifdef HAVE_FCNTL_H
854 # include <fcntl.h>
855 #endif
856 ]],[[
857 long ret;
858 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
859 if (ret != 0) {
860 return 1;
861 }
862 ]])],[
863 AC_MSG_RESULT([yes])
864 AC_DEFINE([HAVE_FALLOCATE], [1], [Have valid fallocate() function])],[
865 AC_MSG_RESULT([no])])
866 ])
867
868
869 AC_ARG_ENABLE([unshare],
870 AS_HELP_STRING([--disable-unshare], [do not build unshare]),
871 [], [enable_unshare=check]
872 )
873 UL_BUILD_INIT([unshare])
874 UL_REQUIRES_LINUX([unshare])
875 UL_REQUIRES_SYSCALL_CHECK([unshare], [UL_CHECK_SYSCALL([unshare])])
876 AM_CONDITIONAL([BUILD_UNSHARE], [test "x$build_unshare" = xyes])
877 AC_CHECK_FUNCS([unshare])
878
879 AC_ARG_ENABLE([nsenter],
880 AS_HELP_STRING([--disable-nsenter], [do not build nsenter]),
881 [], [enable_nsenter=check]
882 )
883 UL_BUILD_INIT([nsenter])
884 UL_REQUIRES_LINUX([nsenter])
885 UL_REQUIRES_SYSCALL_CHECK([nsenter], [UL_CHECK_SYSCALL([setns])], [setns])
886 AM_CONDITIONAL([BUILD_NSENTER], [test "x$build_nsenter" = xyes])
887 AC_CHECK_FUNCS([setns])
888
889 dnl setpriv depends on libcap-ng. It would be possible to build
890 dnl a version of setpriv with limited functionality without libcap-ng,
891 dnl but this isn't currently supported.
892 UL_CHECK_LIB([cap-ng], [capng_apply], [cap_ng])
893 AC_ARG_ENABLE([setpriv],
894 AS_HELP_STRING([--disable-setpriv], [do not build setpriv]),
895 [], [enable_setpriv=check]
896 )
897 UL_BUILD_INIT([setpriv])
898 UL_REQUIRES_LINUX([setpriv])
899 UL_REQUIRES_HAVE([setpriv], [linux_securebits_h], [securebits.h header file])
900 UL_REQUIRES_HAVE([setpriv], [cap_ng], [libcap-ng library])
901 AM_CONDITIONAL([BUILD_SETPRIV], [test "x$build_setpriv" = xyes])
902
903
904 AC_ARG_ENABLE([eject],
905 AS_HELP_STRING([--disable-eject], [do not build eject]),
906 [], [enable_eject=check]
907 )
908 UL_BUILD_INIT([eject])
909 UL_REQUIRES_LINUX([eject])
910 UL_REQUIRES_BUILD([eject], [libmount])
911 AM_CONDITIONAL([BUILD_EJECT], [test "x$build_eject" = xyes])
912
913
914 AC_ARG_ENABLE([agetty],
915 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
916 [], [enable_agetty=yes]
917 )
918 UL_BUILD_INIT([agetty])
919 AM_CONDITIONAL([BUILD_AGETTY], [test "x$build_agetty" = xyes])
920
921
922 AC_ARG_ENABLE([cramfs],
923 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
924 [], [enable_cramfs=check]
925 )
926 UL_BUILD_INIT([cramfs])
927 AC_CHECK_LIB([z], [crc32], [have_z=yes], [have_z=no])
928 UL_REQUIRES_HAVE([cramfs], [z], [z library])
929 AM_CONDITIONAL([BUILD_CRAMFS], [test "x$build_cramfs" = xyes])
930
931
932 AC_ARG_ENABLE([bfs],
933 AS_HELP_STRING([--disable-bfs], [do not build mkfs.bfs]),
934 [], [enable_bfs=yes]
935 )
936 UL_BUILD_INIT([bfs])
937 AM_CONDITIONAL([BUILD_BFS], [test "x$build_bfs" = xyes])
938
939
940 AC_ARG_ENABLE([fdformat],
941 AS_HELP_STRING([--disable-fdformat], [do not build fdformat]),
942 [], [enable_fdformat=check]
943 )
944 UL_BUILD_INIT([fdformat])
945 UL_REQUIRES_LINUX([fdformat])
946 AM_CONDITIONAL([BUILD_FDFORMAT], [test "x$build_fdformat" = xyes])
947
948
949 AC_ARG_ENABLE([hwclock],
950 AS_HELP_STRING([--disable-hwclock], [do not build hwclock]),
951 [], [enable_hwclock=check]
952 )
953 have_linuxdummy=$linux_os
954
955 UL_BUILD_INIT([hwclock])
956 UL_REQUIRES_HAVE([hwclock], [io, linuxdummy], [ioperm iopl function or Linux])
957 AM_CONDITIONAL([BUILD_HWCLOCK], [test "x$build_hwclock" = xyes])
958
959
960 UL_BUILD_INIT([swapon], [check])
961 UL_REQUIRES_LINUX([swapon])
962 UL_REQUIRES_BUILD([swapon], [libblkid])
963 UL_REQUIRES_BUILD([swapon], [libmount])
964 AM_CONDITIONAL([BUILD_SWAPON], [test "x$build_swapon" = xyes])
965
966
967 UL_BUILD_INIT([lsblk], [check])
968 UL_REQUIRES_LINUX([lsblk])
969 UL_REQUIRES_BUILD([lsblk], [libblkid])
970 UL_REQUIRES_BUILD([lsblk], [libmount])
971 AM_CONDITIONAL([BUILD_LSBLK], [test "x$build_lsblk" = xyes])
972
973
974 UL_BUILD_INIT([lscpu], [check])
975 UL_REQUIRES_LINUX([lscpu])
976 UL_REQUIRES_HAVE([lscpu], [cpu_set_t], [cpu_set_t type])
977 AM_CONDITIONAL([BUILD_LSCPU], [test "x$build_lscpu" = xyes])
978
979
980 UL_BUILD_INIT([chcpu], [check])
981 UL_REQUIRES_LINUX([chcpu])
982 UL_REQUIRES_HAVE([chcpu], [cpu_set_t], [cpu_set_t type])
983 AM_CONDITIONAL([BUILD_CHCPU], [test "x$build_chcpu" = xyes])
984
985
986 AC_ARG_ENABLE([wdctl],
987 AS_HELP_STRING([--disable-wdctl], [do not build wdctl]),
988 [], [enable_wdctl=check]
989 )
990 UL_BUILD_INIT([wdctl])
991 UL_REQUIRES_LINUX([wdctl])
992 UL_REQUIRES_HAVE([wdctl], [linux_watchdog_h], [linux/watchdog.h header file])
993 AM_CONDITIONAL([BUILD_WDCTL], [test "x$build_wdctl" = xyes])
994
995
996 UL_BUILD_INIT([swaplabel], [check])
997 UL_REQUIRES_BUILD([swaplabel], [libblkid])
998 AM_CONDITIONAL([BUILD_SWAPLABEL], [test "x$build_swaplabel" = xyes])
999
1000
1001 UL_BUILD_INIT([prlimit], [check])
1002 UL_REQUIRES_LINUX([prlimit])
1003 UL_REQUIRES_SYSCALL_CHECK([prlimit], [UL_CHECK_SYSCALL([prlimit64])], [prlimit64])
1004 AM_CONDITIONAL([BUILD_PRLIMIT], [test "x$build_prlimit" = xyes])
1005 AS_IF([test "x$build_prlimit" = xyes], [
1006 AC_CHECK_FUNCS([prlimit])
1007 ])
1008
1009
1010 UL_BUILD_INIT([lslocks], [check])
1011 UL_REQUIRES_LINUX([lslocks])
1012 UL_REQUIRES_BUILD([lslocks], [libmount])
1013 AM_CONDITIONAL([BUILD_LSLOCKS], [test "x$build_lslocks" = xyes])
1014
1015
1016 AC_ARG_ENABLE([switch_root],
1017 AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
1018 [], [enable_switch_root=check]
1019 )
1020 UL_BUILD_INIT([switch_root])
1021 UL_REQUIRES_LINUX([switch_root])
1022 UL_REQUIRES_HAVE([switch_root], [openat], [openat function])
1023 AM_CONDITIONAL([BUILD_SWITCH_ROOT], [test "x$build_switch_root" = xyes])
1024
1025
1026 AC_ARG_ENABLE([pivot_root],
1027 AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
1028 [], [enable_pivot_root=check]
1029 )
1030 UL_BUILD_INIT([pivot_root])
1031 UL_REQUIRES_LINUX([switch_root])
1032 UL_REQUIRES_SYSCALL_CHECK([pivot_root], [UL_CHECK_SYSCALL([pivot_root])])
1033 AM_CONDITIONAL([BUILD_PIVOT_ROOT], [test "x$build_pivot_root" = xyes])
1034
1035
1036 AC_ARG_ENABLE([tunelp],
1037 AS_HELP_STRING([--enable-tunelp], [build tunelp]),
1038 [], [enable_tunelp=no]
1039 )
1040 UL_BUILD_INIT([tunelp])
1041 UL_REQUIRES_LINUX([tunelp])
1042 AM_CONDITIONAL([BUILD_TUNELP], [test "x$build_tunelp" = xyes])
1043
1044
1045 AC_ARG_ENABLE([kill],
1046 AS_HELP_STRING([--disable-kill], [do not build kill]),
1047 [], [enable_kill=check]
1048 )
1049 UL_BUILD_INIT([kill])
1050 UL_REQUIRES_LINUX([kill])
1051 AM_CONDITIONAL([BUILD_KILL], [test "x$build_kill" = xyes])
1052
1053
1054 AC_ARG_ENABLE([deprecated-last],
1055 AS_HELP_STRING([--enable-deprecated-last], [build old deprecated last]),
1056 [], [enable_deprecated_last=no]
1057 )
1058 UL_BUILD_INIT([deprecated_last])
1059 AM_CONDITIONAL([BUILD_DEPRECATED_LAST], [test "x$build_deprecated_last" = xyes])
1060
1061
1062 AC_ARG_ENABLE([last],
1063 AS_HELP_STRING([--disable-last], [do not build last]),
1064 [], [enable_last=check]
1065 )
1066 UL_BUILD_INIT([last])
1067 UL_CONFLICTS_BUILD([last], [deprecated_last], [old deprecated last version])
1068 AM_CONDITIONAL([BUILD_LAST], [test "x$build_last" = xyes])
1069
1070
1071 AC_ARG_ENABLE([utmpdump],
1072 AS_HELP_STRING([--disable-utmpdump], [do not build utmpdump]),
1073 [], [enable_utmpdump=yes]
1074 )
1075 UL_BUILD_INIT([utmpdump])
1076 AM_CONDITIONAL([BUILD_UTMPDUMP], [test "x$build_utmpdump" = xyes])
1077
1078
1079 AC_ARG_ENABLE([line],
1080 AS_HELP_STRING([--enable-line], [build line]),
1081 [], [enable_line=no]
1082 )
1083 UL_BUILD_INIT([line])
1084 AM_CONDITIONAL([BUILD_LINE], [test "x$build_line" = xyes])
1085
1086
1087 AC_ARG_ENABLE([mesg],
1088 AS_HELP_STRING([--disable-mesg], [do not build mesg]),
1089 [], [enable_mesg=yes]
1090 )
1091 UL_BUILD_INIT([mesg])
1092 AM_CONDITIONAL([BUILD_MESG], [test "x$build_mesg" = xyes])
1093
1094
1095 AC_ARG_ENABLE([raw],
1096 AS_HELP_STRING([--disable-raw], [do not build raw]),
1097 [], [enable_raw=check]
1098 )
1099 UL_BUILD_INIT([raw])
1100 UL_REQUIRES_LINUX([raw])
1101 UL_REQUIRES_HAVE([raw], [linux_raw_h], [raw.h header file])
1102 AM_CONDITIONAL([BUILD_RAW], [test "x$build_raw" = xyes])
1103
1104
1105 AC_ARG_ENABLE([rename],
1106 AS_HELP_STRING([--disable-rename], [do not build rename]),
1107 [], [enable_rename=yes]
1108 )
1109 UL_BUILD_INIT([rename])
1110 AM_CONDITIONAL([BUILD_RENAME], [test "x$build_rename" = xyes])
1111
1112
1113 AC_ARG_ENABLE([reset],
1114 AS_HELP_STRING([--enable-reset], [build reset]),
1115 [], [enable_reset=no]
1116 )
1117 UL_BUILD_INIT([reset])
1118 AM_CONDITIONAL([BUILD_RESET], [test "x$build_reset" = xyes])
1119
1120
1121 AC_ARG_ENABLE([vipw],
1122 AS_HELP_STRING([--enable-vipw], [build vipw]),
1123 [], [enable_vipw=no]
1124 )
1125 UL_BUILD_INIT([vipw])
1126 AM_CONDITIONAL([BUILD_VIPW], [test "x$build_vipw" = xyes])
1127
1128
1129 AC_ARG_ENABLE([newgrp],
1130 AS_HELP_STRING([--enable-newgrp], [build newgrp]),
1131 [], [enable_newgrp=no]
1132 )
1133 UL_BUILD_INIT([newgrp])
1134 AM_CONDITIONAL([BUILD_NEWGRP], [test "x$build_newgrp" = xyes])
1135
1136
1137 AC_ARG_WITH([user], AS_HELP_STRING([--without-user], [compile without libuser (remote chsh)]),
1138 [], [with_user=check]
1139 )
1140 have_user=no
1141 AS_IF([test "x$with_user" != xno], [
1142 PKG_CHECK_MODULES(LIBUSER,[libuser >= 0.58], [have_user=yes], [have_user=no])
1143 AS_CASE([$with_user:$have_user],
1144 [yes:no],
1145 [AC_MSG_ERROR([user selected but libuser not found])],
1146 [*:yes],
1147 [AC_DEFINE([HAVE_LIBUSER], [1], [Define if libuser is available])]
1148 )
1149 # temporary solution, libuser has stupid .pc where are exported all
1150 # private dependencies to Requires: instead of Requires.private:
1151 AS_IF([test "x$have_user" = xyes], [
1152 LIBUSER_LIBS=-luser
1153 ])
1154 ])
1155 AM_CONDITIONAL([HAVE_USER], [test "x$have_user" = xyes])
1156
1157 AC_ARG_ENABLE([chfn-chsh-password],
1158 AS_HELP_STRING([--disable-chfn-chsh-password], [do not require the user to enter the password in chfn and chsh]),
1159 [], [enable_chfn_chsh_password=yes]
1160 )
1161
1162 AC_ARG_ENABLE([chfn-chsh],
1163 AS_HELP_STRING([--enable-chfn-chsh], [build chfn and chsh]),
1164 [], [enable_chfn_chsh=no]
1165 )
1166 UL_BUILD_INIT([chfn_chsh])
1167
1168 AS_IF([test "x$enable_chfn_chsh_password" = xyes -o "x$have_user" = xyes], [
1169 UL_REQUIRES_HAVE([chfn_chsh], [security_pam_misc_h], [PAM header file])
1170 AC_DEFINE([CHFN_CHSH_PASSWORD], [1], [Should chfn and chsh require the user to enter the password?])
1171 ])
1172 AM_CONDITIONAL([BUILD_CHFN_CHSH], [test "x$build_chfn_chsh" = xyes])
1173 AM_CONDITIONAL([CHFN_CHSH_PASSWORD], [test "x$enable_chfn_chsh_password" = xyes])
1174
1175 AC_ARG_ENABLE([chsh-only-listed],
1176 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
1177 [], enable_chsh_only_listed=yes
1178 )
1179
1180 AS_IF([test "x$enable_chsh_only_listed" = xyes], [
1181 AC_DEFINE([ONLY_LISTED_SHELLS], [1], [Should chsh allow only shells in /etc/shells?])
1182 ])
1183
1184
1185 AC_ARG_ENABLE([login],
1186 AS_HELP_STRING([--disable-login], [do not build login]),
1187 [], [enable_login=check]
1188 )
1189 UL_BUILD_INIT([login])
1190 UL_REQUIRES_HAVE([login], [security_pam_misc_h], [PAM header file])
1191 AM_CONDITIONAL([BUILD_LOGIN], [test "x$build_login" = xyes])
1192
1193 AC_ARG_ENABLE([login-chown-vcs],
1194 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
1195 [], [enable_login_chown_vcs=no]
1196 )
1197
1198 AS_IF([test "x$enable_login_chown_vcs" = xyes], [
1199 AC_DEFINE([LOGIN_CHOWN_VCS], [1], [Should login chown /dev/vcsN?])
1200 ])
1201
1202 AC_ARG_ENABLE([login-stat-mail],
1203 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
1204 [], [enable_login_stat_mail=no]
1205 )
1206
1207 AS_IF([test "x$enable_login_stat_mail" = xyes], [
1208 AC_DEFINE([LOGIN_STAT_MAIL], [1], [Should login stat() the mailbox?])
1209 ])
1210
1211
1212 AC_ARG_ENABLE([sulogin],
1213 AS_HELP_STRING([--disable-sulogin], [do not build sulogin]),
1214 [], [enable_sulogin=yes]
1215 )
1216 UL_BUILD_INIT([sulogin])
1217 AM_CONDITIONAL([BUILD_SULOGIN], [test "x$build_sulogin" = xyes])
1218
1219
1220 AC_ARG_ENABLE([su],
1221 AS_HELP_STRING([--disable-su], [do not build su]),
1222 [], [enable_su=check]
1223 )
1224 UL_BUILD_INIT([su])
1225 UL_REQUIRES_HAVE([su], [security_pam_misc_h], [PAM header file])
1226 AM_CONDITIONAL([BUILD_SU], [test "x$build_su" = xyes])
1227
1228
1229 AC_ARG_ENABLE([runuser],
1230 AS_HELP_STRING([--disable-runuser], [do not build runuser]),
1231 [], [enable_runuser=check]
1232 )
1233 UL_BUILD_INIT([runuser])
1234 UL_REQUIRES_HAVE([runuser], [security_pam_misc_h], [PAM header file])
1235 AM_CONDITIONAL([BUILD_RUNUSER], [test "x$build_runuser" = xyes])
1236
1237
1238 AC_ARG_ENABLE([ul],
1239 AS_HELP_STRING([--disable-ul], [do not build ul]),
1240 [], [enable_ul=check]
1241 )
1242 UL_BUILD_INIT([ul])
1243 UL_REQUIRES_HAVE([ul], [ncurses, tinfo], [ncurses or tinfo libraries])
1244 AM_CONDITIONAL([BUILD_UL], [test "x$build_ul" = xyes])
1245
1246
1247 AC_ARG_ENABLE([more],
1248 AS_HELP_STRING([--disable-more], [do not build more]),
1249 [], [enable_more=check]
1250 )
1251 UL_BUILD_INIT([more])
1252 UL_REQUIRES_HAVE([more], [ncurses, tinfo, termcap], [ncurses, tinfo or termcap libraries])
1253 AM_CONDITIONAL([BUILD_MORE], [test "x$build_more" = xyes])
1254
1255
1256 AC_ARG_ENABLE([pg],
1257 AS_HELP_STRING([--disable-pg], [do not build pg]),
1258 [], [enable_pg=check]
1259 )
1260 UL_BUILD_INIT([pg])
1261 UL_REQUIRES_HAVE([pg], [ncurses], [ncurses or ncursesw library])
1262 AM_CONDITIONAL([BUILD_PG], [test "x$build_pg" = xyes])
1263
1264
1265 AC_ARG_ENABLE([setterm],
1266 AS_HELP_STRING([--disable-setterm], [do not build setterm]),
1267 [], [enable_setterm=check]
1268 )
1269 UL_BUILD_INIT([setterm])
1270 UL_REQUIRES_LINUX([setterm])
1271 UL_REQUIRES_HAVE([setterm], [ncurses], [ncurses library])
1272 AM_CONDITIONAL([BUILD_SETTERM], [test "x$build_setterm" = xyes])
1273
1274
1275 AC_ARG_ENABLE([schedutils],
1276 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, taskset]),
1277 [], [enable_schedutils=yes]
1278 )
1279 UL_BUILD_INIT([schedutils])
1280 AM_CONDITIONAL([BUILD_SCHEDUTILS], [test "x$build_schedutils" = xyes])
1281
1282 UL_BUILD_INIT([ionice], [check])
1283 UL_REQUIRES_BUILD([ionice], [schedutils])
1284 UL_REQUIRES_SYSCALL_CHECK([ionice],
1285 [UL_CHECK_SYSCALL([ioprio_set],
1286 [alpha], [442],
1287 [i*86], [289],
1288 [ia64*], [1274],
1289 [powerpc*], [273],
1290 [s390*], [282],
1291 [sparc*], [196],
1292 [sh*], [288],
1293 [x86_64*], [251])],
1294 [ioprio_set])
1295
1296 UL_REQUIRES_SYSCALL_CHECK([ionice],
1297 [UL_CHECK_SYSCALL([ioprio_get],
1298 [alpha], [443],
1299 [i*86], [290],
1300 [ia64*], [1275],
1301 [powerpc*], [274],
1302 [s390*], [283],
1303 [sparc*], [218],
1304 [sh*], [289],
1305 [x86_64*], [252])],
1306 [ioprio_get])
1307
1308 AM_CONDITIONAL([BUILD_IONICE], [test "x$build_ionice" = xyes])
1309
1310 UL_BUILD_INIT([taskset], [check])
1311 UL_REQUIRES_BUILD([taskset], [schedutils])
1312 UL_REQUIRES_HAVE([taskset], [cpu_set_t], [cpu_set_t type])
1313 UL_REQUIRES_SYSCALL_CHECK([taskset],
1314 [UL_CHECK_SYSCALL([sched_getaffinity])],
1315 [sched_getaffinity])
1316 AM_CONDITIONAL([BUILD_TASKSET], [test "x$build_taskset" = xyes])
1317
1318
1319 AC_ARG_ENABLE([wall],
1320 AS_HELP_STRING([--disable-wall], [do not build wall]),
1321 [], [enable_wall=yes]
1322 )
1323 UL_BUILD_INIT([wall])
1324 AM_CONDITIONAL([BUILD_WALL], [test "x$build_wall" = xyes])
1325
1326
1327 AC_ARG_ENABLE([write],
1328 AS_HELP_STRING([--enable-write], [build write]),
1329 [], [enable_write=no]
1330 )
1331 UL_BUILD_INIT([write])
1332 AM_CONDITIONAL([BUILD_WRITE], [test "x$build_write" = xyes])
1333
1334
1335 AC_ARG_ENABLE([socket-activation],
1336 AS_HELP_STRING([--enable-socket-activation], [build uuidd with support for systemd socket activation]),
1337 [], [enable_socket_activation=no]
1338 )
1339
1340 AM_CONDITIONAL([USE_SOCKET_ACTIVATION], [test "x$enable_socket_activation" = xyes])
1341
1342 AS_IF([test "x$enable_socket_activation" = xyes], [
1343 AC_DEFINE([USE_SOCKET_ACTIVATION], [1], [Should uuidd support socket activation?])
1344 ])
1345
1346 AC_ARG_WITH([systemdsystemunitdir],
1347 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [directory for systemd service files]),
1348 [], [with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`])
1349
1350 AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
1351 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
1352 ])
1353
1354 AM_CONDITIONAL([HAVE_SYSTEMD], [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
1355
1356
1357 AC_ARG_WITH([bashcompletiondir],
1358 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
1359 [],
1360 [AS_IF([`$PKG_CONFIG --exists bash-completion`], [
1361 with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion`
1362 ], [
1363 with_bashcompletiondir=${datadir}/bash-completion/completions
1364 ])
1365 ])
1366 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
1367
1368 AC_ARG_ENABLE([bash-completion],
1369 AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]),
1370 [], [enable_bash_completion=yes]
1371 )
1372
1373 AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes])
1374
1375
1376 AC_ARG_WITH([python],
1377 AS_HELP_STRING([--without-python], [do not generate python bindings]),
1378 [], [with_python=yes]
1379 )
1380 have_python=no
1381 AS_IF([test "x$with_python" = xyes], [
1382 AM_PATH_PYTHON([2.4])
1383 AS_IF([test -x "$PYTHON-config"], [
1384 have_python=yes
1385 PYTHON_INCLUDES=$($PYTHON-config --includes)
1386 AC_SUBST(PYTHON_INCLUDES)
1387 ])
1388 ])
1389
1390 dnl FIXME: the python3 should be fixed in future.
1391 AS_CASE([$PYTHON_VERSION],
1392 [2.*], [],
1393 [3.*], [AC_MSG_ERROR([pylibmount will not work with python3])],
1394 [AC_MSG_ERROR([unanticipated python version])]
1395 )
1396
1397 UL_BUILD_INIT([pylibmount], [check])
1398 UL_REQUIRES_HAVE([pylibmount], [python])
1399 UL_REQUIRES_BUILD([pylibmount], [libmount])
1400 AM_CONDITIONAL([BUILD_PYLIBMOUNT], [test "x$build_pylibmount" = "xyes"])
1401
1402
1403 AC_ARG_ENABLE([pg-bell],
1404 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
1405 [], [enable_pg_bell=yes]
1406 )
1407
1408 AS_IF([test "x$enable_pg_bell" = xyes], [
1409 AC_DEFINE([PG_BELL], [1], [Should pg ring the bell on invalid keys?])
1410 ])
1411
1412
1413 AC_DEFUN([FS_PATHS_DEFAULT], [/sbin:/sbin/fs.d:/sbin/fs])
1414 AC_ARG_ENABLE([fs-paths-default],
1415 AS_HELP_STRING([--enable-fs-paths-default=paths], [default search path for fs helpers @<:@FS_PATHS_DEFAULT@:>@]),
1416 [AS_CASE([$enableval],
1417 [yes], [fs_paths_defaults="FS_PATHS_DEFAULT"],
1418 [no], [fs_paths_defaults=""],
1419 [fs_paths_defaults="$enableval"]
1420 )],
1421 [fs_paths_defaults="FS_PATHS_DEFAULT"]
1422 )
1423 AC_ARG_ENABLE([fs-paths-extra],
1424 AS_HELP_STRING([--enable-fs-paths-extra=paths], [additional search paths for fs helpers]),
1425 [AS_CASE([$enableval],
1426 [yes|no], [fs_paths_extra=""],
1427 [fs_paths_extra="$enableval"]
1428 )],
1429 [fs_paths_extra=""]
1430 )
1431 fs_paths="$fs_paths_defaults"
1432 AS_IF([test "x$fs_paths_extra" != "x"], [
1433 AS_IF([test "x$fs_paths" != "x"], [
1434 fs_paths="${fs_paths}:"
1435 ])
1436 fs_paths="${fs_paths}${fs_paths_extra}"
1437 ])
1438 AC_DEFINE_UNQUOTED([FS_SEARCH_PATH], "$fs_paths", [search path for fs helpers])
1439
1440
1441 AC_ARG_ENABLE([use-tty-group],
1442 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
1443 [], [enable_use_tty_group=yes]
1444 )
1445 AM_CONDITIONAL([USE_TTY_GROUP], [test "x$enable_use_tty_group" = xyes])
1446
1447 AS_IF([test "x$enable_use_tty_group" = xyes], [
1448 AC_DEFINE([USE_TTY_GROUP], [1], [Should wall and write be installed setgid tty?])
1449 ])
1450
1451
1452 AC_ARG_ENABLE([sulogin-emergency-mount],
1453 AS_HELP_STRING([--enable-sulogin-emergency-mount],
1454 [use emergency mount of /dev and /proc for sulogin]),
1455 [], [enable_sulogin_emergency_mount=no]
1456 )
1457
1458 AS_IF([test "x$enable_sulogin_emergency_mount" = xyes], [
1459 AC_DEFINE([USE_SULOGIN_EMERGENCY_MOUNT], [1],
1460 [Should sulogin use a emergency mount of /dev and /proc?])
1461 ])
1462
1463
1464 AC_ARG_ENABLE([makeinstall-chown],
1465 AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]),
1466 [], [enable_makeinstall_chown=yes]
1467 )
1468 AM_CONDITIONAL([MAKEINSTALL_DO_CHOWN], [test "x$enable_makeinstall_chown" = xyes])
1469
1470 AC_ARG_ENABLE([makeinstall-setuid],
1471 AS_HELP_STRING([--disable-makeinstall-setuid], [do not do setuid chmod operations during "make install"]),
1472 [], [enable_makeinstall_setuid=yes]
1473 )
1474 AM_CONDITIONAL([MAKEINSTALL_DO_SETUID], [test "x$enable_makeinstall_setuid" = xyes])
1475
1476
1477 AC_ARG_VAR([SUID_CFLAGS],
1478 [CFLAGS used for binaries which are usually with the suid bit])
1479 AC_ARG_VAR([SUID_LDFLAGS],
1480 [LDFLAGS used for binaries which are usually with the suid bit])
1481
1482 AC_ARG_VAR([DAEMON_CFLAGS],
1483 [CFLAGS used for binaries which are usually executed as daemons])
1484 AC_ARG_VAR([DAEMON_LDFLAGS],
1485 [LDFLAGS used for binaries which are usually executed as daemons])
1486
1487 AC_ARG_VAR([SOLIB_CFLAGS],
1488 [CFLAGS used for shared libraries])
1489 AC_ARG_VAR([SOLIB_LDFLAGS],
1490 [LDFLAGS used for shared libraries])
1491
1492 LIBS=""
1493
1494
1495 AC_CONFIG_HEADERS([config.h])
1496
1497 #
1498 # Don't use configure.ac to replace install paths! See Makefile PATHFILES for
1499 # more details.
1500 #
1501 AC_CONFIG_FILES([
1502 Makefile
1503 libblkid/docs/Makefile
1504 libblkid/docs/version.xml
1505 libblkid/src/blkid.h
1506 libmount/docs/Makefile
1507 libmount/docs/version.xml
1508 libmount/src/libmount.h
1509 po/Makefile.in
1510 ])
1511
1512 AC_OUTPUT
1513
1514 AC_MSG_RESULT([
1515 ${PACKAGE} ${VERSION}
1516
1517 prefix: ${prefix}
1518 exec prefix: ${exec_prefix}
1519
1520 localstatedir: ${localstatedir}
1521 bindir: ${bindir}
1522 sbindir: ${sbindir}
1523 libdir: ${libdir}
1524 includedir: ${includedir}
1525 usrbin_execdir: ${usrbin_execdir}
1526 usrsbin_execdir: ${usrsbin_execdir}
1527 usrlib_execdir: ${usrlib_execdir}
1528
1529 compiler: ${CC}
1530 cflags: ${CFLAGS}
1531 suid cflags: ${SUID_CFLAGS}
1532 ldflags: ${LDFLAGS}
1533 suid ldflags: ${SUID_LDFLAGS}
1534 Bash completions dir: ${with_bashcompletiondir}
1535
1536 warnings:
1537
1538 ${WARN_CFLAGS}
1539 ])