@@ -168,6 +168,8 @@ pub struct Header {
168
168
pub have_direct : bool ,
169
169
pub have_parallel : bool ,
170
170
pub have_threadsafe : bool ,
171
+ pub have_zlib : bool ,
172
+ pub have_no_deprecated : bool ,
171
173
pub version : Version ,
172
174
}
173
175
@@ -193,6 +195,10 @@ impl Header {
193
195
hdr. have_parallel = value > 0 ;
194
196
} else if name == "H5_HAVE_THREADSAFE" {
195
197
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 ;
196
202
}
197
203
}
198
204
@@ -571,6 +577,9 @@ impl LibrarySearcher {
571
577
}
572
578
let config = Config { inc_dir : inc_dir. clone ( ) , link_paths, header } ;
573
579
validate_runtime_version ( & config) ;
580
+
581
+ config. check_against_features_required ( ) ;
582
+
574
583
config
575
584
} else {
576
585
panic ! ( "Unable to determine HDF5 location (set HDF5_DIR to specify it manually)." ) ;
@@ -634,6 +643,33 @@ impl Config {
634
643
println ! ( "cargo:have_threadsafe=1" ) ;
635
644
}
636
645
}
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
+ }
637
673
}
638
674
639
675
fn main ( ) {
0 commit comments