blob: 7d134b657360d5a60b2373f4d8f364c86caba34a [file] [log] [blame]
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001AC_INIT(version.h)
2MCONFIG=./MCONFIG
3AC_SUBST_FILE(MCONFIG)
Theodore Ts'o74becf31997-04-26 14:37:06 +00004BINARY_TYPE=bin
5dnl
6dnl This is to figure out the version number and the date....
7dnl
8E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
9 | awk '{print $3}' | tr \" " " | awk '{print $1}'`
10DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
11 | tr \" " "`
12MONTH=`echo $DATE | awk -F- '{print $2}'`
13YEAR=`echo $DATE | awk -F- '{print $3}'`
14
15if expr $YEAR ">" 90 >/dev/null ; then
16 E2FSPROGS_YEAR=19$YEAR
17else
18 E2FSPROGS_YEAR=20$YEAR
19fi
20
21case $MONTH in
22Jan) E2FSPROGS_MONTH="January" ;;
23Feb) E2FSPROGS_MONTH="February" ;;
24Mar) E2FSPROGS_MONTH="March" ;;
25Apr) E2FSPROGS_MONTH="April" ;;
26May) E2FSPROGS_MONTH="May" ;;
27Jun) E2FSPROGS_MONTH="June" ;;
28Jul) E2FSPROGS_MONTH="July" ;;
29Aug) E2FSPROGS_MONTH="August" ;;
30Sep) E2FSPROGS_MONTH="September" ;;
31Oct) E2FSPROGS_MONTH="October" ;;
32Nov) E2FSPROGS_MONTH="November" ;;
33Dec) E2FSPROGS_MONTH="December" ;;
34*) echo "Unknown month $MONTH??" ;;
35esac
36
37unset DATE MONTH YEAR
38echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION"
39echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}"
40AC_SUBST(E2FSPROGS_YEAR)
41AC_SUBST(E2FSPROGS_MONTH)
42AC_SUBST(E2FSPROGS_VERSION)
43dnl
44dnl set $(CC) from --with-cc=value
45dnl
46AC_ARG_WITH([cc],
47[ --with-cc=COMPILER select compiler to use],
48AC_MSG_RESULT(CC=$withval)
49CC=$withval,
50if test -z "$CC" ; then CC=cc; fi
51[AC_MSG_RESULT(CC defaults to $CC)])dnl
52export CC
53AC_SUBST([CC])
54dnl
55dnl set $(LD) from --with-linker=value
56dnl
57AC_ARG_WITH([linker],
58[ --with-linker=LINKER select linker to use],
59AC_MSG_RESULT(LD=$withval)
60LD=$withval,
61if test -z "$LD" ; then LD=$CC; fi
62[AC_MSG_RESULT(LD defaults to $LD)])dnl
63export LD
64AC_SUBST([LD])
65dnl
66dnl set $(CCOPTS) from --with-ccopts=value
67dnl
68AC_ARG_WITH([ccopts],
69[ --with-ccopts=CCOPTS select compiler command line options],
70AC_MSG_RESULT(CCOPTS is $withval)
71CCOPTS=$withval
72CFLAGS="$CFLAGS $withval",
73CCOPTS=)dnl
74AC_SUBST(CCOPTS)
75dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +000076dnl Set default values for library extentions. Will be dealt with after
77dnl parsing configuration opions, which may modify these
78dnl
79LIB_EXT=.a
80STATIC_LIB_EXT=.a
81PROFILE_LIB_EXT=.a
82dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +000083dnl set $(LDFLAGS) from --with-ldopts=value
84dnl
85AC_ARG_WITH([ldopts],
86[ --with-ldopts=LDOPTS select linker command line options],
87AC_MSG_RESULT(LDFLAGS is $withval)
88LDFLAGS=$withval,
89LDFLAGS=)dnl
90AC_SUBST(LDFLAGS)
Theodore Ts'o50e1e101997-04-26 13:58:21 +000091dnl
92dnl handle --enable-dll-shlibs
93dnl
94AC_ARG_ENABLE([dll-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +000095[ --enable-dll-shlibs select DLL libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +000096if test "$enableval" = "no"
97then
98 DLL_CMT=#
99 MAKEFILE_DLL=/dev/null
100 echo "Disabling DLL shared libraries"
101else
102 DLL_CMT=
103 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
Theodore Ts'o74becf31997-04-26 14:37:06 +0000104 BINARY_TYPE=dllbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000105 LIB_EXT=.sa
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000106 echo "Enabling DLL shared libraries"
107fi
108,
109MAKEFILE_DLL=/dev/null
110DLL_CMT=#
111echo "Disabling DLL shared libraries by default"
112)
113AC_SUBST(DLL_CMT)
114AC_SUBST_FILE(MAKEFILE_DLL)
115dnl
116dnl handle --enable-elf-shlibs
117dnl
118AC_ARG_ENABLE([elf-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000119[ --enable-elf-shlibs select ELF shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000120if test "$enableval" = "no"
121then
122 ELF_CMT=#
123 MAKEFILE_ELF=/dev/null
124 echo "Disabling ELF shared libraries"
125else
126 ELF_CMT=
127 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
Theodore Ts'o74becf31997-04-26 14:37:06 +0000128 BINARY_TYPE=elfbin
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000129 LIB_EXT=.so
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000130 echo "Enabling ELF shared libraries"
131fi
132,
133MAKEFILE_ELF=/dev/null
134ELF_CMT=#
135echo "Disabling ELF shared libraries by default"
136)
137AC_SUBST(ELF_CMT)
138AC_SUBST_FILE(MAKEFILE_ELF)
139dnl
140dnl handle --enable-bsd-shlibs
141dnl
142AC_ARG_ENABLE([bsd-shlibs],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000143[ --enable-bsd-shlibs select BSD shared libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000144if test "$enableval" = "no"
145then
146 BSDLIB_CMT=#
147 MAKEFILE_BSDLIB=/dev/null
148 echo "Disabling BSD shared libraries"
149else
150 BSDLIB_CMT=
151 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000152 LIB_EXT=.so
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000153 echo "Enabling BSD shared libraries"
154fi
155,
156MAKEFILE_BSDLIB=/dev/null
157BSDLIB_CMT=#
158echo "Disabling BSD shared libraries by default"
159)
160AC_SUBST(BSDLIB_CMT)
161AC_SUBST_FILE(MAKEFILE_BSDLIB)
162dnl
163dnl handle --enable-profile
164dnl
165AC_ARG_ENABLE([profile],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000166[ --enable-profile build profiling libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000167if test "$enableval" = "no"
168then
169 PROFILE_CMT=#
170 MAKEFILE_PROFILE=/dev/null
171 echo "Disabling profiling libraries"
172else
173 PROFILE_CMT=
174 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000175 PROFILED_LIB_EXT=_p.a
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000176 echo "Building profiling libraries"
177fi
178,
179PROFILE_CMT=#
180MAKEFILE_PROFILE=/dev/null
181echo "Disabling profiling libraries by default"
182)
183AC_SUBST(PROFILE_CMT)
184AC_SUBST_FILE(MAKEFILE_PROFILE)
185dnl
186dnl handle --enable-checker
187dnl
188AC_ARG_ENABLE([checker],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000189[ --enable-checker build checker libraries],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000190if test "$enableval" = "no"
191then
192 CHECKER_CMT=#
193 MAKEFILE_CHECKER=/dev/null
194 echo "Disabling checker libraries"
195else
196 CHECKER_CMT=
197 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
198 echo "Building checker libraries"
199fi
200,
201CHECKER_CMT=#
202MAKEFILE_CHECKER=/dev/null
203echo "Disabling checker libraries by default"
204)
205AC_SUBST(CHECKER_CMT)
206AC_SUBST_FILE(MAKEFILE_CHECKER)
207dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000208dnl Substitute library extensions
209dnl
210AC_SUBST(LIB_EXT)
211AC_SUBST(STATIC_LIB_EXT)
212AC_SUBST(PROFILED_LIB_EXT)
213dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000214dnl handle --enable-gcc-wall
215dnl
216AC_ARG_ENABLE([gcc-wall],
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000217[ --enable-gcc-wall enable GCC anal warnings],
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000218if test "$enableval" = "no"
219then
220 W=#
221 echo "Disabling GCC warnings"
222else
223 W=
224 echo "Enabling GCC warnings"
225fi
226,
227W=#
228echo "Disabling GCC warnings by default"
229)
230AC_SUBST(W)
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000231AC_ARG_ENABLE([dynamic-e2fsck],
232[ --enable-dynamic-e2fsck build e2fsck dynamically],
233if test "$enableval" = "no"
234then
235 E2FSCK_TYPE=static
236 echo "Building e2fsck statically"
237else
238 E2FSCK_TYPE=shared
239 echo "Building e2fsck dynamically"
240fi
241,
242E2FSCK_TYPE=static
243echo "Building e2fsck statically by default"
244)
245AC_SUBST(E2FSCK_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000246dnl
247dnl
248MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
249AC_SUBST_FILE(MAKEFILE_LIBRARY)
250dnl
251dnl End of configuration options
252dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000253AC_SUBST(BINARY_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000254AC_PROG_MAKE_SET
255AC_PATH_PROG(LN, ln, ln)
256AC_PATH_PROG(MV, mv, mv)
257AC_PATH_PROG(CP, cp, cp)
258AC_PATH_PROG(RM, rm, rm)
259AC_PATH_PROG(CHMOD, chmod, :)
260AC_PATH_PROG(AWK, awk, awk)
261AC_PATH_PROG(SED, sed, sed)
262AC_CHECK_TOOL(AR, ar, ar)
263AC_CHECK_TOOL(RANLIB, ranlib, :)
264AC_CHECK_TOOL(STRIP, strip, :)
265AC_PROG_CC
266AC_PROG_INSTALL
267AC_C_CROSS
Theodore Ts'o74becf31997-04-26 14:37:06 +0000268AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h mntent.h dirent.h getopt.h linux/fd.h linux/major.h sys/disklabel.h)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000269AC_FUNC_VPRINTF
270dnl
271dnl See if struct dirent has a d_namlen field (like bsd systems), implying
272dnl that the actual length of the structure may be grater than the declared
273dnl length.
274dnl
275AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
276AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
277 AC_TRY_COMPILE(
278[#include <sys/types.h>
279#include <dirent.h>],
280 [struct dirent de; de.d_namlen = 0;],
281 [e2fsprogs_cv_struct_d_namlen=yes],
282 [e2fsprogs_cv_struct_d_namlen=no]))
283AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
284if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
285 AC_DEFINE(HAVE_DIRENT_NAMLEN)
286fi
287dnl
288dnl Word sizes...
289dnl
290if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
291 # if cross-compiling, with no cached values, just assume something common.
292 ac_cv_sizeof_short=2
293 ac_cv_sizeof_int=4
294 ac_cv_sizeof_long=4
295 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4])
296fi
297AC_CHECK_SIZEOF(short)
298AC_CHECK_SIZEOF(int)
299AC_CHECK_SIZEOF(long)
300SIZEOF_SHORT=$ac_cv_sizeof_short
301SIZEOF_INT=$ac_cv_sizeof_int
302SIZEOF_LONG=$ac_cv_sizeof_long
303AC_SUBST(SIZEOF_SHORT)
304AC_SUBST(SIZEOF_INT)
305AC_SUBST(SIZEOF_LONG)
306dnl
307dnl See if struct stat has a st_flags field, in which case we can get file
308dnl flags somewhat portably. Also check for the analogous setter, chflags().
309dnl
310AC_MSG_CHECKING(whether struct stat has a st_flags field)
311AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
312 AC_TRY_COMPILE([#include <sys/stat.h>],
313 [struct stat stat; stat.st_flags = 0;],
314 [e2fsprogs_cv_struct_st_flags=yes],
315 [e2fsprogs_cv_struct_st_flags=no]))
316AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
317if test "$e2fsprogs_cv_struct_st_flags" = yes; then
318 AC_DEFINE(HAVE_STAT_FLAGS)
319fi
320AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo)
321dnl
322dnl On systems without linux header files, we add an extra include directory
323dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
324dnl is quoted so that it gets expanded by make, not by configure.
325dnl
326AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
327AC_SUBST(EXTRA_PROGS)
328if test "$linux_headers" = yes; then
329 AC_DEFINE(HAVE_LINUX_FS_H)
330 # These are some programs that depend on having linux headers around, and
331 # won't work otherwise. So we only compile them if we can.
332 EXTRA_PROGS="$EXTRA_PROGS flushb"
333else
334 LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
335 # Use this include directory with test compiles in the configure script too.
336 CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
337fi
338AC_SUBST(LINUX_INCLUDE)
339dnl
340dnl See if optreset exists
341dnl
342AC_MSG_CHECKING(for optreset)
343AC_CACHE_VAL(ac_cv_have_optreset,
344[AC_EGREP_HEADER(optreset, unistd.h,
345 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
346AC_MSG_RESULT($ac_cv_have_optreset)
347if test $ac_cv_have_optreset = yes; then
348 AC_DEFINE(HAVE_OPTRESET)
349fi
350dnl
351dnl See if our system has frags enabled (at least in the header file)
352dnl
353AC_MSG_CHECKING(whether struct ext2_inode has frags fields)
354AC_CACHE_VAL(e2fsprogs_cv_struct_ext2_inode_frags,
355 AC_TRY_COMPILE([#include <linux/ext2_fs.h>],
356 [struct ext2_inode i; i.i_frag = i.i_fsize = 0;],
357 [e2fsprogs_cv_struct_ext2_inode_frags=yes],
358 [e2fsprogs_cv_struct_ext2_inode_frags=no]))
359AC_MSG_RESULT($e2fsprogs_cv_struct_ext2_inode_frags)
360if test "$e2fsprogs_cv_struct_ext2_inode_frags" = yes; then
361 AC_DEFINE(HAVE_EXT2_FRAGS)
362fi
363dnl
364dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
365dnl
366AC_MSG_CHECKING(whether the ext2 ioctls compile)
367AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
368 AC_TRY_COMPILE([#include <linux/ext2_fs.h>
369#include <sys/ioctl.h>],
370 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
371 [e2fsprogs_cv_ioctl_ext2=yes],
372 [e2fsprogs_cv_ioctl_ext2=no]))
373AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
374if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
375 AC_DEFINE(HAVE_EXT2_IOCTLS)
376fi
377dnl
378dnl On linux, force the prefix to be '/'
379dnl
380AC_REQUIRE([AC_CANONICAL_HOST])
381case "$host_os" in
382linux*)
383 if test "$prefix" = NONE ; then
384 prefix='/';
385 echo "On Linux systems, prefix defaults to '/'"
386 fi
387;;
388esac
389dnl
390dnl See if -static works.
391dnl XXX for now, assume that only Linux systems support -static
392dnl
393AC_REQUIRE([AC_CANONICAL_HOST])
Theodore Ts'o74becf31997-04-26 14:37:06 +0000394LDFLAG_STATIC=
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000395case "$host_os" in
396linux*)
397 LDFLAG_STATIC=-static
398 echo "On Linux systems, assume -static works"
399;;
400esac
401AC_SUBST(LDFLAG_STATIC)
402dnl
403dnl Check to see if prefix is '/'
404dnl
405if test "$prefix" = / ; then
406 usr_prefix=/usr
407else
408 usr_prefix="\${prefix}"
409fi
410AC_SUBST(usr_prefix)
411dnl
412dnl Make the ss and et directories work correctly.
413dnl
414SS_DIR=`cd ${srcdir}/lib/ss; pwd`
415ET_DIR=`cd ${srcdir}/lib/et; pwd`
416AC_SUBST(SS_DIR)
417AC_SUBST(ET_DIR)
418dnl
419dnl Only try to run the test suite if we're not cross compiling.
420dnl
421if test "$cross_compiling" = yes ; then
422 DO_TEST_SUITE=
423else
424 DO_TEST_SUITE=check
425fi
426AC_SUBST(DO_TEST_SUITE)
427dnl
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000428dnl
429dnl
430DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute
431AC_SUBST_FILE(DO_SUBSTITUTE_SCRIPT)
432dnl
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000433dnl Make our output files, being sure that we create the some miscellaneous
434dnl directories
435dnl
436test -d lib || mkdir lib
437test -d include || mkdir include
438test -d include/linux || mkdir include/linux
Theodore Ts'oa4d09611997-04-29 14:28:00 +0000439AC_OUTPUT(MCONFIG lib/substitute_sh Makefile lib/et/Makefile
440 lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile misc/Makefile
441 e2fsck/Makefile debugfs/Makefile tests/Makefile)