]>
Commit | Line | Data |
---|---|---|
fba4e21f | 1 | AC_INIT(util-linux-ng, 2.14, kzak@redhat.com) |
baf39af1 | 2 | |
7fc9786b | 3 | AC_PREREQ(2.60) |
48d7b13a KZ |
4 | |
5 | AC_CONFIG_AUX_DIR(config) | |
b12991dd | 6 | AC_CONFIG_MACRO_DIR([m4]) |
48d7b13a | 7 | |
42d2a7ba | 8 | AM_INIT_AUTOMAKE([check-news -Wall foreign 1.9 dist-bzip2]) |
48d7b13a KZ |
9 | |
10 | AC_CONFIG_SRCDIR(mount/mount.c) | |
11 | ||
15a9b48c SK |
12 | AC_PREFIX_DEFAULT([/usr]) |
13 | ||
a0487b1c KZ |
14 | dnl blkid version definition (the library SONAME is |
15 | dnl "libblkid.so.$BLKID_VERSION_MAJOR", see blkid/Makefile.am) | |
16 | dnl ---------------------------------------------------------- | |
a0948ffe | 17 | BLKID_VERSION_MAJOR=1 |
a0487b1c | 18 | BLKID_VERSION_MINOR=42 |
a0948ffe | 19 | BLKID_VERSION_RELEASE=0 |
a0487b1c | 20 | BLKID_DATE="10-Feb-2009" |
a0948ffe KZ |
21 | |
22 | BLKID_VERSION=$BLKID_VERSION_MAJOR.$BLKID_VERSION_MINOR.$BLKID_VERSION_RELEASE | |
b12991dd | 23 | BLKID_VERSION_INFO=`expr $BLKID_VERSION_MAJOR + $BLKID_VERSION_MINOR`:$BLKID_VERSION_RELEASE:$BLKID_VERSION_MINOR |
a0948ffe | 24 | |
a0948ffe | 25 | |
15a9b48c SK |
26 | # Check whether exec_prefix=/usr: |
27 | case $exec_prefix:$prefix in | |
28 | NONE:NONE | NONE:/usr | /usr:*) | |
29 | AC_MSG_NOTICE([Default --exec-prefix detected.]) | |
30 | case $bindir in | |
31 | '${exec_prefix}/bin') bindir=/bin | |
32 | AC_MSG_NOTICE([ --bindir defaults to /bin]) ;; | |
33 | esac | |
34 | case $sbindir in | |
35 | '${exec_prefix}/sbin') sbindir=/sbin | |
36 | AC_MSG_NOTICE([ --sbindir defaults to /sbin]) ;; | |
971f57f6 KZ |
37 | esac |
38 | case $libdir in | |
39 | '${exec_prefix}/lib') libdir=/lib | |
40 | AC_MSG_NOTICE([ --libdir defaults to /lib]) ;; | |
15a9b48c SK |
41 | esac ;; |
42 | esac | |
48d7b13a KZ |
43 | |
44 | AC_PROG_CC_STDC | |
240f7101 | 45 | AC_GNU_SOURCE |
a6996860 | 46 | AC_CANONICAL_HOST |
fbaec83b | 47 | AC_C_BIGENDIAN |
b12991dd KZ |
48 | |
49 | dnl libtool-2 | |
50 | LT_INIT | |
48d7b13a | 51 | |
d06d028a KZ |
52 | PKG_PROG_PKG_CONFIG |
53 | ||
8c182554 KZ |
54 | linux_os=no |
55 | case ${host_os} in | |
56 | *linux*) | |
57 | linux_os=yes | |
58 | ;; | |
59 | esac | |
49ccbae6 | 60 | AM_CONDITIONAL([LINUX], test "x$linux_os" = xyes) |
8c182554 | 61 | |
48d7b13a | 62 | AC_PATH_PROG(PERL, perl) |
3f5bda01 KZ |
63 | AC_PATH_PROG(BLKID, blkid, [], [$PATH:/sbin]) |
64 | AC_PATH_PROG(VOLID, vol_id, [], [$PATH:/lib/udev]) | |
48d7b13a KZ |
65 | |
66 | AC_SYS_LARGEFILE | |
67 | ||
e460a5bf | 68 | AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [ |
48d7b13a KZ |
69 | #ifdef HAVE_LINUX_COMPILER_H |
70 | #include <linux/compiler.h> | |
71 | #endif | |
72 | ]) | |
bf962c0a | 73 | AC_CHECK_HEADERS( |
a0948ffe KZ |
74 | [err.h \ |
75 | errno.h \ | |
76 | getopt.h \ | |
bf962c0a | 77 | langinfo.h \ |
a0948ffe KZ |
78 | linux/fd.h \ |
79 | linux/tiocl.h \ | |
80 | linux/version.h \ | |
8b7f16fc | 81 | locale.h \ |
607c2a72 | 82 | stdlib.h \ |
a0948ffe | 83 | pty.h \ |
607c2a72 | 84 | mntent.h \ |
bf962c0a | 85 | rpcsvc/nfs_prot.h \ |
a0948ffe KZ |
86 | scsi/scsi.h \ |
87 | stdlib.h \ | |
88 | sys/disk.h \ | |
89 | sys/disklabel.h \ | |
90 | sys/ioctl.h \ | |
bf962c0a | 91 | sys/io.h \ |
a0948ffe KZ |
92 | sys/mkdev.h \ |
93 | sys/prctl.h \ | |
94 | sys/queue.h \ | |
95 | sys/stat.h \ | |
96 | sys/types.h \ | |
97 | sys/user.h \ | |
98 | unistd.h ]) | |
fd67be31 SK |
99 | AC_CHECK_HEADERS([linux/raw.h], |
100 | [AM_CONDITIONAL([HAVE_RAW], [true])], | |
101 | [AM_CONDITIONAL([HAVE_RAW], [false])]) | |
48d7b13a | 102 | |
bf962c0a SK |
103 | AC_CHECK_FUNCS( |
104 | [inet_aton \ | |
105 | fsync \ | |
106 | getdomainname \ | |
e27a08ab | 107 | get_current_dir_name \ |
bf962c0a SK |
108 | nanosleep \ |
109 | personality \ | |
110 | updwtmp \ | |
111 | lchown \ | |
a0948ffe KZ |
112 | llseek \ |
113 | lseek64 \ | |
114 | strtoull \ | |
fc7aeb09 | 115 | inotify_init \ |
a0948ffe KZ |
116 | prctl \ |
117 | __secure_getenv \ | |
bf962c0a | 118 | rpmatch]) |
48d7b13a | 119 | AC_FUNC_FSEEKO |
48d7b13a | 120 | |
8569410c SK |
121 | dnl Static compilation |
122 | m4_define([UTIL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk]) | |
123 | ||
124 | AC_ARG_ENABLE([static-programs], | |
125 | [AS_HELP_STRING([--enable-static-programs=LIST], | |
126 | [link static the programs in LIST (comma-separated, | |
127 | supported for ]m4_defn([UTIL_STATIC_PROGRAMS])[)])]) | |
128 | ||
129 | case $enable_static_programs in | |
130 | yes) enable_static_programs=m4_quote(UTIL_STATIC_PROGRAMS) ;; | |
131 | no) enable_static_programs= ;; | |
132 | esac | |
133 | ||
8569410c SK |
134 | dnl Set all the individual AM_CONDITIONALs |
135 | m4_foreach([UTIL_PRG], m4_defn([UTIL_STATIC_PROGRAMS]), [ | |
136 | case ,$enable_static_programs, in | |
137 | *,UTIL_PRG,*) static_[]UTIL_PRG=yes ;; | |
138 | esac | |
139 | AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UTIL_PRG), | |
49ccbae6 | 140 | [test "x$static_[]UTIL_PRG" = xyes]) |
8569410c SK |
141 | ]) |
142 | ||
40cc242e KZ |
143 | dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1])) |
144 | dnl The VARSUFFIX is optional and overrides the default behaviour. For example: | |
145 | dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX | |
146 | dnl UTIL_CHECK_LIB(yyy, func) generates have_yyy and HAVE_LIBYYY | |
fd67be31 SK |
147 | dnl --------------------------------- |
148 | AC_DEFUN([UTIL_CHECK_LIB], [ | |
40cc242e KZ |
149 | m4_define([suffix], m4_default([$3],$1)) |
150 | [have_]suffix=yes | |
151 | m4_ifdef([$3], | |
152 | [AC_CHECK_LIB([$1], [$2], [AC_DEFINE(AS_TR_CPP([HAVE_LIB]suffix), 1)], [[have_]suffix=no])], | |
153 | [AC_CHECK_LIB([$1], [$2], [], [[have_]suffix=no])]) | |
154 | AM_CONDITIONAL(AS_TR_CPP([HAVE_]suffix), [test [$have_]suffix = yes]) | |
fd67be31 | 155 | ]) |
9dc801d2 | 156 | |
fd67be31 | 157 | UTIL_CHECK_LIB(uuid, uuid_is_null) |
49ccbae6 | 158 | if test "x$have_uuid" = xno; then |
9dc801d2 KZ |
159 | AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs]) |
160 | fi | |
161 | ||
fd67be31 SK |
162 | UTIL_CHECK_LIB(util, openpty) |
163 | UTIL_CHECK_LIB(termcap, tgetnum) | |
48d7b13a | 164 | |
d06d028a | 165 | |
40f07ff7 | 166 | AC_ARG_WITH([fsprobe], |
d06d028a | 167 | [AS_HELP_STRING([--with-fsprobe], [library to guess filesystems (builtin|blkid|volume_id), default is blkid])], |
baae33d0 | 168 | [], [with_fsprobe=blkid] |
40f07ff7 KZ |
169 | ) |
170 | ||
d06d028a KZ |
171 | build_libblkid=no |
172 | have_blkid_evaluate=no | |
b446754d KZ |
173 | have_blkid=no |
174 | have_volume_id=no | |
d06d028a | 175 | |
b446754d | 176 | if test "x$with_fsprobe" = xblkid; then |
d06d028a KZ |
177 | PKG_CHECK_MODULES(BLKID, blkid, [have_blkid=yes], []) |
178 | AC_CHECK_LIB(blkid, blkid_evaluate_spec, [have_blkid_evaluate=yes], []) | |
b446754d | 179 | elif test "x$with_fsprobe" = xvolume_id; then |
d06d028a | 180 | PKG_CHECK_MODULES(VOLUME_ID, volume_id, [have_volume_id=yes], []) |
b446754d KZ |
181 | elif test "x$with_fsprobe" = xbuiltin; then |
182 | have_blkid=yes | |
d06d028a KZ |
183 | build_libblkid=yes |
184 | have_blkid_evaluate=yes | |
185 | AC_SUBST(BLKID_VERSION_MAJOR) | |
186 | AC_SUBST(BLKID_VERSION_MINOR) | |
187 | AC_SUBST(BLKID_VERSION_RELEASE) | |
188 | AC_SUBST(BLKID_VERSION) | |
189 | AC_SUBST(BLKID_VERSION_INFO) | |
190 | AC_DEFINE_UNQUOTED(BLKID_VERSION, "$BLKID_VERSION", [libblkid version string]) | |
191 | AC_DEFINE_UNQUOTED(BLKID_DATE, "$BLKID_DATE", [libblkid date string]) | |
b446754d KZ |
192 | fi |
193 | ||
d06d028a KZ |
194 | if test "x$have_blkid" = xyes; then |
195 | AC_DEFINE(HAVE_LIBBLKID, 1, [Define to 1 if you have the -lblkid.]) | |
196 | if test "x$have_blkid_evaluate" = xyes; then | |
197 | AC_DEFINE(HAVE_BLKID_EVALUATE_SPEC, 1, [Define to 1 if you have the blkid_evaluate_spec().]) | |
198 | fi | |
199 | fi | |
200 | ||
201 | AM_CONDITIONAL(HAVE_BLKID, test "x$have_blkid" = xyes) | |
202 | AM_CONDITIONAL(HAVE_VOLUME_ID, test "x$have_volume_id" = xyes) | |
203 | AM_CONDITIONAL(BUILD_LIBBLKID, test "x$build_libblkid" = xyes) | |
204 | ||
205 | ||
206 | AC_ARG_ENABLE([mount], | |
207 | AS_HELP_STRING([--disable-mount], [do not build mount utilities]), | |
208 | [], enable_mount=check | |
209 | ) | |
d06d028a | 210 | build_mount=yes |
7177d32e ABL |
211 | if test "${enable_mount}" = "no"; then |
212 | build_mount=no | |
213 | elif test "x$linux_os" = xyes; then | |
7177d32e ABL |
214 | if test "x$have_blkid" = xno && test "x$have_volume_id" = xno; then |
215 | AC_MSG_ERROR([blkid or volume_id is needed to build util-linux-ng mount utilities]) | |
216 | fi | |
217 | else | |
218 | AC_MSG_WARN([non-linux system; do not build mount utilities]) | |
219 | build_mount=no | |
40f07ff7 | 220 | fi |
7177d32e | 221 | AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes) |
48d7b13a | 222 | |
b446754d | 223 | |
607c2a72 KZ |
224 | AC_ARG_ENABLE([fsck], |
225 | AS_HELP_STRING([--enable-fsck], [do build fsck]), | |
226 | [], enable_fsck=no | |
227 | ) | |
228 | if test "x$enable_fsck" = xyes; then | |
229 | if test "x$have_blkid" = xno && test "x$have_volume_id" = xno; then | |
230 | AC_MSG_ERROR([libblkid or libvolume_id is needed to build util-linux-ng fsck]) | |
231 | fi | |
232 | fi | |
233 | AM_CONDITIONAL(BUILD_FSCK, test "x$enable_fsck" = xyes) | |
234 | ||
235 | ||
64754af9 SK |
236 | dnl UTIL_PKG_STATIC(VARIABLE, MODULES) |
237 | dnl ---------------------------------- | |
238 | AC_DEFUN([UTIL_PKG_STATIC], [ | |
239 | if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then | |
240 | $1=`pkg-config --libs --static "$2"` | |
241 | else | |
242 | AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available]) | |
243 | fi | |
244 | ]) | |
245 | ||
8569410c | 246 | # These default values should work in most cases: |
af53f0f1 | 247 | : ${BLKID_LIBS='-lblkid -luuid'} |
d06d028a | 248 | : ${VOLUME_ID_LIBS='-lvolume_id'} |
8569410c | 249 | |
64754af9 SK |
250 | # ... but for static build, we need to consult pkg-config: |
251 | if test -n "$enable_static_programs"; then | |
252 | case $with_fsprobe in | |
253 | blkid) UTIL_PKG_STATIC([BLKID_LIBS_STATIC], [blkid]) ;; | |
d06d028a | 254 | volume_id) UTIL_PKG_STATIC([VOLUME_ID_LIBS_STATIC], [libvolume_id]) ;; |
64754af9 SK |
255 | esac |
256 | fi | |
8569410c | 257 | |
8569410c | 258 | AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid]) |
d06d028a | 259 | AC_ARG_VAR([VOLUME_ID_LIBS_STATIC], [-l options for linking statically with volume_id]) |
8569410c SK |
260 | |
261 | ||
8eeb575c | 262 | AM_GNU_GETTEXT_VERSION([0.14.1]) |
48d7b13a | 263 | AM_GNU_GETTEXT([external]) |
49ccbae6 | 264 | if test -d "$srcdir/po" |
8eeb575c | 265 | then |
1b4a3d89 | 266 | ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'` |
8eeb575c KZ |
267 | else |
268 | 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" | |
269 | fi | |
48d7b13a | 270 | |
08d64aa2 KZ |
271 | AC_ARG_WITH([ncurses], |
272 | AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version | |
273 | (--without-ncurses disables all ncurses(w) support)]), | |
274 | [], with_ncurses=auto | |
275 | ) | |
276 | AM_CONDITIONAL(HAVE_NCURSES, false) | |
277 | ||
278 | if test "x$with_ncurses" != xno; then | |
279 | have_ncurses=no | |
280 | AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [ | |
281 | if test "x$with_ncurses" = xauto; then | |
9ea8ac37 | 282 | UTIL_CHECK_LIB(ncursesw, initscr, ncurses) |
08d64aa2 KZ |
283 | if test "x$have_ncurses" = xyes; then |
284 | NCURSES_LIBS="-lncursesw" | |
285 | fi | |
286 | fi | |
49ccbae6 | 287 | if test "x$have_ncurses" = xno; then |
9ea8ac37 | 288 | UTIL_CHECK_LIB(ncurses, initscr) |
49ccbae6 | 289 | if test "x$have_ncurses" = xyes; then |
08d64aa2 KZ |
290 | NCURSES_LIBS="-lncurses" |
291 | fi | |
292 | fi | |
293 | ]) | |
49ccbae6 | 294 | if test "x$have_ncurses" = xno; then |
08d64aa2 KZ |
295 | AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)]) |
296 | fi | |
297 | fi | |
298 | AC_SUBST([NCURSES_LIBS]) | |
299 | ||
48d7b13a | 300 | |
48d7b13a | 301 | AC_ARG_WITH([slang], |
7fa4f112 | 302 | AS_HELP_STRING([--with-slang], [compile cfdisk with slang]), |
271d98e0 | 303 | [], with_slang=no |
48d7b13a KZ |
304 | ) |
305 | ||
46e71118 AM |
306 | have_tinfo=no |
307 | AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes]) | |
49ccbae6 | 308 | AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes) |
46e71118 | 309 | |
fd67be31 | 310 | use_slang=no |
49ccbae6 | 311 | if test "x$with_slang" = xyes; then |
fd67be31 | 312 | AC_CHECK_HEADERS([slcurses.h slang/slcurses.h], [use_slang=yes]) |
49ccbae6 | 313 | if test "x$use_slang" = xno; then |
48d7b13a KZ |
314 | AC_MSG_ERROR([slang selected but slcurses.h not found]) |
315 | fi | |
316 | fi | |
49ccbae6 | 317 | AM_CONDITIONAL(USE_SLANG, test "x$use_slang" = xyes) |
48d7b13a KZ |
318 | |
319 | ||
cf002530 | 320 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
48d7b13a KZ |
321 | #define _XOPEN_SOURCE |
322 | #include <unistd.h> | |
cf002530 | 323 | ]], [[ |
48d7b13a | 324 | char *c = crypt("abc","pw"); |
cf002530 | 325 | ]])],[],[ |
48d7b13a | 326 | LIBS="$LIBS -lcrypt" |
cf002530 | 327 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
48d7b13a KZ |
328 | #define _XOPEN_SOURCE |
329 | #include <unistd.h> | |
cf002530 | 330 | ]], [[ |
48d7b13a | 331 | char *c = crypt("abc","pw"); |
cf002530 | 332 | ]])],[ |
48d7b13a KZ |
333 | AC_DEFINE(NEED_LIBCRYPT, 1, [Do we need -lcrypt?]) |
334 | need_libcrypt=yes | |
335 | ],[ | |
336 | AC_MSG_ERROR([crypt() is not available]) | |
337 | ]) | |
48d7b13a KZ |
338 | ]) |
339 | ||
49ccbae6 | 340 | AM_CONDITIONAL(NEED_LIBCRYPT, test "x$need_libcrypt" = xyes) |
48d7b13a | 341 | |
cf002530 | 342 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
48d7b13a | 343 | #include <stdio.h> |
cf002530 | 344 | ]], [[ |
48d7b13a | 345 | printf(__progname); |
cf002530 SK |
346 | ]])], |
347 | [AC_DEFINE(HAVE___PROGNAME, 1, Do we have __progname?) | |
348 | ]) | |
48d7b13a KZ |
349 | |
350 | ||
cf002530 | 351 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
48d7b13a KZ |
352 | #include <wchar.h> |
353 | #include <wctype.h> | |
354 | #include <stdio.h> | |
cf002530 | 355 | ]], [[ |
48d7b13a KZ |
356 | wchar_t wc; |
357 | wint_t w; | |
358 | w = fgetwc(stdin); | |
359 | if (w == WEOF) exit(1); | |
360 | wc = w; | |
361 | fputwc(wc,stdout); | |
cf002530 SK |
362 | ]])], |
363 | [AC_DEFINE(HAVE_WIDECHAR,1,Do we have wide character support?) | |
364 | ]) | |
48d7b13a KZ |
365 | |
366 | ||
72065909 MF |
367 | dnl UTIL_CHECK_SYSCALL(SYSCALL, FALLBACK, ...) |
368 | dnl Only specify FALLBACK if the SYSCALL | |
369 | dnl you're checking for is a "newish" one | |
370 | dnl ------------------------------------- | |
371 | AC_DEFUN([UTIL_CHECK_SYSCALL], [ | |
372 | dnl This macro uses host_cpu. | |
373 | AC_REQUIRE([AC_CANONICAL_HOST]) | |
374 | AC_CACHE_CHECK([for syscall $1], | |
375 | [util_cv_syscall_$1], | |
376 | [_UTIL_SYSCALL_CHECK_DECL([SYS_$1], | |
377 | [syscall=SYS_$1], | |
378 | [dnl Our libc failed use, so see if we can get the kernel | |
379 | dnl headers to play ball ... | |
380 | _UTIL_SYSCALL_CHECK_DECL([_NR_$1], | |
381 | [syscall=_NR_$1], | |
382 | [ | |
383 | syscall=no | |
49ccbae6 | 384 | if test "x$linux_os" = xyes; then |
8c182554 KZ |
385 | case $host_cpu in |
386 | _UTIL_CHECK_SYSCALL_FALLBACK(m4_shift($@)) | |
387 | esac | |
388 | fi | |
72065909 MF |
389 | ]) |
390 | ]) | |
391 | util_cv_syscall_$1=$syscall | |
392 | ]) | |
49ccbae6 | 393 | AM_CONDITIONAL([HAVE_]m4_toupper($1), [test "x$util_cv_syscall_$1" != xno]) |
72065909 MF |
394 | case $util_cv_syscall_$1 in #( |
395 | no) AC_MSG_WARN([Unable to detect syscall $1.]) ;; | |
396 | SYS_*) ;; | |
397 | *) AC_DEFINE_UNQUOTED([SYS_$1], [$util_cv_syscall_$1], | |
398 | [Fallback syscall number for $1]) ;; | |
399 | esac | |
400 | ]) | |
401 | ||
402 | dnl _UTIL_SYSCALL_CHECK_DECL(SYMBOL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) | |
403 | dnl Check if SYMBOL is declared, using the headers needed for syscall checks. | |
404 | dnl ------------------------------------- | |
405 | m4_define([_UTIL_SYSCALL_CHECK_DECL], | |
406 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
48d7b13a KZ |
407 | #include <sys/syscall.h> |
408 | #include <unistd.h> | |
72065909 MF |
409 | ]], [[int test = $1;]])], |
410 | [$2], [$3]) | |
411 | ]) | |
48d7b13a | 412 | |
72065909 MF |
413 | dnl _UTIL_CHECK_SYSCALL_FALLBACK(PATTERN, VALUE, ...) |
414 | dnl Helper macro to create the body for the above `case'. | |
415 | dnl ------------------------------------- | |
416 | m4_define([_UTIL_CHECK_SYSCALL_FALLBACK], | |
417 | [m4_ifval([$1], | |
418 | [#( | |
419 | $1) syscall="$2" ;;dnl | |
420 | _UTIL_CHECK_SYSCALL_FALLBACK(m4_shiftn(2, $@))])dnl | |
421 | ]) | |
48d7b13a | 422 | |
72065909 MF |
423 | |
424 | UTIL_CHECK_SYSCALL([pivot_root]) | |
425 | UTIL_CHECK_SYSCALL([sched_getaffinity]) | |
426 | UTIL_CHECK_SYSCALL([ioprio_set], | |
427 | [alpha], [442], | |
428 | [i*86], [289], | |
429 | [ia64*], [1274], | |
430 | [powerpc*], [273], | |
431 | [s390*], [282], | |
432 | [sparc*], [196], | |
447ae7b8 | 433 | [sh*], [288], |
72065909 MF |
434 | [x86_64*], [251]) |
435 | UTIL_CHECK_SYSCALL([ioprio_get], | |
436 | [alpha], [443], | |
437 | [i*86], [290], | |
438 | [ia64*], [1275], | |
439 | [powerpc*], [274], | |
440 | [s390*], [283], | |
441 | [sparc*], [218], | |
447ae7b8 | 442 | [sh*], [289], |
72065909 | 443 | [x86_64*], [252]) |
19a224ad MF |
444 | |
445 | ||
cf002530 | 446 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
48d7b13a KZ |
447 | #include <time.h> |
448 | #include <unistd.h> | |
cf002530 | 449 | ]], [[ |
48d7b13a KZ |
450 | int a = 0; |
451 | struct tm *tm = localtime(0); | |
452 | if (a == -1) /* false */ | |
453 | sleep(tm->tm_gmtoff); | |
cf002530 SK |
454 | ]])], |
455 | [AC_DEFINE(HAVE_TM_GMTOFF,1,[Does struct tm have a field tm_gmtoff?]) | |
456 | ]) | |
48d7b13a | 457 | |
30e8b186 KZ |
458 | AC_CHECK_MEMBERS([struct termios.c_line],,, |
459 | [[#include <termios.h>]]) | |
460 | ||
2d281745 KZ |
461 | AC_CHECK_DECLS([ |
462 | ADDR_NO_RANDOMIZE, | |
463 | FDPIC_FUNCPTRS, | |
464 | MMAP_PAGE_ZERO, | |
465 | ADDR_COMPAT_LAYOUT, | |
466 | READ_IMPLIES_EXEC, | |
467 | ADDR_LIMIT_32BIT, | |
468 | WHOLE_SECONDS, | |
469 | STICKY_TIMEOUTS, | |
470 | ADDR_LIMIT_3GB], [], [], [#include <linux/personality.h>]) | |
48d7b13a | 471 | |
22d36665 | 472 | AC_CHECK_HEADERS([sys/swap.h]) |
b3425806 SK |
473 | |
474 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | |
475 | [[ | |
b3425806 SK |
476 | #ifdef HAVE_SYS_SWAP_H |
477 | # include <sys/swap.h> | |
478 | #endif | |
479 | #include <unistd.h> | |
480 | ]], | |
481 | [[swapon("/dev/null", 0);]])], | |
482 | [AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?]) | |
483 | ], | |
484 | [AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.]) | |
485 | ]) | |
486 | ||
487 | ||
e782f1d4 KZ |
488 | dnl UTIL_SET_ARCH(ARCHNAME, PATTERN) |
489 | dnl --------------------------------- | |
490 | AC_DEFUN([UTIL_SET_ARCH], [ | |
491 | cpu_$1=false | |
492 | case "$host" in | |
493 | $2) cpu_$1=true ;; | |
494 | esac | |
49ccbae6 | 495 | AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test "x$cpu_$1" = xtrue]) |
e782f1d4 | 496 | ]) |
48d7b13a | 497 | |
e782f1d4 KZ |
498 | UTIL_SET_ARCH(I86, i?86-*) |
499 | UTIL_SET_ARCH(86_64, x86_64*) | |
500 | UTIL_SET_ARCH(IA64, ia64*) | |
501 | UTIL_SET_ARCH(S390, s390*) | |
502 | UTIL_SET_ARCH(SPARC, sparc*) | |
503 | UTIL_SET_ARCH(PPC, ppc*|powerpc*) | |
504 | UTIL_SET_ARCH(M68K, m68*) | |
505 | UTIL_SET_ARCH(MIPS, mips*) | |
eeadb4f4 | 506 | UTIL_SET_ARCH(HPPA, hppa*) |
48d7b13a | 507 | |
6a97809b KZ |
508 | AC_ARG_ENABLE([arch], |
509 | AS_HELP_STRING([--enable-arch], [do build arch]), | |
510 | [], enable_arch=no | |
511 | ) | |
49ccbae6 | 512 | AM_CONDITIONAL(BUILD_ARCH, test "x$enable_arch" = xyes) |
48d7b13a KZ |
513 | |
514 | AC_ARG_ENABLE([agetty], | |
7fa4f112 | 515 | AS_HELP_STRING([--disable-agetty], [do not build agetty]), |
271d98e0 | 516 | [], enable_agetty=yes |
48d7b13a | 517 | ) |
49ccbae6 | 518 | AM_CONDITIONAL(BUILD_AGETTY, test "x$enable_agetty" = xyes) |
48d7b13a | 519 | |
9cb68977 | 520 | AC_ARG_ENABLE([cramfs], |
7fa4f112 | 521 | AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]), |
271d98e0 | 522 | [], enable_cramfs=check |
9cb68977 KZ |
523 | ) |
524 | ||
49ccbae6 | 525 | if test "x$enable_cramfs" = xno; then |
fd67be31 SK |
526 | build_cramfs=no |
527 | else | |
528 | build_cramfs=yes | |
529 | dnl Trick: leave the third parameter empty to get the default action. | |
530 | AC_CHECK_LIB(z, crc32, [], build_cramfs=no) | |
531 | case $enable_cramfs:$build_cramfs in | |
532 | yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);; | |
533 | esac | |
9cb68977 | 534 | fi |
49ccbae6 | 535 | AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes) |
9cb68977 KZ |
536 | |
537 | ||
48d7b13a | 538 | AC_ARG_ENABLE([elvtune], |
7fa4f112 | 539 | AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]), |
271d98e0 | 540 | [], enable_elvtune=no |
48d7b13a | 541 | ) |
49ccbae6 | 542 | AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes) |
48d7b13a KZ |
543 | |
544 | ||
545 | AC_ARG_ENABLE([init], | |
7fa4f112 | 546 | AS_HELP_STRING([--enable-init], [build simpleinit, shutdown, initctl]), |
271d98e0 | 547 | [], enable_init=no |
48d7b13a | 548 | ) |
49ccbae6 | 549 | AM_CONDITIONAL(BUILD_INIT, test "x$enable_init" = xyes) |
48d7b13a KZ |
550 | |
551 | ||
552 | AC_ARG_ENABLE([kill], | |
7fa4f112 | 553 | AS_HELP_STRING([--enable-kill], [build kill]), |
271d98e0 | 554 | [], enable_kill=no |
48d7b13a | 555 | ) |
49ccbae6 | 556 | AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes) |
48d7b13a KZ |
557 | |
558 | ||
559 | AC_ARG_ENABLE([last], | |
7fa4f112 | 560 | AS_HELP_STRING([--enable-last], [build last]), |
271d98e0 | 561 | [], enable_last=no |
48d7b13a | 562 | ) |
49ccbae6 | 563 | AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes) |
48d7b13a KZ |
564 | |
565 | ||
566 | AC_ARG_ENABLE([mesg], | |
7fa4f112 | 567 | AS_HELP_STRING([--enable-mesg], [build mesg]), |
271d98e0 | 568 | [], enable_mesg=no |
48d7b13a | 569 | ) |
49ccbae6 | 570 | AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes) |
48d7b13a KZ |
571 | |
572 | ||
573 | AC_ARG_ENABLE([partx], | |
7fa4f112 | 574 | AS_HELP_STRING([--enable-partx], [build addpart, delpart, partx]), |
271d98e0 | 575 | [], enable_partx=no |
48d7b13a | 576 | ) |
49ccbae6 | 577 | AM_CONDITIONAL(BUILD_PARTX, test "x$enable_partx" = xyes) |
48d7b13a KZ |
578 | |
579 | ||
580 | AC_ARG_ENABLE([raw], | |
7fa4f112 | 581 | AS_HELP_STRING([--enable-raw], [build raw]), |
271d98e0 | 582 | [], enable_raw=no |
48d7b13a | 583 | ) |
49ccbae6 | 584 | AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes) |
48d7b13a KZ |
585 | |
586 | ||
587 | AC_ARG_ENABLE([rdev], | |
7fa4f112 | 588 | AS_HELP_STRING([--enable-rdev], [build rdev on i386]), |
271d98e0 | 589 | [], enable_rdev=no |
48d7b13a | 590 | ) |
49ccbae6 | 591 | AM_CONDITIONAL(BUILD_RDEV, test "x$enable_rdev" = xyes) |
48d7b13a KZ |
592 | |
593 | ||
594 | AC_ARG_ENABLE([rename], | |
7fa4f112 | 595 | AS_HELP_STRING([--disable-rename], [do not build rename]), |
271d98e0 | 596 | [], enable_rename=yes |
48d7b13a | 597 | ) |
49ccbae6 | 598 | AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes) |
48d7b13a KZ |
599 | |
600 | ||
601 | AC_ARG_ENABLE([reset], | |
7fa4f112 | 602 | AS_HELP_STRING([--enable-reset], [build reset]), |
271d98e0 | 603 | [], enable_reset=no |
48d7b13a | 604 | ) |
49ccbae6 | 605 | AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes) |
48d7b13a KZ |
606 | |
607 | ||
608 | AC_ARG_ENABLE([login-utils], | |
7fa4f112 | 609 | AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]), |
271d98e0 | 610 | [], enable_login_utils=no |
48d7b13a | 611 | ) |
49ccbae6 | 612 | AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes) |
48d7b13a | 613 | |
9cb68977 | 614 | AC_ARG_WITH([pam], |
7fa4f112 | 615 | [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])]) |
9cb68977 | 616 | |
fd67be31 | 617 | AM_CONDITIONAL(HAVE_PAM, false) |
49ccbae6 | 618 | if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then |
fd67be31 SK |
619 | AC_CHECK_HEADERS([security/pam_misc.h], |
620 | [AM_CONDITIONAL(HAVE_PAM, true)], | |
49ccbae6 | 621 | [if test "x$with_pam" = xyes; then |
fd67be31 SK |
622 | AC_MSG_ERROR([PAM selected but security/pam_misc.h not found]) |
623 | fi | |
624 | ]) | |
9cb68977 | 625 | fi |
9cb68977 KZ |
626 | |
627 | AC_ARG_WITH([selinux], | |
7fa4f112 | 628 | AS_HELP_STRING([--with-selinux], [compile with SELinux support]), |
271d98e0 | 629 | [], with_selinux=no |
9cb68977 KZ |
630 | ) |
631 | ||
49ccbae6 | 632 | if test "x$with_selinux" = xno; then |
fd67be31 SK |
633 | AM_CONDITIONAL(HAVE_SELINUX, false) |
634 | else | |
635 | UTIL_CHECK_LIB(selinux, getprevcon) | |
49ccbae6 | 636 | case "$with_selinux:$have_selinux" in |
fd67be31 SK |
637 | yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);; |
638 | esac | |
9cb68977 | 639 | fi |
9cb68977 | 640 | |
49ccbae6 | 641 | if test "x$have_selinux" = xyes; then |
8569410c SK |
642 | SELINUX_LIBS="-lselinux -lsepol" |
643 | SELINUX_LIBS_STATIC="-lselinux -lsepol" | |
644 | fi | |
645 | AC_SUBST([SELINUX_LIBS]) | |
646 | AC_SUBST([SELINUX_LIBS_STATIC]) | |
9cb68977 | 647 | |
bbae9cb0 | 648 | AC_ARG_WITH([audit], |
7fa4f112 | 649 | AS_HELP_STRING([--with-audit], [compile with audit support]), |
271d98e0 | 650 | [], with_audit=no |
bbae9cb0 KZ |
651 | ) |
652 | ||
49ccbae6 | 653 | if test "x$with_audit" = xno; then |
fd67be31 SK |
654 | AM_CONDITIONAL(HAVE_AUDIT, false) |
655 | else | |
656 | UTIL_CHECK_LIB(audit, audit_log_user_message) | |
49ccbae6 | 657 | case "$with_audit:$have_audit" in |
fd67be31 SK |
658 | yes:no) |
659 | AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())]) | |
660 | ;; | |
661 | esac | |
bbae9cb0 | 662 | fi |
bbae9cb0 | 663 | |
48d7b13a | 664 | AC_ARG_ENABLE([schedutils], |
7fa4f112 | 665 | AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]), |
271d98e0 | 666 | [], enable_schedutils=yes |
48d7b13a | 667 | ) |
49ccbae6 | 668 | AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes) |
48d7b13a KZ |
669 | |
670 | ||
671 | AC_ARG_ENABLE([wall], | |
7fa4f112 | 672 | AS_HELP_STRING([--disable-wall], [do not build wall]), |
271d98e0 | 673 | [], enable_wall=yes |
48d7b13a | 674 | ) |
49ccbae6 | 675 | AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes) |
48d7b13a KZ |
676 | |
677 | ||
678 | AC_ARG_ENABLE([write], | |
7fa4f112 | 679 | AS_HELP_STRING([--enable-write], [build write]), |
271d98e0 | 680 | [], enable_write=no |
48d7b13a | 681 | ) |
49ccbae6 | 682 | AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes) |
48d7b13a KZ |
683 | |
684 | ||
685 | AC_ARG_ENABLE([chsh-only-listed], | |
7fa4f112 | 686 | AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]), |
271d98e0 | 687 | [], enable_chsh_only_listed=yes |
48d7b13a KZ |
688 | ) |
689 | ||
49ccbae6 | 690 | if test "x$enable_chsh_only_listed" = xyes; then |
48d7b13a KZ |
691 | AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?]) |
692 | fi | |
693 | ||
694 | ||
695 | AC_ARG_ENABLE([login-chown-vcs], | |
7fa4f112 | 696 | AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]), |
271d98e0 | 697 | [], enable_login_chown_vcs=no |
48d7b13a KZ |
698 | ) |
699 | ||
49ccbae6 | 700 | if test "x$enable_login_chown_vcs" = xyes; then |
48d7b13a KZ |
701 | AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?]) |
702 | fi | |
703 | ||
704 | ||
705 | AC_ARG_ENABLE([login-stat-mail], | |
7fa4f112 | 706 | AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]), |
271d98e0 | 707 | [], enable_login_stat_mail=no |
48d7b13a KZ |
708 | ) |
709 | ||
49ccbae6 | 710 | if test "x$enable_login_stat_mail" = xyes; then |
48d7b13a KZ |
711 | AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?]) |
712 | fi | |
713 | ||
714 | ||
715 | AC_ARG_ENABLE([pg-bell], | |
7fa4f112 | 716 | AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]), |
271d98e0 | 717 | [], enable_pg_bell=yes |
48d7b13a KZ |
718 | ) |
719 | ||
49ccbae6 | 720 | if test "x$enable_pg_bell" = xyes; then |
48d7b13a KZ |
721 | AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?]) |
722 | fi | |
723 | ||
724 | ||
725 | AC_ARG_ENABLE([require-password], | |
7fa4f112 | 726 | AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]), |
271d98e0 | 727 | [], enable_require_password=yes |
48d7b13a KZ |
728 | ) |
729 | ||
49ccbae6 | 730 | if test "x$enable_require_password" = xyes; then |
48d7b13a KZ |
731 | AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?]) |
732 | fi | |
733 | ||
734 | ||
735 | AC_ARG_ENABLE([use-tty-group], | |
7fa4f112 | 736 | AS_HELP_STRING([--disable-use-tty-group], [do not install wall and write setgid tty]), |
271d98e0 | 737 | [], enable_use_tty_group=yes |
48d7b13a | 738 | ) |
49ccbae6 | 739 | AM_CONDITIONAL(USE_TTY_GROUP, test "x$enable_use_tty_group" = xyes) |
48d7b13a | 740 | |
49ccbae6 | 741 | if test "x$enable_use_tty_group" = xyes; then |
48d7b13a KZ |
742 | AC_DEFINE(USE_TTY_GROUP, 1, [Should wall and write be installed setgid tty?]) |
743 | fi | |
744 | ||
f3831bbd KZ |
745 | AC_ARG_ENABLE([makeinstall-chown], |
746 | AS_HELP_STRING([--disable-makeinstall-chown], [do not do chown-like operations during "make install"]), | |
747 | [], enable_makeinstall_chown=yes | |
748 | ) | |
49ccbae6 | 749 | AM_CONDITIONAL(MAKEINSTALL_DO_CHOWN, test "x$enable_makeinstall_chown" = xyes) |
f3831bbd | 750 | |
06bcee19 | 751 | |
1f10890f SK |
752 | AC_ARG_VAR([SUID_CFLAGS], |
753 | [CFLAGS used for binaries which are usually with the suid bit]) | |
754 | AC_ARG_VAR([SUID_LDFLAGS], | |
755 | [LDFLAGS used for binaries which are usually with the suid bit]) | |
06bcee19 | 756 | |
9cb68977 | 757 | LIBS="" |
48d7b13a | 758 | |
48d7b13a KZ |
759 | |
760 | AC_CONFIG_HEADERS(config.h) | |
761 | ||
8eeb575c KZ |
762 | AC_CONFIG_FILES([ |
763 | Makefile | |
764 | disk-utils/Makefile | |
562218e6 | 765 | fdisk/Makefile |
607c2a72 | 766 | fsck/Makefile |
8eeb575c KZ |
767 | getopt/Makefile |
768 | hwclock/Makefile | |
562218e6 | 769 | include/Makefile |
d00ed891 | 770 | lib/Makefile |
24a06aeb | 771 | libs/Makefile |
6809e7b5 | 772 | libs/blkid/blkid.pc |
a0948ffe | 773 | libs/blkid/Makefile |
51410fc6 | 774 | libs/blkid/bin/Makefile |
a0948ffe | 775 | libs/blkid/src/Makefile |
51410fc6 | 776 | libs/blkid/src/probers/Makefile |
8eeb575c KZ |
777 | login-utils/Makefile |
778 | misc-utils/Makefile | |
779 | mount/Makefile | |
780 | partx/Makefile | |
781 | po/Makefile.in | |
782 | schedutils/Makefile | |
783 | sys-utils/Makefile | |
784 | text-utils/Makefile | |
e83446da | 785 | tests/Makefile |
0f0584ad | 786 | tests/helpers/Makefile |
e83446da | 787 | tests/commands.sh |
cc462132 | 788 | misc-utils/chkdupexe:misc-utils/chkdupexe.pl |
8eeb575c | 789 | ]) |
48d7b13a KZ |
790 | |
791 | AC_OUTPUT |