1*cdf0e10cSrcweir#!/usr/bin/perl -w 2*cdf0e10cSrcweir 3*cdf0e10cSrcweir# *********************************************************************** 4*cdf0e10cSrcweir# Description: 5*cdf0e10cSrcweir# Filename: osarch.pm 6*cdf0e10cSrcweir# Autor: EG 7*cdf0e10cSrcweir# Date: 28.10.96 8*cdf0e10cSrcweir# $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 $ 9*cdf0e10cSrcweir# Copyright: STAR DIVISION 10*cdf0e10cSrcweir# **********************************************************************/ 11*cdf0e10cSrcweir 12*cdf0e10cSrcweirpackage osarch; 13*cdf0e10cSrcweir 14*cdf0e10cSrcweir$m_str = `uname -m`; 15*cdf0e10cSrcweir$s_str = `uname -s`; 16*cdf0e10cSrcweirchop( $m_str, $s_str ); 17*cdf0e10cSrcweir 18*cdf0e10cSrcweir%osTable = ("SunOS", "solaris", 19*cdf0e10cSrcweir "HP-UX", "hpux", 20*cdf0e10cSrcweir "AIX", "aix", 21*cdf0e10cSrcweir "OS/390", "s390", 22*cdf0e10cSrcweir "Linux", "linux", 23*cdf0e10cSrcweir "FreeBSD", "freebsd", 24*cdf0e10cSrcweir "NetBSD", "netbsd", 25*cdf0e10cSrcweir "OSF1", "decunix", 26*cdf0e10cSrcweir "SCO_SV", "scoosr5", 27*cdf0e10cSrcweir# "SCO_SV", "scouw21", 28*cdf0e10cSrcweir "Darwin", "macosxp", 29*cdf0e10cSrcweir "Mac OS", "macosxp", 30*cdf0e10cSrcweir "SINIX-N", "sinix" 31*cdf0e10cSrcweir ); 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir%osDefTable = ("SunOS", "-DSYSV -DSOLARIS", 34*cdf0e10cSrcweir "HP-UX", "-DSYSV -DHPUX", 35*cdf0e10cSrcweir "AIX", "-DSYSV -DAIX", 36*cdf0e10cSrcweir "Linux", "-DLINUX", 37*cdf0e10cSrcweir "FreeBSD", "-DFREEBSD", 38*cdf0e10cSrcweir "NetBSD", "-DNETBSD", 39*cdf0e10cSrcweir "OSF1", "-DSYSV -DDECUNIX", 40*cdf0e10cSrcweir "SCO_SV", "-DSYSV -DSCO -DSCO_OSR5", 41*cdf0e10cSrcweir# "SCO_SV", "-DSYSV -DSCO -DSCO_UW21", 42*cdf0e10cSrcweir "Darwin", "-DBSD -DMACOSX", 43*cdf0e10cSrcweir "Mac OS", "-DBSD -DMACOSX", 44*cdf0e10cSrcweir "SINIX-N", "-DSYSV -DSINIX" 45*cdf0e10cSrcweir ); 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir%osDosTable = ("SunOS", "sol", 48*cdf0e10cSrcweir "HP-UX", "hpx", 49*cdf0e10cSrcweir "AIX", "aix", 50*cdf0e10cSrcweir "OS/390", "mvs", 51*cdf0e10cSrcweir "Linux", "lng", 52*cdf0e10cSrcweir "FreeBSD", "fbsd", 53*cdf0e10cSrcweir "NetBSD", "bsd", 54*cdf0e10cSrcweir "SCO_SV", "sco", 55*cdf0e10cSrcweir "Darwin", "macx", 56*cdf0e10cSrcweir "Mac OS", "macx", 57*cdf0e10cSrcweir "SINIX-N", "sni" 58*cdf0e10cSrcweir ); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir%archTable = ("sun4c", "sparc", 61*cdf0e10cSrcweir "sun4m", "sparc", 62*cdf0e10cSrcweir "sun4u", "sparc", 63*cdf0e10cSrcweir "9000/712", "hp9000", 64*cdf0e10cSrcweir "9000/715", "hp9000", 65*cdf0e10cSrcweir "9000/778", "hp9000", 66*cdf0e10cSrcweir "000029484600", "rs6000", # salsa 67*cdf0e10cSrcweir "000328144600", "rs6000", # lambada 68*cdf0e10cSrcweir "00245D29E000", "rs6000", # segv 69*cdf0e10cSrcweir "00245C46E000", "rs6000", # bus 70*cdf0e10cSrcweir "002012974600", "rs6000", # tango 71*cdf0e10cSrcweir "0006404C4C00", "rs6000", # jive 72*cdf0e10cSrcweir "2003", "g3", # ezopen4 73*cdf0e10cSrcweir "i86pc", "x86", # blauwal 74*cdf0e10cSrcweir "i386", "x86", # SCO_SV, NetBSD, FreeBSD 75*cdf0e10cSrcweir "i486", "x86", # tiger 76*cdf0e10cSrcweir "i586", "x86", # blauwal 77*cdf0e10cSrcweir "i686", "x86", 78*cdf0e10cSrcweir "prep", "ppc", # hooge 79*cdf0e10cSrcweir "ppc", "ppc", # ppc-linux 80*cdf0e10cSrcweir "alpha", "alpha", 81*cdf0e10cSrcweir "RM400", "rm400", # garbo 82*cdf0e10cSrcweir "IP22", "mips", # voyager 83*cdf0e10cSrcweir "IP32", "mips", # giotto 84*cdf0e10cSrcweir "Power Macintosh", "ppc", # NetBSD/arm32 85*cdf0e10cSrcweir "arm32", "arm32" # NetBSD/arm32 86*cdf0e10cSrcweir ); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir%archDefTable=("sun4c", "-DSPARC -DSUN -DSUN4", # hawai 89*cdf0e10cSrcweir "sun4m", "-DSPARC -DSUN -DSUN4", # broccoli 90*cdf0e10cSrcweir "sun4u", "-DSPARC -DSUN -DSUN4", # broccoli 91*cdf0e10cSrcweir "9000/712", "-DHP9000", # tuborg 92*cdf0e10cSrcweir "9000/715", "-DHP9000", # koepi 93*cdf0e10cSrcweir "9000/778", "-DHP9000", # jever, flens 94*cdf0e10cSrcweir "000029484600", "-DRS6000", # salsa 95*cdf0e10cSrcweir "000328144600", "-DRS6000", # lambada 96*cdf0e10cSrcweir "00245D29E000", "-DRS6000", # segv 97*cdf0e10cSrcweir "00245C46E000", "-DRS6000", # segv 98*cdf0e10cSrcweir "002012974600", "-DRS6000", # tango 99*cdf0e10cSrcweir "0006404C4C00", "-DRS6000", # jive 100*cdf0e10cSrcweir "2003", "-DG3", # ezopen4 101*cdf0e10cSrcweir "i86pc", "-DX86 -DINTEL",# gepard 102*cdf0e10cSrcweir "i386", "-DX86", # SCO_SV, NetBSD, FreeBSD 103*cdf0e10cSrcweir "i486", "-DX86", # tiger 104*cdf0e10cSrcweir "i586", "-DX86", # blauwal 105*cdf0e10cSrcweir "i686", "-DX86", # 106*cdf0e10cSrcweir "prep", "-DPPC", # hooge 107*cdf0e10cSrcweir "ppc", "-DPPC", # ppc-linux 108*cdf0e10cSrcweir "alpha", "-DALPHA", # mars 109*cdf0e10cSrcweir "RM400", "-DMIPS -DRM400", # ekberg, garbo 110*cdf0e10cSrcweir "IP22", "-DMIPS", # voyager 111*cdf0e10cSrcweir "IP32", "-DMIPS", # giotto 112*cdf0e10cSrcweir "Power Macintosh", "-DPPC", # NetBSD/arm32 113*cdf0e10cSrcweir "arm32", "-DARM32" # NetBSD/arm32 114*cdf0e10cSrcweir ); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir%archDosTable=("sun4c", "s", # hawai 117*cdf0e10cSrcweir "sun4m", "s", # broccoli 118*cdf0e10cSrcweir "sun4u", "s", # broccoli 119*cdf0e10cSrcweir "9000/712", "r", # tuborg 120*cdf0e10cSrcweir "9000/715", "r", # koepi 121*cdf0e10cSrcweir "9000/778", "r", # jever, flens 122*cdf0e10cSrcweir "000029484600", "p", # salsa 123*cdf0e10cSrcweir "000328144600", "p", # lambada 124*cdf0e10cSrcweir "00245D29E000", "p", # segv 125*cdf0e10cSrcweir "00245C46E000", "p", # segv 126*cdf0e10cSrcweir "002012974600", "p", # tango 127*cdf0e10cSrcweir "0006404C4C00", "p", # jive 128*cdf0e10cSrcweir "2003", "g", # ezopen4 129*cdf0e10cSrcweir "i86pc", "i", # gepard 130*cdf0e10cSrcweir "i386", "i", # SCO_SV, NetBSD, FreeBSD 131*cdf0e10cSrcweir "i486", "i", # tiger 132*cdf0e10cSrcweir "i586", "i", # blauwal 133*cdf0e10cSrcweir "i686", "i", 134*cdf0e10cSrcweir "prep", "p", # hooge 135*cdf0e10cSrcweir "ppc", "p", # ppc-linux 136*cdf0e10cSrcweir "alpha", "a", # mars 137*cdf0e10cSrcweir "RM400", "m", # ekberg, garbo 138*cdf0e10cSrcweir "IP22", "m", # voyager 139*cdf0e10cSrcweir "IP32", "m", # giotto 140*cdf0e10cSrcweir "Power Macintosh", "p", # NetBSD/arm32 141*cdf0e10cSrcweir "arm32", "a" # NetBSD/arm32 142*cdf0e10cSrcweir ); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir$main::solarDef = $osDefTable{ $s_str }.' '.$archDefTable{ $m_str }; 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir$main::solarOS = $osTable{ $s_str }; 147*cdf0e10cSrcweir$main::solarMT = $archTable{ $m_str }; 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir$main::solarArch = $main::solarOS.$main::solarMT; 150*cdf0e10cSrcweir$main::solarOldArch = $main::solarArch; # for compatibility 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir$main::solarDOS = 'unx'.$osDosTable{ $s_str }. $archDosTable{ $m_str }; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweirsub main::osarch 155*cdf0e10cSrcweir{ 156*cdf0e10cSrcweir local ( $flag ) = @_; 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir $perlFlag = $flag eq 'perl'; 159*cdf0e10cSrcweir $defFlag = $flag eq 'def'; 160*cdf0e10cSrcweir $oldFlag = $flag eq 'old'; 161*cdf0e10cSrcweir $dirFlag = $flag eq 'dir'; 162*cdf0e10cSrcweir $dosFlag = $flag eq 'dos'; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir local( $result ) = ( '' ); 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir if ( $perlFlag ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir $result .= '$solarDef = '."'$main::solarDef';\n"; 169*cdf0e10cSrcweir $result .= '$solarArch = '."'$main::solarArch';\n"; 170*cdf0e10cSrcweir $result .= '$solarOldArch = '."'$main::solarOldArch';\n"; 171*cdf0e10cSrcweir $result .= '$solarOS = '."'$main::solarOS';\n"; 172*cdf0e10cSrcweir $result .= '$solarMT = '."'$main::solarMT';\n"; 173*cdf0e10cSrcweir $result .= '$solarDOS = '."'$main::solarDOS';"; 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir elsif ( $defFlag ) 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir $result = $main::solarDef; 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir elsif ( $dirFlag ) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir $result = "$main::solarOS-$main::solarMT"; 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir elsif ( $dosFlag ) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir $result = $main::solarDOS; 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir else 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir $result = $oldFlag ? $main::solarOldArch : $main::solarArch; 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir return $result; 193*cdf0e10cSrcweir} 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir1; 196