Whamcloud - gitweb
e2fsck: handle preallocation for large PAGE_SIZE
[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         dirent.h
860         errno.h
861         execinfo.h
862         getopt.h
863         malloc.h
864         mntent.h
865         paths.h
866         semaphore.h
867         setjmp.h
868         signal.h
869         stdarg.h
870         stdint.h
871         stdlib.h
872         termios.h
873         termio.h
874         unistd.h
875         utime.h
876         linux/falloc.h
877         linux/fd.h
878         linux/major.h
879         linux/loop.h
880         net/if_dl.h
881         netinet/in.h
882         sys/disklabel.h
883         sys/disk.h
884         sys/file.h
885         sys/ioctl.h
886         sys/mkdev.h
887         sys/mman.h
888         sys/mount.h
889         sys/prctl.h
890         sys/resource.h
891         sys/select.h
892         sys/socket.h
893         sys/sockio.h
894         sys/stat.h
895         sys/syscall.h
896         sys/sysmacros.h
897         sys/time.h
898         sys/types.h
899         sys/un.h
900         sys/wait.h
901 ]))
902 AC_CHECK_HEADERS(net/if.h,,,
903 [[
904 #if HAVE_SYS_TYPES_H
905 #include <sys/types.h>
906 #endif
907 #if HAVE_SYS_SOCKET
908 #include <sys/socket.h>
909 #endif
910 ]])
911 AC_FUNC_VPRINTF
912 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
913 dnl is not decleared.
914 AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT, 1,
915                        [Define to 1 if dirent has d_reclen])],,
916                 [#include <dirent.h>])
917 AC_CHECK_MEMBERS([struct stat.st_atim])
918 dnl Check to see if ssize_t was declared
919 AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T, 1,
920                 [Define to 1 if ssize_t declared])],,
921               [#include <sys/types.h>])
922 dnl
923 dnl Check to see if llseek() is declared in unistd.h.  On some libc's 
924 dnl it is, and on others it isn't..... Thank you glibc developers....
925 dnl
926 AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1,
927                         [Define to 1 if llseek declared in unistd.h])],,
928               [#include <unistd.h>])
929 dnl
930 dnl Check to see if lseek64() is declared in unistd.h.  Glibc's header files
931 dnl are so convoluted that I can't tell whether it will always be defined,
932 dnl and if it isn't defined while lseek64 is defined in the library, 
933 dnl disaster will strike.  
934 dnl
935 dnl Warning!  Use of --enable-gcc-wall may throw off this test.
936 dnl
937 dnl
938 AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
939                         [Define to 1 if lseek64 declared in unistd.h])],,
940                 [#define _LARGEFILE_SOURCE
941                  #define _LARGEFILE64_SOURCE
942                  #include <unistd.h>])
943 dnl
944 dnl Word sizes...
945 dnl
946 AC_CHECK_SIZEOF(short)
947 AC_CHECK_SIZEOF(int)
948 AC_CHECK_SIZEOF(long)
949 AC_CHECK_SIZEOF(long long)
950 AC_CHECK_SIZEOF(off_t)
951 SIZEOF_SHORT=$ac_cv_sizeof_short
952 SIZEOF_INT=$ac_cv_sizeof_int
953 SIZEOF_LONG=$ac_cv_sizeof_long
954 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
955 SIZEOF_OFF_T=$ac_cv_sizeof_off_t
956 AC_SUBST(SIZEOF_SHORT)
957 AC_SUBST(SIZEOF_INT)
958 AC_SUBST(SIZEOF_LONG)
959 AC_SUBST(SIZEOF_LONG_LONG)
960 AC_SUBST(SIZEOF_OFF_T)
961 AC_C_BIGENDIAN
962 if test $cross_compiling = no; then
963   BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
964 else
965   CROSS_COMPILE="1" BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
966 fi
967 ASM_TYPES_HEADER=./asm_types.h
968 AC_SUBST_FILE(ASM_TYPES_HEADER)
969 dnl
970 dnl Save the configuration #defines needed for the public ext2fs.h
971 dnl header file
972 dnl
973 echo "/* These defines are needed for the public ext2fs.h header file */" \
974      > public_config.h
975 if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
976   uniq tmp_config.$$ >> public_config.h
977 else
978   echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
979 fi
980 if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
981   uniq tmp_config.$$ >> public_config.h
982 else
983   echo "#undef WORDS_BIGENDIAN" >> public_config.h
984 fi
985 rm -f tmp_config.$$
986 PUBLIC_CONFIG_HEADER=./public_config.h
987 AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
988 dnl
989 dnl See if we have inttypes.h and if intptr_t is defined
990 dnl
991 AC_CHECK_HEADERS([inttypes.h])
992 AC_CHECK_TYPES(intptr_t)
993 dnl
994 dnl See if struct stat has a st_flags field, in which case we can get file
995 dnl flags somewhat portably.  Also check for the analogous setter, chflags().
996 dnl
997 AC_MSG_CHECKING(whether struct stat has a st_flags field)
998 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
999         AC_TRY_COMPILE([#include <sys/stat.h>],
1000                 [struct stat stat; stat.st_flags = 0;],
1001                 [e2fsprogs_cv_struct_st_flags=yes],
1002                 [e2fsprogs_cv_struct_st_flags=no]))
1003 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
1004 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
1005   AC_MSG_CHECKING(whether st_flags field is useful)
1006   AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
1007         AC_TRY_COMPILE([#include <sys/stat.h>],
1008                 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
1009                 [e2fsprogs_cv_struct_st_flags_immut=yes],
1010                 [e2fsprogs_cv_struct_st_flags_immut=no]))
1011   AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
1012   if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
1013           AC_DEFINE(HAVE_STAT_FLAGS, 1,
1014                 [Define to 1 if struct stat has st_flags])
1015   fi
1016 fi
1017 dnl
1018 dnl Check for the presence of SA_LEN
1019 dnl
1020 AC_CHECK_MEMBER(struct sockaddr.sa_len,
1021                 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,
1022                         [Define to 1 if if struct sockaddr contains sa_len]),,
1023         [#include <sys/types.h>
1024          #include <sys/socket.h>])
1025 dnl
1026 dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using
1027 dnl the system-provided blkid library
1028 dnl
1029 if test -n "$BLKID_CMT"; then
1030   AC_SEARCH_LIBS([blkid_probe_all], [blkid])
1031 fi
1032 dnl
1033 AC_CHECK_FUNCS(m4_flatten([
1034         __secure_getenv
1035         backtrace
1036         blkid_probe_get_topology
1037         blkid_probe_enable_partitions
1038         chflags
1039         fadvise64
1040         fallocate
1041         fallocate64
1042         fchown
1043         fdatasync
1044         fstat64
1045         ftruncate64
1046         futimes
1047         getcwd
1048         getdtablesize
1049         getmntinfo
1050         getpwuid_r
1051         getrlimit
1052         getrusage
1053         jrand48
1054         llseek
1055         lseek64
1056         mallinfo
1057         mbstowcs
1058         memalign
1059         mempcpy
1060         mmap
1061         msync
1062         nanosleep
1063         open64
1064         pathconf
1065         posix_fadvise
1066         posix_fadvise64
1067         posix_memalign
1068         prctl
1069         pread
1070         pwrite
1071         pread64
1072         pwrite64
1073         secure_getenv
1074         setmntent
1075         setresgid
1076         setresuid
1077         snprintf
1078         srandom
1079         stpcpy
1080         strcasecmp
1081         strdup
1082         strnlen
1083         strptime
1084         strtoull
1085         sync_file_range
1086         sysconf
1087         usleep
1088         utime
1089         utimes
1090         valloc
1091 ]))
1092 dnl
1093 dnl Check to see if -lsocket is required (solaris) to make something
1094 dnl that uses socket() to compile; this is needed for the UUID library
1095 dnl
1096 SOCKET_LIB=''
1097 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
1098 AC_SUBST(SOCKET_LIB)
1099 dnl
1100 dnl See if optreset exists
1101 dnl
1102 AC_MSG_CHECKING(for optreset)
1103 AC_CACHE_VAL(ac_cv_have_optreset,
1104 [AC_EGREP_HEADER(optreset, unistd.h,
1105   ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
1106 AC_MSG_RESULT($ac_cv_have_optreset)
1107 if test $ac_cv_have_optreset = yes; then
1108   AC_DEFINE(HAVE_OPTRESET, 1, [Define to 1 if optreset for getopt is present])
1109 fi
1110 dnl
1111 dnl Test for sem_init, and which library it might require:
1112 dnl
1113 AH_TEMPLATE([HAVE_SEM_INIT], [Define to 1 if sem_init() exists])
1114 SEM_INIT_LIB=''
1115 AC_CHECK_FUNC(sem_init, ,
1116   AC_CHECK_LIB(pthread, sem_init,
1117         AC_DEFINE(HAVE_SEM_INIT, 1)
1118         SEM_INIT_LIB=-lpthread,
1119   AC_CHECK_LIB(rt, sem_init,
1120         AC_DEFINE(HAVE_SEM_INIT, 1)
1121         SEM_INIT_LIB=-lrt,
1122   AC_CHECK_LIB(posix4, sem_init,
1123         AC_DEFINE(HAVE_SEM_INIT, 1)
1124         SEM_INIT_LIB=-lposix4))))dnl
1125 AC_SUBST(SEM_INIT_LIB)
1126 dnl
1127 dnl Check for unified diff
1128 dnl
1129 AC_MSG_CHECKING(for unified diff option)
1130 if diff -u $0 $0 > /dev/null 2>&1 ; then
1131    UNI_DIFF_OPTS=-u
1132 else
1133    UNI_DIFF_OPTS=-c
1134 fi
1135 AC_MSG_RESULT($UNI_DIFF_OPTS)
1136 AC_SUBST(UNI_DIFF_OPTS)
1137 dnl
1138 dnl We use the EXT2 ioctls only under Linux
1139 dnl
1140 case "$host_os" in
1141 linux*)
1142         AC_DEFINE(HAVE_EXT2_IOCTLS, 1, [Define to 1 if Ext2 ioctls present])
1143         ;;
1144 esac
1145 dnl
1146 dnl OS-specific uncomment control
1147 dnl
1148 LINUX_CMT="#"
1149 CYGWIN_CMT="#"
1150 UNIX_CMT=
1151 case "$host_os" in
1152 linux*)
1153         LINUX_CMT=
1154         ;;
1155 cygwin)
1156         CYGWIN_CMT=
1157         UNIX_CMT="#"
1158         ;;
1159 esac
1160 AC_SUBST(LINUX_CMT)
1161 AC_SUBST(CYGWIN_CMT)
1162 AC_SUBST(UNIX_CMT)
1163 dnl
1164 dnl Linux and Hurd places root files in the / by default
1165 dnl
1166 case "$host_os" in
1167 linux* | gnu* | k*bsd*-gnu)
1168         if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
1169                 root_prefix="";
1170                 AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
1171         fi
1172         ;;
1173 esac
1174 dnl
1175 dnl On Linux/hurd, force the prefix to be /usr
1176 dnl
1177 case "$host_os" in
1178 linux* | gnu* | k*bsd*-gnu)
1179         if test "$prefix" = NONE ; then
1180                 prefix="/usr";
1181                 AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
1182                 if test "$mandir" = '${prefix}/man' ; then
1183                         AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
1184                         mandir=/usr/share/man
1185                 fi
1186         fi
1187 ;;
1188 esac
1189 if test "$root_prefix" = NONE ; then
1190         if test "$prefix" = NONE ; then
1191                 root_prefix="$ac_default_prefix"
1192         else
1193                 root_prefix="$prefix"
1194         fi
1195         root_bindir=$bindir
1196         root_sbindir=$sbindir
1197         root_libdir=$libdir
1198         root_sysconfdir=$sysconfdir
1199 else
1200         root_bindir='${root_prefix}/bin'
1201         root_sbindir='${root_prefix}/sbin'
1202         root_libdir='${root_prefix}/lib'
1203         root_sysconfdir='${root_prefix}/etc'
1204 fi
1205 if test "$bindir" != '${exec_prefix}/bin'; then
1206     root_bindir=$bindir
1207     AC_MSG_RESULT([Setting root_bindir to $root_bindir])
1208 fi
1209 if test "$sbindir" != '${exec_prefix}/sbin'; then
1210     root_sbindir=$sbindir
1211     AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
1212 fi
1213 if test "$libdir" != '${exec_prefix}/lib'; then
1214     root_libdir=$libdir
1215     AC_MSG_RESULT([Setting root_libdir to $root_libdir])
1216 fi
1217 if test "$sysconfdir" != '${prefix}/etc'; then
1218     root_sysconfdir=$sysconfdir
1219     AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
1220 fi
1221 AC_SUBST(root_prefix)
1222 AC_SUBST(root_bindir)
1223 AC_SUBST(root_sbindir)
1224 AC_SUBST(root_libdir)
1225 AC_SUBST(root_sysconfdir)
1226 dnl
1227 dnl Allow specification of the multiarch arch
1228 dnl
1229 AC_ARG_WITH([multiarch],
1230 [  --with-multiarch=ARCH specify the multiarch triplet],
1231 if test "$withval" = "lib64"; then
1232     libdir=/usr/lib64
1233     root_libdir=/lib64
1234 else
1235     libdir=$libdir/$withval
1236     root_libdir=$root_libdir/$withval
1237 fi
1238 )dnl
1239 dnl
1240 dnl See if -static works.  This could fail if the linker does not
1241 dnl support -static, or if required external libraries are not available
1242 dnl in static form.
1243 dnl
1244 AC_MSG_CHECKING([whether we can link with -static])
1245 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
1246 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
1247 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
1248  ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
1249 LDFLAGS=$SAVE_LDFLAGS])
1250 dnl
1251 dnl Regardless of how the test turns out, Solaris doesn't handle -static
1252 dnl This is caused by the socket library requiring the nsl library, which
1253 dnl requires the -dl library, which only works for dynamically linked 
1254 dnl programs.  It basically means you can't have statically linked programs
1255 dnl which use the network under Solaris.  
1256 dnl
1257 case "$host_os" in
1258 solaris2.*)
1259         ac_cv_e2fsprogs_use_static=no   
1260 ;;
1261 esac
1262 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
1263 LDFLAG_STATIC=
1264 if test $ac_cv_e2fsprogs_use_static = yes; then
1265         LDFLAG_STATIC=-static
1266 fi
1267 AC_SUBST(LDFLAG_STATIC)
1268 dnl
1269 dnl Work around mysterious Darwin / GNU libintl problem
1270 dnl (__asm__ redirection doesn't work for some mysterious reason.  Looks like
1271 dnl Apple hacked gcc somehow?)
1272 dnl
1273 case "$host_os" in
1274 darwin*)
1275         AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
1276         AC_DEFINE(_INTL_REDIRECT_MACROS, 1,
1277                 [Define to 1 if Apple Darwin libintl workaround is needed])
1278         ;;
1279 esac
1280 dnl
1281 dnl Make the ss and et directories work correctly.
1282 dnl
1283 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
1284 ET_DIR=`cd ${srcdir}/lib/et; pwd`
1285 AC_SUBST(SS_DIR)
1286 AC_SUBST(ET_DIR)
1287 dnl
1288 dnl Only try to run the test suite if we're not cross compiling.
1289 dnl
1290 if test "$cross_compiling" = yes ; then
1291   DO_TEST_SUITE=
1292 else
1293   DO_TEST_SUITE=check
1294 fi
1295 AC_SUBST(DO_TEST_SUITE)
1296 dnl
1297 dnl Only include the intl include files if we're building with them
1298 dnl
1299 INCLUDES='-I. -I$(top_builddir)/lib -I$(top_srcdir)/lib'
1300 if test -n "$CPPFLAGS" ; then
1301         INCLUDES="$INCLUDES $CPPFLAGS"
1302 fi
1303 if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
1304         INCLUDES=$INCLUDES' -I$(top_builddir)/intl -I$(top_srcdir)/intl'
1305 fi
1306 if test -n "$WITH_DIET_LIBC" ; then
1307         INCLUDES="$INCLUDES -D_REENTRANT"
1308 fi
1309 AC_SUBST(INCLUDES)
1310 AM_MKINSTALLDIRS
1311 dnl
1312 dnl Build CFLAGS
1313 dnl
1314 if test $cross_compiling = no; then
1315    BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
1316    BUILD_LDFLAGS="$LDFLAGS"
1317 fi
1318 AC_SUBST(BUILD_CFLAGS)
1319 AC_SUBST(BUILD_LDFLAGS)
1320 dnl
1321 dnl Make our output files, being sure that we create the some miscellaneous 
1322 dnl directories
1323 dnl
1324 test -d lib || mkdir lib
1325 test -d include || mkdir include
1326 test -d include/linux || mkdir include/linux
1327 test -d include/asm || mkdir include/asm
1328 for i in MCONFIG Makefile e2fsprogs.spec \
1329         e2fsprogs-RHEL-6.spec \
1330         e2fsprogs-SUSE_LINUX-11.spec \
1331         util/Makefile util/subst.conf util/gen-tarball util/install-symlink \
1332         lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
1333         lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
1334         lib/uuid/Makefile lib/uuid/uuid_types.h \
1335         lib/blkid/Makefile lib/blkid/blkid_types.h lib/quota/Makefile \
1336         lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
1337         lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
1338         misc/Makefile ext2ed/Makefile e2fsck/Makefile \
1339         debugfs/Makefile tests/Makefile tests/progs/Makefile \
1340         resize/Makefile doc/Makefile intl/Makefile \
1341         intl/libgnuintl.h po/Makefile.in ; do
1342         if test -d `dirname ${srcdir}/$i` ; then
1343                 outlist="$outlist $i"
1344         fi
1345 done
1346 AC_OUTPUT($outlist)
1347 if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi