summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--btrfs-convert.c1
-rw-r--r--configure.ac45
3 files changed, 41 insertions, 7 deletions
diff --git a/Makefile.in b/Makefile.in
index 1928a4ef..5c0c0d06 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -40,6 +40,7 @@ RMDIR = @RMDIR@
INSTALL = @INSTALL@
DISABLE_DOCUMENTATION = @DISABLE_DOCUMENTATION@
DISABLE_BTRFSCONVERT = @DISABLE_BTRFSCONVERT@
+BTRFSCONVERT_EXT2 = @BTRFSCONVERT_EXT2@
EXTRA_CFLAGS :=
EXTRA_LDFLAGS :=
@@ -166,6 +167,7 @@ endif
# external libs required by various binaries; for btrfs-foo,
# specify btrfs_foo_libs = <list of libs>; see $($(subst...)) rules below
btrfs_convert_libs = @EXT2FS_LIBS@ @COM_ERR_LIBS@
+btrfs_convert_cflags = -DBTRFSCONVERT_EXT2=$(BTRFSCONVERT_EXT2)
btrfs_fragments_libs = -lgd -lpng -ljpeg -lfreetype
btrfs_debug_tree_objects = cmds-inspect-dump-tree.o
btrfs_show_super_objects = cmds-inspect-dump-super.o
diff --git a/btrfs-convert.c b/btrfs-convert.c
index b34a413d..17ea3685 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -37,6 +37,7 @@
#include "crc32c.h"
#include "utils.h"
#include "task-utils.h"
+
#include <ext2fs/ext2_fs.h>
#include <ext2fs/ext2fs.h>
#include <ext2fs/ext2_ext_attr.h>
diff --git a/configure.ac b/configure.ac
index 901d4347..97e89f23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,13 +104,44 @@ AC_ARG_ENABLE([convert],
AS_IF([test "x$enable_convert" = xyes], [DISABLE_BTRFSCONVERT=0], [DISABLE_BTRFSCONVERT=1])
AC_SUBST([DISABLE_BTRFSCONVERT])
+AC_ARG_WITH([convert],
+ AS_HELP_STRING([[[]--with-convert[[=auto]]]], [built-in filesystems for convert (default: auto)
+supported (comma separated list): ext2]),
+ [], [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
if test "x$enable_convert" = xyes; 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])
+ 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
+fi
+AC_SUBST([BTRFSCONVERT_EXT2])
+
+# catch typos
+tmp=$(echo "$with_convert" | sed -e 's/auto//' | sed -e 's/ext2//' | sed -e 's/,\+/,/')
+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])
fi
AX_CHECK_DEFINE([linux/fiemap.h], [FIEMAP_EXTENT_SHARED], [],
@@ -176,7 +207,7 @@ AC_MSG_RESULT([
documentation: ${enable_documentation}
backtrace support: ${enable_backtrace}
- btrfs-convert: ${enable_convert}
+ btrfs-convert: ${enable_convert} ${convertfs:+($convertfs)}
Type 'make' to compile.
])