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