~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/dist/util/arch

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
#  arch
 
4
#
 
5
#___INFO__MARK_BEGIN__
 
6
##########################################################################
 
7
#
 
8
#  The Contents of this file are made available subject to the terms of
 
9
#  the Sun Industry Standards Source License Version 1.2
 
10
#
 
11
#  Sun Microsystems Inc., March, 2001
 
12
#
 
13
#
 
14
#  Sun Industry Standards Source License Version 1.2
 
15
#  =================================================
 
16
#  The contents of this file are subject to the Sun Industry Standards
 
17
#  Source License Version 1.2 (the "License"); You may not use this file
 
18
#  except in compliance with the License. You may obtain a copy of the
 
19
#  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
20
#
 
21
#  Software provided under this License is provided on an "AS IS" basis,
 
22
#  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
23
#  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
24
#  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
25
#  See the License for the specific provisions governing your rights and
 
26
#  obligations concerning the Software.
 
27
#
 
28
#  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
29
#
 
30
#  Copyright: 2001 by Sun Microsystems, Inc.
 
31
#
 
32
#  All Rights Reserved.
 
33
#
 
34
##########################################################################
 
35
#___INFO__MARK_END__
 
36
#
 
37
#  The original idea of "aimk" where this script is based on came from the
 
38
#  PVM 3.x distribution, 22 Jul 1991 Robert Manchek manchek@CS.UTK.EDU. 
 
39
#
 
40
#  call:   arch       (print SGEEE architecture string)
 
41
#          arch -m    (print default MANPATH of system)
 
42
#          arch -mt   (print either "man" or "catman")
 
43
#          arch -lib  (print name of variable to extend shared library path)
 
44
 
 
45
# On some architectures, it is necessary to run the manpath(1) command
 
46
# with the user's path instead of our "safe" one.  Thus we need to
 
47
# save the old value of PATH for later restoration.
 
48
#
 
49
SAFE_PATH=/bin:/usr/bin:/usr/sbin
 
50
OLD_PATH=$PATH
 
51
PATH=$SAFE_PATH
 
52
 
 
53
ARCH=UNKNOWN
 
54
 
 
55
if [ -x /bin/uname ]; then
 
56
   UNAME=/bin/uname
 
57
elif [ -x /usr/bin/uname ]; then
 
58
   UNAME=/usr/bin/uname
 
59
else
 
60
   echo ERROR: \"uname\" command not found
 
61
   exit 1
 
62
fi
 
63
 
 
64
ossysname="`$UNAME -s`"
 
65
osmachine="`$UNAME -m`"
 
66
osrelease="`$UNAME -r`"
 
67
 
 
68
case $ossysname in
 
69
AIX)
 
70
   osversion=`$UNAME -v`
 
71
   case $osversion in
 
72
   3)
 
73
      ARCH=UNSUPPORTED-rs6000
 
74
      ;;
 
75
   4)
 
76
      case $osrelease in
 
77
      1)
 
78
         ARCH=UNSUPPORTED-aix41
 
79
         ;;
 
80
      2)
 
81
         ARCH=UNSUPPORTED-aix42
 
82
         ;;
 
83
      3)
 
84
         ARCH=aix43
 
85
         ;;
 
86
      esac
 
87
      ;;
 
88
   5)
 
89
      case $osrelease in
 
90
      1|2|3)
 
91
         ARCH=aix51
 
92
         ;;
 
93
      *)
 
94
         ARCH=UNSUPPORTED-aix-5-$osrelease
 
95
         ;;
 
96
      esac
 
97
      ;;
 
98
   esac
 
99
   ;;
 
100
CRSOS)
 
101
   if [ $osmachine = smp ]; then
 
102
      ARCH=craysmp
 
103
   fi
 
104
   ;;
 
105
Darwin)
 
106
   case $osmachine in
 
107
      i386)
 
108
         darwin_machine=x86
 
109
         ;;
 
110
      Power*)
 
111
         darwin_machine=ppc
 
112
         ;;
 
113
      *)
 
114
         darwin_machine=unsupported
 
115
         ;;
 
116
   esac
 
117
   ARCH=darwin-$darwin_machine
 
118
   ;;
 
119
FreeBSD|DragonFly)
 
120
   ARCH=fbsd-$osmachine
 
121
   ;;
 
122
NetBSD)
 
123
    osprocessor="`$UNAME -p`"
 
124
    ARCH=nbsd-$osprocessor
 
125
    ;;
 
126
IRIX*)
 
127
   case $osrelease in
 
128
   4*)
 
129
      ARCH=UNSUPPORTED-irix4
 
130
      ;;
 
131
   5*)
 
132
      ARCH=UNSUPPORTED-irix5
 
133
      ;;
 
134
   6.5)
 
135
      ARCH=irix65
 
136
      ;;
 
137
   6.*)
 
138
      ARCH=UNSUPPORTED-irix-$osrelease
 
139
      ;;
 
140
   esac
 
141
   ;;
 
142
HP-UX)
 
143
   case $osmachine in
 
144
   ia64)
 
