]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - configure.in
misc: quiet "unused variable" compiler warnings
[thirdparty/e2fsprogs.git] / configure.in
1 AC_INIT(version.h)
2 AC_PREREQ(2.50)
3 AC_CONFIG_AUX_DIR(config)
4 MCONFIG=./MCONFIG
5 AC_SUBST_FILE(MCONFIG)
6 BINARY_TYPE=bin
7 dnl
8 dnl This is to figure out the version number and the date....
9 dnl
10 E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
11 | awk '{print $3}' | tr \" " " | awk '{print $1}'`
12 DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
13 | tr \" " "`
14 E2FSPROGS_DAY=`echo $DATE | awk -F- '{print $1}'`
15 MONTH=`echo $DATE | awk -F- '{print $2}'`
16 YEAR=`echo $DATE | awk -F- '{print $3}'`
17
18 if expr $YEAR ">" 1900 > /dev/null ; then
19 E2FSPROGS_YEAR=$YEAR
20 elif expr $YEAR ">" 90 >/dev/null ; then
21 E2FSPROGS_YEAR=19$YEAR
22 else
23 E2FSPROGS_YEAR=20$YEAR
24 fi
25
26 case $MONTH in
27 Jan) MONTH_NUM=01; E2FSPROGS_MONTH="January" ;;
28 Feb) MONTH_NUM=02; E2FSPROGS_MONTH="February" ;;
29 Mar) MONTH_NUM=03; E2FSPROGS_MONTH="March" ;;
30 Apr) MONTH_NUM=04; E2FSPROGS_MONTH="April" ;;
31 May) MONTH_NUM=05; E2FSPROGS_MONTH="May" ;;
32 Jun) MONTH_NUM=06; E2FSPROGS_MONTH="June" ;;
33 Jul) MONTH_NUM=07; E2FSPROGS_MONTH="July" ;;
34 Aug) MONTH_NUM=08; E2FSPROGS_MONTH="August" ;;
35 Sep) MONTH_NUM=09; E2FSPROGS_MONTH="September" ;;
36 Oct) MONTH_NUM=10; E2FSPROGS_MONTH="October" ;;
37 Nov) MONTH_NUM=11; E2FSPROGS_MONTH="November" ;;
38 Dec) MONTH_NUM=12; E2FSPROGS_MONTH="December" ;;
39 *) AC_MSG_WARN([Unknown month $MONTH??]) ;;
40 esac
41
42 base_ver=`echo $E2FSPROGS_VERSION | \
43 sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
44
45 date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
46
47 case $E2FSPROGS_VERSION in
48 *-WIP|pre-*)
49 E2FSPROGS_PKGVER="$base_ver~WIP-$E2FSPROGS_YEAR-$MONTH_NUM-$E2FSPROGS_DAY"
50 ;;
51 *)
52 E2FSPROGS_PKGVER="$base_ver"
53 ;;
54 esac
55
56 unset DATE MONTH YEAR base_ver pre_vers date_spec
57 AC_MSG_RESULT([Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION])
58 AC_MSG_RESULT([Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}])
59 AC_SUBST(E2FSPROGS_YEAR)
60 AC_SUBST(E2FSPROGS_MONTH)
61 AC_SUBST(E2FSPROGS_DAY)
62 AC_SUBST(E2FSPROGS_VERSION)
63 AC_SUBST(E2FSPROGS_PKGVER)
64 AC_CANONICAL_HOST
65 dnl
66 dnl Check to see if libdl exists for the sake of dlopen
67 dnl
68 DLOPEN_LIB=''
69 AC_CHECK_LIB(dl, dlopen,
70 [DLOPEN_LIB=-ldl
71 AC_DEFINE(HAVE_DLOPEN)])
72 AC_SUBST(DLOPEN_LIB)
73 dnl
74 dnl Use diet libc
75 dnl
76 WITH_DIET_LIBC=
77 AC_ARG_WITH([diet-libc],
78 [ --with-diet-libc use diet libc],
79 CC="diet cc -nostdinc"
80 WITH_DIET_LIBC=yes
81 AC_MSG_RESULT(CC=$CC))dnl
82 dnl
83 AC_ARG_WITH([cc],
84 AC_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
85 AC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
86 dnl
87 AC_ARG_WITH([ccopts],
88 AC_HELP_STRING([--with-ccopts],[no longer supported, use CFLAGS= instead]),
89 AC_MSG_ERROR([--with-ccopts no longer supported; use CFLAGS= instead]))
90 dnl
91 AC_ARG_WITH([ldopts],
92 AC_HELP_STRING([--with-ldopts],[no longer supported, use LDFLAGS= instead]),
93 AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead]))
94 dnl
95 AC_PROG_CC
96 AC_PROG_CPP
97 dnl
98 dnl On systems without linux header files, we add an extra include directory
99 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
100 dnl is quoted so that it gets expanded by make, not by configure.
101 dnl
102 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
103 if test "$linux_headers" != yes; then
104 LINUX_INCLUDE='-I$(top_builddir)/include'
105 fi
106 AC_SUBST(LINUX_INCLUDE)
107 dnl
108 dnl Alpha computers use fast and imprecise floating point code that may
109 dnl miss exceptions by default. Force sane options if we're using GCC.
110 AC_MSG_CHECKING(for additional special compiler flags)
111 if test "$GCC" = yes
112 then
113 case "$host_cpu" in
114 alpha) addcflags="-mieee" ;;
115 esac
116 fi
117 if test "x$addcflags" != x
118 then
119 AC_MSG_RESULT($addcflags)
120 CFLAGS="$addcflags $CFLAGS"
121 else
122 AC_MSG_RESULT([[(none)]])
123 fi
124 dnl
125 dnl Set default values for library extentions. Will be dealt with after
126 dnl parsing configuration opions, which may modify these
127 dnl
128 LIB_EXT=.a
129 STATIC_LIB_EXT=.a
130 PROFILED_LIB_EXT=.a
131 dnl
132 dnl Allow separate `root_prefix' to be specified
133 dnl
134 AC_ARG_WITH([root-prefix],
135 [ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
136 root_prefix=$withval,
137 root_prefix=NONE)dnl
138 dnl
139 dnl handle --enable-maintainer-mode
140 dnl
141 AC_ARG_ENABLE([maintainer-mode],
142 [ --enable-maintainer-mode enable makefile rules useful for maintainers],
143 if test "$enableval" = "no"
144 then
145 MAINTAINER_CMT=#
146 AC_MSG_RESULT([Disabling maintainer mode])
147 else
148 MAINTAINER_CMT=
149 AC_MSG_RESULT([Enabling maintainer mode])
150 fi
151 ,
152 MAINTAINER_CMT=#
153 AC_MSG_RESULT([Disabling maintainer mode by default])
154 )
155 AC_SUBST(MAINTAINER_CMT)
156 dnl
157 dnl handle --enable-symlink-install
158 dnl
159 AC_ARG_ENABLE([symlink-install],
160 [ --enable-symlink-install use symlinks when installing instead of hard links],
161 if test "$enableval" = "no"
162 then
163 LINK_INSTALL_FLAGS=-f
164 AC_MSG_RESULT([Disabling symlinks for install])
165 else
166 LINK_INSTALL_FLAGS=-sf
167 AC_MSG_RESULT([Enabling symlinks for install])
168 fi
169 ,
170 LINK_INSTALL_FLAGS=-f
171 AC_MSG_RESULT([Disabling symlinks for install])
172 )
173 AC_SUBST(LINK_INSTALL_FLAGS)
174 dnl
175 dnl handle --enable-symlink-build
176 dnl
177 AC_ARG_ENABLE([symlink-build],
178 [ --enable-symlink-build use symlinks while building instead of hard links],
179 if test "$enableval" = "no"
180 then
181 LINK_BUILD_FLAGS=
182 AC_MSG_RESULT([Disabling symlinks for build])
183 else
184 LINK_BUILD_FLAGS=-s
185 AC_MSG_RESULT([Enabling symlinks for build])
186 fi
187 ,
188 LINK_BUILD_FLAGS=
189 AC_MSG_RESULT([Disabling symlinks for build])
190 )
191 AC_SUBST(LINK_BUILD_FLAGS)
192 dnl
193 dnl handle --enable-verbose-makecmds
194 dnl
195 AC_ARG_ENABLE([verbose-makecmds],
196 [ --enable-verbose-makecmds enable verbose make command output],
197 if test "$enableval" = "no"
198 then
199 AC_MSG_RESULT([Disabling verbose make commands])
200 E=@echo
201 Q=@
202 else
203 AC_MSG_RESULT([Enabling verbose make commands])
204 E=@\\#
205 Q=
206 fi
207 ,
208 AC_MSG_RESULT([Disabling verbose make commands])
209 E=@echo
210 Q=@
211 )
212 AC_SUBST(E)
213 AC_SUBST(Q)
214 dnl
215 dnl handle --enable-compression
216 dnl
217 AC_ARG_ENABLE([compression],
218 [ --enable-compression enable EXPERIMENTAL compression support],
219 if test "$enableval" = "no"
220 then
221 AC_MSG_RESULT([Disabling compression support])
222 else
223 AC_DEFINE(ENABLE_COMPRESSION)
224 AC_MSG_RESULT([Enabling compression support])
225 AC_MSG_WARN([Compression support is experimental])
226 fi
227 ,
228 AC_MSG_RESULT([Disabling compression support by default])
229 )
230 dnl
231 dnl handle --enable-htree
232 dnl
233 AC_ARG_ENABLE([htree],
234 [ --enable-htree enable EXPERIMENTAL htree directory support],
235 if test "$enableval" = "no"
236 then
237 HTREE_CMT=#
238 AC_MSG_RESULT([Disabling htree directory support])
239 else
240 HTREE_CMT=
241 AC_DEFINE(ENABLE_HTREE)
242 AC_MSG_RESULT([Enabling htree directory support])
243 fi
244 ,
245 HTREE_CMT=
246 AC_DEFINE(ENABLE_HTREE)
247 AC_MSG_RESULT([Enabling htree directory support by default])
248 )
249 AC_SUBST(HTREE_CMT)
250 dnl
251 dnl This needs to be before all of the --enable-*-shlibs options
252 dnl
253 E2_PKG_CONFIG_STATIC=--static
254 LDFLAG_DYNAMIC=
255 PRIVATE_LIBS_CMT=
256 dnl
257 dnl handle --enable-elf-shlibs
258 dnl
259 AC_ARG_ENABLE([elf-shlibs],
260 [ --enable-elf-shlibs select ELF shared libraries],
261 if test "$enableval" = "no"
262 then
263 ELF_CMT=#
264 MAKEFILE_ELF=/dev/null
265 AC_MSG_RESULT([Disabling ELF shared libraries])
266 else
267 E2_PKG_CONFIG_STATIC=
268 ELF_CMT=
269 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
270 [case "$host_os" in
271 solaris2.*)
272 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
273 ;;
274 esac]
275 BINARY_TYPE=elfbin
276 LIB_EXT=.so
277 PRIVATE_LIBS_CMT=#
278 LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib']
279 AC_MSG_RESULT([Enabling ELF shared libraries])
280 fi
281 ,
282 MAKEFILE_ELF=/dev/null
283 ELF_CMT=#
284 AC_MSG_RESULT([Disabling ELF shared libraries by default])
285 )
286 AC_SUBST(ELF_CMT)
287 AC_SUBST_FILE(MAKEFILE_ELF)
288 dnl
289 dnl handle --enable-bsd-shlibs
290 dnl
291 AC_ARG_ENABLE([bsd-shlibs],
292 [ --enable-bsd-shlibs select BSD shared libraries],
293 if test "$enableval" = "no"
294 then
295 BSDLIB_CMT=#
296 MAKEFILE_BSDLIB=/dev/null
297 AC_MSG_RESULT([Disabling BSD shared libraries])
298 else
299 E2_PKG_CONFIG_STATIC=
300 BSDLIB_CMT=
301 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
302 LIB_EXT=.so
303 [case "$host_os" in
304 darwin*)
305 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
306 LIB_EXT=.dylib
307 ;;
308 esac]
309 AC_MSG_RESULT([Enabling BSD shared libraries])
310 fi
311 ,
312 MAKEFILE_BSDLIB=/dev/null
313 BSDLIB_CMT=#
314 AC_MSG_RESULT([Disabling BSD shared libraries by default])
315 )
316 AC_SUBST(BSDLIB_CMT)
317 AC_SUBST_FILE(MAKEFILE_BSDLIB)
318 dnl
319 dnl handle --enable-profile
320 dnl
321 AC_ARG_ENABLE([profile],
322 [ --enable-profile build profiling libraries],
323 if test "$enableval" = "no"
324 then
325 PROFILE_CMT=#
326 MAKEFILE_PROFILE=/dev/null
327 AC_MSG_RESULT([Disabling profiling libraries])
328 else
329 PROFILE_CMT=
330 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
331 PROFILED_LIB_EXT=_p.a
332 AC_MSG_RESULT([Building profiling libraries])
333 fi
334 ,
335 PROFILE_CMT=#
336 MAKEFILE_PROFILE=/dev/null
337 AC_MSG_RESULT([Disabling profiling libraries by default])
338 )
339 AC_SUBST(PROFILE_CMT)
340 AC_SUBST_FILE(MAKEFILE_PROFILE)
341 dnl
342 dnl handle --enable-checker
343 dnl
344 AC_ARG_ENABLE([checker],
345 [ --enable-checker build checker libraries],
346 if test "$enableval" = "no"
347 then
348 CHECKER_CMT=#
349 MAKEFILE_CHECKER=/dev/null
350 AC_MSG_RESULT([Disabling checker libraries])
351 else
352 CHECKER_CMT=
353 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
354 AC_MSG_RESULT([Building checker libraries])
355 fi
356 ,
357 CHECKER_CMT=#
358 MAKEFILE_CHECKER=/dev/null
359 AC_MSG_RESULT([Disabling checker libraries by default])
360 )
361 AC_SUBST(CHECKER_CMT)
362 AC_SUBST_FILE(MAKEFILE_CHECKER)
363 dnl
364 dnl Substitute library extensions
365 dnl
366 AC_SUBST(LIB_EXT)
367 AC_SUBST(STATIC_LIB_EXT)
368 AC_SUBST(PROFILED_LIB_EXT)
369 AC_SUBST(LDFLAG_DYNAMIC)
370 AC_SUBST(PRIVATE_LIBS_CMT)
371 dnl
372 dnl handle --enable-jbd-debug
373 dnl
374 AC_ARG_ENABLE([jbd-debug],
375 [ --enable-jbd-debug enable journal debugging],
376 if test "$enableval" = "no"
377 then
378 AC_MSG_RESULT([Disabling journal debugging])
379 else
380 AC_DEFINE(CONFIG_JBD_DEBUG)
381 AC_MSG_RESULT([Enabling journal debugging])
382 fi
383 ,
384 AC_MSG_RESULT([Disabling journal debugging by default])
385 )
386 dnl
387 dnl handle --enable-blkid-debug
388 dnl
389 AC_ARG_ENABLE([blkid-debug],
390 [ --enable-blkid-debug enable blkid debugging],
391 if test "$enableval" = "no"
392 then
393 AC_MSG_RESULT([Disabling blkid debugging])
394 else
395 AC_DEFINE(CONFIG_BLKID_DEBUG)
396 AC_MSG_RESULT([Enabling blkid debugging])
397 fi
398 ,
399 AC_MSG_RESULT([Disabling blkid debugging by default])
400 )
401 dnl
402 dnl handle --enable-testio-debug
403 dnl
404 AC_ARG_ENABLE([testio-debug],
405 [ --disable-testio-debug disable the use of the test I/O manager for debugging],
406 if test "$enableval" = "no"
407 then
408 AC_MSG_RESULT([Disabling testio debugging])
409 TEST_IO_CMT="#"
410 else
411 TEST_IO_CMT=
412 AC_DEFINE(CONFIG_TESTIO_DEBUG)
413 AC_MSG_RESULT([Enabling testio debugging])
414 fi
415 ,
416 AC_MSG_RESULT([Enabling testio debugging by default])
417 AC_DEFINE(CONFIG_TESTIO_DEBUG)
418 TEST_IO_CMT=
419 )
420 AC_SUBST(TEST_IO_CMT)
421 dnl
422 dnl handle --disable-libuuid
423 dnl
424 PKG_PROG_PKG_CONFIG
425 LIBUUID=
426 DEPLIBUUID=
427 STATIC_LIBUUID=
428 DEPSTATIC_LIBUUID=
429 PROFILED_LIBUUID=
430 DEPPROFILED_LIBUUID=
431 UUID_CMT=
432 AC_ARG_ENABLE([libuuid],
433 [ --disable-libuuid do not build private uuid library],
434 if test "$enableval" = "no"
435 then
436 if test -z "$PKG_CONFIG"; then
437 AC_MSG_ERROR([pkg-config not installed; please install it.])
438 fi
439
440 AC_CHECK_LIB(uuid, uuid_generate,
441 [LIBUUID=`$PKG_CONFIG --libs uuid`;
442 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`],
443 [AC_MSG_ERROR([external uuid library not found])],
444 [$LIBUUID])
445 UUID_CMT=#
446 AC_MSG_RESULT([Disabling private uuid library])
447 else
448 LIBUUID='$(LIB)/libuuid'$LIB_EXT
449 DEPLIBUUID=$LIBUUID
450 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
451 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
452 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
453 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
454 AC_MSG_RESULT([Enabling private uuid library])
455 fi
456 ,
457 LIBUUID='$(LIB)/libuuid'$LIB_EXT
458 DEPLIBUUID=$LIBUUID
459 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
460 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
461 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
462 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
463 AC_MSG_RESULT([Enabling private uuid library by default])
464 )
465 AC_SUBST(LIBUUID)
466 AC_SUBST(DEPLIBUUID)
467 AC_SUBST(STATIC_LIBUUID)
468 AC_SUBST(DEPSTATIC_LIBUUID)
469 AC_SUBST(PROFILED_LIBUUID)
470 AC_SUBST(DEPPROFILED_LIBUUID)
471 AC_SUBST(UUID_CMT)
472 dnl
473 dnl handle --disable-libblkid
474 dnl
475 PKG_PROG_PKG_CONFIG
476 LIBBLKID=
477 DEPLIBBLKID=
478 STATIC_LIBBLKID=
479 DEPSTATIC_LIBBLKID=
480 PROFILED_LIBBLKID=
481 DEPPROFILED_LIBBLKID=
482 BLKID_CMT=
483 AC_ARG_ENABLE([libblkid],
484 [ --disable-libblkid do not build private blkid library],
485 if test "$enableval" = "no"
486 then
487 if test -z "$PKG_CONFIG"; then
488 AC_MSG_ERROR([pkg-config not installed; please install it.])
489 fi
490
491 AC_CHECK_LIB(blkid, blkid_get_cache,
492 [LIBBLKID=`$PKG_CONFIG --libs blkid`;
493 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
494 [AC_MSG_ERROR([external blkid library not found])],
495 [$LIBBLKID])
496 BLKID_CMT=#
497 AC_MSG_RESULT([Disabling private blkid library])
498 else
499 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
500 DEPLIBBLKID=$LIBBLKID
501 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
502 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
503 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
504 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
505 AC_DEFINE(CONFIG_BUILD_FINDFS)
506 AC_MSG_RESULT([Enabling private blkid library])
507 fi
508 ,
509 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
510 DEPLIBBLKID=$LIBBLKID
511 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
512 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
513 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
514 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
515 AC_DEFINE(CONFIG_BUILD_FINDFS)
516 AC_MSG_RESULT([Enabling private blkid library by default])
517 )
518 AC_SUBST(LIBBLKID)
519 AC_SUBST(DEPLIBBLKID)
520 AC_SUBST(STATIC_LIBBLKID)
521 AC_SUBST(DEPSTATIC_LIBBLKID)
522 AC_SUBST(PROFILED_LIBBLKID)
523 AC_SUBST(DEPPROFILED_LIBBLKID)
524 AC_SUBST(BLKID_CMT)
525 dnl
526 dnl handle --enable-debugfs
527 dnl
528 AC_ARG_ENABLE([debugfs],
529 [ --disable-debugfs disable support of debugfs program],
530 if test "$enableval" = "no"
531 then
532 AC_MSG_RESULT([Disabling debugfs support])
533 DEBUGFS_CMT="#"
534 else
535 DEBUGFS_CMT=
536 AC_MSG_RESULT([Enabling debugfs support])
537 fi
538 ,
539 AC_MSG_RESULT([Enabling debugfs support by default])
540 DEBUGFS_CMT=
541 )
542 AC_SUBST(DEBUGFS_CMT)
543 dnl
544 dnl handle --enable-imager
545 dnl
546 AC_ARG_ENABLE([imager],
547 [ --disable-imager disable support of e2image program],
548 if test "$enableval" = "no"
549 then
550 AC_MSG_RESULT([Disabling e2image support])
551 IMAGER_CMT="#"
552 else
553 IMAGER_CMT=
554 AC_MSG_RESULT([Enabling e2image support])
555 fi
556 ,
557 AC_MSG_RESULT([Enabling e2image support by default])
558 IMAGER_CMT=
559 )
560 AC_SUBST(IMAGER_CMT)
561 dnl
562 dnl handle --enable-resizer
563 dnl
564 AC_ARG_ENABLE([resizer],
565 [ --disable-resizer disable support of e2resize program],
566 if test "$enableval" = "no"
567 then
568 AC_MSG_RESULT([Disabling e2resize support])
569 RESIZER_CMT="#"
570 else
571 RESIZER_CMT=
572 AC_MSG_RESULT([Enabling e2resize support])
573 fi
574 ,
575 AC_MSG_RESULT([Enabling e2resize support by default])
576 RESIZER_CMT=
577 )
578 AC_SUBST(RESIZER_CMT)
579 dnl
580 dnl handle --enable-defrag
581 dnl
582 AC_ARG_ENABLE([defrag],
583 [ --disable-defrag disable support of e4defrag program],
584 if test "$enableval" = "no"
585 then
586 AC_MSG_RESULT([Disabling e4defrag support])
587 DEFRAG_CMT="#"
588 else
589 DEFRAG_CMT=
590 AC_MSG_RESULT([Enabling e4defrag support])
591 fi
592 ,
593 AC_MSG_RESULT([Enabling e4defrag support by default])
594 DEFRAG_CMT=
595 )
596 AC_SUBST(DEFRAG_CMT)
597 dnl
598 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
599 dnl
600 AC_ARG_ENABLE([fsck],
601 [ --enable-fsck build fsck wrapper program],
602 [if test "$enableval" = "no"
603 then
604 FSCK_PROG='' FSCK_MAN=''
605 AC_MSG_RESULT([Not building fsck wrapper])
606 else
607 FSCK_PROG=fsck FSCK_MAN=fsck.8
608 AC_MSG_RESULT([Building fsck wrapper])
609 fi]
610 ,
611 [case "$host_os" in
612 gnu*)
613 FSCK_PROG='' FSCK_MAN=''
614 AC_MSG_RESULT([Not building fsck wrapper by default])
615 ;;
616 *)
617 FSCK_PROG=fsck FSCK_MAN=fsck.8
618 AC_MSG_RESULT([Building fsck wrapper by default])
619 esac]
620 )
621 AC_SUBST(FSCK_PROG)
622 AC_SUBST(FSCK_MAN)
623 dnl
624 dnl See whether to install the `e2initrd-helper' program
625 dnl
626 AC_ARG_ENABLE([e2initrd-helper],
627 [ --enable-e2initrd-helper build e2initrd-helper program],
628 [if test "$enableval" = "no"
629 then
630 E2INITRD_PROG='' E2INITRD_MAN=''
631 AC_MSG_RESULT([Not building e2initrd helper])
632 else
633 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
634 AC_MSG_RESULT([Building e2initrd helper])
635 fi]
636 ,
637 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
638 AC_MSG_RESULT([Building e2initrd helper by default])
639 )
640 AC_SUBST(E2INITRD_PROG)
641 AC_SUBST(E2INITRD_MAN)
642 dnl
643 dnl
644 dnl
645 AC_ARG_ENABLE([tls],
646 [ --disable-tls disable use of thread local support],
647 [if test "$enableval" = "no"
648 then
649 try_tls=""
650 AC_MSG_RESULT([Disabling thread local support])
651 else
652 try_tls="yes"
653 AC_MSG_RESULT([Enabling thread local support])
654 fi]
655 ,
656 if test -n "$WITH_DIET_LIBC"
657 then
658 try_tls=""
659 AC_MSG_RESULT([Diet libc does not support thread local support])
660 else
661 try_tls="yes"
662 AC_MSG_RESULT([Try using thread local support by default])
663 fi
664 )
665 if test "$try_tls" = "yes"
666 then
667 AX_TLS
668 fi
669 dnl
670 dnl
671 dnl
672 AC_ARG_ENABLE([uuidd],
673 [ --disable-uuidd disable building the uuid daemon],
674 [if test "$enableval" = "no"
675 then
676 AC_MSG_RESULT([Not building uuidd])
677 UUIDD_CMT="#"
678 else
679 AC_DEFINE(USE_UUIDD)
680 UUIDD_CMT=""
681 AC_MSG_RESULT([Building uuidd])
682 fi]
683 ,
684 AC_DEFINE(USE_UUIDD)
685 UUIDD_CMT=""
686 AC_MSG_RESULT([Building uuidd by default])
687 )
688 AC_SUBST(UUIDD_CMT)
689 dnl
690 dnl
691 dnl
692 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
693 AC_SUBST_FILE(MAKEFILE_LIBRARY)
694 dnl
695 dnl Add internationalization support, using gettext.
696 dnl
697 GETTEXT_PACKAGE=e2fsprogs
698 PACKAGE=e2fsprogs
699 VERSION="$E2FSPROGS_VERSION"
700 VERSION=0.14.1
701 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
702 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
703 AC_SUBST(GETTEXT_PACKAGE)
704 AC_SUBST(PACKAGE)
705 AC_SUBST(VERSION)
706
707 AM_GNU_GETTEXT
708 dnl
709 dnl End of configuration options
710 dnl
711 AC_SUBST(BINARY_TYPE)
712 AC_PROG_MAKE_SET
713 CHECK_GNU_MAKE
714 AC_PATH_PROG(LN, ln, ln)
715 AC_PROG_LN_S
716 AC_PATH_PROG(MV, mv, mv)
717 AC_PATH_PROG(CP, cp, cp)
718 AC_PATH_PROG(RM, rm, rm)
719 AC_PATH_PROG(CHMOD, chmod, :)
720 AC_PROG_AWK
721 AC_PROG_EGREP
722 AC_PATH_PROG(SED, sed, sed)
723 AC_PATH_PROG(PERL, perl, perl)
724 AC_PATH_PROG(LDCONFIG, ldconfig, :)
725 AC_CHECK_TOOL(AR, ar, ar)
726 AC_CHECK_TOOL(RANLIB, ranlib, :)
727 AC_CHECK_TOOL(STRIP, strip, :)
728 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
729 if test "_$MAKEINFO" = "_"; then
730 MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
731 else
732 case "$MAKEINFO" in
733 */missing.*)
734 AC_MSG_WARN([
735 *** Makeinfo is missing. Info documentation will not be built.])
736 ;;
737 *)
738 ;;
739 esac
740 fi
741 AC_SUBST(MAKEINFO)
742 AC_PROG_INSTALL
743 # See if we need a separate native compiler.
744 if test $cross_compiling = no; then
745 BUILD_CC="$CC"
746 AC_SUBST(BUILD_CC)
747 else
748 AC_CHECK_PROGS(BUILD_CC, gcc cc)
749 fi
750 AC_CHECK_HEADERS(dirent.h errno.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h)
751 AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
752 [[
753 #if HAVE_SYS_QUEUE_H
754 #include <sys/queue.h>
755 #endif
756 ]])
757 AC_CHECK_HEADERS(net/if.h,,,
758 [[
759 #if HAVE_SYS_TYPES_H
760 #include <sys/types.h>
761 #endif
762 #if HAVE_SYS_SOCKET
763 #include <sys/socket.h>
764 #endif
765 ]])
766 AC_FUNC_VPRINTF
767 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
768 dnl is not decleared.
769 AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT)],,
770 [#include <dirent.h>])
771 dnl Check to see if ssize_t was decleared
772 AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T)],,
773 [#include <sys/types.h>])
774 dnl
775 dnl Check to see if llseek() is declared in unistd.h. On some libc's
776 dnl it is, and on others it isn't..... Thank you glibc developers....
777 dnl
778 AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)],,
779 [#include <unistd.h>])
780 dnl
781 dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
782 dnl are so convoluted that I can't tell whether it will always be defined,
783 dnl and if it isn't defined while lseek64 is defined in the library,
784 dnl disaster will strike.
785 dnl
786 dnl Warning! Use of --enable-gcc-wall may throw off this test.
787 dnl
788 dnl
789 AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)],,
790 [#define _LARGEFILE_SOURCE
791 #define _LARGEFILE64_SOURCE
792 #include <unistd.h>])
793 dnl
794 dnl Word sizes...
795 dnl
796 AC_CHECK_SIZEOF(short)
797 AC_CHECK_SIZEOF(int)
798 AC_CHECK_SIZEOF(long)
799 AC_CHECK_SIZEOF(long long)
800 SIZEOF_SHORT=$ac_cv_sizeof_short
801 SIZEOF_INT=$ac_cv_sizeof_int
802 SIZEOF_LONG=$ac_cv_sizeof_long
803 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
804 AC_SUBST(SIZEOF_SHORT)
805 AC_SUBST(SIZEOF_INT)
806 AC_SUBST(SIZEOF_LONG)
807 AC_SUBST(SIZEOF_LONG_LONG)
808 AC_C_BIGENDIAN
809 BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
810 ASM_TYPES_HEADER=./asm_types.h
811 AC_SUBST_FILE(ASM_TYPES_HEADER)
812 dnl
813 dnl Save the configuration #defines needed for the public ext2fs.h
814 dnl header file
815 dnl
816 echo "/* These defines are needed for the public ext2fs.h header file */" \
817 > public_config.h
818 if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
819 uniq tmp_config.$$ >> public_config.h
820 else
821 echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
822 fi
823 if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
824 uniq tmp_config.$$ >> public_config.h
825 else
826 echo "#undef WORDS_BIGENDIAN" >> public_config.h
827 fi
828 rm -f tmp_config.$$
829 PUBLIC_CONFIG_HEADER=./public_config.h
830 AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
831 dnl
832 dnl See if we have inttypes.h and if intptr_t is defined
833 dnl
834 AC_CHECK_HEADERS([inttypes.h])
835 AC_CHECK_TYPES(intptr_t)
836 dnl
837 dnl See if struct stat has a st_flags field, in which case we can get file
838 dnl flags somewhat portably. Also check for the analogous setter, chflags().
839 dnl
840 AC_MSG_CHECKING(whether struct stat has a st_flags field)
841 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
842 AC_TRY_COMPILE([#include <sys/stat.h>],
843 [struct stat stat; stat.st_flags = 0;],
844 [e2fsprogs_cv_struct_st_flags=yes],
845 [e2fsprogs_cv_struct_st_flags=no]))
846 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
847 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
848 AC_MSG_CHECKING(whether st_flags field is useful)
849 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
850 AC_TRY_COMPILE([#include <sys/stat.h>],
851 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
852 [e2fsprogs_cv_struct_st_flags_immut=yes],
853 [e2fsprogs_cv_struct_st_flags_immut=no]))
854 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
855 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
856 AC_DEFINE(HAVE_STAT_FLAGS)
857 fi
858 fi
859 dnl
860 dnl Check for the presence of SA_LEN
861 dnl
862 AC_CHECK_MEMBER(struct sockaddr.sa_len,
863 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
864 [#include <sys/types.h>
865 #include <sys/socket.h>])
866 dnl
867 dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using
868 dnl the system-provided blkid library
869 dnl
870 if test -n "$BLKID_CMT"; then
871 AC_SEARCH_LIBS([blkid_probe_all], [blkid])
872 fi
873 dnl
874 AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid usleep nanosleep getdtablesize getrlimit sync_file_range posix_fadvise fallocate fallocate64 blkid_probe_get_topology mbstowcs)
875 dnl
876 dnl Check to see if -lsocket is required (solaris) to make something
877 dnl that uses socket() to compile; this is needed for the UUID library
878 dnl
879 SOCKET_LIB=''
880 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
881 AC_SUBST(SOCKET_LIB)
882 dnl
883 dnl See if optreset exists
884 dnl
885 AC_MSG_CHECKING(for optreset)
886 AC_CACHE_VAL(ac_cv_have_optreset,
887 [AC_EGREP_HEADER(optreset, unistd.h,
888 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
889 AC_MSG_RESULT($ac_cv_have_optreset)
890 if test $ac_cv_have_optreset = yes; then
891 AC_DEFINE(HAVE_OPTRESET)
892 fi
893 dnl
894 dnl Test for sem_init, and which library it might require:
895 dnl
896 SEM_INIT_LIB=''
897 AC_CHECK_FUNC(sem_init, ,
898 AC_CHECK_LIB(pthread, sem_init,
899 AC_DEFINE(HAVE_SEM_INIT)
900 SEM_INIT_LIB=-lpthread,
901 AC_CHECK_LIB(rt, sem_init,
902 AC_DEFINE(HAVE_SEM_INIT)
903 SEM_INIT_LIB=-lrt,
904 AC_CHECK_LIB(posix4, sem_init,
905 AC_DEFINE(HAVE_SEM_INIT)
906 SEM_INIT_LIB=-lposix4))))dnl
907 AC_SUBST(SEM_INIT_LIB)
908 dnl
909 dnl Check for unified diff
910 dnl
911 AC_MSG_CHECKING(for unified diff option)
912 if diff -u $0 $0 > /dev/null 2>&1 ; then
913 UNI_DIFF_OPTS=-u
914 else
915 UNI_DIFF_OPTS=-c
916 fi
917 AC_MSG_RESULT($UNI_DIFF_OPTS)
918 AC_SUBST(UNI_DIFF_OPTS)
919 dnl
920 dnl We use the EXT2 ioctls only under Linux
921 dnl
922 case "$host_os" in
923 linux*)
924 AC_DEFINE(HAVE_EXT2_IOCTLS)
925 ;;
926 esac
927 dnl
928 dnl OS-specific uncomment control
929 dnl
930 LINUX_CMT="#"
931 CYGWIN_CMT="#"
932 UNIX_CMT=
933 case "$host_os" in
934 linux*)
935 LINUX_CMT=
936 ;;
937 cygwin)
938 CYGWIN_CMT=
939 UNIX_CMT="#"
940 ;;
941 esac
942 AC_SUBST(LINUX_CMT)
943 AC_SUBST(CYGWIN_CMT)
944 AC_SUBST(UNIX_CMT)
945 dnl
946 dnl Linux and Hurd places root files in the / by default
947 dnl
948 case "$host_os" in
949 linux* | gnu* | k*bsd*-gnu)
950 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
951 root_prefix="";
952 AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
953 fi
954 ;;
955 esac
956 dnl
957 dnl On Linux/hurd, force the prefix to be /usr
958 dnl
959 case "$host_os" in
960 linux* | gnu* | k*bsd*-gnu)
961 if test "$prefix" = NONE ; then
962 prefix="/usr";
963 AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
964 if test "$mandir" = '${prefix}/man' ; then
965 AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
966 mandir=/usr/share/man
967 fi
968 fi
969 ;;
970 esac
971 if test "$root_prefix" = NONE ; then
972 if test "$prefix" = NONE ; then
973 root_prefix="$ac_default_prefix"
974 else
975 root_prefix="$prefix"
976 fi
977 root_bindir=$bindir
978 root_sbindir=$sbindir
979 root_libdir=$libdir
980 root_sysconfdir=$sysconfdir
981 else
982 root_bindir='${root_prefix}/bin'
983 root_sbindir='${root_prefix}/sbin'
984 root_libdir='${root_prefix}/lib'
985 root_sysconfdir='${root_prefix}/etc'
986 fi
987 if test "$bindir" != '${exec_prefix}/bin'; then
988 root_bindir=$bindir
989 AC_MSG_RESULT([Setting root_bindir to $root_bindir])
990 fi
991 if test "$sbindir" != '${exec_prefix}/sbin'; then
992 root_sbindir=$sbindir
993 AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
994 fi
995 if test "$libdir" != '${exec_prefix}/lib'; then
996 root_libdir=$libdir
997 AC_MSG_RESULT([Setting root_libdir to $root_libdir])
998 fi
999 if test "$sysconfdir" != '${prefix}/etc'; then
1000 root_sysconfdir=$sysconfdir
1001 AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
1002 fi
1003 AC_SUBST(root_prefix)
1004 AC_SUBST(root_bindir)
1005 AC_SUBST(root_sbindir)
1006 AC_SUBST(root_libdir)
1007 AC_SUBST(root_sysconfdir)
1008 dnl
1009 dnl See if -static works.
1010 dnl
1011 AC_MSG_CHECKING([whether linker accepts -static])
1012 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
1013 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
1014 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
1015 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
1016 LDFLAGS=$SAVE_LDFLAGS])
1017 dnl
1018 dnl Regardless of how the test turns out, Solaris doesn't handle -static
1019 dnl This is caused by the socket library requiring the nsl library, which
1020 dnl requires the -dl library, which only works for dynamically linked
1021 dnl programs. It basically means you can't have statically linked programs
1022 dnl which use the network under Solaris.
1023 dnl
1024 case "$host_os" in
1025 solaris2.*)
1026 ac_cv_e2fsprogs_use_static=no
1027 ;;
1028 esac
1029 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
1030 LDFLAG_STATIC=
1031 if test $ac_cv_e2fsprogs_use_static = yes; then
1032 LDFLAG_STATIC=-static
1033 fi
1034 AC_SUBST(LDFLAG_STATIC)
1035 dnl
1036 dnl Work around mysterious Darwin / GNU libintl problem
1037 dnl (__asm__ redirection doesn't work for some mysterious reason. Looks like
1038 dnl Apple hacked gcc somehow?)
1039 dnl
1040 case "$host_os" in
1041 darwin*)
1042 AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
1043 AC_DEFINE(_INTL_REDIRECT_MACROS)
1044 ;;
1045 esac
1046 dnl
1047 dnl Make the ss and et directories work correctly.
1048 dnl
1049 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
1050 ET_DIR=`cd ${srcdir}/lib/et; pwd`
1051 AC_SUBST(SS_DIR)
1052 AC_SUBST(ET_DIR)
1053 dnl
1054 dnl Only try to run the test suite if we're not cross compiling.
1055 dnl
1056 if test "$cross_compiling" = yes ; then
1057 DO_TEST_SUITE=
1058 else
1059 DO_TEST_SUITE=check
1060 fi
1061 AC_SUBST(DO_TEST_SUITE)
1062 dnl
1063 dnl Only include the intl include files if we're building with them
1064 dnl
1065 INTL_FLAGS=
1066 if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
1067 INTL_FLAGS='-I$(top_builddir)/intl -I$(top_srcdir)/intl'
1068 fi
1069 AC_SUBST(INTL_FLAGS)
1070 dnl
1071 dnl Build CFLAGS
1072 dnl
1073 if test $cross_compiling = no; then
1074 BUILD_CFLAGS="$CFLAGS"
1075 BUILD_LDFLAGS="$LDFLAGS"
1076 else
1077 BUILD_CFLAGS=
1078 BUILD_LDFLAGS=
1079 fi
1080 AC_SUBST(BUILD_CFLAGS)
1081 AC_SUBST(BUILD_LDFLAGS)
1082 dnl
1083 dnl Make our output files, being sure that we create the some miscellaneous
1084 dnl directories
1085 dnl
1086 test -d lib || mkdir lib
1087 test -d include || mkdir include
1088 test -d include/linux || mkdir include/linux
1089 test -d include/asm || mkdir include/asm
1090 for i in MCONFIG Makefile e2fsprogs.spec \
1091 util/Makefile util/subst.conf util/gen-tarball \
1092 lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
1093 lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
1094 lib/uuid/Makefile lib/uuid/uuid_types.h \
1095 lib/blkid/Makefile lib/blkid/blkid_types.h \
1096 lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
1097 lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
1098 misc/Makefile ext2ed/Makefile e2fsck/Makefile \
1099 debugfs/Makefile tests/Makefile tests/progs/Makefile \
1100 resize/Makefile doc/Makefile intl/Makefile \
1101 intl/libgnuintl.h po/Makefile.in ; do
1102 if test -d `dirname ${srcdir}/$i` ; then
1103 outlist="$outlist $i"
1104 fi
1105 done
1106 AC_OUTPUT($outlist)
1107 if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi