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