145
      ARCH=hp11
 
146
      ;;
 
147
   9000/*)
 
148
      case $osrelease in
 
149
      *.09.*)
 
150
         ARCH=UNSUPPORTED-hp
 
151
         ;;
 
152
      *.10.10)
 
153
         ARCH=UNSUPPORTED-hp1010
 
154
         ;;
 
155
      *.10.*)
 
156
         ARCH=hp10
 
157
         ;;
 
158
      *.11.*)
 
159
      if [ -x /usr/bin/getconf ]; then
 
160
         bits="`/usr/bin/getconf KERNEL_BITS`"
 
161
         if [ $bits -eq 64 ]; then
 
162
            ARCH=hp11-64
 
163
         else
 
164
            ARCH=hp11
 
165
         fi
 
166
      else
 
167
         ARCH=hp11
 
168
      fi
 
169
      ;;
 
170
      esac
 
171
   esac
 
172
   ;;
 
173
Linux)
 
174
   unsupported=""
 
175
 
 
176
   case $osmachine in
 
177
   i*86)
 
178
      lxmachine=x86
 
179
      ;;
 
180
   alpha)
 
181
      lxmachine=alpha
 
182
      ;;
 
183
   sparc)
 
184
      lxmachine=sparc
 
185
      ;;
 
186
   sparc64)
 
187
      lxmachine=sparc
 
188
      ;;
 
189
   x86_64)
 
190
      lxmachine=amd64
 
191
      ;;
 
192
   ia64)
 
193
      lxmachine=ia64
 
194
      ;;
 
195
   ppc)
 
196
      lxmachine=ppc
 
197
      ;;
 
198
   ppc64)
 
199
      lxmachine=ppc64
 
200
      ;;
 
201
   *)
 
202
      unsupported="UNSUPPORTED-"
 
203
      lxmachine=$osmachine
 
204
   esac
 
205
 
 
206
   case $osrelease in
 
207
   2.4.*)
 
208
      lxrelease=24
 
209
 
 
210
      # verify the GNU C lib version
 
211
      # For an alternative means to determine GNU C lib version see
 
212
      # http://www.gnu.org/software/libc/FAQ.html#s-4.9
 
213
      case $lxmachine in
 
214
      amd64)
 
215
         libc_string=`strings /lib64/libc.so.6 | grep "GNU C Library"`
 
216
         ;;
 
217
      ia64)
 
218
         libc_string=`strings /lib/libc.so.6.1 | grep "GNU C Library"`
 
219
         ;;
 
220
      *)
 
221
         libc_string=`strings /lib/libc.so.6 | grep "GNU C Library"`
 
222
         ;;
 
223
      esac
 
224
 
 
225
      # retrieving libc version failed
 
226
      if [ $? -ne 0 ]; then
 
227
         unsupported="UNSUPPORTED-"
 
228
         lxrelease="24-GLIBC"
 
229
      else
 
230
         libc_version=`echo $libc_string | tr ' ,' '\n' | grep "2\." | cut -f 2 -d "."`
 
231
         if [ $libc_version -lt 2 ]; then
 
232
            unsupported="UNSUPPORTED-"
 
233
            lxrelease=24-GLIBC-2.${libc_version}
 
234
         else
 
235
            if [ $libc_version -eq 2 ]; then
 
236
               unsupported="u"
 
237
            fi
 
238
         fi
 
239
      fi
 
240
      ;;
 
241
   2.6.*)
 
242
      lxrelease=26
 
243
      ;;
 
244
   *)
 
245
      unsupported="UNSUPPORTED-"
 
246
      lxrelease=$osrelease
 
247
   esac
 
248
   ARCH=${unsupported}lx${lxrelease}-${lxmachine}
 
249
   ;;
 
250
OSF1)
 
251
   case $osrelease in
 
252
   V4*)
 
253
      ARCH=osf4
 
254
      ;;
 
255
    V5*|T5*)
 
256
       ARCH=tru64
 
257
       ;;
 
258
    *)
 
259
       ARCH=UNSUPPORTED-osf1-$osrelease
 
260
       ;;
 
261
    esac
 
262
    ;;
 
263
SunOS)
 
264
   case $osmachine in
 
265
   sun4)
 
266
      ARCH=UNSUPPORTED-sun4
 
267
      ;;
 
268
   i86*)
 
269
      ARCH=sol-x86
 
270
      case $osrelease in
 
271
      5.[8]*)
 
272
         ARCH=usol-x86
 
273
         ;;
 
274
      5.[91]*)
 
275
         if [ `isainfo -b` = 64 ]; then
 
276
            ARCH=sol-amd64
 
277
         else
 
278
            ARCH=sol-x86
 
279
         fi
 
280
         ;;
 
281
      *)
 
282
         ARCH=UNSUPPORTED-SunOS-$osrelease
 
283
         ;;
 
284
      esac
 
285
      ;;
 
286
   *)
 
287
      case $osrelease in
 
288
      5.[7]*)
 
289
         if [ `isainfo -b` = 64 ]; then
 
290
            ARCH=usol-sparc64
 
291
         else
 
292
            ARCH=usol-sparc
 
293
         fi
 
294
         ;;
 
295
      5.[891]*)
 
296
         if [ `isainfo -b` = 64 ]; then
 
297
            ARCH=sol-sparc64
 
298
         else
 
299
            ARCH=sol-sparc
 
300
         fi
 
301
         ;;
 
302
      *)
 
303
         ARCH=UNSUPPORTED-SunOS-$osrelease
 
304
         ;;
 
305
      esac
 
306
      ;;
 
307
   esac
 
308
   ;;
 
309
SUPER-UX)
 
310
   case $osmachine in
 
311
   SX-4*)
 
312
      ARCH=UNSUPPORTED-necsx4
 
313
      ;;
 
314
   SX-[56]*)
 
315
      ARCH=sx
 
316
      ;;
 
317
   *)
 
318
      ARCH=UNSUPPORTED-SUPER-UX-$osmachine
 
319
      ;;
 
320
   esac
 
321
   ;;
 
322
Interix)
 
323
   ARCH=win32-$osmachine
 
324
   ;;
 
325
*)
 
326
   if [ -f /unicos ]; then
 
327
      if [ "`$UNAME -m`" = "CRAY TS" ]; then
 
328
         if [ `/bin/target|/bin/grep ieee` = noieee ]; then
 
329
            ARCH=crayts
 
330
         else
 
331
            ARCH=craytsieee
 
332
         fi
 
333
      else
 
334
         ARCH=cray
 
335
      fi
 
336
   else
 
337
      ARCH=UNSUPPORTED-${ossysname}-${osmachine}-${osrelease}
 
338
   fi
 
339
   ;;
 
340
esac
 
341
 
 
342
if [ "$1" = "-m" -o "$1" = "-mt" -o "$1" = "-lib" ]; then
 
343
   MANTYPE=man
 
344
   SHARED_LIBRARY_PATH="LD_LIBRARY_PATH"
 
345
   DEFAULTMANPATH=/usr/man
 
346
   case $ARCH in
 
347
   aix*)
 
348
      DEFAULTMANPATH=/usr/man
 
349
      SHARED_LIBRARY_PATH="LIBPATH"
 
350
      ;;
 
351
   darwin-*)
 
352
      DEFAULTMANPATH=`/usr/bin/manpath -q`
 
353
      SHARED_LIBRARY_PATH="DYLD_LIBRARY_PATH"
 
354
      ;;
 
355
   fbsd-*)
 
356
      PATH=$OLD_PATH
 
357
      DEFAULTMANPATH=`/usr/bin/manpath -q`
 
358
      PATH=$SAFE_PATH
 
359
      ;;
 
360
   nbsd-*)
 
361
      PATH=$OLD_PATH
 
362
      DEFAULTMANPATH=/usr/pkg/man:/usr/local/man:/usr/X11R6/man:/usr/share/man
 
363
      PATH=$SAFE_PATH
 
364
      ;;
 
365
   hp*)
 
366
      DEFAULTMANPATH=/usr/man:/usr/contrib/man:/usr/local/man
 
367
      SHARED_LIBRARY_PATH="SHLIB_PATH"
 
368
      ;;
 
369
   irix65)
 
370
      DEFAULTMANPATH=/usr/share/catman:/usr/share/man:/usr/catman:/usr/man
 
371
      MANTYPE=catman
 
372
      ;;
 
373
   lx*)
 
374
      if [ "`which manpath 2>/dev/null`" != "" ]; then
 
375
         DEFAULTMANPATH=`manpath 2>/dev/null`
 
376
      else
 
377
         DEFAULTMANPATH=/usr/local/man:/usr/share/man:/usr/man:/usr/X11R6/man
 
378
      fi
 
379
      ;;
 
380
   sol-*)
 
381
      DEFAULTMANPATH=/usr/share/man
 
382
      # if bit-specific variable already set, use this variable!
 
383
      SHARED_LIBRARY_PATH_BITS="LD_LIBRARY_PATH_`isainfo -b`"
 
384
      if eval [ x\$$SHARED_LIBRARY_PATH_BITS != x ]; then
 
385
              SHARED_LIBRARY_PATH=$SHARED_LIBRARY_PATH_BITS
 
386
      fi
 
387
      ;;
 
388
   tru64)
 
389
      DEFAULTMANPATH=/usr/share/man:/usr/dt/share/man:/usr/local/man
 
390
      ;;
 
391
   win32*)
 
392
      DEFAULTMANPATH=/usr/share/man
 
393
      MANTYPE=catman/cat
 
394
      ;;
 
395
   esac
 
396
 
 
397
   if [ "$1" = "-m" ]; then
 
398
      echo $DEFAULTMANPATH
 
399
   elif [ "$1" = "-lib" ]; then
 
400
      echo $SHARED_LIBRARY_PATH
 
401
   else
 
402
      echo $MANTYPE
 
403
   fi
 
404
else
 
405
   echo $ARCH
 
406
fi