Add configure check for libparted version 3.0.0 or higher

This enhancement is in preparation for addressing the following bug
report:
Bug #651559 - Doesn't compile against parted 3.0
This commit is contained in:
Curtis Gedak 2011-06-08 10:38:55 -06:00
parent 9cdd6c0092
commit 13568bcee7
1 changed files with 53 additions and 1 deletions

View File

@ -131,6 +131,55 @@ 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"
need_work_around=yes
AC_TRY_RUN([
#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_MSG_RESULT([yes])
AC_DEFINE([HAVE_LIBPARTED_3_0_0_PLUS], [1], [Define to 1 if libparted >= 3.0])
have_lp_fs_resize_api=no]
, [AC_MSG_RESULT([no])
have_lp_fs_resize_api=yes]
)
LIBS="$LIBS_save"
dnl GTKMM
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 > 2.8])
AC_SUBST([GTKMM_LIBS])
@ -215,9 +264,12 @@ echo " Installing into prefix : $prefix"
echo ""
echo " Build documentation? : $enable_doc"
echo ""
echo " Use native libparted dmraid support? : $enable_libparted_dmraid"
echo ""
echo " --- Features Based On Libparted Version ---"
echo " Need partition table re-read work around? : $need_pt_reread_work_around"
echo " Supports sector sizes > 512 bytes? : $support_sector_size_gt_512"
echo " Use native libparted dmraid support? : $enable_libparted_dmraid"
echo " Have libparted file system resizing API? : $have_lp_fs_resize_api"
echo ""
echo " If all settings are OK, type make and make install "
echo "=================================================================="