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) |
| 4 | dnl |
| 5 | dnl handle --enable-dll-shlibs |
| 6 | dnl |
| 7 | AC_ARG_ENABLE([dll-shlibs], |
| 8 | [ --enable-dll-shlibs select DLL libraries], |
| 9 | if test "$enableval" = "no" |
| 10 | then |
| 11 | DLL_CMT=# |
| 12 | MAKEFILE_DLL=/dev/null |
| 13 | echo "Disabling DLL shared libraries" |
| 14 | else |
| 15 | DLL_CMT= |
| 16 | MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib |
| 17 | echo "Enabling DLL shared libraries" |
| 18 | fi |
| 19 | , |
| 20 | MAKEFILE_DLL=/dev/null |
| 21 | DLL_CMT=# |
| 22 | echo "Disabling DLL shared libraries by default" |
| 23 | ) |
| 24 | AC_SUBST(DLL_CMT) |
| 25 | AC_SUBST_FILE(MAKEFILE_DLL) |
| 26 | dnl |
| 27 | dnl handle --enable-elf-shlibs |
| 28 | dnl |
| 29 | AC_ARG_ENABLE([elf-shlibs], |
| 30 | [ --enable-elf-shlibs select ELF shared libraries], |
| 31 | if test "$enableval" = "no" |
| 32 | then |
| 33 | ELF_CMT=# |
| 34 | MAKEFILE_ELF=/dev/null |
| 35 | echo "Disabling ELF shared libraries" |
| 36 | else |
| 37 | ELF_CMT= |
| 38 | MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib |
| 39 | echo "Enabling ELF shared libraries" |
| 40 | fi |
| 41 | , |
| 42 | MAKEFILE_ELF=/dev/null |
| 43 | ELF_CMT=# |
| 44 | echo "Disabling ELF shared libraries by default" |
| 45 | ) |
| 46 | AC_SUBST(ELF_CMT) |
| 47 | AC_SUBST_FILE(MAKEFILE_ELF) |
| 48 | dnl |
| 49 | dnl handle --enable-bsd-shlibs |
| 50 | dnl |
| 51 | AC_ARG_ENABLE([bsd-shlibs], |
| 52 | [ --enable-bsd-shlibs select BSD shared libraries], |
| 53 | if test "$enableval" = "no" |
| 54 | then |
| 55 | BSDLIB_CMT=# |
| 56 | MAKEFILE_BSDLIB=/dev/null |
| 57 | echo "Disabling BSD shared libraries" |
| 58 | else |
| 59 | BSDLIB_CMT= |
| 60 | MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib |
| 61 | echo "Enabling BSD shared libraries" |
| 62 | fi |
| 63 | , |
| 64 | MAKEFILE_BSDLIB=/dev/null |
| 65 | BSDLIB_CMT=# |
| 66 | echo "Disabling BSD shared libraries by default" |
| 67 | ) |
| 68 | AC_SUBST(BSDLIB_CMT) |
| 69 | AC_SUBST_FILE(MAKEFILE_BSDLIB) |
| 70 | dnl |
| 71 | dnl handle --enable-profile |
| 72 | dnl |
| 73 | AC_ARG_ENABLE([profile], |
| 74 | [ --enable-profile build profiling libraries], |
| 75 | if test "$enableval" = "no" |
| 76 | then |
| 77 | PROFILE_CMT=# |
| 78 | MAKEFILE_PROFILE=/dev/null |
| 79 | echo "Disabling profiling libraries" |
| 80 | else |
| 81 | PROFILE_CMT= |
| 82 | MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile |
| 83 | echo "Building profiling libraries" |
| 84 | fi |
| 85 | , |
| 86 | PROFILE_CMT=# |
| 87 | MAKEFILE_PROFILE=/dev/null |
| 88 | echo "Disabling profiling libraries by default" |
| 89 | ) |
| 90 | AC_SUBST(PROFILE_CMT) |
| 91 | AC_SUBST_FILE(MAKEFILE_PROFILE) |
| 92 | dnl |
| 93 | dnl handle --enable-checker |
| 94 | dnl |
| 95 | AC_ARG_ENABLE([checker], |
| 96 | [ --enable-checker build checker libraries], |
| 97 | if test "$enableval" = "no" |
| 98 | then |
| 99 | CHECKER_CMT=# |
| 100 | MAKEFILE_CHECKER=/dev/null |
| 101 | echo "Disabling checker libraries" |
| 102 | else |
| 103 | CHECKER_CMT= |
| 104 | MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker |
| 105 | echo "Building checker libraries" |
| 106 | fi |
| 107 | , |
| 108 | CHECKER_CMT=# |
| 109 | MAKEFILE_CHECKER=/dev/null |
| 110 | echo "Disabling checker libraries by default" |
| 111 | ) |
| 112 | AC_SUBST(CHECKER_CMT) |
| 113 | AC_SUBST_FILE(MAKEFILE_CHECKER) |
| 114 | dnl |
| 115 | dnl handle --enable-gcc-wall |
| 116 | dnl |
| 117 | AC_ARG_ENABLE([gcc-wall], |
| 118 | [ --enable-gcc-wall enable GCC anal warnings], |
| 119 | if test "$enableval" = "no" |
| 120 | then |
| 121 | W=# |
| 122 | echo "Disabling GCC warnings" |
| 123 | else |
| 124 | W= |
| 125 | echo "Enabling GCC warnings" |
| 126 | fi |
| 127 | , |
| 128 | W=# |
| 129 | echo "Disabling GCC warnings by default" |
| 130 | ) |
| 131 | AC_SUBST(W) |
| 132 | dnl |
| 133 | dnl |
| 134 | MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library |
| 135 | AC_SUBST_FILE(MAKEFILE_LIBRARY) |
| 136 | dnl |
| 137 | dnl End of configuration options |
| 138 | dnl |
| 139 | AC_PROG_MAKE_SET |
| 140 | AC_PATH_PROG(LN, ln, ln) |
| 141 | AC_PATH_PROG(MV, mv, mv) |
| 142 | AC_PATH_PROG(CP, cp, cp) |
| 143 | AC_PATH_PROG(RM, rm, rm) |
| 144 | AC_PATH_PROG(CHMOD, chmod, :) |
| 145 | AC_PATH_PROG(AWK, awk, awk) |
| 146 | AC_PATH_PROG(SED, sed, sed) |
| 147 | AC_CHECK_TOOL(AR, ar, ar) |
| 148 | AC_CHECK_TOOL(RANLIB, ranlib, :) |
| 149 | AC_CHECK_TOOL(STRIP, strip, :) |
| 150 | AC_PROG_CC |
| 151 | AC_PROG_INSTALL |
| 152 | AC_C_CROSS |
| 153 | AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h mntent.h dirent.h getopt.h linux/fd.h sys/disklabel.h) |
| 154 | AC_FUNC_VPRINTF |
| 155 | dnl |
| 156 | dnl See if struct dirent has a d_namlen field (like bsd systems), implying |
| 157 | dnl that the actual length of the structure may be grater than the declared |
| 158 | dnl length. |
| 159 | dnl |
| 160 | AC_MSG_CHECKING(whether struct dirent has a d_namlen field) |
| 161 | AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen, |
| 162 | AC_TRY_COMPILE( |
| 163 | [#include <sys/types.h> |
| 164 | #include <dirent.h>], |
| 165 | [struct dirent de; de.d_namlen = 0;], |
| 166 | [e2fsprogs_cv_struct_d_namlen=yes], |
| 167 | [e2fsprogs_cv_struct_d_namlen=no])) |
| 168 | AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen) |
| 169 | if test "$e2fsprogs_cv_struct_d_namlen" = yes; then |
| 170 | AC_DEFINE(HAVE_DIRENT_NAMLEN) |
| 171 | fi |
| 172 | dnl |
| 173 | dnl Word sizes... |
| 174 | dnl |
| 175 | if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then |
| 176 | # if cross-compiling, with no cached values, just assume something common. |
| 177 | ac_cv_sizeof_short=2 |
| 178 | ac_cv_sizeof_int=4 |
| 179 | ac_cv_sizeof_long=4 |
| 180 | AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4]) |
| 181 | fi |
| 182 | AC_CHECK_SIZEOF(short) |
| 183 | AC_CHECK_SIZEOF(int) |
| 184 | AC_CHECK_SIZEOF(long) |
| 185 | SIZEOF_SHORT=$ac_cv_sizeof_short |
| 186 | SIZEOF_INT=$ac_cv_sizeof_int |
| 187 | SIZEOF_LONG=$ac_cv_sizeof_long |
| 188 | AC_SUBST(SIZEOF_SHORT) |
| 189 | AC_SUBST(SIZEOF_INT) |
| 190 | AC_SUBST(SIZEOF_LONG) |
| 191 | dnl |
| 192 | dnl See if struct stat has a st_flags field, in which case we can get file |
| 193 | dnl flags somewhat portably. Also check for the analogous setter, chflags(). |
| 194 | dnl |
| 195 | AC_MSG_CHECKING(whether struct stat has a st_flags field) |
| 196 | AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags, |
| 197 | AC_TRY_COMPILE([#include <sys/stat.h>], |
| 198 | [struct stat stat; stat.st_flags = 0;], |
| 199 | [e2fsprogs_cv_struct_st_flags=yes], |
| 200 | [e2fsprogs_cv_struct_st_flags=no])) |
| 201 | AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags) |
| 202 | if test "$e2fsprogs_cv_struct_st_flags" = yes; then |
| 203 | AC_DEFINE(HAVE_STAT_FLAGS) |
| 204 | fi |
| 205 | AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo) |
| 206 | dnl |
| 207 | dnl On systems without linux header files, we add an extra include directory |
| 208 | dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here |
| 209 | dnl is quoted so that it gets expanded by make, not by configure. |
| 210 | dnl |
| 211 | AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no]) |
| 212 | AC_SUBST(EXTRA_PROGS) |
| 213 | if test "$linux_headers" = yes; then |
| 214 | AC_DEFINE(HAVE_LINUX_FS_H) |
| 215 | # These are some programs that depend on having linux headers around, and |
| 216 | # won't work otherwise. So we only compile them if we can. |
| 217 | EXTRA_PROGS="$EXTRA_PROGS flushb" |
| 218 | else |
| 219 | LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include' |
| 220 | # Use this include directory with test compiles in the configure script too. |
| 221 | CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include" |
| 222 | fi |
| 223 | AC_SUBST(LINUX_INCLUDE) |
| 224 | dnl |
| 225 | dnl See if optreset exists |
| 226 | dnl |
| 227 | AC_MSG_CHECKING(for optreset) |
| 228 | AC_CACHE_VAL(ac_cv_have_optreset, |
| 229 | [AC_EGREP_HEADER(optreset, unistd.h, |
| 230 | ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl |
| 231 | AC_MSG_RESULT($ac_cv_have_optreset) |
| 232 | if test $ac_cv_have_optreset = yes; then |
| 233 | AC_DEFINE(HAVE_OPTRESET) |
| 234 | fi |
| 235 | dnl |
| 236 | dnl See if our system has frags enabled (at least in the header file) |
| 237 | dnl |
| 238 | AC_MSG_CHECKING(whether struct ext2_inode has frags fields) |
| 239 | AC_CACHE_VAL(e2fsprogs_cv_struct_ext2_inode_frags, |
| 240 | AC_TRY_COMPILE([#include <linux/ext2_fs.h>], |
| 241 | [struct ext2_inode i; i.i_frag = i.i_fsize = 0;], |
| 242 | [e2fsprogs_cv_struct_ext2_inode_frags=yes], |
| 243 | [e2fsprogs_cv_struct_ext2_inode_frags=no])) |
| 244 | AC_MSG_RESULT($e2fsprogs_cv_struct_ext2_inode_frags) |
| 245 | if test "$e2fsprogs_cv_struct_ext2_inode_frags" = yes; then |
| 246 | AC_DEFINE(HAVE_EXT2_FRAGS) |
| 247 | fi |
| 248 | dnl |
| 249 | dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd). |
| 250 | dnl |
| 251 | AC_MSG_CHECKING(whether the ext2 ioctls compile) |
| 252 | AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2, |
| 253 | AC_TRY_COMPILE([#include <linux/ext2_fs.h> |
| 254 | #include <sys/ioctl.h>], |
| 255 | [ioctl (0, EXT2_IOC_SETVERSION, 0);], |
| 256 | [e2fsprogs_cv_ioctl_ext2=yes], |
| 257 | [e2fsprogs_cv_ioctl_ext2=no])) |
| 258 | AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2) |
| 259 | if test "$e2fsprogs_cv_ioctl_ext2" = yes; then |
| 260 | AC_DEFINE(HAVE_EXT2_IOCTLS) |
| 261 | fi |
| 262 | dnl |
| 263 | dnl On linux, force the prefix to be '/' |
| 264 | dnl |
| 265 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 266 | case "$host_os" in |
| 267 | linux*) |
| 268 | if test "$prefix" = NONE ; then |
| 269 | prefix='/'; |
| 270 | echo "On Linux systems, prefix defaults to '/'" |
| 271 | fi |
| 272 | ;; |
| 273 | esac |
| 274 | dnl |
| 275 | dnl See if -static works. |
| 276 | dnl XXX for now, assume that only Linux systems support -static |
| 277 | dnl |
| 278 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 279 | LDFALG_STATIC= |
| 280 | case "$host_os" in |
| 281 | linux*) |
| 282 | LDFLAG_STATIC=-static |
| 283 | echo "On Linux systems, assume -static works" |
| 284 | ;; |
| 285 | esac |
| 286 | AC_SUBST(LDFLAG_STATIC) |
| 287 | dnl |
| 288 | dnl Check to see if prefix is '/' |
| 289 | dnl |
| 290 | if test "$prefix" = / ; then |
| 291 | usr_prefix=/usr |
| 292 | else |
| 293 | usr_prefix="\${prefix}" |
| 294 | fi |
| 295 | AC_SUBST(usr_prefix) |
| 296 | dnl |
| 297 | dnl Make the ss and et directories work correctly. |
| 298 | dnl |
| 299 | SS_DIR=`cd ${srcdir}/lib/ss; pwd` |
| 300 | ET_DIR=`cd ${srcdir}/lib/et; pwd` |
| 301 | AC_SUBST(SS_DIR) |
| 302 | AC_SUBST(ET_DIR) |
| 303 | dnl |
| 304 | dnl Only try to run the test suite if we're not cross compiling. |
| 305 | dnl |
| 306 | if test "$cross_compiling" = yes ; then |
| 307 | DO_TEST_SUITE= |
| 308 | else |
| 309 | DO_TEST_SUITE=check |
| 310 | fi |
| 311 | AC_SUBST(DO_TEST_SUITE) |
| 312 | dnl |
| 313 | dnl Make our output files, being sure that we create the some miscellaneous |
| 314 | dnl directories |
| 315 | dnl |
| 316 | test -d lib || mkdir lib |
| 317 | test -d include || mkdir include |
| 318 | test -d include/linux || mkdir include/linux |
| 319 | AC_OUTPUT(MCONFIG include/linux/types.h Makefile lib/et/Makefile |
| 320 | lib/et/compile_et.sh lib/ss/Makefile lib/ss/mk_cmds.sh |
| 321 | lib/ext2fs/Makefile lib/e2p/Makefile misc/Makefile |
| 322 | e2fsck/Makefile debugfs/Makefile tests/Makefile) |