Implemented run time check of libburn version.

This commit is contained in:
Thomas Schmitt 2008-01-23 21:18:25 +00:00
parent e449654c7b
commit beb1c1d2d1
3 changed files with 75 additions and 13 deletions

View File

@ -91,6 +91,20 @@ or
#define Cdrskin_prog_versioN "0.4.1"
#endif
/** The official libburn interface revision to use.
(May get changed further below)
*/
#ifndef Cdrskin_libburn_majoR
#define Cdrskin_libburn_majoR 0
#endif
#ifndef Cdrskin_libburn_minoR
#define Cdrskin_libburn_minoR 4
#endif
#ifndef Cdrskin_libburn_micrO
#define Cdrskin_libburn_micrO 1
#endif
/** The source code release timestamp */
#include "cdrskin_timestamp.h"
#ifndef Cdrskin_timestamP
@ -139,10 +153,30 @@ or
#endif /* Cdrskin_libburn_0_4_1 */
#ifndef Cdrskin_libburn_versioN
#define Cdrskin_libburn_0_4_0
#define Cdrskin_libburn_versioN "0.4.0"
#define Cdrskin_libburn_from_pykix_svN 1
#endif
#ifdef Cdrskin_libburn_0_4_0
#undef Cdrskin_libburn_majoR
#undef Cdrskin_libburn_minoR
#undef Cdrskin_libburn_micrO
#define Cdrskin_libburn_majoR 0
#define Cdrskin_libburn_minoR 4
#define Cdrskin_libburn_micrO 0
#endif
#ifdef Cdrskin_libburn_0_4_1
#undef Cdrskin_libburn_majoR
#undef Cdrskin_libburn_minoR
#undef Cdrskin_libburn_micrO
#define Cdrskin_libburn_majoR 0
#define Cdrskin_libburn_minoR 4
#define Cdrskin_libburn_micrO 1
#endif
#ifdef Cdrskin_libburn_from_pykix_svN
#ifndef Cdrskin_oldfashioned_api_usE
@ -1870,13 +1904,26 @@ int Cdrpreskin_set_severities(struct CdrpreskiN *preskin, char *queue_severity,
int Cdrpreskin_initialize_lib(struct CdrpreskiN *preskin, int flag)
{
int ret;
int ret, major, minor, micro;
ret= burn_initialize();
if(ret==0) {
fprintf(stderr,"cdrskin : FATAL : Initialization of libburn failed\n");
fprintf(stderr,"cdrskin: FATAL : Initialization of libburn failed\n");
return(0);
}
burn_version(&major, &minor, &micro);
/* <<< for testing only */
/* major= 0; minor= 3; micro= 6; */
if(major<Cdrskin_libburn_majoR ||
(major==Cdrskin_libburn_majoR && (minor<Cdrskin_libburn_minoR ||
(minor==Cdrskin_libburn_minoR && micro<Cdrskin_libburn_micrO)))) {
fprintf(stderr,"cdrskin: FATAL : libburn version too old: %d.%d.%d . Need at least: %d.%d.%d .\n",
major, minor, micro,
Cdrskin_libburn_majoR, Cdrskin_libburn_minoR, Cdrskin_libburn_micrO);
return(-1);
}
Cdrpreskin_set_severities(preskin,NULL,NULL,0);
return(1);
}
@ -2773,9 +2820,13 @@ set_severities:;
goto set_severities;
} else if(strcmp(argv[i],"-version")==0) {
int major, minor, micro;
printf(
"Cdrecord 2.01-Emulation Copyright (C) 2006-2007, see libburnia-project.org\n");
printf("libburn version : %s\n",Cdrskin_libburn_versioN);
printf("libburn interface : %s\n",Cdrskin_libburn_versioN);
burn_version(&major, &minor, &micro);
printf("libburn in use : %d.%d.%d\n", major, minor, micro);
#ifndef Cdrskin_extra_leaN
printf("cdrskin version : %s\n",Cdrskin_prog_versioN);

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2008.01.23.193843"
#define Cdrskin_timestamP "2008.01.23.211731"

View File

@ -9,7 +9,7 @@ AM_INIT_AUTOMAKE([subdir-objects])
dnl Note by ts A71207:
dnl
dnl BURN_MICRO_VERSION is _not_ the third component Z of libburn-X.Y.Z
dnl BURN_MICRO_VERSION was _not_ the third component Z of libburn-X.Y.Z
dnl but an eternal counter which leads to CURRENT. This misunderstanding
dnl caused a messed up sequence of CURRENTs.
dnl
@ -68,21 +68,34 @@ dnl .if MAJOR or MINOR version changes, be sure to change AC_INIT above to match
dnl ---------------------------------------------------------------------------
dnl
dnl Instead, LT_CURRENT, LT_REVISION and LT_AGE get set directly now.
dnl If BURN_VERSION changes, be sure to change AC_INIT above to match.
dnl
dnl SONAME of the emerging library is LT_CURRENT - LT_AGE.
dnl The linker will do no finer checks. Especially no age range check for
dnl the cdrskin binary. If SONAME matches, then the couple starts.
dnl
dnl Therefore a run time check is provided by libburn function burn_version().
dnl It returns the major, minor and micro revision of the library. This means
dnl BURN_*_VERSION kept its second job which does not comply to the usual ways
dnl of configure.ac . I.e. now *officially* this is the source code release
dnl version as announced to the public. It has no conection to SONAME or
dnl libtool version numbering.
dnl It rather feeds the API function burn_version().
dnl
dnl If BURN_*_VERSION changes, be sure to change AC_INIT above to match.
dnl
BURN_MAJOR_VERSION=0
BURN_MINOR_VERSION=4
BURN_DEV_VERSION=1
BURN_VERSION=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_DEV_VERSION
BURN_MICRO_VERSION=1
BURN_VERSION=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_MICRO_VERSION
AC_SUBST(BURN_MAJOR_VERSION)
AC_SUBST(BURN_MINOR_VERSION)
AC_SUBST(BURN_DEV_VERSION)
AC_SUBST(BURN_MICRO_VERSION)
AC_SUBST(BURN_VERSION)
dnl Libtool versioning
# LT_RELEASE=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION
LT_RELEASE=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_DEV_VERSION
LT_RELEASE=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_MICRO_VERSION
# SONAME = 10 - 6 = 4 . Library name = libburn.4.6.1
LT_CURRENT=10
LT_REVISION=1
LT_AGE=6
@ -97,8 +110,6 @@ AC_SUBST(LT_CURRENT_MINUS_AGE)
# ts A71207: This is done only not to break any old components
BURN_INTERFACE_AGE=$LT_REVISION
BURN_BINARY_AGE=`expr $LT_AGE + $BURN_INTERFACE_AGE`
BURN_MICRO_VERSION=`expr $LT_CURRENT + $BURN_INTERFACE_AGE`
AC_SUBST(BURN_MICRO_VERSION)
AC_SUBST(BURN_INTERFACE_AGE)
AC_SUBST(BURN_BINARY_AGE)