@@ -175,6 +175,8 @@ pub struct Header {
175175 pub have_direct : bool ,
176176 pub have_parallel : bool ,
177177 pub have_threadsafe : bool ,
178+ pub have_zlib : bool ,
179+ pub have_no_deprecated : bool ,
178180 pub version : Version ,
179181}
180182
@@ -200,6 +202,10 @@ impl Header {
200202 hdr. have_parallel = value > 0 ;
201203 } else if name == "H5_HAVE_THREADSAFE" {
202204 hdr. have_threadsafe = value > 0 ;
205+ } else if name == "H5_HAVE_FILTER_DEFLATE" {
206+ hdr. have_zlib = value > 0 ;
207+ } else if name == "H5_NO_DEPRECATED_SYMBOLS" {
208+ hdr. have_no_deprecated = value > 0 ;
203209 }
204210 }
205211
@@ -611,6 +617,7 @@ impl LibrarySearcher {
611617 if !( self . pkg_conf_found && cfg ! ( windows) ) {
612618 validate_runtime_version ( & config) ;
613619 }
620+ config. check_against_features_required ( ) ;
614621 config
615622 } else {
616623 panic ! ( "Unable to determine HDF5 location (set HDF5_DIR to specify it manually)." ) ;
@@ -675,6 +682,22 @@ impl Config {
675682 println ! ( "cargo:have_threadsafe=1" ) ;
676683 }
677684 }
685+
686+ fn check_against_features_required ( & self ) {
687+ let h = & self . header ;
688+ for ( flag, feature, native) in [
689+ ( !h. have_no_deprecated , "deprecated" , "HDF5_ENABLE_DEPRECATED_SYMBOLS" ) ,
690+ ( h. have_threadsafe , "threadsafe" , "HDF5_ENABLE_THREADSAFE" ) ,
691+ ( h. have_zlib , "zlib" , "HDF5_ENABLE_Z_LIB_SUPPORT" ) ,
692+ ] {
693+ if feature_enabled ( & feature. to_ascii_uppercase ( ) ) {
694+ assert ! (
695+ flag,
696+ "Enabled feature {feature:?} but the HDF5 library was not built with {native}"
697+ ) ;
698+ }
699+ }
700+ }
678701}
679702
680703fn main ( ) {
0 commit comments