blob: 2534df4c1e55ee8281abbc68791f7d82e4b54f19 [file] [log] [blame]
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001AC_INIT(version.h)
Theodore Ts'ob0cacab2004-11-30 19:00:19 -05002AC_PREREQ(2.50)
3AC_CONFIG_AUX_DIR(config)
Theodore Ts'o50e1e101997-04-26 13:58:21 +00004MCONFIG=./MCONFIG
5AC_SUBST_FILE(MCONFIG)
Theodore Ts'o74becf31997-04-26 14:37:06 +00006BINARY_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 \" " "`
Theodore Ts'obff0cc92003-03-23 01:37:53 -050014E2FSPROGS_DAY=`echo $DATE | awk -F- '{print $1}'`
Theodore Ts'o74becf31997-04-26 14:37:06 +000015MONTH=`echo $DATE | awk -F- '{print $2}'`
16YEAR=`echo $DATE | awk -F- '{print $3}'`
17
Theodore Ts'o40fa8cc1999-01-09 05:06:02 +000018if expr $YEAR ">" 1900 > /dev/null ; then
19 E2FSPROGS_YEAR=$YEAR
20elif expr $YEAR ">" 90 >/dev/null ; then
Theodore Ts'o74becf31997-04-26 14:37:06 +000021 E2FSPROGS_YEAR=19$YEAR
22else
23 E2FSPROGS_YEAR=20$YEAR
24fi
25
26case $MONTH in
Andreas Dilger927566a2006-11-12 19:41:25 -050027Jan) 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" ;;
Theodore Ts'o02d04db2008-08-22 10:52:42 -040039*) AC_MSG_WARN([Unknown month $MONTH??]) ;;
Theodore Ts'o74becf31997-04-26 14:37:06 +000040esac
41
Andreas Dilger927566a2006-11-12 19:41:25 -050042base_ver=`echo $E2FSPROGS_VERSION | \
43 sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
Andreas Dilger927566a2006-11-12 19:41:25 -050044
45date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
46
47case $E2FSPROGS_VERSION in
48*-WIP|pre-*)
Theodore Ts'oab063962008-07-07 16:07:43 -040049 E2FSPROGS_PKGVER="$base_ver~WIP-$E2FSPROGS_YEAR-$MONTH_NUM-$E2FSPROGS_DAY"
Andreas Dilger927566a2006-11-12 19:41:25 -050050 ;;
51*)
52 E2FSPROGS_PKGVER="$base_ver"
53 ;;
54esac
55
56unset DATE MONTH YEAR base_ver pre_vers date_spec
Theodore Ts'o02d04db2008-08-22 10:52:42 -040057AC_MSG_RESULT([Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION])
58AC_MSG_RESULT([Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}])
Theodore Ts'o74becf31997-04-26 14:37:06 +000059AC_SUBST(E2FSPROGS_YEAR)
60AC_SUBST(E2FSPROGS_MONTH)
Theodore Ts'obff0cc92003-03-23 01:37:53 -050061AC_SUBST(E2FSPROGS_DAY)
Theodore Ts'o74becf31997-04-26 14:37:06 +000062AC_SUBST(E2FSPROGS_VERSION)
Andreas Dilger927566a2006-11-12 19:41:25 -050063AC_SUBST(E2FSPROGS_PKGVER)
Theodore Ts'oea97be52001-09-19 15:20:12 -040064AC_CANONICAL_HOST
Theodore Ts'o74becf31997-04-26 14:37:06 +000065dnl
Theodore Ts'od21ae6c2003-05-05 09:00:24 -040066dnl Use diet libc
67dnl
Theodore Ts'oeafba6c2008-07-10 10:21:42 -040068WITH_DIET_LIBC=
Theodore Ts'od21ae6c2003-05-05 09:00:24 -040069AC_ARG_WITH([diet-libc],
Theodore Ts'o32493942007-12-31 10:45:01 -050070[ --with-diet-libc use diet libc],
Theodore Ts'od21ae6c2003-05-05 09:00:24 -040071CC="diet cc -nostdinc"
Theodore Ts'oeafba6c2008-07-10 10:21:42 -040072WITH_DIET_LIBC=yes
Theodore Ts'od21ae6c2003-05-05 09:00:24 -040073AC_MSG_RESULT(CC=$CC))dnl
74dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +000075dnl set $(CC) from --with-cc=value
76dnl
77AC_ARG_WITH([cc],
78[ --with-cc=COMPILER select compiler to use],
79AC_MSG_RESULT(CC=$withval)
80CC=$withval,
81if test -z "$CC" ; then CC=cc; fi
82[AC_MSG_RESULT(CC defaults to $CC)])dnl
83export CC
84AC_SUBST([CC])
Theodore Ts'o73ae2d42000-02-02 16:13:14 +000085AC_PROG_CC
Theodore Ts'o29a5dee2007-07-04 16:28:47 -040086AC_PROG_CPP
Theodore Ts'o74becf31997-04-26 14:37:06 +000087dnl
88dnl set $(LD) from --with-linker=value
89dnl
90AC_ARG_WITH([linker],
91[ --with-linker=LINKER select linker to use],
92AC_MSG_RESULT(LD=$withval)
93LD=$withval,
94if test -z "$LD" ; then LD=$CC; fi
95[AC_MSG_RESULT(LD defaults to $LD)])dnl
96export LD
97AC_SUBST([LD])
98dnl
99dnl set $(CCOPTS) from --with-ccopts=value
100dnl
101AC_ARG_WITH([ccopts],
102[ --with-ccopts=CCOPTS select compiler command line options],
103AC_MSG_RESULT(CCOPTS is $withval)
Theodore Ts'o877eb6d2001-06-11 06:54:13 +0000104CFLAGS=$withval,
105)dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000106dnl
Theodore Ts'of8bd9801999-10-26 04:19:45 +0000107dnl On systems without linux header files, we add an extra include directory
108dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
109dnl is quoted so that it gets expanded by make, not by configure.
110dnl
111AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
Theodore Ts'o73ae2d42000-02-02 16:13:14 +0000112if test "$linux_headers" != yes; then
113 LINUX_INCLUDE='-I$(top_builddir)/include'
Theodore Ts'of8bd9801999-10-26 04:19:45 +0000114fi
115AC_SUBST(LINUX_INCLUDE)
116dnl
Matthias Andreeb1c92f92004-02-23 21:30:11 +0100117dnl Alpha computers use fast and imprecise floating point code that may
118dnl miss exceptions by default. Force sane options if we're using GCC.
119AC_MSG_CHECKING(for additional special compiler flags)
120if test "$GCC" = yes
121then
122 case "$host_cpu" in
123 alpha) addcflags="-mieee" ;;
124 esac
125fi
126if test "x$addcflags" != x
127then
128 AC_MSG_RESULT($addcflags)
129 CFLAGS="$addcflags $CFLAGS"
130else
131 AC_MSG_RESULT([[(none)]])
132fi
133dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000134dnl Set default values for library extentions. Will be dealt with after
135dnl parsing configuration opions, which may modify these
136dnl
137LIB_EXT=.a
138STATIC_LIB_EXT=.a
139PROFILE_LIB_EXT=.a
140dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000141dnl set $(LDFLAGS) from --with-ldopts=value
142dnl
143AC_ARG_WITH([ldopts],
144[ --with-ldopts=LDOPTS select linker command line options],
145AC_MSG_RESULT(LDFLAGS is $withval)
146LDFLAGS=$withval,
Theodore Ts'o1aaaa822008-08-22 12:26:07 -0400147)dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000148AC_SUBST(LDFLAGS)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000149dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000150dnl Allow separate `root_prefix' to be specified
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000151dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000152AC_ARG_WITH([root-prefix],
153[ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
154root_prefix=$withval,
155root_prefix=NONE)dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000156dnl
Theodore Ts'o98919bd2005-02-04 10:43:58 -0500157dnl handle --enable-maintainer-mode
158dnl
159AC_ARG_ENABLE([maintainer-mode],
160[ --enable-maintainer-mode enable makefile rules useful for maintainers],
161if test "$enableval" = "no"
162then
163 MAINTAINER_CMT=#
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400164 AC_MSG_RESULT([Disabling maintainer mode])
Theodore Ts'o98919bd2005-02-04 10:43:58 -0500165else
166 MAINTAINER_CMT=
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400167 AC_MSG_RESULT([Enabling maintainer mode])
Theodore Ts'o98919bd2005-02-04 10:43:58 -0500168fi
169,
170MAINTAINER_CMT=#
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400171AC_MSG_RESULT([Disabling maintainer mode by default])
Theodore Ts'o98919bd2005-02-04 10:43:58 -0500172)
173AC_SUBST(MAINTAINER_CMT)
174dnl
Theodore Ts'o19178752000-02-11 15:55:07 +0000175dnl handle --enable-compression
176dnl
177AC_ARG_ENABLE([compression],
178[ --enable-compression enable EXPERIMENTAL compression support],
179if test "$enableval" = "no"
180then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400181 AC_MSG_RESULT([Disabling compression support])
Theodore Ts'o19178752000-02-11 15:55:07 +0000182else
183 AC_DEFINE(ENABLE_COMPRESSION)
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400184 AC_MSG_RESULT([Enabling compression support])
185 AC_MSG_WARN([Compression support is experimental])
Theodore Ts'o19178752000-02-11 15:55:07 +0000186fi
187,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400188AC_MSG_RESULT([Disabling compression support by default])
Theodore Ts'o19178752000-02-11 15:55:07 +0000189)
190dnl
Theodore Ts'o8fdc9982002-06-25 23:26:34 -0400191dnl handle --enable-htree
192dnl
193AC_ARG_ENABLE([htree],
194[ --enable-htree enable EXPERIMENTAL htree directory support],
195if test "$enableval" = "no"
196then
197 HTREE_CMT=#
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400198 AC_MSG_RESULT([Disabling htree directory support])
Theodore Ts'o8fdc9982002-06-25 23:26:34 -0400199else
200 HTREE_CMT=
201 AC_DEFINE(ENABLE_HTREE)
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400202 AC_MSG_RESULT([Enabling htree directory support])
Theodore Ts'o8fdc9982002-06-25 23:26:34 -0400203fi
204,
Theodore Ts'o559ca6c2002-08-18 03:48:55 -0400205HTREE_CMT=
206AC_DEFINE(ENABLE_HTREE)
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400207AC_MSG_RESULT([Enabling htree directory support by default])
Theodore Ts'o8fdc9982002-06-25 23:26:34 -0400208)
209AC_SUBST(HTREE_CMT)
210dnl
Theodore Ts'oa4ece352008-01-01 20:05:04 -0500211dnl This needs to be before all of the --enable-*-shlibs options
212dnl
213E2_PKG_CONFIG_STATIC=--static
Theodore Ts'o55da9872008-09-02 23:12:38 -0400214LDFLAG_DYNAMIC=
215PRIVATE_LIBS_CMT=
Theodore Ts'oa4ece352008-01-01 20:05:04 -0500216dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000217dnl handle --enable-elf-shlibs
218dnl
219AC_ARG_ENABLE([elf-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000220[ --enable-elf-shlibs select ELF shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000221if test "$enableval" = "no"
222then
223 ELF_CMT=#
224 MAKEFILE_ELF=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400225 AC_MSG_RESULT([Disabling ELF shared libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000226else
Theodore Ts'oa4ece352008-01-01 20:05:04 -0500227 E2_PKG_CONFIG_STATIC=
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000228 ELF_CMT=
229 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
Theodore Ts'of5955dd2000-10-25 02:38:39 +0000230 [case "$host_os" in
231 solaris2.*)
232 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
233 ;;
234 esac]
Theodore Ts'o74becf31997-04-26 14:37:06 +0000235 BINARY_TYPE=elfbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000236 LIB_EXT=.so
Theodore Ts'o55da9872008-09-02 23:12:38 -0400237 PRIVATE_LIBS_CMT=#
238 LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib']
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400239 AC_MSG_RESULT([Enabling ELF shared libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000240fi
241,
242MAKEFILE_ELF=/dev/null
243ELF_CMT=#
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400244AC_MSG_RESULT([Disabling ELF shared libraries by default])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000245)
246AC_SUBST(ELF_CMT)
247AC_SUBST_FILE(MAKEFILE_ELF)
248dnl
249dnl handle --enable-bsd-shlibs
250dnl
251AC_ARG_ENABLE([bsd-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000252[ --enable-bsd-shlibs select BSD shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000253if test "$enableval" = "no"
254then
255 BSDLIB_CMT=#
256 MAKEFILE_BSDLIB=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400257 AC_MSG_RESULT([Disabling BSD shared libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000258else
Theodore Ts'oa4ece352008-01-01 20:05:04 -0500259 E2_PKG_CONFIG_STATIC=
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000260 BSDLIB_CMT=
261 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000262 LIB_EXT=.so
Theodore Ts'oe71d8732003-03-14 02:13:48 -0500263 [case "$host_os" in
Theodore Ts'oaa75ecc2003-03-17 10:01:22 -0500264 darwin*)
Theodore Ts'oe71d8732003-03-14 02:13:48 -0500265 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
266 LIB_EXT=.dylib
267 ;;
268 esac]
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400269 AC_MSG_RESULT([Enabling BSD shared libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000270fi
271,
272MAKEFILE_BSDLIB=/dev/null
273BSDLIB_CMT=#
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400274AC_MSG_RESULT([Disabling BSD shared libraries by default])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000275)
276AC_SUBST(BSDLIB_CMT)
277AC_SUBST_FILE(MAKEFILE_BSDLIB)
278dnl
279dnl handle --enable-profile
280dnl
281AC_ARG_ENABLE([profile],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000282[ --enable-profile build profiling libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000283if test "$enableval" = "no"
284then
285 PROFILE_CMT=#
286 MAKEFILE_PROFILE=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400287 AC_MSG_RESULT([Disabling profiling libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000288else
289 PROFILE_CMT=
290 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000291 PROFILED_LIB_EXT=_p.a
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400292 AC_MSG_RESULT([Building profiling libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000293fi
294,
295PROFILE_CMT=#
296MAKEFILE_PROFILE=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400297AC_MSG_RESULT([Disabling profiling libraries by default])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000298)
299AC_SUBST(PROFILE_CMT)
300AC_SUBST_FILE(MAKEFILE_PROFILE)
301dnl
302dnl handle --enable-checker
303dnl
304AC_ARG_ENABLE([checker],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000305[ --enable-checker build checker libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000306if test "$enableval" = "no"
307then
308 CHECKER_CMT=#
309 MAKEFILE_CHECKER=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400310 AC_MSG_RESULT([Disabling checker libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000311else
312 CHECKER_CMT=
313 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400314 AC_MSG_RESULT([Building checker libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000315fi
316,
317CHECKER_CMT=#
318MAKEFILE_CHECKER=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400319AC_MSG_RESULT([Disabling checker libraries by default])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000320)
321AC_SUBST(CHECKER_CMT)
322AC_SUBST_FILE(MAKEFILE_CHECKER)
323dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000324dnl Substitute library extensions
325dnl
326AC_SUBST(LIB_EXT)
327AC_SUBST(STATIC_LIB_EXT)
328AC_SUBST(PROFILED_LIB_EXT)
Theodore Ts'o55da9872008-09-02 23:12:38 -0400329AC_SUBST(LDFLAG_DYNAMIC)
330AC_SUBST(PRIVATE_LIBS_CMT)
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000331dnl
Theodore Ts'o782bebf2002-11-08 18:46:45 -0500332dnl handle --enable-jbd-debug
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000333dnl
Theodore Ts'o782bebf2002-11-08 18:46:45 -0500334AC_ARG_ENABLE([jbd-debug],
335[ --enable-jbd-debug enable journal debugging],
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000336if test "$enableval" = "no"
337then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400338 AC_MSG_RESULT([Disabling journal debugging])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000339else
Theodore Ts'o8cf93332001-12-16 02:23:36 -0500340 AC_DEFINE(CONFIG_JBD_DEBUG)
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400341 AC_MSG_RESULT([Enabling journal debugging])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000342fi
343,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400344AC_MSG_RESULT([Disabling journal debugging by default])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000345)
346dnl
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500347dnl handle --enable-blkid-debug
348dnl
349AC_ARG_ENABLE([blkid-debug],
Theodore Ts'od21ae6c2003-05-05 09:00:24 -0400350[ --enable-blkid-debug enable blkid debugging],
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500351if test "$enableval" = "no"
352then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400353 AC_MSG_RESULT([Disabling blkid debugging])
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500354else
355 AC_DEFINE(CONFIG_BLKID_DEBUG)
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400356 AC_MSG_RESULT([Enabling blkid debugging])
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500357fi
358,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400359AC_MSG_RESULT([Disabling blkid debugging by default])
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500360)
361dnl
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400362dnl handle --enable-testio-debug
363dnl
364AC_ARG_ENABLE([testio-debug],
Theodore Ts'oaf773652008-09-01 11:27:27 -0400365[ --disable-testio-debug disable the use of the test I/O manager for debugging],
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400366if test "$enableval" = "no"
367then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400368 AC_MSG_RESULT([Disabling testio debugging])
Theodore Ts'oaf773652008-09-01 11:27:27 -0400369 TEST_IO_CMT="#"
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400370else
Theodore Ts'oaf773652008-09-01 11:27:27 -0400371 TEST_IO_CMT=
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400372 AC_DEFINE(CONFIG_TESTIO_DEBUG)
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400373 AC_MSG_RESULT([Enabling testio debugging])
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400374fi
375,
Theodore Ts'oaf773652008-09-01 11:27:27 -0400376AC_MSG_RESULT([Enabling testio debugging by default])
377AC_DEFINE(CONFIG_TESTIO_DEBUG)
378TEST_IO_CMT=
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400379)
Theodore Ts'oaf773652008-09-01 11:27:27 -0400380AC_SUBST(TEST_IO_CMT)
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400381dnl
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000382dnl handle --enable-debugfs
383dnl
384AC_ARG_ENABLE([debugfs],
385[ --disable-debugfs disable support of debugfs program],
386if test "$enableval" = "no"
387then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400388 AC_MSG_RESULT([Disabling debugfs support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000389 DEBUGFS_CMT="#"
390else
391 DEBUGFS_CMT=
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400392 AC_MSG_RESULT([Enabling debugfs support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000393fi
394,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400395AC_MSG_RESULT([Enabling debugfs support by default])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000396DEBUGFS_CMT=
397)
398AC_SUBST(DEBUGFS_CMT)
399dnl
400dnl handle --enable-imager
401dnl
402AC_ARG_ENABLE([imager],
403[ --disable-imager disable support of e2image program],
404if test "$enableval" = "no"
405then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400406 AC_MSG_RESULT([Disabling e2image support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000407 IMAGER_CMT="#"
408else
409 IMAGER_CMT=
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400410 AC_MSG_RESULT([Enabling e2image support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000411fi
412,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400413AC_MSG_RESULT([Enabling e2image support by default])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000414IMAGER_CMT=
415)
416AC_SUBST(IMAGER_CMT)
417dnl
418dnl handle --enable-resizer
419dnl
420AC_ARG_ENABLE([resizer],
421[ --disable-resizer disable support of e2resize program],
422if test "$enableval" = "no"
423then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400424 AC_MSG_RESULT([Disabling e2resize support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000425 RESIZER_CMT="#"
426else
427 RESIZER_CMT=
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400428 AC_MSG_RESULT([Enabling e2resize support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000429fi
430,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400431AC_MSG_RESULT([Enabling e2resize support by default])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000432RESIZER_CMT=
433)
434AC_SUBST(RESIZER_CMT)
435dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000436dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
437dnl
438AC_ARG_ENABLE([fsck],
439[ --enable-fsck build fsck wrapper program],
440[if test "$enableval" = "no"
441then
442 FSCK_PROG='' FSCK_MAN=''
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400443 AC_MSG_RESULT([Not building fsck wrapper])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000444else
445 FSCK_PROG=fsck FSCK_MAN=fsck.8
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400446 AC_MSG_RESULT([Building fsck wrapper])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000447fi]
448,
449[case "$host_os" in
Theodore Ts'oe3632402004-05-04 19:39:54 -0400450 gnu*)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000451 FSCK_PROG='' FSCK_MAN=''
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400452 AC_MSG_RESULT([Not building fsck wrapper by default])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000453 ;;
454 *)
455 FSCK_PROG=fsck FSCK_MAN=fsck.8
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400456 AC_MSG_RESULT([Building fsck wrapper by default])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000457esac]
458)
459AC_SUBST(FSCK_PROG)
460AC_SUBST(FSCK_MAN)
461dnl
Theodore Ts'o5d407732004-09-18 14:53:14 -0400462dnl See whether to install the `e2initrd-helper' program
463dnl
464AC_ARG_ENABLE([e2initrd-helper],
465[ --enable-e2initrd-helper build e2initrd-helper program],
466[if test "$enableval" = "no"
467then
468 E2INITRD_PROG='' E2INITRD_MAN=''
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400469 AC_MSG_RESULT([Not building e2initrd helper])
Theodore Ts'o5d407732004-09-18 14:53:14 -0400470else
471 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400472 AC_MSG_RESULT([Building e2initrd helper])
Theodore Ts'o5d407732004-09-18 14:53:14 -0400473fi]
474,
475E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400476AC_MSG_RESULT([Building e2initrd helper by default])
Theodore Ts'o5d407732004-09-18 14:53:14 -0400477)
478AC_SUBST(E2INITRD_PROG)
479AC_SUBST(E2INITRD_MAN)
Karel Zak4db2f592006-03-08 14:17:28 -0500480dnl
Theodore Ts'o5d407732004-09-18 14:53:14 -0400481dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000482dnl
Theodore Ts'o32493942007-12-31 10:45:01 -0500483AC_ARG_ENABLE([tls],
484[ --disable-tls disable use of thread local support],
485[if test "$enableval" = "no"
486then
487 try_tls=""
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400488 AC_MSG_RESULT([Disabling thread local support])
Theodore Ts'o32493942007-12-31 10:45:01 -0500489else
490 try_tls="yes"
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400491 AC_MSG_RESULT([Enabling thread local support])
Theodore Ts'o32493942007-12-31 10:45:01 -0500492fi]
493,
Theodore Ts'oeafba6c2008-07-10 10:21:42 -0400494if test -n "$WITH_DIET_LIBC"
495then
496 try_tls=""
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400497 AC_MSG_RESULT([Diet libc does not support thread local support])
Theodore Ts'oeafba6c2008-07-10 10:21:42 -0400498else
499 try_tls="yes"
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400500 AC_MSG_RESULT([Try using thread local support by default])
Theodore Ts'oeafba6c2008-07-10 10:21:42 -0400501fi
Theodore Ts'o32493942007-12-31 10:45:01 -0500502)
503if test "$try_tls" = "yes"
504then
505AX_TLS
506fi
507dnl
508dnl
509dnl
Theodore Ts'o5610f992007-12-31 11:16:56 -0500510AC_ARG_ENABLE([uuidd],
511[ --disable-uuidd disable building the uuid daemon],
512[if test "$enableval" = "no"
513then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400514 AC_MSG_RESULT([Not building uuidd])
Theodore Ts'o5610f992007-12-31 11:16:56 -0500515 UUIDD_CMT="#"
516else
517 AC_DEFINE(USE_UUIDD)
518 UUIDD_CMT=""
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400519 AC_MSG_RESULT([Building uuidd])
Theodore Ts'o5610f992007-12-31 11:16:56 -0500520fi]
521,
522AC_DEFINE(USE_UUIDD)
523UUIDD_CMT=""
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400524AC_MSG_RESULT([Building uuidd by default])
Theodore Ts'o5610f992007-12-31 11:16:56 -0500525)
526AC_SUBST(UUIDD_CMT)
527dnl
528dnl
529dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000530MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
531AC_SUBST_FILE(MAKEFILE_LIBRARY)
532dnl
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000533dnl Add internationalization support, using gettext.
534dnl
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500535GETTEXT_PACKAGE=e2fsprogs
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000536PACKAGE=e2fsprogs
537VERSION="$E2FSPROGS_VERSION"
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500538VERSION=0.14.1
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000539AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
540AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500541AC_SUBST(GETTEXT_PACKAGE)
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000542AC_SUBST(PACKAGE)
543AC_SUBST(VERSION)
544
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000545AM_GNU_GETTEXT
546dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000547dnl End of configuration options
548dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000549AC_SUBST(BINARY_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000550AC_PROG_MAKE_SET
551AC_PATH_PROG(LN, ln, ln)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000552AC_PROG_LN_S
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000553AC_PATH_PROG(MV, mv, mv)
554AC_PATH_PROG(CP, cp, cp)
555AC_PATH_PROG(RM, rm, rm)
556AC_PATH_PROG(CHMOD, chmod, :)
Theodore Ts'o32237012005-01-17 19:13:39 -0500557AC_PROG_AWK
558AC_PROG_EGREP
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000559AC_PATH_PROG(SED, sed, sed)
Theodore Ts'o9d564f71999-07-03 20:25:58 +0000560AC_PATH_PROG(PERL, perl, perl)
Theodore Ts'o250f79f2001-05-19 22:02:22 +0000561AC_PATH_PROG(LDCONFIG, ldconfig, :)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000562AC_CHECK_TOOL(AR, ar, ar)
563AC_CHECK_TOOL(RANLIB, ranlib, :)
564AC_CHECK_TOOL(STRIP, strip, :)
Manish Katiyar7321d942008-04-14 17:20:03 +0530565AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
566if test "_$MAKEINFO" = "_"; then
567 MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
568else
569 case "$MAKEINFO" in
570 */missing.*)
571 AC_MSG_WARN([
572*** Makeinfo is missing. Info documentation will not be built.])
573 ;;
574 *)
575 ;;
576 esac
577fi
578AC_SUBST(MAKEINFO)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000579AC_PROG_INSTALL
Theodore Ts'o6c133521999-07-03 20:37:03 +0000580# See if we need a separate native compiler.
581if test $cross_compiling = no; then
582 BUILD_CC="$CC"
583 AC_SUBST(BUILD_CC)
584else
585 AC_CHECK_PROGS(BUILD_CC, gcc cc)
586fi
Theodore Ts'od7f45af2008-09-12 10:15:26 -0400587AC_CHECK_HEADERS(dirent.h errno.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h)
Theodore Ts'oda76d6b2005-01-18 23:29:01 -0500588AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
589[[
590#if HAVE_SYS_QUEUE_H
591#include <sys/queue.h>
592#endif
593]])
594AC_CHECK_HEADERS(net/if.h,,,
595[[
596#if HAVE_SYS_TYPES_H
597#include <sys/types.h>
598#endif
599#if HAVE_SYS_SOCKET
600#include <sys/socket.h>
601#endif
602]])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000603AC_FUNC_VPRINTF
Theodore Ts'offf45482003-04-13 00:44:19 -0400604dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
605dnl is not decleared.
Theodore Ts'o6c65d252005-01-19 12:59:48 -0500606AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT)],,
607 [#include <dirent.h>])
Theodore Ts'offf45482003-04-13 00:44:19 -0400608dnl Check to see if ssize_t was decleared
Theodore Ts'o6c65d252005-01-19 12:59:48 -0500609AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T)],,
610 [#include <sys/types.h>])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000611dnl
Theodore Ts'ob0b9c4d1997-10-20 23:36:30 +0000612dnl Check to see if llseek() is declared in unistd.h. On some libc's
613dnl it is, and on others it isn't..... Thank you glibc developers....
614dnl
Theodore Ts'o6c65d252005-01-19 12:59:48 -0500615AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)],,
616 [#include <unistd.h>])
Theodore Ts'ob0b9c4d1997-10-20 23:36:30 +0000617dnl
Theodore Ts'o6928adc2000-05-25 23:28:50 +0000618dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
619dnl are so convoluted that I can't tell whether it will always be defined,
620dnl and if it isn't defined while lseek64 is defined in the library,
621dnl disaster will strike.
622dnl
623dnl Warning! Use of --enable-gcc-wall may throw off this test.
624dnl
625dnl
Theodore Ts'o6c65d252005-01-19 12:59:48 -0500626AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)],,
627 [#define _LARGEFILE_SOURCE
628 #define _LARGEFILE64_SOURCE
629 #include <unistd.h>])
Theodore Ts'o6928adc2000-05-25 23:28:50 +0000630dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000631dnl Word sizes...
632dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000633AC_CHECK_SIZEOF(short)
634AC_CHECK_SIZEOF(int)
635AC_CHECK_SIZEOF(long)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000636AC_CHECK_SIZEOF(long long)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000637SIZEOF_SHORT=$ac_cv_sizeof_short
638SIZEOF_INT=$ac_cv_sizeof_int
639SIZEOF_LONG=$ac_cv_sizeof_long
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000640SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000641AC_SUBST(SIZEOF_SHORT)
642AC_SUBST(SIZEOF_INT)
643AC_SUBST(SIZEOF_LONG)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000644AC_SUBST(SIZEOF_LONG_LONG)
Theodore Ts'o877eb6d2001-06-11 06:54:13 +0000645AC_C_BIGENDIAN
Theodore Ts'o29a5dee2007-07-04 16:28:47 -0400646BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
Theodore Ts'o4ea7ea02006-04-09 08:41:55 -0400647ASM_TYPES_HEADER=./asm_types.h
648AC_SUBST_FILE(ASM_TYPES_HEADER)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000649dnl
Theodore Ts'o488c75a2008-06-07 08:55:21 -0400650dnl Save the configuration #defines needed for the public ext2fs.h
651dnl header file
652dnl
653echo "/* These defines are needed for the public ext2fs.h header file */" \
654 > public_config.h
655if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
656 uniq tmp_config.$$ >> public_config.h
657else
658 echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
659fi
660if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
661 uniq tmp_config.$$ >> public_config.h
662else
663 echo "#undef WORDS_BIGENDIAN" >> public_config.h
664fi
665rm -f tmp_config.$$
666PUBLIC_CONFIG_HEADER=./public_config.h
667AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
668dnl
Theodore Ts'o0c193f82003-08-01 14:26:23 -0400669dnl See if we have inttypes.h and if intptr_t is defined
670dnl
671AC_CHECK_HEADERS([inttypes.h])
Theodore Ts'od2ee56d2005-01-09 00:57:45 -0500672AC_CHECK_TYPES(intptr_t)
Theodore Ts'o0c193f82003-08-01 14:26:23 -0400673dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000674dnl See if struct stat has a st_flags field, in which case we can get file
675dnl flags somewhat portably. Also check for the analogous setter, chflags().
676dnl
677AC_MSG_CHECKING(whether struct stat has a st_flags field)
678AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
679 AC_TRY_COMPILE([#include <sys/stat.h>],
680 [struct stat stat; stat.st_flags = 0;],
681 [e2fsprogs_cv_struct_st_flags=yes],
682 [e2fsprogs_cv_struct_st_flags=no]))
683AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
684if test "$e2fsprogs_cv_struct_st_flags" = yes; then
Theodore Ts'oc03bc4e1999-10-20 18:20:36 +0000685 AC_MSG_CHECKING(whether st_flags field is useful)
686 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
687 AC_TRY_COMPILE([#include <sys/stat.h>],
688 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
689 [e2fsprogs_cv_struct_st_flags_immut=yes],
690 [e2fsprogs_cv_struct_st_flags_immut=no]))
691 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
692 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
693 AC_DEFINE(HAVE_STAT_FLAGS)
694 fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000695fi
Theodore Ts'o84ea6e72004-03-19 19:29:17 -0500696dnl
697dnl Check for the presence of SA_LEN
698dnl
Theodore Ts'o6c65d252005-01-19 12:59:48 -0500699AC_CHECK_MEMBER(struct sockaddr.sa_len,
700 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
701 [#include <sys/types.h>
702 #include <sys/socket.h>])
Theodore Ts'o84ea6e72004-03-19 19:29:17 -0500703dnl
Theodore Ts'oc13ab4f2008-07-13 16:17:57 -0400704AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid usleep nanosleep)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000705dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000706dnl Check to see if -lsocket is required (solaris) to make something
707dnl that uses socket() to compile; this is needed for the UUID library
708dnl
709SOCKET_LIB=''
710AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
711AC_SUBST(SOCKET_LIB)
712dnl
Theodore Ts'o3ae497e2003-03-16 06:26:25 -0500713dnl Check to see if libdl exists for the sake of dlopen
714dnl
715DLOPEN_LIB=''
716AC_CHECK_LIB(dl, dlopen,
717[DLOPEN_LIB=-ldl
718AC_DEFINE(HAVE_DLOPEN)])
719AC_SUBST(DLOPEN_LIB)
720dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000721dnl See if optreset exists
722dnl
723AC_MSG_CHECKING(for optreset)
724AC_CACHE_VAL(ac_cv_have_optreset,
725[AC_EGREP_HEADER(optreset, unistd.h,
726 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
727AC_MSG_RESULT($ac_cv_have_optreset)
728if test $ac_cv_have_optreset = yes; then
729 AC_DEFINE(HAVE_OPTRESET)
730fi
731dnl
Theodore Ts'od7f45af2008-09-12 10:15:26 -0400732dnl Test for sem_init, and which library it might require:
733dnl
734SEM_INIT_LIB=''
735AC_CHECK_FUNC(sem_init, ,
736 AC_CHECK_LIB(pthread, sem_init,
737 AC_DEFINE(HAVE_SEM_INIT)
738 SEM_INIT_LIB=-lpthread,
739 AC_CHECK_LIB(rt, sem_init,
740 AC_DEFINE(HAVE_SEM_INIT)
741 SEM_INIT_LIB=-lrt,
742 AC_CHECK_LIB(posix4, sem_init,
743 AC_DEFINE(HAVE_SEM_INIT)
744 SEM_INIT_LIB=-lposix4))))dnl
745AC_SUBST(SEM_INIT_LIB)
746dnl
Theodore Ts'oe54635d2006-08-06 14:33:13 -0400747dnl Check for unified diff
748dnl
749AC_MSG_CHECKING(for unified diff option)
Theodore Ts'o27f991b2008-04-01 20:32:55 -0400750if diff -u $0 $0 > /dev/null 2>&1 ; then
Theodore Ts'oe54635d2006-08-06 14:33:13 -0400751 UNI_DIFF_OPTS=-u
752else
753 UNI_DIFF_OPTS=-c
754fi
755AC_MSG_RESULT($UNI_DIFF_OPTS)
756AC_SUBST(UNI_DIFF_OPTS)
757dnl
Theodore Ts'o8f3f29d2000-02-11 05:04:44 +0000758dnl We use the EXT2 ioctls only under Linux
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000759dnl
Theodore Ts'o8f3f29d2000-02-11 05:04:44 +0000760case "$host_os" in
761linux*)
762 AC_DEFINE(HAVE_EXT2_IOCTLS)
763 ;;
764esac
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000765dnl
Theodore Ts'offf45482003-04-13 00:44:19 -0400766dnl OS-specific uncomment control
Theodore Ts'oe6f2bda2002-08-18 03:37:10 -0400767dnl
768LINUX_CMT="#"
Theodore Ts'offf45482003-04-13 00:44:19 -0400769CYGWIN_CMT="#"
770UNIX_CMT=
Theodore Ts'oe6f2bda2002-08-18 03:37:10 -0400771case "$host_os" in
772linux*)
773 LINUX_CMT=
774 ;;
Theodore Ts'offf45482003-04-13 00:44:19 -0400775cygwin)
776 CYGWIN_CMT=
777 UNIX_CMT="#"
Theodore Ts'offf45482003-04-13 00:44:19 -0400778 ;;
Theodore Ts'oe6f2bda2002-08-18 03:37:10 -0400779esac
780AC_SUBST(LINUX_CMT)
Theodore Ts'offf45482003-04-13 00:44:19 -0400781AC_SUBST(CYGWIN_CMT)
782AC_SUBST(UNIX_CMT)
Theodore Ts'oe6f2bda2002-08-18 03:37:10 -0400783dnl
Theodore Ts'o6c133521999-07-03 20:37:03 +0000784dnl Linux and Hurd places root files in the / by default
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000785dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000786case "$host_os" in
Theodore Ts'o93636bd2003-07-12 02:45:05 -0400787linux* | gnu* | k*bsd*-gnu)
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000788 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
789 root_prefix="";
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400790 AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000791 fi
792 ;;
793esac
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000794dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000795dnl On Linux/hurd, force the prefix to be /usr
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000796dnl
797case "$host_os" in
Theodore Ts'o93636bd2003-07-12 02:45:05 -0400798linux* | gnu* | k*bsd*-gnu)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000799 if test "$prefix" = NONE ; then
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000800 prefix="/usr";
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400801 AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
Theodore Ts'obff61a72002-05-21 22:21:38 -0400802 if test "$mandir" = '${prefix}/man' ; then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400803 AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
Theodore Ts'obff61a72002-05-21 22:21:38 -0400804 mandir=/usr/share/man
805 fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000806 fi
807;;
808esac
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000809if test "$root_prefix" = NONE ; then
Theodore Ts'offe19911998-04-08 06:05:49 +0000810 if test "$prefix" = NONE ; then
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000811 root_prefix="$ac_default_prefix"
812 else
813 root_prefix="$prefix"
814 fi
Theodore Ts'ob5ffead2002-05-11 19:17:00 -0400815 root_bindir=$bindir
816 root_sbindir=$sbindir
817 root_libdir=$libdir
818 root_sysconfdir=$sysconfdir
819else
820 root_bindir='${root_prefix}/bin'
821 root_sbindir='${root_prefix}/sbin'
822 root_libdir='${root_prefix}/lib'
823 root_sysconfdir='${root_prefix}/etc'
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000824fi
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -0500825if test "$bindir" != '${exec_prefix}/bin'; then
826 root_bindir=$bindir
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400827 AC_MSG_RESULT([Setting root_bindir to $root_bindir])
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -0500828fi
829if test "$sbindir" != '${exec_prefix}/sbin'; then
830 root_sbindir=$sbindir
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400831 AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -0500832fi
833if test "$libdir" != '${exec_prefix}/lib'; then
834 root_libdir=$libdir
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400835 AC_MSG_RESULT([Setting root_libdir to $root_libdir])
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -0500836fi
837if test "$sysconfdir" != '${prefix}/etc'; then
838 root_sysconfdir=$sysconfdir
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400839 AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -0500840fi
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000841AC_SUBST(root_prefix)
Theodore Ts'ob5ffead2002-05-11 19:17:00 -0400842AC_SUBST(root_bindir)
843AC_SUBST(root_sbindir)
844AC_SUBST(root_libdir)
845AC_SUBST(root_sysconfdir)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000846dnl
847dnl See if -static works.
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000848dnl
Theodore Ts'oae851481997-04-29 18:13:24 +0000849AC_MSG_CHECKING([whether linker accepts -static])
850AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
851[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
852AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
853 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
854LDFLAGS=$SAVE_LDFLAGS])
Theodore Ts'odefde781999-01-04 07:39:19 +0000855dnl
856dnl Regardless of how the test turns out, Solaris doesn't handle -static
857dnl This is caused by the socket library requiring the nsl library, which
858dnl requires the -dl library, which only works for dynamically linked
859dnl programs. It basically means you can't have statically linked programs
860dnl which use the network under Solaris.
861dnl
862case "$host_os" in
863solaris2.*)
864 ac_cv_e2fsprogs_use_static=no
865;;
866esac
Theodore Ts'oae851481997-04-29 18:13:24 +0000867AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
Theodore Ts'o74becf31997-04-26 14:37:06 +0000868LDFLAG_STATIC=
Theodore Ts'oae851481997-04-29 18:13:24 +0000869if test $ac_cv_e2fsprogs_use_static = yes; then
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000870 LDFLAG_STATIC=-static
Theodore Ts'oae851481997-04-29 18:13:24 +0000871fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000872AC_SUBST(LDFLAG_STATIC)
873dnl
Theodore Ts'o07a0db12003-07-05 14:50:24 -0400874dnl Work around mysterious Darwin / GNU libintl problem
875dnl (__asm__ redirection doesn't work for some mysterious reason. Looks like
876dnl Apple hacked gcc somehow?)
877dnl
878case "$host_os" in
879darwin*)
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400880 AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
Theodore Ts'o07a0db12003-07-05 14:50:24 -0400881 AC_DEFINE(_INTL_REDIRECT_MACROS)
882 ;;
883esac
884dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000885dnl Make the ss and et directories work correctly.
886dnl
887SS_DIR=`cd ${srcdir}/lib/ss; pwd`
888ET_DIR=`cd ${srcdir}/lib/et; pwd`
889AC_SUBST(SS_DIR)
890AC_SUBST(ET_DIR)
891dnl
892dnl Only try to run the test suite if we're not cross compiling.
893dnl
894if test "$cross_compiling" = yes ; then
895 DO_TEST_SUITE=
896else
897 DO_TEST_SUITE=check
898fi
899AC_SUBST(DO_TEST_SUITE)
900dnl
Theodore Ts'oc6f35b82003-05-17 16:29:27 -0400901dnl Only include the intl include files if we're building with them
902dnl
903INTL_FLAGS=
904if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
905 INTL_FLAGS='-I$(top_builddir)/intl -I$(top_srcdir)/intl'
906fi
907AC_SUBST(INTL_FLAGS)
908dnl
Theodore Ts'odd947da2005-11-09 18:37:07 -0400909dnl Build CFLAGS
910dnl
911if test $cross_compiling = no; then
912 BUILD_CFLAGS="$CFLAGS"
913 BUILD_LDFLAGS="$LDFLAGS"
914else
915 BUILD_CFLAGS=
916 BUILD_LDFLAGS=
917fi
918AC_SUBST(BUILD_CFLAGS)
919AC_SUBST(BUILD_LDFLAGS)
920dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000921dnl Make our output files, being sure that we create the some miscellaneous
922dnl directories
923dnl
924test -d lib || mkdir lib
925test -d include || mkdir include
926test -d include/linux || mkdir include/linux
Theodore Ts'odefde781999-01-04 07:39:19 +0000927test -d include/asm || mkdir include/asm
Theodore Ts'obff0cc92003-03-23 01:37:53 -0500928for i in MCONFIG Makefile e2fsprogs.spec \
929 util/Makefile util/subst.conf util/gen-tarball \
Theodore Ts'o4ea7ea02006-04-09 08:41:55 -0400930 lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
931 lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
Theodore Ts'o94ba8c72003-03-02 02:07:14 -0500932 lib/uuid/Makefile lib/uuid/uuid_types.h \
933 lib/blkid/Makefile lib/blkid/blkid_types.h \
Theodore Ts'oe6441862005-01-26 12:59:25 -0500934 lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
935 lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
Theodore Ts'o921f4ad2004-11-19 17:25:27 -0500936 misc/Makefile ext2ed/Makefile e2fsck/Makefile \
Theodore Ts'o94ba8c72003-03-02 02:07:14 -0500937 debugfs/Makefile tests/Makefile tests/progs/Makefile \
938 resize/Makefile doc/Makefile intl/Makefile po/Makefile.in ; do
939 if test -d `dirname ${srcdir}/$i` ; then
940 outlist="$outlist $i"
941 fi
942done
943AC_OUTPUT($outlist)
Theodore Ts'oee683a12005-02-05 15:53:56 -0500944if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi