Automatically enable online resize with libparted >= 3.2 (#734076)

Configure script checks for libparted version >= 3.2 to automatically
determine the availability of online resize capability in libparted.
This can be overridden from the ./configure command line.  Override
enable when an older version of libparted has been patched to include
online resize support with:

    ./configure --enable-online-resize

Override disable with libparted 3.2 or later to disable the feature when
it is not wanted with:

    ./configure --disable-online-resize

Note that GParted also requires, and checks for at runtime, Linux
kernel >= 3.6 for online resize support.  See commit for more details:

    de2844d02d
    Add online resize support (#694622)

Bug #734076 - Autodetect parted online partition resizing capability
This commit is contained in:
Mike Fleetwood 2014-08-10 22:35:27 +01:00 committed by Curtis Gedak
parent 4400b62e8f
commit af05344095
2 changed files with 38 additions and 15 deletions

16
README
View File

@ -114,12 +114,16 @@ b. Building from Source
If you wish to build this package with online resize support then
the following is required:
a) A version of libparted that includes the online resize patch.
At time of writing (November 2013), this patch was only
included in Debian and derived distros with parted package
version 2.3-14 or higher.
b) Linux kernel version 3.6 or higher.
Enable with the --enable-online-resize flag:
a) Linux kernel version 3.6 or higher.
b) Libparted with online resize support. Either:
i) Libparted version 3.2 or later which includes online
resize support as standard. In this case GParted is
automatically built with online resize support.
ii) Online resize support back ported into an earlier version
of libparted. This is only known to be included in Debian
and derived distributions with parted version 2.3-14 and
higher. In this case online resize support must be
specifically enabled with the --enable-online-resize flag:
E.g., ./configure --enable-online-resize
Please note that more than one configure flag can be used:

View File

@ -133,6 +133,20 @@ AS_IF(
)
dnl Check for libparted >= 3.2 for online resize support.
LIBPARTED_WANTED_VERSION='3.2'
AC_MSG_CHECKING([for libparted >= $LIBPARTED_WANTED_VERSION (online resize)])
LIBPARTED_WANTED_INT=`echo "$LIBPARTED_WANTED_VERSION" |
$AWK -F. '{print $1 * 10000 + $2 * 100 + $3}'`
if test "$LIBPARTED_FOUND_INT" -ge "$LIBPARTED_WANTED_INT"; then
have_online_resize=yes
AC_MSG_RESULT([(cached) yes])
else
have_online_resize=no
AC_MSG_RESULT([(cached) no])
fi
dnl Check if have libparted fs resize capability
if test [ ${have_old_lp_fs_resize_api} = yes -o ${have_new_lp_fs_resize_lib} = yes ]; then
AC_DEFINE([HAVE_LIBPARTED_FS_RESIZE], [1], [Define to 1 if have libparted fs resize capability])
@ -265,23 +279,28 @@ else
AC_MSG_RESULT([no])
fi
dnl======================
dnl check whether to enable online resize support
dnl======================
AC_ARG_ENABLE([online_resize],
[ --enable-online-resize enable online resize support],,)
if test "x${enable_online_resize}" = "x" ; then
enable_online_resize=no
fi
AC_ARG_ENABLE(
[online-resize],
AS_HELP_STRING(
[--enable-online-resize],
[enable online resize support @<:@default=auto@:>@]),
[enable_online_resize=$enableval],
[enable_online_resize=$have_online_resize]
)
AC_MSG_CHECKING([whether online resize support is enabled])
if test ${enable_online_resize} = yes; then
if test "x$enable_online_resize" = xyes; then
AC_DEFINE([ENABLE_ONLINE_RESIZE], [1], [Define to 1 if online resize is enabled])
AC_MSG_RESULT([yes])
AC_DEFINE([ENABLE_ONLINE_RESIZE], [1], [Define to 1 if --enable-online-resize specified])
else
AC_MSG_RESULT([no])
fi
AC_CONFIG_FILES([
Makefile
compose/Makefile
@ -308,13 +327,13 @@ echo ""
echo " Build documentation? : $enable_doc"
echo ""
echo " Use native libparted dmraid support? : $enable_libparted_dmraid"
echo " Enable online resize support? : $enable_online_resize"
echo ""
echo " --- Features Based On Libparted Version ---"
echo " Need partition table re-read workaround? : $need_pt_reread_workaround"
echo " Supports large sector sizes (> 512 bytes)? : $support_large_sector_sizes"
echo " Have old libparted file system resizing API? : $have_old_lp_fs_resize_api"
echo " Have new libparted file system resizing LIB? : $have_new_lp_fs_resize_lib"
echo " Enable online resize support? : $enable_online_resize"
echo ""
echo " If all settings are OK, type make and then (as root) make install"
echo "========================================================================"