blob: 38a3cd876cb51e0a23a84f3bc27995ec37fdbea8 [file] [log] [blame]
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001AC_INIT(version.h)
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +00002AC_PREREQ(2.12)
Theodore Ts'o50e1e101997-04-26 13:58:21 +00003MCONFIG=./MCONFIG
4AC_SUBST_FILE(MCONFIG)
Theodore Ts'o74becf31997-04-26 14:37:06 +00005BINARY_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
Theodore Ts'o40fa8cc1999-01-09 05:06:02 +000016if expr $YEAR ">" 1900 > /dev/null ; then
17 E2FSPROGS_YEAR=$YEAR
18elif expr $YEAR ">" 90 >/dev/null ; then
Theodore Ts'o74becf31997-04-26 14:37:06 +000019 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)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +000046AC_REQUIRE([AC_CANONICAL_HOST])
Theodore Ts'o74becf31997-04-26 14:37:06 +000047dnl
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])
Theodore Ts'o73ae2d42000-02-02 16:13:14 +000058AC_PROG_CC
Theodore Ts'o74becf31997-04-26 14:37:06 +000059dnl
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)
76CCOPTS=$withval
77CFLAGS="$CFLAGS $withval",
78CCOPTS=)dnl
79AC_SUBST(CCOPTS)
80dnl
Theodore Ts'of8bd9801999-10-26 04:19:45 +000081dnl On systems without linux header files, we add an extra include directory
82dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
83dnl is quoted so that it gets expanded by make, not by configure.
84dnl
85AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
Theodore Ts'o73ae2d42000-02-02 16:13:14 +000086if test "$linux_headers" != yes; then
87 LINUX_INCLUDE='-I$(top_builddir)/include'
Theodore Ts'of8bd9801999-10-26 04:19:45 +000088fi
89AC_SUBST(LINUX_INCLUDE)
90dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +000091dnl Set default values for library extentions. Will be dealt with after
92dnl parsing configuration opions, which may modify these
93dnl
94LIB_EXT=.a
95STATIC_LIB_EXT=.a
96PROFILE_LIB_EXT=.a
97dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +000098dnl set $(LDFLAGS) from --with-ldopts=value
99dnl
100AC_ARG_WITH([ldopts],
101[ --with-ldopts=LDOPTS select linker command line options],
102AC_MSG_RESULT(LDFLAGS is $withval)
103LDFLAGS=$withval,
104LDFLAGS=)dnl
105AC_SUBST(LDFLAGS)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000106dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000107dnl Allow separate `root_prefix' to be specified
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000108dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000109AC_ARG_WITH([root-prefix],
110[ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
111root_prefix=$withval,
112root_prefix=NONE)dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000113dnl
Theodore Ts'o19178752000-02-11 15:55:07 +0000114dnl handle --enable-compression
115dnl
116AC_ARG_ENABLE([compression],
117[ --enable-compression enable EXPERIMENTAL compression support],
118if test "$enableval" = "no"
119then
120 echo "Disabling compression support"
121else
122 AC_DEFINE(ENABLE_COMPRESSION)
123 echo "Enabling compression support"
124 echo "WARNING: Compression support is experimental"
125fi
126,
127echo "Disabling compression support by default"
128)
129dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000130dnl handle --enable-dll-shlibs
131dnl
132AC_ARG_ENABLE([dll-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000133[ --enable-dll-shlibs select DLL libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000134if test "$enableval" = "no"
135then
136 DLL_CMT=#
137 MAKEFILE_DLL=/dev/null
138 echo "Disabling DLL shared libraries"
139else
140 DLL_CMT=
141 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
Theodore Ts'o74becf31997-04-26 14:37:06 +0000142 BINARY_TYPE=dllbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000143 LIB_EXT=.sa
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000144 echo "Enabling DLL shared libraries"
145fi
146,
147MAKEFILE_DLL=/dev/null
148DLL_CMT=#
149echo "Disabling DLL shared libraries by default"
150)
151AC_SUBST(DLL_CMT)
152AC_SUBST_FILE(MAKEFILE_DLL)
153dnl
154dnl handle --enable-elf-shlibs
155dnl
156AC_ARG_ENABLE([elf-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000157[ --enable-elf-shlibs select ELF shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000158if test "$enableval" = "no"
159then
160 ELF_CMT=#
161 MAKEFILE_ELF=/dev/null
162 echo "Disabling ELF shared libraries"
163else
164 ELF_CMT=
165 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
Theodore Ts'of5955dd2000-10-25 02:38:39 +0000166 [case "$host_os" in
167 solaris2.*)
168 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
169 ;;
170 esac]
Theodore Ts'o74becf31997-04-26 14:37:06 +0000171 BINARY_TYPE=elfbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000172 LIB_EXT=.so
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000173 echo "Enabling ELF shared libraries"
174fi
175,
176MAKEFILE_ELF=/dev/null
177ELF_CMT=#
178echo "Disabling ELF shared libraries by default"
179)
180AC_SUBST(ELF_CMT)
181AC_SUBST_FILE(MAKEFILE_ELF)
182dnl
183dnl handle --enable-bsd-shlibs
184dnl
185AC_ARG_ENABLE([bsd-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000186[ --enable-bsd-shlibs select BSD shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000187if test "$enableval" = "no"
188then
189 BSDLIB_CMT=#
190 MAKEFILE_BSDLIB=/dev/null
191 echo "Disabling BSD shared libraries"
192else
193 BSDLIB_CMT=
194 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000195 LIB_EXT=.so
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000196 echo "Enabling BSD shared libraries"
197fi
198,
199MAKEFILE_BSDLIB=/dev/null
200BSDLIB_CMT=#
201echo "Disabling BSD shared libraries by default"
202)
203AC_SUBST(BSDLIB_CMT)
204AC_SUBST_FILE(MAKEFILE_BSDLIB)
205dnl
Theodore Ts'o80bfaa32000-08-18 15:08:37 +0000206dnl handle --enable-jfs-debug
207dnl
208AC_ARG_ENABLE([jfs-debug],
209[ --enable-jfs-debug enable journal debugging],
210if test "$enableval" = "no"
211then
212 echo "Disabling journal debugging"
213else
214 AC_DEFINE(JFS_DEBUG)
215 echo "Enabling journal debugging"
216fi
217,
218echo "Disabling journal debugging by default"
219)
220dnl
Theodore Ts'oa64c9c12000-02-08 20:17:21 +0000221dnl Add internationalization support, using gettext.
222dnl
223PACKAGE=e2fsprogs
224VERSION="$E2FSPROGS_VERSION"
225AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
226AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
227AC_SUBST(PACKAGE)
228AC_SUBST(VERSION)
229
Theodore Ts'o19178752000-02-11 15:55:07 +0000230ALL_LINGUAS="it nyc"
Theodore Ts'oa64c9c12000-02-08 20:17:21 +0000231AM_GNU_GETTEXT
232dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000233dnl handle --enable-profile
234dnl
235AC_ARG_ENABLE([profile],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000236[ --enable-profile build profiling libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000237if test "$enableval" = "no"
238then
239 PROFILE_CMT=#
240 MAKEFILE_PROFILE=/dev/null
241 echo "Disabling profiling libraries"
242else
243 PROFILE_CMT=
244 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000245 PROFILED_LIB_EXT=_p.a
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000246 echo "Building profiling libraries"
247fi
248,
249PROFILE_CMT=#
250MAKEFILE_PROFILE=/dev/null
251echo "Disabling profiling libraries by default"
252)
253AC_SUBST(PROFILE_CMT)
254AC_SUBST_FILE(MAKEFILE_PROFILE)
255dnl
256dnl handle --enable-checker
257dnl
258AC_ARG_ENABLE([checker],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000259[ --enable-checker build checker libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000260if test "$enableval" = "no"
261then
262 CHECKER_CMT=#
263 MAKEFILE_CHECKER=/dev/null
264 echo "Disabling checker libraries"
265else
266 CHECKER_CMT=
267 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
268 echo "Building checker libraries"
269fi
270,
271CHECKER_CMT=#
272MAKEFILE_CHECKER=/dev/null
273echo "Disabling checker libraries by default"
274)
275AC_SUBST(CHECKER_CMT)
276AC_SUBST_FILE(MAKEFILE_CHECKER)
277dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000278dnl Substitute library extensions
279dnl
280AC_SUBST(LIB_EXT)
281AC_SUBST(STATIC_LIB_EXT)
282AC_SUBST(PROFILED_LIB_EXT)
283dnl
Theodore Ts'o4d0f3e12001-01-11 15:48:50 +0000284dnl handle --enable-dynamic-e2fsck
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000285dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000286AC_ARG_ENABLE([dynamic-e2fsck],
287[ --enable-dynamic-e2fsck build e2fsck dynamically],
288if test "$enableval" = "no"
289then
290 E2FSCK_TYPE=static
291 echo "Building e2fsck statically"
292else
293 E2FSCK_TYPE=shared
294 echo "Building e2fsck dynamically"
295fi
296,
297E2FSCK_TYPE=static
298echo "Building e2fsck statically by default"
299)
300AC_SUBST(E2FSCK_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000301dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000302dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
303dnl
304AC_ARG_ENABLE([fsck],
305[ --enable-fsck build fsck wrapper program],
306[if test "$enableval" = "no"
307then
308 FSCK_PROG='' FSCK_MAN=''
309 echo "Not building fsck wrapper"
310else
311 FSCK_PROG=fsck FSCK_MAN=fsck.8
312 echo "Building fsck wrapper"
313fi]
314,
315[case "$host_os" in
316 gnu*)
317 FSCK_PROG='' FSCK_MAN=''
318 echo "Not building fsck wrapper by default"
319 ;;
320 *)
321 FSCK_PROG=fsck FSCK_MAN=fsck.8
322 echo "Building fsck wrapper by default"
323esac]
324)
325AC_SUBST(FSCK_PROG)
326AC_SUBST(FSCK_MAN)
327dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000328dnl
329MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
330AC_SUBST_FILE(MAKEFILE_LIBRARY)
331dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000332dnl
333AC_ARG_ENABLE([old-bitops],
334[ --enable-old-bitops Use old (non-standard but native) bitmask operations],
335if test "$enableval" = "no"
336then
337 echo "Using new (standard) bitmask operations"
338else
339 AC_DEFINE(EXT2_OLD_BITOPS)
340 echo "Using old (native) bitmask operations"
341
342fi
343,
344echo "Using standard bitmask operations by default"
345)
346dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000347dnl End of configuration options
348dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000349AC_SUBST(BINARY_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000350AC_PROG_MAKE_SET
351AC_PATH_PROG(LN, ln, ln)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000352AC_PROG_LN_S
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000353AC_PATH_PROG(MV, mv, mv)
354AC_PATH_PROG(CP, cp, cp)
355AC_PATH_PROG(RM, rm, rm)
356AC_PATH_PROG(CHMOD, chmod, :)
357AC_PATH_PROG(AWK, awk, awk)
358AC_PATH_PROG(SED, sed, sed)
Theodore Ts'o9d564f71999-07-03 20:25:58 +0000359AC_PATH_PROG(PERL, perl, perl)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000360AC_CHECK_TOOL(AR, ar, ar)
361AC_CHECK_TOOL(RANLIB, ranlib, :)
362AC_CHECK_TOOL(STRIP, strip, :)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000363AC_PROG_INSTALL
Theodore Ts'o6c133521999-07-03 20:37:03 +0000364# See if we need a separate native compiler.
365if test $cross_compiling = no; then
366 BUILD_CC="$CC"
367 AC_SUBST(BUILD_CC)
368else
369 AC_CHECK_PROGS(BUILD_CC, gcc cc)
370fi
Theodore Ts'o4d0f3e12001-01-11 15:48:50 +0000371AC_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)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000372AC_FUNC_VPRINTF
373dnl
374dnl See if struct dirent has a d_namlen field (like bsd systems), implying
375dnl that the actual length of the structure may be grater than the declared
376dnl length.
377dnl
378AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
379AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
380 AC_TRY_COMPILE(
381[#include <sys/types.h>
382#include <dirent.h>],
383 [struct dirent de; de.d_namlen = 0;],
384 [e2fsprogs_cv_struct_d_namlen=yes],
385 [e2fsprogs_cv_struct_d_namlen=no]))
386AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
387if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
388 AC_DEFINE(HAVE_DIRENT_NAMLEN)
389fi
390dnl
Theodore Ts'ob0b9c4d1997-10-20 23:36:30 +0000391dnl Check to see if llseek() is declared in unistd.h. On some libc's
392dnl it is, and on others it isn't..... Thank you glibc developers....
393dnl
394dnl Warning! Use of --enable-gcc-wall may throw off this test.
395dnl
396dnl
397AC_MSG_CHECKING(whether llseek declared in unistd.h)
398AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
399 AC_TRY_COMPILE(
400[#include <unistd.h>], [extern int llseek(int);],
401 [e2fsprogs_cv_have_llseek_prototype=no],
402 [e2fsprogs_cv_have_llseek_prototype=yes]))
403AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
404if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
405 AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
406fi
407dnl
Theodore Ts'o6928adc2000-05-25 23:28:50 +0000408dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
409dnl are so convoluted that I can't tell whether it will always be defined,
410dnl and if it isn't defined while lseek64 is defined in the library,
411dnl disaster will strike.
412dnl
413dnl Warning! Use of --enable-gcc-wall may throw off this test.
414dnl
415dnl
416AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
417AC_CACHE_VAL(e2fsprogs_cv_have_lseek64_prototype,
418 AC_TRY_COMPILE(
419[#define _LARGEFILE_SOURCE
420#define _LARGEFILE64_SOURCE
421#include <unistd.h>], [extern int lseek64(int);],
422 [e2fsprogs_cv_have_lseek64_prototype=no],
423 [e2fsprogs_cv_have_lseek64_prototype=yes]))
424AC_MSG_RESULT($e2fsprogs_cv_have_lseek64_prototype)
425if test "$e2fsprogs_cv_have_lseek64_prototype" = yes; then
426 AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)
427fi
428dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000429dnl Word sizes...
430dnl
431if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
432 # if cross-compiling, with no cached values, just assume something common.
433 ac_cv_sizeof_short=2
434 ac_cv_sizeof_int=4
435 ac_cv_sizeof_long=4
Theodore Ts'o6c133521999-07-03 20:37:03 +0000436 ac_cv_sizeof_long_long=8
437 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4, long long=8])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000438fi
439AC_CHECK_SIZEOF(short)
440AC_CHECK_SIZEOF(int)
441AC_CHECK_SIZEOF(long)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000442AC_CHECK_SIZEOF(long long)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000443SIZEOF_SHORT=$ac_cv_sizeof_short
444SIZEOF_INT=$ac_cv_sizeof_int
445SIZEOF_LONG=$ac_cv_sizeof_long
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000446SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000447AC_SUBST(SIZEOF_SHORT)
448AC_SUBST(SIZEOF_INT)
449AC_SUBST(SIZEOF_LONG)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000450AC_SUBST(SIZEOF_LONG_LONG)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000451dnl
452dnl See if struct stat has a st_flags field, in which case we can get file
453dnl flags somewhat portably. Also check for the analogous setter, chflags().
454dnl
455AC_MSG_CHECKING(whether struct stat has a st_flags field)
456AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
457 AC_TRY_COMPILE([#include <sys/stat.h>],
458 [struct stat stat; stat.st_flags = 0;],
459 [e2fsprogs_cv_struct_st_flags=yes],
460 [e2fsprogs_cv_struct_st_flags=no]))
461AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
462if test "$e2fsprogs_cv_struct_st_flags" = yes; then
Theodore Ts'oc03bc4e1999-10-20 18:20:36 +0000463 AC_MSG_CHECKING(whether st_flags field is useful)
464 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
465 AC_TRY_COMPILE([#include <sys/stat.h>],
466 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
467 [e2fsprogs_cv_struct_st_flags_immut=yes],
468 [e2fsprogs_cv_struct_st_flags_immut=no]))
469 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
470 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
471 AC_DEFINE(HAVE_STAT_FLAGS)
472 fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000473fi
Theodore Ts'o6928adc2000-05-25 23:28:50 +0000474AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 strdup getmntinfo strcasecmp srandom fchown mallinfo fdatasync)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000475dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000476dnl Check to see if -lsocket is required (solaris) to make something
477dnl that uses socket() to compile; this is needed for the UUID library
478dnl
479SOCKET_LIB=''
480AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
481AC_SUBST(SOCKET_LIB)
482dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000483dnl See if optreset exists
484dnl
485AC_MSG_CHECKING(for optreset)
486AC_CACHE_VAL(ac_cv_have_optreset,
487[AC_EGREP_HEADER(optreset, unistd.h,
488 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
489AC_MSG_RESULT($ac_cv_have_optreset)
490if test $ac_cv_have_optreset = yes; then
491 AC_DEFINE(HAVE_OPTRESET)
492fi
493dnl
Theodore Ts'o8f3f29d2000-02-11 05:04:44 +0000494dnl We use the EXT2 ioctls only under Linux
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000495dnl
Theodore Ts'o8f3f29d2000-02-11 05:04:44 +0000496case "$host_os" in
497linux*)
498 AC_DEFINE(HAVE_EXT2_IOCTLS)
499 ;;
500esac
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000501dnl
Theodore Ts'o6c133521999-07-03 20:37:03 +0000502dnl Linux and Hurd places root files in the / by default
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000503dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000504case "$host_os" in
Theodore Ts'o6c133521999-07-03 20:37:03 +0000505linux* | gnu*)
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000506 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
507 root_prefix="";
508 echo "On $host_os systems, root_prefix defaults to ''"
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000509 fi
510 ;;
511esac
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000512dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000513dnl On Linux/hurd, force the prefix to be /usr
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000514dnl
515case "$host_os" in
516linux* | gnu*)
517 if test "$prefix" = NONE ; then
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000518 prefix="/usr";
519 echo "On $host_os systems, prefix defaults to /usr"
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000520 fi
521;;
522esac
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000523if test "$root_prefix" = NONE ; then
Theodore Ts'offe19911998-04-08 06:05:49 +0000524 if test "$prefix" = NONE ; then
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000525 root_prefix="$ac_default_prefix"
526 else
527 root_prefix="$prefix"
528 fi
529fi
530AC_SUBST(root_prefix)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000531dnl
532dnl See if -static works.
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000533dnl
Theodore Ts'oae851481997-04-29 18:13:24 +0000534AC_MSG_CHECKING([whether linker accepts -static])
535AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
536[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
537AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
538 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
539LDFLAGS=$SAVE_LDFLAGS])
Theodore Ts'odefde781999-01-04 07:39:19 +0000540dnl
541dnl Regardless of how the test turns out, Solaris doesn't handle -static
542dnl This is caused by the socket library requiring the nsl library, which
543dnl requires the -dl library, which only works for dynamically linked
544dnl programs. It basically means you can't have statically linked programs
545dnl which use the network under Solaris.
546dnl
547case "$host_os" in
548solaris2.*)
549 ac_cv_e2fsprogs_use_static=no
550;;
551esac
Theodore Ts'oae851481997-04-29 18:13:24 +0000552AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
Theodore Ts'o74becf31997-04-26 14:37:06 +0000553LDFLAG_STATIC=
Theodore Ts'oae851481997-04-29 18:13:24 +0000554if test $ac_cv_e2fsprogs_use_static = yes; then
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000555 LDFLAG_STATIC=-static
Theodore Ts'oae851481997-04-29 18:13:24 +0000556fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000557AC_SUBST(LDFLAG_STATIC)
558dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000559dnl Make the ss and et directories work correctly.
560dnl
561SS_DIR=`cd ${srcdir}/lib/ss; pwd`
562ET_DIR=`cd ${srcdir}/lib/et; pwd`
563AC_SUBST(SS_DIR)
564AC_SUBST(ET_DIR)
565dnl
566dnl Only try to run the test suite if we're not cross compiling.
567dnl
568if test "$cross_compiling" = yes ; then
569 DO_TEST_SUITE=
570else
571 DO_TEST_SUITE=check
572fi
573AC_SUBST(DO_TEST_SUITE)
574dnl
575dnl Make our output files, being sure that we create the some miscellaneous
576dnl directories
577dnl
578test -d lib || mkdir lib
579test -d include || mkdir include
580test -d include/linux || mkdir include/linux
Theodore Ts'odefde781999-01-04 07:39:19 +0000581test -d include/asm || mkdir include/asm
Theodore Ts'o24b2c7a1997-06-07 20:42:58 +0000582rmakefile=
583if test -d ${srcdir}/resize ; then
584 rmakefile=resize/Makefile
585fi
Theodore Ts'o44339bd1997-10-15 02:47:20 +0000586AC_OUTPUT(MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000587 lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile
588 misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile
Theodore Ts'oa64c9c12000-02-08 20:17:21 +0000589 tests/progs/Makefile $rmakefile doc/Makefile
590 intl/Makefile po/Makefile.in)