From d0312c9cf6352cfa44514a61f00af8c7c63296a1 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 5 Sep 2006 02:44:02 +0000 Subject: Remove set_os_defines and set_cc_defines, replace them with a call to read_info_files which encapsulates the loop over the directory, calling a function reference for each file and collating the results. --- configure.pl | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) (limited to 'configure.pl') diff --git a/configure.pl b/configure.pl index 833073e55..c069744af 100755 --- a/configure.pl +++ b/configure.pl @@ -80,8 +80,8 @@ sub main { %MODULES = get_modules_list($MOD_DIR); set_arch_defines($ARCH_DIR); - set_os_defines($OS_DIR); - set_cc_defines($CC_DIR); + %OPERATING_SYSTEM = read_info_files($OS_DIR, \&get_os_info); + %COMPILER = read_info_files($CC_DIR, \&get_cc_info); my ($debug, $dumb_gcc, $no_shared) = (0, 0, 0); my ($make_style, $build_dir, $module_set, $local_config) = @@ -1731,6 +1731,18 @@ sub get_modules_list { return %MODULES; } +sub read_info_files { + my ($dir,$func) = @_; + + my %allinfo; + + foreach my $os (dir_list($dir)) { + my %info = &$func($os, File::Spec->catfile($dir, $os)); + %{$allinfo{$os}} = %info; + } + return %allinfo; +} + sub get_module_info { my ($name, $file) = @_; @@ -1919,27 +1931,3 @@ sub set_arch_defines { } %CPU = %allinfo; } - -sub set_os_defines { - my $dir = $_[0]; - my %allinfo; - - foreach my $os (dir_list($dir)) { - my %info = get_os_info($os, File::Spec->catfile($dir, $os)); - - %{$allinfo{$os}} = %info; - } - %OPERATING_SYSTEM = %allinfo; -} - -sub set_cc_defines { - my $dir = $_[0]; - my %allinfo; - - foreach my $cc (dir_list($dir)) { - my %info = get_cc_info($cc, File::Spec->catfile($dir, $cc)); - - %{$allinfo{$cc}} = %info; - } - %COMPILER = %allinfo; -} -- cgit v1.2.3