-# This is somewhat grim, but I want the code for parsing config.sh here and
-# now so that I can expand $Config{ivsize} and $Config{ivtype}
-
-my $fetch_string = <<'EOT';
-
-# Search for it in the big string
-sub fetch_string {
- my($self, $key) = @_;
-
- my $quote_type = "'";
- my $marker = "$key=";
-
- # Check for the common case, ' delimited
- my $start = index($Config_SH, "\n$marker$quote_type");
- # If that failed, check for " delimited
- if ($start == -1) {
- $quote_type = '"';
- $start = index($Config_SH, "\n$marker$quote_type");
- }
- return undef if ( ($start == -1) && # in case it's first
- (substr($Config_SH, 0, length($marker)) ne $marker) );
- if ($start == -1) {
- # It's the very first thing we found. Skip $start forward
- # and figure out the quote mark after the =.
- $start = length($marker) + 1;
- $quote_type = substr($Config_SH, $start - 1, 1);
- }
- else {
- $start += length($marker) + 2;
- }
-
- my $value = substr($Config_SH, $start,
- index($Config_SH, "$quote_type\n", $start) - $start);
-
- # If we had a double-quote, we'd better eval it so escape
- # sequences and such can be interpolated. Since the incoming
- # value is supposed to follow shell rules and not perl rules,
- # we escape any perl variable markers
- if ($quote_type eq '"') {
- $value =~ s/\$/\\\$/g;
- $value =~ s/\@/\\\@/g;
- eval "\$value = \"$value\"";
- }