[gparted] Use Autoconf check specifically for libparted-fs-resize (#734718)



commit c1db9811e1e7a7caa1582c724e63b8a3be01992e
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Tue Aug 5 00:24:12 2014 +0100

    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 <parted/filesys.h>.
    
    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 <parted/filesys.h> as it has always been
    included via <parted/parted.h>, 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 8b8e32e..8a58196 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 <stdio.h>
-#include <parted/parted.h>
-
-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, &micro ) == 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 195bca2..122923e 100644
--- a/include/GParted_Core.h
+++ b/include/GParted_Core.h
@@ -22,9 +22,6 @@
 #include "../include/Operation.h"
 
 #include <parted/parted.h>
-#ifdef HAVE_LIBPARTED_3_1_0_PLUS
-#include <parted/filesys.h>
-#endif
 #include <vector>
 #include <fstream>
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]