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