[gparted] Use specific Autoconf check for FS resize capability in libparted (#734718)



commit eb7b706f23312631c677ab8cb91accbaca13a45e
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Tue Aug 5 21:47:20 2014 +0100

    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 files changed, 12 insertions(+), 56 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index eb6ab59..30ca7e6 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 <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 ;
-}
-               ]]
-       )],
-       [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
@@ -211,6 +157,16 @@ 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],
        [have_new_lp_fs_resize_lib=no]


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