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