Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / config.sh
1 # -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
2
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 #
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
10 #
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
14 # License.
15
16 # The Original Code is Mozilla Communicator client code, released
17 # March 31, 1998.
18
19 # The Initial Developer of the Original Code is
20 # Netscape Communications Corporation.
21 # Portions created by the Initial Developer are Copyright (C) 1998-1999
22 # the Initial Developer. All Rights Reserved.
23
24 # Contributor(s):
25
26 # Alternatively, the contents of this file may be used under the terms of
27 # either of the GNU General Public License Version 2 or later (the "GPL"),
28 # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 # in which case the provisions of the GPL or the LGPL are applicable instead
30 # of those above. If you wish to allow use of your version of this file only
31 # under the terms of either the GPL or the LGPL, and not to allow others to
32 # use your version of this file under the terms of the MPL, indicate your
33 # decision by deleting the provisions above and replace them with the notice
34 # and other provisions required by the GPL or the LGPL. If you do not delete
35 # the provisions above, a recipient may use your version of this file under
36 # the terms of any one of the MPL, the GPL or the LGPL.
37
38 # ***** END LICENSE BLOCK *****
39
40 # This file was adapted from mozilla/js/src/config.mk
41
42 # Set os+release dependent make variables
43 OS_ARCH="`uname -s | sed /\ /s//_/`"
44
45 # Attempt to differentiate between SunOS 5.4 and x86 5.4
46 OS_CPUARCH=`uname -m`
47
48 if [[ "$OS_CPUARCH" == "i86pc" ]]; then
49     OS_RELEASE="`uname -r`_$OS_CPUARCH"
50 elif [[ "$OS_ARCH" == "AIX" ]]; then
51     OS_RELEASE="`uname -v`.`uname -r`"
52 else
53     OS_RELEASE="`uname -r`"
54 fi
55
56 if [[ "$OS_ARCH" == "IRIX64" ]]; then
57     OS_ARCH="IRIX"
58 fi
59
60 # Handle output from win32 unames other than Netscape's version
61 if echo "Windows_95 Windows_98 CYGWIN_95-4.0 CYGWIN_98-4.10" | grep -iq "$OS_ARCH"; then
62     OS_ARCH="WIN95"
63 fi
64
65 if [[ "$OS_ARCH" == "WIN95" ]]; then
66     OS_ARCH="WINNT"
67     OS_RELEASE="4.0"
68 fi
69
70 if [[ "$OS_ARCH" == "Windows_NT" ]]; then
71     OS_ARCH="WINNT"
72     OS_MINOR_RELEASE="`uname -v`"
73
74     if [[ "$OS_MINOR_RELEASE" == "00" ]]; then
75         OS_MINOR_RELEASE=0
76     fi
77
78     OS_RELEASE="$OS_RELEASE.$OS_MINOR_RELEASE"
79 fi
80
81 if echo "$OS_ARCH" | grep -iq CYGWIN_NT; then
82     OS_RELEASE="`echo $OS_ARCH|sed 's/CYGWIN_NT-//'`"
83     OS_ARCH="WINNT"
84 fi
85
86 if [[ "$OS_ARCH" == "CYGWIN32_NT" ]]; then
87     OS_ARCH="WINNT"
88 fi
89
90 if echo "$OS_ARCH" | grep -iq MINGW32_NT; then
91     OS_RELEASE="`echo $OS_ARCH|sed 's/MINGW32_NT-//'`"
92     OS_ARCH="WINNT"
93 fi
94
95 if [[ "$OS_ARCH" == "MINGW32_NT" ]]; then
96     OS_ARCH="WINNT"
97 fi
98
99 # Virtually all Linux versions are identical.
100 # Any distinctions are handled in linux.h
101
102 case "$OS_ARCH" in
103     "Linux")
104         OS_CONFIG="Linux_All"
105         ;;
106     "dgux")
107         OS_CONFIG="dgux"
108         ;;
109     "Darwin")
110         OS_CONFIG="Darwin"
111         ;;
112     *)
113         OS_CONFIG="$OS_ARCH$OS_OBJTYPE$OS_RELEASE"
114         ;;
115 esac
116
117 case "$buildtype" in
118     "opt")
119         OBJDIR_TAG="_OPT"
120         ;;
121     "debug")
122         OBJDIR_TAG="_DBG"
123         ;;
124     *)
125         error "Unknown build type $buildtype"
126 esac
127
128
129
130 # Name of the binary code directories
131 if [[ -z "$OBJDIR_TAG" ]]; then
132     true
133 elif [[ -n "$BUILD_IDG" ]]; then
134     JS_OBJDIR="$OS_CONFIG$OBJDIR_TAG.OBJD"
135 else
136     JS_OBJDIR="$OS_CONFIG$OBJDIR_TAG.OBJ"
137 fi
138