From c1db9811e1e7a7caa1582c724e63b8a3be01992e Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Tue, 5 Aug 2014 00:24:12 +0100 Subject: [PATCH] Use Autoconf check specifically for libparted-fs-resize (#734718) Remove HAVE_LIBPARTED_3_1_0_PLUS definition and replace Autoconf check for libparted >= 3.1 Currently uses custom check which compiles an executable to check for libparted version >= 3.1 to determine the availability of the library parted-fs-resize and the need to include the header . Change to use a direct Autoconf check to determine the availability of the ped_file_system_resize() function in the parted-fs-resize library. Remove inclusion of the header as it has always been included via , at least as far back as parted 1.8.0, and even in parted 3.0 when ped_file_system_resize() and libparted file system resize capability didn't exist. Bug #734718 - Update Autoconf version specific libparted checks and defines to feature specific ones --- configure.ac | 68 +++++++++++------------------------------- include/GParted_Core.h | 3 -- 2 files changed, 17 insertions(+), 54 deletions(-) diff --git a/configure.ac b/configure.ac index 8b8e32e3..8a581960 100644 --- a/configure.ac +++ b/configure.ac @@ -198,58 +198,24 @@ int main () LIBS="$LIBS_save" -dnl====================== -dnl check whether libparted >= 3.1 (libparted has new file system resizing LIB) -dnl====================== -LIBPARTED_VERSION=3.1 -AC_MSG_CHECKING([if libparted >= $LIBPARTED_VERSION (libparted has new file system resizing LIB)]) -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 ; -} - ]] - )], - [AC_DEFINE([HAVE_LIBPARTED_3_1_0_PLUS], [1], [Define to 1 if libparted >= 3.1]) - have_new_lp_fs_resize_lib=yes - AC_MSG_RESULT([yes]) - ], - [have_new_lp_fs_resize_lib=no - AC_MSG_RESULT([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. +dnl +dnl NOTE: +dnl For AC_CHECK_LIB the default action-if-found ($3) includes extending +dnl LIBS with the newly found library ($1) thus: +dnl LIBS="-l$1 $LIBS" +dnl If default action-if-found is overridden, LIBS is not extended when +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-fs-resize], [ped_file_system_resize], + [have_new_lp_fs_resize_lib=yes], + [have_new_lp_fs_resize_lib=no] ) -LIBS="$LIBS_save" dnl Check for availability of libparted fs resize library diff --git a/include/GParted_Core.h b/include/GParted_Core.h index 195bca29..122923e8 100644 --- a/include/GParted_Core.h +++ b/include/GParted_Core.h @@ -22,9 +22,6 @@ #include "../include/Operation.h" #include -#ifdef HAVE_LIBPARTED_3_1_0_PLUS -#include -#endif #include #include