summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: b9e5a90d02e0195bd81bc6658c9bfac16cd0e90e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
AC_INIT(util-linux-ng, 2.13devel, kzak@redhat.com)

AC_PREREQ(2.59)

AC_CONFIG_AUX_DIR(config)

AM_INIT_AUTOMAKE([check-news -Wall foreign 1.9])

AC_CONFIG_SRCDIR(mount/mount.c)

AC_PREFIX_DEFAULT([/usr])

# Check whether exec_prefix=/usr:
case $exec_prefix:$prefix in
NONE:NONE | NONE:/usr | /usr:*)
  AC_MSG_NOTICE([Default --exec-prefix detected.])
  case $bindir in
  '${exec_prefix}/bin') bindir=/bin
    AC_MSG_NOTICE([  --bindir defaults to /bin]) ;;
  esac
  case $sbindir in
  '${exec_prefix}/sbin') sbindir=/sbin
    AC_MSG_NOTICE([  --sbindir defaults to /sbin]) ;;
  esac ;;
esac

AC_PROG_CC_STDC
AC_PROG_LIBTOOL

AC_PATH_PROG(PERL, perl)

AC_SYS_LARGEFILE

AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h], [], [], [
#ifdef HAVE_LINUX_COMPILER_H
#include <linux/compiler.h>
#endif
])
AC_CHECK_HEADERS(
	[scsi/scsi.h \
	langinfo.h \
	sys/user.h \
	rpcsvc/nfs_prot.h \
	sys/io.h \
	pty.h])
AC_CHECK_HEADERS([linux/raw.h],
		 [AM_CONDITIONAL([HAVE_RAW], [true])],
		 [AM_CONDITIONAL([HAVE_RAW], [false])])

AC_CHECK_FUNCS(
	[inet_aton \
	fsync \
	getdomainname \
	nanosleep \
	personality \
	updwtmp \
	lchown \
	rpmatch])
AC_FUNC_FSEEKO

dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION)
dnl ---------------------------------
AC_DEFUN([UTIL_CHECK_LIB], [
  dnl The trick is to keep the third argument to AC_CHECK_LIB empty,
  dnl and thus keep the default action.
  have_$1=yes
  AC_CHECK_LIB([$1], [$2], [], [have_$1=no])
  AM_CONDITIONAL(AS_TR_CPP(HAVE_$1), [test $have_$1 = yes])
])
UTIL_CHECK_LIB(uuid, uuid_is_null)
UTIL_CHECK_LIB(util, openpty)
UTIL_CHECK_LIB(termcap, tgetnum)
UTIL_CHECK_LIB(blkid, blkid_known_fstype)


AM_GNU_GETTEXT_VERSION([0.14.1])
AM_GNU_GETTEXT([external])
if test -d po
then
    ALL_LINGUAS=`(cd po > /dev/null && ls *.po) | sed 's+\.po$++'`
else
    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"
fi

have_ncurses=no
AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [have_ncurses=yes])
case $have_ncurses in
yes) AC_MSG_NOTICE([you have ncurses]);;
no)  AC_MSG_NOTICE([you do not have ncurses]);;
esac
AM_CONDITIONAL(HAVE_NCURSES, test x$have_ncurses = xyes)


AC_ARG_WITH([slang],
  AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
  [], with_slang=no
)

use_slang=no
if test x$with_slang = xyes; then
  AC_CHECK_HEADERS([slcurses.h slang/slcurses.h], [use_slang=yes])
  if test $use_slang = no; then
    AC_MSG_ERROR([slang selected but slcurses.h not found])
  fi
fi
AM_CONDITIONAL(USE_SLANG, test $use_slang = yes)


AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#define _XOPEN_SOURCE
#include <unistd.h>
]], [[
char *c = crypt("abc","pw");
]])],[],[
  LIBS="$LIBS -lcrypt"
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  #define _XOPEN_SOURCE
  #include <unistd.h>
  ]], [[
  char *c = crypt("abc","pw");
  ]])],[
  AC_DEFINE(NEED_LIBCRYPT, 1, [Do we need -lcrypt?])
  need_libcrypt=yes
  ],[
  AC_MSG_ERROR([crypt() is not available])
  ])
])

AM_CONDITIONAL(NEED_LIBCRYPT, test x$need_libcrypt = xyes)

AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
]], [[
printf(__progname);
]])],
[AC_DEFINE(HAVE___PROGNAME, 1, Do we have __progname?)
])


AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <wchar.h>
#include <wctype.h>
#include <stdio.h>
]], [[
  wchar_t wc;
  wint_t w;
  w = fgetwc(stdin);
  if (w == WEOF) exit(1);
  wc = w;
  fputwc(wc,stdout);
]])],
[AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?)
])


AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/syscall.h>
#include <unistd.h>
]], [[
int test = SYS_pivot_root;
]])],
[AM_CONDITIONAL(HAVE_PIVOT_ROOT, true)],
[AM_CONDITIONAL(HAVE_PIVOT_ROOT, false)])


AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <time.h>
#include <unistd.h>
]], [[
    int a = 0;
    struct tm *tm = localtime(0);
    if (a == -1)  /* false */
        sleep(tm->tm_gmtoff);
]])],
[AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?])
])


AC_CHECK_HEADERS([asm/page.h sys/swap.h], [], [], [
#ifdef HAVE_ASM_PAGE_H
# include <asm/page.h>
#endif
])

AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#ifdef HAVE_ASM_PAGE_H
# include <asm/page.h>
#endif
#ifdef HAVE_SYS_SWAP_H
# include <sys/swap.h>
#endif
#include <unistd.h>
]],
[[swapon("/dev/null", 0);]])],
[AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
],
[AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
])


case "$host" in
  i?86-*)  intel=true ;;
  m68*)    m68k=true ;;
  sparc*)  sparc=true ;;
esac

AM_CONDITIONAL(INTEL, test x$intel = xtrue)
AM_CONDITIONAL(M68K,  test x$m68k  = xtrue)
AM_CONDITIONAL(SPARC, test x$sparc = xtrue)


AC_ARG_ENABLE([agetty],
  AS_HELP_STRING([--disable-agetty], [do not build agetty]),
  [], enable_agetty=yes
)
AM_CONDITIONAL(BUILD_AGETTY, test x$enable_agetty = xyes)


AC_ARG_ENABLE([cramfs],
  AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]),
  [], enable_cramfs=check
)

if test $enable_cramfs = no; then
  build_cramfs=no
else
  build_cramfs=yes
  dnl Trick: leave the third parameter empty to get the default action.
  AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
  case $enable_cramfs:$build_cramfs in
  yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
  esac
fi
AM_CONDITIONAL(BUILD_CRAMFS, test $build_cramfs = yes)


AC_ARG_ENABLE([elvtune],
  AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
  [], enable_elvtune=no
)
AM_CONDITIONAL(BUILD_ELVTUNE, test x$enable_elvtune = xyes)


AC_ARG_ENABLE([init],
  AS_HELP_STRING([--enable-init], [build simpleinit, shutdown, initctl]),
  [], enable_init=no
)
AM_CONDITIONAL(BUILD_INIT, test x$enable_init = xyes)


AC_ARG_ENABLE([kill],
  AS_HELP_STRING([--enable-kill], [build kill]),
  [], enable_kill=no
)
AM_CONDITIONAL(BUILD_KILL, test x$enable_kill = xyes)


AC_ARG_ENABLE([last],
  AS_HELP_STRING([--enable-last], [build last]),
  [], enable_last=no
)
AM_CONDITIONAL(BUILD_LAST, test x$enable_last = xyes)


AC_ARG_ENABLE([mesg],
  AS_HELP_STRING([--enable-mesg], [build mesg]),
  [], enable_mesg=no
)
AM_CONDITIONAL(BUILD_MESG, test x$enable_mesg = xyes)


AC_ARG_ENABLE([partx],
  AS_HELP_STRING([--enable-partx], [build addpart, delpart, partx]),
  [], enable_partx=no
)
AM_CONDITIONAL(BUILD_PARTX, test x$enable_partx = xyes)


AC_ARG_ENABLE([raw],
  AS_HELP_STRING([--enable-raw], [build raw]),
  [], enable_raw=no
)
AM_CONDITIONAL(BUILD_RAW, test x$enable_raw = xyes)


AC_ARG_ENABLE([rdev],
  AS_HELP_STRING([--enable-rdev], [build rdev on i386]),
  [], enable_rdev=no
)
AM_CONDITIONAL(BUILD_RDEV, test x$enable_rdev = xyes)


