2014-12-04 20:26:46 +08:00
|
|
|
AC_INIT([btrfs-progs],
|
2018-01-23 21:38:30 +08:00
|
|
|
m4_chomp(m4_include([VERSION])),
|
2014-12-04 20:26:46 +08:00
|
|
|
[linux-btrfs@vger.kernel.org],,
|
|
|
|
[http://btrfs.wiki.kernel.org])
|
|
|
|
|
2015-02-13 21:39:43 +08:00
|
|
|
if test "x$PACKAGE_URL" = "x"; then
|
|
|
|
AC_DEFINE([PACKAGE_URL], ["http://btrfs.wiki.kernel.org"], [URL])
|
|
|
|
fi
|
|
|
|
|
2014-12-09 22:58:11 +08:00
|
|
|
dnl library version
|
|
|
|
LIBBTRFS_MAJOR=0
|
|
|
|
LIBBTRFS_MINOR=1
|
2016-12-13 00:48:19 +08:00
|
|
|
LIBBTRFS_PATCHLEVEL=2
|
2014-12-04 20:26:46 +08:00
|
|
|
|
2015-02-05 22:11:40 +08:00
|
|
|
CFLAGS=${CFLAGS:-"-g -O1 -Wall -D_FORTIFY_SOURCE=2"}
|
2015-02-05 02:23:38 +08:00
|
|
|
AC_SUBST([CFLAGS])
|
2014-12-10 18:56:59 +08:00
|
|
|
|
2014-12-04 20:26:46 +08:00
|
|
|
AC_PREREQ([2.60])
|
|
|
|
|
|
|
|
AC_CONFIG_AUX_DIR([config])
|
|
|
|
dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
|
|
|
|
dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
|
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
|
|
|
|
AC_CONFIG_SRCDIR([btrfs.c])
|
2015-11-30 17:36:28 +08:00
|
|
|
AC_PREFIX_DEFAULT([/usr/local])
|
2014-12-04 20:26:46 +08:00
|
|
|
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_CANONICAL_HOST
|
|
|
|
AC_C_CONST
|
|
|
|
AC_C_VOLATILE
|
|
|
|
AC_C_BIGENDIAN
|
|
|
|
|
|
|
|
AC_SYS_LARGEFILE
|
|
|
|
|
|
|
|
AC_PROG_INSTALL
|
2014-12-09 23:41:10 +08:00
|
|
|
AC_PROG_LN_S
|
2016-01-14 18:18:03 +08:00
|
|
|
AC_CHECK_TOOL([AR], [ar])
|
2015-01-29 01:41:17 +08:00
|
|
|
AC_PATH_PROG([RM], [rm], [rm])
|
|
|
|
AC_PATH_PROG([RMDIR], [rmdir], [rmdir])
|
2014-12-04 20:26:46 +08:00
|
|
|
|
2018-02-03 03:51:25 +08:00
|
|
|
|
2014-12-04 20:26:46 +08:00
|
|
|
AC_CHECK_FUNCS([openat], [],
|
|
|
|
[AC_MSG_ERROR([cannot find openat() function])])
|
|
|
|
|
|
|
|
m4_ifndef([PKG_PROG_PKG_CONFIG],
|
|
|
|
[m4_fatal([Could not locate the pkg-config autoconf
|
|
|
|
macros. These are usually located in /usr/share/aclocal/pkg.m4.
|
|
|
|
If your macros are in a different location, try setting the
|
|
|
|
environment variable AL_OPTS="-I/other/macro/dir" before running
|
|
|
|
./autogen.sh or autoreconf again.])])
|
|
|
|
PKG_PROG_PKG_CONFIG
|
|
|
|
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Calls pkg-config --static
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PKG_STATIC], [
|
2018-02-20 01:13:46 +08:00
|
|
|
if AC_RUN_LOG([${PKG_CONFIG} --exists --print-errors "$2"]); then
|
|
|
|
$1=`${PKG_CONFIG} --libs --static "$2"`
|
2014-12-04 20:26:46 +08:00
|
|
|
AC_SUBST([$1])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2014-12-10 22:21:24 +08:00
|
|
|
|
|
|
|
AC_ARG_ENABLE([backtrace],
|
|
|
|
AS_HELP_STRING([--disable-backtrace], [disable btrfs backtrace]),
|
|
|
|
[], [enable_backtrace=yes]
|
|
|
|
)
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_backtrace" = xno], [
|
|
|
|
AC_DEFINE([BTRFS_DISABLE_BACKTRACE], [1], [disable backtrace stuff in kerncompat.h ])
|
|
|
|
])
|
|
|
|
|
2015-02-03 23:50:33 +08:00
|
|
|
if test "x$enable_backtrace" = xyes; then
|
|
|
|
AC_CHECK_HEADERS([execinfo.h])
|
|
|
|
AC_CHECK_FUNCS([backtrace backtrace_symbols_fd], [],
|
|
|
|
AC_MSG_ERROR([standard library does not have backtrace support]))
|
|
|
|
fi
|
|
|
|
|
2014-12-12 18:54:06 +08:00
|
|
|
|
|
|
|
AC_ARG_ENABLE([documentation],
|
|
|
|
AS_HELP_STRING([--disable-documentation], [do not build domumentation]),
|
|
|
|
[], [enable_documentation=yes]
|
|
|
|
)
|
|
|
|
AS_IF([test "x$enable_documentation" = xyes], [DISABLE_DOCUMENTATION=0], [DISABLE_DOCUMENTATION=1])
|
|
|
|
AC_SUBST([DISABLE_DOCUMENTATION])
|
|
|
|
|
2015-02-03 22:38:17 +08:00
|
|
|
dnl detect tools to build documentation
|
2018-02-03 03:51:25 +08:00
|
|
|
ASCIIDOC_TOOL="none"
|
2015-02-03 22:38:17 +08:00
|
|
|
if test "x$enable_documentation" = xyes; then
|
|
|
|
AC_PATH_PROG([XMLTO], [xmlto], [xmlto])
|
|
|
|
AC_PATH_PROG([GZIP], [gzip], [gzip])
|
|
|
|
AC_PATH_PROG([MV], [mv], [mv])
|
|
|
|
AC_PROG_SED
|
2018-02-03 03:51:25 +08:00
|
|
|
AC_PATH_PROG([ASCIIDOC], [asciidoc])
|
|
|
|
AC_PATH_PROG([ASCIIDOCTOR], [asciidoctor])
|
|
|
|
|
|
|
|
dnl asciidoc is preferred
|
|
|
|
if test -n "$ASCIIDOC"; then
|
|
|
|
ASCIIDOC_TOOL="asciidoc"
|
|
|
|
else
|
|
|
|
if test -n "$ASCIIDOCTOR"; then
|
|
|
|
ASCIIDOC_TOOL="asciidoctor"
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([cannot find asciidoc or asciidoctor, cannot build documentation])
|
|
|
|
fi
|
|
|
|
fi
|
2015-02-03 22:38:17 +08:00
|
|
|
fi
|
2018-02-03 03:51:25 +08:00
|
|
|
AC_SUBST([ASCIIDOC_TOOL])
|
2015-02-03 22:38:17 +08:00
|
|
|
|
2015-02-03 23:22:55 +08:00
|
|
|
AC_ARG_ENABLE([convert],
|
|
|
|
AS_HELP_STRING([--disable-convert], [do not build btrfs-convert]),
|
2015-03-25 08:55:41 +08:00
|
|
|
[], [enable_convert=yes]
|
2015-02-03 23:22:55 +08:00
|
|
|
)
|
|
|
|
|
2015-03-25 08:55:41 +08:00
|
|
|
AS_IF([test "x$enable_convert" = xyes], [DISABLE_BTRFSCONVERT=0], [DISABLE_BTRFSCONVERT=1])
|
2015-02-03 23:22:55 +08:00
|
|
|
AC_SUBST([DISABLE_BTRFSCONVERT])
|
|
|
|
|
2016-08-23 23:21:30 +08:00
|
|
|
AC_ARG_WITH([convert],
|
|
|
|
AS_HELP_STRING([[[]--with-convert[[=auto]]]], [built-in filesystems for convert (default: auto)
|
2017-08-23 00:30:43 +08:00
|
|
|
supported (comma separated list): ext2,reiserfs]),
|
2016-08-23 23:21:30 +08:00
|
|
|
[], [with_convert=auto]
|
|
|
|
)
|
|
|
|
|
|
|
|
if test "$with_convert" = "yes"; then
|
|
|
|
with_convert=auto
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$with_convert" = "no"; then
|
|
|
|
with_convert=
|
|
|
|
fi
|
|
|
|
|
|
|
|
convertfs=
|
|
|
|
BTRFSCONVERT_EXT2=0
|
2017-08-23 00:30:43 +08:00
|
|
|
BTRFSCONVERT_REISERFS=0
|
2015-03-25 08:55:41 +08:00
|
|
|
if test "x$enable_convert" = xyes; then
|
2016-08-23 23:21:30 +08:00
|
|
|
if test "x$with_convert" = "xauto" || echo "$with_convert" | grep -q "ext2"; then
|
|
|
|
PKG_CHECK_MODULES(EXT2FS, [ext2fs >= 1.42],,
|
|
|
|
[PKG_CHECK_MODULES(EXT2FS, [ext2fs],
|
|
|
|
[AC_DEFINE([HAVE_OLD_E2FSPROGS], [1],
|
|
|
|
[E2fsprogs does not support BIGALLOC])]
|
|
|
|
)])
|
|
|
|
PKG_CHECK_MODULES(COM_ERR, [com_err])
|
|
|
|
convertfs="${convertfs:+$convertfs,}ext2"
|
|
|
|
BTRFSCONVERT_EXT2=1
|
|
|
|
fi
|
2017-08-23 00:30:43 +08:00
|
|
|
if test "x$with_convert" = "xauto"; then
|
|
|
|
PKG_CHECK_MODULES(REISERFS, [reiserfscore >= 3.6.27],
|
|
|
|
[BTRFSCONVERT_REISERFS=1],
|
|
|
|
[BTRFSCONVERT_REISERFS=0])
|
|
|
|
elif echo "$with_convert" | grep -q "reiserfs"; then
|
|
|
|
PKG_CHECK_MODULES(REISERFS, [reiserfscore >= 3.6.27],
|
|
|
|
[BTRFSCONVERT_REISERFS=1],[])
|
|
|
|
fi
|
|
|
|
if test "$BTRFSCONVERT_REISERFS" = 1; then
|
|
|
|
convertfs="${convertfs:+$convertfs,}reiserfs"
|
|
|
|
fi
|
2016-08-23 23:21:30 +08:00
|
|
|
fi
|
|
|
|
AC_SUBST([BTRFSCONVERT_EXT2])
|
2017-08-23 00:30:43 +08:00
|
|
|
AC_SUBST([BTRFSCONVERT_REISERFS])
|
2016-08-23 23:21:30 +08:00
|
|
|
|
|
|
|
# catch typos
|
2017-10-12 20:08:54 +08:00
|
|
|
tmp=$(echo "$with_convert" | sed -e 's/auto//' | sed -e 's/ext2//' | sed -e 's/reiserfs//' | sed -e 's/,\+//')
|
2016-08-23 23:21:30 +08:00
|
|
|
if ! test "x$tmp" = "x"; then
|
|
|
|
AC_MSG_ERROR([unknown tokens for --with-convert: $tmp])
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$DISABLE_BTRFSCONVERT" = 0 && test "x$convertfs" = "x"; then
|
|
|
|
AC_MSG_ERROR([no filesystems for convert, use --disable-convert instead])
|
2015-02-04 00:12:28 +08:00
|
|
|
fi
|
|
|
|
|
2016-10-15 00:39:40 +08:00
|
|
|
HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE=0
|
2016-06-24 20:04:04 +08:00
|
|
|
AX_CHECK_DEFINE([linux/fiemap.h], [FIEMAP_EXTENT_SHARED], [],
|
2016-10-15 00:39:40 +08:00
|
|
|
[HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE=1
|
|
|
|
AC_MSG_WARN([no definition of FIEMAP_EXTENT_SHARED found, probably old kernel, will use own defintion, 'btrfs fi du' might report wrong numbers])])
|
|
|
|
|
|
|
|
if test "x$HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE" == "x1"; then
|
|
|
|
AC_DEFINE([HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE], [1], [We defined FIEMAP_EXTENT_SHARED])
|
|
|
|
else
|
|
|
|
AC_DEFINE([HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE], [0], [We did not define FIEMAP_EXTENT_SHARED])
|
|
|
|
fi
|
2014-12-12 18:54:06 +08:00
|
|
|
|
2014-12-04 20:26:46 +08:00
|
|
|
dnl Define <NAME>_LIBS= and <NAME>_CFLAGS= by pkg-config
|
|
|
|
dnl
|
|
|
|
dnl The default PKG_CHECK_MODULES() action-if-not-found is end the
|
|
|
|
dnl execution with error. The static libs are optional.
|
|
|
|
|
|
|
|
PKG_CHECK_MODULES(BLKID, [blkid])
|
|
|
|
PKG_STATIC(BLKID_LIBS_STATIC, [blkid])
|
|
|
|
|
|
|
|
PKG_CHECK_MODULES(UUID, [uuid])
|
|
|
|
PKG_STATIC(UUID_LIBS_STATIC, [uuid])
|
|
|
|
|
|
|
|
PKG_CHECK_MODULES(ZLIB, [zlib])
|
|
|
|
PKG_STATIC(ZLIB_LIBS_STATIC, [zlib])
|
|
|
|
|
2017-09-09 04:29:23 +08:00
|
|
|
AC_ARG_ENABLE([zstd],
|
2018-01-30 00:46:42 +08:00
|
|
|
AS_HELP_STRING([--disable-zstd], [build without zstd support]),
|
2017-11-14 22:24:39 +08:00
|
|
|
[], [enable_zstd=yes]
|
2017-09-09 04:29:23 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if test "x$enable_zstd" = xyes; then
|
|
|
|
PKG_CHECK_MODULES(ZSTD, [libzstd >= 1.0.0])
|
|
|
|
PKG_STATIC(ZSTD_LIBS_STATIC, [libzstd])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_zstd" = xyes], [BTRFSRESTORE_ZSTD=1], [BTRFSRESTORE_ZSTD=0])
|
|
|
|
AC_SUBST(BTRFSRESTORE_ZSTD)
|
|
|
|
|
2017-12-18 16:31:25 +08:00
|
|
|
AC_ARG_ENABLE([python],
|
|
|
|
AS_HELP_STRING([--disable-python], [do not build libbtrfsutil Python bindings]),
|
|
|
|
[], [enable_python=yes]
|
|
|
|
)
|
|
|
|
|
|
|
|
if test "x$enable_python" = xyes; then
|
|
|
|
AM_PATH_PYTHON([3.4])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_python" = xyes], [PYTHON_BINDINGS=1], [PYTHON_BINDINGS=0])
|
|
|
|
AC_SUBST(PYTHON_BINDINGS)
|
|
|
|
AC_SUBST(PYTHON)
|
|
|
|
|
2016-08-31 09:15:44 +08:00
|
|
|
# udev v190 introduced the btrfs builtin and a udev rule to use it.
|
|
|
|
# Our udev rule gives us the friendly dm names but isn't required (or valid)
|
|
|
|
# on earlier releases.
|
|
|
|
UDEVDIR=
|
2018-02-20 01:13:46 +08:00
|
|
|
if ${PKG_CONFIG} udev --atleast-version 190; then
|
|
|
|
UDEVDIR="$(${PKG_CONFIG} udev --variable=udevdir)"
|
2016-08-31 09:15:44 +08:00
|
|
|
fi
|
2016-05-13 11:44:52 +08:00
|
|
|
AC_SUBST(UDEVDIR)
|
2016-05-09 23:44:26 +08:00
|
|
|
|
2014-12-04 20:26:46 +08:00
|
|
|
dnl lzo library does not provide pkg-config, let use classic way
|
|
|
|
AC_CHECK_LIB([lzo2], [lzo_version], [
|
|
|
|
LZO2_LIBS="-llzo2"
|
|
|
|
LZO2_CFLAGS=""
|
|
|
|
LZO2_LIBS_STATIC="-llzo2"],[
|
|
|
|
AC_MSG_ERROR([cannot find lzo2 library])
|
|
|
|
])
|
|
|
|
AC_SUBST([LZO2_LIBS])
|
|
|
|
AC_SUBST([LZO2_LIBS_STATIC])
|
|
|
|
AC_SUBST([LZO2_CFLAGS])
|
|
|
|
|
|
|
|
|
2014-12-09 22:58:11 +08:00
|
|
|
dnl library stuff
|
|
|
|
AC_SUBST([LIBBTRFS_MAJOR])
|
|
|
|
AC_SUBST([LIBBTRFS_MINOR])
|
|
|
|
AC_SUBST([LIBBTRFS_PATCHLEVEL])
|
2014-12-04 20:26:46 +08:00
|
|
|
|
|
|
|
AC_CONFIG_HEADERS([config.h])
|
|
|
|
|
|
|
|
AC_CONFIG_FILES([
|
2017-01-30 18:04:16 +08:00
|
|
|
Makefile.inc
|
2015-02-03 21:49:09 +08:00
|
|
|
Documentation/Makefile
|
2014-12-09 22:58:11 +08:00
|
|
|
version.h
|
2014-12-04 20:26:46 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_OUTPUT
|
|
|
|
|
|
|
|
AC_MSG_RESULT([
|
|
|
|
${PACKAGE_NAME} ${PACKAGE_VERSION}
|
|
|
|
|
2017-09-09 04:29:23 +08:00
|
|
|
prefix: ${prefix}
|
|
|
|
exec prefix: ${exec_prefix}
|
2014-12-04 20:26:46 +08:00
|
|
|
|
2017-09-09 04:29:23 +08:00
|
|
|
bindir: ${bindir}
|
|
|
|
libdir: ${libdir}
|
|
|
|
includedir: ${includedir}
|
2014-12-04 20:26:46 +08:00
|
|
|
|
2017-09-09 04:29:23 +08:00
|
|
|
compiler: ${CC}
|
|
|
|
cflags: ${CFLAGS}
|
|
|
|
ldflags: ${LDFLAGS}
|
2014-12-04 20:26:46 +08:00
|
|
|
|
2017-09-09 04:29:23 +08:00
|
|
|
documentation: ${enable_documentation}
|
2018-02-03 03:51:25 +08:00
|
|
|
doc generator: ${ASCIIDOC_TOOL}
|
2017-09-09 04:29:23 +08:00
|
|
|
backtrace support: ${enable_backtrace}
|
|
|
|
btrfs-convert: ${enable_convert} ${convertfs:+($convertfs)}
|
|
|
|
btrfs-restore zstd: ${enable_zstd}
|
2017-12-18 16:31:25 +08:00
|
|
|
Python bindings: ${enable_python}
|
|
|
|
Python interpreter: ${PYTHON}
|
2015-02-03 23:31:51 +08:00
|
|
|
|
2014-12-04 20:26:46 +08:00
|
|
|
Type 'make' to compile.
|
|
|
|
])
|