diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2015-10-08 20:50:15 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2015-10-08 20:50:15 (GMT) |
commit | 1f1081e039bea766161cb7055589b74267764c9b (patch) | |
tree | 4322b8502e18562d6c88535ee83c8f0e1720138e /src/H5.c | |
parent | 74ab402e3eb08b53dbf2ad7d3a27b51cfae87f5b (diff) | |
download | hdf5-1f1081e039bea766161cb7055589b74267764c9b.zip hdf5-1f1081e039bea766161cb7055589b74267764c9b.tar.gz hdf5-1f1081e039bea766161cb7055589b74267764c9b.tar.bz2 |
[svn-r28009] HDFFV-9536: Changed H5check_version() to use libtool shared library version numbers instead of the library version numbers.
bin/h5vers:
Changed to copy the shared lib version from lt_vers.am to H5public.h
(Thanks to Larry who made the changes.)
src/H5public.h:
Changed by bin/h5vers.
src/H5.c:
Changed H5check_version() to use shared library version for compatibility
checking.
test/tcheck_version.c:
test/testcheck_version.sh.in:
Changed to use shared library version numbers instead of the HDF5 library
version numbers for testing.
Tested: tested in Jam and Kituo.
Diffstat (limited to 'src/H5.c')
-rw-r--r-- | src/H5.c | 63 |
1 files changed, 50 insertions, 13 deletions
@@ -675,6 +675,31 @@ 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 * @@ -686,6 +711,8 @@ 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. * *------------------------------------------------------------------------- */ @@ -700,33 +727,43 @@ done: "settings such as 'LD_LIBRARY_PATH'.\n" herr_t -H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) +H5check_version(unsigned interface, unsigned revision, unsigned age) { 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", majnum, minnum, relnum); + H5TRACE3("e", "IuIuIu", interface, revision, age); /* Don't check again, if we already have */ if (checked) HGOTO_DONE(SUCCEED) - { const char *s; /* Environment string for disabling version check */ + /* Check if the user wishes to allow different versions of the header */ + /* files and the library. */ + s = HDgetenv ("HDF5_DISABLE_VERSION_CHECK"); - /* Allow different versions of the header files and library? */ - s = HDgetenv ("HDF5_DISABLE_VERSION_CHECK"); + if (s && HDisdigit(*s)) + disable_version_check = (unsigned int)HDstrtol (s, NULL, 0); - if (s && HDisdigit(*s)) - disable_version_check = (unsigned int)HDstrtol (s, NULL, 0); + /* 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 (H5_VERS_MAJOR!=majnum || H5_VERS_MINOR!=minnum || - H5_VERS_RELEASE!=relnum) { + if (((LT_VERS_INTERFACE - LT_VERS_AGE) != (interface - age)) || \ + (age > LT_VERS_AGE)) { switch (disable_version_check) { case 0: HDfprintf(stderr, "%s%s", version_mismatch_warning, @@ -735,8 +772,8 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) "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", - majnum, minnum, relnum, - (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); + interface, revision, age, + (unsigned)LT_VERS_INTERFACE, (unsigned)LT_VERS_REVISION, (unsigned)LT_VERS_AGE); /* Show library settings if available */ HDfprintf (stderr, "%s", H5libhdf5_settings); @@ -753,8 +790,8 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) 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", - majnum, minnum, relnum, - (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); + interface, revision, age, + (unsigned)LT_VERS_INTERFACE, (unsigned)LT_VERS_REVISION, (unsigned)LT_VERS_AGE); /* Show library settings if available */ HDfprintf (stderr, "%s", H5libhdf5_settings); break; |