blob: 43d149da8953c9171f22c73eefb237ec6c1fc2b8 [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
76dnl set $(LDFLAGS) from --with-ldopts=value
77dnl
78AC_ARG_WITH([ldopts],
79[ --with-ldopts=LDOPTS select linker command line options],
80AC_MSG_RESULT(LDFLAGS is $withval)
81LDFLAGS=$withval,
82LDFLAGS=)dnl
83AC_SUBST(LDFLAGS)
Theodore Ts'o50e1e101997-04-26 13:58:21 +000084dnl
85dnl handle --enable-dll-shlibs
86dnl
87AC_ARG_ENABLE([dll-shlibs],
88[ --enable-dll-shlibs select DLL libraries],
89if test "$enableval" = "no"
90then
91 DLL_CMT=#
92 MAKEFILE_DLL=/dev/null
93 echo "Disabling DLL shared libraries"
94else
95 DLL_CMT=
96 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
Theodore Ts'o74becf31997-04-26 14:37:06 +000097 BINARY_TYPE=dllbin
Theodore Ts'o50e1e101997-04-26 13:58:21 +000098 echo "Enabling DLL shared libraries"
99fi
100,
101MAKEFILE_DLL=/dev/null
102DLL_CMT=#
103echo "Disabling DLL shared libraries by default"
104)
105AC_SUBST(DLL_CMT)
106AC_SUBST_FILE(MAKEFILE_DLL)
107dnl
108dnl handle --enable-elf-shlibs
109dnl
110AC_ARG_ENABLE([elf-shlibs],
111[ --enable-elf-shlibs select ELF shared libraries],
112if test "$enableval" = "no"
113then
114 ELF_CMT=#
115 MAKEFILE_ELF=/dev/null
116 echo "Disabling ELF shared libraries"
117else
118 ELF_CMT=
119 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
Theodore Ts'o74becf31997-04-26 14:37:06 +0000120 BINARY_TYPE=elfbin
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000121 echo "Enabling ELF shared libraries"
122fi
123,
124MAKEFILE_ELF=/dev/null
125ELF_CMT=#
126echo "Disabling ELF shared libraries by default"
127)
128AC_SUBST(ELF_CMT)
129AC_SUBST_FILE(MAKEFILE_ELF)
130dnl
131dnl handle --enable-bsd-shlibs
132dnl
133AC_ARG_ENABLE([bsd-shlibs],
134[ --enable-bsd-shlibs select BSD shared libraries],
135if test "$enableval" = "no"
136then
137 BSDLIB_CMT=#
138 MAKEFILE_BSDLIB=/dev/null
139 echo "Disabling BSD shared libraries"
140else
141 BSDLIB_CMT=
142 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
143 echo "Enabling BSD shared libraries"
144fi
145,
146MAKEFILE_BSDLIB=/dev/null
147BSDLIB_CMT=#
148echo "Disabling BSD shared libraries by default"
149)
150AC_SUBST(BSDLIB_CMT)
151AC_SUBST_FILE(MAKEFILE_BSDLIB)
152dnl
153dnl handle --enable-profile
154dnl
155AC_ARG_ENABLE([profile],
156[ --enable-profile build profiling libraries],
157if test "$enableval" = "no"
158then
159 PROFILE_CMT=#
160 MAKEFILE_PROFILE=/dev/null
161 echo "Disabling profiling libraries"
162else
163 PROFILE_CMT=
164 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
165 echo "Building profiling libraries"
166fi
167,
168PROFILE_CMT=#
169MAKEFILE_PROFILE=/dev/null
170echo "Disabling profiling libraries by default"
171)
172AC_SUBST(PROFILE_CMT)
173AC_SUBST_FILE(MAKEFILE_PROFILE)
174dnl
175dnl handle --enable-checker
176dnl
177AC_ARG_ENABLE([checker],
178[ --enable-checker build checker libraries],
179if test "$enableval" = "no"
180then
181 CHECKER_CMT=#
182 MAKEFILE_CHECKER=/dev/null
183 echo "Disabling checker libraries"
184else
185 CHECKER_CMT=
186 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
187 echo "Building checker libraries"
188fi
189,
190CHECKER_CMT=#
191MAKEFILE_CHECKER=/dev/null
192echo "Disabling checker libraries by default"
193)
194AC_SUBST(CHECKER_CMT)
195AC_SUBST_FILE(MAKEFILE_CHECKER)
196dnl
197dnl handle --enable-gcc-wall
198dnl
199AC_ARG_ENABLE([gcc-wall],
200[ --enable-gcc-wall enable GCC anal warnings],
201if test "$enableval" = "no"
202then
203 W=#
204 echo "Disabling GCC warnings"
205else
206 W=
207 echo "Enabling GCC warnings"
208fi
209,
210W=#
211echo "Disabling GCC warnings by default"
212)
213AC_SUBST(W)
214dnl
215dnl
216MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
217AC_SUBST_FILE(MAKEFILE_LIBRARY)
218dnl
219dnl End of configuration options
220dnl
Theodore Ts'o74becf31997-04-26 14:37:06 +0000221AC_SUBST(BINARY_TYPE)
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000222AC_PROG_MAKE_SET
223AC_PATH_PROG(LN, ln, ln)
224AC_PATH_PROG(MV, mv, mv)
225AC_PATH_PROG(CP, cp, cp)
226AC_PATH_PROG(RM, rm, rm)
227AC_PATH_PROG(CHMOD, chmod, :)
228AC_PATH_PROG(AWK, awk, awk)
229AC_PATH_PROG(SED, sed, sed)
230AC_CHECK_TOOL(AR, ar, ar)
231AC_CHECK_TOOL(RANLIB, ranlib, :)
232AC_CHECK_TOOL(STRIP, strip, :)
233AC_PROG_CC
234AC_PROG_INSTALL
235AC_C_CROSS
Theodore Ts'o74becf31997-04-26 14:37:06 +0000236AC_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 +0000237AC_FUNC_VPRINTF
238dnl
239dnl See if struct dirent has a d_namlen field (like bsd systems), implying
240dnl that the actual length of the structure may be grater than the declared
241dnl length.
242dnl
243AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
244AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
245 AC_TRY_COMPILE(
246[#include <sys/types.h>
247#include <dirent.h>],
248 [struct dirent de; de.d_namlen = 0;],
249 [e2fsprogs_cv_struct_d_namlen=yes],
250 [e2fsprogs_cv_struct_d_namlen=no]))
251AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
252if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
253 AC_DEFINE(HAVE_DIRENT_NAMLEN)
254fi
255dnl
256dnl Word sizes...
257dnl
258if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
259 # if cross-compiling, with no cached values, just assume something common.
260 ac_cv_sizeof_short=2
261 ac_cv_sizeof_int=4
262 ac_cv_sizeof_long=4
263 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4])
264fi
265AC_CHECK_SIZEOF(short)
266AC_CHECK_SIZEOF(int)
267AC_CHECK_SIZEOF(long)
268SIZEOF_SHORT=$ac_cv_sizeof_short
269SIZEOF_INT=$ac_cv_sizeof_int
270SIZEOF_LONG=$ac_cv_sizeof_long
271AC_SUBST(SIZEOF_SHORT)
272AC_SUBST(SIZEOF_INT)
273AC_SUBST(SIZEOF_LONG)
274dnl
275dnl See if struct stat has a st_flags field, in which case we can get file
276dnl flags somewhat portably. Also check for the analogous setter, chflags().
277dnl
278AC_MSG_CHECKING(whether struct stat has a st_flags field)
279AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
280 AC_TRY_COMPILE([#include <sys/stat.h>],
281 [struct stat stat; stat.st_flags = 0;],
282 [e2fsprogs_cv_struct_st_flags=yes],
283 [e2fsprogs_cv_struct_st_flags=no]))
284AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
285if test "$e2fsprogs_cv_struct_st_flags" = yes; then
286 AC_DEFINE(HAVE_STAT_FLAGS)
287fi
288AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo)
289dnl
290dnl On systems without linux header files, we add an extra include directory
291dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
292dnl is quoted so that it gets expanded by make, not by configure.
293dnl
294AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
295AC_SUBST(EXTRA_PROGS)
296if test "$linux_headers" = yes; then
297 AC_DEFINE(HAVE_LINUX_FS_H)
298 # These are some programs that depend on having linux headers around, and
299 # won't work otherwise. So we only compile them if we can.
300 EXTRA_PROGS="$EXTRA_PROGS flushb"
301else
302 LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
303 # Use this include directory with test compiles in the configure script too.
304 CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
305fi
306AC_SUBST(LINUX_INCLUDE)
307dnl
308dnl See if optreset exists
309dnl
310AC_MSG_CHECKING(for optreset)
311AC_CACHE_VAL(ac_cv_have_optreset,
312[AC_EGREP_HEADER(optreset, unistd.h,
313 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
314AC_MSG_RESULT($ac_cv_have_optreset)
315if test $ac_cv_have_optreset = yes; then
316 AC_DEFINE(HAVE_OPTRESET)
317fi
318dnl
319dnl See if our system has frags enabled (at least in the header file)
320dnl
321AC_MSG_CHECKING(whether struct ext2_inode has frags fields)
322AC_CACHE_VAL(e2fsprogs_cv_struct_ext2_inode_frags,
323 AC_TRY_COMPILE([#include <linux/ext2_fs.h>],
324 [struct ext2_inode i; i.i_frag = i.i_fsize = 0;],
325 [e2fsprogs_cv_struct_ext2_inode_frags=yes],
326 [e2fsprogs_cv_struct_ext2_inode_frags=no]))
327AC_MSG_RESULT($e2fsprogs_cv_struct_ext2_inode_frags)
328if test "$e2fsprogs_cv_struct_ext2_inode_frags" = yes; then
329 AC_DEFINE(HAVE_EXT2_FRAGS)
330fi
331dnl
332dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
333dnl
334AC_MSG_CHECKING(whether the ext2 ioctls compile)
335AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
336 AC_TRY_COMPILE([#include <linux/ext2_fs.h>
337#include <sys/ioctl.h>],
338 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
339 [e2fsprogs_cv_ioctl_ext2=yes],
340 [e2fsprogs_cv_ioctl_ext2=no]))
341AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
342if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
343 AC_DEFINE(HAVE_EXT2_IOCTLS)
344fi
345dnl
346dnl On linux, force the prefix to be '/'
347dnl
348AC_REQUIRE([AC_CANONICAL_HOST])
349case "$host_os" in
350linux*)
351 if test "$prefix" = NONE ; then
352 prefix='/';
353 echo "On Linux systems, prefix defaults to '/'"
354 fi
355;;
356esac
357dnl
358dnl See if -static works.
359dnl XXX for now, assume that only Linux systems support -static
360dnl
361AC_REQUIRE([AC_CANONICAL_HOST])
Theodore Ts'o74becf31997-04-26 14:37:06 +0000362LDFLAG_STATIC=
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000363case "$host_os" in
364linux*)
365 LDFLAG_STATIC=-static
366 echo "On Linux systems, assume -static works"
367;;
368esac
369AC_SUBST(LDFLAG_STATIC)
370dnl
371dnl Check to see if prefix is '/'
372dnl
373if test "$prefix" = / ; then
374 usr_prefix=/usr
375else
376 usr_prefix="\${prefix}"
377fi
378AC_SUBST(usr_prefix)
379dnl
380dnl Make the ss and et directories work correctly.
381dnl
382SS_DIR=`cd ${srcdir}/lib/ss; pwd`
383ET_DIR=`cd ${srcdir}/lib/et; pwd`
384AC_SUBST(SS_DIR)
385AC_SUBST(ET_DIR)
386dnl
387dnl Only try to run the test suite if we're not cross compiling.
388dnl
389if test "$cross_compiling" = yes ; then
390 DO_TEST_SUITE=
391else
392 DO_TEST_SUITE=check
393fi
394AC_SUBST(DO_TEST_SUITE)
395dnl
396dnl Make our output files, being sure that we create the some miscellaneous
397dnl directories
398dnl
399test -d lib || mkdir lib
400test -d include || mkdir include
401test -d include/linux || mkdir include/linux
402AC_OUTPUT(MCONFIG include/linux/types.h Makefile lib/et/Makefile
403 lib/et/compile_et.sh lib/ss/Makefile lib/ss/mk_cmds.sh
404 lib/ext2fs/Makefile lib/e2p/Makefile misc/Makefile
Theodore Ts'o74becf31997-04-26 14:37:06 +0000405 e2fsck/Makefile debugfs/Makefile tests/Makefile lib/ext2fs/ext2_err.et
406 debugfs/debugfs.8 e2fsck/e2fsck.8 misc/tune2fs.8 misc/lsattr.1
407 misc/chattr.1 misc/badblocks.8 misc/dumpe2fs.8 misc/mke2fs.8
408 misc/fsck.8 misc/mklost+found.8)