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
This commit is contained in:
Mike Fleetwood 2014-08-05 00:24:12 +01:00 committed by Curtis Gedak
parent 654cdc7335
commit c1db9811e1
2 changed files with 17 additions and 54 deletions

View file

@ -198,58 +198,24 @@ int main ()
LIBS="$LIBS_save" LIBS="$LIBS_save"
dnl====================== dnl Check for ped_file_system_resize() function in the parted-fs-resize
dnl check whether libparted >= 3.1 (libparted has new file system resizing LIB) dnl library to determine the need to use the new library. Available in
dnl====================== dnl parted >= 3.1.
LIBPARTED_VERSION=3.1 dnl
AC_MSG_CHECKING([if libparted >= $LIBPARTED_VERSION (libparted has new file system resizing LIB)]) dnl NOTE:
LIBS_save="$LIBS" dnl For AC_CHECK_LIB the default action-if-found ($3) includes extending
LIBS="-lparted -luuid -ldl" dnl LIBS with the newly found library ($1) thus:
AC_RUN_IFELSE( dnl LIBS="-l$1 $LIBS"
[AC_LANG_SOURCE( dnl If default action-if-found is overridden, LIBS is not extended when
[[ dnl the library is found.
#include <stdio.h> dnl
#include <parted/parted.h> dnl As the default action-if-found is overridden, LIBS isn't extended so
dnl saving and restoring LIBS isn't required.
int main () AC_CHECK_LIB(
{ [parted-fs-resize], [ped_file_system_resize],
int min_major = 0; [have_new_lp_fs_resize_lib=yes],
int min_minor = 0; [have_new_lp_fs_resize_lib=no]
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])
]
) )
LIBS="$LIBS_save"
dnl Check for availability of libparted fs resize library dnl Check for availability of libparted fs resize library

View file

@ -22,9 +22,6 @@
#include "../include/Operation.h" #include "../include/Operation.h"
#include <parted/parted.h> #include <parted/parted.h>
#ifdef HAVE_LIBPARTED_3_1_0_PLUS
#include <parted/filesys.h>
#endif
#include <vector> #include <vector>
#include <fstream> #include <fstream>