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 If you wish to build this package with online resize support then
the following is required: the following is required:
a) A version of libparted that includes the online resize patch. a) Linux kernel version 3.6 or higher.
At time of writing (November 2013), this patch was only b) Libparted with online resize support. Either:
included in Debian and derived distros with parted package i) Libparted version 3.2 or later which includes online
version 2.3-14 or higher. resize support as standard. In this case GParted is
b) Linux kernel version 3.6 or higher. automatically built with online resize support.
Enable with the --enable-online-resize flag: 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 E.g., ./configure --enable-online-resize
Please note that more than one configure flag can be used: 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 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 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]) 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]) AC_MSG_RESULT([no])
fi fi
dnl====================== dnl======================
dnl check whether to enable online resize support dnl check whether to enable online resize support
dnl====================== dnl======================
AC_ARG_ENABLE([online_resize], AC_ARG_ENABLE(
[ --enable-online-resize enable online resize support],,) [online-resize],
if test "x${enable_online_resize}" = "x" ; then AS_HELP_STRING(
enable_online_resize=no [--enable-online-resize],
fi [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]) 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_MSG_RESULT([yes])
AC_DEFINE([ENABLE_ONLINE_RESIZE], [1], [Define to 1 if --enable-online-resize specified])
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
compose/Makefile compose/Makefile
@ -308,13 +327,13 @@ echo ""
echo " Build documentation? : $enable_doc" echo " Build documentation? : $enable_doc"
echo "" echo ""
echo " Use native libparted dmraid support? : $enable_libparted_dmraid" echo " Use native libparted dmraid support? : $enable_libparted_dmraid"
echo " Enable online resize support? : $enable_online_resize"
echo "" echo ""
echo " --- Features Based On Libparted Version ---" echo " --- Features Based On Libparted Version ---"
echo " Need partition table re-read workaround? : $need_pt_reread_workaround" echo " Need partition table re-read workaround? : $need_pt_reread_workaround"
echo " Supports large sector sizes (> 512 bytes)? : $support_large_sector_sizes" 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 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 " Have new libparted file system resizing LIB? : $have_new_lp_fs_resize_lib"
echo " Enable online resize support? : $enable_online_resize"
echo "" echo ""
echo " If all settings are OK, type make and then (as root) make install" echo " If all settings are OK, type make and then (as root) make install"
echo "========================================================================" echo "========================================================================"