common/autoconf/toolchain.m4

changeset 494
e64f2cb57d05
parent 478
2ba6f4da4bf3
child 495
e3182741ade2
equal deleted inserted replaced
488:8a3fe0ae06a8 494:e64f2cb57d05
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any 22 # or visit www.oracle.com if you need additional information or have any
23 # questions. 23 # questions.
24 # 24 #
25 25
26 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV], 26 # $1 = compiler to test (CC or CXX)
27 # $2 = human readable name of compiler (C or C++)
28 AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
27 [ 29 [
28 30 COMPILER=[$]$1
29 # Check if the VS env variables were setup prior to running configure. 31 COMPILER_NAME=$2
30 # If not, then find vcvarsall.bat and run it automatically, and integrate 32
31 # the set env variables into the spec file. 33 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
32 SETUPDEVENV="# No special vars" 34 # Make sure we use the Sun Studio compiler and not gcc on Solaris, which won't work
33 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then 35 COMPILER_VERSION_TEST=`$COMPILER -V 2>&1 | $HEAD -n 1`
34 # Store path to cygwin link.exe to help excluding it when searching for 36 $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
35 # VS linker. 37 if test $? -ne 0; then
36 AC_PATH_PROG(CYGWIN_LINK, link) 38 GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
37 AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool]) 39
38 "$CYGWIN_LINK" --version > /dev/null 40 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.])
39 if test $? -eq 0 ; then 41 AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"])
40 AC_MSG_RESULT([yes]) 42 AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.])
41 else 43 else
42 AC_MSG_RESULT([no]) 44 COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/p"`
43 # This might be the VS linker. Don't exclude it later on. 45 COMPILER_VENDOR="Sun Studio"
44 CYGWIN_LINK="" 46 fi
47 elif test "x$OPENJDK_TARGET_OS" = xwindows; then
48 # First line typically looks something like:
49 # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
50 COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1`
51 COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \(@<:@1-9@:>@@<:@0-9.@:>@*\) .*/\1/p"`
52 COMPILER_VENDOR="Microsoft CL.EXE"
53 COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"`
54 if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
55 if test "x$COMPILER_CPU_TEST" != "x80x86"; then
56 AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".])
57 fi
58 elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
59 if test "x$COMPILER_CPU_TEST" != "xx64"; then
60 AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
61 fi
62 fi
63 else
64 COMPILER_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
65 # Check that this is likely to be GCC.
66 $COMPILER --version 2>&1 | $GREP "Free Software Foundation" > /dev/null
67 if test $? -ne 0; then
68 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required GCC compiler.])
69 AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_TEST"])
70 AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.])
45 fi 71 fi
46 72
47 # If vcvarsall.bat has been run, then VCINSTALLDIR is set. 73 # First line typically looks something like:
48 if test "x$VCINSTALLDIR" != x; then 74 # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
49 # No further setup is needed. The build will happen from this kind 75 COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"`
50 # of shell. 76 COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"`
51 SETUPDEVENV="# This spec file expects that you are running bash from within a VS command prompt." 77 fi
52 # Make sure to remind you, if you forget to run make from a cygwin bash shell 78 # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker)
53 # that is spawned "bash -l" from a VS command prompt. 79 $1_VERSION="$COMPILER_VERSION"
54 CHECK_FOR_VCINSTALLDIR=yes 80 # This sets CC_VENDOR or CXX_VENDOR. (This comment is a grep marker)
55 AC_MSG_CHECKING([if you are running from within a VS command prompt]) 81 $1_VENDOR="$COMPILER_VENDOR"
56 AC_MSG_RESULT([yes]) 82
57 else 83 AC_MSG_NOTICE([Using $COMPILER_VENDOR $COMPILER_NAME compiler version $COMPILER_VERSION (located at $COMPILER)])
58 # Ah, we have not yet run vcvarsall.bat/vsvars32.bat/vsvars64.bat. Lets do that. First find it.
59 if test "x$VS100COMNTOOLS" != x; then
60 VARSBAT=`find "$VS100COMNTOOLS/../.." -name vcvarsall.bat`
61 SEARCH_ROOT="$VS100COMNTOOLS"
62 else
63 VARSBAT=`find "$PROGRAMFILES" -name vcvarsall.bat`
64 SEARCH_ROOT="$PROGRAMFILES"
65 fi
66 VCPATH=`dirname "$VARSBAT"`
67 VCPATH=`cygpath -w "$VCPATH"`
68 if test "x$VARSBAT" = x || test ! -d "$VCPATH"; then
69 AC_MSG_CHECKING([if we can find the VS installation])
70 AC_MSG_RESULT([no])
71 AC_MSG_ERROR([Tried to find a VS installation using both $SEARCH_ROOT but failed. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
72 fi
73 case "$OPENJDK_TARGET_CPU" in
74 x86)
75 VARSBAT_ARCH=x86
76 ;;
77 x86_64)
78 VARSBAT_ARCH=amd64
79 ;;
80 esac
81 # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
82 cd $OUTPUT_ROOT
83 bash $SRC_ROOT/common/bin/extractvcvars.sh "$VARSBAT" "$VARSBAT_ARCH"
84 cd $CURDIR
85 if test ! -s $OUTPUT_ROOT/localdevenv.sh || test ! -s $OUTPUT_ROOT/localdevenv.gmk; then
86 AC_MSG_CHECKING([if we can extract the needed env variables])
87 AC_MSG_RESULT([no])
88 AC_MSG_ERROR([Could not succesfully extract the env variables needed for the VS setup. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
89 fi
90 # Now set all paths and other env variables. This will allow the rest of
91 # the configure script to find and run the compiler in the proper way.
92 . $OUTPUT_ROOT/localdevenv.sh
93 AC_MSG_CHECKING([if we can find the VS installation])
94 if test "x$VCINSTALLDIR" != x; then
95 AC_MSG_RESULT([$VCINSTALLDIR])
96 else
97 AC_MSG_RESULT([no])
98 AC_MSG_ERROR([Could not find VS installation. Please install. If you are sure you have installed VS, then please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
99 fi
100 CHECK_FOR_VCINSTALLDIR=no
101 SETUPDEVENV="include $OUTPUT_ROOT/localdevenv.gmk"
102
103 AC_MSG_CHECKING([for msvcr100.dll])
104 AC_ARG_WITH(msvcr100dll, [AS_HELP_STRING([--with-msvcr100dll],
105 [copy this msvcr100.dll into the built JDK])])
106 if test "x$with_msvcr100dll" != x; then
107 MSVCR100DLL="$with_msvcr100dll"
108 else
109 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
110 MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x64 | head --lines 1`
111 else
112 MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
113 if test "x$MSVCR100DLL" = x; then
114 MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | head --lines 1`
115 fi
116 fi
117 fi
118 if test "x$MSVCR100DLL" = x; then
119 AC_MSG_RESULT([no])
120 AC_MSG_ERROR([Could not find msvcr100.dll !])
121 fi
122 AC_MSG_RESULT([$MSVCR100DLL])
123 SPACESAFE(MSVCR100DLL,[the path to msvcr100.dll])
124 fi
125 fi
126 AC_SUBST(SETUPDEVENV)
127 AC_SUBST(CHECK_FOR_VCINSTALLDIR)
128 AC_SUBST(MSVCR100DLL)
129 ]) 84 ])
85
130 86
131 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS], 87 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS],
132 [ 88 [
133 ############################################################################### 89 ###############################################################################
134 # 90 #
149 AC_SUBST(EXE_OUT_OPTION) 105 AC_SUBST(EXE_OUT_OPTION)
150 AC_SUBST(LD_OUT_OPTION) 106 AC_SUBST(LD_OUT_OPTION)
151 AC_SUBST(AR_OUT_OPTION) 107 AC_SUBST(AR_OUT_OPTION)
152 ]) 108 ])
153 109
154 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_PATHS], 110 # $1 = compiler to test (CC or CXX)
111 # $2 = human readable name of compiler (C or C++)
112 # $3 = list of compiler names to search for
113 AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
155 [ 114 [
115 COMPILER_NAME=$2
116
117 # Do a first initial attempt at searching the list of compiler names.
118 # AC_PATH_PROGS can't be run multiple times with the same variable,
119 # so create a new name for this run.
120 AC_PATH_PROGS(POTENTIAL_$1, $3)
121 $1=$POTENTIAL_$1
122
123 if test "x$[$]$1" = x; then
124 HELP_MSG_MISSING_DEPENDENCY([devkit])
125 AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
126 fi
127 BASIC_FIXUP_EXECUTABLE($1)
128 AC_MSG_CHECKING([resolved symbolic links for $1])
129 TEST_COMPILER="[$]$1"
130 BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
131 AC_MSG_RESULT([$TEST_COMPILER])
132 AC_MSG_CHECKING([if $1 is disguised ccache])
133
134 COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
135 if test "x$COMPILER_BASENAME" = "xccache"; then
136 AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
137 # We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
138 # We want to control ccache invocation ourselves, so ignore this cc and try
139 # searching again.
140
141 # Remove the path to the fake ccache cc from the PATH
142 RETRY_COMPILER_SAVED_PATH="$PATH"
143 COMPILER_DIRNAME=`$DIRNAME [$]$1`
144 PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
145
146 # Try again looking for our compiler
147 AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
148 BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
149 PATH="$RETRY_COMPILER_SAVED_PATH"
150
151 AC_MSG_CHECKING([for resolved symbolic links for $1])
152 BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
153 AC_MSG_RESULT([$PROPER_COMPILER_$1])
154 $1="$PROPER_COMPILER_$1"
155 else
156 AC_MSG_RESULT([no, keeping $1])
157 $1="$TEST_COMPILER"
158 fi
159 TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
160 ])
161
162
163 AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
164 [
165 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
166 TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
167 fi
168
169 AC_SUBST(MSVCR_DLL)
170
156 # If --build AND --host is set, then the configure script will find any 171 # If --build AND --host is set, then the configure script will find any
157 # cross compilation tools in the PATH. Cross compilation tools 172 # cross compilation tools in the PATH. Cross compilation tools
158 # follows the cross compilation standard where they are prefixed with ${host}. 173 # follows the cross compilation standard where they are prefixed with ${host}.
159 # For example the binary i686-sun-solaris2.10-gcc 174 # For example the binary i686-sun-solaris2.10-gcc
160 # will cross compile for i686-sun-solaris2.10 175 # will cross compile for i686-sun-solaris2.10
169 # once. Also, we need to do this before adding a tools dir to the path, 184 # once. Also, we need to do this before adding a tools dir to the path,
170 # otherwise we might pick up cross-compilers which don't use standard naming. 185 # otherwise we might pick up cross-compilers which don't use standard naming.
171 # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have 186 # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
172 # to wait until they are properly discovered. 187 # to wait until they are properly discovered.
173 AC_PATH_PROGS(BUILD_CC, [cl cc gcc]) 188 AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
174 SET_FULL_PATH(BUILD_CC) 189 BASIC_FIXUP_EXECUTABLE(BUILD_CC)
175 AC_PATH_PROGS(BUILD_CXX, [cl CC g++]) 190 AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
176 SET_FULL_PATH(BUILD_CXX) 191 BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
177 AC_PATH_PROG(BUILD_LD, ld) 192 AC_PATH_PROG(BUILD_LD, ld)
178 SET_FULL_PATH(BUILD_LD) 193 BASIC_FIXUP_EXECUTABLE(BUILD_LD)
179 fi 194 fi
180 AC_SUBST(BUILD_CC) 195 AC_SUBST(BUILD_CC)
181 AC_SUBST(BUILD_CXX) 196 AC_SUBST(BUILD_CXX)
182 AC_SUBST(BUILD_LD) 197 AC_SUBST(BUILD_LD)
183 198
216 OLD_PATH="$PATH" 231 OLD_PATH="$PATH"
217 if test "x$TOOLS_DIR" != x; then 232 if test "x$TOOLS_DIR" != x; then
218 PATH=$TOOLS_DIR:$PATH 233 PATH=$TOOLS_DIR:$PATH
219 fi 234 fi
220 235
236
237 ### Locate C compiler (CC)
238
221 # gcc is almost always present, but on Windows we 239 # gcc is almost always present, but on Windows we
222 # prefer cl.exe and on Solaris we prefer CC. 240 # prefer cl.exe and on Solaris we prefer CC.
223 # Thus test for them in this order. 241 # Thus test for them in this order.
224 AC_PROG_CC([cl cc gcc]) 242 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
225 if test "x$CC" = x; then 243 # Do not probe for cc on MacOSX.
226 HELP_MSG_MISSING_DEPENDENCY([devkit]) 244 COMPILER_CHECK_LIST="cl gcc"
227 AC_MSG_ERROR([Could not find a compiler. $HELP_MSG]) 245 else
228 fi 246 COMPILER_CHECK_LIST="cl cc gcc"
229 if test "x$CC" = xcc && test "x$OPENJDK_BUILD_OS" = xmacosx; then 247 fi
230 # Do not use cc on MacOSX use gcc instead. 248
231 CC="gcc" 249 TOOLCHAIN_FIND_COMPILER([CC],[C],[$COMPILER_CHECK_LIST])
232 fi 250 # Now that we have resolved CC ourself, let autoconf have it's go at it
233 SET_FULL_PATH(CC) 251 AC_PROG_CC([$CC])
234 252
235 AC_PROG_CXX([cl CC g++]) 253 ### Locate C++ compiler (CXX)
236 if test "x$CXX" = xCC && test "x$OPENJDK_BUILD_OS" = xmacosx; then 254
237 # The found CC, even though it seems to be a g++ derivate, cannot compile 255 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
238 # c++ code. Override. 256 # Do not probe for CC on MacOSX.
239 CXX="g++" 257 COMPILER_CHECK_LIST="cl g++"
240 fi 258 else
241 SET_FULL_PATH(CXX) 259 COMPILER_CHECK_LIST="cl CC g++"
242 260 fi
243 if test "x$CXX" = x || test "x$CC" = x; then 261 TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST])
244 HELP_MSG_MISSING_DEPENDENCY([devkit]) 262 # Now that we have resolved CXX ourself, let autoconf have it's go at it
245 AC_MSG_ERROR([Could not find the needed compilers! $HELP_MSG ]) 263 AC_PROG_CXX([$CXX])
246 fi 264
247 265 ### Locate other tools
248 if test "x$OPENJDK_BUILD_OS" != xwindows; then 266
267 if test "x$OPENJDK_TARGET_OS" != xwindows; then
249 AC_PROG_OBJC 268 AC_PROG_OBJC
250 SET_FULL_PATH(OBJC) 269 BASIC_FIXUP_EXECUTABLE(OBJC)
251 else 270 else
252 OBJC= 271 OBJC=
253 fi 272 fi
254 273
255 # Restore the flags to the user specified values. 274 # Restore the flags to the user specified values.
268 # Linking C++ libraries. 287 # Linking C++ libraries.
269 AC_SUBST(LDCXX) 288 AC_SUBST(LDCXX)
270 # Linking C++ executables. 289 # Linking C++ executables.
271 AC_SUBST(LDEXECXX) 290 AC_SUBST(LDEXECXX)
272 291
273 if test "x$OPENJDK_BUILD_OS" != xwindows; then 292 if test "x$OPENJDK_TARGET_OS" != xwindows; then
274 AC_CHECK_TOOL(AR, ar) 293 AC_CHECK_TOOL(AR, ar)
275 SET_FULL_PATH(AR) 294 BASIC_FIXUP_EXECUTABLE(AR)
276 fi 295 fi
277 if test "x$OPENJDK_BUILD_OS" = xmacosx; then 296 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
278 ARFLAGS="-r" 297 ARFLAGS="-r"
279 else 298 else
280 ARFLAGS="" 299 ARFLAGS=""
281 fi 300 fi
282 AC_SUBST(ARFLAGS) 301 AC_SUBST(ARFLAGS)
283 302
303 # For hotspot, we need these in Windows mixed path; other platforms keep them the same
304 HOTSPOT_CXX="$CXX"
305 HOTSPOT_LD="$LD"
306 AC_SUBST(HOTSPOT_CXX)
307 AC_SUBST(HOTSPOT_LD)
308
284 COMPILER_NAME=gcc 309 COMPILER_NAME=gcc
285 COMPILER_TYPE=CC 310 COMPILER_TYPE=CC
286 AS_IF([test "x$OPENJDK_BUILD_OS" = xwindows], [ 311 AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
287 # For now, assume that we are always compiling using cl.exe. 312 # For now, assume that we are always compiling using cl.exe.
288 CC_OUT_OPTION=-Fo 313 CC_OUT_OPTION=-Fo
289 EXE_OUT_OPTION=-out: 314 EXE_OUT_OPTION=-out:
290 LD_OUT_OPTION=-out: 315 LD_OUT_OPTION=-out:
291 AR_OUT_OPTION=-out: 316 AR_OUT_OPTION=-out:
292 # On Windows, reject /usr/bin/link (as determined in CYGWIN_LINK), which is a cygwin 317 # On Windows, reject /usr/bin/link (as determined in CYGWIN_LINK), which is a cygwin
293 # program for something completely different. 318 # program for something completely different.
294 AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK]) 319 AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK])
295 # Since we must ignore the first found link, WINLD will contain 320 # Since we must ignore the first found link, WINLD will contain
296 # the full path to the link.exe program. 321 # the full path to the link.exe program.
297 SET_FULL_PATH_SPACESAFE([WINLD]) 322 BASIC_FIXUP_EXECUTABLE(WINLD)
298 printf "Windows linker was found at $WINLD\n" 323 printf "Windows linker was found at $WINLD\n"
299 AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker]) 324 AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
300 "$WINLD" --version > /dev/null 325 "$WINLD" --version > /dev/null
301 if test $? -eq 0 ; then 326 if test $? -eq 0 ; then
302 AC_MSG_RESULT([no]) 327 AC_MSG_RESULT([no])
308 LDEXE="$WINLD" 333 LDEXE="$WINLD"
309 LDCXX="$WINLD" 334 LDCXX="$WINLD"
310 LDEXECXX="$WINLD" 335 LDEXECXX="$WINLD"
311 336
312 AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt]) 337 AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
313 SET_FULL_PATH_SPACESAFE([MT]) 338 BASIC_FIXUP_EXECUTABLE(MT)
314 # The resource compiler 339 # The resource compiler
315 AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc]) 340 AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
316 SET_FULL_PATH_SPACESAFE([RC]) 341 BASIC_FIXUP_EXECUTABLE(RC)
317 342
318 RC_FLAGS="-nologo /l 0x409 /r" 343 # For hotspot, we need these in Windows mixed path,
344 # so rewrite them all. Need added .exe suffix.
345 HOTSPOT_CXX="$CXX.exe"
346 HOTSPOT_LD="$LD.exe"
347 HOTSPOT_MT="$MT.exe"
348 HOTSPOT_RC="$RC.exe"
349 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX)
350 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD)
351 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT)
352 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC)
353 AC_SUBST(HOTSPOT_MT)
354 AC_SUBST(HOTSPOT_RC)
355
356 RC_FLAGS="-nologo -l 0x409 -r"
319 AS_IF([test "x$VARIANT" = xOPT], [ 357 AS_IF([test "x$VARIANT" = xOPT], [
320 RC_FLAGS="$RC_FLAGS -d NDEBUG" 358 RC_FLAGS="$RC_FLAGS -d NDEBUG"
321 ]) 359 ])
322 JDK_UPDATE_VERSION_NOTNULL=$JDK_UPDATE_VERSION 360 JDK_UPDATE_VERSION_NOTNULL=$JDK_UPDATE_VERSION
323 AS_IF([test "x$JDK_UPDATE_VERSION" = x], [ 361 AS_IF([test "x$JDK_UPDATE_VERSION" = x], [
331 RC_FLAGS="$RC_FLAGS -d \"JDK_NAME=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME $JDK_MINOR_VERSION $JDK_UPDATE_META_TAG\"" 369 RC_FLAGS="$RC_FLAGS -d \"JDK_NAME=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME $JDK_MINOR_VERSION $JDK_UPDATE_META_TAG\""
332 RC_FLAGS="$RC_FLAGS -d \"JDK_FVER=$JDK_MINOR_VERSION,$JDK_MICRO_VERSION,$JDK_UPDATE_VERSION_NOTNULL,$COOKED_BUILD_NUMBER\"" 370 RC_FLAGS="$RC_FLAGS -d \"JDK_FVER=$JDK_MINOR_VERSION,$JDK_MICRO_VERSION,$JDK_UPDATE_VERSION_NOTNULL,$COOKED_BUILD_NUMBER\""
333 371
334 # lib.exe is used to create static libraries. 372 # lib.exe is used to create static libraries.
335 AC_CHECK_PROG([WINAR], [lib],[lib],,,) 373 AC_CHECK_PROG([WINAR], [lib],[lib],,,)
336 SET_FULL_PATH_SPACESAFE([WINAR]) 374 BASIC_FIXUP_EXECUTABLE(WINAR)
337 AR="$WINAR" 375 AR="$WINAR"
338 ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT" 376 ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
339 377
340 AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,) 378 AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
341 SET_FULL_PATH_SPACESAFE([DUMPBIN]) 379 BASIC_FIXUP_EXECUTABLE(DUMPBIN)
342 380
343 COMPILER_TYPE=CL 381 COMPILER_TYPE=CL
344 CCXXFLAGS="$CCXXFLAGS -nologo" 382 CCXXFLAGS="$CCXXFLAGS -nologo"
345 ]) 383 ])
346 AC_SUBST(RC_FLAGS) 384 AC_SUBST(RC_FLAGS)
347 AC_SUBST(COMPILER_TYPE) 385 AC_SUBST(COMPILER_TYPE)
348 386
349 AC_PROG_CPP 387 AC_PROG_CPP
350 SET_FULL_PATH(CPP) 388 BASIC_FIXUP_EXECUTABLE(CPP)
351 389
352 AC_PROG_CXXCPP 390 AC_PROG_CXXCPP
353 SET_FULL_PATH(CXXCPP) 391 BASIC_FIXUP_EXECUTABLE(CXXCPP)
354 392
355 if test "x$COMPILE_TYPE" != "xcross"; then 393 if test "x$COMPILE_TYPE" != "xcross"; then
356 # If we are not cross compiling, use the same compilers for 394 # If we are not cross compiling, use the same compilers for
357 # building the build platform executables. The cross-compilation 395 # building the build platform executables. The cross-compilation
358 # case needed to be done earlier, but this can only be done after 396 # case needed to be done earlier, but this can only be done after
371 if test "x$OPENJDK_BUILD_OS" = xsolaris; then 409 if test "x$OPENJDK_BUILD_OS" = xsolaris; then
372 PATH="${TOOLS_DIR}:/usr/ccs/bin:${OLD_PATH}" 410 PATH="${TOOLS_DIR}:/usr/ccs/bin:${OLD_PATH}"
373 fi 411 fi
374 412
375 # Find the right assembler. 413 # Find the right assembler.
376 if test "x$OPENJDK_BUILD_OS" = xsolaris; then 414 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
377 AC_PATH_PROG(AS, as) 415 AC_PATH_PROG(AS, as)
378 SET_FULL_PATH(AS) 416 BASIC_FIXUP_EXECUTABLE(AS)
379 else 417 else
380 AS="$CC -c" 418 AS="$CC -c"
381 fi 419 fi
382 AC_SUBST(AS) 420 AC_SUBST(AS)
383 421
384 if test "x$OPENJDK_BUILD_OS" = xsolaris; then 422 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
385 AC_PATH_PROGS(NM, [gnm nm]) 423 AC_PATH_PROGS(NM, [gnm nm])
386 SET_FULL_PATH(NM) 424 BASIC_FIXUP_EXECUTABLE(NM)
387 AC_PATH_PROG(STRIP, strip) 425 AC_PATH_PROG(STRIP, strip)
388 SET_FULL_PATH(STRIP) 426 BASIC_FIXUP_EXECUTABLE(STRIP)
389 AC_PATH_PROG(MCS, mcs) 427 AC_PATH_PROG(MCS, mcs)
390 SET_FULL_PATH(MCS) 428 BASIC_FIXUP_EXECUTABLE(MCS)
391 elif test "x$OPENJDK_BUILD_OS" != xwindows; then 429 elif test "x$OPENJDK_TARGET_OS" != xwindows; then
392 AC_CHECK_TOOL(NM, nm) 430 AC_CHECK_TOOL(NM, nm)
393 SET_FULL_PATH(NM) 431 BASIC_FIXUP_EXECUTABLE(NM)
394 AC_CHECK_TOOL(STRIP, strip) 432 AC_CHECK_TOOL(STRIP, strip)
395 SET_FULL_PATH(STRIP) 433 BASIC_FIXUP_EXECUTABLE(STRIP)
396 fi 434 fi
397 435
398 ### 436 # objcopy is used for moving debug symbols to separate files when
399 # 437 # full debug symbols are enabled.
400 # Check for objcopy 438 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
401 # 439 AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
402 # but search for gobjcopy first... 440 BASIC_FIXUP_EXECUTABLE(OBJCOPY)
403 # since I on solaris found a broken objcopy...buhh 441 fi
404 # 442
405 AC_PATH_TOOL(OBJCOPY, gobjcopy) 443 AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
406 if test "x$OBJCOPY" = x; then 444 if test "x$OBJDUMP" != x; then
407 AC_PATH_TOOL(OBJCOPY, objcopy) 445 # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
446 BASIC_FIXUP_EXECUTABLE(OBJDUMP)
408 fi 447 fi
409 448
410 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then 449 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
411 AC_PATH_PROG(LIPO, lipo) 450 AC_PATH_PROG(LIPO, lipo)
412 SET_FULL_PATH(LIPO) 451 BASIC_FIXUP_EXECUTABLE(LIPO)
413 fi 452 fi
414 453
415 # Restore old path without tools dir 454 # Restore old path without tools dir
416 PATH="$OLD_PATH" 455 PATH="$OLD_PATH"
417 ]) 456 ])
447 LDCXX="$CXX" 486 LDCXX="$CXX"
448 LDEXECXX="$CXX" 487 LDEXECXX="$CXX"
449 POST_STRIP_CMD="$STRIP -g" 488 POST_STRIP_CMD="$STRIP -g"
450 489
451 # Linking is different on MacOSX 490 # Linking is different on MacOSX
452 if test "x$OPENJDK_BUILD_OS" = xmacosx; then 491 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
453 # Might change in the future to clang. 492 # Might change in the future to clang.
454 COMPILER_NAME=gcc 493 COMPILER_NAME=gcc
455 SHARED_LIBRARY='lib[$]1.dylib' 494 SHARED_LIBRARY='lib[$]1.dylib'
456 SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" 495 SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
457 SHARED_LIBRARY_SUFFIX='.dylib' 496 SHARED_LIBRARY_SUFFIX='.dylib'
461 SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.' 500 SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
462 SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN" 501 SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
463 POST_STRIP_CMD="$STRIP -S" 502 POST_STRIP_CMD="$STRIP -S"
464 fi 503 fi
465 else 504 else
466 if test "x$OPENJDK_BUILD_OS" = xsolaris; then 505 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
467 # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler 506 # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler
468 COMPILER_NAME=ossc 507 COMPILER_NAME=ossc
469 PICFLAG="-KPIC" 508 PICFLAG="-KPIC"
470 LIBRARY_PREFIX=lib 509 LIBRARY_PREFIX=lib
471 SHARED_LIBRARY='lib[$]1.so' 510 SHARED_LIBRARY='lib[$]1.so'
485 CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__" 524 CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
486 CFLAGS_JDKLIB_EXTRA='-xstrconst' 525 CFLAGS_JDKLIB_EXTRA='-xstrconst'
487 POST_STRIP_CMD="$STRIP -x" 526 POST_STRIP_CMD="$STRIP -x"
488 POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\"" 527 POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
489 fi 528 fi
490 if test "x$OPENJDK_BUILD_OS" = xwindows; then 529 if test "x$OPENJDK_TARGET_OS" = xwindows; then
491 # If it is not gcc, then assume it is the MS Visual Studio compiler 530 # If it is not gcc, then assume it is the MS Visual Studio compiler
492 COMPILER_NAME=cl 531 COMPILER_NAME=cl
493 PICFLAG="" 532 PICFLAG=""
494 LIBRARY_PREFIX= 533 LIBRARY_PREFIX=
495 SHARED_LIBRARY='[$]1.dll' 534 SHARED_LIBRARY='[$]1.dll'
624 # Use optimized math routines 663 # Use optimized math routines
625 # (If you expect perfect errno behavior, do not use this) 664 # (If you expect perfect errno behavior, do not use this)
626 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now 665 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
627 #CC_HIGHEST="$CC_HIGHEST -xlibmopt" 666 #CC_HIGHEST="$CC_HIGHEST -xlibmopt"
628 667
668 if test "x$OPENJDK_TARGET_CPU" = xsparc; then
669 CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
670 CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
671 fi
672
629 case $OPENJDK_TARGET_CPU_ARCH in 673 case $OPENJDK_TARGET_CPU_ARCH in
630 x86) 674 x86)
631 C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr" 675 C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr"
632 C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr" 676 C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
633 C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr" 677 C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
640 C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium" 684 C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
641 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium" 685 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
642 fi 686 fi
643 ;; 687 ;;
644 sparc) 688 sparc)
645 CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
646 CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
647 CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl" 689 CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
648 CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl" 690 CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
649 C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra" 691 C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
650 C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0" 692 C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
651 C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0" 693 C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
757 ;; 799 ;;
758 ossc ) 800 ossc )
759 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS" 801 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
760 case $OPENJDK_TARGET_CPU_ARCH in 802 case $OPENJDK_TARGET_CPU_ARCH in
761 x86 ) 803 x86 )
762 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -Di386" 804 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
763 CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE" 805 CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
764 ;; 806 ;;
765 esac 807 esac
766 808
767 CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" 809 CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
857 # is identical for client and server? Yes. Which is picked at runtime (client or server)? 899 # is identical for client and server? Yes. Which is picked at runtime (client or server)?
858 # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following 900 # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
859 # libraries will link to whatever is in memory. Yuck. 901 # libraries will link to whatever is in memory. Yuck.
860 # 902 #
861 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh. 903 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
862 if test "x$COMPILER_TYPE" = xCL; then 904 if test "x$COMPILER_NAME" = xcl; then
863 LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no" 905 LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
864 if test "x$OPENJDK_TARGET_CPU" = xx86; then 906 if test "x$OPENJDK_TARGET_CPU" = xx86; then
865 LDFLAGS_JDK="$LDFLAGS_JDK -safeseh" 907 LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
866 fi 908 fi
867 # TODO: make -debug optional "--disable-full-debug-symbols" 909 # TODO: make -debug optional "--disable-full-debug-symbols"
873 else 915 else
874 LDFLAGS_STACK_SIZE=327680 916 LDFLAGS_STACK_SIZE=327680
875 fi 917 fi
876 LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE" 918 LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE"
877 else 919 else
878 # If this is a --hash-style=gnu system, use --hash-style=both, why? 920 if test "x$COMPILER_NAME" = xgcc; then
879 HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'` 921 # If this is a --hash-style=gnu system, use --hash-style=both, why?
880 if test -n "$HAS_GNU_HASH"; then 922 HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
881 # And since we now know that the linker is gnu, then add -z defs, to forbid 923 if test -n "$HAS_GNU_HASH"; then
882 # undefined symbols in object files. 924 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both "
883 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both -Xlinker -z -Xlinker defs"
884 if test "x$DEBUG_LEVEL" == "xrelease"; then
885 # When building release libraries, tell the linker optimize them.
886 # Should this be supplied to the OSS linker as well?
887 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
888 fi 925 fi
889 fi 926 if test "x$OPENJDK_TARGET_OS" = xlinux; then
890 927 # And since we now know that the linker is gnu, then add -z defs, to forbid
928 # undefined symbols in object files.
929 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
930 if test "x$DEBUG_LEVEL" = "xrelease"; then
931 # When building release libraries, tell the linker optimize them.
932 # Should this be supplied to the OSS linker as well?
933 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
934 fi
935 fi
936 fi
891 LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \ 937 LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
892 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server \ 938 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server \
893 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client \ 939 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client \
894 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}" 940 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
895 941

mercurial