+######################################################################
+# Build up information for skipping certain directories depending on disabled
+# features, as well as setting up macros for disabled features.
+
+# This is a tentative database of directories to skip. Some entries may not
+# correspond to anything real, but that's ok, they will simply be ignored.
+# The actual processing of these entries is done in the build.info lookup
+# loop further down.
+#
+# The key is a Unix formatted path in the source tree, the value is an index
+# into %disabled_info, so any existing path gets added to a corresponding
+# 'skipped' entry in there with the list of skipped directories.
+my %skipdir = ();
+my %disabled_info = (); # For configdata.pm
+foreach my $what (sort keys %disabled) {
+ # There are deprecated disablables that translate to themselves.
+ # They cause disabling cascades, but should otherwise not regiter.
+ next if $deprecated_disablables{$what};
+ # The generated $disabled{"deprecated-x.y"} entries are special
+ # and treated properly elsewhere
+ next if $what =~ m|^deprecated-|;
+
+ $config{options} .= " no-$what";
+
+ if (!grep { $what eq $_ } ( 'buildtest-c++', 'fips', 'threads', 'shared',
+ 'module', 'pic', 'dynamic-engine', 'makedepend',
+ 'zlib-dynamic', 'zlib', 'sse2', 'legacy' )) {
+ (my $WHAT = uc $what) =~ s|-|_|g;
+ my $skipdir = $what;
+
+ # fix-up crypto/directory name(s)
+ $skipdir = "ripemd" if $what eq "rmd160";
+ $skipdir = "whrlpool" if $what eq "whirlpool";
+
+ my $macro = $disabled_info{$what}->{macro} = "OPENSSL_NO_$WHAT";
+ push @{$config{openssl_feature_defines}}, $macro;
+
+ $skipdir{engines} = $what if $what eq 'engine';
+ $skipdir{"crypto/$skipdir"} = $what
+ unless $what eq 'async' || $what eq 'err' || $what eq 'dso';
+ }
+}
+
+if ($disabled{"dynamic-engine"}) {
+ push @{$config{openssl_feature_defines}}, "OPENSSL_NO_DYNAMIC_ENGINE";
+} else {
+ push @{$config{openssl_feature_defines}}, "OPENSSL_NO_STATIC_ENGINE";
+}
+