blob: 3f022e44152f00bfbaa457eccd37fceb80c1ac1e [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])
58dnl
59dnl set $(LD) from --with-linker=value
60dnl
61AC_ARG_WITH([linker],
62[ --with-linker=LINKER select linker to use],
63AC_MSG_RESULT(LD=$withval)
64LD=$withval,
65if test -z "$LD" ; then LD=$CC; fi
66[AC_MSG_RESULT(LD defaults to $LD)])dnl
67export LD
68AC_SUBST([LD])
69dnl
70dnl set $(CCOPTS) from --with-ccopts=value
71dnl
72AC_ARG_WITH([ccopts],
73[ --with-ccopts=CCOPTS select compiler command line options],
74AC_MSG_RESULT(CCOPTS is $withval)
75CCOPTS=$withval
76CFLAGS="$CFLAGS $withval",
77CCOPTS=)dnl
78AC_SUBST(CCOPTS)
79dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +000080dnl Set default values for library extentions. Will be dealt with after
81dnl parsing configuration opions, which may modify these
82dnl
83LIB_EXT=.a
84STATIC_LIB_EXT=.a
85PROFILE_LIB_EXT=.a
86dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +000087dnl set $(LDFLAGS) from --with-ldopts=value
88dnl
89AC_ARG_WITH([ldopts],
90[ --with-ldopts=LDOPTS select linker command line options],
91AC_MSG_RESULT(LDFLAGS is $withval)
92LDFLAGS=$withval,
93LDFLAGS=)dnl
94AC_SUBST(LDFLAGS)
Theodore Ts'o50e1e101997-04-26 13:58:21 +000095dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +000096dnl Allow separate `root_prefix' to be specified
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +000097dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +000098AC_ARG_WITH([root-prefix],
99[ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
100root_prefix=$withval,
101root_prefix=NONE)dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000102dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000103dnl handle --enable-dll-shlibs
104dnl
105AC_ARG_ENABLE([dll-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000106[ --enable-dll-shlibs select DLL libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000107if test "$enableval" = "no"
108then
109 DLL_CMT=#
110 MAKEFILE_DLL=/dev/null
111 echo "Disabling DLL shared libraries"
112else
113 DLL_CMT=
114 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
Theodore Ts'o74becf31997-04-26 14:37:06 +0000115 BINARY_TYPE=dllbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000116 LIB_EXT=.sa
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000117 echo "Enabling DLL shared libraries"
118fi
119,
120MAKEFILE_DLL=/dev/null
121DLL_CMT=#
122echo "Disabling DLL shared libraries by default"
123)
124AC_SUBST(DLL_CMT)
125AC_SUBST_FILE(MAKEFILE_DLL)
126dnl
127dnl handle --enable-elf-shlibs
128dnl
129AC_ARG_ENABLE([elf-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000130[ --enable-elf-shlibs select ELF shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000131if test "$enableval" = "no"
132then
133 ELF_CMT=#
134 MAKEFILE_ELF=/dev/null
135 echo "Disabling ELF shared libraries"
136else
137 ELF_CMT=
138 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
Theodore Ts'o74becf31997-04-26 14:37:06 +0000139 BINARY_TYPE=elfbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000140 LIB_EXT=.so
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000141 echo "Enabling ELF shared libraries"
142fi
143,
144MAKEFILE_ELF=/dev/null
145ELF_CMT=#
146echo "Disabling ELF shared libraries by default"
147)
148AC_SUBST(ELF_CMT)
149AC_SUBST_FILE(MAKEFILE_ELF)
150dnl
151dnl handle --enable-bsd-shlibs
152dnl
153AC_ARG_ENABLE([bsd-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000154[ --enable-bsd-shlibs select BSD shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000155if test "$enableval" = "no"
156then
157 BSDLIB_CMT=#
158 MAKEFILE_BSDLIB=/dev/null
159 echo "Disabling BSD shared libraries"
160else
161 BSDLIB_CMT=
162 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000163 LIB_EXT=.so
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000164 echo "Enabling BSD shared libraries"
165fi
166,
167MAKEFILE_BSDLIB=/dev/null
168BSDLIB_CMT=#
169echo "Disabling BSD shared libraries by default"
170)
171AC_SUBST(BSDLIB_CMT)
172AC_SUBST_FILE(MAKEFILE_BSDLIB)
173dnl
174dnl handle --enable-profile
175dnl
176AC_ARG_ENABLE([profile],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000177[ --enable-profile build profiling libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000178if test "$enableval" = "no"
179then
180 PROFILE_CMT=#
181 MAKEFILE_PROFILE=/dev/null
182 echo "Disabling profiling libraries"
183else
184 PROFILE_CMT=
185 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000186 PROFILED_LIB_EXT=_p.a
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000187 echo "Building profiling libraries"
188fi
189,
190PROFILE_CMT=#
191MAKEFILE_PROFILE=/dev/null
192echo "Disabling profiling libraries by default"
193)
194AC_SUBST(PROFILE_CMT)
195AC_SUBST_FILE(MAKEFILE_PROFILE)
196dnl
197dnl handle --enable-checker
198dnl
199AC_ARG_ENABLE([checker],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000200[ --enable-checker build checker libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000201if test "$enableval" = "no"
202then
203 CHECKER_CMT=#
204 MAKEFILE_CHECKER=/dev/null
205 echo "Disabling checker libraries"
206else
207 CHECKER_CMT=
208 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
209 echo "Building checker libraries"
210fi
211,
212CHECKER_CMT=#
213MAKEFILE_CHECKER=/dev/null
214echo "Disabling checker libraries by default"
215)
216AC_SUBST(CHECKER_CMT)
217AC_SUBST_FILE(MAKEFILE_CHECKER)
218dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000219dnl Substitute library extensions
220dnl
221AC_SUBST(LIB_EXT)
222AC_SUBST(STATIC_LIB_EXT)
223AC_SUBST(PROFILED_LIB_EXT)
224dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000225dnl handle --enable-gcc-wall
226dnl
227AC_ARG_ENABLE([gcc-wall],
Theodore Ts'ob0b9c4d1997-10-20 23:36:30 +0000228[ --enable-gcc-wall enable GCC anal warnings (DON'T USE IN PRODUCTION)],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000229if test "$enableval" = "no"
230then
231 W=#
232 echo "Disabling GCC warnings"
233else
234 W=
235 echo "Enabling GCC warnings"
236fi
237,
238W=#
239echo "Disabling GCC warnings by default"
240)
241AC_SUBST(W)
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000242AC_ARG_ENABLE([dynamic-e2fsck],
243[ --enable-dynamic-e2fsck build e2fsck dynamically],
244if test "$enableval" = "no"
245then
246 E2FSCK_TYPE=static
247 echo "Building e2fsck statically"
248else
249 E2FSCK_TYPE=shared
250 echo "Building e2fsck dynamically"
251fi
252,
253E2FSCK_TYPE=static
254echo "Building e2fsck statically by default"
255)
256AC_SUBST(E2FSCK_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000257dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000258dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
259dnl
260AC_ARG_ENABLE([fsck],
261[ --enable-fsck build fsck wrapper program],
262[if test "$enableval" = "no"
263then
264 FSCK_PROG='' FSCK_MAN=''
265 echo "Not building fsck wrapper"
266else
267 FSCK_PROG=fsck FSCK_MAN=fsck.8
268 echo "Building fsck wrapper"
269fi]
270,
271[case "$host_os" in
272 gnu*)
273 FSCK_PROG='' FSCK_MAN=''
274 echo "Not building fsck wrapper by default"
275 ;;
276 *)
277 FSCK_PROG=fsck FSCK_MAN=fsck.8
278 echo "Building fsck wrapper by default"
279esac]
280)
281AC_SUBST(FSCK_PROG)
282AC_SUBST(FSCK_MAN)
283dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000284dnl
285MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
286AC_SUBST_FILE(MAKEFILE_LIBRARY)
287dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000288dnl
289AC_ARG_ENABLE([old-bitops],
290[ --enable-old-bitops Use old (non-standard but native) bitmask operations],
291if test "$enableval" = "no"
292then
293 echo "Using new (standard) bitmask operations"
294else
295 AC_DEFINE(EXT2_OLD_BITOPS)
296 echo "Using old (native) bitmask operations"
297
298fi
299,
300echo "Using standard bitmask operations by default"
301)
302dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000303dnl End of configuration options
304dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000305AC_SUBST(BINARY_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000306AC_PROG_MAKE_SET
307AC_PATH_PROG(LN, ln, ln)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000308AC_PROG_LN_S
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000309AC_PATH_PROG(MV, mv, mv)
310AC_PATH_PROG(CP, cp, cp)
311AC_PATH_PROG(RM, rm, rm)
312AC_PATH_PROG(CHMOD, chmod, :)
313AC_PATH_PROG(AWK, awk, awk)
314AC_PATH_PROG(SED, sed, sed)
Theodore Ts'o9d564f71999-07-03 20:25:58 +0000315AC_PATH_PROG(PERL, perl, perl)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000316AC_CHECK_TOOL(AR, ar, ar)
317AC_CHECK_TOOL(RANLIB, ranlib, :)
318AC_CHECK_TOOL(STRIP, strip, :)
319AC_PROG_CC
320AC_PROG_INSTALL
321AC_C_CROSS
Theodore Ts'o6c133521999-07-03 20:37:03 +0000322# See if we need a separate native compiler.
323if test $cross_compiling = no; then
324 BUILD_CC="$CC"
325 AC_SUBST(BUILD_CC)
326else
327 AC_CHECK_PROGS(BUILD_CC, gcc cc)
328fi
Theodore Ts'oc03bc4e1999-10-20 18:20:36 +0000329AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h linux/fd.h linux/major.h sys/disklabel.h sys/sockio.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000330AC_FUNC_VPRINTF
331dnl
332dnl See if struct dirent has a d_namlen field (like bsd systems), implying
333dnl that the actual length of the structure may be grater than the declared
334dnl length.
335dnl
336AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
337AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
338 AC_TRY_COMPILE(
339[#include <sys/types.h>
340#include <dirent.h>],
341 [struct dirent de; de.d_namlen = 0;],
342 [e2fsprogs_cv_struct_d_namlen=yes],
343 [e2fsprogs_cv_struct_d_namlen=no]))
344AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
345if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
346 AC_DEFINE(HAVE_DIRENT_NAMLEN)
347fi
348dnl
Theodore Ts'ob0b9c4d1997-10-20 23:36:30 +0000349dnl Check to see if llseek() is declared in unistd.h. On some libc's
350dnl it is, and on others it isn't..... Thank you glibc developers....
351dnl
352dnl Warning! Use of --enable-gcc-wall may throw off this test.
353dnl
354dnl
355AC_MSG_CHECKING(whether llseek declared in unistd.h)
356AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
357 AC_TRY_COMPILE(
358[#include <unistd.h>], [extern int llseek(int);],
359 [e2fsprogs_cv_have_llseek_prototype=no],
360 [e2fsprogs_cv_have_llseek_prototype=yes]))
361AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
362if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
363 AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
364fi
365dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000366dnl Word sizes...
367dnl
368if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
369 # if cross-compiling, with no cached values, just assume something common.
370 ac_cv_sizeof_short=2
371 ac_cv_sizeof_int=4
372 ac_cv_sizeof_long=4
Theodore Ts'o6c133521999-07-03 20:37:03 +0000373 ac_cv_sizeof_long_long=8
374 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 +0000375fi
376AC_CHECK_SIZEOF(short)
377AC_CHECK_SIZEOF(int)
378AC_CHECK_SIZEOF(long)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000379AC_CHECK_SIZEOF(long long)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000380SIZEOF_SHORT=$ac_cv_sizeof_short
381SIZEOF_INT=$ac_cv_sizeof_int
382SIZEOF_LONG=$ac_cv_sizeof_long
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000383SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000384AC_SUBST(SIZEOF_SHORT)
385AC_SUBST(SIZEOF_INT)
386AC_SUBST(SIZEOF_LONG)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000387AC_SUBST(SIZEOF_LONG_LONG)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000388dnl
389dnl See if struct stat has a st_flags field, in which case we can get file
390dnl flags somewhat portably. Also check for the analogous setter, chflags().
391dnl
392AC_MSG_CHECKING(whether struct stat has a st_flags field)
393AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
394 AC_TRY_COMPILE([#include <sys/stat.h>],
395 [struct stat stat; stat.st_flags = 0;],
396 [e2fsprogs_cv_struct_st_flags=yes],
397 [e2fsprogs_cv_struct_st_flags=no]))
398AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
399if test "$e2fsprogs_cv_struct_st_flags" = yes; then
Theodore Ts'oc03bc4e1999-10-20 18:20:36 +0000400 AC_MSG_CHECKING(whether st_flags field is useful)
401 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
402 AC_TRY_COMPILE([#include <sys/stat.h>],
403 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
404 [e2fsprogs_cv_struct_st_flags_immut=yes],
405 [e2fsprogs_cv_struct_st_flags_immut=no]))
406 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
407 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
408 AC_DEFINE(HAVE_STAT_FLAGS)
409 fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000410fi
Theodore Ts'o6454d841999-03-16 19:24:34 +0000411AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo strcasecmp srandom fchown mallinfo)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000412dnl
413dnl Check to see if ino_t is defined
414dnl
415AC_MSG_CHECKING(ino_t defined by sys/types.h)
416AC_CACHE_VAL(e2fsprogs_cv_ino_t,
417 AC_TRY_COMPILE([#include <sys/types.h>],
418 [ino_t ino; ino = 0;],
419 [e2fsprogs_cv_ino_t=yes],
420 [e2fsprogs_cv_ino_t=no]))
421AC_MSG_RESULT($e2fsprogs_cv_ino_t)
422if test "$e2fsprogs_cv_ino_t" = yes; then
423 AC_DEFINE(HAVE_INO_T)
424fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000425dnl
426dnl On systems without linux header files, we add an extra include directory
427dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
428dnl is quoted so that it gets expanded by make, not by configure.
429dnl
430AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000431if test "$linux_headers" = yes; then
432 AC_DEFINE(HAVE_LINUX_FS_H)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000433else
434 LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
435 # Use this include directory with test compiles in the configure script too.
436 CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
437fi
438AC_SUBST(LINUX_INCLUDE)
439dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000440dnl Check to see if -lsocket is required (solaris) to make something
441dnl that uses socket() to compile; this is needed for the UUID library
442dnl
443SOCKET_LIB=''
444AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
445AC_SUBST(SOCKET_LIB)
446dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000447dnl See if optreset exists
448dnl
449AC_MSG_CHECKING(for optreset)
450AC_CACHE_VAL(ac_cv_have_optreset,
451[AC_EGREP_HEADER(optreset, unistd.h,
452 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
453AC_MSG_RESULT($ac_cv_have_optreset)
454if test $ac_cv_have_optreset = yes; then
455 AC_DEFINE(HAVE_OPTRESET)
456fi
457dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000458dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
459dnl
460AC_MSG_CHECKING(whether the ext2 ioctls compile)
461AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
462 AC_TRY_COMPILE([#include <linux/ext2_fs.h>
463#include <sys/ioctl.h>],
464 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
465 [e2fsprogs_cv_ioctl_ext2=yes],
466 [e2fsprogs_cv_ioctl_ext2=no]))
467AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
468if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
469 AC_DEFINE(HAVE_EXT2_IOCTLS)
470fi
471dnl
Theodore Ts'o66704951999-06-25 15:30:33 +0000472dnl Check if ext2_inode has i_version (changed to i_generation in Linux 2.3)
473dnl
474AC_MSG_CHECKING(whether struct ext2_inode has an i_version field)
475AC_CACHE_VAL(e2fsprogs_cv_ext2_inode_version,
476 AC_TRY_COMPILE([#include <linux/ext2_fs.h>],
477 [struct ext2_inode e2i; e2i.i_version=0;],
478 [e2fsprogs_cv_ext2_inode_version=yes],
479 [e2fsprogs_cv_ext2_inode_version=no]))
480AC_MSG_RESULT($e2fsprogs_cv_ext2_inode_version)
481if test "$e2fsprogs_cv_ext2_inode_version" = yes; then
482 AC_DEFINE(HAVE_EXT2_INODE_VERSION)
483fi
484dnl
Theodore Ts'o6c133521999-07-03 20:37:03 +0000485dnl Linux and Hurd places root files in the / by default
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000486dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000487case "$host_os" in
Theodore Ts'o6c133521999-07-03 20:37:03 +0000488linux* | gnu*)
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000489 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
490 root_prefix="";
491 echo "On $host_os systems, root_prefix defaults to ''"
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000492 fi
493 ;;
494esac
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000495dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000496dnl On Linux/hurd, force the prefix to be /usr
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000497dnl
498case "$host_os" in
499linux* | gnu*)
500 if test "$prefix" = NONE ; then
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000501 prefix="/usr";
502 echo "On $host_os systems, prefix defaults to /usr"
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000503 fi
504;;
505esac
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000506if test "$root_prefix" = NONE ; then
Theodore Ts'offe19911998-04-08 06:05:49 +0000507 if test "$prefix" = NONE ; then
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000508 root_prefix="$ac_default_prefix"
509 else
510 root_prefix="$prefix"
511 fi
512fi
513AC_SUBST(root_prefix)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000514dnl
515dnl See if -static works.
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000516dnl
Theodore Ts'oae851481997-04-29 18:13:24 +0000517AC_MSG_CHECKING([whether linker accepts -static])
518AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
519[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
520AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
521 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
522LDFLAGS=$SAVE_LDFLAGS])
Theodore Ts'odefde781999-01-04 07:39:19 +0000523dnl
524dnl Regardless of how the test turns out, Solaris doesn't handle -static
525dnl This is caused by the socket library requiring the nsl library, which
526dnl requires the -dl library, which only works for dynamically linked
527dnl programs. It basically means you can't have statically linked programs
528dnl which use the network under Solaris.
529dnl
530case "$host_os" in
531solaris2.*)
532 ac_cv_e2fsprogs_use_static=no
533;;
534esac
Theodore Ts'oae851481997-04-29 18:13:24 +0000535AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
Theodore Ts'o74becf31997-04-26 14:37:06 +0000536LDFLAG_STATIC=
Theodore Ts'oae851481997-04-29 18:13:24 +0000537if test $ac_cv_e2fsprogs_use_static = yes; then
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000538 LDFLAG_STATIC=-static
Theodore Ts'oae851481997-04-29 18:13:24 +0000539fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000540AC_SUBST(LDFLAG_STATIC)
541dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000542dnl Make the ss and et directories work correctly.
543dnl
544SS_DIR=`cd ${srcdir}/lib/ss; pwd`
545ET_DIR=`cd ${srcdir}/lib/et; pwd`
546AC_SUBST(SS_DIR)
547AC_SUBST(ET_DIR)
548dnl
549dnl Only try to run the test suite if we're not cross compiling.
550dnl
551if test "$cross_compiling" = yes ; then
552 DO_TEST_SUITE=
553else
554 DO_TEST_SUITE=check
555fi
556AC_SUBST(DO_TEST_SUITE)
557dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000558dnl
559dnl
560DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute
561AC_SUBST_FILE(DO_SUBSTITUTE_SCRIPT)
562dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000563dnl Make our output files, being sure that we create the some miscellaneous
564dnl directories
565dnl
566test -d lib || mkdir lib
567test -d include || mkdir include
568test -d include/linux || mkdir include/linux
Theodore Ts'odefde781999-01-04 07:39:19 +0000569test -d include/asm || mkdir include/asm
Theodore Ts'o24b2c7a1997-06-07 20:42:58 +0000570rmakefile=
571if test -d ${srcdir}/resize ; then
572 rmakefile=resize/Makefile
573fi
Theodore Ts'o44339bd1997-10-15 02:47:20 +0000574AC_OUTPUT(MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000575 lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile
576 misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile
Theodore Ts'o24b2c7a1997-06-07 20:42:58 +0000577 tests/progs/Makefile $rmakefile doc/Makefile)