blob: ceceeb6a15b250a669e9f7a143965657af235099 [file] [log] [blame]
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001AC_INIT(version.h)
Theodore Ts'o37cdbee2012-12-22 22:24:45 -05002AC_PREREQ(2.54)
Theodore Ts'ob0cacab2004-11-30 19:00:19 -05003AC_CONFIG_AUX_DIR(config)
Theodore Ts'od1154eb2011-09-18 17:34:37 -04004AC_CONFIG_HEADERS([lib/config.h])
Theodore Ts'oc714d022014-01-30 18:48:23 -05005AH_BOTTOM([#include <dirpaths.h>])
Theodore Ts'o50e1e101997-04-26 13:58:21 +00006MCONFIG=./MCONFIG
7AC_SUBST_FILE(MCONFIG)
Theodore Ts'o74becf31997-04-26 14:37:06 +00008BINARY_TYPE=bin
9dnl
10dnl This is to figure out the version number and the date....
11dnl
12E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
13 | awk '{print $3}' | tr \" " " | awk '{print $1}'`
14DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
15 | tr \" " "`
Theodore Ts'o2ab53822016-03-15 01:10:29 -040016E2FSPROGS_DAY=$(echo $DATE | awk -F- '{print $1}' | sed -e '/^[[1-9]]$/s/^/0/')
Theodore Ts'o74becf31997-04-26 14:37:06 +000017MONTH=`echo $DATE | awk -F- '{print $2}'`
18YEAR=`echo $DATE | awk -F- '{print $3}'`
19
Theodore Ts'o40fa8cc1999-01-09 05:06:02 +000020if expr $YEAR ">" 1900 > /dev/null ; then
21 E2FSPROGS_YEAR=$YEAR
22elif expr $YEAR ">" 90 >/dev/null ; then
Theodore Ts'o74becf31997-04-26 14:37:06 +000023 E2FSPROGS_YEAR=19$YEAR
24else
25 E2FSPROGS_YEAR=20$YEAR
26fi
27
28case $MONTH in
Andreas Dilger927566a2006-11-12 19:41:25 -050029Jan) MONTH_NUM=01; E2FSPROGS_MONTH="January" ;;
30Feb) MONTH_NUM=02; E2FSPROGS_MONTH="February" ;;
31Mar) MONTH_NUM=03; E2FSPROGS_MONTH="March" ;;
32Apr) MONTH_NUM=04; E2FSPROGS_MONTH="April" ;;
33May) MONTH_NUM=05; E2FSPROGS_MONTH="May" ;;
34Jun) MONTH_NUM=06; E2FSPROGS_MONTH="June" ;;
35Jul) MONTH_NUM=07; E2FSPROGS_MONTH="July" ;;
36Aug) MONTH_NUM=08; E2FSPROGS_MONTH="August" ;;
37Sep) MONTH_NUM=09; E2FSPROGS_MONTH="September" ;;
38Oct) MONTH_NUM=10; E2FSPROGS_MONTH="October" ;;
39Nov) MONTH_NUM=11; E2FSPROGS_MONTH="November" ;;
40Dec) MONTH_NUM=12; E2FSPROGS_MONTH="December" ;;
Theodore Ts'o02d04db2008-08-22 10:52:42 -040041*) AC_MSG_WARN([Unknown month $MONTH??]) ;;
Theodore Ts'o74becf31997-04-26 14:37:06 +000042esac
43
Andreas Dilger927566a2006-11-12 19:41:25 -050044base_ver=`echo $E2FSPROGS_VERSION | \
45 sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
Andreas Dilger927566a2006-11-12 19:41:25 -050046
47date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
48
49case $E2FSPROGS_VERSION in
50*-WIP|pre-*)
Theodore Ts'o2ab53822016-03-15 01:10:29 -040051 E2FSPROGS_PKGVER="$base_ver~WIP.$date_spec"
Andreas Dilger927566a2006-11-12 19:41:25 -050052 ;;
53*)
54 E2FSPROGS_PKGVER="$base_ver"
55 ;;
56esac
57
58unset DATE MONTH YEAR base_ver pre_vers date_spec
Theodore Ts'o02d04db2008-08-22 10:52:42 -040059AC_MSG_RESULT([Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION])
60AC_MSG_RESULT([Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}])
Theodore Ts'o74becf31997-04-26 14:37:06 +000061AC_SUBST(E2FSPROGS_YEAR)
62AC_SUBST(E2FSPROGS_MONTH)
Theodore Ts'obff0cc92003-03-23 01:37:53 -050063AC_SUBST(E2FSPROGS_DAY)
Theodore Ts'o74becf31997-04-26 14:37:06 +000064AC_SUBST(E2FSPROGS_VERSION)
Andreas Dilger927566a2006-11-12 19:41:25 -050065AC_SUBST(E2FSPROGS_PKGVER)
Theodore Ts'o57aa50d2009-11-26 10:38:04 -050066dnl
Theodore Ts'od21ae6c2003-05-05 09:00:24 -040067dnl Use diet libc
68dnl
Theodore Ts'oeafba6c2008-07-10 10:21:42 -040069WITH_DIET_LIBC=
Theodore Ts'od21ae6c2003-05-05 09:00:24 -040070AC_ARG_WITH([diet-libc],
Theodore Ts'o32493942007-12-31 10:45:01 -050071[ --with-diet-libc use diet libc],
Theodore Ts'od21ae6c2003-05-05 09:00:24 -040072CC="diet cc -nostdinc"
Theodore Ts'oeafba6c2008-07-10 10:21:42 -040073WITH_DIET_LIBC=yes
Theodore Ts'o6c59a662014-01-04 20:44:29 -050074if test -z "$LIBS"
75then
76 LIBS="-lcompat"
77else
78 LIBS="$LIBS -lcompat"
79fi
Theodore Ts'od21ae6c2003-05-05 09:00:24 -040080AC_MSG_RESULT(CC=$CC))dnl
81dnl
Theodore Ts'o6c59a662014-01-04 20:44:29 -050082AC_CANONICAL_HOST
83dnl
84dnl Check to see if libdl exists for the sake of dlopen
85dnl
86DLOPEN_LIB=''
87AC_CHECK_LIB(dl, dlopen,
88[DLOPEN_LIB=-ldl
89AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if dlopen/libdl exists])])
90AC_SUBST(DLOPEN_LIB)
91dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +000092AC_ARG_WITH([cc],
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -040093AC_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
94AC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
Theodore Ts'o74becf31997-04-26 14:37:06 +000095dnl
96AC_ARG_WITH([ccopts],
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -040097AC_HELP_STRING([--with-ccopts],[no longer supported, use CFLAGS= instead]),
98AC_MSG_ERROR([--with-ccopts no longer supported; use CFLAGS= instead]))
99dnl
100AC_ARG_WITH([ldopts],
101AC_HELP_STRING([--with-ldopts],[no longer supported, use LDFLAGS= instead]),
102AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead]))
103dnl
104AC_PROG_CC
Theodore Ts'o9b3018a2011-08-11 14:56:49 -0400105if test "$GCC" = yes; then
106 RDYNAMIC="-rdynamic"
107 AC_SUBST(RDYNAMIC)
108fi
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400109AC_PROG_CPP
Theodore Ts'o74becf31997-04-26 14:37:06 +0000110dnl
Matthias Andreeb1c92f92004-02-23 21:30:11 +0100111dnl Alpha computers use fast and imprecise floating point code that may
112dnl miss exceptions by default. Force sane options if we're using GCC.
113AC_MSG_CHECKING(for additional special compiler flags)
114if test "$GCC" = yes
115then
116 case "$host_cpu" in
117 alpha) addcflags="-mieee" ;;
118 esac
119fi
120if test "x$addcflags" != x
121then
122 AC_MSG_RESULT($addcflags)
123 CFLAGS="$addcflags $CFLAGS"
124else
125 AC_MSG_RESULT([[(none)]])
126fi
Theodore Ts'o93613952014-07-03 23:44:13 -0400127AC_USE_SYSTEM_EXTENSIONS
Matthias Andreeb1c92f92004-02-23 21:30:11 +0100128dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000129dnl Set default values for library extentions. Will be dealt with after
130dnl parsing configuration opions, which may modify these
131dnl
132LIB_EXT=.a
133STATIC_LIB_EXT=.a
Theodore Ts'o14b596d2009-04-22 09:18:30 -0400134PROFILED_LIB_EXT=.a
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000135dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000136dnl Allow separate `root_prefix' to be specified
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000137dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000138AC_ARG_WITH([root-prefix],
139[ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
140root_prefix=$withval,
141root_prefix=NONE)dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000142dnl
Theodore Ts'o98919bd2005-02-04 10:43:58 -0500143dnl handle --enable-maintainer-mode
144dnl
145AC_ARG_ENABLE([maintainer-mode],
146[ --enable-maintainer-mode enable makefile rules useful for maintainers],
147if test "$enableval" = "no"
148then
149 MAINTAINER_CMT=#
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400150 AC_MSG_RESULT([Disabling maintainer mode])
Theodore Ts'o98919bd2005-02-04 10:43:58 -0500151else
152 MAINTAINER_CMT=
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400153 AC_MSG_RESULT([Enabling maintainer mode])
Theodore Ts'o98919bd2005-02-04 10:43:58 -0500154fi
155,
156MAINTAINER_CMT=#
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400157AC_MSG_RESULT([Disabling maintainer mode by default])
Theodore Ts'o98919bd2005-02-04 10:43:58 -0500158)
159AC_SUBST(MAINTAINER_CMT)
160dnl
Theodore Ts'o5aa6c3f2010-05-17 19:21:42 -0400161dnl handle --enable-symlink-install
162dnl
163AC_ARG_ENABLE([symlink-install],
164[ --enable-symlink-install use symlinks when installing instead of hard links],
165if test "$enableval" = "no"
166then
167 LINK_INSTALL_FLAGS=-f
168 AC_MSG_RESULT([Disabling symlinks for install])
169else
170 LINK_INSTALL_FLAGS=-sf
171 AC_MSG_RESULT([Enabling symlinks for install])
172fi
173,
174LINK_INSTALL_FLAGS=-f
Theodore Ts'o183c73b2012-05-12 23:13:24 -0400175AC_MSG_RESULT([Disabling symlinks for install by default])
Theodore Ts'o5aa6c3f2010-05-17 19:21:42 -0400176)
177AC_SUBST(LINK_INSTALL_FLAGS)
178dnl
Theodore Ts'o183c73b2012-05-12 23:13:24 -0400179dnl handle --enable-relative-symlinks
180dnl
Theodore Ts'o91d11da2012-09-06 23:01:14 -0400181relative_symlink_defined=
182AC_ARG_ENABLE([relative-symlinks],
Theodore Ts'o183c73b2012-05-12 23:13:24 -0400183[ --enable-relative-symlinks use relative symlinks when installing],
184if test "$enableval" = "no"
185then
186 SYMLINK_RELATIVE=
Theodore Ts'o91d11da2012-09-06 23:01:14 -0400187 relative_symlink_defined=yes
Theodore Ts'o183c73b2012-05-12 23:13:24 -0400188 AC_MSG_RESULT([Disabling relative symlinks for install])
189else
190 SYMLINK_RELATIVE=--relative
Theodore Ts'o91d11da2012-09-06 23:01:14 -0400191 relative_symlink_defined=yes
192 AC_MSG_RESULT([Enabling relative symlinks for install])
193fi)
194AC_ARG_ENABLE([symlink-relative-symlinks],,
195if test "$enableval" = "no"
196then
197 SYMLINK_RELATIVE=yes
198 AC_MSG_RESULT([Disabling relative symlinks for install])
199else
200 SYMLINK_RELATIVE=--relative
201 AC_MSG_RESULT([Enabling relative symlinks for install])
Theodore Ts'o183c73b2012-05-12 23:13:24 -0400202fi
203,
Theodore Ts'o91d11da2012-09-06 23:01:14 -0400204if test -z "$relative_symlink_defined"
205then
Theodore Ts'o183c73b2012-05-12 23:13:24 -0400206 SYMLINK_RELATIVE=
207AC_MSG_RESULT([Disabling relative symlinks for install by default])
Theodore Ts'o91d11da2012-09-06 23:01:14 -0400208fi
Theodore Ts'o183c73b2012-05-12 23:13:24 -0400209)
210AC_SUBST(SYMLINK_RELATIVE)
211dnl
Theodore Ts'o5aa6c3f2010-05-17 19:21:42 -0400212dnl handle --enable-symlink-build
213dnl
214AC_ARG_ENABLE([symlink-build],
215[ --enable-symlink-build use symlinks while building instead of hard links],
216if test "$enableval" = "no"
217then
218 LINK_BUILD_FLAGS=
219 AC_MSG_RESULT([Disabling symlinks for build])
220else
221 LINK_BUILD_FLAGS=-s
222 AC_MSG_RESULT([Enabling symlinks for build])
223fi
224,
225LINK_BUILD_FLAGS=
Theodore Ts'o183c73b2012-05-12 23:13:24 -0400226AC_MSG_RESULT([Disabling symlinks for build by default])
Theodore Ts'o5aa6c3f2010-05-17 19:21:42 -0400227)
228AC_SUBST(LINK_BUILD_FLAGS)
229dnl
Theodore Ts'oc13351f2009-07-02 00:11:17 -0400230dnl handle --enable-verbose-makecmds
231dnl
232AC_ARG_ENABLE([verbose-makecmds],
Theodore Ts'o5aa6c3f2010-05-17 19:21:42 -0400233[ --enable-verbose-makecmds enable verbose make command output],
Theodore Ts'oc13351f2009-07-02 00:11:17 -0400234if test "$enableval" = "no"
235then
236 AC_MSG_RESULT([Disabling verbose make commands])
237 E=@echo
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400238 ES=echo
Theodore Ts'oc13351f2009-07-02 00:11:17 -0400239 Q=@
240else
241 AC_MSG_RESULT([Enabling verbose make commands])
242 E=@\\#
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400243 ES=\\#
Theodore Ts'oc13351f2009-07-02 00:11:17 -0400244 Q=
245fi
246,
247AC_MSG_RESULT([Disabling verbose make commands])
248E=@echo
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400249ES=echo
Theodore Ts'oc13351f2009-07-02 00:11:17 -0400250Q=@
251)
252AC_SUBST(E)
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400253AC_SUBST(ES)
Theodore Ts'oc13351f2009-07-02 00:11:17 -0400254AC_SUBST(Q)
255dnl
Theodore Ts'oa4ece352008-01-01 20:05:04 -0500256dnl This needs to be before all of the --enable-*-shlibs options
257dnl
258E2_PKG_CONFIG_STATIC=--static
Theodore Ts'o55da9872008-09-02 23:12:38 -0400259LDFLAG_DYNAMIC=
260PRIVATE_LIBS_CMT=
Theodore Ts'oa4ece352008-01-01 20:05:04 -0500261dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000262dnl handle --enable-elf-shlibs
263dnl
264AC_ARG_ENABLE([elf-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000265[ --enable-elf-shlibs select ELF shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000266if test "$enableval" = "no"
267then
268 ELF_CMT=#
269 MAKEFILE_ELF=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400270 AC_MSG_RESULT([Disabling ELF shared libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000271else
Theodore Ts'oa4ece352008-01-01 20:05:04 -0500272 E2_PKG_CONFIG_STATIC=
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000273 ELF_CMT=
274 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
Theodore Ts'of5955dd2000-10-25 02:38:39 +0000275 [case "$host_os" in
276 solaris2.*)
277 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
278 ;;
279 esac]
Theodore Ts'o74becf31997-04-26 14:37:06 +0000280 BINARY_TYPE=elfbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000281 LIB_EXT=.so
Theodore Ts'o55da9872008-09-02 23:12:38 -0400282 PRIVATE_LIBS_CMT=#
283 LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib']
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400284 AC_MSG_RESULT([Enabling ELF shared libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000285fi
286,
287MAKEFILE_ELF=/dev/null
288ELF_CMT=#
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400289AC_MSG_RESULT([Disabling ELF shared libraries by default])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000290)
291AC_SUBST(ELF_CMT)
292AC_SUBST_FILE(MAKEFILE_ELF)
293dnl
294dnl handle --enable-bsd-shlibs
295dnl
296AC_ARG_ENABLE([bsd-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000297[ --enable-bsd-shlibs select BSD shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000298if test "$enableval" = "no"
299then
300 BSDLIB_CMT=#
301 MAKEFILE_BSDLIB=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400302 AC_MSG_RESULT([Disabling BSD shared libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000303else
Theodore Ts'oa4ece352008-01-01 20:05:04 -0500304 E2_PKG_CONFIG_STATIC=
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000305 BSDLIB_CMT=
306 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000307 LIB_EXT=.so
Theodore Ts'oe71d8732003-03-14 02:13:48 -0500308 [case "$host_os" in
Theodore Ts'oaa75ecc2003-03-17 10:01:22 -0500309 darwin*)
Theodore Ts'oe71d8732003-03-14 02:13:48 -0500310 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
311 LIB_EXT=.dylib
312 ;;
313 esac]
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400314 AC_MSG_RESULT([Enabling BSD shared libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000315fi
316,
317MAKEFILE_BSDLIB=/dev/null
318BSDLIB_CMT=#
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400319AC_MSG_RESULT([Disabling BSD shared libraries by default])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000320)
321AC_SUBST(BSDLIB_CMT)
322AC_SUBST_FILE(MAKEFILE_BSDLIB)
323dnl
324dnl handle --enable-profile
325dnl
326AC_ARG_ENABLE([profile],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000327[ --enable-profile build profiling libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000328if test "$enableval" = "no"
329then
330 PROFILE_CMT=#
331 MAKEFILE_PROFILE=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400332 AC_MSG_RESULT([Disabling profiling libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000333else
334 PROFILE_CMT=
335 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000336 PROFILED_LIB_EXT=_p.a
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400337 AC_MSG_RESULT([Building profiling libraries])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000338fi
339,
340PROFILE_CMT=#
341MAKEFILE_PROFILE=/dev/null
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400342AC_MSG_RESULT([Disabling profiling libraries by default])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000343)
344AC_SUBST(PROFILE_CMT)
345AC_SUBST_FILE(MAKEFILE_PROFILE)
346dnl
Theodore Ts'ofedfb272014-02-23 00:17:09 -0500347dnl handle --enable-gcov
348dnl
349AC_ARG_ENABLE([gcov],
350[ --enable-gcov build for coverage testing using gcov],
351if test "$enableval" = "yes"
352then
353 CFLAGS="-g -fprofile-arcs -ftest-coverage"
354 LDFLAGS="-fprofile-arcs -ftest-coverage"
355 AC_MSG_RESULT([Enabling gcov support])
356fi
357)
Eric Sandeen2f8d0252014-04-17 17:05:38 -0500358
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000359dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000360dnl Substitute library extensions
361dnl
362AC_SUBST(LIB_EXT)
363AC_SUBST(STATIC_LIB_EXT)
364AC_SUBST(PROFILED_LIB_EXT)
Theodore Ts'o55da9872008-09-02 23:12:38 -0400365AC_SUBST(LDFLAG_DYNAMIC)
366AC_SUBST(PRIVATE_LIBS_CMT)
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000367dnl
Theodore Ts'o782bebf2002-11-08 18:46:45 -0500368dnl handle --enable-jbd-debug
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000369dnl
Theodore Ts'o782bebf2002-11-08 18:46:45 -0500370AC_ARG_ENABLE([jbd-debug],
371[ --enable-jbd-debug enable journal debugging],
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000372if test "$enableval" = "no"
373then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400374 AC_MSG_RESULT([Disabling journal debugging])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000375else
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400376 AC_DEFINE(CONFIG_JBD_DEBUG, 1,
377 [Define to 1 if debugging ext3/4 journal code])
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400378 AC_MSG_RESULT([Enabling journal debugging])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000379fi
380,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400381AC_MSG_RESULT([Disabling journal debugging by default])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000382)
383dnl
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500384dnl handle --enable-blkid-debug
385dnl
386AC_ARG_ENABLE([blkid-debug],
Theodore Ts'od21ae6c2003-05-05 09:00:24 -0400387[ --enable-blkid-debug enable blkid debugging],
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500388if test "$enableval" = "no"
389then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400390 AC_MSG_RESULT([Disabling blkid debugging])
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500391else
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400392 AC_DEFINE(CONFIG_BLKID_DEBUG, 1,
393 [Define to 1 if debugging the blkid library])
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400394 AC_MSG_RESULT([Enabling blkid debugging])
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500395fi
396,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400397AC_MSG_RESULT([Disabling blkid debugging by default])
Theodore Ts'of0a22d02003-02-22 13:19:53 -0500398)
399dnl
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400400dnl handle --enable-testio-debug
401dnl
402AC_ARG_ENABLE([testio-debug],
Theodore Ts'oaf773652008-09-01 11:27:27 -0400403[ --disable-testio-debug disable the use of the test I/O manager for debugging],
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400404AH_TEMPLATE([CONFIG_TESTIO_DEBUG],
405 [Define to 1 if the testio I/O manager should be enabled])
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400406if test "$enableval" = "no"
407then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400408 AC_MSG_RESULT([Disabling testio debugging])
Theodore Ts'oaf773652008-09-01 11:27:27 -0400409 TEST_IO_CMT="#"
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400410else
Theodore Ts'oaf773652008-09-01 11:27:27 -0400411 TEST_IO_CMT=
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400412 AC_DEFINE(CONFIG_TESTIO_DEBUG, 1)
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400413 AC_MSG_RESULT([Enabling testio debugging])
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400414fi
415,
Theodore Ts'oaf773652008-09-01 11:27:27 -0400416AC_MSG_RESULT([Enabling testio debugging by default])
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400417AC_DEFINE(CONFIG_TESTIO_DEBUG, 1)
Theodore Ts'oaf773652008-09-01 11:27:27 -0400418TEST_IO_CMT=
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400419)
Theodore Ts'oaf773652008-09-01 11:27:27 -0400420AC_SUBST(TEST_IO_CMT)
Theodore Ts'o2a29f132003-05-05 12:08:47 -0400421dnl
Scott James Remnant39fd3d42009-05-14 13:03:25 +0100422dnl handle --disable-libuuid
423dnl
424PKG_PROG_PKG_CONFIG
425LIBUUID=
426DEPLIBUUID=
427STATIC_LIBUUID=
428DEPSTATIC_LIBUUID=
429PROFILED_LIBUUID=
430DEPPROFILED_LIBUUID=
431UUID_CMT=
432AC_ARG_ENABLE([libuuid],
Theodore Ts'of5dffb82015-06-20 14:20:14 -0400433[ --enable-libuuid build and use private uuid library],
Scott James Remnant39fd3d42009-05-14 13:03:25 +0100434if test "$enableval" = "no"
435then
436 if test -z "$PKG_CONFIG"; then
437 AC_MSG_ERROR([pkg-config not installed; please install it.])
438 fi
439
440 AC_CHECK_LIB(uuid, uuid_generate,
441 [LIBUUID=`$PKG_CONFIG --libs uuid`;
442 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`],
Theodore Ts'o2d7583b2014-07-05 00:27:02 -0400443 [AC_MSG_ERROR([external uuid library not found])])
Theodore Ts'o5afdf372014-09-18 21:11:33 -0400444 PROFILED_LIBUUID=$LIBUUID
Scott James Remnant39fd3d42009-05-14 13:03:25 +0100445 UUID_CMT=#
446 AC_MSG_RESULT([Disabling private uuid library])
447else
448 LIBUUID='$(LIB)/libuuid'$LIB_EXT
449 DEPLIBUUID=$LIBUUID
450 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
451 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
452 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
453 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
454 AC_MSG_RESULT([Enabling private uuid library])
455fi
456,
Theodore Ts'of5dffb82015-06-20 14:20:14 -0400457if test -n "$PKG_CONFIG"; then
458 AC_CHECK_LIB(uuid, uuid_generate,
459 [LIBUUID=`$PKG_CONFIG --libs uuid`;
460 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`])
461fi
462if test -n "$LIBUUID"; then
463 PROFILED_LIBUUID=$LIBUUID
464 UUID_CMT=#
465 AC_MSG_RESULT([Using system uuid by default])
466else
467 LIBUUID='$(LIB)/libuuid'$LIB_EXT
468 DEPLIBUUID=$LIBUUID
469 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
470 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
471 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
472 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
473 AC_MSG_RESULT([Enabling private uuid library by default])
474fi
Scott James Remnant39fd3d42009-05-14 13:03:25 +0100475)
476AC_SUBST(LIBUUID)
477AC_SUBST(DEPLIBUUID)
478AC_SUBST(STATIC_LIBUUID)
479AC_SUBST(DEPSTATIC_LIBUUID)
480AC_SUBST(PROFILED_LIBUUID)
481AC_SUBST(DEPPROFILED_LIBUUID)
482AC_SUBST(UUID_CMT)
483dnl
Theodore Ts'o14b596d2009-04-22 09:18:30 -0400484dnl handle --disable-libblkid
485dnl
486PKG_PROG_PKG_CONFIG
487LIBBLKID=
488DEPLIBBLKID=
489STATIC_LIBBLKID=
490DEPSTATIC_LIBBLKID=
491PROFILED_LIBBLKID=
492DEPPROFILED_LIBBLKID=
493BLKID_CMT=
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400494AH_TEMPLATE([CONFIG_BUILD_FINDFS], [Define to 1 to compile findfs])
Theodore Ts'o14b596d2009-04-22 09:18:30 -0400495AC_ARG_ENABLE([libblkid],
Theodore Ts'of5dffb82015-06-20 14:20:14 -0400496[ --enable-libblkid build and use private blkid library],
Theodore Ts'o14b596d2009-04-22 09:18:30 -0400497if test "$enableval" = "no"
498then
499 if test -z "$PKG_CONFIG"; then
500 AC_MSG_ERROR([pkg-config not installed; please install it.])
501 fi
502
503 AC_CHECK_LIB(blkid, blkid_get_cache,
504 [LIBBLKID=`$PKG_CONFIG --libs blkid`;
505 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
Theodore Ts'o2d7583b2014-07-05 00:27:02 -0400506 [AC_MSG_ERROR([external blkid library not found])], -luuid)
Theodore Ts'o14b596d2009-04-22 09:18:30 -0400507 BLKID_CMT=#
Theodore Ts'o5afdf372014-09-18 21:11:33 -0400508 PROFILED_LIBBLKID=$LIBBLKID
Theodore Ts'o14b596d2009-04-22 09:18:30 -0400509 AC_MSG_RESULT([Disabling private blkid library])
510else
511 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
512 DEPLIBBLKID=$LIBBLKID
513 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
514 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
515 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
516 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400517 AC_DEFINE(CONFIG_BUILD_FINDFS, 1)
Theodore Ts'o14b596d2009-04-22 09:18:30 -0400518 AC_MSG_RESULT([Enabling private blkid library])
519fi
520,
Theodore Ts'of5dffb82015-06-20 14:20:14 -0400521if test -n "$PKG_CONFIG"; then
522 AC_CHECK_LIB(blkid, blkid_get_cache,
523 [LIBBLKID=`$PKG_CONFIG --libs blkid`;
524 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`])
525fi
526if test -n "$LIBBLKID"; then
527 BLKID_CMT=#
528 PROFILED_LIBBLKID=$LIBBLKID
529 AC_MSG_RESULT([Using system blkid library by default])
530else
531 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
532 DEPLIBBLKID=$LIBBLKID
533 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
534 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
535 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
536 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
537 AC_DEFINE(CONFIG_BUILD_FINDFS, 1)
538 AC_MSG_RESULT([Enabling private blkid library by default])
539fi
Theodore Ts'o14b596d2009-04-22 09:18:30 -0400540)
541AC_SUBST(LIBBLKID)
542AC_SUBST(DEPLIBBLKID)
543AC_SUBST(STATIC_LIBBLKID)
544AC_SUBST(DEPSTATIC_LIBBLKID)
545AC_SUBST(PROFILED_LIBBLKID)
546AC_SUBST(DEPPROFILED_LIBBLKID)
547AC_SUBST(BLKID_CMT)
548dnl
Theodore Ts'o3df60142013-06-16 16:14:40 -0400549dnl handle --disable-backtrace
550dnl
551AH_TEMPLATE([DISABLE_BACKTRACE], [Define to 1 to disable use of backtrace])
552AC_ARG_ENABLE([backtrace],
553[ --disable-backtrace disable use backtrace],
554if test "$enableval" = "no"
555then
556 AC_MSG_RESULT([Disabling use of backtrace])
557 AC_DEFINE(DISABLE_BACKTRACE, 1)
558else
559 AC_MSG_RESULT([Enabling use of backtrace])
560fi
561,
562AC_MSG_RESULT([Enabling use of backtrace by default])
563)
564dnl
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000565dnl handle --enable-debugfs
566dnl
567AC_ARG_ENABLE([debugfs],
568[ --disable-debugfs disable support of debugfs program],
569if test "$enableval" = "no"
570then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400571 AC_MSG_RESULT([Disabling debugfs support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000572 DEBUGFS_CMT="#"
573else
574 DEBUGFS_CMT=
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400575 AC_MSG_RESULT([Enabling debugfs support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000576fi
577,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400578AC_MSG_RESULT([Enabling debugfs support by default])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000579DEBUGFS_CMT=
580)
581AC_SUBST(DEBUGFS_CMT)
582dnl
583dnl handle --enable-imager
584dnl
585AC_ARG_ENABLE([imager],
586[ --disable-imager disable support of e2image program],
587if test "$enableval" = "no"
588then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400589 AC_MSG_RESULT([Disabling e2image support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000590 IMAGER_CMT="#"
591else
592 IMAGER_CMT=
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400593 AC_MSG_RESULT([Enabling e2image support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000594fi
595,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400596AC_MSG_RESULT([Enabling e2image support by default])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000597IMAGER_CMT=
598)
599AC_SUBST(IMAGER_CMT)
600dnl
601dnl handle --enable-resizer
602dnl
603AC_ARG_ENABLE([resizer],
604[ --disable-resizer disable support of e2resize program],
605if test "$enableval" = "no"
606then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400607 AC_MSG_RESULT([Disabling e2resize support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000608 RESIZER_CMT="#"
609else
610 RESIZER_CMT=
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400611 AC_MSG_RESULT([Enabling e2resize support])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000612fi
613,
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400614AC_MSG_RESULT([Enabling e2resize support by default])
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000615RESIZER_CMT=
616)
617AC_SUBST(RESIZER_CMT)
618dnl
Theodore Ts'o8d9c50c2010-12-24 15:19:44 -0500619dnl handle --enable-defrag
620dnl
621AC_ARG_ENABLE([defrag],
622[ --disable-defrag disable support of e4defrag program],
623if test "$enableval" = "no"
624then
625 AC_MSG_RESULT([Disabling e4defrag support])
626 DEFRAG_CMT="#"
627else
628 DEFRAG_CMT=
629 AC_MSG_RESULT([Enabling e4defrag support])
630fi
631,
Theodore Ts'o6c59a662014-01-04 20:44:29 -0500632if test -z "$WITH_DIET_LIBC"
633then
634 AC_MSG_RESULT([Enabling e4defrag support by default])
635 DEFRAG_CMT=
636else
637 AC_MSG_RESULT([Disabling e4defrag support by default])
638 DEFRAG_CMT="#"
639fi
Theodore Ts'o8d9c50c2010-12-24 15:19:44 -0500640)
641AC_SUBST(DEFRAG_CMT)
642dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000643dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
644dnl
645AC_ARG_ENABLE([fsck],
646[ --enable-fsck build fsck wrapper program],
647[if test "$enableval" = "no"
648then
649 FSCK_PROG='' FSCK_MAN=''
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400650 AC_MSG_RESULT([Not building fsck wrapper])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000651else
652 FSCK_PROG=fsck FSCK_MAN=fsck.8
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400653 AC_MSG_RESULT([Building fsck wrapper])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000654fi]
655,
656[case "$host_os" in
Theodore Ts'oe3632402004-05-04 19:39:54 -0400657 gnu*)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000658 FSCK_PROG='' FSCK_MAN=''
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400659 AC_MSG_RESULT([Not building fsck wrapper by default])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000660 ;;
661 *)
662 FSCK_PROG=fsck FSCK_MAN=fsck.8
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400663 AC_MSG_RESULT([Building fsck wrapper by default])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000664esac]
665)
666AC_SUBST(FSCK_PROG)
667AC_SUBST(FSCK_MAN)
668dnl
Theodore Ts'o5d407732004-09-18 14:53:14 -0400669dnl See whether to install the `e2initrd-helper' program
670dnl
671AC_ARG_ENABLE([e2initrd-helper],
672[ --enable-e2initrd-helper build e2initrd-helper program],
673[if test "$enableval" = "no"
674then
675 E2INITRD_PROG='' E2INITRD_MAN=''
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400676 AC_MSG_RESULT([Not building e2initrd helper])
Theodore Ts'o5d407732004-09-18 14:53:14 -0400677else
678 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400679 AC_MSG_RESULT([Building e2initrd helper])
Theodore Ts'o5d407732004-09-18 14:53:14 -0400680fi]
681,
682E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400683AC_MSG_RESULT([Building e2initrd helper by default])
Theodore Ts'o5d407732004-09-18 14:53:14 -0400684)
685AC_SUBST(E2INITRD_PROG)
686AC_SUBST(E2INITRD_MAN)
Karel Zak4db2f592006-03-08 14:17:28 -0500687dnl
Theodore Ts'o5d407732004-09-18 14:53:14 -0400688dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000689dnl
Theodore Ts'o32493942007-12-31 10:45:01 -0500690AC_ARG_ENABLE([tls],
691[ --disable-tls disable use of thread local support],
692[if test "$enableval" = "no"
693then
694 try_tls=""
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400695 AC_MSG_RESULT([Disabling thread local support])
Theodore Ts'o32493942007-12-31 10:45:01 -0500696else
697 try_tls="yes"
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400698 AC_MSG_RESULT([Enabling thread local support])
Theodore Ts'o32493942007-12-31 10:45:01 -0500699fi]
700,
Theodore Ts'oeafba6c2008-07-10 10:21:42 -0400701if test -n "$WITH_DIET_LIBC"
702then
703 try_tls=""
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400704 AC_MSG_RESULT([Diet libc does not support thread local support])
Theodore Ts'oeafba6c2008-07-10 10:21:42 -0400705else
706 try_tls="yes"
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400707 AC_MSG_RESULT([Try using thread local support by default])
Theodore Ts'oeafba6c2008-07-10 10:21:42 -0400708fi
Theodore Ts'o32493942007-12-31 10:45:01 -0500709)
710if test "$try_tls" = "yes"
711then
712AX_TLS
713fi
714dnl
715dnl
716dnl
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400717AH_TEMPLATE([USE_UUIDD], [Define to 1 to build uuidd])
Theodore Ts'o5610f992007-12-31 11:16:56 -0500718AC_ARG_ENABLE([uuidd],
719[ --disable-uuidd disable building the uuid daemon],
720[if test "$enableval" = "no"
721then
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400722 AC_MSG_RESULT([Not building uuidd])
Theodore Ts'o5610f992007-12-31 11:16:56 -0500723 UUIDD_CMT="#"
724else
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400725 AC_DEFINE(USE_UUIDD, 1)
Theodore Ts'o5610f992007-12-31 11:16:56 -0500726 UUIDD_CMT=""
Theodore Ts'o02d04db2008-08-22 10:52:42 -0400727 AC_MSG_RESULT([Building uuidd])
Theodore Ts'o5610f992007-12-31 11:16:56 -0500728fi]
729,
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400730AC_DEFINE(USE_UUIDD, 1)
Theodore Ts'oe3d10152014-09-19 00:26:26 -0400731if test -z "$UUID_CMT"
732then
733 UUIDD_CMT=""
734 AC_MSG_RESULT([Building uuidd by default])
735else
736 UUIDD_CMT="#"
737 AC_MSG_RESULT([Disabling uuidd by default])
738fi
Theodore Ts'o5610f992007-12-31 11:16:56 -0500739)
740AC_SUBST(UUIDD_CMT)
741dnl
Tony Breedsd6a4bcb2012-06-26 11:42:15 +1000742dnl handle --disable-mmp
743dnl
744AH_TEMPLATE([CONFIG_MMP], [Define to 1 to enable mmp support])
745AC_ARG_ENABLE([mmp],
746[ --disable-mmp disable support mmp, Multi Mount Protection],
747if test "$enableval" = "no"
748then
749 AC_MSG_RESULT([Disabling mmp support])
750else
751 AC_MSG_RESULT([Enabling mmp support])
752 AC_DEFINE(CONFIG_MMP, 1)
753fi
754,
755AC_MSG_RESULT([Enabling mmp support by default])
756AC_DEFINE(CONFIG_MMP, 1)
757)
758dnl
Tony Breeds1625bf42012-07-30 14:44:12 -0400759dnl handle --disable-bmap-stats
760dnl
761AH_TEMPLATE([ENABLE_BMAP_STATS], [Define to 1 to enable bitmap stats.])
762AC_ARG_ENABLE([bmap-stats],
763[ --disable-bmap-stats disable collection of bitmap stats.],
764if test "$enableval" = "no"
765then
766 AC_MSG_RESULT([Disabling bitmap statistics support])
767else
768 AC_MSG_RESULT([Enabling bitmap statistics support])
769 AC_DEFINE(ENABLE_BMAP_STATS, 1)
770fi
771,
772AC_MSG_RESULT([Enabling bitmap statistics support by default])
773AC_DEFINE(ENABLE_BMAP_STATS, 1)
774)
775dnl
776dnl handle --enable-bmap-stats-ops
777dnl
778AH_TEMPLATE([ENABLE_BMAP_STATS_OPS], [Define to 1 to enable bitmap stats.])
779AC_ARG_ENABLE([bmap-stats-ops],
780[ --enable-bmap-stats-ops enable collection of additional bitmap stats],
781if test "$enableval" = "no"
782then
783 AC_MSG_RESULT([Disabling additional bitmap statistics])
784else
785 dnl There has to be a better way!
786 AS_IF([test "x${enable_bmap_stats}" = "xno"],
787 AC_MSG_FAILURE([Error --enable-bmap-stats-ops requires bmap-stats]))
788
789 AC_MSG_RESULT([Enabling additional bitmap statistics])
790 AC_DEFINE(ENABLE_BMAP_STATS_OPS, 1)
791fi
792,
793AC_MSG_RESULT([Disabling additional bitmap statistics by default])
794)
795dnl
Theodore Ts'o5610f992007-12-31 11:16:56 -0500796dnl
797dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000798MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
799AC_SUBST_FILE(MAKEFILE_LIBRARY)
800dnl
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000801dnl Add internationalization support, using gettext.
802dnl
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500803GETTEXT_PACKAGE=e2fsprogs
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000804PACKAGE=e2fsprogs
805VERSION="$E2FSPROGS_VERSION"
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500806VERSION=0.14.1
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400807AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [package name for gettext])
808AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [version for gettext])
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500809AC_SUBST(GETTEXT_PACKAGE)
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000810AC_SUBST(PACKAGE)
811AC_SUBST(VERSION)
812
Theodore Ts'ocdf186e2001-06-13 22:16:47 +0000813AM_GNU_GETTEXT
814dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000815dnl End of configuration options
816dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000817AC_SUBST(BINARY_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000818AC_PROG_MAKE_SET
Theodore Ts'obcb915b2009-07-02 18:19:10 -0400819CHECK_GNU_MAKE
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000820AC_PATH_PROG(LN, ln, ln)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000821AC_PROG_LN_S
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000822AC_PATH_PROG(MV, mv, mv)
823AC_PATH_PROG(CP, cp, cp)
824AC_PATH_PROG(RM, rm, rm)
825AC_PATH_PROG(CHMOD, chmod, :)
Theodore Ts'o32237012005-01-17 19:13:39 -0500826AC_PROG_AWK
827AC_PROG_EGREP
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000828AC_PATH_PROG(SED, sed, sed)
Theodore Ts'o9d564f71999-07-03 20:25:58 +0000829AC_PATH_PROG(PERL, perl, perl)
Theodore Ts'o250f79f2001-05-19 22:02:22 +0000830AC_PATH_PROG(LDCONFIG, ldconfig, :)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000831AC_CHECK_TOOL(AR, ar, ar)
832AC_CHECK_TOOL(RANLIB, ranlib, :)
833AC_CHECK_TOOL(STRIP, strip, :)
Manish Katiyar7321d942008-04-14 17:20:03 +0530834AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
835if test "_$MAKEINFO" = "_"; then
836 MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
837else
838 case "$MAKEINFO" in
839 */missing.*)
840 AC_MSG_WARN([
841*** Makeinfo is missing. Info documentation will not be built.])
842 ;;
843 *)
844 ;;
845 esac
846fi
847AC_SUBST(MAKEINFO)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000848AC_PROG_INSTALL
Theodore Ts'o6c133521999-07-03 20:37:03 +0000849# See if we need a separate native compiler.
850if test $cross_compiling = no; then
851 BUILD_CC="$CC"
852 AC_SUBST(BUILD_CC)
853else
854 AC_CHECK_PROGS(BUILD_CC, gcc cc)
855fi
Mike Frysinger677fc912012-03-06 20:13:54 -0500856AC_CHECK_HEADERS(m4_flatten([
857 dirent.h
858 errno.h
859 execinfo.h
860 getopt.h
861 malloc.h
862 mntent.h
863 paths.h
864 semaphore.h
865 setjmp.h
866 signal.h
867 stdarg.h
868 stdint.h
869 stdlib.h
870 termios.h
871 termio.h
872 unistd.h
873 utime.h
Ross Burtonc84da2e2014-07-10 17:44:38 +0100874 attr/xattr.h
Mike Frysinger677fc912012-03-06 20:13:54 -0500875 linux/falloc.h
876 linux/fd.h
877 linux/major.h
Kazuya Miofbabd5c2013-12-16 00:48:12 -0500878 linux/loop.h
Mike Frysinger677fc912012-03-06 20:13:54 -0500879 net/if_dl.h
880 netinet/in.h
Darrick J. Wong81cbf1e2015-05-13 17:22:40 -0700881 sys/acl.h
Mike Frysinger677fc912012-03-06 20:13:54 -0500882 sys/disklabel.h
Andreas Dilger51050542014-06-11 12:59:05 -0600883 sys/disk.h
Mike Frysinger677fc912012-03-06 20:13:54 -0500884 sys/file.h
885 sys/ioctl.h
Theodore Ts'o74f2c4a2015-06-19 19:28:25 -0400886 sys/key.h
Mike Frysinger677fc912012-03-06 20:13:54 -0500887 sys/mkdev.h
888 sys/mman.h
Andreas Dilger51050542014-06-11 12:59:05 -0600889 sys/mount.h
Mike Frysinger677fc912012-03-06 20:13:54 -0500890 sys/prctl.h
Mike Frysinger677fc912012-03-06 20:13:54 -0500891 sys/resource.h
892 sys/select.h
893 sys/socket.h
894 sys/sockio.h
895 sys/stat.h
896 sys/syscall.h
Darrick J. Wong79614b22015-04-20 22:27:19 -0400897 sys/sysctl.h
Mike Frysinger677fc912012-03-06 20:13:54 -0500898 sys/sysmacros.h
899 sys/time.h
900 sys/types.h
901 sys/un.h
902 sys/wait.h
903]))
Theodore Ts'oda76d6b2005-01-18 23:29:01 -0500904AC_CHECK_HEADERS(net/if.h,,,
905[[
906#if HAVE_SYS_TYPES_H
907#include <sys/types.h>
908#endif
909#if HAVE_SYS_SOCKET
910#include <sys/socket.h>
911#endif
912]])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000913AC_FUNC_VPRINTF
Theodore Ts'offf45482003-04-13 00:44:19 -0400914dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
915dnl is not decleared.
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400916AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT, 1,
917 [Define to 1 if dirent has d_reclen])],,
Theodore Ts'o6c65d252005-01-19 12:59:48 -0500918 [#include <dirent.h>])
Theodore Ts'o28739272014-01-03 00:26:43 -0500919AC_CHECK_MEMBERS([struct stat.st_atim])
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400920dnl Check to see if ssize_t was declared
921AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T, 1,
922 [Define to 1 if ssize_t declared])],,
Theodore Ts'o6c65d252005-01-19 12:59:48 -0500923 [#include <sys/types.h>])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000924dnl
Theodore Ts'ob0b9c4d1997-10-20 23:36:30 +0000925dnl Check to see if llseek() is declared in unistd.h. On some libc's
926dnl it is, and on others it isn't..... Thank you glibc developers....
927dnl
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400928AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1,
929 [Define to 1 if llseek declared in unistd.h])],,
Theodore Ts'o6c65d252005-01-19 12:59:48 -0500930 [#include <unistd.h>])
Theodore Ts'ob0b9c4d1997-10-20 23:36:30 +0000931dnl
Theodore Ts'o6928adc2000-05-25 23:28:50 +0000932dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
933dnl are so convoluted that I can't tell whether it will always be defined,
934dnl and if it isn't defined while lseek64 is defined in the library,
935dnl disaster will strike.
936dnl
937dnl Warning! Use of --enable-gcc-wall may throw off this test.
938dnl
939dnl
Theodore Ts'od1154eb2011-09-18 17:34:37 -0400940AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
941 [Define to 1 if lseek64 declared in unistd.h])],,
Theodore Ts'o6c65d252005-01-19 12:59:48 -0500942 [#define _LARGEFILE_SOURCE
943 #define _LARGEFILE64_SOURCE
944 #include <unistd.h>])
Theodore Ts'o6928adc2000-05-25 23:28:50 +0000945dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000946dnl Word sizes...
947dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000948AC_CHECK_SIZEOF(short)
949AC_CHECK_SIZEOF(int)
950AC_CHECK_SIZEOF(long)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000951AC_CHECK_SIZEOF(long long)
Phillip Susi274d46e2013-01-24 11:21:56 -0500952AC_CHECK_SIZEOF(off_t)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000953SIZEOF_SHORT=$ac_cv_sizeof_short
954SIZEOF_INT=$ac_cv_sizeof_int
955SIZEOF_LONG=$ac_cv_sizeof_long
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000956SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
Phillip Susi274d46e2013-01-24 11:21:56 -0500957SIZEOF_OFF_T=$ac_cv_sizeof_off_t
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000958AC_SUBST(SIZEOF_SHORT)
959AC_SUBST(SIZEOF_INT)
960AC_SUBST(SIZEOF_LONG)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000961AC_SUBST(SIZEOF_LONG_LONG)
Phillip Susi274d46e2013-01-24 11:21:56 -0500962AC_SUBST(SIZEOF_OFF_T)
Theodore Ts'o877eb6d2001-06-11 06:54:13 +0000963AC_C_BIGENDIAN
Chen Qi91f04682014-05-05 21:08:42 -0400964if test $cross_compiling = no; then
965 BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
966else
967 CROSS_COMPILE="1" BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
968fi
Theodore Ts'o4ea7ea02006-04-09 08:41:55 -0400969ASM_TYPES_HEADER=./asm_types.h
970AC_SUBST_FILE(ASM_TYPES_HEADER)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000971dnl
Theodore Ts'o488c75a2008-06-07 08:55:21 -0400972dnl Save the configuration #defines needed for the public ext2fs.h
973dnl header file
974dnl
975echo "/* These defines are needed for the public ext2fs.h header file */" \
976 > public_config.h
977if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
978 uniq tmp_config.$$ >> public_config.h
979else
980 echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
981fi
982if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
983 uniq tmp_config.$$ >> public_config.h
984else
985 echo "#undef WORDS_BIGENDIAN" >> public_config.h
986fi
987rm -f tmp_config.$$
988PUBLIC_CONFIG_HEADER=./public_config.h
989AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
990dnl
Theodore Ts'o0c193f82003-08-01 14:26:23 -0400991dnl See if we have inttypes.h and if intptr_t is defined
992dnl
993AC_CHECK_HEADERS([inttypes.h])
Theodore Ts'od2ee56d2005-01-09 00:57:45 -0500994AC_CHECK_TYPES(intptr_t)
Theodore Ts'o0c193f82003-08-01 14:26:23 -0400995dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000996dnl See if struct stat has a st_flags field, in which case we can get file
997dnl flags somewhat portably. Also check for the analogous setter, chflags().
998dnl
999AC_MSG_CHECKING(whether struct stat has a st_flags field)
1000AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
1001 AC_TRY_COMPILE([#include <sys/stat.h>],
1002 [struct stat stat; stat.st_flags = 0;],
1003 [e2fsprogs_cv_struct_st_flags=yes],
1004 [e2fsprogs_cv_struct_st_flags=no]))
1005AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
1006if test "$e2fsprogs_cv_struct_st_flags" = yes; then
Theodore Ts'oc03bc4e1999-10-20 18:20:36 +00001007 AC_MSG_CHECKING(whether st_flags field is useful)
1008 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
1009 AC_TRY_COMPILE([#include <sys/stat.h>],
1010 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
1011 [e2fsprogs_cv_struct_st_flags_immut=yes],
1012 [e2fsprogs_cv_struct_st_flags_immut=no]))
1013 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
1014 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001015 AC_DEFINE(HAVE_STAT_FLAGS, 1,
1016 [Define to 1 if struct stat has st_flags])
Theodore Ts'oc03bc4e1999-10-20 18:20:36 +00001017 fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001018fi
Theodore Ts'o84ea6e72004-03-19 19:29:17 -05001019dnl
1020dnl Check for the presence of SA_LEN
1021dnl
Theodore Ts'o6c65d252005-01-19 12:59:48 -05001022AC_CHECK_MEMBER(struct sockaddr.sa_len,
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001023 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,
1024 [Define to 1 if if struct sockaddr contains sa_len]),,
Theodore Ts'o6c65d252005-01-19 12:59:48 -05001025 [#include <sys/types.h>
1026 #include <sys/socket.h>])
Theodore Ts'o84ea6e72004-03-19 19:29:17 -05001027dnl
Eric Sandeen9ed8e5f2009-10-02 11:32:42 -05001028dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using
1029dnl the system-provided blkid library
1030dnl
1031if test -n "$BLKID_CMT"; then
1032 AC_SEARCH_LIBS([blkid_probe_all], [blkid])
1033fi
1034dnl
Mike Frysinger677fc912012-03-06 20:13:54 -05001035AC_CHECK_FUNCS(m4_flatten([
1036 __secure_getenv
Theodore Ts'o74f2c4a2015-06-19 19:28:25 -04001037 add_key
Mike Frysinger677fc912012-03-06 20:13:54 -05001038 backtrace
1039 blkid_probe_get_topology
Theodore Ts'o2de26282014-05-05 01:22:22 -04001040 blkid_probe_enable_partitions
Mike Frysinger677fc912012-03-06 20:13:54 -05001041 chflags
Baruch Siach9a393892014-01-02 13:05:37 -05001042 fadvise64
Mike Frysinger677fc912012-03-06 20:13:54 -05001043 fallocate
1044 fallocate64
1045 fchown
1046 fdatasync
1047 fstat64
1048 ftruncate64
Theodore Ts'o28739272014-01-03 00:26:43 -05001049 futimes
Theodore Ts'o6c59a662014-01-04 20:44:29 -05001050 getcwd
Mike Frysinger677fc912012-03-06 20:13:54 -05001051 getdtablesize
1052 getmntinfo
Theodore Ts'o25ff7722012-04-05 15:16:50 -07001053 getpwuid_r
Mike Frysinger677fc912012-03-06 20:13:54 -05001054 getrlimit
1055 getrusage
1056 jrand48
Theodore Ts'o74f2c4a2015-06-19 19:28:25 -04001057 keyctl
Ross Burtonc84da2e2014-07-10 17:44:38 +01001058 llistxattr
Mike Frysinger677fc912012-03-06 20:13:54 -05001059 llseek
1060 lseek64
1061 mallinfo
1062 mbstowcs
1063 memalign
Theodore Ts'o6c59a662014-01-04 20:44:29 -05001064 mempcpy
Mike Frysinger677fc912012-03-06 20:13:54 -05001065 mmap
1066 msync
1067 nanosleep
1068 open64
1069 pathconf
1070 posix_fadvise
Baruch Siach9a393892014-01-02 13:05:37 -05001071 posix_fadvise64
Mike Frysinger677fc912012-03-06 20:13:54 -05001072 posix_memalign
1073 prctl
Darrick J. Wongbaa35442014-08-02 19:18:03 -04001074 pread
1075 pwrite
Theodore Ts'of00948a2014-08-08 16:42:05 -04001076 pread64
1077 pwrite64
Theodore Ts'o1ad31742013-06-16 14:34:59 -04001078 secure_getenv
Theodore Ts'ob24efa22012-04-05 15:31:09 -07001079 setmntent
Mike Frysinger677fc912012-03-06 20:13:54 -05001080 setresgid
1081 setresuid
Theodore Ts'oc42de752014-07-08 20:02:48 -04001082 snprintf
Mike Frysinger677fc912012-03-06 20:13:54 -05001083 srandom
Theodore Ts'o6c59a662014-01-04 20:44:29 -05001084 stpcpy
Mike Frysinger677fc912012-03-06 20:13:54 -05001085 strcasecmp
1086 strdup
1087 strnlen
1088 strptime
1089 strtoull
1090 sync_file_range
1091 sysconf
1092 usleep
1093 utime
Theodore Ts'o441eb332014-10-19 22:02:48 -04001094 utimes
Mike Frysinger677fc912012-03-06 20:13:54 -05001095 valloc
1096]))
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +00001097dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +00001098dnl Check to see if -lsocket is required (solaris) to make something
1099dnl that uses socket() to compile; this is needed for the UUID library
1100dnl
1101SOCKET_LIB=''
1102AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
1103AC_SUBST(SOCKET_LIB)
1104dnl
Darrick J. Wongb291c112014-09-13 15:12:46 -07001105dnl See if libmagic exists
1106dnl
1107AC_CHECK_LIB(magic, magic_file, [MAGIC_LIB=-lmagic
1108AC_CHECK_HEADERS([magic.h])])
Theodore Ts'od2e3c0d2014-09-21 01:25:58 -04001109if test "$ac_cv_lib_dl_dlopen" = yes ; then
1110 MAGIC_LIB=$DLOPEN_LIB
1111fi
Darrick J. Wongb291c112014-09-13 15:12:46 -07001112AC_SUBST(MAGIC_LIB)
1113dnl
Darrick J. Wong81cbf1e2015-05-13 17:22:40 -07001114dnl Check to see if the FUSE library is -lfuse or -losxfuse
1115dnl
1116FUSE_CMT=
1117FUSE_LIB=
1118dnl osxfuse.dylib supersedes fuselib.dylib
1119AC_ARG_ENABLE([fuse2fs],
Theodore Ts'of5dffb82015-06-20 14:20:14 -04001120[ --disable-fuse2fs do not build fuse2fs],
Darrick J. Wong81cbf1e2015-05-13 17:22:40 -07001121if test "$enableval" = "no"
1122then
1123 FUSE_CMT="#"
1124 AC_MSG_RESULT([Disabling fuse2fs])
1125else
1126 AC_CHECK_HEADERS([pthread.h fuse.h], [],
1127[AC_MSG_FAILURE([Cannot find fuse2fs headers.])],
1128[#define _FILE_OFFSET_BITS 64
1129#define FUSE_USE_VERSION 29])
1130
1131 AC_PREPROC_IFELSE(
1132[AC_LANG_PROGRAM([[#define FUSE_USE_VERSION 29
1133#ifdef __linux__
1134#include <linux/fs.h>
1135#include <linux/falloc.h>
1136#include <linux/xattr.h>
1137#endif
1138]], [])], [], [AC_MSG_FAILURE([Cannot find fuse2fs Linux headers.])])
1139
1140 AC_CHECK_LIB(osxfuse, fuse_main, [FUSE_LIB=-losxfuse],
1141 [AC_CHECK_LIB(fuse, fuse_main, [FUSE_LIB=-lfuse],
1142 [AC_MSG_FAILURE([Cannot find fuse library.])])])
1143 AC_MSG_RESULT([Enabling fuse2fs])
1144fi
1145,
1146AC_CHECK_HEADERS([pthread.h fuse.h], [], [FUSE_CMT="#"],
1147[#define _FILE_OFFSET_BITS 64
1148#define FUSE_USE_VERSION 29
1149#ifdef __linux__
1150# include <linux/fs.h>
1151# include <linux/falloc.h>
1152# include <linux/xattr.h>
1153#endif])
1154if test -z "$FUSE_CMT"
1155then
1156 AC_CHECK_LIB(osxfuse, fuse_main, [FUSE_LIB=-losxfuse],
1157[AC_CHECK_LIB(fuse, fuse_main, [FUSE_LIB=-lfuse], [FUSE_CMT="#"])])
1158fi
1159if test -z "$FUSE_CMT"
1160then
1161 AC_MSG_RESULT([Enabling fuse2fs by default.])
1162fi
1163)
1164AC_SUBST(FUSE_LIB)
1165AC_SUBST(FUSE_CMT)
1166dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001167dnl See if optreset exists
1168dnl
1169AC_MSG_CHECKING(for optreset)
1170AC_CACHE_VAL(ac_cv_have_optreset,
1171[AC_EGREP_HEADER(optreset, unistd.h,
1172 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
1173AC_MSG_RESULT($ac_cv_have_optreset)
1174if test $ac_cv_have_optreset = yes; then
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001175 AC_DEFINE(HAVE_OPTRESET, 1, [Define to 1 if optreset for getopt is present])
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001176fi
1177dnl
Theodore Ts'od7f45af2008-09-12 10:15:26 -04001178dnl Test for sem_init, and which library it might require:
1179dnl
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001180AH_TEMPLATE([HAVE_SEM_INIT], [Define to 1 if sem_init() exists])
Theodore Ts'od7f45af2008-09-12 10:15:26 -04001181SEM_INIT_LIB=''
1182AC_CHECK_FUNC(sem_init, ,
1183 AC_CHECK_LIB(pthread, sem_init,
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001184 AC_DEFINE(HAVE_SEM_INIT, 1)
Theodore Ts'od7f45af2008-09-12 10:15:26 -04001185 SEM_INIT_LIB=-lpthread,
1186 AC_CHECK_LIB(rt, sem_init,
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001187 AC_DEFINE(HAVE_SEM_INIT, 1)
Theodore Ts'od7f45af2008-09-12 10:15:26 -04001188 SEM_INIT_LIB=-lrt,
1189 AC_CHECK_LIB(posix4, sem_init,
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001190 AC_DEFINE(HAVE_SEM_INIT, 1)
Theodore Ts'od7f45af2008-09-12 10:15:26 -04001191 SEM_INIT_LIB=-lposix4))))dnl
1192AC_SUBST(SEM_INIT_LIB)
1193dnl
Theodore Ts'oe54635d2006-08-06 14:33:13 -04001194dnl Check for unified diff
1195dnl
1196AC_MSG_CHECKING(for unified diff option)
Theodore Ts'o27f991b2008-04-01 20:32:55 -04001197if diff -u $0 $0 > /dev/null 2>&1 ; then
Theodore Ts'oe54635d2006-08-06 14:33:13 -04001198 UNI_DIFF_OPTS=-u
1199else
1200 UNI_DIFF_OPTS=-c
1201fi
1202AC_MSG_RESULT($UNI_DIFF_OPTS)
1203AC_SUBST(UNI_DIFF_OPTS)
1204dnl
Theodore Ts'o8f3f29d2000-02-11 05:04:44 +00001205dnl We use the EXT2 ioctls only under Linux
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001206dnl
Theodore Ts'o8f3f29d2000-02-11 05:04:44 +00001207case "$host_os" in
1208linux*)
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001209 AC_DEFINE(HAVE_EXT2_IOCTLS, 1, [Define to 1 if Ext2 ioctls present])
Theodore Ts'o8f3f29d2000-02-11 05:04:44 +00001210 ;;
1211esac
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001212dnl
Theodore Ts'offf45482003-04-13 00:44:19 -04001213dnl OS-specific uncomment control
Theodore Ts'oe6f2bda2002-08-18 03:37:10 -04001214dnl
1215LINUX_CMT="#"
Theodore Ts'offf45482003-04-13 00:44:19 -04001216CYGWIN_CMT="#"
1217UNIX_CMT=
Theodore Ts'oe6f2bda2002-08-18 03:37:10 -04001218case "$host_os" in
1219linux*)
1220 LINUX_CMT=
1221 ;;
Theodore Ts'offf45482003-04-13 00:44:19 -04001222cygwin)
1223 CYGWIN_CMT=
1224 UNIX_CMT="#"
Theodore Ts'offf45482003-04-13 00:44:19 -04001225 ;;
Theodore Ts'oe6f2bda2002-08-18 03:37:10 -04001226esac
1227AC_SUBST(LINUX_CMT)
Theodore Ts'offf45482003-04-13 00:44:19 -04001228AC_SUBST(CYGWIN_CMT)
1229AC_SUBST(UNIX_CMT)
Theodore Ts'oe6f2bda2002-08-18 03:37:10 -04001230dnl
Theodore Ts'o6c133521999-07-03 20:37:03 +00001231dnl Linux and Hurd places root files in the / by default
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001232dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001233case "$host_os" in
Theodore Ts'o93636bd2003-07-12 02:45:05 -04001234linux* | gnu* | k*bsd*-gnu)
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +00001235 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
1236 root_prefix="";
Theodore Ts'o02d04db2008-08-22 10:52:42 -04001237 AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +00001238 fi
1239 ;;
1240esac
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +00001241dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +00001242dnl On Linux/hurd, force the prefix to be /usr
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +00001243dnl
1244case "$host_os" in
Theodore Ts'o93636bd2003-07-12 02:45:05 -04001245linux* | gnu* | k*bsd*-gnu)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +00001246 if test "$prefix" = NONE ; then
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +00001247 prefix="/usr";
Theodore Ts'o02d04db2008-08-22 10:52:42 -04001248 AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
Theodore Ts'obff61a72002-05-21 22:21:38 -04001249 if test "$mandir" = '${prefix}/man' ; then
Theodore Ts'o02d04db2008-08-22 10:52:42 -04001250 AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
Theodore Ts'obff61a72002-05-21 22:21:38 -04001251 mandir=/usr/share/man
1252 fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001253 fi
1254;;
1255esac
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +00001256if test "$root_prefix" = NONE ; then
Theodore Ts'offe19911998-04-08 06:05:49 +00001257 if test "$prefix" = NONE ; then
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +00001258 root_prefix="$ac_default_prefix"
1259 else
1260 root_prefix="$prefix"
1261 fi
Theodore Ts'ob5ffead2002-05-11 19:17:00 -04001262 root_bindir=$bindir
1263 root_sbindir=$sbindir
1264 root_libdir=$libdir
1265 root_sysconfdir=$sysconfdir
1266else
1267 root_bindir='${root_prefix}/bin'
1268 root_sbindir='${root_prefix}/sbin'
1269 root_libdir='${root_prefix}/lib'
1270 root_sysconfdir='${root_prefix}/etc'
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +00001271fi
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -05001272if test "$bindir" != '${exec_prefix}/bin'; then
1273 root_bindir=$bindir
Theodore Ts'o02d04db2008-08-22 10:52:42 -04001274 AC_MSG_RESULT([Setting root_bindir to $root_bindir])
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -05001275fi
1276if test "$sbindir" != '${exec_prefix}/sbin'; then
1277 root_sbindir=$sbindir
Theodore Ts'o02d04db2008-08-22 10:52:42 -04001278 AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -05001279fi
1280if test "$libdir" != '${exec_prefix}/lib'; then
1281 root_libdir=$libdir
Theodore Ts'o02d04db2008-08-22 10:52:42 -04001282 AC_MSG_RESULT([Setting root_libdir to $root_libdir])
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -05001283fi
1284if test "$sysconfdir" != '${prefix}/etc'; then
1285 root_sysconfdir=$sysconfdir
Theodore Ts'o02d04db2008-08-22 10:52:42 -04001286 AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
Theodore Ts'oc4ef11c2008-01-04 16:55:37 -05001287fi
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +00001288AC_SUBST(root_prefix)
Theodore Ts'ob5ffead2002-05-11 19:17:00 -04001289AC_SUBST(root_bindir)
1290AC_SUBST(root_sbindir)
1291AC_SUBST(root_libdir)
1292AC_SUBST(root_sysconfdir)
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001293dnl
Theodore Ts'o55e00a22011-09-18 23:53:23 -04001294dnl Allow specification of the multiarch arch
1295dnl
1296AC_ARG_WITH([multiarch],
1297[ --with-multiarch=ARCH specify the multiarch triplet],
Theodore Ts'od7fa4102014-02-05 15:45:36 -05001298if test "$withval" = "lib64"; then
1299 libdir=/usr/lib64
1300 root_libdir=/lib64
1301else
1302 libdir=$libdir/$withval
1303 root_libdir=$root_libdir/$withval
1304fi
Theodore Ts'o55e00a22011-09-18 23:53:23 -04001305)dnl
1306dnl
Theodore Ts'od3de1a72012-12-15 22:10:27 -05001307dnl See if -static works. This could fail if the linker does not
1308dnl support -static, or if required external libraries are not available
1309dnl in static form.
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001310dnl
Theodore Ts'od3de1a72012-12-15 22:10:27 -05001311AC_MSG_CHECKING([whether we can link with -static])
Theodore Ts'oae851481997-04-29 18:13:24 +00001312AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
1313[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
1314AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
1315 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
1316LDFLAGS=$SAVE_LDFLAGS])
Theodore Ts'odefde781999-01-04 07:39:19 +00001317dnl
1318dnl Regardless of how the test turns out, Solaris doesn't handle -static
1319dnl This is caused by the socket library requiring the nsl library, which
1320dnl requires the -dl library, which only works for dynamically linked
1321dnl programs. It basically means you can't have statically linked programs
1322dnl which use the network under Solaris.
1323dnl
1324case "$host_os" in
1325solaris2.*)
1326 ac_cv_e2fsprogs_use_static=no
1327;;
1328esac
Theodore Ts'oae851481997-04-29 18:13:24 +00001329AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
Theodore Ts'o74becf31997-04-26 14:37:06 +00001330LDFLAG_STATIC=
Theodore Ts'oae851481997-04-29 18:13:24 +00001331if test $ac_cv_e2fsprogs_use_static = yes; then
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001332 LDFLAG_STATIC=-static
Theodore Ts'oae851481997-04-29 18:13:24 +00001333fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001334AC_SUBST(LDFLAG_STATIC)
1335dnl
Theodore Ts'o07a0db12003-07-05 14:50:24 -04001336dnl Work around mysterious Darwin / GNU libintl problem
1337dnl (__asm__ redirection doesn't work for some mysterious reason. Looks like
1338dnl Apple hacked gcc somehow?)
1339dnl
1340case "$host_os" in
1341darwin*)
Theodore Ts'o02d04db2008-08-22 10:52:42 -04001342 AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001343 AC_DEFINE(_INTL_REDIRECT_MACROS, 1,
1344 [Define to 1 if Apple Darwin libintl workaround is needed])
Theodore Ts'o07a0db12003-07-05 14:50:24 -04001345 ;;
1346esac
1347dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001348dnl Make the ss and et directories work correctly.
1349dnl
1350SS_DIR=`cd ${srcdir}/lib/ss; pwd`
1351ET_DIR=`cd ${srcdir}/lib/et; pwd`
1352AC_SUBST(SS_DIR)
1353AC_SUBST(ET_DIR)
1354dnl
1355dnl Only try to run the test suite if we're not cross compiling.
1356dnl
1357if test "$cross_compiling" = yes ; then
1358 DO_TEST_SUITE=
1359else
1360 DO_TEST_SUITE=check
1361fi
1362AC_SUBST(DO_TEST_SUITE)
1363dnl
Theodore Ts'oc6f35b82003-05-17 16:29:27 -04001364dnl Only include the intl include files if we're building with them
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001365dnl
1366INCLUDES='-I. -I$(top_builddir)/lib -I$(top_srcdir)/lib'
1367if test -n "$CPPFLAGS" ; then
1368 INCLUDES="$INCLUDES $CPPFLAGS"
Theodore Ts'oc6f35b82003-05-17 16:29:27 -04001369fi
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001370if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
1371 INCLUDES=$INCLUDES' -I$(top_builddir)/intl -I$(top_srcdir)/intl'
1372fi
Theodore Ts'o6c59a662014-01-04 20:44:29 -05001373if test -n "$WITH_DIET_LIBC" ; then
1374 INCLUDES="$INCLUDES -D_REENTRANT"
1375fi
Theodore Ts'od1154eb2011-09-18 17:34:37 -04001376AC_SUBST(INCLUDES)
Theodore Ts'o5b5bd2c2014-07-10 00:17:05 -04001377AM_MKINSTALLDIRS
Theodore Ts'oc6f35b82003-05-17 16:29:27 -04001378dnl
Theodore Ts'odd947da2005-11-09 18:37:07 -04001379dnl Build CFLAGS
1380dnl
1381if test $cross_compiling = no; then
Theodore Ts'o28739272014-01-03 00:26:43 -05001382 BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
Theodore Ts'odd947da2005-11-09 18:37:07 -04001383 BUILD_LDFLAGS="$LDFLAGS"
Theodore Ts'odd947da2005-11-09 18:37:07 -04001384fi
1385AC_SUBST(BUILD_CFLAGS)
1386AC_SUBST(BUILD_LDFLAGS)
1387dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001388dnl Make our output files, being sure that we create the some miscellaneous
1389dnl directories
1390dnl
1391test -d lib || mkdir lib
1392test -d include || mkdir include
1393test -d include/linux || mkdir include/linux
Theodore Ts'odefde781999-01-04 07:39:19 +00001394test -d include/asm || mkdir include/asm
Theodore Ts'o44dfb372015-07-01 19:42:05 -04001395if test -z "$UUID_CMT" ; then
1396 uuid_out_list="lib/uuid/Makefile lib/uuid/uuid.pc \
1397 lib/uuid/uuid_types.h"
1398fi
1399if test -z "$BLKID_CMT" ; then
1400 blkid_out_list="lib/blkid/Makefile lib/blkid/blkid.pc \
1401 lib/blkid/blkid_types.h"
1402fi
Theodore Ts'obff0cc92003-03-23 01:37:53 -05001403for i in MCONFIG Makefile e2fsprogs.spec \
Theodore Ts'o183c73b2012-05-12 23:13:24 -04001404 util/Makefile util/subst.conf util/gen-tarball util/install-symlink \
Theodore Ts'o4ea7ea02006-04-09 08:41:55 -04001405 lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
1406 lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
Theodore Ts'of34af412015-07-11 23:05:57 -04001407 $uuid_out_list $blkid_out_list lib/support/Makefile \
Theodore Ts'o44dfb372015-07-01 19:42:05 -04001408 lib/ss/ss.pc lib/et/com_err.pc lib/e2p/e2p.pc lib/ext2fs/ext2fs.pc \
Theodore Ts'o921f4ad2004-11-19 17:25:27 -05001409 misc/Makefile ext2ed/Makefile e2fsck/Makefile \
Theodore Ts'o94ba8c72003-03-02 02:07:14 -05001410 debugfs/Makefile tests/Makefile tests/progs/Makefile \
Matthias Andree98a5ad62009-07-15 17:37:52 +02001411 resize/Makefile doc/Makefile intl/Makefile \
1412 intl/libgnuintl.h po/Makefile.in ; do
Theodore Ts'o94ba8c72003-03-02 02:07:14 -05001413 if test -d `dirname ${srcdir}/$i` ; then
1414 outlist="$outlist $i"
1415 fi
1416done
1417AC_OUTPUT($outlist)
Theodore Ts'oee683a12005-02-05 15:53:56 -05001418if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi