OSDN Git Service

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