blob: dfec9f2f0575f6c7ef309f5763531960ea698205 [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'of8bd9801999-10-26 04:19:45 +000080dnl On systems without linux header files, we add an extra include directory
81dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
82dnl is quoted so that it gets expanded by make, not by configure.
83dnl
84AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
85if test "$linux_headers" = yes; then
86 AC_DEFINE(HAVE_LINUX_FS_H)
87else
88 LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
89 # Use this include directory with test compiles in the configure script too.
90 CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
91fi
92AC_SUBST(LINUX_INCLUDE)
93dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +000094dnl Set default values for library extentions. Will be dealt with after
95dnl parsing configuration opions, which may modify these
96dnl
97LIB_EXT=.a
98STATIC_LIB_EXT=.a
99PROFILE_LIB_EXT=.a
100dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000101dnl set $(LDFLAGS) from --with-ldopts=value
102dnl
103AC_ARG_WITH([ldopts],
104[ --with-ldopts=LDOPTS select linker command line options],
105AC_MSG_RESULT(LDFLAGS is $withval)
106LDFLAGS=$withval,
107LDFLAGS=)dnl
108AC_SUBST(LDFLAGS)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000109dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000110dnl Allow separate `root_prefix' to be specified
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000111dnl
Theodore Ts'oa4b2d3c1998-04-03 16:12:25 +0000112AC_ARG_WITH([root-prefix],
113[ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
114root_prefix=$withval,
115root_prefix=NONE)dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000116dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000117dnl handle --enable-dll-shlibs
118dnl
119AC_ARG_ENABLE([dll-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000120[ --enable-dll-shlibs select DLL libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000121if test "$enableval" = "no"
122then
123 DLL_CMT=#
124 MAKEFILE_DLL=/dev/null
125 echo "Disabling DLL shared libraries"
126else
127 DLL_CMT=
128 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
Theodore Ts'o74becf31997-04-26 14:37:06 +0000129 BINARY_TYPE=dllbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000130 LIB_EXT=.sa
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000131 echo "Enabling DLL shared libraries"
132fi
133,
134MAKEFILE_DLL=/dev/null
135DLL_CMT=#
136echo "Disabling DLL shared libraries by default"
137)
138AC_SUBST(DLL_CMT)
139AC_SUBST_FILE(MAKEFILE_DLL)
140dnl
141dnl handle --enable-elf-shlibs
142dnl
143AC_ARG_ENABLE([elf-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000144[ --enable-elf-shlibs select ELF shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000145if test "$enableval" = "no"
146then
147 ELF_CMT=#
148 MAKEFILE_ELF=/dev/null
149 echo "Disabling ELF shared libraries"
150else
151 ELF_CMT=
152 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
Theodore Ts'o74becf31997-04-26 14:37:06 +0000153 BINARY_TYPE=elfbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000154 LIB_EXT=.so
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000155 echo "Enabling ELF shared libraries"
156fi
157,
158MAKEFILE_ELF=/dev/null
159ELF_CMT=#
160echo "Disabling ELF shared libraries by default"
161)
162AC_SUBST(ELF_CMT)
163AC_SUBST_FILE(MAKEFILE_ELF)
164dnl
165dnl handle --enable-bsd-shlibs
166dnl
167AC_ARG_ENABLE([bsd-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000168[ --enable-bsd-shlibs select BSD shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000169if test "$enableval" = "no"
170then
171 BSDLIB_CMT=#
172 MAKEFILE_BSDLIB=/dev/null
173 echo "Disabling BSD shared libraries"
174else
175 BSDLIB_CMT=
176 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000177 LIB_EXT=.so
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000178 echo "Enabling BSD shared libraries"
179fi
180,
181MAKEFILE_BSDLIB=/dev/null
182BSDLIB_CMT=#
183echo "Disabling BSD shared libraries by default"
184)
185AC_SUBST(BSDLIB_CMT)
186AC_SUBST_FILE(MAKEFILE_BSDLIB)
187dnl
188dnl handle --enable-profile
189dnl
190AC_ARG_ENABLE([profile],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000191[ --enable-profile build profiling libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000192if test "$enableval" = "no"
193then
194 PROFILE_CMT=#
195 MAKEFILE_PROFILE=/dev/null
196 echo "Disabling profiling libraries"
197else
198 PROFILE_CMT=
199 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000200 PROFILED_LIB_EXT=_p.a
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000201 echo "Building profiling libraries"
202fi
203,
204PROFILE_CMT=#
205MAKEFILE_PROFILE=/dev/null
206echo "Disabling profiling libraries by default"
207)
208AC_SUBST(PROFILE_CMT)
209AC_SUBST_FILE(MAKEFILE_PROFILE)
210dnl
211dnl handle --enable-checker
212dnl
213AC_ARG_ENABLE([checker],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000214[ --enable-checker build checker libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000215if test "$enableval" = "no"
216then
217 CHECKER_CMT=#
218 MAKEFILE_CHECKER=/dev/null
219 echo "Disabling checker libraries"
220else
221 CHECKER_CMT=
222 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
223 echo "Building checker libraries"
224fi
225,
226CHECKER_CMT=#
227MAKEFILE_CHECKER=/dev/null
228echo "Disabling checker libraries by default"
229)
230AC_SUBST(CHECKER_CMT)
231AC_SUBST_FILE(MAKEFILE_CHECKER)
232dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000233dnl Substitute library extensions
234dnl
235AC_SUBST(LIB_EXT)
236AC_SUBST(STATIC_LIB_EXT)
237AC_SUBST(PROFILED_LIB_EXT)
238dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000239dnl handle --enable-gcc-wall
240dnl
241AC_ARG_ENABLE([gcc-wall],
Theodore Ts'ob0b9c4d1997-10-20 23:36:30 +0000242[ --enable-gcc-wall enable GCC anal warnings (DON'T USE IN PRODUCTION)],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000243if test "$enableval" = "no"
244then
245 W=#
246 echo "Disabling GCC warnings"
247else
248 W=
249 echo "Enabling GCC warnings"
250fi
251,
252W=#
253echo "Disabling GCC warnings by default"
254)
255AC_SUBST(W)
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000256AC_ARG_ENABLE([dynamic-e2fsck],
257[ --enable-dynamic-e2fsck build e2fsck dynamically],
258if test "$enableval" = "no"
259then
260 E2FSCK_TYPE=static
261 echo "Building e2fsck statically"
262else
263 E2FSCK_TYPE=shared
264 echo "Building e2fsck dynamically"
265fi
266,
267E2FSCK_TYPE=static
268echo "Building e2fsck statically by default"
269)
270AC_SUBST(E2FSCK_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000271dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000272dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
273dnl
274AC_ARG_ENABLE([fsck],
275[ --enable-fsck build fsck wrapper program],
276[if test "$enableval" = "no"
277then
278 FSCK_PROG='' FSCK_MAN=''
279 echo "Not building fsck wrapper"
280else
281 FSCK_PROG=fsck FSCK_MAN=fsck.8
282 echo "Building fsck wrapper"
283fi]
284,
285[case "$host_os" in
286 gnu*)
287 FSCK_PROG='' FSCK_MAN=''
288 echo "Not building fsck wrapper by default"
289 ;;
290 *)
291 FSCK_PROG=fsck FSCK_MAN=fsck.8
292 echo "Building fsck wrapper by default"
293esac]
294)
295AC_SUBST(FSCK_PROG)
296AC_SUBST(FSCK_MAN)
297dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000298dnl
299MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
300AC_SUBST_FILE(MAKEFILE_LIBRARY)
301dnl
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000302dnl
303AC_ARG_ENABLE([old-bitops],
304[ --enable-old-bitops Use old (non-standard but native) bitmask operations],
305if test "$enableval" = "no"
306then
307 echo "Using new (standard) bitmask operations"
308else
309 AC_DEFINE(EXT2_OLD_BITOPS)
310 echo "Using old (native) bitmask operations"
311
312fi
313,
314echo "Using standard bitmask operations by default"
315)
316dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000317dnl End of configuration options
318dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000319AC_SUBST(BINARY_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000320AC_PROG_MAKE_SET
321AC_PATH_PROG(LN, ln, ln)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000322AC_PROG_LN_S
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000323AC_PATH_PROG(MV, mv, mv)
324AC_PATH_PROG(CP, cp, cp)
325AC_PATH_PROG(RM, rm, rm)
326AC_PATH_PROG(CHMOD, chmod, :)
327AC_PATH_PROG(AWK, awk, awk)
328AC_PATH_PROG(SED, sed, sed)
Theodore Ts'o9d564f71999-07-03 20:25:58 +0000329AC_PATH_PROG(PERL, perl, perl)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000330AC_CHECK_TOOL(AR, ar, ar)
331AC_CHECK_TOOL(RANLIB, ranlib, :)
332AC_CHECK_TOOL(STRIP, strip, :)
333AC_PROG_CC
334AC_PROG_INSTALL
335AC_C_CROSS
Theodore Ts'o6c133521999-07-03 20:37:03 +0000336# See if we need a separate native compiler.
337if test $cross_compiling = no; then
338 BUILD_CC="$CC"
339 AC_SUBST(BUILD_CC)
340else
341 AC_CHECK_PROGS(BUILD_CC, gcc cc)
342fi
Theodore Ts'oc81c6ce1999-10-26 04:28:53 +0000343AC_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/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 +0000344AC_FUNC_VPRINTF
345dnl
346dnl See if struct dirent has a d_namlen field (like bsd systems), implying
347dnl that the actual length of the structure may be grater than the declared
348dnl length.
349dnl
350AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
351AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
352 AC_TRY_COMPILE(
353[#include <sys/types.h>
354#include <dirent.h>],
355 [struct dirent de; de.d_namlen = 0;],
356 [e2fsprogs_cv_struct_d_namlen=yes],
357 [e2fsprogs_cv_struct_d_namlen=no]))
358AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
359if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
360 AC_DEFINE(HAVE_DIRENT_NAMLEN)
361fi
362dnl
Theodore Ts'ob0b9c4d1997-10-20 23:36:30 +0000363dnl Check to see if llseek() is declared in unistd.h. On some libc's
364dnl it is, and on others it isn't..... Thank you glibc developers....
365dnl
366dnl Warning! Use of --enable-gcc-wall may throw off this test.
367dnl
368dnl
369AC_MSG_CHECKING(whether llseek declared in unistd.h)
370AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
371 AC_TRY_COMPILE(
372[#include <unistd.h>], [extern int llseek(int);],
373 [e2fsprogs_cv_have_llseek_prototype=no],
374 [e2fsprogs_cv_have_llseek_prototype=yes]))
375AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
376if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
377 AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
378fi
379dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000380dnl Word sizes...
381dnl
382if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
383 # if cross-compiling, with no cached values, just assume something common.
384 ac_cv_sizeof_short=2
385 ac_cv_sizeof_int=4
386 ac_cv_sizeof_long=4
Theodore Ts'o6c133521999-07-03 20:37:03 +0000387 ac_cv_sizeof_long_long=8
388 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 +0000389fi
390AC_CHECK_SIZEOF(short)
391AC_CHECK_SIZEOF(int)
392AC_CHECK_SIZEOF(long)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000393AC_CHECK_SIZEOF(long long)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000394SIZEOF_SHORT=$ac_cv_sizeof_short
395SIZEOF_INT=$ac_cv_sizeof_int
396SIZEOF_LONG=$ac_cv_sizeof_long
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000397SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000398AC_SUBST(SIZEOF_SHORT)
399AC_SUBST(SIZEOF_INT)
400AC_SUBST(SIZEOF_LONG)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000401AC_SUBST(SIZEOF_LONG_LONG)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000402dnl
403dnl See if struct stat has a st_flags field, in which case we can get file
404dnl flags somewhat portably. Also check for the analogous setter, chflags().
405dnl
406AC_MSG_CHECKING(whether struct stat has a st_flags field)
407AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
408 AC_TRY_COMPILE([#include <sys/stat.h>],
409 [struct stat stat; stat.st_flags = 0;],
410 [e2fsprogs_cv_struct_st_flags=yes],
411 [e2fsprogs_cv_struct_st_flags=no]))
412AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
413if test "$e2fsprogs_cv_struct_st_flags" = yes; then
Theodore Ts'oc03bc4e1999-10-20 18:20:36 +0000414 AC_MSG_CHECKING(whether st_flags field is useful)
415 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
416 AC_TRY_COMPILE([#include <sys/stat.h>],
417 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
418 [e2fsprogs_cv_struct_st_flags_immut=yes],
419 [e2fsprogs_cv_struct_st_flags_immut=no]))
420 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
421 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
422 AC_DEFINE(HAVE_STAT_FLAGS)
423 fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000424fi
Theodore Ts'o6454d841999-03-16 19:24:34 +0000425AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo strcasecmp srandom fchown mallinfo)
Theodore Ts'ofc6d9d51997-04-29 14:51:31 +0000426dnl
427dnl Check to see if ino_t is defined
428dnl
429AC_MSG_CHECKING(ino_t defined by sys/types.h)
430AC_CACHE_VAL(e2fsprogs_cv_ino_t,
431 AC_TRY_COMPILE([#include <sys/types.h>],
432 [ino_t ino; ino = 0;],
433 [e2fsprogs_cv_ino_t=yes],
434 [e2fsprogs_cv_ino_t=no]))
435AC_MSG_RESULT($e2fsprogs_cv_ino_t)
436if test "$e2fsprogs_cv_ino_t" = yes; then
437 AC_DEFINE(HAVE_INO_T)
438fi
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000439dnl
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'oad6783d1999-10-26 01:58:54 +0000458dnl See if using the EXT2 ioctls causes a compile-time barf (as on the Hurd).
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000459dnl
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)