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