diff options
author | lloyd <[email protected]> | 2007-10-20 21:04:34 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-10-20 21:04:34 +0000 |
commit | a1797765efa6ef33f08905e962bfed5bbfcda912 (patch) | |
tree | 045670a011987cfe6ead2c3c5293caa1d2ecb7cc /configure.pl | |
parent | 0c5395d0d40373447ada983d346da7a46a92d9a0 (diff) |
Compare the value of $^O to names we know about in the hash, rather than
hardcoding them into that function.
Diffstat (limited to 'configure.pl')
-rwxr-xr-x | configure.pl | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/configure.pl b/configure.pl index ae97bec6d..3910a6d3f 100755 --- a/configure.pl +++ b/configure.pl @@ -1687,30 +1687,28 @@ sub guess_compiler sub guess_os { - return 'aix' if($^O eq 'aix'); - return 'beos' if($^O eq 'beos'); - return 'cygwin' if($^O eq 'cygwin'); - return 'darwin' if($^O eq 'darwin'); - return 'freebsd' if($^O eq 'freebsd'); - return 'hpux' if($^O eq 'hpux'); - return 'irix' if($^O eq 'irix'); - return 'linux' if($^O eq 'linux'); - return 'openbsd' if($^O eq 'openbsd'); - return 'solaris' if($^O eq 'solaris'); - return 'windows' if($^O eq 'MSWin32'); - return 'windows' if($^O eq 'dos'); + sub recognize_os + { + my $os = os_alias($_[0]); + return $os if defined($OPERATING_SYSTEM{$os}); + return undef; + } + + my $guess = recognize_os($^O); + return $guess if $guess; trace("Can't guess os from $^O"); - my $os = lc `uname -s 2>/dev/null`; chomp $os; + my $uname = `uname -s 2>/dev/null`; + chomp $uname; + $uname = lc $uname; - # Cygwin's uname -s is cygwin_<windows version> - $os = 'cygwin' if($os =~ /^cygwin/); - $os = os_alias($os); + $guess = recognize_os($uname); + return $guess if $guess; - return $os if defined($OPERATING_SYSTEM{$os}); + trace("Can't guess os from $uname"); - warning("Unknown OS ('$^O', '$os'), falling back to generic code"); + warning("Unknown OS ('$^O', '$uname'), falling back to generic code"); return 'generic'; } |