Imported Upstream version 1.64.0
[platform/upstream/boost.git] / tools / build / src / engine / guess_toolset.bat
1 @ECHO OFF
2
3 REM ~ Copyright 2002-2017 Rene Rivera.
4 REM ~ Distributed under the Boost Software License, Version 1.0.
5 REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7 if "_%1_" == "_yacc_" goto Guess_Yacc
8 goto Guess
9
10
11 :Clear_Error
12 ver >nul
13 goto :eof
14
15
16 :Test_Path
17 REM Tests for the given executable file presence in the directories in the PATH
18 REM environment variable. Additionaly sets FOUND_PATH to the path of the
19 REM found file.
20 call :Clear_Error
21 setlocal
22 set test=%~$PATH:1
23 endlocal
24 if not errorlevel 1 set FOUND_PATH=%~dp$PATH:1
25 goto :eof
26
27
28 :Guess
29 REM Check the variable first. This can be set manually by the user (by running the tools commmand prompt).
30 call :Clear_Error
31 if NOT "_%VS150COMNTOOLS%_" == "__" (
32     set "BOOST_JAM_TOOLSET=vc141"
33     set "BOOST_JAM_TOOLSET_ROOT=%VS150COMNTOOLS%..\..\VC\"
34     goto :eof)
35 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"  (
36     set "BOOST_JAM_TOOLSET=vc141"
37     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\"
38     goto :eof)
39 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat"  (
40     set "BOOST_JAM_TOOLSET=vc141"
41     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Professional\VC\"
42     goto :eof)
43 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"  (
44     set "BOOST_JAM_TOOLSET=vc141"
45     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Community\VC\"
46     goto :eof)
47 if NOT "_%VS140COMNTOOLS%_" == "__" (
48     set "BOOST_JAM_TOOLSET=vc14"
49     set "BOOST_JAM_TOOLSET_ROOT=%VS140COMNTOOLS%..\..\VC\"
50     goto :eof)
51 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 14.0\VC\VCVARSALL.BAT" (
52     set "BOOST_JAM_TOOLSET=vc14"
53     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 14.0\VC\"
54     goto :eof)
55 if NOT "_%VS120COMNTOOLS%_" == "__" (
56     set "BOOST_JAM_TOOLSET=vc12"
57     set "BOOST_JAM_TOOLSET_ROOT=%VS120COMNTOOLS%..\..\VC\"
58     goto :eof)
59 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 12.0\VC\VCVARSALL.BAT" (
60     set "BOOST_JAM_TOOLSET=vc12"
61     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 12.0\VC\"
62     goto :eof)
63 if NOT "_%VS110COMNTOOLS%_" == "__" (
64     set "BOOST_JAM_TOOLSET=vc11"
65     set "BOOST_JAM_TOOLSET_ROOT=%VS110COMNTOOLS%..\..\VC\"
66     goto :eof)
67 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 11.0\VC\VCVARSALL.BAT" (
68     set "BOOST_JAM_TOOLSET=vc11"
69     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 11.0\VC\"
70     goto :eof)
71 if NOT "_%VS100COMNTOOLS%_" == "__" (
72     set "BOOST_JAM_TOOLSET=vc10"
73     set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\"
74     goto :eof)
75 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 10.0\VC\VCVARSALL.BAT" (
76     set "BOOST_JAM_TOOLSET=vc10"
77     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 10.0\VC\"
78     goto :eof)
79 if NOT "_%VS90COMNTOOLS%_" == "__" (
80     set "BOOST_JAM_TOOLSET=vc9"
81     set "BOOST_JAM_TOOLSET_ROOT=%VS90COMNTOOLS%..\..\VC\"
82     goto :eof)
83 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 9.0\VC\VCVARSALL.BAT" (
84     set "BOOST_JAM_TOOLSET=vc9"
85     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 9.0\VC\"
86     goto :eof)
87 if NOT "_%VS80COMNTOOLS%_" == "__" (
88     set "BOOST_JAM_TOOLSET=vc8"
89     set "BOOST_JAM_TOOLSET_ROOT=%VS80COMNTOOLS%..\..\VC\"
90     goto :eof)
91 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 8\VC\VCVARSALL.BAT" (
92     set "BOOST_JAM_TOOLSET=vc8"
93     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 8\VC\"
94     goto :eof)
95 if NOT "_%VS71COMNTOOLS%_" == "__" (
96     set "BOOST_JAM_TOOLSET=vc7"
97     set "BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%\..\..\VC7\"
98     goto :eof)
99 if NOT "_%VCINSTALLDIR%_" == "__" (
100     REM %VCINSTALLDIR% is also set for VC9 (and probably VC8)
101     set "BOOST_JAM_TOOLSET=vc7"
102     set "BOOST_JAM_TOOLSET_ROOT=%VCINSTALLDIR%\VC7\"
103     goto :eof)
104 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\bin\VCVARS32.BAT" (
105     set "BOOST_JAM_TOOLSET=vc7"
106     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\"
107     goto :eof)
108 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" (
109     set "BOOST_JAM_TOOLSET=vc7"
110     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio .NET\VC7\"
111     goto :eof)
112 if NOT "_%MSVCDir%_" == "__" (
113     set "BOOST_JAM_TOOLSET=msvc"
114     set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\"
115     goto :eof)
116 if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" (
117     set "BOOST_JAM_TOOLSET=msvc"
118     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\VC98\"
119     goto :eof)
120 if EXIST "%VS_ProgramFiles%\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" (
121     set "BOOST_JAM_TOOLSET=msvc"
122     set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual C++\VC98\"
123     goto :eof)
124 call :Test_Path cl.exe
125 if not errorlevel 1 (
126     set "BOOST_JAM_TOOLSET=msvc"
127     set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
128     goto :eof)
129 call :Test_Path vcvars32.bat
130 if not errorlevel 1 (
131     set "BOOST_JAM_TOOLSET=msvc"
132     call "%FOUND_PATH%VCVARS32.BAT"
133     set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\"
134     goto :eof)
135 if EXIST "C:\Borland\BCC55\Bin\bcc32.exe" (
136     set "BOOST_JAM_TOOLSET=borland"
137     set "BOOST_JAM_TOOLSET_ROOT=C:\Borland\BCC55\"
138     goto :eof)
139 call :Test_Path bcc32.exe
140 if not errorlevel 1 (
141     set "BOOST_JAM_TOOLSET=borland"
142     set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
143     goto :eof)
144 call :Test_Path icl.exe
145 if not errorlevel 1 (
146     set "BOOST_JAM_TOOLSET=intel-win32"
147     set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
148     goto :eof)
149 if EXIST "C:\MinGW\bin\gcc.exe" (
150     set "BOOST_JAM_TOOLSET=mingw"
151     set "BOOST_JAM_TOOLSET_ROOT=C:\MinGW\"
152     goto :eof)
153 if NOT "_%CWFolder%_" == "__" (
154     set "BOOST_JAM_TOOLSET=metrowerks"
155     set "BOOST_JAM_TOOLSET_ROOT=%CWFolder%\"
156     goto :eof)
157 call :Test_Path mwcc.exe
158 if not errorlevel 1 (
159     set "BOOST_JAM_TOOLSET=metrowerks"
160     set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\..\"
161     goto :eof)
162 REM Could not find a suitable toolset
163 exit /b 1
164
165
166 :Guess_Yacc
167 REM Tries to find bison or yacc in common places so we can build the grammar.
168 call :Test_Path yacc.exe
169 if not errorlevel 1 (
170     set "YACC=yacc -d"
171     goto :eof)
172 call :Test_Path bison.exe
173 if not errorlevel 1 (
174     set "YACC=bison -d --yacc"
175     goto :eof)
176 if EXIST "C:\Program Files\GnuWin32\bin\bison.exe" (
177     set "YACC=C:\Program Files\GnuWin32\bin\bison.exe" -d --yacc
178     goto :eof)
179 exit /b 1