xref: /aosp_15_r20/external/e2fsprogs/configure.ac (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard WorkerAC_INIT
2*6a54128fSAndroid Build Coastguard WorkerAC_CONFIG_SRCDIR([version.h])
3*6a54128fSAndroid Build Coastguard WorkerAC_PREREQ([2.71])
4*6a54128fSAndroid Build Coastguard WorkerAC_CONFIG_AUX_DIR(config)
5*6a54128fSAndroid Build Coastguard WorkerAC_CONFIG_HEADERS([lib/config.h])
6*6a54128fSAndroid Build Coastguard WorkerAH_BOTTOM([#include <dirpaths.h>])
7*6a54128fSAndroid Build Coastguard WorkerAC_USE_SYSTEM_EXTENSIONS
8*6a54128fSAndroid Build Coastguard WorkerMCONFIG=./MCONFIG
9*6a54128fSAndroid Build Coastguard WorkerAC_SUBST_FILE(MCONFIG)
10*6a54128fSAndroid Build Coastguard WorkerBINARY_TYPE=bin
11*6a54128fSAndroid Build Coastguard Workerdnl
12*6a54128fSAndroid Build Coastguard Workerdnl This is to figure out the version number and the date....
13*6a54128fSAndroid Build Coastguard Workerdnl
14*6a54128fSAndroid Build Coastguard WorkerE2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h  \
15*6a54128fSAndroid Build Coastguard Worker	| awk '{print $3}' | tr \" " " | awk '{print $1}'`
16*6a54128fSAndroid Build Coastguard WorkerE2FSPROGS_DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
17*6a54128fSAndroid Build Coastguard Worker	| tr \" " " | awk '{print $1}'`
18*6a54128fSAndroid Build Coastguard WorkerE2FSPROGS_DAY=$(echo $E2FSPROGS_DATE | awk -F- '{print $1}' | sed -e '/^[[1-9]]$/s/^/0/')
19*6a54128fSAndroid Build Coastguard WorkerMONTH=`echo $E2FSPROGS_DATE | awk -F- '{print $2}'`
20*6a54128fSAndroid Build Coastguard WorkerYEAR=`echo $E2FSPROGS_DATE | awk -F- '{print $3}'`
21*6a54128fSAndroid Build Coastguard Worker
22*6a54128fSAndroid Build Coastguard Workerif expr $YEAR ">" 1900 > /dev/null ; then
23*6a54128fSAndroid Build Coastguard Worker	E2FSPROGS_YEAR=$YEAR
24*6a54128fSAndroid Build Coastguard Workerelif expr $YEAR ">" 90 >/dev/null ; then
25*6a54128fSAndroid Build Coastguard Worker	E2FSPROGS_YEAR=19$YEAR
26*6a54128fSAndroid Build Coastguard Workerelse
27*6a54128fSAndroid Build Coastguard Worker	E2FSPROGS_YEAR=20$YEAR
28*6a54128fSAndroid Build Coastguard Workerfi
29*6a54128fSAndroid Build Coastguard Worker
30*6a54128fSAndroid Build Coastguard Workercase $MONTH in
31*6a54128fSAndroid Build Coastguard WorkerJan)	MONTH_NUM=01; E2FSPROGS_MONTH="January" ;;
32*6a54128fSAndroid Build Coastguard WorkerFeb)	MONTH_NUM=02; E2FSPROGS_MONTH="February" ;;
33*6a54128fSAndroid Build Coastguard WorkerMar)	MONTH_NUM=03; E2FSPROGS_MONTH="March" ;;
34*6a54128fSAndroid Build Coastguard WorkerApr)	MONTH_NUM=04; E2FSPROGS_MONTH="April" ;;
35*6a54128fSAndroid Build Coastguard WorkerMay)	MONTH_NUM=05; E2FSPROGS_MONTH="May" ;;
36*6a54128fSAndroid Build Coastguard WorkerJun)	MONTH_NUM=06; E2FSPROGS_MONTH="June" ;;
37*6a54128fSAndroid Build Coastguard WorkerJul)	MONTH_NUM=07; E2FSPROGS_MONTH="July" ;;
38*6a54128fSAndroid Build Coastguard WorkerAug)	MONTH_NUM=08; E2FSPROGS_MONTH="August" ;;
39*6a54128fSAndroid Build Coastguard WorkerSep)	MONTH_NUM=09; E2FSPROGS_MONTH="September" ;;
40*6a54128fSAndroid Build Coastguard WorkerOct)	MONTH_NUM=10; E2FSPROGS_MONTH="October" ;;
41*6a54128fSAndroid Build Coastguard WorkerNov)	MONTH_NUM=11; E2FSPROGS_MONTH="November" ;;
42*6a54128fSAndroid Build Coastguard WorkerDec)	MONTH_NUM=12; E2FSPROGS_MONTH="December" ;;
43*6a54128fSAndroid Build Coastguard Worker*)	AC_MSG_WARN([Unknown month $MONTH??]) ;;
44*6a54128fSAndroid Build Coastguard Workeresac
45*6a54128fSAndroid Build Coastguard Worker
46*6a54128fSAndroid Build Coastguard Workerbase_ver=`echo $E2FSPROGS_VERSION | \
47*6a54128fSAndroid Build Coastguard Worker	       sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
48*6a54128fSAndroid Build Coastguard Worker
49*6a54128fSAndroid Build Coastguard Workerdate_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
50*6a54128fSAndroid Build Coastguard Worker
51*6a54128fSAndroid Build Coastguard Workercase $E2FSPROGS_VERSION in
52*6a54128fSAndroid Build Coastguard Worker*-WIP|pre-*)
53*6a54128fSAndroid Build Coastguard Worker	E2FSPROGS_PKGVER="$base_ver~WIP.$date_spec"
54*6a54128fSAndroid Build Coastguard Worker	;;
55*6a54128fSAndroid Build Coastguard Worker*)
56*6a54128fSAndroid Build Coastguard Worker	E2FSPROGS_PKGVER="$base_ver"
57*6a54128fSAndroid Build Coastguard Worker	;;
58*6a54128fSAndroid Build Coastguard Workeresac
59*6a54128fSAndroid Build Coastguard Worker
60*6a54128fSAndroid Build Coastguard Workerunset DATE MONTH YEAR base_ver pre_vers date_spec
61*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION])
62*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}])
63*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E2FSPROGS_YEAR)
64*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E2FSPROGS_MONTH)
65*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E2FSPROGS_DAY)
66*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E2FSPROGS_VERSION)
67*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E2FSPROGS_PKGVER)
68*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E2FSPROGS_DATE)
69*6a54128fSAndroid Build Coastguard Workerdnl
70*6a54128fSAndroid Build Coastguard Workerdnl Use diet libc
71*6a54128fSAndroid Build Coastguard Workerdnl
72*6a54128fSAndroid Build Coastguard WorkerWITH_DIET_LIBC=
73*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([diet-libc],
74*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--with-diet-libc],[use diet libc]),
75*6a54128fSAndroid Build Coastguard WorkerCC="diet cc -nostdinc"
76*6a54128fSAndroid Build Coastguard WorkerWITH_DIET_LIBC=yes
77*6a54128fSAndroid Build Coastguard Workerif test -z "$LIBS"
78*6a54128fSAndroid Build Coastguard Workerthen
79*6a54128fSAndroid Build Coastguard Worker	LIBS="-lcompat"
80*6a54128fSAndroid Build Coastguard Workerelse
81*6a54128fSAndroid Build Coastguard Worker	LIBS="$LIBS -lcompat"
82*6a54128fSAndroid Build Coastguard Workerfi
83*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT(CC=$CC))dnl
84*6a54128fSAndroid Build Coastguard Workerdnl
85*6a54128fSAndroid Build Coastguard WorkerAC_CANONICAL_HOST
86*6a54128fSAndroid Build Coastguard Workerdnl
87*6a54128fSAndroid Build Coastguard Workerdnl Check to see if libdl exists for the sake of dlopen
88*6a54128fSAndroid Build Coastguard Workerdnl
89*6a54128fSAndroid Build Coastguard WorkerDLOPEN_LIB=''
90*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_LIB(dl, dlopen,DLOPEN_LIB=-ldl)
91*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DLOPEN_LIB)
92*6a54128fSAndroid Build Coastguard Workerdnl
93*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([cc],
94*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
95*6a54128fSAndroid Build Coastguard WorkerAC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
96*6a54128fSAndroid Build Coastguard Workerdnl
97*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([ccopts],
98*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--with-ccopts],[no longer supported, use CFLAGS= instead]),
99*6a54128fSAndroid Build Coastguard WorkerAC_MSG_ERROR([--with-ccopts no longer supported; use CFLAGS= instead]))
100*6a54128fSAndroid Build Coastguard Workerdnl
101*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([ldopts],
102*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--with-ldopts],[no longer supported, use LDFLAGS= instead]),
103*6a54128fSAndroid Build Coastguard WorkerAC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead]))
104*6a54128fSAndroid Build Coastguard Workerdnl
105*6a54128fSAndroid Build Coastguard WorkerAC_PROG_CC
106*6a54128fSAndroid Build Coastguard Workerif test "$GCC" = yes; then
107*6a54128fSAndroid Build Coastguard Worker   RDYNAMIC="-rdynamic"
108*6a54128fSAndroid Build Coastguard Worker   AC_SUBST(RDYNAMIC)
109*6a54128fSAndroid Build Coastguard Workerfi
110*6a54128fSAndroid Build Coastguard WorkerAC_PROG_CPP
111*6a54128fSAndroid Build Coastguard Workerdnl
112*6a54128fSAndroid Build Coastguard Workerdnl Alpha computers use fast and imprecise floating point code that may
113*6a54128fSAndroid Build Coastguard Workerdnl miss exceptions by default. Force sane options if we're using GCC.
114*6a54128fSAndroid Build Coastguard WorkerAC_MSG_CHECKING(for additional special compiler flags)
115*6a54128fSAndroid Build Coastguard Workerif test "$GCC" = yes
116*6a54128fSAndroid Build Coastguard Workerthen
117*6a54128fSAndroid Build Coastguard Worker    case "$host_cpu" in
118*6a54128fSAndroid Build Coastguard Worker	alpha)		addcflags="-mieee" ;;
119*6a54128fSAndroid Build Coastguard Worker    esac
120*6a54128fSAndroid Build Coastguard Workerfi
121*6a54128fSAndroid Build Coastguard Workerif test "x$addcflags" != x
122*6a54128fSAndroid Build Coastguard Workerthen
123*6a54128fSAndroid Build Coastguard Worker    AC_MSG_RESULT($addcflags)
124*6a54128fSAndroid Build Coastguard Worker    CFLAGS="$addcflags $CFLAGS"
125*6a54128fSAndroid Build Coastguard Workerelse
126*6a54128fSAndroid Build Coastguard Worker    AC_MSG_RESULT([[(none)]])
127*6a54128fSAndroid Build Coastguard Workerfi
128*6a54128fSAndroid Build Coastguard Workerdnl
129*6a54128fSAndroid Build Coastguard Workerdnl Set default values for library extensions.  Will be dealt with after
130*6a54128fSAndroid Build Coastguard Workerdnl parsing configuration options, which may modify these
131*6a54128fSAndroid Build Coastguard Workerdnl
132*6a54128fSAndroid Build Coastguard WorkerLIB_EXT=.a
133*6a54128fSAndroid Build Coastguard WorkerSTATIC_LIB_EXT=.a
134*6a54128fSAndroid Build Coastguard WorkerPROFILED_LIB_EXT=.a
135*6a54128fSAndroid Build Coastguard Workerdnl
136*6a54128fSAndroid Build Coastguard Workerdnl Allow separate `root_prefix' to be specified
137*6a54128fSAndroid Build Coastguard Workerdnl
138*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([root-prefix],
139*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--with-root-prefix=PREFIX],[override prefix variable for files to be placed in the root]),
140*6a54128fSAndroid Build Coastguard Workerroot_prefix=$withval,
141*6a54128fSAndroid Build Coastguard Workerroot_prefix=NONE)dnl
142*6a54128fSAndroid Build Coastguard Workerdnl
143*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-maintainer-mode
144*6a54128fSAndroid Build Coastguard Workerdnl
145*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([maintainer-mode],
146*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-maintainer-mode],[enable makefile rules useful for maintainers]),
147*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
148*6a54128fSAndroid Build Coastguard Workerthen
149*6a54128fSAndroid Build Coastguard Worker	MAINTAINER_CMT=#
150*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling maintainer mode])
151*6a54128fSAndroid Build Coastguard Workerelse
152*6a54128fSAndroid Build Coastguard Worker	MAINTAINER_CMT=
153*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling maintainer mode])
154*6a54128fSAndroid Build Coastguard Workerfi
155*6a54128fSAndroid Build Coastguard Worker,
156*6a54128fSAndroid Build Coastguard WorkerMAINTAINER_CMT=#
157*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling maintainer mode by default])
158*6a54128fSAndroid Build Coastguard Worker)
159*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(MAINTAINER_CMT)
160*6a54128fSAndroid Build Coastguard Workerdnl
161*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-symlink-install
162*6a54128fSAndroid Build Coastguard Workerdnl
163*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([symlink-install],
164*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-symlink-install],[use symlinks when installing instead of hard links]),
165*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
166*6a54128fSAndroid Build Coastguard Workerthen
167*6a54128fSAndroid Build Coastguard Worker	LINK_INSTALL_FLAGS=-f
168*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling symlinks for install])
169*6a54128fSAndroid Build Coastguard Workerelse
170*6a54128fSAndroid Build Coastguard Worker	LINK_INSTALL_FLAGS=-sf
171*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling symlinks for install])
172*6a54128fSAndroid Build Coastguard Workerfi
173*6a54128fSAndroid Build Coastguard Worker,
174*6a54128fSAndroid Build Coastguard WorkerLINK_INSTALL_FLAGS=-f
175*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling symlinks for install by default])
176*6a54128fSAndroid Build Coastguard Worker)
177*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(LINK_INSTALL_FLAGS)
178*6a54128fSAndroid Build Coastguard Workerdnl
179*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-relative-symlinks
180*6a54128fSAndroid Build Coastguard Workerdnl
181*6a54128fSAndroid Build Coastguard Workerrelative_symlink_defined=
182*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([relative-symlinks],
183*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-relative-symlinks],[use relative symlinks when installing]),
184*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
185*6a54128fSAndroid Build Coastguard Workerthen
186*6a54128fSAndroid Build Coastguard Worker	SYMLINK_RELATIVE=
187*6a54128fSAndroid Build Coastguard Worker	relative_symlink_defined=yes
188*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling relative symlinks for install])
189*6a54128fSAndroid Build Coastguard Workerelse
190*6a54128fSAndroid Build Coastguard Worker	SYMLINK_RELATIVE=--relative
191*6a54128fSAndroid Build Coastguard Worker	relative_symlink_defined=yes
192*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling relative symlinks for install])
193*6a54128fSAndroid Build Coastguard Workerfi)
194*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([symlink-relative-symlinks],,
195*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
196*6a54128fSAndroid Build Coastguard Workerthen
197*6a54128fSAndroid Build Coastguard Worker	SYMLINK_RELATIVE=yes
198*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling relative symlinks for install])
199*6a54128fSAndroid Build Coastguard Workerelse
200*6a54128fSAndroid Build Coastguard Worker	SYMLINK_RELATIVE=--relative
201*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling relative symlinks for install])
202*6a54128fSAndroid Build Coastguard Workerfi
203*6a54128fSAndroid Build Coastguard Worker,
204*6a54128fSAndroid Build Coastguard Workerif test -z "$relative_symlink_defined"
205*6a54128fSAndroid Build Coastguard Workerthen
206*6a54128fSAndroid Build Coastguard Worker	SYMLINK_RELATIVE=
207*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling relative symlinks for install by default])
208*6a54128fSAndroid Build Coastguard Workerfi
209*6a54128fSAndroid Build Coastguard Worker)
210*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SYMLINK_RELATIVE)
211*6a54128fSAndroid Build Coastguard Workerdnl
212*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-symlink-build
213*6a54128fSAndroid Build Coastguard Workerdnl
214*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([symlink-build],
215*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-symlink-build],[use symlinks while building instead of hard links]),
216*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
217*6a54128fSAndroid Build Coastguard Workerthen
218*6a54128fSAndroid Build Coastguard Worker	LINK_BUILD_FLAGS=
219*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling symlinks for build])
220*6a54128fSAndroid Build Coastguard Workerelse
221*6a54128fSAndroid Build Coastguard Worker	LINK_BUILD_FLAGS=-s
222*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling symlinks for build])
223*6a54128fSAndroid Build Coastguard Workerfi
224*6a54128fSAndroid Build Coastguard Worker,
225*6a54128fSAndroid Build Coastguard WorkerLINK_BUILD_FLAGS=
226*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling symlinks for build by default])
227*6a54128fSAndroid Build Coastguard Worker)
228*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(LINK_BUILD_FLAGS)
229*6a54128fSAndroid Build Coastguard Workerdnl
230*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-verbose-makecmds
231*6a54128fSAndroid Build Coastguard Workerdnl
232*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([verbose-makecmds],
233*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-verbose-makecmds],[enable verbose make command output]),
234*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
235*6a54128fSAndroid Build Coastguard Workerthen
236*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling verbose make commands])
237*6a54128fSAndroid Build Coastguard Worker	E=@echo
238*6a54128fSAndroid Build Coastguard Worker	ES=echo
239*6a54128fSAndroid Build Coastguard Worker	Q=@
240*6a54128fSAndroid Build Coastguard Workerelse
241*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling verbose make commands])
242*6a54128fSAndroid Build Coastguard Worker	E=@\\#
243*6a54128fSAndroid Build Coastguard Worker	ES=\\#
244*6a54128fSAndroid Build Coastguard Worker	Q=
245*6a54128fSAndroid Build Coastguard Workerfi
246*6a54128fSAndroid Build Coastguard Worker,
247*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling verbose make commands])
248*6a54128fSAndroid Build Coastguard WorkerE=@echo
249*6a54128fSAndroid Build Coastguard WorkerES=echo
250*6a54128fSAndroid Build Coastguard WorkerQ=@
251*6a54128fSAndroid Build Coastguard Worker)
252*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E)
253*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(ES)
254*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(Q)
255*6a54128fSAndroid Build Coastguard Workerdnl
256*6a54128fSAndroid Build Coastguard Workerdnl This needs to be before all of the --enable-*-shlibs options
257*6a54128fSAndroid Build Coastguard Workerdnl
258*6a54128fSAndroid Build Coastguard WorkerE2_PKG_CONFIG_STATIC=--static
259*6a54128fSAndroid Build Coastguard WorkerLDFLAG_DYNAMIC=
260*6a54128fSAndroid Build Coastguard WorkerPRIVATE_LIBS_CMT=
261*6a54128fSAndroid Build Coastguard Workerdnl
262*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-elf-shlibs
263*6a54128fSAndroid Build Coastguard Workerdnl
264*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([elf-shlibs],
265*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-elf-shlibs],[select ELF shared libraries]),
266*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
267*6a54128fSAndroid Build Coastguard Workerthen
268*6a54128fSAndroid Build Coastguard Worker	ELF_CMT=#
269*6a54128fSAndroid Build Coastguard Worker	MAKEFILE_ELF=/dev/null
270*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling ELF shared libraries])
271*6a54128fSAndroid Build Coastguard Workerelse
272*6a54128fSAndroid Build Coastguard Worker	E2_PKG_CONFIG_STATIC=
273*6a54128fSAndroid Build Coastguard Worker	ELF_CMT=
274*6a54128fSAndroid Build Coastguard Worker	MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
275*6a54128fSAndroid Build Coastguard Worker	[case "$host_os" in
276*6a54128fSAndroid Build Coastguard Worker	solaris2.*)
277*6a54128fSAndroid Build Coastguard Worker		MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
278*6a54128fSAndroid Build Coastguard Worker	;;
279*6a54128fSAndroid Build Coastguard Worker	esac]
280*6a54128fSAndroid Build Coastguard Worker	BINARY_TYPE=elfbin
281*6a54128fSAndroid Build Coastguard Worker	LIB_EXT=.so
282*6a54128fSAndroid Build Coastguard Worker	PRIVATE_LIBS_CMT=#
283*6a54128fSAndroid Build Coastguard Worker	LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib']
284*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling ELF shared libraries])
285*6a54128fSAndroid Build Coastguard Workerfi
286*6a54128fSAndroid Build Coastguard Worker,
287*6a54128fSAndroid Build Coastguard WorkerMAKEFILE_ELF=/dev/null
288*6a54128fSAndroid Build Coastguard WorkerELF_CMT=#
289*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling ELF shared libraries by default])
290*6a54128fSAndroid Build Coastguard Worker)
291*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(ELF_CMT)
292*6a54128fSAndroid Build Coastguard WorkerAC_SUBST_FILE(MAKEFILE_ELF)
293*6a54128fSAndroid Build Coastguard Workerdnl
294*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-bsd-shlibs
295*6a54128fSAndroid Build Coastguard Workerdnl
296*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([bsd-shlibs],
297*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-bsd-shlibs],[select BSD shared libraries]),
298*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
299*6a54128fSAndroid Build Coastguard Workerthen
300*6a54128fSAndroid Build Coastguard Worker	BSDLIB_CMT=#
301*6a54128fSAndroid Build Coastguard Worker	MAKEFILE_BSDLIB=/dev/null
302*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling BSD shared libraries])
303*6a54128fSAndroid Build Coastguard Workerelse
304*6a54128fSAndroid Build Coastguard Worker	E2_PKG_CONFIG_STATIC=
305*6a54128fSAndroid Build Coastguard Worker	BSDLIB_CMT=
306*6a54128fSAndroid Build Coastguard Worker	MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
307*6a54128fSAndroid Build Coastguard Worker	LIB_EXT=.so
308*6a54128fSAndroid Build Coastguard Worker	[case "$host_os" in
309*6a54128fSAndroid Build Coastguard Worker	darwin*)
310*6a54128fSAndroid Build Coastguard Worker		MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
311*6a54128fSAndroid Build Coastguard Worker		LIB_EXT=.dylib
312*6a54128fSAndroid Build Coastguard Worker	;;
313*6a54128fSAndroid Build Coastguard Worker	esac]
314*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling BSD shared libraries])
315*6a54128fSAndroid Build Coastguard Workerfi
316*6a54128fSAndroid Build Coastguard Worker,
317*6a54128fSAndroid Build Coastguard WorkerMAKEFILE_BSDLIB=/dev/null
318*6a54128fSAndroid Build Coastguard WorkerBSDLIB_CMT=#
319*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling BSD shared libraries by default])
320*6a54128fSAndroid Build Coastguard Worker)
321*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(BSDLIB_CMT)
322*6a54128fSAndroid Build Coastguard WorkerAC_SUBST_FILE(MAKEFILE_BSDLIB)
323*6a54128fSAndroid Build Coastguard Workerdnl
324*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-profile
325*6a54128fSAndroid Build Coastguard Workerdnl
326*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([profile],
327*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-profile],[build profiling libraries]),
328*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
329*6a54128fSAndroid Build Coastguard Workerthen
330*6a54128fSAndroid Build Coastguard Worker	PROFILE_CMT=#
331*6a54128fSAndroid Build Coastguard Worker	MAKEFILE_PROFILE=/dev/null
332*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling profiling libraries])
333*6a54128fSAndroid Build Coastguard Workerelse
334*6a54128fSAndroid Build Coastguard Worker	PROFILE_CMT=
335*6a54128fSAndroid Build Coastguard Worker	MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
336*6a54128fSAndroid Build Coastguard Worker	PROFILED_LIB_EXT=_p.a
337*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Building profiling libraries])
338*6a54128fSAndroid Build Coastguard Workerfi
339*6a54128fSAndroid Build Coastguard Worker,
340*6a54128fSAndroid Build Coastguard WorkerPROFILE_CMT=#
341*6a54128fSAndroid Build Coastguard WorkerMAKEFILE_PROFILE=/dev/null
342*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling profiling libraries by default])
343*6a54128fSAndroid Build Coastguard Worker)
344*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(PROFILE_CMT)
345*6a54128fSAndroid Build Coastguard WorkerAC_SUBST_FILE(MAKEFILE_PROFILE)
346*6a54128fSAndroid Build Coastguard Workerdnl
347*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-gcov
348*6a54128fSAndroid Build Coastguard Workerdnl
349*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([gcov],
350*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-gcov],[build for coverage testing using gcov]),
351*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "yes"
352*6a54128fSAndroid Build Coastguard Workerthen
353*6a54128fSAndroid Build Coastguard Worker	CFLAGS="-g -fprofile-arcs -ftest-coverage"
354*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="-fprofile-arcs -ftest-coverage"
355*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling gcov support])
356*6a54128fSAndroid Build Coastguard Workerfi
357*6a54128fSAndroid Build Coastguard Worker)
358*6a54128fSAndroid Build Coastguard Workerdnl
359*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-hardening
360*6a54128fSAndroid Build Coastguard Workerdnl
361*6a54128fSAndroid Build Coastguard WorkerCFLAGS_SHLIB="${CFLAGS_SHLIB:-$CFLAGS}"
362*6a54128fSAndroid Build Coastguard WorkerCFLAGS_STLIB="${CFLAGS_STLIB:-$CFLAGS}"
363*6a54128fSAndroid Build Coastguard WorkerLDFLAGS_SHLIB=${LDFLAGS_SHLIB:-$LDFLAGS}
364*6a54128fSAndroid Build Coastguard WorkerLDFLAGS_STATIC=${LDFLAGS_STATIC:-$LDFLAGS}
365*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([hardening],
366*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-hardening],[build for coverage testing using gcov]),
367*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "yes"
368*6a54128fSAndroid Build Coastguard Workerthen
369*6a54128fSAndroid Build Coastguard Worker	HARDEN_CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong"
370*6a54128fSAndroid Build Coastguard Worker	HARDEN_LDFLAGS=["-Wl,-z,relro -Wl,-z,now"]
371*6a54128fSAndroid Build Coastguard Worker	CFLAGS="$CFLAGS $HARDEN_CFLAGS -fPIE"
372*6a54128fSAndroid Build Coastguard Worker	CFLAGS_SHLIB="$CFLAGS_SHLIB $HARDEN_CFLAGS"
373*6a54128fSAndroid Build Coastguard Worker	CFLAGS_STLIB="$CFLAGS_STLIB $HARDEN_CFLAGS -fPIE"
374*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="$LDFLAGS $HARDEN_LDFLAGS -fPIE -pie"
375*6a54128fSAndroid Build Coastguard Worker	LDFLAGS_STATIC="$LDFLAGS_STATIC $HARDEN_LDFLAGS"
376*6a54128fSAndroid Build Coastguard Worker	LDFLAGS_SHLIB="$LDFLAGS_SHLIB $HARDEN_LDFLAGS"
377*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling hardening support])
378*6a54128fSAndroid Build Coastguard Workerfi
379*6a54128fSAndroid Build Coastguard Worker)
380*6a54128fSAndroid Build Coastguard Workerdnl
381*6a54128fSAndroid Build Coastguard Workerdnl Substitute library extensions
382*6a54128fSAndroid Build Coastguard Workerdnl
383*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(LIB_EXT)
384*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(STATIC_LIB_EXT)
385*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(PROFILED_LIB_EXT)
386*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(LDFLAG_DYNAMIC)
387*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(PRIVATE_LIBS_CMT)
388*6a54128fSAndroid Build Coastguard Workerdnl
389*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-jbd-debug
390*6a54128fSAndroid Build Coastguard Workerdnl
391*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([jbd-debug],
392*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-jbd-debug],[enable journal debugging]),
393*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
394*6a54128fSAndroid Build Coastguard Workerthen
395*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling journal debugging])
396*6a54128fSAndroid Build Coastguard Workerelse
397*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(CONFIG_JBD_DEBUG, 1,
398*6a54128fSAndroid Build Coastguard Worker		[Define to 1 if debugging ext3/4 journal code])
399*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling journal debugging])
400*6a54128fSAndroid Build Coastguard Workerfi
401*6a54128fSAndroid Build Coastguard Worker,
402*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling journal debugging by default])
403*6a54128fSAndroid Build Coastguard Worker)
404*6a54128fSAndroid Build Coastguard Workerdnl
405*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-blkid-debug
406*6a54128fSAndroid Build Coastguard Workerdnl
407*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([blkid-debug],
408*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-blkid-debug],[enable blkid debugging]),
409*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
410*6a54128fSAndroid Build Coastguard Workerthen
411*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling blkid debugging])
412*6a54128fSAndroid Build Coastguard Workerelse
413*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(CONFIG_BLKID_DEBUG, 1,
414*6a54128fSAndroid Build Coastguard Worker		[Define to 1 if debugging the blkid library])
415*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling blkid debugging])
416*6a54128fSAndroid Build Coastguard Workerfi
417*6a54128fSAndroid Build Coastguard Worker,
418*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling blkid debugging by default])
419*6a54128fSAndroid Build Coastguard Worker)
420*6a54128fSAndroid Build Coastguard Workerdnl
421*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-testio-debug
422*6a54128fSAndroid Build Coastguard Workerdnl
423*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([testio-debug],
424*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-testio-debug],[disable the use of the test I/O manager for debugging]),
425*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([CONFIG_TESTIO_DEBUG],
426*6a54128fSAndroid Build Coastguard Worker	[Define to 1 if the testio I/O manager should be enabled])
427*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
428*6a54128fSAndroid Build Coastguard Workerthen
429*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling testio debugging])
430*6a54128fSAndroid Build Coastguard Worker	TEST_IO_CMT="#"
431*6a54128fSAndroid Build Coastguard Workerelse
432*6a54128fSAndroid Build Coastguard Worker	TEST_IO_CMT=
433*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(CONFIG_TESTIO_DEBUG, 1)
434*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling testio debugging])
435*6a54128fSAndroid Build Coastguard Workerfi
436*6a54128fSAndroid Build Coastguard Worker,
437*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Enabling testio debugging by default])
438*6a54128fSAndroid Build Coastguard WorkerAC_DEFINE(CONFIG_TESTIO_DEBUG, 1)
439*6a54128fSAndroid Build Coastguard WorkerTEST_IO_CMT=
440*6a54128fSAndroid Build Coastguard Worker)
441*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(TEST_IO_CMT)
442*6a54128fSAndroid Build Coastguard Workerdnl
443*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-developer-features
444*6a54128fSAndroid Build Coastguard Workerdnl
445*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([developer-features],
446*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-developer-features],[enable features for use by ext4 developers]),
447*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([CONFIG_DEVELOPER_FEATURES],
448*6a54128fSAndroid Build Coastguard Worker	[Define to 1 for features for use by ext4 developers])
449*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "yes"
450*6a54128fSAndroid Build Coastguard Workerthen
451*6a54128fSAndroid Build Coastguard Worker	DEV_FEATURES_CMT=
452*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(CONFIG_DEVELOPER_FEATURES, 1)
453*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling ext4 developer features])
454*6a54128fSAndroid Build Coastguard Workerelse
455*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling ext4 developer features])
456*6a54128fSAndroid Build Coastguard Worker	DEV_FEATURES_CMT="#"
457*6a54128fSAndroid Build Coastguard Workerfi
458*6a54128fSAndroid Build Coastguard Worker,
459*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling ext4 developer features by default])
460*6a54128fSAndroid Build Coastguard WorkerDEV_FEATURES_CMT=
461*6a54128fSAndroid Build Coastguard Worker)
462*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DEV_FEATURES_CMT)
463*6a54128fSAndroid Build Coastguard Workerdnl
464*6a54128fSAndroid Build Coastguard Workerdnl handle --disable-libuuid
465*6a54128fSAndroid Build Coastguard Workerdnl
466*6a54128fSAndroid Build Coastguard WorkerPKG_PROG_PKG_CONFIG
467*6a54128fSAndroid Build Coastguard WorkerLIBUUID=
468*6a54128fSAndroid Build Coastguard WorkerDEPLIBUUID=
469*6a54128fSAndroid Build Coastguard WorkerSTATIC_LIBUUID=
470*6a54128fSAndroid Build Coastguard WorkerDEPSTATIC_LIBUUID=
471*6a54128fSAndroid Build Coastguard WorkerPROFILED_LIBUUID=
472*6a54128fSAndroid Build Coastguard WorkerDEPPROFILED_LIBUUID=
473*6a54128fSAndroid Build Coastguard WorkerUUID_CMT=
474*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([libuuid],
475*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-libuuid],[build and use private uuid library]),
476*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
477*6a54128fSAndroid Build Coastguard Workerthen
478*6a54128fSAndroid Build Coastguard Worker	if test -z "$PKG_CONFIG"; then
479*6a54128fSAndroid Build Coastguard Worker		AC_MSG_ERROR([pkg-config not installed; please install it.])
480*6a54128fSAndroid Build Coastguard Worker	fi
481*6a54128fSAndroid Build Coastguard Worker
482*6a54128fSAndroid Build Coastguard Worker	AC_CHECK_LIB(uuid, uuid_generate,
483*6a54128fSAndroid Build Coastguard Worker		[LIBUUID=`$PKG_CONFIG --libs uuid`;
484*6a54128fSAndroid Build Coastguard Worker		 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`],
485*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_ERROR([external uuid library not found])])
486*6a54128fSAndroid Build Coastguard Worker	PROFILED_LIBUUID=$LIBUUID
487*6a54128fSAndroid Build Coastguard Worker	UUID_CMT=#
488*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling private uuid library])
489*6a54128fSAndroid Build Coastguard Workerelse
490*6a54128fSAndroid Build Coastguard Worker	LIBUUID='$(LIB)/libuuid'$LIB_EXT
491*6a54128fSAndroid Build Coastguard Worker	DEPLIBUUID=$LIBUUID
492*6a54128fSAndroid Build Coastguard Worker	STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
493*6a54128fSAndroid Build Coastguard Worker	DEPSTATIC_LIBUUID=$STATIC_LIBUUID
494*6a54128fSAndroid Build Coastguard Worker	PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
495*6a54128fSAndroid Build Coastguard Worker	DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
496*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling private uuid library])
497*6a54128fSAndroid Build Coastguard Workerfi
498*6a54128fSAndroid Build Coastguard Worker,
499*6a54128fSAndroid Build Coastguard Workerif test -n "$PKG_CONFIG"; then
500*6a54128fSAndroid Build Coastguard Worker	AC_CHECK_LIB(uuid, uuid_generate,
501*6a54128fSAndroid Build Coastguard Worker		[LIBUUID=`$PKG_CONFIG --libs uuid`;
502*6a54128fSAndroid Build Coastguard Worker		 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`])
503*6a54128fSAndroid Build Coastguard Workerfi
504*6a54128fSAndroid Build Coastguard Workerif test -n "$LIBUUID"; then
505*6a54128fSAndroid Build Coastguard Worker	PROFILED_LIBUUID=$LIBUUID
506*6a54128fSAndroid Build Coastguard Worker	UUID_CMT=#
507*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Using system uuid by default])
508*6a54128fSAndroid Build Coastguard Workerelse
509*6a54128fSAndroid Build Coastguard Worker	LIBUUID='$(LIB)/libuuid'$LIB_EXT
510*6a54128fSAndroid Build Coastguard Worker	DEPLIBUUID=$LIBUUID
511*6a54128fSAndroid Build Coastguard Worker	STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
512*6a54128fSAndroid Build Coastguard Worker	DEPSTATIC_LIBUUID=$STATIC_LIBUUID
513*6a54128fSAndroid Build Coastguard Worker	PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
514*6a54128fSAndroid Build Coastguard Worker	DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
515*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling private uuid library by default])
516*6a54128fSAndroid Build Coastguard Workerfi
517*6a54128fSAndroid Build Coastguard Worker)
518*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(LIBUUID)
519*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DEPLIBUUID)
520*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(STATIC_LIBUUID)
521*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DEPSTATIC_LIBUUID)
522*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(PROFILED_LIBUUID)
523*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DEPPROFILED_LIBUUID)
524*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(UUID_CMT)
525*6a54128fSAndroid Build Coastguard Workerdnl
526*6a54128fSAndroid Build Coastguard Workerdnl handle --disable-libblkid
527*6a54128fSAndroid Build Coastguard Workerdnl
528*6a54128fSAndroid Build Coastguard WorkerPKG_PROG_PKG_CONFIG
529*6a54128fSAndroid Build Coastguard WorkerLIBBLKID=
530*6a54128fSAndroid Build Coastguard WorkerDEPLIBBLKID=
531*6a54128fSAndroid Build Coastguard WorkerSTATIC_LIBBLKID=
532*6a54128fSAndroid Build Coastguard WorkerDEPSTATIC_LIBBLKID=
533*6a54128fSAndroid Build Coastguard WorkerPROFILED_LIBBLKID=
534*6a54128fSAndroid Build Coastguard WorkerDEPPROFILED_LIBBLKID=
535*6a54128fSAndroid Build Coastguard WorkerBLKID_CMT=
536*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([CONFIG_BUILD_FINDFS], [Define to 1 to compile findfs])
537*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([libblkid],
538*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-libblkid],[build and use private blkid library]),
539*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
540*6a54128fSAndroid Build Coastguard Workerthen
541*6a54128fSAndroid Build Coastguard Worker	if test -z "$PKG_CONFIG"; then
542*6a54128fSAndroid Build Coastguard Worker		AC_MSG_ERROR([pkg-config not installed; please install it.])
543*6a54128fSAndroid Build Coastguard Worker	fi
544*6a54128fSAndroid Build Coastguard Worker
545*6a54128fSAndroid Build Coastguard Worker	AC_CHECK_LIB(blkid, blkid_get_cache,
546*6a54128fSAndroid Build Coastguard Worker		[LIBBLKID=`$PKG_CONFIG --libs blkid`;
547*6a54128fSAndroid Build Coastguard Worker		 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
548*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_ERROR([external blkid library not found])], -luuid)
549*6a54128fSAndroid Build Coastguard Worker	BLKID_CMT=#
550*6a54128fSAndroid Build Coastguard Worker	PROFILED_LIBBLKID=$LIBBLKID
551*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling private blkid library])
552*6a54128fSAndroid Build Coastguard Workerelse
553*6a54128fSAndroid Build Coastguard Worker	LIBBLKID='$(LIB)/libblkid'$LIB_EXT
554*6a54128fSAndroid Build Coastguard Worker	DEPLIBBLKID=$LIBBLKID
555*6a54128fSAndroid Build Coastguard Worker	STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
556*6a54128fSAndroid Build Coastguard Worker	DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
557*6a54128fSAndroid Build Coastguard Worker	PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
558*6a54128fSAndroid Build Coastguard Worker	DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
559*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(CONFIG_BUILD_FINDFS, 1)
560*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling private blkid library])
561*6a54128fSAndroid Build Coastguard Workerfi
562*6a54128fSAndroid Build Coastguard Worker,
563*6a54128fSAndroid Build Coastguard Workerif test -n "$PKG_CONFIG"; then
564*6a54128fSAndroid Build Coastguard Worker	AC_CHECK_LIB(blkid, blkid_get_cache,
565*6a54128fSAndroid Build Coastguard Worker		[LIBBLKID=`$PKG_CONFIG --libs blkid`;
566*6a54128fSAndroid Build Coastguard Worker		 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`])
567*6a54128fSAndroid Build Coastguard Workerfi
568*6a54128fSAndroid Build Coastguard Workerif test -n "$LIBBLKID"; then
569*6a54128fSAndroid Build Coastguard Worker	BLKID_CMT=#
570*6a54128fSAndroid Build Coastguard Worker	PROFILED_LIBBLKID=$LIBBLKID
571*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Using system blkid library by default])
572*6a54128fSAndroid Build Coastguard Workerelse
573*6a54128fSAndroid Build Coastguard Worker	LIBBLKID='$(LIB)/libblkid'$LIB_EXT
574*6a54128fSAndroid Build Coastguard Worker	DEPLIBBLKID=$LIBBLKID
575*6a54128fSAndroid Build Coastguard Worker	STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
576*6a54128fSAndroid Build Coastguard Worker	DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
577*6a54128fSAndroid Build Coastguard Worker	PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
578*6a54128fSAndroid Build Coastguard Worker	DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
579*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(CONFIG_BUILD_FINDFS, 1)
580*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling private blkid library by default])
581*6a54128fSAndroid Build Coastguard Workerfi
582*6a54128fSAndroid Build Coastguard Worker)
583*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(LIBBLKID)
584*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DEPLIBBLKID)
585*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(STATIC_LIBBLKID)
586*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DEPSTATIC_LIBBLKID)
587*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(PROFILED_LIBBLKID)
588*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DEPPROFILED_LIBBLKID)
589*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(BLKID_CMT)
590*6a54128fSAndroid Build Coastguard Workerdnl
591*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-subset
592*6a54128fSAndroid Build Coastguard Workerdnl
593*6a54128fSAndroid Build Coastguard WorkerALL_CMT=
594*6a54128fSAndroid Build Coastguard WorkerSUBSET_CMT=
595*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([subset],
596*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-subset],[enable subset-only build]),
597*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
598*6a54128fSAndroid Build Coastguard Workerthen
599*6a54128fSAndroid Build Coastguard Worker	SUBSET_CMT=#
600*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling subset-only build])
601*6a54128fSAndroid Build Coastguard Workerelse
602*6a54128fSAndroid Build Coastguard Worker	ALL_CMT=#
603*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling subset-only-build])
604*6a54128fSAndroid Build Coastguard Workerfi
605*6a54128fSAndroid Build Coastguard Worker,)
606*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(ALL_CMT)
607*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SUBSET_CMT)
608*6a54128fSAndroid Build Coastguard Workerdnl
609*6a54128fSAndroid Build Coastguard Workerdnl handle --disable-backtrace
610*6a54128fSAndroid Build Coastguard Workerdnl
611*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([DISABLE_BACKTRACE], [Define to 1 to disable use of backtrace])
612*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([backtrace],
613*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-backtrace],[disable use backtrace]),
614*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
615*6a54128fSAndroid Build Coastguard Workerthen
616*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling use of backtrace])
617*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(DISABLE_BACKTRACE, 1)
618*6a54128fSAndroid Build Coastguard Workerelse
619*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling use of backtrace])
620*6a54128fSAndroid Build Coastguard Workerfi
621*6a54128fSAndroid Build Coastguard Worker,
622*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Enabling use of backtrace by default])
623*6a54128fSAndroid Build Coastguard Worker)
624*6a54128fSAndroid Build Coastguard Workerdnl
625*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-debugfs
626*6a54128fSAndroid Build Coastguard Workerdnl
627*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([debugfs],
628*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-debugfs],[disable support of debugfs program]),
629*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
630*6a54128fSAndroid Build Coastguard Workerthen
631*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling debugfs support])
632*6a54128fSAndroid Build Coastguard Worker	DEBUGFS_CMT="#"
633*6a54128fSAndroid Build Coastguard Workerelse
634*6a54128fSAndroid Build Coastguard Worker	DEBUGFS_CMT=
635*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling debugfs support])
636*6a54128fSAndroid Build Coastguard Workerfi
637*6a54128fSAndroid Build Coastguard Worker,
638*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Enabling debugfs support by default])
639*6a54128fSAndroid Build Coastguard WorkerDEBUGFS_CMT=
640*6a54128fSAndroid Build Coastguard Worker)
641*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DEBUGFS_CMT)
642*6a54128fSAndroid Build Coastguard Workerdnl
643*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-imager
644*6a54128fSAndroid Build Coastguard Workerdnl
645*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([imager],
646*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-imager],[disable support of e2image program]),
647*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
648*6a54128fSAndroid Build Coastguard Workerthen
649*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling e2image support])
650*6a54128fSAndroid Build Coastguard Worker	IMAGER_CMT="#"
651*6a54128fSAndroid Build Coastguard Workerelse
652*6a54128fSAndroid Build Coastguard Worker	IMAGER_CMT=
653*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling e2image support])
654*6a54128fSAndroid Build Coastguard Workerfi
655*6a54128fSAndroid Build Coastguard Worker,
656*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Enabling e2image support by default])
657*6a54128fSAndroid Build Coastguard WorkerIMAGER_CMT=
658*6a54128fSAndroid Build Coastguard Worker)
659*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(IMAGER_CMT)
660*6a54128fSAndroid Build Coastguard Workerdnl
661*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-resizer
662*6a54128fSAndroid Build Coastguard Workerdnl
663*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([resizer],
664*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-resizer],[disable support of e2resize program]),
665*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
666*6a54128fSAndroid Build Coastguard Workerthen
667*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling e2resize support])
668*6a54128fSAndroid Build Coastguard Worker	RESIZER_CMT="#"
669*6a54128fSAndroid Build Coastguard Workerelse
670*6a54128fSAndroid Build Coastguard Worker	RESIZER_CMT=
671*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling e2resize support])
672*6a54128fSAndroid Build Coastguard Workerfi
673*6a54128fSAndroid Build Coastguard Worker,
674*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Enabling e2resize support by default])
675*6a54128fSAndroid Build Coastguard WorkerRESIZER_CMT=
676*6a54128fSAndroid Build Coastguard Worker)
677*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(RESIZER_CMT)
678*6a54128fSAndroid Build Coastguard Workerdnl
679*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-defrag
680*6a54128fSAndroid Build Coastguard Workerdnl
681*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([defrag],
682*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-defrag],[disable support of e4defrag program]),
683*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
684*6a54128fSAndroid Build Coastguard Workerthen
685*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling e4defrag support])
686*6a54128fSAndroid Build Coastguard Worker	DEFRAG_CMT="#"
687*6a54128fSAndroid Build Coastguard Workerelse
688*6a54128fSAndroid Build Coastguard Worker	DEFRAG_CMT=
689*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling e4defrag support])
690*6a54128fSAndroid Build Coastguard Workerfi
691*6a54128fSAndroid Build Coastguard Worker,
692*6a54128fSAndroid Build Coastguard Workerif test -z "$WITH_DIET_LIBC"
693*6a54128fSAndroid Build Coastguard Workerthen
694*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling e4defrag support by default])
695*6a54128fSAndroid Build Coastguard Worker	DEFRAG_CMT=
696*6a54128fSAndroid Build Coastguard Workerelse
697*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling e4defrag support by default])
698*6a54128fSAndroid Build Coastguard Worker	DEFRAG_CMT="#"
699*6a54128fSAndroid Build Coastguard Workerfi
700*6a54128fSAndroid Build Coastguard Worker)
701*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DEFRAG_CMT)
702*6a54128fSAndroid Build Coastguard Workerdnl
703*6a54128fSAndroid Build Coastguard Workerdnl See whether to install the `fsck' wrapper program (that calls e2fsck)
704*6a54128fSAndroid Build Coastguard Workerdnl
705*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([fsck],
706*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-fsck],[build fsck wrapper program]),
707*6a54128fSAndroid Build Coastguard Worker[if test "$enableval" = "no"
708*6a54128fSAndroid Build Coastguard Workerthen
709*6a54128fSAndroid Build Coastguard Worker	FSCK_PROG='' FSCK_MAN=''
710*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Not building fsck wrapper])
711*6a54128fSAndroid Build Coastguard Workerelse
712*6a54128fSAndroid Build Coastguard Worker	FSCK_PROG=fsck FSCK_MAN=fsck.8
713*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Building fsck wrapper])
714*6a54128fSAndroid Build Coastguard Workerfi]
715*6a54128fSAndroid Build Coastguard Worker,
716*6a54128fSAndroid Build Coastguard Worker[case "$host_os" in
717*6a54128fSAndroid Build Coastguard Worker  gnu*)
718*6a54128fSAndroid Build Coastguard Worker    FSCK_PROG='' FSCK_MAN=''
719*6a54128fSAndroid Build Coastguard Worker    AC_MSG_RESULT([Not building fsck wrapper by default])
720*6a54128fSAndroid Build Coastguard Worker    ;;
721*6a54128fSAndroid Build Coastguard Worker  *)
722*6a54128fSAndroid Build Coastguard Worker    FSCK_PROG=fsck FSCK_MAN=fsck.8
723*6a54128fSAndroid Build Coastguard Worker    AC_MSG_RESULT([Building fsck wrapper by default])
724*6a54128fSAndroid Build Coastguard Workeresac]
725*6a54128fSAndroid Build Coastguard Worker)
726*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(FSCK_PROG)
727*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(FSCK_MAN)
728*6a54128fSAndroid Build Coastguard Workerdnl
729*6a54128fSAndroid Build Coastguard Workerdnl See whether to install the `e2initrd-helper' program
730*6a54128fSAndroid Build Coastguard Workerdnl
731*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([e2initrd-helper],
732*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-e2initrd-helper],[build e2initrd-helper program]),
733*6a54128fSAndroid Build Coastguard Worker[if test "$enableval" = "no"
734*6a54128fSAndroid Build Coastguard Workerthen
735*6a54128fSAndroid Build Coastguard Worker	E2INITRD_PROG='' E2INITRD_MAN=''
736*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Not building e2initrd helper])
737*6a54128fSAndroid Build Coastguard Workerelse
738*6a54128fSAndroid Build Coastguard Worker	E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
739*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Building e2initrd helper])
740*6a54128fSAndroid Build Coastguard Workerfi]
741*6a54128fSAndroid Build Coastguard Worker,
742*6a54128fSAndroid Build Coastguard WorkerE2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
743*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Building e2initrd helper by default])
744*6a54128fSAndroid Build Coastguard Worker)
745*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E2INITRD_PROG)
746*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E2INITRD_MAN)
747*6a54128fSAndroid Build Coastguard Workerdnl
748*6a54128fSAndroid Build Coastguard Workerdnl
749*6a54128fSAndroid Build Coastguard Workerdnl
750*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([tls],
751*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-tls],[disable use of thread local support]),
752*6a54128fSAndroid Build Coastguard Worker[if test "$enableval" = "no"
753*6a54128fSAndroid Build Coastguard Workerthen
754*6a54128fSAndroid Build Coastguard Worker	try_tls=""
755*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling thread local support])
756*6a54128fSAndroid Build Coastguard Workerelse
757*6a54128fSAndroid Build Coastguard Worker	try_tls="yes"
758*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling thread local support])
759*6a54128fSAndroid Build Coastguard Workerfi]
760*6a54128fSAndroid Build Coastguard Worker,
761*6a54128fSAndroid Build Coastguard Workerif test -n "$WITH_DIET_LIBC"
762*6a54128fSAndroid Build Coastguard Workerthen
763*6a54128fSAndroid Build Coastguard Worker	try_tls=""
764*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Diet libc does not support thread local support])
765*6a54128fSAndroid Build Coastguard Workerelse
766*6a54128fSAndroid Build Coastguard Worker	try_tls="yes"
767*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Try using thread local support by default])
768*6a54128fSAndroid Build Coastguard Workerfi
769*6a54128fSAndroid Build Coastguard Worker)
770*6a54128fSAndroid Build Coastguard Workerif test "$try_tls" = "yes"
771*6a54128fSAndroid Build Coastguard Workerthen
772*6a54128fSAndroid Build Coastguard WorkerAX_TLS
773*6a54128fSAndroid Build Coastguard Workerfi
774*6a54128fSAndroid Build Coastguard Workerdnl
775*6a54128fSAndroid Build Coastguard Workerdnl
776*6a54128fSAndroid Build Coastguard Workerdnl
777*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([pthread],
778*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--without-pthread],[disable use of pthread support]),
779*6a54128fSAndroid Build Coastguard Worker[if test "$withval" = "no"
780*6a54128fSAndroid Build Coastguard Workerthen
781*6a54128fSAndroid Build Coastguard Worker	try_pthread=""
782*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling pthread support])
783*6a54128fSAndroid Build Coastguard Workerelse
784*6a54128fSAndroid Build Coastguard Worker	try_pthread="yes"
785*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Testing for pthread support])
786*6a54128fSAndroid Build Coastguard Workerfi]
787*6a54128fSAndroid Build Coastguard Worker,
788*6a54128fSAndroid Build Coastguard Workertry_pthread="yes"
789*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Try testing for pthread support by default])
790*6a54128fSAndroid Build Coastguard Worker)
791*6a54128fSAndroid Build Coastguard Workerif test "$try_pthread" = "yes"
792*6a54128fSAndroid Build Coastguard Workerthen
793*6a54128fSAndroid Build Coastguard WorkerAX_PTHREAD
794*6a54128fSAndroid Build Coastguard Workerelse
795*6a54128fSAndroid Build Coastguard Workertest -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
796*6a54128fSAndroid Build Coastguard WorkerAC_SUBST([PTHREAD_CC])
797*6a54128fSAndroid Build Coastguard Workerfi
798*6a54128fSAndroid Build Coastguard Workerdnl
799*6a54128fSAndroid Build Coastguard Workerdnl
800*6a54128fSAndroid Build Coastguard Workerdnl
801*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([USE_UUIDD], [Define to 1 to build uuidd])
802*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([uuidd],
803*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-uuidd],[disable building the uuid daemon]),
804*6a54128fSAndroid Build Coastguard Worker[if test "$enableval" = "no"
805*6a54128fSAndroid Build Coastguard Workerthen
806*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Not building uuidd])
807*6a54128fSAndroid Build Coastguard Worker	UUIDD_CMT="#"
808*6a54128fSAndroid Build Coastguard Workerelse
809*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(USE_UUIDD, 1)
810*6a54128fSAndroid Build Coastguard Worker	UUIDD_CMT=""
811*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Building uuidd])
812*6a54128fSAndroid Build Coastguard Workerfi]
813*6a54128fSAndroid Build Coastguard Worker,
814*6a54128fSAndroid Build Coastguard WorkerAC_DEFINE(USE_UUIDD, 1)
815*6a54128fSAndroid Build Coastguard Workerif test -z "$UUID_CMT"
816*6a54128fSAndroid Build Coastguard Workerthen
817*6a54128fSAndroid Build Coastguard Worker	UUIDD_CMT=""
818*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Building uuidd by default])
819*6a54128fSAndroid Build Coastguard Workerelse
820*6a54128fSAndroid Build Coastguard Worker	UUIDD_CMT="#"
821*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling uuidd by default])
822*6a54128fSAndroid Build Coastguard Workerfi
823*6a54128fSAndroid Build Coastguard Worker)
824*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(UUIDD_CMT)
825*6a54128fSAndroid Build Coastguard Workerdnl
826*6a54128fSAndroid Build Coastguard Workerdnl handle --disable-mmp
827*6a54128fSAndroid Build Coastguard Workerdnl
828*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([CONFIG_MMP], [Define to 1 to enable mmp support])
829*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([mmp],
830*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-mmp],[disable support mmp, Multi Mount Protection]),
831*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
832*6a54128fSAndroid Build Coastguard Workerthen
833*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling mmp support])
834*6a54128fSAndroid Build Coastguard Workerelse
835*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling mmp support])
836*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(CONFIG_MMP, 1)
837*6a54128fSAndroid Build Coastguard Workerfi
838*6a54128fSAndroid Build Coastguard Worker,
839*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Enabling mmp support by default])
840*6a54128fSAndroid Build Coastguard WorkerAC_DEFINE(CONFIG_MMP, 1)
841*6a54128fSAndroid Build Coastguard Worker)
842*6a54128fSAndroid Build Coastguard Workerdnl
843*6a54128fSAndroid Build Coastguard Workerdnl handle --disable-tdb
844*6a54128fSAndroid Build Coastguard Workerdnl
845*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([CONFIG_TDB], [Define to 1 to enable tdb support])
846*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([tdb],
847*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-tdb],[disable tdb support]),
848*6a54128fSAndroid Build Coastguard Worker[
849*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
850*6a54128fSAndroid Build Coastguard Workerthen
851*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling tdb support])
852*6a54128fSAndroid Build Coastguard Worker	CONFIG_TDB=0
853*6a54128fSAndroid Build Coastguard Workerelse
854*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling tdb support])
855*6a54128fSAndroid Build Coastguard Worker	CONFIG_TDB=1
856*6a54128fSAndroid Build Coastguard Workerfi
857*6a54128fSAndroid Build Coastguard Worker]
858*6a54128fSAndroid Build Coastguard Worker,
859*6a54128fSAndroid Build Coastguard Worker[
860*6a54128fSAndroid Build Coastguard Workercase "$host_os" in
861*6a54128fSAndroid Build Coastguard Workermingw*)
862*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling tdb support by default])
863*6a54128fSAndroid Build Coastguard Worker	CONFIG_TDB=0
864*6a54128fSAndroid Build Coastguard Worker	;;
865*6a54128fSAndroid Build Coastguard Worker*)
866*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling tdb support by default])
867*6a54128fSAndroid Build Coastguard Worker	CONFIG_TDB=1
868*6a54128fSAndroid Build Coastguard Worker	;;
869*6a54128fSAndroid Build Coastguard Workeresac
870*6a54128fSAndroid Build Coastguard Worker]
871*6a54128fSAndroid Build Coastguard Worker)
872*6a54128fSAndroid Build Coastguard Workerif test "$CONFIG_TDB" = "1"
873*6a54128fSAndroid Build Coastguard Workerthen
874*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(CONFIG_TDB, 1)
875*6a54128fSAndroid Build Coastguard Worker	TDB_CMT=""
876*6a54128fSAndroid Build Coastguard Worker	TDB_MAN_COMMENT=""
877*6a54128fSAndroid Build Coastguard Workerelse
878*6a54128fSAndroid Build Coastguard Worker	TDB_CMT="#"
879*6a54128fSAndroid Build Coastguard Worker	TDB_MAN_COMMENT='.\"'
880*6a54128fSAndroid Build Coastguard Workerfi
881*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(TDB_CMT)
882*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(TDB_MAN_COMMENT)
883*6a54128fSAndroid Build Coastguard Workerdnl
884*6a54128fSAndroid Build Coastguard Workerdnl handle --disable-bmap-stats
885*6a54128fSAndroid Build Coastguard Workerdnl
886*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([ENABLE_BMAP_STATS], [Define to 1 to enable bitmap stats.])
887*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([bmap-stats],
888*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-bmap-stats],[disable collection of bitmap stats]),
889*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
890*6a54128fSAndroid Build Coastguard Workerthen
891*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling bitmap statistics support])
892*6a54128fSAndroid Build Coastguard Workerelse
893*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling bitmap statistics support])
894*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(ENABLE_BMAP_STATS, 1)
895*6a54128fSAndroid Build Coastguard Workerfi
896*6a54128fSAndroid Build Coastguard Worker,
897*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Enabling bitmap statistics support by default])
898*6a54128fSAndroid Build Coastguard WorkerAC_DEFINE(ENABLE_BMAP_STATS, 1)
899*6a54128fSAndroid Build Coastguard Worker)
900*6a54128fSAndroid Build Coastguard Workerdnl
901*6a54128fSAndroid Build Coastguard Workerdnl handle --enable-bmap-stats-ops
902*6a54128fSAndroid Build Coastguard Workerdnl
903*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([ENABLE_BMAP_STATS_OPS], [Define to 1 to enable bitmap stats.])
904*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([bmap-stats-ops],
905*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-bmap-stats-ops],[enable collection of additional bitmap stats]),
906*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
907*6a54128fSAndroid Build Coastguard Workerthen
908*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling additional bitmap statistics])
909*6a54128fSAndroid Build Coastguard Workerelse
910*6a54128fSAndroid Build Coastguard Worker	dnl There has to be a better way!
911*6a54128fSAndroid Build Coastguard Worker	AS_IF([test "x${enable_bmap_stats}" = "xno"],
912*6a54128fSAndroid Build Coastguard Worker	 AC_MSG_FAILURE([Error --enable-bmap-stats-ops requires bmap-stats]))
913*6a54128fSAndroid Build Coastguard Worker
914*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling additional bitmap statistics])
915*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(ENABLE_BMAP_STATS_OPS, 1)
916*6a54128fSAndroid Build Coastguard Workerfi
917*6a54128fSAndroid Build Coastguard Worker,
918*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT([Disabling additional bitmap statistics by default])
919*6a54128fSAndroid Build Coastguard Worker)
920*6a54128fSAndroid Build Coastguard Workerdnl
921*6a54128fSAndroid Build Coastguard Workerdnl
922*6a54128fSAndroid Build Coastguard Workerdnl
923*6a54128fSAndroid Build Coastguard WorkerMAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
924*6a54128fSAndroid Build Coastguard WorkerAC_SUBST_FILE(MAKEFILE_LIBRARY)
925*6a54128fSAndroid Build Coastguard Workerdnl
926*6a54128fSAndroid Build Coastguard Workerdnl Add internationalization support, using gettext.
927*6a54128fSAndroid Build Coastguard Workerdnl
928*6a54128fSAndroid Build Coastguard WorkerGETTEXT_PACKAGE=e2fsprogs
929*6a54128fSAndroid Build Coastguard WorkerPACKAGE=e2fsprogs
930*6a54128fSAndroid Build Coastguard WorkerVERSION="$E2FSPROGS_VERSION"
931*6a54128fSAndroid Build Coastguard WorkerVERSION=0.14.1
932*6a54128fSAndroid Build Coastguard WorkerAC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [package name for gettext])
933*6a54128fSAndroid Build Coastguard WorkerAC_DEFINE_UNQUOTED(VERSION, "$VERSION", [version for gettext])
934*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(GETTEXT_PACKAGE)
935*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(PACKAGE)
936*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(VERSION)
937*6a54128fSAndroid Build Coastguard Worker
938*6a54128fSAndroid Build Coastguard WorkerAM_GNU_GETTEXT([external])
939*6a54128fSAndroid Build Coastguard Workerdnl
940*6a54128fSAndroid Build Coastguard Workerdnl End of configuration options
941*6a54128fSAndroid Build Coastguard Workerdnl
942*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(BINARY_TYPE)
943*6a54128fSAndroid Build Coastguard WorkerAC_PROG_MAKE_SET
944*6a54128fSAndroid Build Coastguard WorkerCHECK_GNU_MAKE
945*6a54128fSAndroid Build Coastguard WorkerAC_PATH_PROG(LN, ln, ln)
946*6a54128fSAndroid Build Coastguard WorkerAC_PROG_MKDIR_P
947*6a54128fSAndroid Build Coastguard Workerdnl
948*6a54128fSAndroid Build Coastguard Workerdnl @mkdir_p@ is used by po's Makefile.in
949*6a54128fSAndroid Build Coastguard Workerdnl
950*6a54128fSAndroid Build Coastguard Workermkdir_p=$MKDIR_P
951*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(mkdir_p)
952*6a54128fSAndroid Build Coastguard WorkerAC_PROG_LN_S
953*6a54128fSAndroid Build Coastguard WorkerAC_PATH_PROG(MV, mv, mv)
954*6a54128fSAndroid Build Coastguard WorkerAC_PATH_PROG(CP, cp, cp)
955*6a54128fSAndroid Build Coastguard WorkerAC_PATH_PROG(RM, rm, rm)
956*6a54128fSAndroid Build Coastguard WorkerAC_PATH_PROG(CHMOD, chmod, :)
957*6a54128fSAndroid Build Coastguard WorkerAC_PROG_AWK
958*6a54128fSAndroid Build Coastguard WorkerAC_PROG_EGREP
959*6a54128fSAndroid Build Coastguard WorkerAC_PATH_PROG(SED, sed, sed)
960*6a54128fSAndroid Build Coastguard WorkerAC_PATH_PROG(PERL, perl, perl)
961*6a54128fSAndroid Build Coastguard WorkerAC_PATH_PROG(LDCONFIG, ldconfig, :)
962*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_TOOL(AR, ar, ar)
963*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_TOOL(RANLIB, ranlib, :)
964*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_TOOL(STRIP, strip, :)
965*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
966*6a54128fSAndroid Build Coastguard Workerif test "_$MAKEINFO" = "_"; then
967*6a54128fSAndroid Build Coastguard Worker    MAKEINFO="echo Makeinfo is missing. Info documentation will not be built."
968*6a54128fSAndroid Build Coastguard Workerelse
969*6a54128fSAndroid Build Coastguard Worker    case "$MAKEINFO" in
970*6a54128fSAndroid Build Coastguard Worker      */missing.*)
971*6a54128fSAndroid Build Coastguard Worker        AC_MSG_WARN([
972*6a54128fSAndroid Build Coastguard Worker*** Makeinfo is missing. Info documentation will not be built.])
973*6a54128fSAndroid Build Coastguard Worker        ;;
974*6a54128fSAndroid Build Coastguard Worker      *)
975*6a54128fSAndroid Build Coastguard Worker        ;;
976*6a54128fSAndroid Build Coastguard Worker    esac
977*6a54128fSAndroid Build Coastguard Workerfi
978*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(MAKEINFO)
979*6a54128fSAndroid Build Coastguard WorkerAC_PROG_INSTALL
980*6a54128fSAndroid Build Coastguard Worker# See if we need a separate native compiler.
981*6a54128fSAndroid Build Coastguard Workerif test $cross_compiling = no; then
982*6a54128fSAndroid Build Coastguard Worker  BUILD_CC="$CC"
983*6a54128fSAndroid Build Coastguard Worker  AC_SUBST(BUILD_CC)
984*6a54128fSAndroid Build Coastguard Workerelse
985*6a54128fSAndroid Build Coastguard Worker  AC_CHECK_PROGS(BUILD_CC, gcc cc)
986*6a54128fSAndroid Build Coastguard Workerfi
987*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_HEADERS(m4_flatten([
988*6a54128fSAndroid Build Coastguard Worker	dirent.h
989*6a54128fSAndroid Build Coastguard Worker	errno.h
990*6a54128fSAndroid Build Coastguard Worker	execinfo.h
991*6a54128fSAndroid Build Coastguard Worker	getopt.h
992*6a54128fSAndroid Build Coastguard Worker	malloc.h
993*6a54128fSAndroid Build Coastguard Worker	mntent.h
994*6a54128fSAndroid Build Coastguard Worker	paths.h
995*6a54128fSAndroid Build Coastguard Worker	pthread.h
996*6a54128fSAndroid Build Coastguard Worker	semaphore.h
997*6a54128fSAndroid Build Coastguard Worker	setjmp.h
998*6a54128fSAndroid Build Coastguard Worker	signal.h
999*6a54128fSAndroid Build Coastguard Worker	stdarg.h
1000*6a54128fSAndroid Build Coastguard Worker	stdint.h
1001*6a54128fSAndroid Build Coastguard Worker	stdlib.h
1002*6a54128fSAndroid Build Coastguard Worker	termios.h
1003*6a54128fSAndroid Build Coastguard Worker	termio.h
1004*6a54128fSAndroid Build Coastguard Worker	unistd.h
1005*6a54128fSAndroid Build Coastguard Worker	utime.h
1006*6a54128fSAndroid Build Coastguard Worker	attr/xattr.h
1007*6a54128fSAndroid Build Coastguard Worker	linux/falloc.h
1008*6a54128fSAndroid Build Coastguard Worker	linux/fd.h
1009*6a54128fSAndroid Build Coastguard Worker	linux/fsmap.h
1010*6a54128fSAndroid Build Coastguard Worker	linux/major.h
1011*6a54128fSAndroid Build Coastguard Worker	linux/loop.h
1012*6a54128fSAndroid Build Coastguard Worker	linux/types.h
1013*6a54128fSAndroid Build Coastguard Worker	net/if_dl.h
1014*6a54128fSAndroid Build Coastguard Worker	netinet/in.h
1015*6a54128fSAndroid Build Coastguard Worker	sys/acl.h
1016*6a54128fSAndroid Build Coastguard Worker	sys/disklabel.h
1017*6a54128fSAndroid Build Coastguard Worker	sys/disk.h
1018*6a54128fSAndroid Build Coastguard Worker	sys/file.h
1019*6a54128fSAndroid Build Coastguard Worker	sys/ioctl.h
1020*6a54128fSAndroid Build Coastguard Worker	sys/key.h
1021*6a54128fSAndroid Build Coastguard Worker	sys/mkdev.h
1022*6a54128fSAndroid Build Coastguard Worker	sys/mman.h
1023*6a54128fSAndroid Build Coastguard Worker	sys/mount.h
1024*6a54128fSAndroid Build Coastguard Worker	sys/prctl.h
1025*6a54128fSAndroid Build Coastguard Worker	sys/random.h
1026*6a54128fSAndroid Build Coastguard Worker	sys/resource.h
1027*6a54128fSAndroid Build Coastguard Worker	sys/select.h
1028*6a54128fSAndroid Build Coastguard Worker	sys/socket.h
1029*6a54128fSAndroid Build Coastguard Worker	sys/sockio.h
1030*6a54128fSAndroid Build Coastguard Worker	sys/stat.h
1031*6a54128fSAndroid Build Coastguard Worker	sys/syscall.h
1032*6a54128fSAndroid Build Coastguard Worker	sys/sysmacros.h
1033*6a54128fSAndroid Build Coastguard Worker	sys/time.h
1034*6a54128fSAndroid Build Coastguard Worker	sys/types.h
1035*6a54128fSAndroid Build Coastguard Worker	sys/un.h
1036*6a54128fSAndroid Build Coastguard Worker	sys/wait.h
1037*6a54128fSAndroid Build Coastguard Worker	sys/xattr.h
1038*6a54128fSAndroid Build Coastguard Worker]))
1039*6a54128fSAndroid Build Coastguard Workercase "$host_os" in
1040*6a54128fSAndroid Build Coastguard Workermingw*)
1041*6a54128fSAndroid Build Coastguard Worker	# The above checks only detect system headers, not the headers in
1042*6a54128fSAndroid Build Coastguard Worker	# ./include/mingw/, so explicitly define them to be available.
1043*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(HAVE_LINUX_TYPES_H, 1)
1044*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(HAVE_SYS_STAT_H, 1)
1045*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(HAVE_SYS_SYSMACROS_H, 1)
1046*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(HAVE_SYS_TYPES_H, 1)
1047*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(HAVE_UNISTD_H, 1)
1048*6a54128fSAndroid Build Coastguard Worker	;;
1049*6a54128fSAndroid Build Coastguard Workeresac
1050*6a54128fSAndroid Build Coastguard Workerdnl Check where to find a dd(1) that supports iflag=fullblock
1051*6a54128fSAndroid Build Coastguard Workerdnl and oflag=append
1052*6a54128fSAndroid Build Coastguard WorkerAC_MSG_CHECKING([for a dd(1) program that supports iflag=fullblock])
1053*6a54128fSAndroid Build Coastguard WorkerDD=
1054*6a54128fSAndroid Build Coastguard Workerfor i in dd gdd ; do
1055*6a54128fSAndroid Build Coastguard Worker	if "$i" if=/dev/null of=/dev/null count=1 bs=10k 2>/dev/null iflag=fullblock oflag=append ; then
1056*6a54128fSAndroid Build Coastguard Worker		DD=$i
1057*6a54128fSAndroid Build Coastguard Worker		break
1058*6a54128fSAndroid Build Coastguard Worker	fi
1059*6a54128fSAndroid Build Coastguard Workerdone
1060*6a54128fSAndroid Build Coastguard Workerif test -n "$DD" ; then
1061*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([$DD])
1062*6a54128fSAndroid Build Coastguard Workerelse
1063*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([not found, using dd])
1064*6a54128fSAndroid Build Coastguard Worker	DD=dd
1065*6a54128fSAndroid Build Coastguard Worker	AC_MSG_WARN([No GNU-compatible dd(1) program found, expect some self-test failures.])
1066*6a54128fSAndroid Build Coastguard Workerfi
1067*6a54128fSAndroid Build Coastguard WorkerAC_SUBST([DD])
1068*6a54128fSAndroid Build Coastguard Worker
1069*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_HEADERS(net/if.h,,,
1070*6a54128fSAndroid Build Coastguard Worker[[
1071*6a54128fSAndroid Build Coastguard Worker#if HAVE_SYS_TYPES_H
1072*6a54128fSAndroid Build Coastguard Worker#include <sys/types.h>
1073*6a54128fSAndroid Build Coastguard Worker#endif
1074*6a54128fSAndroid Build Coastguard Worker#if HAVE_SYS_SOCKET
1075*6a54128fSAndroid Build Coastguard Worker#include <sys/socket.h>
1076*6a54128fSAndroid Build Coastguard Worker#endif
1077*6a54128fSAndroid Build Coastguard Worker]])
1078*6a54128fSAndroid Build Coastguard WorkerAC_FUNC_VPRINTF
1079*6a54128fSAndroid Build Coastguard Workerdnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
1080*6a54128fSAndroid Build Coastguard Workerdnl is not declared.
1081*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT, 1,
1082*6a54128fSAndroid Build Coastguard Worker		       [Define to 1 if dirent has d_reclen])],,
1083*6a54128fSAndroid Build Coastguard Worker		[#include <dirent.h>])
1084*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_MEMBERS([struct stat.st_atim])
1085*6a54128fSAndroid Build Coastguard Workerdnl Check to see if ssize_t was declared
1086*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T, 1,
1087*6a54128fSAndroid Build Coastguard Worker		[Define to 1 if ssize_t declared])],,
1088*6a54128fSAndroid Build Coastguard Worker	      [#include <sys/types.h>])
1089*6a54128fSAndroid Build Coastguard Workerdnl
1090*6a54128fSAndroid Build Coastguard Workerdnl Check to see if llseek() is declared in unistd.h.  On some libc's
1091*6a54128fSAndroid Build Coastguard Workerdnl it is, and on others it isn't..... Thank you glibc developers....
1092*6a54128fSAndroid Build Coastguard Workerdnl
1093*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1,
1094*6a54128fSAndroid Build Coastguard Worker			[Define to 1 if llseek declared in unistd.h])],,
1095*6a54128fSAndroid Build Coastguard Worker	      [#include <unistd.h>])
1096*6a54128fSAndroid Build Coastguard Workerdnl
1097*6a54128fSAndroid Build Coastguard Workerdnl Check to see if lseek64() is declared in unistd.h.  Glibc's header files
1098*6a54128fSAndroid Build Coastguard Workerdnl are so convoluted that I can't tell whether it will always be defined,
1099*6a54128fSAndroid Build Coastguard Workerdnl and if it isn't defined while lseek64 is defined in the library,
1100*6a54128fSAndroid Build Coastguard Workerdnl disaster will strike.
1101*6a54128fSAndroid Build Coastguard Workerdnl
1102*6a54128fSAndroid Build Coastguard Workerdnl Warning!  Use of --enable-gcc-wall may throw off this test.
1103*6a54128fSAndroid Build Coastguard Workerdnl
1104*6a54128fSAndroid Build Coastguard Workerdnl
1105*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
1106*6a54128fSAndroid Build Coastguard Worker			[Define to 1 if lseek64 declared in unistd.h])],,
1107*6a54128fSAndroid Build Coastguard Worker		[#define _LARGEFILE_SOURCE
1108*6a54128fSAndroid Build Coastguard Worker		 #define _LARGEFILE64_SOURCE
1109*6a54128fSAndroid Build Coastguard Worker		 #include <unistd.h>])
1110*6a54128fSAndroid Build Coastguard Workerdnl
1111*6a54128fSAndroid Build Coastguard Workerdnl Word sizes...
1112*6a54128fSAndroid Build Coastguard Workerdnl
1113*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_SIZEOF(short)
1114*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_SIZEOF(int)
1115*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_SIZEOF(long)
1116*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_SIZEOF(long long)
1117*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_SIZEOF(off_t)
1118*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_SIZEOF(time_t)
1119*6a54128fSAndroid Build Coastguard WorkerSIZEOF_SHORT=$ac_cv_sizeof_short
1120*6a54128fSAndroid Build Coastguard WorkerSIZEOF_INT=$ac_cv_sizeof_int
1121*6a54128fSAndroid Build Coastguard WorkerSIZEOF_LONG=$ac_cv_sizeof_long
1122*6a54128fSAndroid Build Coastguard WorkerSIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
1123*6a54128fSAndroid Build Coastguard WorkerSIZEOF_OFF_T=$ac_cv_sizeof_off_t
1124*6a54128fSAndroid Build Coastguard WorkerSIZEOF_TIME_T=$ac_cv_sizeof_time_t
1125*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SIZEOF_SHORT)
1126*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SIZEOF_INT)
1127*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SIZEOF_LONG)
1128*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SIZEOF_LONG_LONG)
1129*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SIZEOF_OFF_T)
1130*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SIZEOF_TIME_T)
1131*6a54128fSAndroid Build Coastguard WorkerAC_C_BIGENDIAN
1132*6a54128fSAndroid Build Coastguard Workerif test $cross_compiling = no; then
1133*6a54128fSAndroid Build Coastguard Worker  BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
1134*6a54128fSAndroid Build Coastguard Workerelse
1135*6a54128fSAndroid Build Coastguard Worker  CROSS_COMPILE="1" BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
1136*6a54128fSAndroid Build Coastguard Workerfi
1137*6a54128fSAndroid Build Coastguard WorkerASM_TYPES_HEADER=./asm_types.h
1138*6a54128fSAndroid Build Coastguard WorkerAC_SUBST_FILE(ASM_TYPES_HEADER)
1139*6a54128fSAndroid Build Coastguard Workerdnl
1140*6a54128fSAndroid Build Coastguard Workerdnl Save the configuration #defines needed for the public ext2fs.h
1141*6a54128fSAndroid Build Coastguard Workerdnl header file
1142*6a54128fSAndroid Build Coastguard Workerdnl
1143*6a54128fSAndroid Build Coastguard Workerecho "/* These defines are needed for the public ext2fs.h header file */" \
1144*6a54128fSAndroid Build Coastguard Worker     > public_config.h
1145*6a54128fSAndroid Build Coastguard Workerif grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
1146*6a54128fSAndroid Build Coastguard Worker  uniq tmp_config.$$ >> public_config.h
1147*6a54128fSAndroid Build Coastguard Workerelse
1148*6a54128fSAndroid Build Coastguard Worker  echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
1149*6a54128fSAndroid Build Coastguard Workerfi
1150*6a54128fSAndroid Build Coastguard Workerif grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
1151*6a54128fSAndroid Build Coastguard Worker  uniq tmp_config.$$ >> public_config.h
1152*6a54128fSAndroid Build Coastguard Workerelse
1153*6a54128fSAndroid Build Coastguard Worker  echo "#undef WORDS_BIGENDIAN" >> public_config.h
1154*6a54128fSAndroid Build Coastguard Workerfi
1155*6a54128fSAndroid Build Coastguard Workerrm -f tmp_config.$$
1156*6a54128fSAndroid Build Coastguard WorkerPUBLIC_CONFIG_HEADER=./public_config.h
1157*6a54128fSAndroid Build Coastguard WorkerAC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
1158*6a54128fSAndroid Build Coastguard Workerdnl
1159*6a54128fSAndroid Build Coastguard Workerdnl See if we have inttypes.h and if intptr_t is defined
1160*6a54128fSAndroid Build Coastguard Workerdnl
1161*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_HEADERS([inttypes.h])
1162*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_TYPES(intptr_t)
1163*6a54128fSAndroid Build Coastguard Workerdnl
1164*6a54128fSAndroid Build Coastguard Workerdnl See if struct stat has a st_flags field, in which case we can get file
1165*6a54128fSAndroid Build Coastguard Workerdnl flags somewhat portably.  Also check for the analogous setter, chflags().
1166*6a54128fSAndroid Build Coastguard Workerdnl
1167*6a54128fSAndroid Build Coastguard WorkerAC_MSG_CHECKING(whether struct stat has a st_flags field)
1168*6a54128fSAndroid Build Coastguard WorkerAC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
1169*6a54128fSAndroid Build Coastguard Worker	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat stat; stat.st_flags = 0;]])],[e2fsprogs_cv_struct_st_flags=yes],[e2fsprogs_cv_struct_st_flags=no]))
1170*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
1171*6a54128fSAndroid Build Coastguard Workerif test "$e2fsprogs_cv_struct_st_flags" = yes; then
1172*6a54128fSAndroid Build Coastguard Worker  AC_MSG_CHECKING(whether st_flags field is useful)
1173*6a54128fSAndroid Build Coastguard Worker  AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
1174*6a54128fSAndroid Build Coastguard Worker	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat stat; stat.st_flags |= UF_IMMUTABLE;]])],[e2fsprogs_cv_struct_st_flags_immut=yes],[e2fsprogs_cv_struct_st_flags_immut=no]))
1175*6a54128fSAndroid Build Coastguard Worker  AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
1176*6a54128fSAndroid Build Coastguard Worker  if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
1177*6a54128fSAndroid Build Coastguard Worker	  AC_DEFINE(HAVE_STAT_FLAGS, 1,
1178*6a54128fSAndroid Build Coastguard Worker		[Define to 1 if struct stat has st_flags])
1179*6a54128fSAndroid Build Coastguard Worker  fi
1180*6a54128fSAndroid Build Coastguard Workerfi
1181*6a54128fSAndroid Build Coastguard Workerdnl
1182*6a54128fSAndroid Build Coastguard Workerdnl Check for the presence of SA_LEN
1183*6a54128fSAndroid Build Coastguard Workerdnl
1184*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_MEMBER(struct sockaddr.sa_len,
1185*6a54128fSAndroid Build Coastguard Worker		AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,
1186*6a54128fSAndroid Build Coastguard Worker			[Define to 1 if if struct sockaddr contains sa_len]),,
1187*6a54128fSAndroid Build Coastguard Worker	[#include <sys/types.h>
1188*6a54128fSAndroid Build Coastguard Worker	 #include <sys/socket.h>])
1189*6a54128fSAndroid Build Coastguard Workerdnl
1190*6a54128fSAndroid Build Coastguard Workerdnl If we are using the system-provided blkid library, check for
1191*6a54128fSAndroid Build Coastguard Workerdnl the functions added after migrating that library to util-linux
1192*6a54128fSAndroid Build Coastguard Workerdnl
1193*6a54128fSAndroid Build Coastguard Workerif test -n "$BLKID_CMT"; then
1194*6a54128fSAndroid Build Coastguard Worker  AC_CHECK_LIB(blkid, blkid_probe_get_topology,
1195*6a54128fSAndroid Build Coastguard Worker		      AC_DEFINE(HAVE_BLKID_PROBE_GET_TOPOLOGY, 1,
1196*6a54128fSAndroid Build Coastguard Worker				[Define to 1 if blkid has blkid_probe_get_topology]))
1197*6a54128fSAndroid Build Coastguard Worker  AC_CHECK_LIB(blkid, blkid_topology_get_dax,
1198*6a54128fSAndroid Build Coastguard Worker		      AC_DEFINE(HAVE_BLKID_TOPOLOGY_GET_DAX, 1,
1199*6a54128fSAndroid Build Coastguard Worker				[Define to 1 if blkid has blkid_topology_get_dax]))
1200*6a54128fSAndroid Build Coastguard Worker  AC_CHECK_LIB(blkid, blkid_probe_enable_partitions,
1201*6a54128fSAndroid Build Coastguard Worker		      AC_DEFINE(HAVE_BLKID_PROBE_ENABLE_PARTITIONS, 1,
1202*6a54128fSAndroid Build Coastguard Worker				[Define to 1 if blkid has blkid_probe_enable_partitions]))
1203*6a54128fSAndroid Build Coastguard Workerfi
1204*6a54128fSAndroid Build Coastguard Workerdnl
1205*6a54128fSAndroid Build Coastguard Workerif test -n "$DLOPEN_LIB" ; then
1206*6a54128fSAndroid Build Coastguard Worker   ac_cv_func_dlopen=yes
1207*6a54128fSAndroid Build Coastguard Workerfi
1208*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_FUNCS(m4_flatten([
1209*6a54128fSAndroid Build Coastguard Worker	__secure_getenv
1210*6a54128fSAndroid Build Coastguard Worker	add_key
1211*6a54128fSAndroid Build Coastguard Worker	backtrace
1212*6a54128fSAndroid Build Coastguard Worker	chflags
1213*6a54128fSAndroid Build Coastguard Worker	dlopen
1214*6a54128fSAndroid Build Coastguard Worker	fadvise64
1215*6a54128fSAndroid Build Coastguard Worker	fallocate
1216*6a54128fSAndroid Build Coastguard Worker	fallocate64
1217*6a54128fSAndroid Build Coastguard Worker	fchown
1218*6a54128fSAndroid Build Coastguard Worker	fcntl
1219*6a54128fSAndroid Build Coastguard Worker	fdatasync
1220*6a54128fSAndroid Build Coastguard Worker	fstat64
1221*6a54128fSAndroid Build Coastguard Worker	fsync
1222*6a54128fSAndroid Build Coastguard Worker	ftruncate64
1223*6a54128fSAndroid Build Coastguard Worker	futimes
1224*6a54128fSAndroid Build Coastguard Worker	getcwd
1225*6a54128fSAndroid Build Coastguard Worker	getdtablesize
1226*6a54128fSAndroid Build Coastguard Worker	getentropy
1227*6a54128fSAndroid Build Coastguard Worker	gethostname
1228*6a54128fSAndroid Build Coastguard Worker	getmntinfo
1229*6a54128fSAndroid Build Coastguard Worker	getpwuid_r
1230*6a54128fSAndroid Build Coastguard Worker	getrandom
1231*6a54128fSAndroid Build Coastguard Worker	getrlimit
1232*6a54128fSAndroid Build Coastguard Worker	getrusage
1233*6a54128fSAndroid Build Coastguard Worker	jrand48
1234*6a54128fSAndroid Build Coastguard Worker	keyctl
1235*6a54128fSAndroid Build Coastguard Worker	llistxattr
1236*6a54128fSAndroid Build Coastguard Worker	llseek
1237*6a54128fSAndroid Build Coastguard Worker	lseek64
1238*6a54128fSAndroid Build Coastguard Worker	mallinfo
1239*6a54128fSAndroid Build Coastguard Worker	mallinfo2
1240*6a54128fSAndroid Build Coastguard Worker	mbstowcs
1241*6a54128fSAndroid Build Coastguard Worker	memalign
1242*6a54128fSAndroid Build Coastguard Worker	mempcpy
1243*6a54128fSAndroid Build Coastguard Worker	mmap
1244*6a54128fSAndroid Build Coastguard Worker	msync
1245*6a54128fSAndroid Build Coastguard Worker	nanosleep
1246*6a54128fSAndroid Build Coastguard Worker	open64
1247*6a54128fSAndroid Build Coastguard Worker	pathconf
1248*6a54128fSAndroid Build Coastguard Worker	posix_fadvise
1249*6a54128fSAndroid Build Coastguard Worker	posix_fadvise64
1250*6a54128fSAndroid Build Coastguard Worker	posix_memalign
1251*6a54128fSAndroid Build Coastguard Worker	prctl
1252*6a54128fSAndroid Build Coastguard Worker	pread
1253*6a54128fSAndroid Build Coastguard Worker	pwrite
1254*6a54128fSAndroid Build Coastguard Worker	pread64
1255*6a54128fSAndroid Build Coastguard Worker	pwrite64
1256*6a54128fSAndroid Build Coastguard Worker	qsort_r
1257*6a54128fSAndroid Build Coastguard Worker	secure_getenv
1258*6a54128fSAndroid Build Coastguard Worker	setmntent
1259*6a54128fSAndroid Build Coastguard Worker	setresgid
1260*6a54128fSAndroid Build Coastguard Worker	setresuid
1261*6a54128fSAndroid Build Coastguard Worker	snprintf
1262*6a54128fSAndroid Build Coastguard Worker	srandom
1263*6a54128fSAndroid Build Coastguard Worker	stpcpy
1264*6a54128fSAndroid Build Coastguard Worker	strcasecmp
1265*6a54128fSAndroid Build Coastguard Worker	strdup
1266*6a54128fSAndroid Build Coastguard Worker	strnlen
1267*6a54128fSAndroid Build Coastguard Worker	strptime
1268*6a54128fSAndroid Build Coastguard Worker	strtoull
1269*6a54128fSAndroid Build Coastguard Worker	sync_file_range
1270*6a54128fSAndroid Build Coastguard Worker	sysconf
1271*6a54128fSAndroid Build Coastguard Worker	usleep
1272*6a54128fSAndroid Build Coastguard Worker	utime
1273*6a54128fSAndroid Build Coastguard Worker	utimes
1274*6a54128fSAndroid Build Coastguard Worker	valloc
1275*6a54128fSAndroid Build Coastguard Worker]))
1276*6a54128fSAndroid Build Coastguard Workerdnl
1277*6a54128fSAndroid Build Coastguard Workerdnl Check to see if -lsocket is required (solaris) to make something
1278*6a54128fSAndroid Build Coastguard Workerdnl that uses socket() to compile; this is needed for the UUID library
1279*6a54128fSAndroid Build Coastguard Workerdnl
1280*6a54128fSAndroid Build Coastguard WorkerSOCKET_LIB=''
1281*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
1282*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SOCKET_LIB)
1283*6a54128fSAndroid Build Coastguard Workerdnl
1284*6a54128fSAndroid Build Coastguard Workerdnl See if libmagic exists
1285*6a54128fSAndroid Build Coastguard Workerdnl
1286*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_LIB(magic, magic_file, [MAGIC_LIB=-lmagic
1287*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_HEADERS([magic.h])])
1288*6a54128fSAndroid Build Coastguard Workerif test "$ac_cv_func_dlopen" = yes ; then
1289*6a54128fSAndroid Build Coastguard Worker   MAGIC_LIB=$DLOPEN_LIB
1290*6a54128fSAndroid Build Coastguard Workerfi
1291*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(MAGIC_LIB)
1292*6a54128fSAndroid Build Coastguard Workerdnl
1293*6a54128fSAndroid Build Coastguard Workerdnl Check to see if librt is required for clock_gettime() (glibc < 2.17)
1294*6a54128fSAndroid Build Coastguard Workerdnl
1295*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_LIB(rt, clock_gettime, [CLOCK_GETTIME_LIB=-lrt])
1296*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(CLOCK_GETTIME_LIB)
1297*6a54128fSAndroid Build Coastguard Workerdnl
1298*6a54128fSAndroid Build Coastguard Workerdnl Check to see if the FUSE library is -lfuse or -losxfuse
1299*6a54128fSAndroid Build Coastguard Workerdnl
1300*6a54128fSAndroid Build Coastguard WorkerFUSE_CMT=
1301*6a54128fSAndroid Build Coastguard WorkerFUSE_LIB=
1302*6a54128fSAndroid Build Coastguard Workerdnl osxfuse.dylib supersedes fuselib.dylib
1303*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([fuse2fs],
1304*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--disable-fuse2fs],[do not build fuse2fs]),
1305*6a54128fSAndroid Build Coastguard Workerif test "$enableval" = "no"
1306*6a54128fSAndroid Build Coastguard Workerthen
1307*6a54128fSAndroid Build Coastguard Worker	FUSE_CMT="#"
1308*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Disabling fuse2fs])
1309*6a54128fSAndroid Build Coastguard Workerelse
1310*6a54128fSAndroid Build Coastguard Worker	AC_CHECK_HEADERS([pthread.h fuse.h], [],
1311*6a54128fSAndroid Build Coastguard Worker[AC_MSG_FAILURE([Cannot find fuse2fs headers.])],
1312*6a54128fSAndroid Build Coastguard Worker[#define _FILE_OFFSET_BITS	64
1313*6a54128fSAndroid Build Coastguard Worker#define FUSE_USE_VERSION 29])
1314*6a54128fSAndroid Build Coastguard Worker
1315*6a54128fSAndroid Build Coastguard Worker	AC_PREPROC_IFELSE(
1316*6a54128fSAndroid Build Coastguard Worker[AC_LANG_PROGRAM([[#define FUSE_USE_VERSION 29
1317*6a54128fSAndroid Build Coastguard Worker#ifdef __linux__
1318*6a54128fSAndroid Build Coastguard Worker#include <linux/fs.h>
1319*6a54128fSAndroid Build Coastguard Worker#include <linux/falloc.h>
1320*6a54128fSAndroid Build Coastguard Worker#include <linux/xattr.h>
1321*6a54128fSAndroid Build Coastguard Worker#endif
1322*6a54128fSAndroid Build Coastguard Worker]], [])], [], [AC_MSG_FAILURE([Cannot find fuse2fs Linux headers.])])
1323*6a54128fSAndroid Build Coastguard Worker
1324*6a54128fSAndroid Build Coastguard Worker	AC_CHECK_LIB(osxfuse, fuse_main, [FUSE_LIB=-losxfuse],
1325*6a54128fSAndroid Build Coastguard Worker		[AC_CHECK_LIB(fuse, fuse_main, [FUSE_LIB=-lfuse],
1326*6a54128fSAndroid Build Coastguard Worker			      [AC_MSG_FAILURE([Cannot find fuse library.])])])
1327*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling fuse2fs])
1328*6a54128fSAndroid Build Coastguard Workerfi
1329*6a54128fSAndroid Build Coastguard Worker,
1330*6a54128fSAndroid Build Coastguard WorkerAC_CHECK_HEADERS([pthread.h fuse.h], [], [FUSE_CMT="#"],
1331*6a54128fSAndroid Build Coastguard Worker[#define _FILE_OFFSET_BITS	64
1332*6a54128fSAndroid Build Coastguard Worker#define FUSE_USE_VERSION 29
1333*6a54128fSAndroid Build Coastguard Worker#ifdef __linux__
1334*6a54128fSAndroid Build Coastguard Worker# include <linux/fs.h>
1335*6a54128fSAndroid Build Coastguard Worker# include <linux/falloc.h>
1336*6a54128fSAndroid Build Coastguard Worker# include <linux/xattr.h>
1337*6a54128fSAndroid Build Coastguard Worker#endif])
1338*6a54128fSAndroid Build Coastguard Workerif test -z "$FUSE_CMT"
1339*6a54128fSAndroid Build Coastguard Workerthen
1340*6a54128fSAndroid Build Coastguard Worker	AC_CHECK_LIB(osxfuse, fuse_main, [FUSE_LIB=-losxfuse],
1341*6a54128fSAndroid Build Coastguard Worker[AC_CHECK_LIB(fuse, fuse_main, [FUSE_LIB=-lfuse], [FUSE_CMT="#"])])
1342*6a54128fSAndroid Build Coastguard Workerfi
1343*6a54128fSAndroid Build Coastguard Workerif test -z "$FUSE_CMT"
1344*6a54128fSAndroid Build Coastguard Workerthen
1345*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Enabling fuse2fs by default.])
1346*6a54128fSAndroid Build Coastguard Workerfi
1347*6a54128fSAndroid Build Coastguard Worker)
1348*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(FUSE_LIB)
1349*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(FUSE_CMT)
1350*6a54128fSAndroid Build Coastguard Workerdnl
1351*6a54128fSAndroid Build Coastguard Workerdnl See if optreset exists
1352*6a54128fSAndroid Build Coastguard Workerdnl
1353*6a54128fSAndroid Build Coastguard WorkerAC_MSG_CHECKING(for optreset)
1354*6a54128fSAndroid Build Coastguard WorkerAC_CACHE_VAL(ac_cv_have_optreset,
1355*6a54128fSAndroid Build Coastguard Worker[AC_EGREP_HEADER(optreset, unistd.h,
1356*6a54128fSAndroid Build Coastguard Worker  ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
1357*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT($ac_cv_have_optreset)
1358*6a54128fSAndroid Build Coastguard Workerif test $ac_cv_have_optreset = yes; then
1359*6a54128fSAndroid Build Coastguard Worker  AC_DEFINE(HAVE_OPTRESET, 1, [Define to 1 if optreset for getopt is present])
1360*6a54128fSAndroid Build Coastguard Workerfi
1361*6a54128fSAndroid Build Coastguard Workerdnl
1362*6a54128fSAndroid Build Coastguard Workerdnl Test for sem_init, and which library it might require:
1363*6a54128fSAndroid Build Coastguard Workerdnl
1364*6a54128fSAndroid Build Coastguard WorkerAH_TEMPLATE([HAVE_SEM_INIT], [Define to 1 if sem_init() exists])
1365*6a54128fSAndroid Build Coastguard WorkerSEM_INIT_LIB=''
1366*6a54128fSAndroid Build Coastguard Workerecho GL_THREADS_API: ${gl_threads_api}
1367*6a54128fSAndroid Build Coastguard Workerif test "${gl_threads_api}" != none
1368*6a54128fSAndroid Build Coastguard Workerthen
1369*6a54128fSAndroid Build Coastguard Worker  AC_CHECK_FUNC(sem_init, ,
1370*6a54128fSAndroid Build Coastguard Worker    AC_CHECK_LIB(pthread, sem_init,
1371*6a54128fSAndroid Build Coastguard Worker  	AC_DEFINE(HAVE_SEM_INIT, 1)
1372*6a54128fSAndroid Build Coastguard Worker  	SEM_INIT_LIB=-lpthread,
1373*6a54128fSAndroid Build Coastguard Worker    AC_CHECK_LIB(rt, sem_init,
1374*6a54128fSAndroid Build Coastguard Worker  	AC_DEFINE(HAVE_SEM_INIT, 1)
1375*6a54128fSAndroid Build Coastguard Worker  	SEM_INIT_LIB=-lrt,
1376*6a54128fSAndroid Build Coastguard Worker    AC_CHECK_LIB(posix4, sem_init,
1377*6a54128fSAndroid Build Coastguard Worker  	AC_DEFINE(HAVE_SEM_INIT, 1)
1378*6a54128fSAndroid Build Coastguard Worker  	SEM_INIT_LIB=-lposix4))))dnl
1379*6a54128fSAndroid Build Coastguard Workerfi
1380*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(SEM_INIT_LIB)
1381*6a54128fSAndroid Build Coastguard Workerdnl
1382*6a54128fSAndroid Build Coastguard Workerdnl qsort_r detection
1383*6a54128fSAndroid Build Coastguard Workerdnl
1384*6a54128fSAndroid Build Coastguard WorkerAS_IF([test "$ac_cv_func_qsort_r" != no], [
1385*6a54128fSAndroid Build Coastguard Worker  AC_CACHE_CHECK(whether qsort_r is GNU version, e2_cv_gnu_qsort_r,
1386*6a54128fSAndroid Build Coastguard Worker    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1387*6a54128fSAndroid Build Coastguard Worker@%:@include <stdlib.h>
1388*6a54128fSAndroid Build Coastguard Workervoid (qsort_r)(void *base, size_t nmemb, size_t size,
1389*6a54128fSAndroid Build Coastguard Worker	    int (*compar)(const void *, const void *, void *),
1390*6a54128fSAndroid Build Coastguard Worker	    void *arg);
1391*6a54128fSAndroid Build Coastguard Worker]], [[ ]])],[e2_cv_gnu_qsort_r=yes],[e2_cv_gnu_qsort_r=no])
1392*6a54128fSAndroid Build Coastguard Worker  ])
1393*6a54128fSAndroid Build Coastguard Worker  AC_CACHE_CHECK(whether qsort_r is BSD version, e2_cv_bsd_qsort_r,
1394*6a54128fSAndroid Build Coastguard Worker    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1395*6a54128fSAndroid Build Coastguard Worker@%:@include <stdlib.h>
1396*6a54128fSAndroid Build Coastguard Workervoid (qsort_r)(void *base, size_t nmemb, size_t size,
1397*6a54128fSAndroid Build Coastguard Worker	     void *arg, int (*compar)(void *, const void *, const void *));
1398*6a54128fSAndroid Build Coastguard Worker]], [[ ]])],[e2_cv_bsd_qsort_r=yes],[e2_cv_bsd_qsort_r=no])
1399*6a54128fSAndroid Build Coastguard Worker  ])
1400*6a54128fSAndroid Build Coastguard Worker  AS_CASE("$e2_cv_gnu_qsort_r:$e2_cv_bsd_qsort_r",
1401*6a54128fSAndroid Build Coastguard Worker  [yes:no], [
1402*6a54128fSAndroid Build Coastguard Worker    AC_DEFINE(HAVE_GNU_QSORT_R, 1, [ Define to 1 if you have the GNU-style 'qsort_r' function.])
1403*6a54128fSAndroid Build Coastguard Worker  ],
1404*6a54128fSAndroid Build Coastguard Worker  [no:yes], [
1405*6a54128fSAndroid Build Coastguard Worker    AC_DEFINE(HAVE_BSD_QSORT_R, 1, [ Define to 1 if you have the BSD-style 'qsort_r' function.])
1406*6a54128fSAndroid Build Coastguard Worker  ])
1407*6a54128fSAndroid Build Coastguard Worker])
1408*6a54128fSAndroid Build Coastguard Workerdnl
1409*6a54128fSAndroid Build Coastguard Workerdnl Check for unified diff
1410*6a54128fSAndroid Build Coastguard Workerdnl
1411*6a54128fSAndroid Build Coastguard WorkerAC_MSG_CHECKING(for unified diff option)
1412*6a54128fSAndroid Build Coastguard Workerif diff -u $0 $0 > /dev/null 2>&1 ; then
1413*6a54128fSAndroid Build Coastguard Worker   UNI_DIFF_OPTS=-u
1414*6a54128fSAndroid Build Coastguard Workerelse
1415*6a54128fSAndroid Build Coastguard Worker   UNI_DIFF_OPTS=-c
1416*6a54128fSAndroid Build Coastguard Workerfi
1417*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT($UNI_DIFF_OPTS)
1418*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(UNI_DIFF_OPTS)
1419*6a54128fSAndroid Build Coastguard Workerdnl
1420*6a54128fSAndroid Build Coastguard Workerdnl We use the EXT2 ioctls only under Linux
1421*6a54128fSAndroid Build Coastguard Workerdnl
1422*6a54128fSAndroid Build Coastguard Workercase "$host_os" in
1423*6a54128fSAndroid Build Coastguard Workerlinux*)
1424*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(HAVE_EXT2_IOCTLS, 1, [Define to 1 if Ext2 ioctls present])
1425*6a54128fSAndroid Build Coastguard Worker	;;
1426*6a54128fSAndroid Build Coastguard Workeresac
1427*6a54128fSAndroid Build Coastguard Workerdnl
1428*6a54128fSAndroid Build Coastguard Workerdnl Check the available mount options
1429*6a54128fSAndroid Build Coastguard Workerdnl
1430*6a54128fSAndroid Build Coastguard WorkerAX_CHECK_MOUNT_OPT(nosuid)
1431*6a54128fSAndroid Build Coastguard WorkerAX_CHECK_MOUNT_OPT(nodev)
1432*6a54128fSAndroid Build Coastguard Workerdnl Enable LTO for all packages
1433*6a54128fSAndroid Build Coastguard Workerdnl
1434*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([lto],
1435*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-lto],[enable link time optimization]),,
1436*6a54128fSAndroid Build Coastguard Workerenable_lto=no)
1437*6a54128fSAndroid Build Coastguard Workerif test "$enable_lto" = "yes" || test "$enable_lto" = "probe"; then
1438*6a54128fSAndroid Build Coastguard Worker	AC_MSG_CHECKING([if C compiler supports LTO])
1439*6a54128fSAndroid Build Coastguard Worker	OLD_CFLAGS="$CFLAGS"
1440*6a54128fSAndroid Build Coastguard Worker	OLD_LDFLAGS="$LDFLAGS"
1441*6a54128fSAndroid Build Coastguard Worker	LTO_FLAGS="-g -flto -ffat-lto-objects"
1442*6a54128fSAndroid Build Coastguard Worker	CFLAGS="$CFLAGS $LTO_FLAGS"
1443*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="$LDFLAGS $LTO_FLAGS"
1444*6a54128fSAndroid Build Coastguard Worker	AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1445*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([yes])]
1446*6a54128fSAndroid Build Coastguard Worker		[lto_cflags=$LTO_FLAGS]
1447*6a54128fSAndroid Build Coastguard Worker		[lto_ldflags=$LTO_FLAGS]
1448*6a54128fSAndroid Build Coastguard Worker		[AC_PATH_PROG(gcc_ar, gcc-ar,,)]
1449*6a54128fSAndroid Build Coastguard Worker		[AC_PATH_PROG(gcc_ranlib, gcc-ranlib,,)],
1450*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([no])])
1451*6a54128fSAndroid Build Coastguard Worker	if test -x "$gcc_ar" && test -x "$gcc_ranlib"; then
1452*6a54128fSAndroid Build Coastguard Worker		have_lto=yes
1453*6a54128fSAndroid Build Coastguard Worker		AR="${gcc_ar}"
1454*6a54128fSAndroid Build Coastguard Worker		RANLIB="${gcc_ranlib}"
1455*6a54128fSAndroid Build Coastguard Worker	fi
1456*6a54128fSAndroid Build Coastguard Worker	CFLAGS="${OLD_CFLAGS}"
1457*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="${OLD_LDFLAGS}"
1458*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(have_lto)
1459*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(lto_cflags)
1460*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(lto_ldflags)
1461*6a54128fSAndroid Build Coastguard Workerfi
1462*6a54128fSAndroid Build Coastguard Workerif test "$enable_lto" = "yes" && test "$have_lto" != "yes"; then
1463*6a54128fSAndroid Build Coastguard Worker	AC_MSG_ERROR([LTO not supported by compiler.])
1464*6a54128fSAndroid Build Coastguard Workerfi
1465*6a54128fSAndroid Build Coastguard Workerdnl
1466*6a54128fSAndroid Build Coastguard Workerdnl Enable UBSAN for all packages
1467*6a54128fSAndroid Build Coastguard Workerdnl
1468*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([ubsan],
1469*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-ubsan],[enable undefined behavior sanitizer]),,
1470*6a54128fSAndroid Build Coastguard Workerenable_ubsan=no)
1471*6a54128fSAndroid Build Coastguard Workerif test "$enable_ubsan" = "yes" || test "$enable_ubsan" = "probe"; then
1472*6a54128fSAndroid Build Coastguard Worker	AC_MSG_CHECKING([if C compiler supports UBSAN])
1473*6a54128fSAndroid Build Coastguard Worker	OLD_CFLAGS="$CFLAGS"
1474*6a54128fSAndroid Build Coastguard Worker	OLD_LDFLAGS="$LDFLAGS"
1475*6a54128fSAndroid Build Coastguard Worker	UBSAN_FLAGS="-fsanitize=undefined"
1476*6a54128fSAndroid Build Coastguard Worker	CFLAGS="$CFLAGS $UBSAN_FLAGS"
1477*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="$LDFLAGS $UBSAN_FLAGS"
1478*6a54128fSAndroid Build Coastguard Worker	AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1479*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([yes])]
1480*6a54128fSAndroid Build Coastguard Worker		[ubsan_cflags=$UBSAN_FLAGS]
1481*6a54128fSAndroid Build Coastguard Worker		[ubsan_ldflags=$UBSAN_FLAGS]
1482*6a54128fSAndroid Build Coastguard Worker		[have_ubsan=yes],
1483*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([no])])
1484*6a54128fSAndroid Build Coastguard Worker	CFLAGS="${OLD_CFLAGS}"
1485*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="${OLD_LDFLAGS}"
1486*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(have_ubsan)
1487*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(ubsan_cflags)
1488*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(ubsan_ldflags)
1489*6a54128fSAndroid Build Coastguard Workerfi
1490*6a54128fSAndroid Build Coastguard Workerif test "$enable_ubsan" = "yes" && test "$have_ubsan" != "yes"; then
1491*6a54128fSAndroid Build Coastguard Worker	AC_MSG_ERROR([UBSAN not supported by compiler.])
1492*6a54128fSAndroid Build Coastguard Workerfi
1493*6a54128fSAndroid Build Coastguard Workerdnl
1494*6a54128fSAndroid Build Coastguard Workerdnl Enable ADDRSAN for all packages
1495*6a54128fSAndroid Build Coastguard Workerdnl
1496*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([addrsan],
1497*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-addrsan],[enable address sanitizer]),,
1498*6a54128fSAndroid Build Coastguard Workerenable_addrsan=no)
1499*6a54128fSAndroid Build Coastguard Workerif test "$enable_addrsan" = "yes" || test "$enable_addrsan" = "probe"; then
1500*6a54128fSAndroid Build Coastguard Worker	AC_MSG_CHECKING([if C compiler supports ADDRSAN])
1501*6a54128fSAndroid Build Coastguard Worker	OLD_CFLAGS="$CFLAGS"
1502*6a54128fSAndroid Build Coastguard Worker	OLD_LDFLAGS="$LDFLAGS"
1503*6a54128fSAndroid Build Coastguard Worker	ADDRSAN_FLAGS="-fsanitize=address"
1504*6a54128fSAndroid Build Coastguard Worker	CFLAGS="$CFLAGS $ADDRSAN_FLAGS"
1505*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="$LDFLAGS $ADDRSAN_FLAGS"
1506*6a54128fSAndroid Build Coastguard Worker	AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1507*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([yes])]
1508*6a54128fSAndroid Build Coastguard Worker		[addrsan_cflags=$ADDRSAN_FLAGS]
1509*6a54128fSAndroid Build Coastguard Worker		[addrsan_ldflags=$ADDRSAN_FLAGS]
1510*6a54128fSAndroid Build Coastguard Worker		[have_addrsan=yes],
1511*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([no])])
1512*6a54128fSAndroid Build Coastguard Worker	CFLAGS="${OLD_CFLAGS}"
1513*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="${OLD_LDFLAGS}"
1514*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(have_addrsan)
1515*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(addrsan_cflags)
1516*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(addrsan_ldflags)
1517*6a54128fSAndroid Build Coastguard Workerfi
1518*6a54128fSAndroid Build Coastguard Workerif test "$enable_addrsan" = "yes" && test "$have_addrsan" != "yes"; then
1519*6a54128fSAndroid Build Coastguard Worker	AC_MSG_ERROR([ADDRSAN not supported by compiler.])
1520*6a54128fSAndroid Build Coastguard Workerfi
1521*6a54128fSAndroid Build Coastguard Workerdnl
1522*6a54128fSAndroid Build Coastguard Workerdnl Enable THREADSAN for all packages
1523*6a54128fSAndroid Build Coastguard Workerdnl
1524*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([threadsan],
1525*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-threadsan],[enable thread sanitizer]),,
1526*6a54128fSAndroid Build Coastguard Workerenable_threadsan=no)
1527*6a54128fSAndroid Build Coastguard Workerif test "$enable_threadsan" = "yes" || test "$enable_threadsan" = "probe"; then
1528*6a54128fSAndroid Build Coastguard Worker	AC_MSG_CHECKING([if C compiler supports THREADSAN])
1529*6a54128fSAndroid Build Coastguard Worker	OLD_CFLAGS="$CFLAGS"
1530*6a54128fSAndroid Build Coastguard Worker	OLD_LDFLAGS="$LDFLAGS"
1531*6a54128fSAndroid Build Coastguard Worker	THREADSAN_FLAGS="-fsanitize=thread"
1532*6a54128fSAndroid Build Coastguard Worker	CFLAGS="$CFLAGS $THREADSAN_FLAGS"
1533*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="$LDFLAGS $THREADSAN_FLAGS"
1534*6a54128fSAndroid Build Coastguard Worker	AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1535*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([yes])]
1536*6a54128fSAndroid Build Coastguard Worker		[threadsan_cflags=$THREADSAN_FLAGS]
1537*6a54128fSAndroid Build Coastguard Worker		[threadsan_ldflags=$THREADSAN_FLAGS]
1538*6a54128fSAndroid Build Coastguard Worker		[have_threadsan=yes],
1539*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([no])])
1540*6a54128fSAndroid Build Coastguard Worker	CFLAGS="${OLD_CFLAGS}"
1541*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="${OLD_LDFLAGS}"
1542*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(have_threadsan)
1543*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(threadsan_cflags)
1544*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(threadsan_ldflags)
1545*6a54128fSAndroid Build Coastguard Workerfi
1546*6a54128fSAndroid Build Coastguard Workerif test "$enable_threadsan" = "yes" && test "$have_threadsan" != "yes"; then
1547*6a54128fSAndroid Build Coastguard Worker	AC_MSG_ERROR([THREADSAN not supported by compiler.])
1548*6a54128fSAndroid Build Coastguard Workerfi
1549*6a54128fSAndroid Build Coastguard Workerif test "$have_threadsan" = "yes" && test "$have_addrsan" = "yes"; then
1550*6a54128fSAndroid Build Coastguard Worker	AC_MSG_WARN([ADDRSAN and THREADSAN are not known to work together.])
1551*6a54128fSAndroid Build Coastguard Workerfi
1552*6a54128fSAndroid Build Coastguard Workerdnl
1553*6a54128fSAndroid Build Coastguard Workerdnl Enable the fuzzer sanitizer for all packages
1554*6a54128fSAndroid Build Coastguard Workerdnl
1555*6a54128fSAndroid Build Coastguard WorkerFUZZING_CMT="#"
1556*6a54128fSAndroid Build Coastguard WorkerAC_ARG_ENABLE([fuzzing],
1557*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--enable-fuzzing],[enable fuzzing sanitizer]),,
1558*6a54128fSAndroid Build Coastguard Workerenable_fuzzing=no)
1559*6a54128fSAndroid Build Coastguard Workerif test "$enable_fuzzing" = "yes" || test "$enable_fuzzing" = "probe"; then
1560*6a54128fSAndroid Build Coastguard Worker	AC_PROG_CXX
1561*6a54128fSAndroid Build Coastguard Worker	AC_MSG_CHECKING([if C compiler supports fuzzing sanitizer])
1562*6a54128fSAndroid Build Coastguard Worker	AC_LANG_PUSH([C++])
1563*6a54128fSAndroid Build Coastguard Worker	OLD_CXXFLAGS="$CXXFLAGS"
1564*6a54128fSAndroid Build Coastguard Worker	OLD_LDFLAGS="$LDFLAGS"
1565*6a54128fSAndroid Build Coastguard Worker	FUZZER_FLAGS="-fsanitize=fuzzer"
1566*6a54128fSAndroid Build Coastguard Worker	CXXFLAGS="$CXXFLAGS $FUZZER_FLAGS"
1567*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="$LDFLAGS $FUZZER_FLAGS"
1568*6a54128fSAndroid Build Coastguard Worker	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1569*6a54128fSAndroid Build Coastguard Worker		#include <stddef.h>
1570*6a54128fSAndroid Build Coastguard Worker		#include <stdint.h>
1571*6a54128fSAndroid Build Coastguard Worker		]],
1572*6a54128fSAndroid Build Coastguard Worker		[ return 0; ])],
1573*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([yes])]
1574*6a54128fSAndroid Build Coastguard Worker		[fuzzer_cflags=$FUZZER_FLAGS]
1575*6a54128fSAndroid Build Coastguard Worker		[fuzzer_ldflags=$FUZZER_FLAGS]
1576*6a54128fSAndroid Build Coastguard Worker		[FUZZING_CMT=]
1577*6a54128fSAndroid Build Coastguard Worker		[have_fuzzer=yes],
1578*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_RESULT([no])]
1579*6a54128fSAndroid Build Coastguard Worker		[AC_MSG_ERROR([fuzzing requested but not available])])
1580*6a54128fSAndroid Build Coastguard Worker	CXXFLAGS="${OLD_CXXFLAGS}"
1581*6a54128fSAndroid Build Coastguard Worker	LDFLAGS="${OLD_LDFLAGS}"
1582*6a54128fSAndroid Build Coastguard Worker	AC_LANG_POP([C++])
1583*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(have_fuzzer)
1584*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(fuzzer_cflags)
1585*6a54128fSAndroid Build Coastguard Worker	AC_SUBST(fuzzer_ldflags)
1586*6a54128fSAndroid Build Coastguard Workerfi
1587*6a54128fSAndroid Build Coastguard Workerif test "$enable_fuzzer" = "yes" && test "$have_fuzzer" != "yes"; then
1588*6a54128fSAndroid Build Coastguard Worker	AC_MSG_ERROR([Fuzzing not supported by compiler.])
1589*6a54128fSAndroid Build Coastguard Workerfi
1590*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(FUZZING_CMT)
1591*6a54128fSAndroid Build Coastguard Workerdnl
1592*6a54128fSAndroid Build Coastguard Workerdnl OS-specific uncomment control
1593*6a54128fSAndroid Build Coastguard Workerdnl
1594*6a54128fSAndroid Build Coastguard WorkerLINUX_CMT="#"
1595*6a54128fSAndroid Build Coastguard WorkerCYGWIN_CMT="#"
1596*6a54128fSAndroid Build Coastguard WorkerUNIX_CMT=
1597*6a54128fSAndroid Build Coastguard Workercase "$host_os" in
1598*6a54128fSAndroid Build Coastguard Workerlinux*)
1599*6a54128fSAndroid Build Coastguard Worker	LINUX_CMT=
1600*6a54128fSAndroid Build Coastguard Worker	;;
1601*6a54128fSAndroid Build Coastguard Workercygwin)
1602*6a54128fSAndroid Build Coastguard Worker	CYGWIN_CMT=
1603*6a54128fSAndroid Build Coastguard Worker	UNIX_CMT="#"
1604*6a54128fSAndroid Build Coastguard Worker	;;
1605*6a54128fSAndroid Build Coastguard Workeresac
1606*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(LINUX_CMT)
1607*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(CYGWIN_CMT)
1608*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(UNIX_CMT)
1609*6a54128fSAndroid Build Coastguard Workerdnl
1610*6a54128fSAndroid Build Coastguard Workerdnl e2scrub only builds on linux
1611*6a54128fSAndroid Build Coastguard Workerdnl
1612*6a54128fSAndroid Build Coastguard WorkerE2SCRUB_CMT="$LINUX_CMT"
1613*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(E2SCRUB_CMT)
1614*6a54128fSAndroid Build Coastguard Workerdnl
1615*6a54128fSAndroid Build Coastguard Workerdnl Linux and Hurd places root files in the / by default
1616*6a54128fSAndroid Build Coastguard Workerdnl
1617*6a54128fSAndroid Build Coastguard Workercase "$host_os" in
1618*6a54128fSAndroid Build Coastguard Workerlinux* | gnu* | k*bsd*-gnu)
1619*6a54128fSAndroid Build Coastguard Worker	if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
1620*6a54128fSAndroid Build Coastguard Worker		root_prefix="";
1621*6a54128fSAndroid Build Coastguard Worker		AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
1622*6a54128fSAndroid Build Coastguard Worker	fi
1623*6a54128fSAndroid Build Coastguard Worker	;;
1624*6a54128fSAndroid Build Coastguard Workeresac
1625*6a54128fSAndroid Build Coastguard Workerdnl
1626*6a54128fSAndroid Build Coastguard Workerdnl On Linux/hurd, force the prefix to be /usr
1627*6a54128fSAndroid Build Coastguard Workerdnl
1628*6a54128fSAndroid Build Coastguard Workercase "$host_os" in
1629*6a54128fSAndroid Build Coastguard Workerlinux* | gnu* | k*bsd*-gnu)
1630*6a54128fSAndroid Build Coastguard Worker	if test "$prefix" = NONE ; then
1631*6a54128fSAndroid Build Coastguard Worker		prefix="/usr";
1632*6a54128fSAndroid Build Coastguard Worker		AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
1633*6a54128fSAndroid Build Coastguard Worker		if test "$mandir" = '${prefix}/man' ; then
1634*6a54128fSAndroid Build Coastguard Worker			AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
1635*6a54128fSAndroid Build Coastguard Worker			mandir=/usr/share/man
1636*6a54128fSAndroid Build Coastguard Worker		fi
1637*6a54128fSAndroid Build Coastguard Worker	fi
1638*6a54128fSAndroid Build Coastguard Worker;;
1639*6a54128fSAndroid Build Coastguard Workeresac
1640*6a54128fSAndroid Build Coastguard Workerif test "$root_prefix" = NONE ; then
1641*6a54128fSAndroid Build Coastguard Worker	if test "$prefix" = NONE ; then
1642*6a54128fSAndroid Build Coastguard Worker		root_prefix="$ac_default_prefix"
1643*6a54128fSAndroid Build Coastguard Worker	else
1644*6a54128fSAndroid Build Coastguard Worker		root_prefix="$prefix"
1645*6a54128fSAndroid Build Coastguard Worker	fi
1646*6a54128fSAndroid Build Coastguard Worker	root_bindir=$bindir
1647*6a54128fSAndroid Build Coastguard Worker	root_sbindir=$sbindir
1648*6a54128fSAndroid Build Coastguard Worker	root_libdir=$libdir
1649*6a54128fSAndroid Build Coastguard Worker	root_sysconfdir=$sysconfdir
1650*6a54128fSAndroid Build Coastguard Workerelse
1651*6a54128fSAndroid Build Coastguard Worker	root_bindir='${root_prefix}/bin'
1652*6a54128fSAndroid Build Coastguard Worker	root_sbindir='${root_prefix}/sbin'
1653*6a54128fSAndroid Build Coastguard Worker	root_libdir='${root_prefix}/lib'
1654*6a54128fSAndroid Build Coastguard Worker	root_sysconfdir='${root_prefix}/etc'
1655*6a54128fSAndroid Build Coastguard Workerfi
1656*6a54128fSAndroid Build Coastguard Workerif test "$bindir" != '${exec_prefix}/bin'; then
1657*6a54128fSAndroid Build Coastguard Worker    root_bindir=$bindir
1658*6a54128fSAndroid Build Coastguard Worker    AC_MSG_RESULT([Setting root_bindir to $root_bindir])
1659*6a54128fSAndroid Build Coastguard Workerfi
1660*6a54128fSAndroid Build Coastguard Workerif test "$sbindir" != '${exec_prefix}/sbin'; then
1661*6a54128fSAndroid Build Coastguard Worker    root_sbindir=$sbindir
1662*6a54128fSAndroid Build Coastguard Worker    AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
1663*6a54128fSAndroid Build Coastguard Workerfi
1664*6a54128fSAndroid Build Coastguard Workerif test "$libdir" != '${exec_prefix}/lib'; then
1665*6a54128fSAndroid Build Coastguard Worker    root_libdir=$libdir
1666*6a54128fSAndroid Build Coastguard Worker    AC_MSG_RESULT([Setting root_libdir to $root_libdir])
1667*6a54128fSAndroid Build Coastguard Workerfi
1668*6a54128fSAndroid Build Coastguard Workerif test "$sysconfdir" != '${prefix}/etc'; then
1669*6a54128fSAndroid Build Coastguard Worker    root_sysconfdir=$sysconfdir
1670*6a54128fSAndroid Build Coastguard Worker    AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
1671*6a54128fSAndroid Build Coastguard Workerfi
1672*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(root_prefix)
1673*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(root_bindir)
1674*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(root_sbindir)
1675*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(root_libdir)
1676*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(root_sysconfdir)
1677*6a54128fSAndroid Build Coastguard Workerdnl
1678*6a54128fSAndroid Build Coastguard Workerdnl Allow specification of the multiarch arch
1679*6a54128fSAndroid Build Coastguard Workerdnl
1680*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([multiarch],
1681*6a54128fSAndroid Build Coastguard WorkerAS_HELP_STRING([--with-multiarch=ARCH],[specify the multiarch triplet]),
1682*6a54128fSAndroid Build Coastguard Workerif test "$withval" = "lib64"; then
1683*6a54128fSAndroid Build Coastguard Worker    libdir=/usr/lib64
1684*6a54128fSAndroid Build Coastguard Worker    root_libdir=/lib64
1685*6a54128fSAndroid Build Coastguard Workerelse
1686*6a54128fSAndroid Build Coastguard Worker    libdir=$libdir/$withval
1687*6a54128fSAndroid Build Coastguard Worker    root_libdir=$root_libdir/$withval
1688*6a54128fSAndroid Build Coastguard Workerfi
1689*6a54128fSAndroid Build Coastguard Worker)
1690*6a54128fSAndroid Build Coastguard Workerdnl
1691*6a54128fSAndroid Build Coastguard Workerdnl
1692*6a54128fSAndroid Build Coastguard Workerdnl See if -static works.  This could fail if the linker does not
1693*6a54128fSAndroid Build Coastguard Workerdnl support -static, or if required external libraries are not available
1694*6a54128fSAndroid Build Coastguard Workerdnl in static form.
1695*6a54128fSAndroid Build Coastguard Workerdnl
1696*6a54128fSAndroid Build Coastguard WorkerAC_MSG_CHECKING([whether we can link with -static])
1697*6a54128fSAndroid Build Coastguard WorkerAC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
1698*6a54128fSAndroid Build Coastguard Worker[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS_STATIC -static"
1699*6a54128fSAndroid Build Coastguard WorkerAC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[fflush(stdout);]])],[ac_cv_e2fsprogs_use_static=yes],[ac_cv_e2fsprogs_use_static=no])
1700*6a54128fSAndroid Build Coastguard WorkerLDFLAGS=$SAVE_LDFLAGS])
1701*6a54128fSAndroid Build Coastguard Workerdnl
1702*6a54128fSAndroid Build Coastguard Workerdnl Regardless of how the test turns out, Solaris doesn't handle -static
1703*6a54128fSAndroid Build Coastguard Workerdnl This is caused by the socket library requiring the nsl library, which
1704*6a54128fSAndroid Build Coastguard Workerdnl requires the -dl library, which only works for dynamically linked
1705*6a54128fSAndroid Build Coastguard Workerdnl programs.  It basically means you can't have statically linked programs
1706*6a54128fSAndroid Build Coastguard Workerdnl which use the network under Solaris.
1707*6a54128fSAndroid Build Coastguard Workerdnl
1708*6a54128fSAndroid Build Coastguard Workercase "$host_os" in
1709*6a54128fSAndroid Build Coastguard Workersolaris2.*)
1710*6a54128fSAndroid Build Coastguard Worker	ac_cv_e2fsprogs_use_static=no
1711*6a54128fSAndroid Build Coastguard Worker;;
1712*6a54128fSAndroid Build Coastguard Workeresac
1713*6a54128fSAndroid Build Coastguard WorkerAC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
1714*6a54128fSAndroid Build Coastguard Workerif test $ac_cv_e2fsprogs_use_static = yes; then
1715*6a54128fSAndroid Build Coastguard Worker	LDFLAGS_STATIC="$LDFLAGS_STATIC -static"
1716*6a54128fSAndroid Build Coastguard Workerfi
1717*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(LDFLAGS_STATIC)
1718*6a54128fSAndroid Build Coastguard Workerdnl
1719*6a54128fSAndroid Build Coastguard Workerdnl Work around mysterious Darwin / GNU libintl problem
1720*6a54128fSAndroid Build Coastguard Workerdnl (__asm__ redirection doesn't work for some mysterious reason.  Looks like
1721*6a54128fSAndroid Build Coastguard Workerdnl Apple hacked gcc somehow?)
1722*6a54128fSAndroid Build Coastguard Workerdnl
1723*6a54128fSAndroid Build Coastguard Workercase "$host_os" in
1724*6a54128fSAndroid Build Coastguard Workerdarwin*)
1725*6a54128fSAndroid Build Coastguard Worker	AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
1726*6a54128fSAndroid Build Coastguard Worker	AC_DEFINE(_INTL_REDIRECT_MACROS, 1,
1727*6a54128fSAndroid Build Coastguard Worker		[Define to 1 if Apple Darwin libintl workaround is needed])
1728*6a54128fSAndroid Build Coastguard Worker	;;
1729*6a54128fSAndroid Build Coastguard Workeresac
1730*6a54128fSAndroid Build Coastguard Workerdnl
1731*6a54128fSAndroid Build Coastguard Workerdnl Only try to run the test suite if we're not cross compiling.
1732*6a54128fSAndroid Build Coastguard Workerdnl
1733*6a54128fSAndroid Build Coastguard Workerif test "$cross_compiling" = yes ; then
1734*6a54128fSAndroid Build Coastguard Worker  DO_TEST_SUITE=
1735*6a54128fSAndroid Build Coastguard Workerelse
1736*6a54128fSAndroid Build Coastguard Worker  DO_TEST_SUITE=check
1737*6a54128fSAndroid Build Coastguard Workerfi
1738*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(DO_TEST_SUITE)
1739*6a54128fSAndroid Build Coastguard Workerdnl
1740*6a54128fSAndroid Build Coastguard Workerdnl Only include the intl include files if we're building with them
1741*6a54128fSAndroid Build Coastguard Workerdnl
1742*6a54128fSAndroid Build Coastguard WorkerINCLUDES='-I. -I$(top_builddir)/lib -I$(top_srcdir)/lib'
1743*6a54128fSAndroid Build Coastguard Workerif test -n "$CPPFLAGS" ; then
1744*6a54128fSAndroid Build Coastguard Worker	INCLUDES="$INCLUDES $CPPFLAGS"
1745*6a54128fSAndroid Build Coastguard Workerfi
1746*6a54128fSAndroid Build Coastguard Workerif test "$USE_INCLUDED_LIBINTL" = "yes" ; then
1747*6a54128fSAndroid Build Coastguard Worker	INCLUDES=$INCLUDES' -I$(top_builddir)/intl -I$(top_srcdir)/intl'
1748*6a54128fSAndroid Build Coastguard Workerfi
1749*6a54128fSAndroid Build Coastguard Workerif test -n "$WITH_DIET_LIBC" ; then
1750*6a54128fSAndroid Build Coastguard Worker	INCLUDES="$INCLUDES -D_REENTRANT"
1751*6a54128fSAndroid Build Coastguard Workerfi
1752*6a54128fSAndroid Build Coastguard Workercase "$host_os" in
1753*6a54128fSAndroid Build Coastguard Workermingw*)
1754*6a54128fSAndroid Build Coastguard Worker	INCLUDES=$INCLUDES' -I$(top_srcdir)/include/mingw'
1755*6a54128fSAndroid Build Coastguard Worker	;;
1756*6a54128fSAndroid Build Coastguard Workeresac
1757*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(INCLUDES)
1758*6a54128fSAndroid Build Coastguard Workerdnl
1759*6a54128fSAndroid Build Coastguard Workerdnl Build CFLAGS
1760*6a54128fSAndroid Build Coastguard Workerdnl
1761*6a54128fSAndroid Build Coastguard Workerif test $cross_compiling = no; then
1762*6a54128fSAndroid Build Coastguard Worker   BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
1763*6a54128fSAndroid Build Coastguard Worker   BUILD_LDFLAGS="$LDFLAGS"
1764*6a54128fSAndroid Build Coastguard Workerfi
1765*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(BUILD_CFLAGS)
1766*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(BUILD_LDFLAGS)
1767*6a54128fSAndroid Build Coastguard Workerdnl
1768*6a54128fSAndroid Build Coastguard Workerdnl Define CFLAGS and LDFLAGS for shared libraries
1769*6a54128fSAndroid Build Coastguard Workerdnl
1770*6a54128fSAndroid Build Coastguard WorkerCFLAGS_SHLIB=${CFLAGS_SHLIB:-$CFLAGS}
1771*6a54128fSAndroid Build Coastguard WorkerCFLAGS_STLIB=${CFLAGS_STLIB:-$CFLAGS}
1772*6a54128fSAndroid Build Coastguard WorkerLDFLAGS_SHLIB=${LDFLAGS_SHLIB:-$LDFLAGS}
1773*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(CFLAGS_SHLIB)
1774*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(CFLAGS_STLIB)
1775*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(LDFLAGS_SHLIB)
1776*6a54128fSAndroid Build Coastguard Worker
1777*6a54128fSAndroid Build Coastguard Workerdnl
1778*6a54128fSAndroid Build Coastguard Workerdnl Where do udev rules go?
1779*6a54128fSAndroid Build Coastguard Workerdnl
1780*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([udev_rules_dir],
1781*6a54128fSAndroid Build Coastguard Worker  [AS_HELP_STRING([--with-udev-rules-dir@<:@=DIR@:>@],
1782*6a54128fSAndroid Build Coastguard Worker	[Install udev rules into DIR.])],
1783*6a54128fSAndroid Build Coastguard Worker  [],
1784*6a54128fSAndroid Build Coastguard Worker  [with_udev_rules_dir=yes])
1785*6a54128fSAndroid Build Coastguard WorkerAS_IF([test "x${with_udev_rules_dir}" != "xno"],
1786*6a54128fSAndroid Build Coastguard Worker  [
1787*6a54128fSAndroid Build Coastguard Worker	AS_IF([test "x${with_udev_rules_dir}" = "xyes"],
1788*6a54128fSAndroid Build Coastguard Worker	  [
1789*6a54128fSAndroid Build Coastguard Worker		PKG_CHECK_MODULES([udev], [udev],
1790*6a54128fSAndroid Build Coastguard Worker		  [
1791*6a54128fSAndroid Build Coastguard Worker			with_udev_rules_dir="$($PKG_CONFIG --variable=udevdir udev)/rules.d"
1792*6a54128fSAndroid Build Coastguard Worker		  ], [
1793*6a54128fSAndroid Build Coastguard Worker			with_udev_rules_dir=""
1794*6a54128fSAndroid Build Coastguard Worker		  ])
1795*6a54128fSAndroid Build Coastguard Worker	  ])
1796*6a54128fSAndroid Build Coastguard Worker	AC_MSG_CHECKING([for udev rules dir])
1797*6a54128fSAndroid Build Coastguard Worker	pkg_udev_rules_dir="${with_udev_rules_dir}"
1798*6a54128fSAndroid Build Coastguard Worker	AS_IF([test -n "${pkg_udev_rules_dir}"],
1799*6a54128fSAndroid Build Coastguard Worker	  [
1800*6a54128fSAndroid Build Coastguard Worker		AC_MSG_RESULT(${pkg_udev_rules_dir})
1801*6a54128fSAndroid Build Coastguard Worker		have_udev="yes"
1802*6a54128fSAndroid Build Coastguard Worker	  ],
1803*6a54128fSAndroid Build Coastguard Worker	  [
1804*6a54128fSAndroid Build Coastguard Worker		AC_MSG_RESULT(no)
1805*6a54128fSAndroid Build Coastguard Worker		have_udev="no"
1806*6a54128fSAndroid Build Coastguard Worker	  ])
1807*6a54128fSAndroid Build Coastguard Worker  ],
1808*6a54128fSAndroid Build Coastguard Worker  [
1809*6a54128fSAndroid Build Coastguard Worker	have_udev="disabled"
1810*6a54128fSAndroid Build Coastguard Worker  ])
1811*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(have_udev)
1812*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(pkg_udev_rules_dir)
1813*6a54128fSAndroid Build Coastguard Worker
1814*6a54128fSAndroid Build Coastguard Workerdnl
1815*6a54128fSAndroid Build Coastguard Workerdnl Where do cron jobs go?
1816*6a54128fSAndroid Build Coastguard Workerdnl
1817*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([crond_dir],
1818*6a54128fSAndroid Build Coastguard Worker  [AS_HELP_STRING([--with-crond-dir@<:@=DIR@:>@],
1819*6a54128fSAndroid Build Coastguard Worker	[Install system crontabs into DIR.])],
1820*6a54128fSAndroid Build Coastguard Worker  [],
1821*6a54128fSAndroid Build Coastguard Worker  [with_crond_dir=yes])
1822*6a54128fSAndroid Build Coastguard WorkerAS_IF([test "x${with_crond_dir}" != "xno"],
1823*6a54128fSAndroid Build Coastguard Worker  [
1824*6a54128fSAndroid Build Coastguard Worker	AS_IF([test "x${with_crond_dir}" = "xyes"],
1825*6a54128fSAndroid Build Coastguard Worker	  [
1826*6a54128fSAndroid Build Coastguard Worker		AS_IF([test -d "/etc/cron.d"],
1827*6a54128fSAndroid Build Coastguard Worker		  [with_crond_dir="/etc/cron.d"],
1828*6a54128fSAndroid Build Coastguard Worker		  [have_crond="no"; with_crond_dir=""])
1829*6a54128fSAndroid Build Coastguard Worker	  ])
1830*6a54128fSAndroid Build Coastguard Worker	AC_MSG_CHECKING([for system crontab dir])
1831*6a54128fSAndroid Build Coastguard Worker	crond_dir="${with_crond_dir}"
1832*6a54128fSAndroid Build Coastguard Worker	AS_IF([test -n "${crond_dir}"],
1833*6a54128fSAndroid Build Coastguard Worker	  [
1834*6a54128fSAndroid Build Coastguard Worker		AC_MSG_RESULT(${crond_dir})
1835*6a54128fSAndroid Build Coastguard Worker		have_crond="yes"
1836*6a54128fSAndroid Build Coastguard Worker	  ],
1837*6a54128fSAndroid Build Coastguard Worker	  [
1838*6a54128fSAndroid Build Coastguard Worker		AC_MSG_RESULT(no)
1839*6a54128fSAndroid Build Coastguard Worker		have_crond="no"
1840*6a54128fSAndroid Build Coastguard Worker	  ])
1841*6a54128fSAndroid Build Coastguard Worker  ],
1842*6a54128fSAndroid Build Coastguard Worker  [
1843*6a54128fSAndroid Build Coastguard Worker	have_crond="disabled"
1844*6a54128fSAndroid Build Coastguard Worker  ])
1845*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(have_crond)
1846*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(crond_dir)
1847*6a54128fSAndroid Build Coastguard Worker
1848*6a54128fSAndroid Build Coastguard Workerdnl
1849*6a54128fSAndroid Build Coastguard Workerdnl Where do systemd services go?
1850*6a54128fSAndroid Build Coastguard Workerdnl
1851*6a54128fSAndroid Build Coastguard WorkerAC_ARG_WITH([systemd_unit_dir],
1852*6a54128fSAndroid Build Coastguard Worker  [AS_HELP_STRING([--with-systemd-unit-dir@<:@=DIR@:>@],
1853*6a54128fSAndroid Build Coastguard Worker	[Install systemd system units into DIR.])],
1854*6a54128fSAndroid Build Coastguard Worker  [],
1855*6a54128fSAndroid Build Coastguard Worker  [with_systemd_unit_dir=yes])
1856*6a54128fSAndroid Build Coastguard WorkerAS_IF([test "x${with_systemd_unit_dir}" != "xno"],
1857*6a54128fSAndroid Build Coastguard Worker  [
1858*6a54128fSAndroid Build Coastguard Worker	AS_IF([test "x${with_systemd_unit_dir}" = "xyes"],
1859*6a54128fSAndroid Build Coastguard Worker	  [
1860*6a54128fSAndroid Build Coastguard Worker		PKG_CHECK_MODULES([systemd], [systemd],
1861*6a54128fSAndroid Build Coastguard Worker		  [
1862*6a54128fSAndroid Build Coastguard Worker			with_systemd_unit_dir="$($PKG_CONFIG --variable=systemdsystemunitdir systemd)"
1863*6a54128fSAndroid Build Coastguard Worker		  ], [
1864*6a54128fSAndroid Build Coastguard Worker			with_systemd_unit_dir=""
1865*6a54128fSAndroid Build Coastguard Worker		  ])
1866*6a54128fSAndroid Build Coastguard Worker		m4_pattern_allow([^PKG_(MAJOR|MINOR|BUILD|REVISION)$])
1867*6a54128fSAndroid Build Coastguard Worker	  ])
1868*6a54128fSAndroid Build Coastguard Worker	AC_MSG_CHECKING([for systemd system unit dir])
1869*6a54128fSAndroid Build Coastguard Worker	systemd_system_unit_dir="${with_systemd_unit_dir}"
1870*6a54128fSAndroid Build Coastguard Worker	AS_IF([test -n "${systemd_system_unit_dir}"],
1871*6a54128fSAndroid Build Coastguard Worker	  [
1872*6a54128fSAndroid Build Coastguard Worker		AC_MSG_RESULT(${systemd_system_unit_dir})
1873*6a54128fSAndroid Build Coastguard Worker		have_systemd="yes"
1874*6a54128fSAndroid Build Coastguard Worker	  ],
1875*6a54128fSAndroid Build Coastguard Worker	  [
1876*6a54128fSAndroid Build Coastguard Worker		AC_MSG_RESULT(no)
1877*6a54128fSAndroid Build Coastguard Worker		have_systemd="no"
1878*6a54128fSAndroid Build Coastguard Worker	  ])
1879*6a54128fSAndroid Build Coastguard Worker  ],
1880*6a54128fSAndroid Build Coastguard Worker  [
1881*6a54128fSAndroid Build Coastguard Worker	have_systemd="disabled"
1882*6a54128fSAndroid Build Coastguard Worker  ])
1883*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(have_systemd)
1884*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(systemd_system_unit_dir)
1885*6a54128fSAndroid Build Coastguard Workerdnl Adjust the compiled files if we are on windows vs everywhere else
1886*6a54128fSAndroid Build Coastguard Workerdnl
1887*6a54128fSAndroid Build Coastguard WorkerOS_IO_FILE=""
1888*6a54128fSAndroid Build Coastguard Worker[case "$host_os" in
1889*6a54128fSAndroid Build Coastguard Worker  mingw*)
1890*6a54128fSAndroid Build Coastguard Worker    OS_IO_FILE=windows_io
1891*6a54128fSAndroid Build Coastguard Worker  ;;
1892*6a54128fSAndroid Build Coastguard Worker  *)
1893*6a54128fSAndroid Build Coastguard Worker    OS_IO_FILE=unix_io
1894*6a54128fSAndroid Build Coastguard Worker  ;;
1895*6a54128fSAndroid Build Coastguard Workeresac]
1896*6a54128fSAndroid Build Coastguard WorkerAC_SUBST(OS_IO_FILE)
1897*6a54128fSAndroid Build Coastguard Worker
1898*6a54128fSAndroid Build Coastguard WorkerAC_SYS_LARGEFILE
1899*6a54128fSAndroid Build Coastguard Worker
1900*6a54128fSAndroid Build Coastguard Workerdnl
1901*6a54128fSAndroid Build Coastguard Workerdnl Make our output files, being sure that we create the some miscellaneous
1902*6a54128fSAndroid Build Coastguard Workerdnl directories
1903*6a54128fSAndroid Build Coastguard Workerdnl
1904*6a54128fSAndroid Build Coastguard Workertest -d lib || mkdir lib
1905*6a54128fSAndroid Build Coastguard Workertest -d include || mkdir include
1906*6a54128fSAndroid Build Coastguard Workertest -d include/linux || mkdir include/linux
1907*6a54128fSAndroid Build Coastguard Workertest -d include/asm || mkdir include/asm
1908*6a54128fSAndroid Build Coastguard Workerif test -z "$UUID_CMT" ; then
1909*6a54128fSAndroid Build Coastguard Worker	uuid_out_list="lib/uuid/Makefile lib/uuid/uuid.pc \
1910*6a54128fSAndroid Build Coastguard Worker		lib/uuid/uuid_types.h"
1911*6a54128fSAndroid Build Coastguard Workerfi
1912*6a54128fSAndroid Build Coastguard Workerif test -z "$BLKID_CMT" ; then
1913*6a54128fSAndroid Build Coastguard Worker	blkid_out_list="lib/blkid/Makefile lib/blkid/blkid.pc \
1914*6a54128fSAndroid Build Coastguard Worker		lib/blkid/blkid_types.h"
1915*6a54128fSAndroid Build Coastguard Workerfi
1916*6a54128fSAndroid Build Coastguard Workerfor i in MCONFIG Makefile \
1917*6a54128fSAndroid Build Coastguard Worker	util/Makefile util/subst.conf util/gen-tarball util/install-symlink \
1918*6a54128fSAndroid Build Coastguard Worker	lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
1919*6a54128fSAndroid Build Coastguard Worker	lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
1920*6a54128fSAndroid Build Coastguard Worker	$uuid_out_list $blkid_out_list lib/support/Makefile \
1921*6a54128fSAndroid Build Coastguard Worker	lib/ss/ss.pc lib/et/com_err.pc lib/e2p/e2p.pc lib/ext2fs/ext2fs.pc \
1922*6a54128fSAndroid Build Coastguard Worker	misc/Makefile ext2ed/Makefile e2fsck/Makefile \
1923*6a54128fSAndroid Build Coastguard Worker	debugfs/Makefile tests/Makefile tests/progs/Makefile \
1924*6a54128fSAndroid Build Coastguard Worker	tests/fuzz/Makefile resize/Makefile doc/Makefile \
1925*6a54128fSAndroid Build Coastguard Worker	po/Makefile.in scrub/Makefile; do
1926*6a54128fSAndroid Build Coastguard Worker	if test -d `dirname ${srcdir}/$i` ; then
1927*6a54128fSAndroid Build Coastguard Worker		outlist="$outlist $i"
1928*6a54128fSAndroid Build Coastguard Worker	fi
1929*6a54128fSAndroid Build Coastguard Workerdone
1930*6a54128fSAndroid Build Coastguard WorkerAC_CONFIG_FILES([$outlist])
1931*6a54128fSAndroid Build Coastguard WorkerAC_OUTPUT
1932*6a54128fSAndroid Build Coastguard Workerif test -f util/gen-tarball; then chmod +x util/gen-tarball; fi
1933