@@ -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
@@ -581,6 +587,7 @@ impl LibrarySearcher {
581587 }
582588 let config = Config { inc_dir : inc_dir. clone ( ) , link_paths, header } ;
583589 validate_runtime_version ( & config) ;
590+ config. check_against_features_required ( ) ;
584591 config
585592 } else {
586593 panic ! ( "Unable to determine HDF5 location (set HDF5_DIR to specify it manually)." ) ;
@@ -645,6 +652,24 @@ impl Config {
645652 println ! ( "cargo:have_threadsafe=1" ) ;
646653 }
647654 }
655+
656+ fn check_against_features_required ( & self ) {
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+ }
648673}
649674
650675fn main ( ) {
0 commit comments