Home | History | Annotate | Download | only in e2fsprogs
      1 AC_INIT(version.h)
      2 AC_PREREQ(2.50)
      3 AC_CONFIG_AUX_DIR(config)
      4 MCONFIG=./MCONFIG
      5 AC_SUBST_FILE(MCONFIG)
      6 BINARY_TYPE=bin
      7 dnl
      8 dnl This is to figure out the version number and the date....
      9 dnl
     10 E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h  \
     11 	| awk '{print $3}' | tr \" " " | awk '{print $1}'`
     12 DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
     13 	| tr \" " "`
     14 E2FSPROGS_DAY=`echo $DATE | awk -F- '{print $1}'`
     15 MONTH=`echo $DATE | awk -F- '{print $2}'`
     16 YEAR=`echo $DATE | awk -F- '{print $3}'`
     17 
     18 if expr $YEAR ">" 1900 > /dev/null ; then
     19 	E2FSPROGS_YEAR=$YEAR
     20 elif expr $YEAR ">" 90 >/dev/null ; then
     21 	E2FSPROGS_YEAR=19$YEAR
     22 else
     23 	E2FSPROGS_YEAR=20$YEAR
     24 fi
     25 
     26 case $MONTH in
     27 Jan)	MONTH_NUM=01; E2FSPROGS_MONTH="January" ;;
     28 Feb)	MONTH_NUM=02; E2FSPROGS_MONTH="February" ;;
     29 Mar)	MONTH_NUM=03; E2FSPROGS_MONTH="March" ;;
     30 Apr)	MONTH_NUM=04; E2FSPROGS_MONTH="April" ;;
     31 May)	MONTH_NUM=05; E2FSPROGS_MONTH="May" ;;
     32 Jun)	MONTH_NUM=06; E2FSPROGS_MONTH="June" ;;
     33 Jul)	MONTH_NUM=07; E2FSPROGS_MONTH="July" ;;
     34 Aug)	MONTH_NUM=08; E2FSPROGS_MONTH="August" ;;
     35 Sep)	MONTH_NUM=09; E2FSPROGS_MONTH="September" ;;
     36 Oct)	MONTH_NUM=10; E2FSPROGS_MONTH="October" ;;
     37 Nov)	MONTH_NUM=11; E2FSPROGS_MONTH="November" ;;
     38 Dec)	MONTH_NUM=12; E2FSPROGS_MONTH="December" ;;
     39 *)	AC_MSG_WARN([Unknown month $MONTH??]) ;;
     40 esac
     41 
     42 base_ver=`echo $E2FSPROGS_VERSION | \
     43 	       sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
     44 
     45 date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
     46 
     47 case $E2FSPROGS_VERSION in
     48 *-WIP|pre-*)
     49 	E2FSPROGS_PKGVER="$base_ver~WIP-$E2FSPROGS_YEAR-$MONTH_NUM-$E2FSPROGS_DAY"
     50 	;;
     51 *)
     52 	E2FSPROGS_PKGVER="$base_ver"
     53 	;;
     54 esac
     55 
     56 unset DATE MONTH YEAR base_ver pre_vers date_spec
     57 AC_MSG_RESULT([Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION])
     58 AC_MSG_RESULT([Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}])
     59 AC_SUBST(E2FSPROGS_YEAR)
     60 AC_SUBST(E2FSPROGS_MONTH)
     61 AC_SUBST(E2FSPROGS_DAY)
     62 AC_SUBST(E2FSPROGS_VERSION)
     63 AC_SUBST(E2FSPROGS_PKGVER)
     64 AC_CANONICAL_HOST
     65 dnl
     66 dnl Check to see if libdl exists for the sake of dlopen
     67 dnl
     68 DLOPEN_LIB=''
     69 AC_CHECK_LIB(dl, dlopen, 
     70 [DLOPEN_LIB=-ldl
     71 AC_DEFINE(HAVE_DLOPEN)])
     72 AC_SUBST(DLOPEN_LIB)
     73 dnl
     74 dnl Use diet libc
     75 dnl 
     76 WITH_DIET_LIBC=
     77 AC_ARG_WITH([diet-libc],
     78 [  --with-diet-libc        use diet libc],
     79 CC="diet cc -nostdinc"
     80 WITH_DIET_LIBC=yes
     81 AC_MSG_RESULT(CC=$CC))dnl
     82 dnl
     83 AC_ARG_WITH([cc],
     84 AC_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
     85 AC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
     86 dnl
     87 AC_ARG_WITH([ccopts],
     88 AC_HELP_STRING([--with-ccopts],[no longer supported, use CFLAGS= instead]),
     89 AC_MSG_ERROR([--with-ccopts no longer supported; use CFLAGS= instead]))
     90 dnl
     91 AC_ARG_WITH([ldopts],
     92 AC_HELP_STRING([--with-ldopts],[no longer supported, use LDFLAGS= instead]),
     93 AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead]))
     94 dnl
     95 AC_PROG_CC
     96 AC_PROG_CPP
     97 dnl
     98 dnl On systems without linux header files, we add an extra include directory
     99 dnl that holds enough to fake it (hopefully).  Note that the $(top_srcdir) here
    100 dnl is quoted so that it gets expanded by make, not by configure.
    101 dnl
    102 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
    103 if test "$linux_headers" != yes; then
    104   LINUX_INCLUDE='-I$(top_builddir)/include'
    105 fi
    106 AC_SUBST(LINUX_INCLUDE)
    107 dnl
    108 dnl Alpha computers use fast and imprecise floating point code that may
    109 dnl miss exceptions by default. Force sane options if we're using GCC.
    110 AC_MSG_CHECKING(for additional special compiler flags)
    111 if test "$GCC" = yes
    112 then
    113     case "$host_cpu" in
    114 	alpha)		addcflags="-mieee" ;;
    115     esac
    116 fi
    117 if test "x$addcflags" != x
    118 then
    119     AC_MSG_RESULT($addcflags)
    120     CFLAGS="$addcflags $CFLAGS"
    121 else
    122     AC_MSG_RESULT([[(none)]])
    123 fi
    124 dnl
    125 dnl Set default values for library extentions.  Will be dealt with after
    126 dnl parsing configuration opions, which may modify these
    127 dnl
    128 LIB_EXT=.a
    129 STATIC_LIB_EXT=.a
    130 PROFILED_LIB_EXT=.a
    131 dnl
    132 dnl Allow separate `root_prefix' to be specified
    133 dnl
    134 AC_ARG_WITH([root-prefix],
    135 [  --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
    136 root_prefix=$withval,
    137 root_prefix=NONE)dnl
    138 dnl
    139 dnl handle --enable-maintainer-mode
    140 dnl
    141 AC_ARG_ENABLE([maintainer-mode],
    142 [  --enable-maintainer-mode enable makefile rules useful for maintainers],
    143 if test "$enableval" = "no"
    144 then
    145 	MAINTAINER_CMT=#
    146 	AC_MSG_RESULT([Disabling maintainer mode])
    147 else
    148 	MAINTAINER_CMT=
    149 	AC_MSG_RESULT([Enabling maintainer mode])
    150 fi
    151 ,
    152 MAINTAINER_CMT=#
    153 AC_MSG_RESULT([Disabling maintainer mode by default])
    154 )
    155 AC_SUBST(MAINTAINER_CMT)
    156 dnl
    157 dnl handle --enable-verbose-makecmds
    158 dnl
    159 AC_ARG_ENABLE([verbose-makecmds],
    160 [  --enable-verbose-makecmds  enable verbose make command output],
    161 if test "$enableval" = "no"
    162 then
    163 	AC_MSG_RESULT([Disabling verbose make commands])
    164 	E=@echo
    165 	Q=@
    166 else
    167 	AC_MSG_RESULT([Enabling verbose make commands])
    168 	E=@\\#
    169 	Q= 
    170 fi
    171 ,
    172 AC_MSG_RESULT([Disabling verbose make commands])
    173 E=@echo
    174 Q=@
    175 )
    176 AC_SUBST(E)
    177 AC_SUBST(Q)
    178 dnl
    179 dnl handle --enable-compression
    180 dnl
    181 AC_ARG_ENABLE([compression],
    182 [  --enable-compression	  enable EXPERIMENTAL compression support],
    183 if test "$enableval" = "no"
    184 then
    185 	AC_MSG_RESULT([Disabling compression support])
    186 else
    187 	AC_DEFINE(ENABLE_COMPRESSION)
    188 	AC_MSG_RESULT([Enabling compression support])
    189 	AC_MSG_WARN([Compression support is experimental])
    190 fi
    191 ,
    192 AC_MSG_RESULT([Disabling compression support by default])
    193 )
    194 dnl
    195 dnl handle --enable-htree
    196 dnl
    197 AC_ARG_ENABLE([htree],
    198 [  --enable-htree      	  enable EXPERIMENTAL htree directory support],
    199 if test "$enableval" = "no"
    200 then
    201 	HTREE_CMT=#
    202 	AC_MSG_RESULT([Disabling htree directory support])
    203 else
    204 	HTREE_CMT=
    205 	AC_DEFINE(ENABLE_HTREE)
    206 	AC_MSG_RESULT([Enabling htree directory support])
    207 fi
    208 ,
    209 HTREE_CMT=
    210 AC_DEFINE(ENABLE_HTREE)
    211 AC_MSG_RESULT([Enabling htree directory support by default])
    212 )
    213 AC_SUBST(HTREE_CMT)
    214 dnl
    215 dnl This needs to be before all of the --enable-*-shlibs options
    216 dnl
    217 E2_PKG_CONFIG_STATIC=--static
    218 LDFLAG_DYNAMIC=
    219 PRIVATE_LIBS_CMT=
    220 dnl
    221 dnl handle --enable-elf-shlibs
    222 dnl
    223 AC_ARG_ENABLE([elf-shlibs],
    224 [  --enable-elf-shlibs	  select ELF shared libraries],
    225 if test "$enableval" = "no"
    226 then
    227 	ELF_CMT=#
    228 	MAKEFILE_ELF=/dev/null
    229 	AC_MSG_RESULT([Disabling ELF shared libraries])
    230 else
    231 	E2_PKG_CONFIG_STATIC=
    232 	ELF_CMT=
    233 	MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
    234 	[case "$host_os" in
    235 	solaris2.*)
    236 		MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
    237 	;;
    238 	esac]
    239 	BINARY_TYPE=elfbin
    240 	LIB_EXT=.so
    241 	PRIVATE_LIBS_CMT=#
    242 	LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib']
    243 	AC_MSG_RESULT([Enabling ELF shared libraries])
    244 fi
    245 ,
    246 MAKEFILE_ELF=/dev/null
    247 ELF_CMT=#
    248 AC_MSG_RESULT([Disabling ELF shared libraries by default])
    249 )
    250 AC_SUBST(ELF_CMT)
    251 AC_SUBST_FILE(MAKEFILE_ELF)
    252 dnl
    253 dnl handle --enable-bsd-shlibs
    254 dnl
    255 AC_ARG_ENABLE([bsd-shlibs],
    256 [  --enable-bsd-shlibs	  select BSD shared libraries],
    257 if test "$enableval" = "no"
    258 then
    259 	BSDLIB_CMT=#
    260 	MAKEFILE_BSDLIB=/dev/null
    261 	AC_MSG_RESULT([Disabling BSD shared libraries])
    262 else
    263 	E2_PKG_CONFIG_STATIC=
    264 	BSDLIB_CMT=
    265 	MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
    266 	LIB_EXT=.so
    267 	[case "$host_os" in
    268 	darwin*)
    269 		MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
    270 		LIB_EXT=.dylib
    271 	;;
    272 	esac]
    273 	AC_MSG_RESULT([Enabling BSD shared libraries])
    274 fi
    275 ,
    276 MAKEFILE_BSDLIB=/dev/null
    277 BSDLIB_CMT=#
    278 AC_MSG_RESULT([Disabling BSD shared libraries by default])
    279 )
    280 AC_SUBST(BSDLIB_CMT)
    281 AC_SUBST_FILE(MAKEFILE_BSDLIB)
    282 dnl
    283 dnl handle --enable-profile
    284 dnl
    285 AC_ARG_ENABLE([profile],
    286 [  --enable-profile	  build profiling libraries],
    287 if test "$enableval" = "no"
    288 then
    289 	PROFILE_CMT=#
    290 	MAKEFILE_PROFILE=/dev/null
    291 	AC_MSG_RESULT([Disabling profiling libraries])
    292 else
    293 	PROFILE_CMT=
    294 	MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
    295 	PROFILED_LIB_EXT=_p.a
    296 	AC_MSG_RESULT([Building profiling libraries])
    297 fi
    298 ,
    299 PROFILE_CMT=#
    300 MAKEFILE_PROFILE=/dev/null
    301 AC_MSG_RESULT([Disabling profiling libraries by default])
    302 )
    303 AC_SUBST(PROFILE_CMT)
    304 AC_SUBST_FILE(MAKEFILE_PROFILE)
    305 dnl
    306 dnl handle --enable-checker
    307 dnl
    308 AC_ARG_ENABLE([checker],
    309 [  --enable-checker	  build checker libraries],
    310 if test "$enableval" = "no"
    311 then
    312 	CHECKER_CMT=#
    313 	MAKEFILE_CHECKER=/dev/null
    314 	AC_MSG_RESULT([Disabling checker libraries])
    315 else
    316 	CHECKER_CMT=
    317 	MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
    318 	AC_MSG_RESULT([Building checker libraries])
    319 fi
    320 ,
    321 CHECKER_CMT=#
    322 MAKEFILE_CHECKER=/dev/null
    323 AC_MSG_RESULT([Disabling checker libraries by default])
    324 )
    325 AC_SUBST(CHECKER_CMT)
    326 AC_SUBST_FILE(MAKEFILE_CHECKER)
    327 dnl
    328 dnl Substitute library extensions
    329 dnl
    330 AC_SUBST(LIB_EXT)
    331 AC_SUBST(STATIC_LIB_EXT)
    332 AC_SUBST(PROFILED_LIB_EXT)
    333 AC_SUBST(LDFLAG_DYNAMIC)
    334 AC_SUBST(PRIVATE_LIBS_CMT)
    335 dnl
    336 dnl handle --enable-jbd-debug
    337 dnl
    338 AC_ARG_ENABLE([jbd-debug],
    339 [  --enable-jbd-debug  	  enable journal debugging],
    340 if test "$enableval" = "no"
    341 then
    342 	AC_MSG_RESULT([Disabling journal debugging])
    343 else
    344 	AC_DEFINE(CONFIG_JBD_DEBUG)
    345 	AC_MSG_RESULT([Enabling journal debugging])
    346 fi
    347 ,
    348 AC_MSG_RESULT([Disabling journal debugging by default])
    349 )
    350 dnl
    351 dnl handle --enable-blkid-debug
    352 dnl
    353 AC_ARG_ENABLE([blkid-debug],
    354 [  --enable-blkid-debug    enable blkid debugging],
    355 if test "$enableval" = "no"
    356 then
    357 	AC_MSG_RESULT([Disabling blkid debugging])
    358 else
    359 	AC_DEFINE(CONFIG_BLKID_DEBUG)
    360 	AC_MSG_RESULT([Enabling blkid debugging])
    361 fi
    362 ,
    363 AC_MSG_RESULT([Disabling blkid debugging by default])
    364 )
    365 dnl
    366 dnl handle --enable-testio-debug
    367 dnl
    368 AC_ARG_ENABLE([testio-debug],
    369 [  --disable-testio-debug  disable the use of the test I/O manager for debugging],
    370 if test "$enableval" = "no"
    371 then
    372 	AC_MSG_RESULT([Disabling testio debugging])
    373 	TEST_IO_CMT="#"
    374 else
    375 	TEST_IO_CMT=
    376 	AC_DEFINE(CONFIG_TESTIO_DEBUG)
    377 	AC_MSG_RESULT([Enabling testio debugging])
    378 fi
    379 ,
    380 AC_MSG_RESULT([Enabling testio debugging by default])
    381 AC_DEFINE(CONFIG_TESTIO_DEBUG)
    382 TEST_IO_CMT=
    383 )
    384 AC_SUBST(TEST_IO_CMT)
    385 dnl
    386 dnl handle --disable-libuuid
    387 dnl
    388 PKG_PROG_PKG_CONFIG
    389 LIBUUID=
    390 DEPLIBUUID=
    391 STATIC_LIBUUID=
    392 DEPSTATIC_LIBUUID=
    393 PROFILED_LIBUUID=
    394 DEPPROFILED_LIBUUID=
    395 UUID_CMT=
    396 AC_ARG_ENABLE([libuuid],
    397 [  --disable-libuuid	  do not build private uuid library],
    398 if test "$enableval" = "no"
    399 then
    400 	if test -z "$PKG_CONFIG"; then
    401 		AC_MSG_ERROR([pkg-config not installed; please install it.])
    402 	fi
    403 
    404 	AC_CHECK_LIB(uuid, uuid_generate,
    405 		[LIBUUID=`$PKG_CONFIG --libs uuid`;
    406 		 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`],
    407 		[AC_MSG_ERROR([external uuid library not found])],
    408 		[$LIBUUID])
    409 	UUID_CMT=#
    410 	AC_MSG_RESULT([Disabling private uuid library])
    411 else
    412 	LIBUUID='$(LIB)/libuuid'$LIB_EXT
    413 	DEPLIBUUID=$LIBUUID
    414 	STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
    415 	DEPSTATIC_LIBUUID=$STATIC_LIBUUID
    416 	PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
    417 	DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
    418 	AC_MSG_RESULT([Enabling private uuid library])
    419 fi
    420 ,
    421 LIBUUID='$(LIB)/libuuid'$LIB_EXT
    422 DEPLIBUUID=$LIBUUID
    423 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
    424 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
    425 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
    426 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
    427 AC_MSG_RESULT([Enabling private uuid library by default])
    428 )
    429 AC_SUBST(LIBUUID)
    430 AC_SUBST(DEPLIBUUID)
    431 AC_SUBST(STATIC_LIBUUID)
    432 AC_SUBST(DEPSTATIC_LIBUUID)
    433 AC_SUBST(PROFILED_LIBUUID)
    434 AC_SUBST(DEPPROFILED_LIBUUID)
    435 AC_SUBST(UUID_CMT)
    436 dnl
    437 dnl handle --disable-libblkid
    438 dnl
    439 PKG_PROG_PKG_CONFIG
    440 LIBBLKID=
    441 DEPLIBBLKID=
    442 STATIC_LIBBLKID=
    443 DEPSTATIC_LIBBLKID=
    444 PROFILED_LIBBLKID=
    445 DEPPROFILED_LIBBLKID=
    446 BLKID_CMT=
    447 AC_ARG_ENABLE([libblkid],
    448 [  --disable-libblkid	  do not build private blkid library],
    449 if test "$enableval" = "no"
    450 then
    451 	if test -z "$PKG_CONFIG"; then
    452 		AC_MSG_ERROR([pkg-config not installed; please install it.])
    453 	fi
    454 
    455 	AC_CHECK_LIB(blkid, blkid_get_cache,
    456 		[LIBBLKID=`$PKG_CONFIG --libs blkid`;
    457 		 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
    458 		[AC_MSG_ERROR([external blkid library not found])],
    459 		[$LIBBLKID])
    460 	BLKID_CMT=#
    461 	AC_MSG_RESULT([Disabling private blkid library])
    462 else
    463 	LIBBLKID='$(LIB)/libblkid'$LIB_EXT
    464 	DEPLIBBLKID=$LIBBLKID
    465 	STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
    466 	DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
    467 	PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
    468 	DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
    469 	AC_DEFINE(CONFIG_BUILD_FINDFS)
    470 	AC_MSG_RESULT([Enabling private blkid library])
    471 fi
    472 ,
    473 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
    474 DEPLIBBLKID=$LIBBLKID
    475 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
    476 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
    477 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
    478 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
    479 AC_DEFINE(CONFIG_BUILD_FINDFS)
    480 AC_MSG_RESULT([Enabling private blkid library by default])
    481 )
    482 AC_SUBST(LIBBLKID)
    483 AC_SUBST(DEPLIBBLKID)
    484 AC_SUBST(STATIC_LIBBLKID)
    485 AC_SUBST(DEPSTATIC_LIBBLKID)
    486 AC_SUBST(PROFILED_LIBBLKID)
    487 AC_SUBST(DEPPROFILED_LIBBLKID)
    488 AC_SUBST(BLKID_CMT)
    489 dnl
    490 dnl handle --enable-debugfs
    491 dnl
    492 AC_ARG_ENABLE([debugfs],
    493 [  --disable-debugfs   	  disable support of debugfs program],
    494 if test "$enableval" = "no"
    495 then
    496 	AC_MSG_RESULT([Disabling debugfs support])
    497 	DEBUGFS_CMT="#"
    498 else
    499 	DEBUGFS_CMT=
    500 	AC_MSG_RESULT([Enabling debugfs support])
    501 fi
    502 ,
    503 AC_MSG_RESULT([Enabling debugfs support by default])
    504 DEBUGFS_CMT=
    505 )
    506 AC_SUBST(DEBUGFS_CMT)
    507 dnl
    508 dnl handle --enable-imager
    509 dnl
    510 AC_ARG_ENABLE([imager],
    511 [  --disable-imager   	  disable support of e2image program],
    512 if test "$enableval" = "no"
    513 then
    514 	AC_MSG_RESULT([Disabling e2image support])
    515 	IMAGER_CMT="#"
    516 else
    517 	IMAGER_CMT=
    518 	AC_MSG_RESULT([Enabling e2image support])
    519 fi
    520 ,
    521 AC_MSG_RESULT([Enabling e2image support by default])
    522 IMAGER_CMT=
    523 )
    524 AC_SUBST(IMAGER_CMT)
    525 dnl
    526 dnl handle --enable-resizer
    527 dnl
    528 AC_ARG_ENABLE([resizer],
    529 [  --disable-resizer   	  disable support of e2resize program],
    530 if test "$enableval" = "no"
    531 then
    532 	AC_MSG_RESULT([Disabling e2resize support])
    533 	RESIZER_CMT="#"
    534 else
    535 	RESIZER_CMT=
    536 	AC_MSG_RESULT([Enabling e2resize support])
    537 fi
    538 ,
    539 AC_MSG_RESULT([Enabling e2resize support by default])
    540 RESIZER_CMT=
    541 )
    542 AC_SUBST(RESIZER_CMT)
    543 dnl
    544 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
    545 dnl
    546 AC_ARG_ENABLE([fsck],
    547 [  --enable-fsck           build fsck wrapper program],
    548 [if test "$enableval" = "no"
    549 then
    550 	FSCK_PROG='' FSCK_MAN=''
    551 	AC_MSG_RESULT([Not building fsck wrapper])
    552 else
    553 	FSCK_PROG=fsck FSCK_MAN=fsck.8
    554 	AC_MSG_RESULT([Building fsck wrapper])
    555 fi]
    556 ,
    557 [case "$host_os" in
    558   gnu*)
    559     FSCK_PROG='' FSCK_MAN=''
    560     AC_MSG_RESULT([Not building fsck wrapper by default])
    561     ;;
    562   *)
    563     FSCK_PROG=fsck FSCK_MAN=fsck.8
    564     AC_MSG_RESULT([Building fsck wrapper by default])
    565 esac]
    566 )
    567 AC_SUBST(FSCK_PROG)
    568 AC_SUBST(FSCK_MAN)
    569 dnl
    570 dnl See whether to install the `e2initrd-helper' program
    571 dnl
    572 AC_ARG_ENABLE([e2initrd-helper],
    573 [  --enable-e2initrd-helper build e2initrd-helper program],
    574 [if test "$enableval" = "no"
    575 then
    576 	E2INITRD_PROG='' E2INITRD_MAN=''
    577 	AC_MSG_RESULT([Not building e2initrd helper])
    578 else
    579 	E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
    580 	AC_MSG_RESULT([Building e2initrd helper])
    581 fi]
    582 ,
    583 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
    584 AC_MSG_RESULT([Building e2initrd helper by default])
    585 )
    586 AC_SUBST(E2INITRD_PROG)
    587 AC_SUBST(E2INITRD_MAN)
    588 dnl
    589 dnl
    590 dnl
    591 AC_ARG_ENABLE([tls],
    592 [  --disable-tls           disable use of thread local support],
    593 [if test "$enableval" = "no"
    594 then
    595 	try_tls=""
    596 	AC_MSG_RESULT([Disabling thread local support])
    597 else
    598 	try_tls="yes"
    599 	AC_MSG_RESULT([Enabling thread local support])
    600 fi]
    601 ,
    602 if test -n "$WITH_DIET_LIBC"
    603 then
    604 	try_tls=""
    605 	AC_MSG_RESULT([Diet libc does not support thread local support])
    606 else
    607 	try_tls="yes"
    608 	AC_MSG_RESULT([Try using thread local support by default])
    609 fi
    610 )
    611 if test "$try_tls" = "yes"
    612 then
    613 AX_TLS
    614 fi
    615 dnl
    616 dnl
    617 dnl
    618 AC_ARG_ENABLE([uuidd],
    619 [  --disable-uuidd         disable building the uuid daemon],
    620 [if test "$enableval" = "no"
    621 then
    622 	AC_MSG_RESULT([Not building uuidd])
    623 	UUIDD_CMT="#"
    624 else
    625 	AC_DEFINE(USE_UUIDD)
    626 	UUIDD_CMT=""
    627 	AC_MSG_RESULT([Building uuidd])
    628 fi]
    629 ,
    630 AC_DEFINE(USE_UUIDD)
    631 UUIDD_CMT=""
    632 AC_MSG_RESULT([Building uuidd by default])
    633 )
    634 AC_SUBST(UUIDD_CMT)
    635 dnl
    636 dnl
    637 dnl
    638 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
    639 AC_SUBST_FILE(MAKEFILE_LIBRARY)
    640 dnl
    641 dnl Add internationalization support, using gettext.
    642 dnl
    643 GETTEXT_PACKAGE=e2fsprogs
    644 PACKAGE=e2fsprogs
    645 VERSION="$E2FSPROGS_VERSION"
    646 VERSION=0.14.1
    647 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
    648 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
    649 AC_SUBST(GETTEXT_PACKAGE)
    650 AC_SUBST(PACKAGE)
    651 AC_SUBST(VERSION)
    652 
    653 AM_GNU_GETTEXT
    654 dnl
    655 dnl End of configuration options
    656 dnl
    657 AC_SUBST(BINARY_TYPE)
    658 AC_PROG_MAKE_SET
    659 CHECK_GNU_MAKE
    660 AC_PATH_PROG(LN, ln, ln)
    661 AC_PROG_LN_S
    662 AC_PATH_PROG(MV, mv, mv)
    663 AC_PATH_PROG(CP, cp, cp)
    664 AC_PATH_PROG(RM, rm, rm)
    665 AC_PATH_PROG(CHMOD, chmod, :)
    666 AC_PROG_AWK
    667 AC_PROG_EGREP
    668 AC_PATH_PROG(SED, sed, sed)
    669 AC_PATH_PROG(PERL, perl, perl)
    670 AC_PATH_PROG(LDCONFIG, ldconfig, :)
    671 AC_CHECK_TOOL(AR, ar, ar)
    672 AC_CHECK_TOOL(RANLIB, ranlib, :)
    673 AC_CHECK_TOOL(STRIP, strip, :)
    674 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
    675 if test "_$MAKEINFO" = "_"; then
    676     MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
    677 else
    678     case "$MAKEINFO" in
    679       */missing.*)
    680         AC_MSG_WARN([
    681 *** Makeinfo is missing. Info documentation will not be built.])
    682         ;;
    683       *)
    684         ;;
    685     esac
    686 fi
    687 AC_SUBST(MAKEINFO)
    688 AC_PROG_INSTALL
    689 # See if we need a separate native compiler.
    690 if test $cross_compiling = no; then
    691   BUILD_CC="$CC"
    692   AC_SUBST(BUILD_CC)
    693 else
    694   AC_CHECK_PROGS(BUILD_CC, gcc cc)
    695 fi
    696 AC_CHECK_HEADERS(dirent.h errno.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h)
    697 AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
    698 [[
    699 #if HAVE_SYS_QUEUE_H
    700 #include <sys/queue.h>
    701 #endif
    702 ]])
    703 AC_CHECK_HEADERS(net/if.h,,,
    704 [[
    705 #if HAVE_SYS_TYPES_H
    706 #include <sys/types.h>
    707 #endif
    708 #if HAVE_SYS_SOCKET
    709 #include <sys/socket.h>
    710 #endif
    711 ]])
    712 AC_FUNC_VPRINTF
    713 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
    714 dnl is not decleared.
    715 AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT)],,
    716 		[#include <dirent.h>])
    717 dnl Check to see if ssize_t was decleared
    718 AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T)],,
    719 	      [#include <sys/types.h>])
    720 dnl
    721 dnl Check to see if llseek() is declared in unistd.h.  On some libc's 
    722 dnl it is, and on others it isn't..... Thank you glibc developers....
    723 dnl
    724 AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)],,
    725 	      [#include <unistd.h>])
    726 dnl
    727 dnl Check to see if lseek64() is declared in unistd.h.  Glibc's header files
    728 dnl are so convoluted that I can't tell whether it will always be defined,
    729 dnl and if it isn't defined while lseek64 is defined in the library, 
    730 dnl disaster will strike.  
    731 dnl
    732 dnl Warning!  Use of --enable-gcc-wall may throw off this test.
    733 dnl
    734 dnl
    735 AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)],,
    736 		[#define _LARGEFILE_SOURCE
    737 		 #define _LARGEFILE64_SOURCE
    738 		 #include <unistd.h>])
    739 dnl
    740 dnl Word sizes...
    741 dnl
    742 AC_CHECK_SIZEOF(short)
    743 AC_CHECK_SIZEOF(int)
    744 AC_CHECK_SIZEOF(long)
    745 AC_CHECK_SIZEOF(long long)
    746 SIZEOF_SHORT=$ac_cv_sizeof_short
    747 SIZEOF_INT=$ac_cv_sizeof_int
    748 SIZEOF_LONG=$ac_cv_sizeof_long
    749 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
    750 AC_SUBST(SIZEOF_SHORT)
    751 AC_SUBST(SIZEOF_INT)
    752 AC_SUBST(SIZEOF_LONG)
    753 AC_SUBST(SIZEOF_LONG_LONG)
    754 AC_C_BIGENDIAN
    755 BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
    756 ASM_TYPES_HEADER=./asm_types.h
    757 AC_SUBST_FILE(ASM_TYPES_HEADER)
    758 dnl
    759 dnl Save the configuration #defines needed for the public ext2fs.h
    760 dnl header file
    761 dnl
    762 echo "/* These defines are needed for the public ext2fs.h header file */" \
    763      > public_config.h
    764 if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
    765   uniq tmp_config.$$ >> public_config.h
    766 else
    767   echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
    768 fi
    769 if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
    770   uniq tmp_config.$$ >> public_config.h
    771 else
    772   echo "#undef WORDS_BIGENDIAN" >> public_config.h
    773 fi
    774 rm -f tmp_config.$$
    775 PUBLIC_CONFIG_HEADER=./public_config.h
    776 AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
    777 dnl
    778 dnl See if we have inttypes.h and if intptr_t is defined
    779 dnl
    780 AC_CHECK_HEADERS([inttypes.h])
    781 AC_CHECK_TYPES(intptr_t)
    782 dnl
    783 dnl See if struct stat has a st_flags field, in which case we can get file
    784 dnl flags somewhat portably.  Also check for the analogous setter, chflags().
    785 dnl
    786 AC_MSG_CHECKING(whether struct stat has a st_flags field)
    787 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
    788 	AC_TRY_COMPILE([#include <sys/stat.h>],
    789 		[struct stat stat; stat.st_flags = 0;],
    790 		[e2fsprogs_cv_struct_st_flags=yes],
    791 		[e2fsprogs_cv_struct_st_flags=no]))
    792 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
    793 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
    794   AC_MSG_CHECKING(whether st_flags field is useful)
    795   AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
    796 	AC_TRY_COMPILE([#include <sys/stat.h>],
    797 		[struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
    798 		[e2fsprogs_cv_struct_st_flags_immut=yes],
    799 		[e2fsprogs_cv_struct_st_flags_immut=no]))
    800   AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
    801   if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
    802 	  AC_DEFINE(HAVE_STAT_FLAGS)
    803   fi
    804 fi
    805 dnl
    806 dnl Check for the presence of SA_LEN
    807 dnl
    808 AC_CHECK_MEMBER(struct sockaddr.sa_len,
    809 		AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
    810 	[#include <sys/types.h>
    811 	 #include <sys/socket.h>])
    812 dnl
    813 dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using
    814 dnl the system-provided blkid library
    815 dnl
    816 if test -n "$BLKID_CMT"; then
    817   AC_SEARCH_LIBS([blkid_probe_all], [blkid])
    818 fi
    819 dnl
    820 AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid usleep nanosleep getdtablesize getrlimit blkid_probe_get_topology)
    821 dnl
    822 dnl Check to see if -lsocket is required (solaris) to make something
    823 dnl that uses socket() to compile; this is needed for the UUID library
    824 dnl
    825 SOCKET_LIB=''
    826 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
    827 AC_SUBST(SOCKET_LIB)
    828 dnl
    829 dnl See if optreset exists
    830 dnl
    831 AC_MSG_CHECKING(for optreset)
    832 AC_CACHE_VAL(ac_cv_have_optreset,
    833 [AC_EGREP_HEADER(optreset, unistd.h,
    834   ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
    835 AC_MSG_RESULT($ac_cv_have_optreset)
    836 if test $ac_cv_have_optreset = yes; then
    837   AC_DEFINE(HAVE_OPTRESET)
    838 fi
    839 dnl
    840 dnl Test for sem_init, and which library it might require:
    841 dnl
    842 SEM_INIT_LIB=''
    843 AC_CHECK_FUNC(sem_init, ,
    844   AC_CHECK_LIB(pthread, sem_init,
    845   	AC_DEFINE(HAVE_SEM_INIT)
    846   	SEM_INIT_LIB=-lpthread,
    847   AC_CHECK_LIB(rt, sem_init,
    848   	AC_DEFINE(HAVE_SEM_INIT)
    849   	SEM_INIT_LIB=-lrt,
    850   AC_CHECK_LIB(posix4, sem_init,
    851   	AC_DEFINE(HAVE_SEM_INIT)
    852   	SEM_INIT_LIB=-lposix4))))dnl
    853 AC_SUBST(SEM_INIT_LIB)
    854 dnl
    855 dnl Check for unified diff
    856 dnl
    857 AC_MSG_CHECKING(for unified diff option)
    858 if diff -u $0 $0 > /dev/null 2>&1 ; then
    859    UNI_DIFF_OPTS=-u
    860 else
    861    UNI_DIFF_OPTS=-c
    862 fi
    863 AC_MSG_RESULT($UNI_DIFF_OPTS)
    864 AC_SUBST(UNI_DIFF_OPTS)
    865 dnl
    866 dnl We use the EXT2 ioctls only under Linux
    867 dnl
    868 case "$host_os" in
    869 linux*)
    870 	AC_DEFINE(HAVE_EXT2_IOCTLS)
    871 	;;
    872 esac
    873 dnl
    874 dnl OS-specific uncomment control
    875 dnl
    876 LINUX_CMT="#"
    877 CYGWIN_CMT="#"
    878 UNIX_CMT=
    879 case "$host_os" in
    880 linux*)
    881 	LINUX_CMT=
    882 	;;
    883 cygwin)
    884 	CYGWIN_CMT=
    885 	UNIX_CMT="#"
    886 	;;
    887 esac
    888 AC_SUBST(LINUX_CMT)
    889 AC_SUBST(CYGWIN_CMT)
    890 AC_SUBST(UNIX_CMT)
    891 dnl
    892 dnl Linux and Hurd places root files in the / by default
    893 dnl
    894 case "$host_os" in
    895 linux* | gnu* | k*bsd*-gnu)
    896 	if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
    897 		root_prefix="";
    898 		AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
    899 	fi
    900 	;;
    901 esac
    902 dnl
    903 dnl On Linux/hurd, force the prefix to be /usr
    904 dnl
    905 case "$host_os" in
    906 linux* | gnu* | k*bsd*-gnu)
    907 	if test "$prefix" = NONE ; then
    908 		prefix="/usr";
    909 		AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
    910 		if test "$mandir" = '${prefix}/man' ; then
    911 			AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
    912 			mandir=/usr/share/man
    913 		fi
    914 	fi
    915 ;;
    916 esac
    917 if test "$root_prefix" = NONE ; then
    918 	if test "$prefix" = NONE ; then
    919 		root_prefix="$ac_default_prefix"
    920 	else
    921 		root_prefix="$prefix"
    922 	fi
    923 	root_bindir=$bindir
    924 	root_sbindir=$sbindir
    925 	root_libdir=$libdir
    926 	root_sysconfdir=$sysconfdir
    927 else
    928 	root_bindir='${root_prefix}/bin'
    929 	root_sbindir='${root_prefix}/sbin'
    930 	root_libdir='${root_prefix}/lib'
    931 	root_sysconfdir='${root_prefix}/etc'
    932 fi
    933 if test "$bindir" != '${exec_prefix}/bin'; then
    934     root_bindir=$bindir
    935     AC_MSG_RESULT([Setting root_bindir to $root_bindir])
    936 fi
    937 if test "$sbindir" != '${exec_prefix}/sbin'; then
    938     root_sbindir=$sbindir
    939     AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
    940 fi
    941 if test "$libdir" != '${exec_prefix}/lib'; then
    942     root_libdir=$libdir
    943     AC_MSG_RESULT([Setting root_libdir to $root_libdir])
    944 fi
    945 if test "$sysconfdir" != '${prefix}/etc'; then
    946     root_sysconfdir=$sysconfdir
    947     AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
    948 fi
    949 AC_SUBST(root_prefix)
    950 AC_SUBST(root_bindir)
    951 AC_SUBST(root_sbindir)
    952 AC_SUBST(root_libdir)
    953 AC_SUBST(root_sysconfdir)
    954 dnl
    955 dnl See if -static works.
    956 dnl
    957 AC_MSG_CHECKING([whether linker accepts -static])
    958 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
    959 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
    960 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
    961  ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
    962 LDFLAGS=$SAVE_LDFLAGS])
    963 dnl
    964 dnl Regardless of how the test turns out, Solaris doesn't handle -static
    965 dnl This is caused by the socket library requiring the nsl library, which
    966 dnl requires the -dl library, which only works for dynamically linked 
    967 dnl programs.  It basically means you can't have statically linked programs
    968 dnl which use the network under Solaris.  
    969 dnl
    970 case "$host_os" in
    971 solaris2.*)
    972 	ac_cv_e2fsprogs_use_static=no	
    973 ;;
    974 esac
    975 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
    976 LDFLAG_STATIC=
    977 if test $ac_cv_e2fsprogs_use_static = yes; then
    978 	LDFLAG_STATIC=-static
    979 fi
    980 AC_SUBST(LDFLAG_STATIC)
    981 dnl
    982 dnl Work around mysterious Darwin / GNU libintl problem
    983 dnl (__asm__ redirection doesn't work for some mysterious reason.  Looks like
    984 dnl Apple hacked gcc somehow?)
    985 dnl
    986 case "$host_os" in
    987 darwin*)
    988 	AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
    989 	AC_DEFINE(_INTL_REDIRECT_MACROS)
    990 	;;
    991 esac
    992 dnl
    993 dnl Make the ss and et directories work correctly.
    994 dnl
    995 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
    996 ET_DIR=`cd ${srcdir}/lib/et; pwd`
    997 AC_SUBST(SS_DIR)
    998 AC_SUBST(ET_DIR)
    999 dnl
   1000 dnl Only try to run the test suite if we're not cross compiling.
   1001 dnl
   1002 if test "$cross_compiling" = yes ; then
   1003   DO_TEST_SUITE=
   1004 else
   1005   DO_TEST_SUITE=check
   1006 fi
   1007 AC_SUBST(DO_TEST_SUITE)
   1008 dnl
   1009 dnl Only include the intl include files if we're building with them
   1010 dnl 
   1011 INTL_FLAGS=
   1012 if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
   1013 	INTL_FLAGS='-I$(top_builddir)/intl -I$(top_srcdir)/intl'
   1014 fi
   1015 AC_SUBST(INTL_FLAGS)
   1016 dnl
   1017 dnl Build CFLAGS
   1018 dnl
   1019 if test $cross_compiling = no; then
   1020    BUILD_CFLAGS="$CFLAGS"
   1021    BUILD_LDFLAGS="$LDFLAGS"
   1022 else
   1023    BUILD_CFLAGS=
   1024    BUILD_LDFLAGS=
   1025 fi
   1026 AC_SUBST(BUILD_CFLAGS)
   1027 AC_SUBST(BUILD_LDFLAGS)
   1028 dnl
   1029 dnl Make our output files, being sure that we create the some miscellaneous 
   1030 dnl directories
   1031 dnl
   1032 test -d lib || mkdir lib
   1033 test -d include || mkdir include
   1034 test -d include/linux || mkdir include/linux
   1035 test -d include/asm || mkdir include/asm
   1036 for i in MCONFIG Makefile e2fsprogs.spec \
   1037 	util/Makefile util/subst.conf util/gen-tarball \
   1038 	lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
   1039 	lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
   1040 	lib/uuid/Makefile lib/uuid/uuid_types.h \
   1041 	lib/blkid/Makefile lib/blkid/blkid_types.h \
   1042 	lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
   1043 	lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
   1044 	misc/Makefile ext2ed/Makefile e2fsck/Makefile \
   1045 	debugfs/Makefile tests/Makefile tests/progs/Makefile \
   1046 	resize/Makefile doc/Makefile intl/Makefile \
   1047 	intl/libgnuintl.h po/Makefile.in ; do
   1048 	if test -d `dirname ${srcdir}/$i` ; then
   1049 		outlist="$outlist $i"
   1050 	fi
   1051 done
   1052 AC_OUTPUT($outlist)
   1053 if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi
   1054