AC_ARG_ENABLE([rename],
  AS_HELP_STRING([--disable-rename], [do not build rename]),
  [], enable_rename=yes
)
AM_CONDITIONAL(BUILD_RENAME, test x$enable_rename = xyes)


AC_ARG_ENABLE([reset],
  AS_HELP_STRING([--enable-reset], [build reset]),
  [], enable_reset=no
)
AM_CONDITIONAL(BUILD_RESET, test x$enable_reset = xyes)


AC_ARG_ENABLE([login-utils],
  AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
  [], enable_login_utils=no
)
AM_CONDITIONAL(BUILD_LOGIN_UTILS, test x$enable_login_utils = xyes)

AC_ARG_WITH([pam],
  [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])

AM_CONDITIONAL(HAVE_PAM, false)
if test x$enable_login_utils = xyes && test x$with_pam != xno; then
  AC_CHECK_HEADERS([security/pam_misc.h],
    [AM_CONDITIONAL(HAVE_PAM, true)],
    [if test x$with_pam = xyes; then
	AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
     fi
    ])
fi

AC_ARG_WITH([selinux],
  AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
  [], with_selinux=no
)

if test x$with_selinux = xno; then
  AM_CONDITIONAL(HAVE_SELINUX, false)
else
  UTIL_CHECK_LIB(selinux, getprevcon)
  case $with_selinux:$have_selinux in
  yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
  esac
fi


AC_ARG_WITH([audit],
  AS_HELP_STRING([--with-audit], [compile with audit support]),
  [], with_audit=no
)

if test x$with_audit = xno; then
  AM_CONDITIONAL(HAVE_AUDIT, false)
else
  UTIL_CHECK_LIB(audit, audit_log_user_message)
  case $with_audit:$have_audit in
  yes:no)
   AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
   ;;
  esac
fi


AC_ARG_ENABLE([schedutils],
  AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
  [], enable_schedutils=yes
)
AM_CONDITIONAL(BUILD_SCHEDUTILS, test x$enable_schedutils = xyes)


AC_ARG_ENABLE([wall],
  AS_HELP_STRING([--disable-wall], [do not build wall]),
  [], enable_wall=yes
)
AM_CONDITIONAL(BUILD_WALL, test x$enable_wall = xyes)


AC_ARG_ENABLE([write],
  AS_HELP_STRING([--enable-write], [build write]),
  [], enable_write=no
)
AM_CONDITIONAL(BUILD_WRITE, test x$enable_write = xyes)


AC_ARG_ENABLE([chsh-only-listed],
  AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
  [], enable_chsh_only_listed=yes
)

if test x$enable_chsh_only_listed = xyes; then
  AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
fi


AC_ARG_ENABLE([login-chown-vcs],
  AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
  [], enable_login_chown_vcs=no
)

if test x$enable_login_chown_vcs = xyes; then
  AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
fi


AC_ARG_ENABLE([login-stat-mail],
  AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
  [], enable_login_stat_mail=no
)

if test x$enable_login_stat_mail = xyes; then
  AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
fi


AC_ARG_ENABLE([pg-bell],
  AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
  [], enable_pg_bell=yes
)

if test x$enable_pg_bell = xyes; then
  AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
fi


AC_ARG_ENABLE([require-password],
  AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
  [], enable_require_password=yes
)

if test x$enable_require_password = xyes; then
  AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
fi


AC_ARG_ENABLE([use-tty-group],
  AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]),
  [], enable_use_tty_group=yes
)
AM_CONDITIONAL(USE_TTY_GROUP, test x$enable_use_tty_group = xyes)

if test x$enable_use_tty_group = xyes; then
  AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?])
fi


AC_ARG_VAR([SUID_CFLAGS],
	   [CFLAGS used for binaries which are usually with the suid bit])
AC_ARG_VAR([SUID_LDFLAGS],
	   [LDFLAGS used for binaries which are usually with the suid bit])

LIBS=""


AC_CONFIG_HEADERS(config.h)

AC_CONFIG_FILES([
Makefile
disk-utils/Makefile
fdisk/Makefile
getopt/Makefile
hwclock/Makefile
include/Makefile
login-utils/Makefile
misc-utils/Makefile
mount/Makefile
partx/Makefile
po/Makefile.in
schedutils/Makefile
sys-utils/Makefile
text-utils/Makefile
tests/Makefile
tests/helpers/Makefile
tests/commands.sh
])

AC_OUTPUT