summaryrefslogtreecommitdiff
path: root/tec_uname
blob: d885215da199a9688fbdf50d932fa5963a6922b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/bin/bash

Pause()
{
  echo -n Press Enter to continue or Ctrl+C to abort...
  read contscr
  echo ' '
}

ComputeTecUname()
{
  # Base Defintions
  TEC_SYSNAME=`uname -s`
  TEC_SYSVERSION=`uname -r|cut -f1 -d.`
  TEC_SYSMINOR=`uname -r|cut -f2 -d.`
  TEC_SYSARCH=`uname -m`

  # Fixes
  if [ $TEC_SYSNAME == SunOS ]; then
    TEC_SYSARCH=`uname -p`
  fi
  if [ $TEC_SYSNAME == IRIX ]; then
    TEC_SYSARCH=`uname -p`
  fi
  if [ $TEC_SYSNAME == FreeBSD ]; then
    TEC_SYSMINOR=`uname -r|cut -f2 -d.|cut -f1 -d-`
  fi
  if [ $TEC_SYSNAME == AIX ]; then
    TEC_SYSVERSION=`uname -v`
    TEC_SYSMINOR=`uname -r`
    TEC_SYSARCH=ppc
  fi
  if [ $TEC_SYSNAME == Darwin ]; then
    TEC_SYSNAME=MacOS
    TEC_SYSVERSION=`sw_vers -productVersion|cut -f1 -d.`
    TEC_SYSMINOR=`sw_vers -productVersion|cut -f2 -d.`
    TEC_SYSARCH=`uname -p`
  fi
 
  if [ $TEC_SYSARCH == i686 ]; then
    TEC_SYSARCH=x86
  fi
  if [ $TEC_SYSARCH == i386 ]; then
    TEC_SYSARCH=x86
  fi
  if [ $TEC_SYSARCH == powerpc ]; then
    TEC_SYSARCH=ppc
  fi
  if [ $TEC_SYSARCH == x86_64 ]; then
    TEC_SYSARCH=x64
  fi
  if [ $TEC_SYSARCH == amd64 ]; then
    TEC_SYSARCH=x64
  fi
  
  # Compose
  TEC_UNAME=$TEC_SYSNAME$TEC_SYSVERSION$TEC_SYSMINOR

  # Cygwin
  CYGW=`uname -s|cut -f1 -d-`
  if [ $CYGW == CYGWIN_NT ]; then
    TEC_SYSNAME=CYGWIN
    TEC_UNAME='cygw'$TEC_SYSVERSION$TEC_SYSMINOR
  fi
  
  # Linux 2.4 and GCC 3.x
  if [ $TEC_UNAME == Linux24 ]; then
    GCCVER=`gcc -dumpversion|cut -f1 -d.`
    if [ $GCCVER == 3 ]; then
      TEC_UNAME=$TEC_UNAME'g3'
    fi
  fi

  # Linux 2.6 and GCC 4.x
  if [ $TEC_UNAME == Linux26 ]; then
    GCCVER=`gcc -dumpversion|cut -f1 -d.`
    if [ $GCCVER == 4 ]; then
      TEC_UNAME=$TEC_UNAME'g4'
    fi
  fi

  # Linux and PowerPC
  if [ $TEC_SYSNAME == Linux ]; then
    if [ $TEC_SYSARCH == ppc ]; then
      TEC_UNAME=$TEC_UNAME'ppc'
    fi
  fi

  # 64-bits Linux
  if [ $TEC_SYSNAME == Linux ]; then
    if [ $TEC_SYSARCH == x64 ]; then
      BUILD_64=Yes
      TEC_UNAME=$TEC_UNAME'_64'
    fi

    if [ $TEC_SYSARCH == ia64 ]; then
      BUILD_64=Yes
      TEC_UNAME=$TEC_UNAME'_ia64'
    fi
  fi

  # 64-bits FreeBSD
  if [ $TEC_SYSNAME == FreeBSD ]; then
    if [ $TEC_SYSARCH == x64 ]; then
      BUILD_64=Yes
      TEC_UNAME=$TEC_UNAME'_64'
    fi
  fi

  # Solaris and Intel
  if [ $TEC_SYSNAME == SunOS ]; then
    if [ $TEC_SYSARCH == x86 ]; then
      TEC_UNAME=$TEC_UNAME'x86'
    fi
  fi

  # MacOS and Intel
  if [ $TEC_SYSNAME == MacOS ]; then
    if [ $TEC_SYSMINOR == 6 ]; then
      TEC_SYSARCH=x64
    else
      if [ $TEC_SYSARCH == x86 ]; then
        TEC_UNAME=$TEC_UNAME'x86'
      fi
    fi
  fi
}

ComputeSystemPaths()
{
  if [ $TEC_SYSARCH == x64 ]; then
    if [ -d /usr/lib64 ]; then
      TEC_SYSTEM_LIB=/usr/lib64
    else
      TEC_SYSTEM_LIB=/usr/lib
    fi
  else
    TEC_SYSTEM_LIB=/usr/lib
  fi

  TEC_SYSTEM_INC=/usr/include
  
  TEC_LUA_LIB=$TEC_SYSTEM_LIB/lua/5.1
}

PrintInfo()
{
  echo ' '
  echo '  Info:'
  echo 'TEC_SYSNAME='$TEC_SYSNAME
  echo 'TEC_SYSVERSION='$TEC_SYSVERSION
  echo 'TEC_SYSMINOR='$TEC_SYSMINOR
  echo 'TEC_SYSARCH='$TEC_SYSARCH
  echo 'TEC_SYSTEM_LIB='$TEC_SYSTEM_LIB
  echo 'TEC_SYSTEM_INC='$TEC_SYSTEM_INC
}