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
60 dnl set $(LD) from --with-linker=value
63 [ --with-linker=LINKER select linker to use],
64 AC_MSG_RESULT(LD=$withval)
66 if test -z "$LD" ; then LD=$CC; fi
67 [AC_MSG_RESULT(LD defaults to $LD)])dnl
71 dnl set $(CCOPTS) from --with-ccopts=value
74 [ --with-ccopts=CCOPTS select compiler command line options],
75 AC_MSG_RESULT(CCOPTS is $withval)
77 CFLAGS="$CFLAGS $withval",
81 dnl On systems without linux header files, we add an extra include directory
82 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
83 dnl is quoted so that it gets expanded by make, not by configure.
85 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
86 if test "$linux_headers" != yes; then
87 LINUX_INCLUDE='-I$(top_builddir)/include'
89 AC_SUBST(LINUX_INCLUDE)
91 dnl Set default values for library extentions. Will be dealt with after
92 dnl parsing configuration opions, which may modify these
98 dnl set $(LDFLAGS) from --with-ldopts=value
100 AC_ARG_WITH([ldopts],
101 [ --with-ldopts=LDOPTS select linker command line options],
102 AC_MSG_RESULT(LDFLAGS is $withval)
107 dnl Allow separate `root_prefix' to be specified
109 AC_ARG_WITH([root-prefix],
110 [ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
111 root_prefix=$withval,
114 dnl handle --enable-dll-shlibs
116 AC_ARG_ENABLE([dll-shlibs],
117 [ --enable-dll-shlibs select DLL libraries],
118 if test "$enableval" = "no"
121 MAKEFILE_DLL=/dev/null
122 echo "Disabling DLL shared libraries"
125 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
128 echo "Enabling DLL shared libraries"
131 MAKEFILE_DLL=/dev/null
133 echo "Disabling DLL shared libraries by default"
136 AC_SUBST_FILE(MAKEFILE_DLL)
138 dnl handle --enable-elf-shlibs
140 AC_ARG_ENABLE([elf-shlibs],
141 [ --enable-elf-shlibs select ELF shared libraries],
142 if test "$enableval" = "no"
145 MAKEFILE_ELF=/dev/null
146 echo "Disabling ELF shared libraries"
149 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
152 echo "Enabling ELF shared libraries"
155 MAKEFILE_ELF=/dev/null
157 echo "Disabling ELF shared libraries by default"
160 AC_SUBST_FILE(MAKEFILE_ELF)
162 dnl handle --enable-bsd-shlibs
164 AC_ARG_ENABLE([bsd-shlibs],
165 [ --enable-bsd-shlibs select BSD shared libraries],
166 if test "$enableval" = "no"
169 MAKEFILE_BSDLIB=/dev/null
170 echo "Disabling BSD shared libraries"
173 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
175 echo "Enabling BSD shared libraries"
178 MAKEFILE_BSDLIB=/dev/null
180 echo "Disabling BSD shared libraries by default"
183 AC_SUBST_FILE(MAKEFILE_BSDLIB)
185 dnl Add internationalization support, using gettext.
188 VERSION="$E2FSPROGS_VERSION"
189 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
190 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
197 dnl handle --enable-profile
199 AC_ARG_ENABLE([profile],
200 [ --enable-profile build profiling libraries],
201 if test "$enableval" = "no"
204 MAKEFILE_PROFILE=/dev/null
205 echo "Disabling profiling libraries"
208 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
209 PROFILED_LIB_EXT=_p.a
210 echo "Building profiling libraries"
214 MAKEFILE_PROFILE=/dev/null
215 echo "Disabling profiling libraries by default"
217 AC_SUBST(PROFILE_CMT)
218 AC_SUBST_FILE(MAKEFILE_PROFILE)
220 dnl handle --enable-checker
222 AC_ARG_ENABLE([checker],
223 [ --enable-checker build checker libraries],
224 if test "$enableval" = "no"
227 MAKEFILE_CHECKER=/dev/null
228 echo "Disabling checker libraries"
231 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
232 echo "Building checker libraries"
236 MAKEFILE_CHECKER=/dev/null
237 echo "Disabling checker libraries by default"
239 AC_SUBST(CHECKER_CMT)
240 AC_SUBST_FILE(MAKEFILE_CHECKER)
242 dnl Substitute library extensions
245 AC_SUBST(STATIC_LIB_EXT)
246 AC_SUBST(PROFILED_LIB_EXT)
248 dnl handle --enable-gcc-wall
250 AC_ARG_ENABLE([gcc-wall],
251 [ --enable-gcc-wall enable GCC anal warnings (DON'T USE IN PRODUCTION)],
252 if test "$enableval" = "no"
255 echo "Disabling GCC warnings"
258 echo "Enabling GCC warnings"
262 echo "Disabling GCC warnings by default"
265 AC_ARG_ENABLE([dynamic-e2fsck],
266 [ --enable-dynamic-e2fsck build e2fsck dynamically],
267 if test "$enableval" = "no"
270 echo "Building e2fsck statically"
273 echo "Building e2fsck dynamically"
277 echo "Building e2fsck statically by default"
279 AC_SUBST(E2FSCK_TYPE)
281 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
283 AC_ARG_ENABLE([fsck],
284 [ --enable-fsck build fsck wrapper program],
285 [if test "$enableval" = "no"
287 FSCK_PROG='' FSCK_MAN=''
288 echo "Not building fsck wrapper"
290 FSCK_PROG=fsck FSCK_MAN=fsck.8
291 echo "Building fsck wrapper"
296 FSCK_PROG='' FSCK_MAN=''
297 echo "Not building fsck wrapper by default"
300 FSCK_PROG=fsck FSCK_MAN=fsck.8
301 echo "Building fsck wrapper by default"
308 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
309 AC_SUBST_FILE(MAKEFILE_LIBRARY)
312 AC_ARG_ENABLE([old-bitops],
313 [ --enable-old-bitops Use old (non-standard but native) bitmask operations],
314 if test "$enableval" = "no"
316 echo "Using new (standard) bitmask operations"
318 AC_DEFINE(EXT2_OLD_BITOPS)
319 echo "Using old (native) bitmask operations"
323 echo "Using standard bitmask operations by default"
326 dnl End of configuration options
328 AC_SUBST(BINARY_TYPE)
330 AC_PATH_PROG(LN, ln, ln)
332 AC_PATH_PROG(MV, mv, mv)
333 AC_PATH_PROG(CP, cp, cp)
334 AC_PATH_PROG(RM, rm, rm)
335 AC_PATH_PROG(CHMOD, chmod, :)
336 AC_PATH_PROG(AWK, awk, awk)
337 AC_PATH_PROG(SED, sed, sed)
338 AC_PATH_PROG(PERL, perl, perl)
339 AC_CHECK_TOOL(AR, ar, ar)
340 AC_CHECK_TOOL(RANLIB, ranlib, :)
341 AC_CHECK_TOOL(STRIP, strip, :)
343 # See if we need a separate native compiler.
344 if test $cross_compiling = no; then
348 AC_CHECK_PROGS(BUILD_CC, gcc cc)
350 AC_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)
353 dnl See if struct dirent has a d_namlen field (like bsd systems), implying
354 dnl that the actual length of the structure may be grater than the declared
357 AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
358 AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
360 [#include <sys/types.h>
361 #include <dirent.h>],
362 [struct dirent de; de.d_namlen = 0;],
363 [e2fsprogs_cv_struct_d_namlen=yes],
364 [e2fsprogs_cv_struct_d_namlen=no]))
365 AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
366 if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
367 AC_DEFINE(HAVE_DIRENT_NAMLEN)
370 dnl Check to see if llseek() is declared in unistd.h. On some libc's
371 dnl it is, and on others it isn't..... Thank you glibc developers....
373 dnl Warning! Use of --enable-gcc-wall may throw off this test.
376 AC_MSG_CHECKING(whether llseek declared in unistd.h)
377 AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
379 [#include <unistd.h>], [extern int llseek(int);],
380 [e2fsprogs_cv_have_llseek_prototype=no],
381 [e2fsprogs_cv_have_llseek_prototype=yes]))
382 AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
383 if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
384 AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
389 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
390 # if cross-compiling, with no cached values, just assume something common.
394 ac_cv_sizeof_long_long=8
395 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4, long long=8])
397 AC_CHECK_SIZEOF(short)
399 AC_CHECK_SIZEOF(long)
400 AC_CHECK_SIZEOF(long long)
401 SIZEOF_SHORT=$ac_cv_sizeof_short
402 SIZEOF_INT=$ac_cv_sizeof_int
403 SIZEOF_LONG=$ac_cv_sizeof_long
404 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
405 AC_SUBST(SIZEOF_SHORT)
407 AC_SUBST(SIZEOF_LONG)
408 AC_SUBST(SIZEOF_LONG_LONG)
410 dnl See if struct stat has a st_flags field, in which case we can get file
411 dnl flags somewhat portably. Also check for the analogous setter, chflags().
413 AC_MSG_CHECKING(whether struct stat has a st_flags field)
414 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
415 AC_TRY_COMPILE([#include <sys/stat.h>],
416 [struct stat stat; stat.st_flags = 0;],
417 [e2fsprogs_cv_struct_st_flags=yes],
418 [e2fsprogs_cv_struct_st_flags=no]))
419 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
420 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
421 AC_MSG_CHECKING(whether st_flags field is useful)
422 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
423 AC_TRY_COMPILE([#include <sys/stat.h>],
424 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
425 [e2fsprogs_cv_struct_st_flags_immut=yes],
426 [e2fsprogs_cv_struct_st_flags_immut=no]))
427 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
428 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
429 AC_DEFINE(HAVE_STAT_FLAGS)
432 AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo strcasecmp srandom fchown mallinfo)
434 dnl Check to see if ino_t is defined
436 AC_MSG_CHECKING(ino_t defined by sys/types.h)
437 AC_CACHE_VAL(e2fsprogs_cv_ino_t,
438 AC_TRY_COMPILE([#include <sys/types.h>],
439 [ino_t ino; ino = 0;],
440 [e2fsprogs_cv_ino_t=yes],
441 [e2fsprogs_cv_ino_t=no]))
442 AC_MSG_RESULT($e2fsprogs_cv_ino_t)
443 if test "$e2fsprogs_cv_ino_t" = yes; then
444 AC_DEFINE(HAVE_INO_T)
447 dnl Check to see if -lsocket is required (solaris) to make something
448 dnl that uses socket() to compile; this is needed for the UUID library
451 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
454 dnl See if optreset exists
456 AC_MSG_CHECKING(for optreset)
457 AC_CACHE_VAL(ac_cv_have_optreset,
458 [AC_EGREP_HEADER(optreset, unistd.h,
459 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
460 AC_MSG_RESULT($ac_cv_have_optreset)
461 if test $ac_cv_have_optreset = yes; then
462 AC_DEFINE(HAVE_OPTRESET)
465 dnl See if using the EXT2 ioctls causes a compile-time barf (as on the Hurd).
467 AC_MSG_CHECKING(whether the ext2 ioctls compile)
468 AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
469 AC_TRY_COMPILE([#include <linux/ext2_fs.h>
470 #include <sys/ioctl.h>],
471 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
472 [e2fsprogs_cv_ioctl_ext2=yes],
473 [e2fsprogs_cv_ioctl_ext2=no]))
474 AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
475 if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
476 AC_DEFINE(HAVE_EXT2_IOCTLS)
479 dnl Linux and Hurd places root files in the / by default
483 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
485 echo "On $host_os systems, root_prefix defaults to ''"
490 dnl On Linux/hurd, force the prefix to be /usr
494 if test "$prefix" = NONE ; then
496 echo "On $host_os systems, prefix defaults to /usr"
500 if test "$root_prefix" = NONE ; then
501 if test "$prefix" = NONE ; then
502 root_prefix="$ac_default_prefix"
504 root_prefix="$prefix"
507 AC_SUBST(root_prefix)
509 dnl See if -static works.
511 AC_MSG_CHECKING([whether linker accepts -static])
512 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
513 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
514 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
515 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
516 LDFLAGS=$SAVE_LDFLAGS])
518 dnl Regardless of how the test turns out, Solaris doesn't handle -static
519 dnl This is caused by the socket library requiring the nsl library, which
520 dnl requires the -dl library, which only works for dynamically linked
521 dnl programs. It basically means you can't have statically linked programs
522 dnl which use the network under Solaris.
526 ac_cv_e2fsprogs_use_static=no
529 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
531 if test $ac_cv_e2fsprogs_use_static = yes; then
532 LDFLAG_STATIC=-static
534 AC_SUBST(LDFLAG_STATIC)
536 dnl Make the ss and et directories work correctly.
538 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
539 ET_DIR=`cd ${srcdir}/lib/et; pwd`
543 dnl Only try to run the test suite if we're not cross compiling.
545 if test "$cross_compiling" = yes ; then
550 AC_SUBST(DO_TEST_SUITE)
554 DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute
555 AC_SUBST_FILE(DO_SUBSTITUTE_SCRIPT)
557 dnl Make our output files, being sure that we create the some miscellaneous
560 test -d lib || mkdir lib
561 test -d include || mkdir include
562 test -d include/linux || mkdir include/linux
563 test -d include/asm || mkdir include/asm
565 if test -d ${srcdir}/resize ; then
566 rmakefile=resize/Makefile
568 AC_OUTPUT(MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile
569 lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile
570 misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile
571 tests/progs/Makefile $rmakefile doc/Makefile
572 intl/Makefile po/Makefile.in)