diff options
-rwxr-xr-x | bin/h5vers | 60 | ||||
-rw-r--r-- | src/H5.c | 63 | ||||
-rw-r--r-- | src/H5public.h | 12 | ||||
-rw-r--r-- | test/tcheck_version.c | 12 | ||||
-rw-r--r-- | test/testcheck_version.sh.in | 11 |
5 files changed, 48 insertions, 110 deletions
@@ -105,13 +105,6 @@ sub setvers { $vers[3]?"-":"", $vers[3])/me; } -sub setltvers { - my ($contents, @vers) = @_; - $_[0] =~ s/^(\#\s*define\s+LT_VERS_INTERFACE\s+)\d+/$1$vers[0]/m; - $_[0] =~ s/^(\#\s*define\s+LT_VERS_REVISION\s+)\d+/$1$vers[1]/m; - $_[0] =~ s/^(\#\s*define\s+LT_VERS_AGE\s+)\d+/$1$vers[2]/m; -} - sub usage { my ($prog) = $0 =~ /([^\/]+)$/; print STDERR <<EOF; @@ -246,7 +239,7 @@ if ($set) { $RELEASE = ""; $CONFIGURE = ""; $CPP_DOC_CONFIG = ""; -# $LT_VERS = ""; + $LT_VERS = ""; @newver = @curver; } @@ -263,45 +256,35 @@ if ($newver[0]*1000000 + $newver[1]*1000 + $newver[2] > $version_increased="true"; } -my @newltver; -# Update the libtool shared library version in src/H5public.h -if ($LT_VERS) { - open FILE, $LT_VERS or die "$LT_VERS: $!\n"; - my ($contentsy) = join "", <FILE>; - close FILE; - - local($_) = $contentsy; - - # Don't increment LT_VERS_REVISION, but instead copy LT_VERS_* values - # to H5public.h. - # my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; - # my $new_lt_revision = $lt_revision+1; - # ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m; - - # open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n"; - # print FILE $contentsy; - # close FILE; - - my ($lt_interface) = /^LT_VERS_INTERFACE\s*=\s*(\d+)/m; - my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; - my ($lt_age) = /^LT_VERS_AGE\s*=\s*(\d+)/m; - - @newltver = ($lt_interface, $lt_revision, $lt_age); - -} - # Update the version number if it changed. if ($newver[0]!=$curver[0] || $newver[1]!=$curver[1] || $newver[2]!=$curver[2] || $newver[3]ne$curver[3]) { setvers $contents, @newver or die "unable to set version\n"; -} - setltvers $contents, @newltver or die "unable to set lt version\n"; rename $file, "$file~" or die "unable to save backup file\n"; open FILE, ">$file" or die "unable to open $file but backup saved!\n"; print FILE $contents; close FILE; +} + +# Update the libtool shared library version in src/Makefile.am if +# the version number has increased. +if ($LT_VERS && $version_increased) { + open FILE, $LT_VERS or die "$LT_VERS: $!\n"; + my ($contentsy) = join "", <FILE>; + close FILE; + + local($_) = $contentsy; + + my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; + my $new_lt_revision = $lt_revision+1; + ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m; + + open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n"; + print FILE $contentsy; + close FILE; +} # Update the README.txt file if ($README) { @@ -453,9 +436,6 @@ if ($verbose) { $newver[3] eq "" ? "" : "-".$newver[3]); } -# print shared lib version in the format of interface.revision.age -printf("Shared lib version %d.%d.%d\n", @newltver[0,1,2]); - exit 0; # Because the first line of this file looks like a Bourne shell script, we @@ -675,31 +675,6 @@ done: * called from user to verify that the versions of header files * compiled into the application match the version of the hdf5 * library. - * Algorithm: - * - * Definitions: - * Compile-time (aka headers, defined in src/H5public.h): - * the three arguments supplied - * interface: compile time interface - * revision: compile time revision - * age: compiler time age - * - * Link-time (aka values library has from its version of src/H5public.h): - * LT_VERS_INTERFACE - * LT_VERS_REVISION - * LT_VERS_AGE - * - * Verification criteria: - * Assert interface >= age and LT_VERS_INTERFACE >= LT_VERS_AGE - * - * if ((LT_VERS_INTERFACE - LT_VERS_AGE) .ne. (interface - age)) then - * mesg “incompatible” - * else - * if (age > LT_VERS_AGE) then - * mesg “incompatible” - * endif - * endif - * * * Return: Success: SUCCEED * @@ -711,8 +686,6 @@ done: * Modifications: * Albert Cheng, May 12, 2001 * Added verification of H5_VERS_INFO. - * Albert Cheng, Oct 8, 2015 - * Changed to use shared library version for verification criteria. * *------------------------------------------------------------------------- */ @@ -727,43 +700,33 @@ done: "settings such as 'LD_LIBRARY_PATH'.\n" herr_t -H5check_version(unsigned interface, unsigned revision, unsigned age) +H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) { char lib_str[256]; char substr[] = H5_VERS_SUBRELEASE; static int checked = 0; /* If we've already checked the version info */ static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */ static const char *version_mismatch_warning = VERSION_MISMATCH_WARNING; - const char *s; /* Environment string for disabling version check */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT_NOERR_NOFS - H5TRACE3("e", "IuIuIu", interface, revision, age); + H5TRACE3("e", "IuIuIu", majnum, minnum, relnum); /* Don't check again, if we already have */ if (checked) HGOTO_DONE(SUCCEED) - /* Check if the user wishes to allow different versions of the header */ - /* files and the library. */ - s = HDgetenv ("HDF5_DISABLE_VERSION_CHECK"); + { const char *s; /* Environment string for disabling version check */ - if (s && HDisdigit(*s)) - disable_version_check = (unsigned int)HDstrtol (s, NULL, 0); + /* Allow different versions of the header files and library? */ + s = HDgetenv ("HDF5_DISABLE_VERSION_CHECK"); - /* assert version sanity */ - if ((LT_VERS_INTERFACE < LT_VERS_AGE) || (interface < age)){ - HDfprintf(stderr, "It is illegal for interface is less than age\n" - "LT_VERS_INTERFACE=%u, LT_VERS_AGE=%u, interface=%u, age=%u\n", - LT_VERS_INTERFACE, LT_VERS_AGE, interface, age); - /* Bail out now. */ - - HDfputs ("Bye...\n", stderr); - HDabort (); + if (s && HDisdigit(*s)) + disable_version_check = (unsigned int)HDstrtol (s, NULL, 0); } - if (((LT_VERS_INTERFACE - LT_VERS_AGE) != (interface - age)) || \ - (age > LT_VERS_AGE)) { + if (H5_VERS_MAJOR!=majnum || H5_VERS_MINOR!=minnum || + H5_VERS_RELEASE!=relnum) { switch (disable_version_check) { case 0: HDfprintf(stderr, "%s%s", version_mismatch_warning, @@ -772,8 +735,8 @@ H5check_version(unsigned interface, unsigned revision, unsigned age) "Setting it to 2 or higher will suppress the warning messages totally.\n"); /* Mention the versions we are referring to */ HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", - interface, revision, age, - (unsigned)LT_VERS_INTERFACE, (unsigned)LT_VERS_REVISION, (unsigned)LT_VERS_AGE); + majnum, minnum, relnum, + (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); /* Show library settings if available */ HDfprintf (stderr, "%s", H5libhdf5_settings); @@ -790,8 +753,8 @@ H5check_version(unsigned interface, unsigned revision, unsigned age) version_mismatch_warning, disable_version_check); /* Mention the versions we are referring to */ HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", - interface, revision, age, - (unsigned)LT_VERS_INTERFACE, (unsigned)LT_VERS_REVISION, (unsigned)LT_VERS_AGE); + majnum, minnum, relnum, + (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); /* Show library settings if available */ HDfprintf (stderr, "%s", H5libhdf5_settings); break; diff --git a/src/H5public.h b/src/H5public.h index f5da58f..4dac82e 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -99,8 +99,8 @@ extern "C" { /* Empty string for real releases. */ #define H5_VERS_INFO "HDF5 library version: 1.8.17-snap0" /* Full version string */ -#define H5check() H5check_version(LT_VERS_INTERFACE, LT_VERS_REVISION, \ - LT_VERS_AGE) +#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ + H5_VERS_RELEASE) /* macros for comparing the version */ #define H5_VERSION_GE(Maj,Min,Rel) \ @@ -113,11 +113,6 @@ extern "C" { ((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR<Min)) || \ (H5_VERS_MAJOR<Maj)) -/* LT Version numbers */ -#define LT_VERS_INTERFACE 11 -#define LT_VERS_REVISION 0 -#define LT_VERS_AGE 1 - /* * Status return values. Failed integer functions in HDF5 result almost * always in a negative value (unsigned failing functions sometimes return @@ -334,7 +329,8 @@ H5_DLL herr_t H5set_free_list_limits (int reg_global_lim, int reg_list_lim, int blk_list_lim); H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum); -H5_DLL herr_t H5check_version(unsigned interface, unsigned revision, unsigned age); +H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, + unsigned relnum); H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts); H5_DLL herr_t H5free_memory(void *mem); H5_DLL void *H5allocate_memory(size_t size, hbool_t clear); diff --git a/test/tcheck_version.c b/test/tcheck_version.c index 67c45fd..a75d642 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.c @@ -39,9 +39,9 @@ void parse(int ac, char **av); void abort_intercept (int H5_ATTR_UNUSED sig); /* global variables */ -unsigned major = LT_VERS_INTERFACE; -unsigned minor = LT_VERS_REVISION; -unsigned release = LT_VERS_AGE; +unsigned major = H5_VERS_MAJOR; +unsigned minor = H5_VERS_MINOR; +unsigned release = H5_VERS_RELEASE; void showhelp(void) @@ -50,9 +50,9 @@ showhelp(void) printf("\t-h\tShow this page and version information\n"); printf("\t-t<vers>: Test by changing (adding 1 to) the <vers> to trigger\n"); printf("\t\t the warning. <vers> can be:\n"); - printf("\t\t\tM for Major version number (%d)\n", LT_VERS_INTERFACE); - printf("\t\t\tm for Minor version number (%d)\n", LT_VERS_REVISION); - printf("\t\t\tr for Release number (%d)\n", LT_VERS_AGE); + printf("\t\t\tM for Major version number (%d)\n", H5_VERS_MAJOR); + printf("\t\t\tm for Minor version number (%d)\n", H5_VERS_MINOR); + printf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE); } diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in index f89480e..ed9845e 100644 --- a/test/testcheck_version.sh.in +++ b/test/testcheck_version.sh.in @@ -217,11 +217,10 @@ h5libsettings=../src/libhdf5.settings PURPOSE -# Figure out lt version numbers from the header file. -# sed uses spaces and tabs as white spaces. -h5versmajor=`sed -e 's/#define[ ]*LT_VERS_INTERFACE[ ]*//p;d' $srcdir/../src/H5public.h` -h5versminor=`sed -e 's/#define[ ]*LT_VERS_REVISION[ ]*//p;d' $srcdir/../src/H5public.h` -h5versrelease=`sed -e 's/#define[ ]*LT_VERS_AGE[ ]*//p;d' $srcdir/../src/H5public.h` +# Figure out library version numbers from the header file. +h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | cut -f2` +h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | cut -f2` +h5versrelease=`grep '#define H5_VERS_RELEASE' $srcdir/../src/H5public.h | cut -f2` DEBUGPRINT $h5versmajor.$h5versminor.$h5versrelease case "$h5versmajor$h5versminor$h5versrelease" in [0-9]*) # good. noop. @@ -248,7 +247,7 @@ fi # HDF5_DISABLE_VERSION_CHECK, as unset, "", -1, 0, 1, 2, 3 for val_disable_version_check in unset "" -1 0 1 2 3; do - for wrong_version in none M r ; do + for wrong_version in none M m r; do TESTING "$val_disable_version_check" "$wrong_version" done done |