Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 1 | AC_INIT(version.h) |
Theodore Ts'o | a4b2d3c | 1998-04-03 16:12:25 +0000 | [diff] [blame] | 2 | AC_PREREQ(2.12) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 3 | MCONFIG=./MCONFIG |
| 4 | AC_SUBST_FILE(MCONFIG) |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 5 | BINARY_TYPE=bin |
| 6 | dnl |
| 7 | dnl This is to figure out the version number and the date.... |
| 8 | dnl |
| 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}' \ |
| 12 | | tr \" " "` |
| 13 | MONTH=`echo $DATE | awk -F- '{print $2}'` |
| 14 | YEAR=`echo $DATE | awk -F- '{print $3}'` |
| 15 | |
Theodore Ts'o | 40fa8cc | 1999-01-09 05:06:02 +0000 | [diff] [blame] | 16 | if expr $YEAR ">" 1900 > /dev/null ; then |
| 17 | E2FSPROGS_YEAR=$YEAR |
| 18 | elif expr $YEAR ">" 90 >/dev/null ; then |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 19 | E2FSPROGS_YEAR=19$YEAR |
| 20 | else |
| 21 | E2FSPROGS_YEAR=20$YEAR |
| 22 | fi |
| 23 | |
| 24 | case $MONTH in |
| 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??" ;; |
| 38 | esac |
| 39 | |
| 40 | unset DATE MONTH YEAR |
| 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) |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 46 | AC_REQUIRE([AC_CANONICAL_HOST]) |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 47 | dnl |
| 48 | dnl set $(CC) from --with-cc=value |
| 49 | dnl |
| 50 | AC_ARG_WITH([cc], |
| 51 | [ --with-cc=COMPILER select compiler to use], |
| 52 | AC_MSG_RESULT(CC=$withval) |
| 53 | CC=$withval, |
| 54 | if test -z "$CC" ; then CC=cc; fi |
| 55 | [AC_MSG_RESULT(CC defaults to $CC)])dnl |
| 56 | export CC |
| 57 | AC_SUBST([CC]) |
Theodore Ts'o | 73ae2d4 | 2000-02-02 16:13:14 +0000 | [diff] [blame^] | 58 | AC_PROG_CC |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 59 | dnl |
| 60 | dnl set $(LD) from --with-linker=value |
| 61 | dnl |
| 62 | AC_ARG_WITH([linker], |
| 63 | [ --with-linker=LINKER select linker to use], |
| 64 | AC_MSG_RESULT(LD=$withval) |
| 65 | LD=$withval, |
| 66 | if test -z "$LD" ; then LD=$CC; fi |
| 67 | [AC_MSG_RESULT(LD defaults to $LD)])dnl |
| 68 | export LD |
| 69 | AC_SUBST([LD]) |
| 70 | dnl |
| 71 | dnl set $(CCOPTS) from --with-ccopts=value |
| 72 | dnl |
| 73 | AC_ARG_WITH([ccopts], |
| 74 | [ --with-ccopts=CCOPTS select compiler command line options], |
| 75 | AC_MSG_RESULT(CCOPTS is $withval) |
| 76 | CCOPTS=$withval |
| 77 | CFLAGS="$CFLAGS $withval", |
| 78 | CCOPTS=)dnl |
| 79 | AC_SUBST(CCOPTS) |
| 80 | dnl |
Theodore Ts'o | f8bd980 | 1999-10-26 04:19:45 +0000 | [diff] [blame] | 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. |
| 84 | dnl |
| 85 | AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no]) |
Theodore Ts'o | 73ae2d4 | 2000-02-02 16:13:14 +0000 | [diff] [blame^] | 86 | if test "$linux_headers" != yes; then |
| 87 | LINUX_INCLUDE='-I$(top_builddir)/include' |
Theodore Ts'o | f8bd980 | 1999-10-26 04:19:45 +0000 | [diff] [blame] | 88 | fi |
| 89 | AC_SUBST(LINUX_INCLUDE) |
| 90 | dnl |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 91 | dnl Set default values for library extentions. Will be dealt with after |
| 92 | dnl parsing configuration opions, which may modify these |
| 93 | dnl |
| 94 | LIB_EXT=.a |
| 95 | STATIC_LIB_EXT=.a |
| 96 | PROFILE_LIB_EXT=.a |
| 97 | dnl |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 98 | dnl set $(LDFLAGS) from --with-ldopts=value |
| 99 | dnl |
| 100 | AC_ARG_WITH([ldopts], |
| 101 | [ --with-ldopts=LDOPTS select linker command line options], |
| 102 | AC_MSG_RESULT(LDFLAGS is $withval) |
| 103 | LDFLAGS=$withval, |
| 104 | LDFLAGS=)dnl |
| 105 | AC_SUBST(LDFLAGS) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 106 | dnl |
Theodore Ts'o | a4b2d3c | 1998-04-03 16:12:25 +0000 | [diff] [blame] | 107 | dnl Allow separate `root_prefix' to be specified |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 108 | dnl |
Theodore Ts'o | a4b2d3c | 1998-04-03 16:12:25 +0000 | [diff] [blame] | 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, |
| 112 | root_prefix=NONE)dnl |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 113 | dnl |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 114 | dnl handle --enable-dll-shlibs |
| 115 | dnl |
| 116 | AC_ARG_ENABLE([dll-shlibs], |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 117 | [ --enable-dll-shlibs select DLL libraries], |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 118 | if test "$enableval" = "no" |
| 119 | then |
| 120 | DLL_CMT=# |
| 121 | MAKEFILE_DLL=/dev/null |
| 122 | echo "Disabling DLL shared libraries" |
| 123 | else |
| 124 | DLL_CMT= |
| 125 | MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 126 | BINARY_TYPE=dllbin |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 127 | LIB_EXT=.sa |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 128 | echo "Enabling DLL shared libraries" |
| 129 | fi |
| 130 | , |
| 131 | MAKEFILE_DLL=/dev/null |
| 132 | DLL_CMT=# |
| 133 | echo "Disabling DLL shared libraries by default" |
| 134 | ) |
| 135 | AC_SUBST(DLL_CMT) |
| 136 | AC_SUBST_FILE(MAKEFILE_DLL) |
| 137 | dnl |
| 138 | dnl handle --enable-elf-shlibs |
| 139 | dnl |
| 140 | AC_ARG_ENABLE([elf-shlibs], |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 141 | [ --enable-elf-shlibs select ELF shared libraries], |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 142 | if test "$enableval" = "no" |
| 143 | then |
| 144 | ELF_CMT=# |
| 145 | MAKEFILE_ELF=/dev/null |
| 146 | echo "Disabling ELF shared libraries" |
| 147 | else |
| 148 | ELF_CMT= |
| 149 | MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 150 | BINARY_TYPE=elfbin |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 151 | LIB_EXT=.so |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 152 | echo "Enabling ELF shared libraries" |
| 153 | fi |
| 154 | , |
| 155 | MAKEFILE_ELF=/dev/null |
| 156 | ELF_CMT=# |
| 157 | echo "Disabling ELF shared libraries by default" |
| 158 | ) |
| 159 | AC_SUBST(ELF_CMT) |
| 160 | AC_SUBST_FILE(MAKEFILE_ELF) |
| 161 | dnl |
| 162 | dnl handle --enable-bsd-shlibs |
| 163 | dnl |
| 164 | AC_ARG_ENABLE([bsd-shlibs], |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 165 | [ --enable-bsd-shlibs select BSD shared libraries], |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 166 | if test "$enableval" = "no" |
| 167 | then |
| 168 | BSDLIB_CMT=# |
| 169 | MAKEFILE_BSDLIB=/dev/null |
| 170 | echo "Disabling BSD shared libraries" |
| 171 | else |
| 172 | BSDLIB_CMT= |
| 173 | MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 174 | LIB_EXT=.so |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 175 | echo "Enabling BSD shared libraries" |
| 176 | fi |
| 177 | , |
| 178 | MAKEFILE_BSDLIB=/dev/null |
| 179 | BSDLIB_CMT=# |
| 180 | echo "Disabling BSD shared libraries by default" |
| 181 | ) |
| 182 | AC_SUBST(BSDLIB_CMT) |
| 183 | AC_SUBST_FILE(MAKEFILE_BSDLIB) |
| 184 | dnl |
| 185 | dnl handle --enable-profile |
| 186 | dnl |
| 187 | AC_ARG_ENABLE([profile], |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 188 | [ --enable-profile build profiling libraries], |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 189 | if test "$enableval" = "no" |
| 190 | then |
| 191 | PROFILE_CMT=# |
| 192 | MAKEFILE_PROFILE=/dev/null |
| 193 | echo "Disabling profiling libraries" |
| 194 | else |
| 195 | PROFILE_CMT= |
| 196 | MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 197 | PROFILED_LIB_EXT=_p.a |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 198 | echo "Building profiling libraries" |
| 199 | fi |
| 200 | , |
| 201 | PROFILE_CMT=# |
| 202 | MAKEFILE_PROFILE=/dev/null |
| 203 | echo "Disabling profiling libraries by default" |
| 204 | ) |
| 205 | AC_SUBST(PROFILE_CMT) |
| 206 | AC_SUBST_FILE(MAKEFILE_PROFILE) |
| 207 | dnl |
| 208 | dnl handle --enable-checker |
| 209 | dnl |
| 210 | AC_ARG_ENABLE([checker], |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 211 | [ --enable-checker build checker libraries], |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 212 | if test "$enableval" = "no" |
| 213 | then |
| 214 | CHECKER_CMT=# |
| 215 | MAKEFILE_CHECKER=/dev/null |
| 216 | echo "Disabling checker libraries" |
| 217 | else |
| 218 | CHECKER_CMT= |
| 219 | MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker |
| 220 | echo "Building checker libraries" |
| 221 | fi |
| 222 | , |
| 223 | CHECKER_CMT=# |
| 224 | MAKEFILE_CHECKER=/dev/null |
| 225 | echo "Disabling checker libraries by default" |
| 226 | ) |
| 227 | AC_SUBST(CHECKER_CMT) |
| 228 | AC_SUBST_FILE(MAKEFILE_CHECKER) |
| 229 | dnl |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 230 | dnl Substitute library extensions |
| 231 | dnl |
| 232 | AC_SUBST(LIB_EXT) |
| 233 | AC_SUBST(STATIC_LIB_EXT) |
| 234 | AC_SUBST(PROFILED_LIB_EXT) |
| 235 | dnl |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 236 | dnl handle --enable-gcc-wall |
| 237 | dnl |
| 238 | AC_ARG_ENABLE([gcc-wall], |
Theodore Ts'o | b0b9c4d | 1997-10-20 23:36:30 +0000 | [diff] [blame] | 239 | [ --enable-gcc-wall enable GCC anal warnings (DON'T USE IN PRODUCTION)], |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 240 | if test "$enableval" = "no" |
| 241 | then |
| 242 | W=# |
| 243 | echo "Disabling GCC warnings" |
| 244 | else |
| 245 | W= |
| 246 | echo "Enabling GCC warnings" |
| 247 | fi |
| 248 | , |
| 249 | W=# |
| 250 | echo "Disabling GCC warnings by default" |
| 251 | ) |
| 252 | AC_SUBST(W) |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 253 | AC_ARG_ENABLE([dynamic-e2fsck], |
| 254 | [ --enable-dynamic-e2fsck build e2fsck dynamically], |
| 255 | if test "$enableval" = "no" |
| 256 | then |
| 257 | E2FSCK_TYPE=static |
| 258 | echo "Building e2fsck statically" |
| 259 | else |
| 260 | E2FSCK_TYPE=shared |
| 261 | echo "Building e2fsck dynamically" |
| 262 | fi |
| 263 | , |
| 264 | E2FSCK_TYPE=static |
| 265 | echo "Building e2fsck statically by default" |
| 266 | ) |
| 267 | AC_SUBST(E2FSCK_TYPE) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 268 | dnl |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 269 | dnl See whether to install the `fsck' wrapper program (that calls e2fsck) |
| 270 | dnl |
| 271 | AC_ARG_ENABLE([fsck], |
| 272 | [ --enable-fsck build fsck wrapper program], |
| 273 | [if test "$enableval" = "no" |
| 274 | then |
| 275 | FSCK_PROG='' FSCK_MAN='' |
| 276 | echo "Not building fsck wrapper" |
| 277 | else |
| 278 | FSCK_PROG=fsck FSCK_MAN=fsck.8 |
| 279 | echo "Building fsck wrapper" |
| 280 | fi] |
| 281 | , |
| 282 | [case "$host_os" in |
| 283 | gnu*) |
| 284 | FSCK_PROG='' FSCK_MAN='' |
| 285 | echo "Not building fsck wrapper by default" |
| 286 | ;; |
| 287 | *) |
| 288 | FSCK_PROG=fsck FSCK_MAN=fsck.8 |
| 289 | echo "Building fsck wrapper by default" |
| 290 | esac] |
| 291 | ) |
| 292 | AC_SUBST(FSCK_PROG) |
| 293 | AC_SUBST(FSCK_MAN) |
| 294 | dnl |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 295 | dnl |
| 296 | MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library |
| 297 | AC_SUBST_FILE(MAKEFILE_LIBRARY) |
| 298 | dnl |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 299 | dnl |
| 300 | AC_ARG_ENABLE([old-bitops], |
| 301 | [ --enable-old-bitops Use old (non-standard but native) bitmask operations], |
| 302 | if test "$enableval" = "no" |
| 303 | then |
| 304 | echo "Using new (standard) bitmask operations" |
| 305 | else |
| 306 | AC_DEFINE(EXT2_OLD_BITOPS) |
| 307 | echo "Using old (native) bitmask operations" |
| 308 | |
| 309 | fi |
| 310 | , |
| 311 | echo "Using standard bitmask operations by default" |
| 312 | ) |
| 313 | dnl |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 314 | dnl End of configuration options |
| 315 | dnl |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 316 | AC_SUBST(BINARY_TYPE) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 317 | AC_PROG_MAKE_SET |
| 318 | AC_PATH_PROG(LN, ln, ln) |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 319 | AC_PROG_LN_S |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 320 | AC_PATH_PROG(MV, mv, mv) |
| 321 | AC_PATH_PROG(CP, cp, cp) |
| 322 | AC_PATH_PROG(RM, rm, rm) |
| 323 | AC_PATH_PROG(CHMOD, chmod, :) |
| 324 | AC_PATH_PROG(AWK, awk, awk) |
| 325 | AC_PATH_PROG(SED, sed, sed) |
Theodore Ts'o | 9d564f7 | 1999-07-03 20:25:58 +0000 | [diff] [blame] | 326 | AC_PATH_PROG(PERL, perl, perl) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 327 | AC_CHECK_TOOL(AR, ar, ar) |
| 328 | AC_CHECK_TOOL(RANLIB, ranlib, :) |
| 329 | AC_CHECK_TOOL(STRIP, strip, :) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 330 | AC_PROG_INSTALL |
Theodore Ts'o | 6c13352 | 1999-07-03 20:37:03 +0000 | [diff] [blame] | 331 | # See if we need a separate native compiler. |
| 332 | if test $cross_compiling = no; then |
| 333 | BUILD_CC="$CC" |
| 334 | AC_SUBST(BUILD_CC) |
| 335 | else |
| 336 | AC_CHECK_PROGS(BUILD_CC, gcc cc) |
| 337 | fi |
Theodore Ts'o | c81c6ce | 1999-10-26 04:28:53 +0000 | [diff] [blame] | 338 | 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) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 339 | AC_FUNC_VPRINTF |
| 340 | dnl |
| 341 | dnl See if struct dirent has a d_namlen field (like bsd systems), implying |
| 342 | dnl that the actual length of the structure may be grater than the declared |
| 343 | dnl length. |
| 344 | dnl |
| 345 | AC_MSG_CHECKING(whether struct dirent has a d_namlen field) |
| 346 | AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen, |
| 347 | AC_TRY_COMPILE( |
| 348 | [#include <sys/types.h> |
| 349 | #include <dirent.h>], |
| 350 | [struct dirent de; de.d_namlen = 0;], |
| 351 | [e2fsprogs_cv_struct_d_namlen=yes], |
| 352 | [e2fsprogs_cv_struct_d_namlen=no])) |
| 353 | AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen) |
| 354 | if test "$e2fsprogs_cv_struct_d_namlen" = yes; then |
| 355 | AC_DEFINE(HAVE_DIRENT_NAMLEN) |
| 356 | fi |
| 357 | dnl |
Theodore Ts'o | b0b9c4d | 1997-10-20 23:36:30 +0000 | [diff] [blame] | 358 | dnl Check to see if llseek() is declared in unistd.h. On some libc's |
| 359 | dnl it is, and on others it isn't..... Thank you glibc developers.... |
| 360 | dnl |
| 361 | dnl Warning! Use of --enable-gcc-wall may throw off this test. |
| 362 | dnl |
| 363 | dnl |
| 364 | AC_MSG_CHECKING(whether llseek declared in unistd.h) |
| 365 | AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype, |
| 366 | AC_TRY_COMPILE( |
| 367 | [#include <unistd.h>], [extern int llseek(int);], |
| 368 | [e2fsprogs_cv_have_llseek_prototype=no], |
| 369 | [e2fsprogs_cv_have_llseek_prototype=yes])) |
| 370 | AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype) |
| 371 | if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then |
| 372 | AC_DEFINE(HAVE_LLSEEK_PROTOTYPE) |
| 373 | fi |
| 374 | dnl |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 375 | dnl Word sizes... |
| 376 | dnl |
| 377 | if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then |
| 378 | # if cross-compiling, with no cached values, just assume something common. |
| 379 | ac_cv_sizeof_short=2 |
| 380 | ac_cv_sizeof_int=4 |
| 381 | ac_cv_sizeof_long=4 |
Theodore Ts'o | 6c13352 | 1999-07-03 20:37:03 +0000 | [diff] [blame] | 382 | ac_cv_sizeof_long_long=8 |
| 383 | AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4, long long=8]) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 384 | fi |
| 385 | AC_CHECK_SIZEOF(short) |
| 386 | AC_CHECK_SIZEOF(int) |
| 387 | AC_CHECK_SIZEOF(long) |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 388 | AC_CHECK_SIZEOF(long long) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 389 | SIZEOF_SHORT=$ac_cv_sizeof_short |
| 390 | SIZEOF_INT=$ac_cv_sizeof_int |
| 391 | SIZEOF_LONG=$ac_cv_sizeof_long |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 392 | SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 393 | AC_SUBST(SIZEOF_SHORT) |
| 394 | AC_SUBST(SIZEOF_INT) |
| 395 | AC_SUBST(SIZEOF_LONG) |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 396 | AC_SUBST(SIZEOF_LONG_LONG) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 397 | dnl |
| 398 | dnl See if struct stat has a st_flags field, in which case we can get file |
| 399 | dnl flags somewhat portably. Also check for the analogous setter, chflags(). |
| 400 | dnl |
| 401 | AC_MSG_CHECKING(whether struct stat has a st_flags field) |
| 402 | AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags, |
| 403 | AC_TRY_COMPILE([#include <sys/stat.h>], |
| 404 | [struct stat stat; stat.st_flags = 0;], |
| 405 | [e2fsprogs_cv_struct_st_flags=yes], |
| 406 | [e2fsprogs_cv_struct_st_flags=no])) |
| 407 | AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags) |
| 408 | if test "$e2fsprogs_cv_struct_st_flags" = yes; then |
Theodore Ts'o | c03bc4e | 1999-10-20 18:20:36 +0000 | [diff] [blame] | 409 | AC_MSG_CHECKING(whether st_flags field is useful) |
| 410 | AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut, |
| 411 | AC_TRY_COMPILE([#include <sys/stat.h>], |
| 412 | [struct stat stat; stat.st_flags |= UF_IMMUTABLE;], |
| 413 | [e2fsprogs_cv_struct_st_flags_immut=yes], |
| 414 | [e2fsprogs_cv_struct_st_flags_immut=no])) |
| 415 | AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut) |
| 416 | if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then |
| 417 | AC_DEFINE(HAVE_STAT_FLAGS) |
| 418 | fi |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 419 | fi |
Theodore Ts'o | 6454d84 | 1999-03-16 19:24:34 +0000 | [diff] [blame] | 420 | AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo strcasecmp srandom fchown mallinfo) |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 421 | dnl |
| 422 | dnl Check to see if ino_t is defined |
| 423 | dnl |
| 424 | AC_MSG_CHECKING(ino_t defined by sys/types.h) |
| 425 | AC_CACHE_VAL(e2fsprogs_cv_ino_t, |
| 426 | AC_TRY_COMPILE([#include <sys/types.h>], |
| 427 | [ino_t ino; ino = 0;], |
| 428 | [e2fsprogs_cv_ino_t=yes], |
| 429 | [e2fsprogs_cv_ino_t=no])) |
| 430 | AC_MSG_RESULT($e2fsprogs_cv_ino_t) |
| 431 | if test "$e2fsprogs_cv_ino_t" = yes; then |
| 432 | AC_DEFINE(HAVE_INO_T) |
| 433 | fi |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 434 | dnl |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 435 | dnl Check to see if -lsocket is required (solaris) to make something |
| 436 | dnl that uses socket() to compile; this is needed for the UUID library |
| 437 | dnl |
| 438 | SOCKET_LIB='' |
| 439 | AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket]) |
| 440 | AC_SUBST(SOCKET_LIB) |
| 441 | dnl |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 442 | dnl See if optreset exists |
| 443 | dnl |
| 444 | AC_MSG_CHECKING(for optreset) |
| 445 | AC_CACHE_VAL(ac_cv_have_optreset, |
| 446 | [AC_EGREP_HEADER(optreset, unistd.h, |
| 447 | ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl |
| 448 | AC_MSG_RESULT($ac_cv_have_optreset) |
| 449 | if test $ac_cv_have_optreset = yes; then |
| 450 | AC_DEFINE(HAVE_OPTRESET) |
| 451 | fi |
| 452 | dnl |
Theodore Ts'o | ad6783d | 1999-10-26 01:58:54 +0000 | [diff] [blame] | 453 | dnl See if using the EXT2 ioctls causes a compile-time barf (as on the Hurd). |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 454 | dnl |
| 455 | AC_MSG_CHECKING(whether the ext2 ioctls compile) |
| 456 | AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2, |
| 457 | AC_TRY_COMPILE([#include <linux/ext2_fs.h> |
| 458 | #include <sys/ioctl.h>], |
| 459 | [ioctl (0, EXT2_IOC_SETVERSION, 0);], |
| 460 | [e2fsprogs_cv_ioctl_ext2=yes], |
| 461 | [e2fsprogs_cv_ioctl_ext2=no])) |
| 462 | AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2) |
| 463 | if test "$e2fsprogs_cv_ioctl_ext2" = yes; then |
| 464 | AC_DEFINE(HAVE_EXT2_IOCTLS) |
| 465 | fi |
| 466 | dnl |
Theodore Ts'o | 6c13352 | 1999-07-03 20:37:03 +0000 | [diff] [blame] | 467 | dnl Linux and Hurd places root files in the / by default |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 468 | dnl |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 469 | case "$host_os" in |
Theodore Ts'o | 6c13352 | 1999-07-03 20:37:03 +0000 | [diff] [blame] | 470 | linux* | gnu*) |
Theodore Ts'o | a4b2d3c | 1998-04-03 16:12:25 +0000 | [diff] [blame] | 471 | if test "$prefix" = NONE -a "$root_prefix" = NONE ; then |
| 472 | root_prefix=""; |
| 473 | echo "On $host_os systems, root_prefix defaults to ''" |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 474 | fi |
| 475 | ;; |
| 476 | esac |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 477 | dnl |
Theodore Ts'o | a4b2d3c | 1998-04-03 16:12:25 +0000 | [diff] [blame] | 478 | dnl On Linux/hurd, force the prefix to be /usr |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 479 | dnl |
| 480 | case "$host_os" in |
| 481 | linux* | gnu*) |
| 482 | if test "$prefix" = NONE ; then |
Theodore Ts'o | a4b2d3c | 1998-04-03 16:12:25 +0000 | [diff] [blame] | 483 | prefix="/usr"; |
| 484 | echo "On $host_os systems, prefix defaults to /usr" |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 485 | fi |
| 486 | ;; |
| 487 | esac |
Theodore Ts'o | a4b2d3c | 1998-04-03 16:12:25 +0000 | [diff] [blame] | 488 | if test "$root_prefix" = NONE ; then |
Theodore Ts'o | ffe1991 | 1998-04-08 06:05:49 +0000 | [diff] [blame] | 489 | if test "$prefix" = NONE ; then |
Theodore Ts'o | a4b2d3c | 1998-04-03 16:12:25 +0000 | [diff] [blame] | 490 | root_prefix="$ac_default_prefix" |
| 491 | else |
| 492 | root_prefix="$prefix" |
| 493 | fi |
| 494 | fi |
| 495 | AC_SUBST(root_prefix) |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 496 | dnl |
| 497 | dnl See if -static works. |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 498 | dnl |
Theodore Ts'o | ae85148 | 1997-04-29 18:13:24 +0000 | [diff] [blame] | 499 | AC_MSG_CHECKING([whether linker accepts -static]) |
| 500 | AC_CACHE_VAL(ac_cv_e2fsprogs_use_static, |
| 501 | [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static" |
| 502 | AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);], |
| 503 | ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no) |
| 504 | LDFLAGS=$SAVE_LDFLAGS]) |
Theodore Ts'o | defde78 | 1999-01-04 07:39:19 +0000 | [diff] [blame] | 505 | dnl |
| 506 | dnl Regardless of how the test turns out, Solaris doesn't handle -static |
| 507 | dnl This is caused by the socket library requiring the nsl library, which |
| 508 | dnl requires the -dl library, which only works for dynamically linked |
| 509 | dnl programs. It basically means you can't have statically linked programs |
| 510 | dnl which use the network under Solaris. |
| 511 | dnl |
| 512 | case "$host_os" in |
| 513 | solaris2.*) |
| 514 | ac_cv_e2fsprogs_use_static=no |
| 515 | ;; |
| 516 | esac |
Theodore Ts'o | ae85148 | 1997-04-29 18:13:24 +0000 | [diff] [blame] | 517 | AC_MSG_RESULT($ac_cv_e2fsprogs_use_static) |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 518 | LDFLAG_STATIC= |
Theodore Ts'o | ae85148 | 1997-04-29 18:13:24 +0000 | [diff] [blame] | 519 | if test $ac_cv_e2fsprogs_use_static = yes; then |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 520 | LDFLAG_STATIC=-static |
Theodore Ts'o | ae85148 | 1997-04-29 18:13:24 +0000 | [diff] [blame] | 521 | fi |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 522 | AC_SUBST(LDFLAG_STATIC) |
| 523 | dnl |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 524 | dnl Make the ss and et directories work correctly. |
| 525 | dnl |
| 526 | SS_DIR=`cd ${srcdir}/lib/ss; pwd` |
| 527 | ET_DIR=`cd ${srcdir}/lib/et; pwd` |
| 528 | AC_SUBST(SS_DIR) |
| 529 | AC_SUBST(ET_DIR) |
| 530 | dnl |
| 531 | dnl Only try to run the test suite if we're not cross compiling. |
| 532 | dnl |
| 533 | if test "$cross_compiling" = yes ; then |
| 534 | DO_TEST_SUITE= |
| 535 | else |
| 536 | DO_TEST_SUITE=check |
| 537 | fi |
| 538 | AC_SUBST(DO_TEST_SUITE) |
| 539 | dnl |
Theodore Ts'o | a4d0961 | 1997-04-29 14:28:00 +0000 | [diff] [blame] | 540 | dnl |
| 541 | dnl |
| 542 | DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute |
| 543 | AC_SUBST_FILE(DO_SUBSTITUTE_SCRIPT) |
| 544 | dnl |
Theodore Ts'o | 50e1e10 | 1997-04-26 13:58:21 +0000 | [diff] [blame] | 545 | dnl Make our output files, being sure that we create the some miscellaneous |
| 546 | dnl directories |
| 547 | dnl |
| 548 | test -d lib || mkdir lib |
| 549 | test -d include || mkdir include |
| 550 | test -d include/linux || mkdir include/linux |
Theodore Ts'o | defde78 | 1999-01-04 07:39:19 +0000 | [diff] [blame] | 551 | test -d include/asm || mkdir include/asm |
Theodore Ts'o | 24b2c7a | 1997-06-07 20:42:58 +0000 | [diff] [blame] | 552 | rmakefile= |
| 553 | if test -d ${srcdir}/resize ; then |
| 554 | rmakefile=resize/Makefile |
| 555 | fi |
Theodore Ts'o | 44339bd | 1997-10-15 02:47:20 +0000 | [diff] [blame] | 556 | AC_OUTPUT(MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile |
Theodore Ts'o | fc6d9d5 | 1997-04-29 14:51:31 +0000 | [diff] [blame] | 557 | lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile |
| 558 | misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile |
Theodore Ts'o | 24b2c7a | 1997-06-07 20:42:58 +0000 | [diff] [blame] | 559 | tests/progs/Makefile $rmakefile doc/Makefile) |