From eb7b706f23312631c677ab8cb91accbaca13a45e Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Tue, 5 Aug 2014 21:47:20 +0100 Subject: [PATCH] Use specific Autoconf check for FS resize capability in libparted (#734718) Replace Autoconf check for libparted >= 3.0 Currently uses a custom check which compiles an executable to check for libparted version >= 3.0 to determine if the ped_file_system_resize() function exists in the parted library. Change to use a direct Autoconf check to determine the availability of the ped_file_system_resize() function in the parted library. Bug #734718 - Update Autoconf version specific libparted checks and defines to feature specific ones --- configure.ac | 68 ++++++++++------------------------------------------ 1 file changed, 12 insertions(+), 56 deletions(-) diff --git a/configure.ac b/configure.ac index eb6ab59f..30ca7e61 100644 --- a/configure.ac +++ b/configure.ac @@ -144,62 +144,8 @@ int main () LIBS="$LIBS_save" -dnl====================== -dnl check whether libparted >= 3.0 (libparted is missing file system resizing API) -dnl====================== -LIBPARTED_VERSION=3.0 -AC_MSG_CHECKING([if libparted >= $LIBPARTED_VERSION (libparted is missing file system resizing API)]) -LIBS_save="$LIBS" -LIBS="-lparted -luuid -ldl" -AC_RUN_IFELSE( - [AC_LANG_SOURCE( - [[ -#include -#include - -int main () -{ - int min_major = 0; - int min_minor = 0; - int min_micro = 0; - int major = 0; - int minor = 0; - int micro = 0; - - if ( ( sscanf( "$LIBPARTED_VERSION", "%d.%d.%d", &min_major, &min_minor, &min_micro ) == 3 ) || - ( sscanf( "$LIBPARTED_VERSION", "%d.%d", &min_major, &min_minor ) == 2 ) || - ( sscanf( "$LIBPARTED_VERSION", "%d", &min_major ) == 1 ) - ) - { - if ( ( sscanf( ped_get_version(), "%d.%d.%d", &major, &minor, µ ) == 3 ) || - ( sscanf( ped_get_version(), "%d.%d", &major, &minor ) == 2 ) || - ( sscanf( ped_get_version(), "%d", &major ) == 1 ) - ) - { - return ! ( (major > min_major) || - ( (major == min_major) && (minor > min_minor) ) || - ( (major == min_major) && (minor == min_minor) && (micro >= min_micro) ) - ) ; - } - } - - return 1 ; -} - ]] - )], - [have_old_lp_fs_resize_api=no - AC_MSG_RESULT([yes]) - ], - [have_old_lp_fs_resize_api=yes - AC_MSG_RESULT([no]) - ] -) -LIBS="$LIBS_save" - - -dnl Check for ped_file_system_resize() function in the parted-fs-resize -dnl library to determine the need to use the new library. Available in -dnl parted >= 3.1. +dnl Check for ped_file_system_resize() function to determine the existence +dnl of the API in the original parted library. Available in parted <= 2.4. dnl dnl NOTE: dnl For AC_CHECK_LIB the default action-if-found ($3) includes extending @@ -210,6 +156,16 @@ dnl the library is found. dnl dnl As the default action-if-found is overridden, LIBS isn't extended so dnl saving and restoring LIBS isn't required. +AC_CHECK_LIB( + [parted], [ped_file_system_resize], + [have_old_lp_fs_resize_api=yes], + [have_old_lp_fs_resize_api=no] +) + + +dnl Check for ped_file_system_resize() function in the parted-fs-resize +dnl library to determine the need to use the new library. Available in +dnl parted >= 3.1. AC_CHECK_LIB( [parted-fs-resize], [ped_file_system_resize], [have_new_lp_fs_resize_lib=yes],