diff options
author | lloyd <[email protected]> | 2006-09-05 02:44:02 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-09-05 02:44:02 +0000 |
commit | d0312c9cf6352cfa44514a61f00af8c7c63296a1 (patch) | |
tree | 61735e32162ef7f2ef9f0cd0ae208dcd7134739a /configure.pl | |
parent | ad8719cff16d69bee798a968f39b0216a71e123b (diff) |
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.
Diffstat (limited to 'configure.pl')
-rwxr-xr-x | configure.pl | 40 |
1 files changed, 14 insertions, 26 deletions
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; -} |