(output_kind): New.
(output_functions, output_identifiers, output_headers): Use it.
+2001-06-12 Akim Demaille <akim@epita.fr>
+
+ * autoscan.in (%kind_comment): New.
+ (output_kind): New.
+ (output_functions, output_identifiers, output_headers): Use it.
+
2001-06-12 Akim Demaille <akim@epita.fr>
* autoscan.in (&print_unique): Take `$kind' and `$word' as
'libraries' => 'AC_CHECK_LIB'
);
+my %kind_comment =
+ (
+ 'functions' => 'Checks for library functions.',
+ 'headers' => 'Checks for header files.',
+ 'identifiers' => 'Checks for typedefs, structures, and compiler characteristics.',
+ );
my $configure_scan = 'configure.scan';
}
+# output_kind ($KIND)
+# -------------------
+sub output_kind ($)
+{
+ my ($kind) = @_;
+ my @have;
+
+ print CONF "\n# $kind_comment{$kind}\n";
+ foreach my $word (sort keys %{$used{$kind}})
+ {
+ if (defined $macro{$kind}{$word})
+ {
+ if ($macro{$kind}{$word} eq $generic_macro{$kind})
+ {
+ push (@have, $word);
+ push (@{$needed_macros{"$generic_macro{$kind}([$word])"}},
+ @{$used{$kind}{$word}});
+ }
+ else
+ {
+ print_unique ($kind, $word);
+ }
+ }
+ }
+ print CONF "$generic_macro{$kind}([" . join(' ', sort(@have)) . "])\n"
+ if @have;
+}
+
+
+
# output_programs ()
# ------------------
sub output_programs ()
# -----------------
sub output_headers ()
{
- my @have_headers;
-
- print CONF "\n# Checks for header files.\n";
- foreach my $word (sort keys %{$used{'headers'}})
- {
- if (defined $macro{'headers'}{$word})
- {
- if ($macro{'headers'}{$word} eq 'AC_CHECK_HEADERS')
- {
- push (@have_headers, $word);
- push (@{$needed_macros{"AC_CHECK_HEADERS([$word])"}},
- @{$used{'headers'}{$word}});
- }
- else
- {
- print_unique ('headers', $word);
- }
- }
- }
- print CONF "AC_CHECK_HEADERS([" . join(' ', sort(@have_headers)) . "])\n"
- if @have_headers;
+ output_kind ('headers');
}
# ---------------------
sub output_identifiers ()
{
- my @have_types;
-
- print CONF "\n# Checks for typedefs, structures, and compiler characteristics.\n";
- foreach my $word (sort keys %{$used{'identifiers'}})
- {
- if (defined $macro{'identifiers'}{$word})
- {
- if ($macro{'identifiers'}{$word} eq 'AC_CHECK_TYPES')
- {
- push (@have_types, $word);
- push (@{$needed_macros{"AC_CHECK_TYPES([$word])"}},
- @{$used{'identifiers'}{$word}});
- }
- else
- {
- print_unique ('identifiers', $word);
- }
- }
- }
- print CONF "AC_CHECK_TYPES([" . join(', ', sort(@have_types)) . "])\n"
- if @have_types;
+ output_kind ('identifiers');
}
# -------------------
sub output_functions ()
{
- my @have_funcs;
-
- print CONF "\n# Checks for library functions.\n";
- foreach my $word (sort keys %{$used{'functions'}})
- {
- if (defined $macro{'functions'}{$word})
- {
- if ($macro{'functions'}{$word} eq 'AC_CHECK_FUNCS')
- {
- push (@have_funcs, $word);
- push (@{$needed_macros{"AC_CHECK_FUNCS([$word])"}},
- @{$used{'functions'}{$word}});
- }
- else
- {
- print_unique ('functions', $word);
- }
- }
- }
- print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n"
- if @have_funcs;
+ output_kind ('functions');
}
'libraries' => 'AC_CHECK_LIB'
);
+my %kind_comment =
+ (
+ 'functions' => 'Checks for library functions.',
+ 'headers' => 'Checks for header files.',
+ 'identifiers' => 'Checks for typedefs, structures, and compiler characteristics.',
+ );
my $configure_scan = 'configure.scan';
}
+# output_kind ($KIND)
+# -------------------
+sub output_kind ($)
+{
+ my ($kind) = @_;
+ my @have;
+
+ print CONF "\n# $kind_comment{$kind}\n";
+ foreach my $word (sort keys %{$used{$kind}})
+ {
+ if (defined $macro{$kind}{$word})
+ {
+ if ($macro{$kind}{$word} eq $generic_macro{$kind})
+ {
+ push (@have, $word);
+ push (@{$needed_macros{"$generic_macro{$kind}([$word])"}},
+ @{$used{$kind}{$word}});
+ }
+ else
+ {
+ print_unique ($kind, $word);
+ }
+ }
+ }
+ print CONF "$generic_macro{$kind}([" . join(' ', sort(@have)) . "])\n"
+ if @have;
+}
+
+
+
# output_programs ()
# ------------------
sub output_programs ()
# -----------------
sub output_headers ()
{
- my @have_headers;
-
- print CONF "\n# Checks for header files.\n";
- foreach my $word (sort keys %{$used{'headers'}})
- {
- if (defined $macro{'headers'}{$word})
- {
- if ($macro{'headers'}{$word} eq 'AC_CHECK_HEADERS')
- {
- push (@have_headers, $word);
- push (@{$needed_macros{"AC_CHECK_HEADERS([$word])"}},
- @{$used{'headers'}{$word}});
- }
- else
- {
- print_unique ('headers', $word);
- }
- }
- }
- print CONF "AC_CHECK_HEADERS([" . join(' ', sort(@have_headers)) . "])\n"
- if @have_headers;
+ output_kind ('headers');
}
# ---------------------
sub output_identifiers ()
{
- my @have_types;
-
- print CONF "\n# Checks for typedefs, structures, and compiler characteristics.\n";
- foreach my $word (sort keys %{$used{'identifiers'}})
- {
- if (defined $macro{'identifiers'}{$word})
- {
- if ($macro{'identifiers'}{$word} eq 'AC_CHECK_TYPES')
- {
- push (@have_types, $word);
- push (@{$needed_macros{"AC_CHECK_TYPES([$word])"}},
- @{$used{'identifiers'}{$word}});
- }
- else
- {
- print_unique ('identifiers', $word);
- }
- }
- }
- print CONF "AC_CHECK_TYPES([" . join(', ', sort(@have_types)) . "])\n"
- if @have_types;
+ output_kind ('identifiers');
}
# -------------------
sub output_functions ()
{
- my @have_funcs;
-
- print CONF "\n# Checks for library functions.\n";
- foreach my $word (sort keys %{$used{'functions'}})
- {
- if (defined $macro{'functions'}{$word})
- {
- if ($macro{'functions'}{$word} eq 'AC_CHECK_FUNCS')
- {
- push (@have_funcs, $word);
- push (@{$needed_macros{"AC_CHECK_FUNCS([$word])"}},
- @{$used{'functions'}{$word}});
- }
- else
- {
- print_unique ('functions', $word);
- }
- }
- }
- print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n"
- if @have_funcs;
+ output_kind ('functions');
}