Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 1 | AC_INIT(version.h) |
| 2 | MCONFIG=./MCONFIG |
| 3 | AC_SUBST_FILE(MCONFIG) |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame^] | 4 | BINARY_TYPE=bin |
| 5 | dnl |
| 6 | dnl This is to figure out the version number and the date.... |
| 7 | dnl |
| 8 | E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \ |
| 9 | | awk '{print $3}' | tr \" " " | awk '{print $1}'` |
| 10 | DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \ |
| 11 | | tr \" " "` |
| 12 | MONTH=`echo $DATE | awk -F- '{print $2}'` |
| 13 | YEAR=`echo $DATE | awk -F- '{print $3}'` |
| 14 | |
| 15 | if expr $YEAR ">" 90 >/dev/null ; then |
| 16 | E2FSPROGS_YEAR=19$YEAR |
| 17 | else |
| 18 | E2FSPROGS_YEAR=20$YEAR |
| 19 | fi |
| 20 | |
| 21 | case $MONTH in |
| 22 | Jan) E2FSPROGS_MONTH="January" ;; |
| 23 | Feb) E2FSPROGS_MONTH="February" ;; |
| 24 | Mar) E2FSPROGS_MONTH="March" ;; |
| 25 | Apr) E2FSPROGS_MONTH="April" ;; |
| 26 | May) E2FSPROGS_MONTH="May" ;; |
| 27 | Jun) E2FSPROGS_MONTH="June" ;; |
| 28 | Jul) E2FSPROGS_MONTH="July" ;; |
| 29 | Aug) E2FSPROGS_MONTH="August" ;; |
| 30 | Sep) E2FSPROGS_MONTH="September" ;; |
| 31 | Oct) E2FSPROGS_MONTH="October" ;; |
| 32 | Nov) E2FSPROGS_MONTH="November" ;; |
| 33 | Dec) E2FSPROGS_MONTH="December" ;; |
| 34 | *) echo "Unknown month $MONTH??" ;; |
| 35 | esac |
| 36 | |
| 37 | unset DATE MONTH YEAR |
| 38 | echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION" |
| 39 | echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}" |
| 40 | AC_SUBST(E2FSPROGS_YEAR) |
| 41 | AC_SUBST(E2FSPROGS_MONTH) |
| 42 | AC_SUBST(E2FSPROGS_VERSION) |
| 43 | dnl |
| 44 | dnl set $(CC) from --with-cc=value |
| 45 | dnl |
| 46 | AC_ARG_WITH([cc], |
| 47 | [ --with-cc=COMPILER select compiler to use], |
| 48 | AC_MSG_RESULT(CC=$withval) |
| 49 | CC=$withval, |
| 50 | if test -z "$CC" ; then CC=cc; fi |
| 51 | [AC_MSG_RESULT(CC defaults to $CC)])dnl |
| 52 | export CC |
| 53 | AC_SUBST([CC]) |
| 54 | dnl |
| 55 | dnl set $(LD) from --with-linker=value |
| 56 | dnl |
| 57 | AC_ARG_WITH([linker], |
| 58 | [ --with-linker=LINKER select linker to use], |
| 59 | AC_MSG_RESULT(LD=$withval) |
| 60 | LD=$withval, |
| 61 | if test -z "$LD" ; then LD=$CC; fi |
| 62 | [AC_MSG_RESULT(LD defaults to $LD)])dnl |
| 63 | export LD |
| 64 | AC_SUBST([LD]) |
| 65 | dnl |
| 66 | dnl set $(CCOPTS) from --with-ccopts=value |
| 67 | dnl |
| 68 | AC_ARG_WITH([ccopts], |
| 69 | [ --with-ccopts=CCOPTS select compiler command line options], |
| 70 | AC_MSG_RESULT(CCOPTS is $withval) |
| 71 | CCOPTS=$withval |
| 72 | CFLAGS="$CFLAGS $withval", |
| 73 | CCOPTS=)dnl |
| 74 | AC_SUBST(CCOPTS) |
| 75 | dnl |
| 76 | dnl set $(LDFLAGS) from --with-ldopts=value |
| 77 | dnl |
| 78 | AC_ARG_WITH([ldopts], |
| 79 | [ --with-ldopts=LDOPTS select linker command line options], |
| 80 | AC_MSG_RESULT(LDFLAGS is $withval) |
| 81 | LDFLAGS=$withval, |
| 82 | LDFLAGS=)dnl |
| 83 | AC_SUBST(LDFLAGS) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 84 | dnl |
| 85 | dnl handle --enable-dll-shlibs |
| 86 | dnl |
| 87 | AC_ARG_ENABLE([dll-shlibs], |
| 88 | [ --enable-dll-shlibs select DLL libraries], |
| 89 | if test "$enableval" = "no" |
| 90 | then |
| 91 | DLL_CMT=# |
| 92 | MAKEFILE_DLL=/dev/null |
| 93 | echo "Disabling DLL shared libraries" |
| 94 | else |
| 95 | DLL_CMT= |
| 96 | MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame^] | 97 | BINARY_TYPE=dllbin |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 98 | echo "Enabling DLL shared libraries" |
| 99 | fi |
| 100 | , |
| 101 | MAKEFILE_DLL=/dev/null |
| 102 | DLL_CMT=# |
| 103 | echo "Disabling DLL shared libraries by default" |
| 104 | ) |
| 105 | AC_SUBST(DLL_CMT) |
| 106 | AC_SUBST_FILE(MAKEFILE_DLL) |
| 107 | dnl |
| 108 | dnl handle --enable-elf-shlibs |
| 109 | dnl |
| 110 | AC_ARG_ENABLE([elf-shlibs], |
| 111 | [ --enable-elf-shlibs select ELF shared libraries], |
| 112 | if test "$enableval" = "no" |
| 113 | then |
| 114 | ELF_CMT=# |
| 115 | MAKEFILE_ELF=/dev/null |
| 116 | echo "Disabling ELF shared libraries" |
| 117 | else |
| 118 | ELF_CMT= |
| 119 | MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame^] | 120 | BINARY_TYPE=elfbin |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 121 | echo "Enabling ELF shared libraries" |
| 122 | fi |
| 123 | , |
| 124 | MAKEFILE_ELF=/dev/null |
| 125 | ELF_CMT=# |
| 126 | echo "Disabling ELF shared libraries by default" |
| 127 | ) |
| 128 | AC_SUBST(ELF_CMT) |
| 129 | AC_SUBST_FILE(MAKEFILE_ELF) |
| 130 | dnl |
| 131 | dnl handle --enable-bsd-shlibs |
| 132 | dnl |
| 133 | AC_ARG_ENABLE([bsd-shlibs], |
| 134 | [ --enable-bsd-shlibs select BSD shared libraries], |
| 135 | if test "$enableval" = "no" |
| 136 | then |
| 137 | BSDLIB_CMT=# |
| 138 | MAKEFILE_BSDLIB=/dev/null |
| 139 | echo "Disabling BSD shared libraries" |
| 140 | else |
| 141 | BSDLIB_CMT= |
| 142 | MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib |
| 143 | echo "Enabling BSD shared libraries" |
| 144 | fi |
| 145 | , |
| 146 | MAKEFILE_BSDLIB=/dev/null |
| 147 | BSDLIB_CMT=# |
| 148 | echo "Disabling BSD shared libraries by default" |
| 149 | ) |
| 150 | AC_SUBST(BSDLIB_CMT) |
| 151 | AC_SUBST_FILE(MAKEFILE_BSDLIB) |
| 152 | dnl |
| 153 | dnl handle --enable-profile |
| 154 | dnl |
| 155 | AC_ARG_ENABLE([profile], |
| 156 | [ --enable-profile build profiling libraries], |
| 157 | if test "$enableval" = "no" |
| 158 | then |
| 159 | PROFILE_CMT=# |
| 160 | MAKEFILE_PROFILE=/dev/null |
| 161 | echo "Disabling profiling libraries" |
| 162 | else |
| 163 | PROFILE_CMT= |
| 164 | MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile |
| 165 | echo "Building profiling libraries" |
| 166 | fi |
| 167 | , |
| 168 | PROFILE_CMT=# |
| 169 | MAKEFILE_PROFILE=/dev/null |
| 170 | echo "Disabling profiling libraries by default" |
| 171 | ) |
| 172 | AC_SUBST(PROFILE_CMT) |
| 173 | AC_SUBST_FILE(MAKEFILE_PROFILE) |
| 174 | dnl |
| 175 | dnl handle --enable-checker |
| 176 | dnl |
| 177 | AC_ARG_ENABLE([checker], |
| 178 | [ --enable-checker build checker libraries], |
| 179 | if test "$enableval" = "no" |
| 180 | then |
| 181 | CHECKER_CMT=# |
| 182 | MAKEFILE_CHECKER=/dev/null |
| 183 | echo "Disabling checker libraries" |
| 184 | else |
| 185 | CHECKER_CMT= |
| 186 | MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker |
| 187 | echo "Building checker libraries" |
| 188 | fi |
| 189 | , |
| 190 | CHECKER_CMT=# |
| 191 | MAKEFILE_CHECKER=/dev/null |
| 192 | echo "Disabling checker libraries by default" |
| 193 | ) |
| 194 | AC_SUBST(CHECKER_CMT) |
| 195 | AC_SUBST_FILE(MAKEFILE_CHECKER) |
| 196 | dnl |
| 197 | dnl handle --enable-gcc-wall |
| 198 | dnl |
| 199 | AC_ARG_ENABLE([gcc-wall], |
| 200 | [ --enable-gcc-wall enable GCC anal warnings], |
| 201 | if test "$enableval" = "no" |
| 202 | then |
| 203 | W=# |
| 204 | echo "Disabling GCC warnings" |
| 205 | else |
| 206 | W= |
| 207 | echo "Enabling GCC warnings" |
| 208 | fi |
| 209 | , |
| 210 | W=# |
| 211 | echo "Disabling GCC warnings by default" |
| 212 | ) |
| 213 | AC_SUBST(W) |
| 214 | dnl |
| 215 | dnl |
| 216 | MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library |
| 217 | AC_SUBST_FILE(MAKEFILE_LIBRARY) |
| 218 | dnl |
| 219 | dnl End of configuration options |
| 220 | dnl |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame^] | 221 | AC_SUBST(BINARY_TYPE) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 222 | AC_PROG_MAKE_SET |
| 223 | AC_PATH_PROG(LN, ln, ln) |
| 224 | AC_PATH_PROG(MV, mv, mv) |
| 225 | AC_PATH_PROG(CP, cp, cp) |
| 226 | AC_PATH_PROG(RM, rm, rm) |
| 227 | AC_PATH_PROG(CHMOD, chmod, :) |
| 228 | AC_PATH_PROG(AWK, awk, awk) |
| 229 | AC_PATH_PROG(SED, sed, sed) |
| 230 | AC_CHECK_TOOL(AR, ar, ar) |
| 231 | AC_CHECK_TOOL(RANLIB, ranlib, :) |
| 232 | AC_CHECK_TOOL(STRIP, strip, :) |
| 233 | AC_PROG_CC |
| 234 | AC_PROG_INSTALL |
| 235 | AC_C_CROSS |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame^] | 236 | AC_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'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 237 | AC_FUNC_VPRINTF |
| 238 | dnl |
| 239 | dnl See if struct dirent has a d_namlen field (like bsd systems), implying |
| 240 | dnl that the actual length of the structure may be grater than the declared |
| 241 | dnl length. |
| 242 | dnl |
| 243 | AC_MSG_CHECKING(whether struct dirent has a d_namlen field) |
| 244 | AC_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])) |
| 251 | AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen) |
| 252 | if test "$e2fsprogs_cv_struct_d_namlen" = yes; then |
| 253 | AC_DEFINE(HAVE_DIRENT_NAMLEN) |
| 254 | fi |
| 255 | dnl |
| 256 | dnl Word sizes... |
| 257 | dnl |
| 258 | if 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]) |
| 264 | fi |
| 265 | AC_CHECK_SIZEOF(short) |
| 266 | AC_CHECK_SIZEOF(int) |
| 267 | AC_CHECK_SIZEOF(long) |
| 268 | SIZEOF_SHORT=$ac_cv_sizeof_short |
| 269 | SIZEOF_INT=$ac_cv_sizeof_int |
| 270 | SIZEOF_LONG=$ac_cv_sizeof_long |
| 271 | AC_SUBST(SIZEOF_SHORT) |
| 272 | AC_SUBST(SIZEOF_INT) |
| 273 | AC_SUBST(SIZEOF_LONG) |
| 274 | dnl |
| 275 | dnl See if struct stat has a st_flags field, in which case we can get file |
| 276 | dnl flags somewhat portably. Also check for the analogous setter, chflags(). |
| 277 | dnl |
| 278 | AC_MSG_CHECKING(whether struct stat has a st_flags field) |
| 279 | AC_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])) |
| 284 | AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags) |
| 285 | if test "$e2fsprogs_cv_struct_st_flags" = yes; then |
| 286 | AC_DEFINE(HAVE_STAT_FLAGS) |
| 287 | fi |
| 288 | AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo) |
| 289 | dnl |
| 290 | dnl On systems without linux header files, we add an extra include directory |
| 291 | dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here |
| 292 | dnl is quoted so that it gets expanded by make, not by configure. |
| 293 | dnl |
| 294 | AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no]) |
| 295 | AC_SUBST(EXTRA_PROGS) |
| 296 | if 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" |
| 301 | else |
| 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" |
| 305 | fi |
| 306 | AC_SUBST(LINUX_INCLUDE) |
| 307 | dnl |
| 308 | dnl See if optreset exists |
| 309 | dnl |
| 310 | AC_MSG_CHECKING(for optreset) |
| 311 | AC_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 |
| 314 | AC_MSG_RESULT($ac_cv_have_optreset) |
| 315 | if test $ac_cv_have_optreset = yes; then |
| 316 | AC_DEFINE(HAVE_OPTRESET) |
| 317 | fi |
| 318 | dnl |
| 319 | dnl See if our system has frags enabled (at least in the header file) |
| 320 | dnl |
| 321 | AC_MSG_CHECKING(whether struct ext2_inode has frags fields) |
| 322 | AC_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])) |
| 327 | AC_MSG_RESULT($e2fsprogs_cv_struct_ext2_inode_frags) |
| 328 | if test "$e2fsprogs_cv_struct_ext2_inode_frags" = yes; then |
| 329 | AC_DEFINE(HAVE_EXT2_FRAGS) |
| 330 | fi |
| 331 | dnl |
| 332 | dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd). |
| 333 | dnl |
| 334 | AC_MSG_CHECKING(whether the ext2 ioctls compile) |
| 335 | AC_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])) |
| 341 | AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2) |
| 342 | if test "$e2fsprogs_cv_ioctl_ext2" = yes; then |
| 343 | AC_DEFINE(HAVE_EXT2_IOCTLS) |
| 344 | fi |
| 345 | dnl |
| 346 | dnl On linux, force the prefix to be '/' |
| 347 | dnl |
| 348 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 349 | case "$host_os" in |
| 350 | linux*) |
| 351 | if test "$prefix" = NONE ; then |
| 352 | prefix='/'; |
| 353 | echo "On Linux systems, prefix defaults to '/'" |
| 354 | fi |
| 355 | ;; |
| 356 | esac |
| 357 | dnl |
| 358 | dnl See if -static works. |
| 359 | dnl XXX for now, assume that only Linux systems support -static |
| 360 | dnl |
| 361 | AC_REQUIRE([AC_CANONICAL_HOST]) |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame^] | 362 | LDFLAG_STATIC= |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 363 | case "$host_os" in |
| 364 | linux*) |
| 365 | LDFLAG_STATIC=-static |
| 366 | echo "On Linux systems, assume -static works" |
| 367 | ;; |
| 368 | esac |
| 369 | AC_SUBST(LDFLAG_STATIC) |
| 370 | dnl |
| 371 | dnl Check to see if prefix is '/' |
| 372 | dnl |
| 373 | if test "$prefix" = / ; then |
| 374 | usr_prefix=/usr |
| 375 | else |
| 376 | usr_prefix="\${prefix}" |
| 377 | fi |
| 378 | AC_SUBST(usr_prefix) |
| 379 | dnl |
| 380 | dnl Make the ss and et directories work correctly. |
| 381 | dnl |
| 382 | SS_DIR=`cd ${srcdir}/lib/ss; pwd` |
| 383 | ET_DIR=`cd ${srcdir}/lib/et; pwd` |
| 384 | AC_SUBST(SS_DIR) |
| 385 | AC_SUBST(ET_DIR) |
| 386 | dnl |
| 387 | dnl Only try to run the test suite if we're not cross compiling. |
| 388 | dnl |
| 389 | if test "$cross_compiling" = yes ; then |
| 390 | DO_TEST_SUITE= |
| 391 | else |
| 392 | DO_TEST_SUITE=check |
| 393 | fi |
| 394 | AC_SUBST(DO_TEST_SUITE) |
| 395 | dnl |
| 396 | dnl Make our output files, being sure that we create the some miscellaneous |
| 397 | dnl directories |
| 398 | dnl |
| 399 | test -d lib || mkdir lib |
| 400 | test -d include || mkdir include |
| 401 | test -d include/linux || mkdir include/linux |
| 402 | AC_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'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame^] | 405 | 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) |