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