]> git.ipfire.org Git - thirdparty/util-linux.git/blame - configure.ac
docs: add README.licensing
[thirdparty/util-linux.git] / configure.ac
CommitLineData
a21adf48 1AC_INIT(util-linux-ng, 2.13-rc3, kzak@redhat.com)
baf39af1
KZ
2
3AC_PREREQ(2.59)
48d7b13a
KZ
4
5AC_CONFIG_AUX_DIR(config)
6
42d2a7ba 7AM_INIT_AUTOMAKE([check-news -Wall foreign 1.9 dist-bzip2])
48d7b13a
KZ
8
9AC_CONFIG_SRCDIR(mount/mount.c)
10
15a9b48c
SK
11AC_PREFIX_DEFAULT([/usr])
12
13# Check whether exec_prefix=/usr:
14case $exec_prefix:$prefix in
15NONE:NONE | NONE:/usr | /usr:*)
16 AC_MSG_NOTICE([Default --exec-prefix detected.])
17 case $bindir in
18 '${exec_prefix}/bin') bindir=/bin
19 AC_MSG_NOTICE([ --bindir defaults to /bin]) ;;
20 esac
21 case $sbindir in
22 '${exec_prefix}/sbin') sbindir=/sbin
23 AC_MSG_NOTICE([ --sbindir defaults to /sbin]) ;;
24 esac ;;
25esac
48d7b13a
KZ
26
27AC_PROG_CC_STDC
240f7101 28AC_GNU_SOURCE
48d7b13a
KZ
29
30AC_PATH_PROG(PERL, perl)
3f5bda01
KZ
31AC_PATH_PROG(BLKID, blkid, [], [$PATH:/sbin])
32AC_PATH_PROG(VOLID, vol_id, [], [$PATH:/lib/udev])
48d7b13a
KZ
33
34AC_SYS_LARGEFILE
35
bf962c0a 36AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h], [], [], [
48d7b13a
KZ
37#ifdef HAVE_LINUX_COMPILER_H
38#include <linux/compiler.h>
39#endif
40])
bf962c0a
SK
41AC_CHECK_HEADERS(
42 [scsi/scsi.h \
43 langinfo.h \
44 sys/user.h \
45 rpcsvc/nfs_prot.h \
46 sys/io.h \
fd67be31
SK
47 pty.h])
48AC_CHECK_HEADERS([linux/raw.h],
49 [AM_CONDITIONAL([HAVE_RAW], [true])],
50 [AM_CONDITIONAL([HAVE_RAW], [false])])
48d7b13a 51
bf962c0a
SK
52AC_CHECK_FUNCS(
53 [inet_aton \
54 fsync \
55 getdomainname \
56 nanosleep \
57 personality \
58 updwtmp \
59 lchown \
60 rpmatch])
48d7b13a 61AC_FUNC_FSEEKO
48d7b13a 62
fd67be31
SK
63dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION)
64dnl ---------------------------------
65AC_DEFUN([UTIL_CHECK_LIB], [
66 dnl The trick is to keep the third argument to AC_CHECK_LIB empty,
67 dnl and thus keep the default action.
68 have_$1=yes
69 AC_CHECK_LIB([$1], [$2], [], [have_$1=no])
70 AM_CONDITIONAL(AS_TR_CPP(HAVE_$1), [test $have_$1 = yes])
71])
9dc801d2 72
fd67be31 73UTIL_CHECK_LIB(uuid, uuid_is_null)
9dc801d2
KZ
74if test $have_uuid = no; then
75 AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
76fi
77
fd67be31
SK
78UTIL_CHECK_LIB(util, openpty)
79UTIL_CHECK_LIB(termcap, tgetnum)
48d7b13a 80
40f07ff7 81AC_ARG_WITH([fsprobe],
baae33d0
KZ
82 [AS_HELP_STRING([--with-fsprobe], [library to guess filesystems (blkid|volume_id), default is blkid])],
83 [], [with_fsprobe=blkid]
40f07ff7
KZ
84)
85
86AM_CONDITIONAL(HAVE_BLKID, false)
87AM_CONDITIONAL(HAVE_VOLUME_ID, false)
88
89have_blkid=no
90have_volume_id=no
91if test x$with_fsprobe = xblkid; then
92 UTIL_CHECK_LIB(blkid, blkid_known_fstype)
93elif test x$with_fsprobe = xvolume_id; then
9f70f8b1 94 UTIL_CHECK_LIB(volume_id, volume_id_encode_string)
40f07ff7
KZ
95fi
96
97if test $have_blkid = no && test $have_volume_id = no; then
baae33d0 98 AC_MSG_ERROR([blkid or volume_id is needed to build util-linux-ng.])
40f07ff7 99fi
48d7b13a 100
8eeb575c 101AM_GNU_GETTEXT_VERSION([0.14.1])
48d7b13a 102AM_GNU_GETTEXT([external])
1b4a3d89 103if test -d $srcdir/po
8eeb575c 104then
1b4a3d89 105 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
8eeb575c
KZ
106else
107 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"
108fi
48d7b13a 109
fd67be31
SK
110have_ncurses=no
111AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [have_ncurses=yes])
112case $have_ncurses in
4445728f
KZ
113yes)
114 AC_MSG_NOTICE([you have ncurses])
115 AC_DEFINE(HAVE_NCURSES, 1, [Do we have -lncurses?])
116 ;;
117no)
118 AC_MSG_NOTICE([you do not have ncurses])
119 ;;
fd67be31 120esac
48d7b13a
KZ
121AM_CONDITIONAL(HAVE_NCURSES, test x$have_ncurses = xyes)
122
48d7b13a 123AC_ARG_WITH([slang],
7fa4f112 124 AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
271d98e0 125 [], with_slang=no
48d7b13a
KZ
126)
127
46e71118
AM
128have_tinfo=no
129AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes])
130AM_CONDITIONAL(HAVE_TINFO, test x$have_tinfo = xyes)
131
fd67be31 132use_slang=no
48d7b13a 133if test x$with_slang = xyes; then
fd67be31
SK
134 AC_CHECK_HEADERS([slcurses.h slang/slcurses.h], [use_slang=yes])
135 if test $use_slang = no; then
48d7b13a
KZ
136 AC_MSG_ERROR([slang selected but slcurses.h not found])
137 fi
138fi
fd67be31 139AM_CONDITIONAL(USE_SLANG, test $use_slang = yes)
48d7b13a
KZ
140
141
cf002530 142AC_LINK_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
143#define _XOPEN_SOURCE
144#include <unistd.h>
cf002530 145]], [[
48d7b13a 146char *c = crypt("abc","pw");
cf002530 147]])],[],[
48d7b13a 148 LIBS="$LIBS -lcrypt"
cf002530 149 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
150 #define _XOPEN_SOURCE
151 #include <unistd.h>
cf002530 152 ]], [[
48d7b13a 153 char *c = crypt("abc","pw");
cf002530 154 ]])],[
48d7b13a
KZ
155 AC_DEFINE(NEED_LIBCRYPT, 1, [Do we need -lcrypt?])
156 need_libcrypt=yes
157 ],[
158 AC_MSG_ERROR([crypt() is not available])
159 ])
48d7b13a
KZ
160])
161
162AM_CONDITIONAL(NEED_LIBCRYPT, test x$need_libcrypt = xyes)
163
cf002530 164AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a 165#include <stdio.h>
cf002530 166]], [[
48d7b13a 167printf(__progname);
cf002530
SK
168]])],
169[AC_DEFINE(HAVE___PROGNAME, 1, Do we have __progname?)
170])
48d7b13a
KZ
171
172
cf002530 173AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
174#include <wchar.h>
175#include <wctype.h>
176#include <stdio.h>
cf002530 177]], [[
48d7b13a
KZ
178 wchar_t wc;
179 wint_t w;
180 w = fgetwc(stdin);
181 if (w == WEOF) exit(1);
182 wc = w;
183 fputwc(wc,stdout);
cf002530
SK
184]])],
185[AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?)
186])
48d7b13a
KZ
187
188
cf002530 189AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
190#include <sys/syscall.h>
191#include <unistd.h>
cf002530 192]], [[
48d7b13a 193int test = SYS_pivot_root;
cf002530
SK
194]])],
195[AM_CONDITIONAL(HAVE_PIVOT_ROOT, true)],
196[AM_CONDITIONAL(HAVE_PIVOT_ROOT, false)])
48d7b13a
KZ
197
198
cf002530 199AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48d7b13a
KZ
200#include <time.h>
201#include <unistd.h>
cf002530 202]], [[
48d7b13a
KZ
203 int a = 0;
204 struct tm *tm = localtime(0);
205 if (a == -1) /* false */
206 sleep(tm->tm_gmtoff);
cf002530
SK
207]])],
208[AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?])
209])
48d7b13a
KZ
210
211
22d36665 212AC_CHECK_HEADERS([sys/swap.h])
b3425806
SK
213
214AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
215[[
b3425806
SK
216#ifdef HAVE_SYS_SWAP_H
217# include <sys/swap.h>
218#endif
219#include <unistd.h>
220]],
221[[swapon("/dev/null", 0);]])],
222[AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
223],
224[AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
225])
226
227
e782f1d4
KZ
228dnl UTIL_SET_ARCH(ARCHNAME, PATTERN)
229dnl ---------------------------------
230AC_DEFUN([UTIL_SET_ARCH], [
231 cpu_$1=false
232 case "$host" in
233 $2) cpu_$1=true ;;
234 esac
235 AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test x$cpu_$1 = xtrue])
236])
48d7b13a 237
e782f1d4
KZ
238UTIL_SET_ARCH(I86, i?86-*)
239UTIL_SET_ARCH(86_64, x86_64*)
240UTIL_SET_ARCH(IA64, ia64*)
241UTIL_SET_ARCH(S390, s390*)
242UTIL_SET_ARCH(SPARC, sparc*)
243UTIL_SET_ARCH(PPC, ppc*|powerpc*)
244UTIL_SET_ARCH(M68K, m68*)
245UTIL_SET_ARCH(MIPS, mips*)
48d7b13a 246
6a97809b
KZ
247AC_ARG_ENABLE([arch],
248 AS_HELP_STRING([--enable-arch], [do build arch]),
249 [], enable_arch=no
250)
251AM_CONDITIONAL(BUILD_ARCH, test x$enable_arch = xyes)
48d7b13a
KZ
252
253AC_ARG_ENABLE([agetty],
7fa4f112 254 AS_HELP_STRING([--disable-agetty], [do not build agetty]),
271d98e0 255 [], enable_agetty=yes
48d7b13a 256)
baf39af1 257AM_CONDITIONAL(BUILD_AGETTY, test x$enable_agetty = xyes)
48d7b13a 258
9cb68977 259AC_ARG_ENABLE([cramfs],
7fa4f112 260 AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
271d98e0 261 [], enable_cramfs=check
9cb68977
KZ
262)
263
fd67be31
SK
264if test $enable_cramfs = no; then
265 build_cramfs=no
266else
267 build_cramfs=yes
268 dnl Trick: leave the third parameter empty to get the default action.
269 AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
270 case $enable_cramfs:$build_cramfs in
271 yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
272 esac
9cb68977 273fi
fd67be31 274AM_CONDITIONAL(BUILD_CRAMFS, test $build_cramfs = yes)
9cb68977
KZ
275
276
48d7b13a 277AC_ARG_ENABLE([elvtune],
7fa4f112 278 AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
271d98e0 279 [], enable_elvtune=no
48d7b13a 280)
baf39af1 281AM_CONDITIONAL(BUILD_ELVTUNE, test x$enable_elvtune = xyes)
48d7b13a
KZ
282
283
284AC_ARG_ENABLE([init],
7fa4f112 285 AS_HELP_STRING([--enable-init], [build simpleinit, shutdown, initctl]),
271d98e0 286 [], enable_init=no
48d7b13a 287)
baf39af1 288AM_CONDITIONAL(BUILD_INIT, test x$enable_init = xyes)
48d7b13a
KZ
289
290
291AC_ARG_ENABLE([kill],
7fa4f112 292 AS_HELP_STRING([--enable-kill], [build kill]),
271d98e0 293 [], enable_kill=no
48d7b13a 294)
baf39af1 295AM_CONDITIONAL(BUILD_KILL, test x$enable_kill = xyes)
48d7b13a
KZ
296
297
298AC_ARG_ENABLE([last],
7fa4f112 299 AS_HELP_STRING([--enable-last], [build last]),
271d98e0 300 [], enable_last=no
48d7b13a 301)
baf39af1 302AM_CONDITIONAL(BUILD_LAST, test x$enable_last = xyes)
48d7b13a
KZ
303
304
305AC_ARG_ENABLE([mesg],
7fa4f112 306 AS_HELP_STRING([--enable-mesg], [build mesg]),
271d98e0 307 [], enable_mesg=no
48d7b13a 308)
baf39af1 309AM_CONDITIONAL(BUILD_MESG, test x$enable_mesg = xyes)
48d7b13a
KZ
310
311
312AC_ARG_ENABLE([partx],
7fa4f112 313 AS_HELP_STRING([--enable-partx], [build addpart, delpart, partx]),
271d98e0 314 [], enable_partx=no
48d7b13a 315)
baf39af1 316AM_CONDITIONAL(BUILD_PARTX, test x$enable_partx = xyes)
48d7b13a
KZ
317
318
319AC_ARG_ENABLE([raw],
7fa4f112 320 AS_HELP_STRING([--enable-raw], [build raw]),
271d98e0 321 [], enable_raw=no
48d7b13a 322)
baf39af1 323AM_CONDITIONAL(BUILD_RAW, test x$enable_raw = xyes)
48d7b13a
KZ
324
325
326AC_ARG_ENABLE([rdev],
7fa4f112 327 AS_HELP_STRING([--enable-rdev], [build rdev on i386]),
271d98e0 328 [], enable_rdev=no
48d7b13a 329)
baf39af1 330AM_CONDITIONAL(BUILD_RDEV, test x$enable_rdev = xyes)
48d7b13a
KZ
331
332
333AC_ARG_ENABLE([rename],
7fa4f112 334 AS_HELP_STRING([--disable-rename], [do not build rename]),
271d98e0 335 [], enable_rename=yes
48d7b13a 336)
baf39af1 337AM_CONDITIONAL(BUILD_RENAME, test x$enable_rename = xyes)
48d7b13a
KZ
338
339
340AC_ARG_ENABLE([reset],
7fa4f112 341 AS_HELP_STRING([--enable-reset], [build reset]),
271d98e0 342 [], enable_reset=no
48d7b13a 343)
baf39af1 344AM_CONDITIONAL(BUILD_RESET, test x$enable_reset = xyes)
48d7b13a
KZ
345
346
347AC_ARG_ENABLE([login-utils],
7fa4f112 348 AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
271d98e0 349 [], enable_login_utils=no
48d7b13a 350)
baf39af1 351AM_CONDITIONAL(BUILD_LOGIN_UTILS, test x$enable_login_utils = xyes)
48d7b13a 352
9cb68977 353AC_ARG_WITH([pam],
7fa4f112 354 [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
9cb68977 355
fd67be31 356AM_CONDITIONAL(HAVE_PAM, false)
9cb68977 357if test x$enable_login_utils = xyes && test x$with_pam != xno; then
fd67be31
SK
358 AC_CHECK_HEADERS([security/pam_misc.h],
359 [AM_CONDITIONAL(HAVE_PAM, true)],
360 [if test x$with_pam = xyes; then
361 AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
362 fi
363 ])
9cb68977 364fi
9cb68977
KZ
365
366AC_ARG_WITH([selinux],
7fa4f112 367 AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
271d98e0 368 [], with_selinux=no
9cb68977
KZ
369)
370
fd67be31
SK
371if test x$with_selinux = xno; then
372 AM_CONDITIONAL(HAVE_SELINUX, false)
373else
374 UTIL_CHECK_LIB(selinux, getprevcon)
375 case $with_selinux:$have_selinux in
376 yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
377 esac
9cb68977 378fi
9cb68977
KZ
379
380
bbae9cb0 381AC_ARG_WITH([audit],
7fa4f112 382 AS_HELP_STRING([--with-audit], [compile with audit support]),
271d98e0 383 [], with_audit=no
bbae9cb0
KZ
384)
385
fd67be31
SK
386if test x$with_audit = xno; then
387 AM_CONDITIONAL(HAVE_AUDIT, false)
388else
389 UTIL_CHECK_LIB(audit, audit_log_user_message)
390 case $with_audit:$have_audit in
391 yes:no)
392 AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
393 ;;
394 esac
bbae9cb0 395fi
bbae9cb0 396
48d7b13a
KZ
397
398AC_ARG_ENABLE([schedutils],
7fa4f112 399 AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
271d98e0 400 [], enable_schedutils=yes
48d7b13a 401)
baf39af1 402AM_CONDITIONAL(BUILD_SCHEDUTILS, test x$enable_schedutils = xyes)
48d7b13a
KZ
403
404
405AC_ARG_ENABLE([wall],
7fa4f112 406 AS_HELP_STRING([--disable-wall], [do not build wall]),
271d98e0 407 [], enable_wall=yes
48d7b13a 408)
baf39af1 409AM_CONDITIONAL(BUILD_WALL, test x$enable_wall = xyes)
48d7b13a
KZ
410
411
412AC_ARG_ENABLE([write],
7fa4f112 413 AS_HELP_STRING([--enable-write], [build write]),
271d98e0 414 [], enable_write=no
48d7b13a 415)
baf39af1 416AM_CONDITIONAL(BUILD_WRITE, test x$enable_write = xyes)
48d7b13a
KZ
417
418
419AC_ARG_ENABLE([chsh-only-listed],
7fa4f112 420 AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
271d98e0 421 [], enable_chsh_only_listed=yes
48d7b13a
KZ
422)
423
baf39af1 424if test x$enable_chsh_only_listed = xyes; then
48d7b13a
KZ
425 AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
426fi
427
428
429AC_ARG_ENABLE([login-chown-vcs],
7fa4f112 430 AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
271d98e0 431 [], enable_login_chown_vcs=no
48d7b13a
KZ
432)
433
baf39af1 434if test x$enable_login_chown_vcs = xyes; then
48d7b13a
KZ
435 AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
436fi
437
438
439AC_ARG_ENABLE([login-stat-mail],
7fa4f112 440 AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
271d98e0 441 [], enable_login_stat_mail=no
48d7b13a
KZ
442)
443
baf39af1 444if test x$enable_login_stat_mail = xyes; then
48d7b13a
KZ
445 AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
446fi
447
448
449AC_ARG_ENABLE([pg-bell],
7fa4f112 450 AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
271d98e0 451 [], enable_pg_bell=yes
48d7b13a
KZ
452)
453
baf39af1 454if test x$enable_pg_bell = xyes; then
48d7b13a
KZ
455 AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
456fi
457
458
459AC_ARG_ENABLE([require-password],
7fa4f112 460 AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
271d98e0 461 [], enable_require_password=yes
48d7b13a
KZ
462)
463
baf39af1 464if test x$enable_require_password = xyes; then
48d7b13a
KZ
465 AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
466fi
467
468
469AC_ARG_ENABLE([use-tty-group],
7fa4f112 470 AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
271d98e0 471 [], enable_use_tty_group=yes
48d7b13a 472)
baf39af1 473AM_CONDITIONAL(USE_TTY_GROUP, test x$enable_use_tty_group = xyes)
48d7b13a 474
baf39af1 475if test x$enable_use_tty_group = xyes; then
48d7b13a
KZ
476 AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
477fi
478
06bcee19 479
1f10890f
SK
480AC_ARG_VAR([SUID_CFLAGS],
481 [CFLAGS used for binaries which are usually with the suid bit])
482AC_ARG_VAR([SUID_LDFLAGS],
483 [LDFLAGS used for binaries which are usually with the suid bit])
06bcee19 484
9cb68977 485LIBS=""
48d7b13a 486
48d7b13a
KZ
487
488AC_CONFIG_HEADERS(config.h)
489
8eeb575c
KZ
490AC_CONFIG_FILES([
491Makefile
492disk-utils/Makefile
562218e6 493fdisk/Makefile
8eeb575c
KZ
494getopt/Makefile
495hwclock/Makefile
562218e6 496include/Makefile
8eeb575c
KZ
497login-utils/Makefile
498misc-utils/Makefile
499mount/Makefile
500partx/Makefile
501po/Makefile.in
502schedutils/Makefile
503sys-utils/Makefile
504text-utils/Makefile
e83446da 505tests/Makefile
0f0584ad 506tests/helpers/Makefile
e83446da 507tests/commands.sh
cc462132
SK
508misc-utils/chkdupexe:misc-utils/chkdupexe.pl
509misc-utils/scriptreplay:misc-utils/scriptreplay.pl
8eeb575c 510])
48d7b13a
KZ
511
512AC_OUTPUT