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