@@ -168,6 +168,8 @@ pub struct Header {
168168 pub have_direct : bool ,
169169 pub have_parallel : bool ,
170170 pub have_threadsafe : bool ,
171+ pub have_zlib : bool ,
172+ pub have_no_deprecated : bool ,
171173 pub version : Version ,
172174}
173175
@@ -193,6 +195,10 @@ impl Header {
193195 hdr. have_parallel = value > 0 ;
194196 } else if name == "H5_HAVE_THREADSAFE" {
195197 hdr. have_threadsafe = value > 0 ;
198+ } else if name == "H5_HAVE_FILTER_DEFLATE" {
199+ hdr. have_zlib = value > 0 ;
200+ } else if name == "H5_NO_DEPRECATED_SYMBOLS" {
201+ hdr. have_no_deprecated = value > 0 ;
196202 }
197203 }
198204
@@ -571,6 +577,9 @@ impl LibrarySearcher {
571577 }
572578 let config = Config { inc_dir : inc_dir. clone ( ) , link_paths, header } ;
573579 validate_runtime_version ( & config) ;
580+
581+ config. check_against_features_required ( ) ;
582+
574583 config
575584 } else {
576585 panic ! ( "Unable to determine HDF5 location (set HDF5_DIR to specify it manually)." ) ;
@@ -634,6 +643,33 @@ impl Config {
634643 println ! ( "cargo:have_threadsafe=1" ) ;
635644 }
636645 }
646+
647+ fn check_against_features_required ( & self ) {
648+ for version in [ 10 , 12 , 13 ] {
649+ if feature_enabled ( & format ! ( "1_{version}_OR_LATER" ) ) {
650+ assert ! (
651+ self . header. version >= Version { major: 1 , minor: version, micro: 0 } ,
652+ "Required version 1.{version} or later, found {:?}" ,
653+ self . header. version
654+ ) ;
655+ }
656+ }
657+ if feature_enabled ( "DEPRECATED" ) {
658+ assert ! ( !self . header. have_no_deprecated, "Required deprecated symbols are not present" )
659+ }
660+ if feature_enabled ( "THREADSAFE" ) {
661+ assert ! (
662+ self . header. have_threadsafe,
663+ "Required threadsafe but library was not build using the threadsafe option"
664+ ) ;
665+ }
666+ if feature_enabled ( "ZLIB" ) {
667+ assert ! (
668+ self . header. have_zlib,
669+ "Required zlib filter but library does not have builtin support for this options"
670+ ) ;
671+ }
672+ }
637673}
638674
639675fn main ( ) {
0 commit comments