7 dnl This is to figure out the version number and the date....
9 E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
10 | awk '{print $3}' | tr \" " " | awk '{print $1}'`
11 DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
13 MONTH=`echo $DATE | awk -F- '{print $2}'`
14 YEAR=`echo $DATE | awk -F- '{print $3}'`
16 if expr $YEAR ">" 1900 > /dev/null ; then
18 elif expr $YEAR ">" 90 >/dev/null ; then
19 E2FSPROGS_YEAR=19$YEAR
21 E2FSPROGS_YEAR=20$YEAR
25 Jan) E2FSPROGS_MONTH="January" ;;
26 Feb) E2FSPROGS_MONTH="February" ;;
27 Mar) E2FSPROGS_MONTH="March" ;;
28 Apr) E2FSPROGS_MONTH="April" ;;
29 May) E2FSPROGS_MONTH="May" ;;
30 Jun) E2FSPROGS_MONTH="June" ;;
31 Jul) E2FSPROGS_MONTH="July" ;;
32 Aug) E2FSPROGS_MONTH="August" ;;
33 Sep) E2FSPROGS_MONTH="September" ;;
34 Oct) E2FSPROGS_MONTH="October" ;;
35 Nov) E2FSPROGS_MONTH="November" ;;
36 Dec) E2FSPROGS_MONTH="December" ;;
37 *) echo "Unknown month $MONTH??" ;;
41 echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION"
42 echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}"
43 AC_SUBST(E2FSPROGS_YEAR)
44 AC_SUBST(E2FSPROGS_MONTH)
45 AC_SUBST(E2FSPROGS_VERSION)
46 AC_REQUIRE([AC_CANONICAL_HOST])
48 dnl set $(CC) from --with-cc=value
51 [ --with-cc=COMPILER select compiler to use],
52 AC_MSG_RESULT(CC=$withval)
54 if test -z "$CC" ; then CC=cc; fi
55 [AC_MSG_RESULT(CC defaults to $CC)])dnl
59 dnl set $(LD) from --with-linker=value
62 [ --with-linker=LINKER select linker to use],
63 AC_MSG_RESULT(LD=$withval)
65 if test -z "$LD" ; then LD=$CC; fi
66 [AC_MSG_RESULT(LD defaults to $LD)])dnl
70 dnl set $(CCOPTS) from --with-ccopts=value
73 [ --with-ccopts=CCOPTS select compiler command line options],
74 AC_MSG_RESULT(CCOPTS is $withval)
76 CFLAGS="$CFLAGS $withval",
80 dnl Set default values for library extentions. Will be dealt with after
81 dnl parsing configuration opions, which may modify these
87 dnl set $(LDFLAGS) from --with-ldopts=value
90 [ --with-ldopts=LDOPTS select linker command line options],
91 AC_MSG_RESULT(LDFLAGS is $withval)
96 dnl Allow separate `root_prefix' to be specified
98 AC_ARG_WITH([root-prefix],
99 [ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
100 root_prefix=$withval,
103 dnl handle --enable-dll-shlibs
105 AC_ARG_ENABLE([dll-shlibs],
106 [ --enable-dll-shlibs select DLL libraries],
107 if test "$enableval" = "no"
110 MAKEFILE_DLL=/dev/null
111 echo "Disabling DLL shared libraries"
114 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
117 echo "Enabling DLL shared libraries"
120 MAKEFILE_DLL=/dev/null
122 echo "Disabling DLL shared libraries by default"
125 AC_SUBST_FILE(MAKEFILE_DLL)
127 dnl handle --enable-elf-shlibs
129 AC_ARG_ENABLE([elf-shlibs],
130 [ --enable-elf-shlibs select ELF shared libraries],
131 if test "$enableval" = "no"
134 MAKEFILE_ELF=/dev/null
135 echo "Disabling ELF shared libraries"
138 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
141 echo "Enabling ELF shared libraries"
144 MAKEFILE_ELF=/dev/null
146 echo "Disabling ELF shared libraries by default"
149 AC_SUBST_FILE(MAKEFILE_ELF)
151 dnl handle --enable-bsd-shlibs
153 AC_ARG_ENABLE([bsd-shlibs],
154 [ --enable-bsd-shlibs select BSD shared libraries],
155 if test "$enableval" = "no"
158 MAKEFILE_BSDLIB=/dev/null
159 echo "Disabling BSD shared libraries"
162 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
164 echo "Enabling BSD shared libraries"
167 MAKEFILE_BSDLIB=/dev/null
169 echo "Disabling BSD shared libraries by default"
172 AC_SUBST_FILE(MAKEFILE_BSDLIB)
174 dnl handle --enable-profile
176 AC_ARG_ENABLE([profile],
177 [ --enable-profile build profiling libraries],
178 if test "$enableval" = "no"
181 MAKEFILE_PROFILE=/dev/null
182 echo "Disabling profiling libraries"
185 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
186 PROFILED_LIB_EXT=_p.a
187 echo "Building profiling libraries"
191 MAKEFILE_PROFILE=/dev/null
192 echo "Disabling profiling libraries by default"
194 AC_SUBST(PROFILE_CMT)
195 AC_SUBST_FILE(MAKEFILE_PROFILE)
197 dnl handle --enable-checker
199 AC_ARG_ENABLE([checker],
200 [ --enable-checker build checker libraries],
201 if test "$enableval" = "no"
204 MAKEFILE_CHECKER=/dev/null
205 echo "Disabling checker libraries"
208 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
209 echo "Building checker libraries"
213 MAKEFILE_CHECKER=/dev/null
214 echo "Disabling checker libraries by default"
216 AC_SUBST(CHECKER_CMT)
217 AC_SUBST_FILE(MAKEFILE_CHECKER)
219 dnl Substitute library extensions
222 AC_SUBST(STATIC_LIB_EXT)
223 AC_SUBST(PROFILED_LIB_EXT)
225 dnl handle --enable-gcc-wall
227 AC_ARG_ENABLE([gcc-wall],
228 [ --enable-gcc-wall enable GCC anal warnings (DON'T USE IN PRODUCTION)],
229 if test "$enableval" = "no"
232 echo "Disabling GCC warnings"
235 echo "Enabling GCC warnings"
239 echo "Disabling GCC warnings by default"
242 AC_ARG_ENABLE([dynamic-e2fsck],
243 [ --enable-dynamic-e2fsck build e2fsck dynamically],
244 if test "$enableval" = "no"
247 echo "Building e2fsck statically"
250 echo "Building e2fsck dynamically"
254 echo "Building e2fsck statically by default"
256 AC_SUBST(E2FSCK_TYPE)
258 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
260 AC_ARG_ENABLE([fsck],
261 [ --enable-fsck build fsck wrapper program],
262 [if test "$enableval" = "no"
264 FSCK_PROG='' FSCK_MAN=''
265 echo "Not building fsck wrapper"
267 FSCK_PROG=fsck FSCK_MAN=fsck.8
268 echo "Building fsck wrapper"
273 FSCK_PROG='' FSCK_MAN=''
274 echo "Not building fsck wrapper by default"
277 FSCK_PROG=fsck FSCK_MAN=fsck.8
278 echo "Building fsck wrapper by default"
285 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
286 AC_SUBST_FILE(MAKEFILE_LIBRARY)
289 AC_ARG_ENABLE([old-bitops],
290 [ --enable-old-bitops Use old (non-standard but native) bitmask operations],
291 if test "$enableval" = "no"
293 echo "Using new (standard) bitmask operations"
295 AC_DEFINE(EXT2_OLD_BITOPS)
296 echo "Using old (native) bitmask operations"
300 echo "Using standard bitmask operations by default"
303 dnl End of configuration options
305 AC_SUBST(BINARY_TYPE)
307 AC_PATH_PROG(LN, ln, ln)
309 AC_PATH_PROG(MV, mv, mv)
310 AC_PATH_PROG(CP, cp, cp)
311 AC_PATH_PROG(RM, rm, rm)
312 AC_PATH_PROG(CHMOD, chmod, :)
313 AC_PATH_PROG(AWK, awk, awk)
314 AC_PATH_PROG(SED, sed, sed)
315 AC_CHECK_TOOL(AR, ar, ar)
316 AC_CHECK_TOOL(RANLIB, ranlib, :)
317 AC_CHECK_TOOL(STRIP, strip, :)
321 AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h mntent.h paths.h dirent.h getopt.h setjmp.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)
324 dnl See if struct dirent has a d_namlen field (like bsd systems), implying
325 dnl that the actual length of the structure may be grater than the declared
328 AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
329 AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
331 [#include <sys/types.h>
332 #include <dirent.h>],
333 [struct dirent de; de.d_namlen = 0;],
334 [e2fsprogs_cv_struct_d_namlen=yes],
335 [e2fsprogs_cv_struct_d_namlen=no]))
336 AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
337 if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
338 AC_DEFINE(HAVE_DIRENT_NAMLEN)
341 dnl Check to see if llseek() is declared in unistd.h. On some libc's
342 dnl it is, and on others it isn't..... Thank you glibc developers....
344 dnl Warning! Use of --enable-gcc-wall may throw off this test.
347 AC_MSG_CHECKING(whether llseek declared in unistd.h)
348 AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
350 [#include <unistd.h>], [extern int llseek(int);],
351 [e2fsprogs_cv_have_llseek_prototype=no],
352 [e2fsprogs_cv_have_llseek_prototype=yes]))
353 AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
354 if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
355 AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
360 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
361 # if cross-compiling, with no cached values, just assume something common.
365 ac_cv_sizeof_long_long=0
366 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4])
368 AC_CHECK_SIZEOF(short)
370 AC_CHECK_SIZEOF(long)
371 AC_CHECK_SIZEOF(long long)
372 SIZEOF_SHORT=$ac_cv_sizeof_short
373 SIZEOF_INT=$ac_cv_sizeof_int
374 SIZEOF_LONG=$ac_cv_sizeof_long
375 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
376 AC_SUBST(SIZEOF_SHORT)
378 AC_SUBST(SIZEOF_LONG)
379 AC_SUBST(SIZEOF_LONG_LONG)
381 dnl See if struct stat has a st_flags field, in which case we can get file
382 dnl flags somewhat portably. Also check for the analogous setter, chflags().
384 AC_MSG_CHECKING(whether struct stat has a st_flags field)
385 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
386 AC_TRY_COMPILE([#include <sys/stat.h>],
387 [struct stat stat; stat.st_flags = 0;],
388 [e2fsprogs_cv_struct_st_flags=yes],
389 [e2fsprogs_cv_struct_st_flags=no]))
390 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
391 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
392 AC_DEFINE(HAVE_STAT_FLAGS)
394 AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo strcasecmp srandom fchown)
396 dnl Check to see if ino_t is defined
398 AC_MSG_CHECKING(ino_t defined by sys/types.h)
399 AC_CACHE_VAL(e2fsprogs_cv_ino_t,
400 AC_TRY_COMPILE([#include <sys/types.h>],
401 [ino_t ino; ino = 0;],
402 [e2fsprogs_cv_ino_t=yes],
403 [e2fsprogs_cv_ino_t=no]))
404 AC_MSG_RESULT($e2fsprogs_cv_ino_t)
405 if test "$e2fsprogs_cv_ino_t" = yes; then
406 AC_DEFINE(HAVE_INO_T)
409 dnl On systems without linux header files, we add an extra include directory
410 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
411 dnl is quoted so that it gets expanded by make, not by configure.
413 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
414 if test "$linux_headers" = yes; then
415 AC_DEFINE(HAVE_LINUX_FS_H)
417 LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
418 # Use this include directory with test compiles in the configure script too.
419 CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
421 AC_SUBST(LINUX_INCLUDE)
423 dnl Check to see if -lsocket is required (solaris) to make something
424 dnl that uses socket() to compile; this is needed for the UUID library
427 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
430 dnl See if optreset exists
432 AC_MSG_CHECKING(for optreset)
433 AC_CACHE_VAL(ac_cv_have_optreset,
434 [AC_EGREP_HEADER(optreset, unistd.h,
435 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
436 AC_MSG_RESULT($ac_cv_have_optreset)
437 if test $ac_cv_have_optreset = yes; then
438 AC_DEFINE(HAVE_OPTRESET)
441 dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
443 AC_MSG_CHECKING(whether the ext2 ioctls compile)
444 AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
445 AC_TRY_COMPILE([#include <linux/ext2_fs.h>
446 #include <sys/ioctl.h>],
447 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
448 [e2fsprogs_cv_ioctl_ext2=yes],
449 [e2fsprogs_cv_ioctl_ext2=no]))
450 AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
451 if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
452 AC_DEFINE(HAVE_EXT2_IOCTLS)
455 dnl Linux places root files in the / by default
459 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
461 echo "On $host_os systems, root_prefix defaults to ''"
466 dnl On Linux/hurd, force the prefix to be /usr
470 if test "$prefix" = NONE ; then
472 echo "On $host_os systems, prefix defaults to /usr"
476 if test "$root_prefix" = NONE ; then
477 if test "$prefix" = NONE ; then
478 root_prefix="$ac_default_prefix"
480 root_prefix="$prefix"
483 AC_SUBST(root_prefix)
485 dnl See if -static works.
487 AC_MSG_CHECKING([whether linker accepts -static])
488 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
489 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
490 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
491 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
492 LDFLAGS=$SAVE_LDFLAGS])
494 dnl Regardless of how the test turns out, Solaris doesn't handle -static
495 dnl This is caused by the socket library requiring the nsl library, which
496 dnl requires the -dl library, which only works for dynamically linked
497 dnl programs. It basically means you can't have statically linked programs
498 dnl which use the network under Solaris.
502 ac_cv_e2fsprogs_use_static=no
505 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
507 if test $ac_cv_e2fsprogs_use_static = yes; then
508 LDFLAG_STATIC=-static
510 AC_SUBST(LDFLAG_STATIC)
512 dnl Make the ss and et directories work correctly.
514 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
515 ET_DIR=`cd ${srcdir}/lib/et; pwd`
519 dnl Only try to run the test suite if we're not cross compiling.
521 if test "$cross_compiling" = yes ; then
526 AC_SUBST(DO_TEST_SUITE)
530 DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute
531 AC_SUBST_FILE(DO_SUBSTITUTE_SCRIPT)
533 dnl Make our output files, being sure that we create the some miscellaneous
536 test -d lib || mkdir lib
537 test -d include || mkdir include
538 test -d include/linux || mkdir include/linux
539 test -d include/asm || mkdir include/asm
541 if test -d ${srcdir}/resize ; then
542 rmakefile=resize/Makefile
544 AC_OUTPUT(MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile
545 lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile
546 misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile
547 tests/progs/Makefile $rmakefile doc/Makefile)