1#!/usr/bin/env perl -w 2# ************************************************************* 3# 4# Licensed to the Apache Software Foundation (ASF) under one 5# or more contributor license agreements. See the NOTICE file 6# distributed with this work for additional information 7# regarding copyright ownership. The ASF licenses this file 8# to you under the Apache License, Version 2.0 (the 9# "License"); you may not use this file except in compliance 10# with the License. You may obtain a copy of the License at 11# 12# http://www.apache.org/licenses/LICENSE-2.0 13# 14# Unless required by applicable law or agreed to in writing, 15# software distributed under the License is distributed on an 16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17# KIND, either express or implied. See the License for the 18# specific language governing permissions and limitations 19# under the License. 20# 21# ************************************************************* 22 23# *********************************************************************** 24# Description: 25# Filename: osarch.pm 26# Author: EG 27# Date: 28.10.96 28# $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/solenv/bin/modules/osarch.pm,v 1.3 2008-08-18 13:11:04 vg Exp $ 29# Copyright: STAR DIVISION 30# **********************************************************************/ 31 32package osarch; 33 34$m_str = `uname -m`; 35$s_str = `uname -s`; 36chop( $m_str, $s_str ); 37 38%osTable = ("SunOS", "solaris", 39 "HP-UX", "hpux", 40 "AIX", "aix", 41 "OS/390", "s390", 42 "Linux", "linux", 43 "FreeBSD", "freebsd", 44 "NetBSD", "netbsd", 45 "OSF1", "decunix", 46 "SCO_SV", "scoosr5", 47# "SCO_SV", "scouw21", 48 "Darwin", "macosxp", 49 "Mac OS", "macosxp", 50 "SINIX-N", "sinix" 51 ); 52 53%osDefTable = ("SunOS", "-DSYSV -DSOLARIS", 54 "HP-UX", "-DSYSV -DHPUX", 55 "AIX", "-DSYSV -DAIX", 56 "Linux", "-DLINUX", 57 "FreeBSD", "-DFREEBSD", 58 "NetBSD", "-DNETBSD", 59 "OSF1", "-DSYSV -DDECUNIX", 60 "SCO_SV", "-DSYSV -DSCO -DSCO_OSR5", 61# "SCO_SV", "-DSYSV -DSCO -DSCO_UW21", 62 "Darwin", "-DBSD -DMACOSX", 63 "Mac OS", "-DBSD -DMACOSX", 64 "SINIX-N", "-DSYSV -DSINIX" 65 ); 66 67%osDosTable = ("SunOS", "sol", 68 "HP-UX", "hpx", 69 "AIX", "aix", 70 "OS/390", "mvs", 71 "Linux", "lng", 72 "FreeBSD", "fbsd", 73 "NetBSD", "bsd", 74 "SCO_SV", "sco", 75 "Darwin", "macx", 76 "Mac OS", "macx", 77 "SINIX-N", "sni" 78 ); 79 80%archTable = ("sun4c", "sparc", 81 "sun4m", "sparc", 82 "sun4u", "sparc", 83 "9000/712", "hp9000", 84 "9000/715", "hp9000", 85 "9000/778", "hp9000", 86 "000029484600", "rs6000", # salsa 87 "000328144600", "rs6000", # lambada 88 "00245D29E000", "rs6000", # segv 89 "00245C46E000", "rs6000", # bus 90 "002012974600", "rs6000", # tango 91 "0006404C4C00", "rs6000", # jive 92 "2003", "g3", # ezopen4 93 "i86pc", "x86", # blauwal 94 "i386", "x86", # SCO_SV, NetBSD, FreeBSD 95 "i486", "x86", # tiger 96 "i586", "x86", # blauwal 97 "i686", "x86", 98 "prep", "ppc", # hooge 99 "ppc", "ppc", # ppc-linux 100 "alpha", "alpha", 101 "RM400", "rm400", # garbo 102 "IP22", "mips", # voyager 103 "IP32", "mips", # giotto 104 "Power Macintosh", "ppc", # NetBSD/arm32 105 "arm32", "arm32" # NetBSD/arm32 106 ); 107 108%archDefTable=("sun4c", "-DSPARC -DSUN -DSUN4", # hawai 109 "sun4m", "-DSPARC -DSUN -DSUN4", # broccoli 110 "sun4u", "-DSPARC -DSUN -DSUN4", # broccoli 111 "9000/712", "-DHP9000", # tuborg 112 "9000/715", "-DHP9000", # koepi 113 "9000/778", "-DHP9000", # jever, flens 114 "000029484600", "-DRS6000", # salsa 115 "000328144600", "-DRS6000", # lambada 116 "00245D29E000", "-DRS6000", # segv 117 "00245C46E000", "-DRS6000", # segv 118 "002012974600", "-DRS6000", # tango 119 "0006404C4C00", "-DRS6000", # jive 120 "2003", "-DG3", # ezopen4 121 "i86pc", "-DX86 -DINTEL",# gepard 122 "i386", "-DX86", # SCO_SV, NetBSD, FreeBSD 123 "i486", "-DX86", # tiger 124 "i586", "-DX86", # blauwal 125 "i686", "-DX86", # 126 "prep", "-DPPC", # hooge 127 "ppc", "-DPPC", # ppc-linux 128 "alpha", "-DALPHA", # mars 129 "RM400", "-DMIPS -DRM400", # ekberg, garbo 130 "IP22", "-DMIPS", # voyager 131 "IP32", "-DMIPS", # giotto 132 "Power Macintosh", "-DPPC", # NetBSD/arm32 133 "arm32", "-DARM32" # NetBSD/arm32 134 ); 135 136%archDosTable=("sun4c", "s", # hawai 137 "sun4m", "s", # broccoli 138 "sun4u", "s", # broccoli 139 "9000/712", "r", # tuborg 140 "9000/715", "r", # koepi 141 "9000/778", "r", # jever, flens 142 "000029484600", "p", # salsa 143 "000328144600", "p", # lambada 144 "00245D29E000", "p", # segv 145 "00245C46E000", "p", # segv 146 "002012974600", "p", # tango 147 "0006404C4C00", "p", # jive 148 "2003", "g", # ezopen4 149 "i86pc", "i", # gepard 150 "i386", "i", # SCO_SV, NetBSD, FreeBSD 151 "i486", "i", # tiger 152 "i586", "i", # blauwal 153 "i686", "i", 154 "prep", "p", # hooge 155 "ppc", "p", # ppc-linux 156 "alpha", "a", # mars 157 "RM400", "m", # ekberg, garbo 158 "IP22", "m", # voyager 159 "IP32", "m", # giotto 160 "Power Macintosh", "p", # NetBSD/arm32 161 "arm32", "a" # NetBSD/arm32 162 ); 163 164$main::solarDef = $osDefTable{ $s_str }.' '.$archDefTable{ $m_str }; 165 166$main::solarOS = $osTable{ $s_str }; 167$main::solarMT = $archTable{ $m_str }; 168 169$main::solarArch = $main::solarOS.$main::solarMT; 170$main::solarOldArch = $main::solarArch; # for compatibility 171 172$main::solarDOS = 'unx'.$osDosTable{ $s_str }. $archDosTable{ $m_str }; 173 174sub main::osarch 175{ 176 local ( $flag ) = @_; 177 178 $perlFlag = $flag eq 'perl'; 179 $defFlag = $flag eq 'def'; 180 $oldFlag = $flag eq 'old'; 181 $dirFlag = $flag eq 'dir'; 182 $dosFlag = $flag eq 'dos'; 183 184 local( $result ) = ( '' ); 185 186 if ( $perlFlag ) 187 { 188 $result .= '$solarDef = '."'$main::solarDef';\n"; 189 $result .= '$solarArch = '."'$main::solarArch';\n"; 190 $result .= '$solarOldArch = '."'$main::solarOldArch';\n"; 191 $result .= '$solarOS = '."'$main::solarOS';\n"; 192 $result .= '$solarMT = '."'$main::solarMT';\n"; 193 $result .= '$solarDOS = '."'$main::solarDOS';"; 194 } 195 elsif ( $defFlag ) 196 { 197 $result = $main::solarDef; 198 } 199 elsif ( $dirFlag ) 200 { 201 $result = "$main::solarOS-$main::solarMT"; 202 } 203 elsif ( $dosFlag ) 204 { 205 $result = $main::solarDOS; 206 } 207 else 208 { 209 $result = $oldFlag ? $main::solarOldArch : $main::solarArch; 210 } 211 212 return $result; 213} 214 2151; 216