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