252 OLD_PATH="$PATH" |
252 OLD_PATH="$PATH" |
253 if test "x$TOOLS_DIR" != x; then |
253 if test "x$TOOLS_DIR" != x; then |
254 PATH=$TOOLS_DIR:$PATH |
254 PATH=$TOOLS_DIR:$PATH |
255 fi |
255 fi |
256 |
256 |
|
257 # Before we locate the compilers, we need to sanitize the Xcode build environment |
|
258 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then |
|
259 # determine path to Xcode developer directory |
|
260 # can be empty in which case all the tools will rely on a sane Xcode 4 installation |
|
261 SET_DEVELOPER_DIR= |
|
262 |
|
263 if test -n "$XCODE_PATH"; then |
|
264 DEVELOPER_DIR="$XCODE_PATH"/Contents/Developer |
|
265 fi |
|
266 |
|
267 # DEVELOPER_DIR could also be provided directly |
|
268 AC_MSG_CHECKING([Determining if we need to set DEVELOPER_DIR]) |
|
269 if test -n "$DEVELOPER_DIR"; then |
|
270 if test ! -d "$DEVELOPER_DIR"; then |
|
271 AC_MSG_ERROR([Xcode Developer path does not exist: $DEVELOPER_DIR, please provide a path to the Xcode 4 application bundle using --with-xcode-path]) |
|
272 fi |
|
273 if test ! -f "$DEVELOPER_DIR"/usr/bin/xcodebuild; then |
|
274 AC_MSG_ERROR([Xcode Developer path is not valid: $DEVELOPER_DIR, it must point to Contents/Developer inside an Xcode application bundle]) |
|
275 fi |
|
276 # make it visible to all the tools immediately |
|
277 export DEVELOPER_DIR |
|
278 SET_DEVELOPER_DIR="export DEVELOPER_DIR := $DEVELOPER_DIR" |
|
279 AC_MSG_RESULT([yes ($DEVELOPER_DIR)]) |
|
280 else |
|
281 AC_MSG_RESULT([no]) |
|
282 fi |
|
283 AC_SUBST(SET_DEVELOPER_DIR) |
|
284 |
|
285 AC_PATH_PROG(XCODEBUILD, xcodebuild) |
|
286 if test -z "$XCODEBUILD"; then |
|
287 AC_MSG_ERROR([The xcodebuild tool was not found, the Xcode command line tools are required to build on Mac OS X]) |
|
288 fi |
|
289 |
|
290 # Fail-fast: verify we're building on Xcode 4, we cannot build with Xcode 5 or later |
|
291 XCODE_VERSION=`$XCODEBUILD -version | grep '^Xcode ' | sed 's/Xcode //'` |
|
292 XC_VERSION_PARTS=( ${XCODE_VERSION//./ } ) |
|
293 if test ! "${XC_VERSION_PARTS[[0]]}" = "4"; then |
|
294 AC_MSG_ERROR([Xcode 4 is required to build JDK 8, the version found was $XCODE_VERSION. Use --with-xcode-path to specify the location of Xcode 4 or make Xcode 4 active by using xcode-select.]) |
|
295 fi |
|
296 |
|
297 # Some versions of Xcode 5 command line tools install gcc and g++ as symlinks to |
|
298 # clang and clang++, which will break the build. So handle that here if we need to. |
|
299 if test -L "/usr/bin/gcc" -o -L "/usr/bin/g++"; then |
|
300 # use xcrun to find the real gcc and add it's directory to PATH |
|
301 # then autoconf magic will find it |
|
302 AC_MSG_NOTICE([Found gcc symlinks to clang in /usr/bin, adding path to real gcc to PATH]) |
|
303 XCODE_BIN_PATH=$(dirname `xcrun -find gcc`) |
|
304 PATH="$XCODE_BIN_PATH":$PATH |
|
305 fi |
|
306 |
|
307 # Determine appropriate SDKPATH, don't use SDKROOT as it interferes with the stub tools |
|
308 AC_MSG_CHECKING([Determining Xcode SDK path]) |
|
309 # allow SDKNAME to be set to override the default SDK selection |
|
310 SDKPATH=`"$XCODEBUILD" -sdk ${SDKNAME:-macosx} -version | grep '^Path: ' | sed 's/Path: //'` |
|
311 if test -n "$SDKPATH"; then |
|
312 AC_MSG_RESULT([$SDKPATH]) |
|
313 else |
|
314 AC_MSG_RESULT([(none, will use system headers and frameworks)]) |
|
315 fi |
|
316 AC_SUBST(SDKPATH) |
|
317 |
|
318 # Perform a basic sanity test |
|
319 if test ! -f "$SDKPATH/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then |
|
320 AC_MSG_ERROR([Unable to find required framework headers, provide a valid path to Xcode 4 using --with-xcode-path]) |
|
321 fi |
|
322 |
|
323 # if SDKPATH is non-empty then we need to add -isysroot and -iframework for gcc and g++ |
|
324 if test -n "$SDKPATH"; then |
|
325 # We need -isysroot <path> and -iframework<path>/System/Library/Frameworks |
|
326 CFLAGS_JDK="${CFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\"" |
|
327 CXXFLAGS_JDK="${CXXFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\"" |
|
328 LDFLAGS_JDK="${LDFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\"" |
|
329 fi |
|
330 |
|
331 # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework |
|
332 # setting this here means it doesn't have to be peppered throughout the forest |
|
333 CFLAGS_JDK="$CFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\"" |
|
334 CXXFLAGS_JDK="$CXXFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\"" |
|
335 LDFLAGS_JDK="$LDFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\"" |
|
336 fi |
257 |
337 |
258 ### Locate C compiler (CC) |
338 ### Locate C compiler (CC) |
259 |
339 |
260 # On windows, only cl.exe is supported. |
340 # On windows, only cl.exe is supported. |
261 # On Solaris, cc is preferred to gcc. |
341 # On Solaris, cc is preferred to gcc. |
475 AC_PATH_PROG(STRIP, strip) |
555 AC_PATH_PROG(STRIP, strip) |
476 BASIC_FIXUP_EXECUTABLE(STRIP) |
556 BASIC_FIXUP_EXECUTABLE(STRIP) |
477 AC_PATH_PROG(MCS, mcs) |
557 AC_PATH_PROG(MCS, mcs) |
478 BASIC_FIXUP_EXECUTABLE(MCS) |
558 BASIC_FIXUP_EXECUTABLE(MCS) |
479 elif test "x$OPENJDK_TARGET_OS" != xwindows; then |
559 elif test "x$OPENJDK_TARGET_OS" != xwindows; then |
|
560 AC_PATH_PROG(OTOOL, otool) |
|
561 if test "x$OTOOL" = "x"; then |
|
562 OTOOL="true" |
|
563 fi |
480 AC_CHECK_TOOL(NM, nm) |
564 AC_CHECK_TOOL(NM, nm) |
481 BASIC_FIXUP_EXECUTABLE(NM) |
565 BASIC_FIXUP_EXECUTABLE(NM) |
482 GNM="$NM" |
566 GNM="$NM" |
483 AC_SUBST(GNM) |
567 AC_SUBST(GNM) |
484 AC_CHECK_TOOL(STRIP, strip) |
568 AC_CHECK_TOOL(STRIP, strip) |
497 |
581 |
498 AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump]) |
582 AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump]) |
499 if test "x$OBJDUMP" != x; then |
583 if test "x$OBJDUMP" != x; then |
500 # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing. |
584 # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing. |
501 BASIC_FIXUP_EXECUTABLE(OBJDUMP) |
585 BASIC_FIXUP_EXECUTABLE(OBJDUMP) |
502 fi |
|
503 |
|
504 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then |
|
505 AC_PATH_PROG(LIPO, lipo) |
|
506 BASIC_FIXUP_EXECUTABLE(LIPO) |
|
507 fi |
586 fi |
508 |
587 |
509 TOOLCHAIN_SETUP_JTREG |
588 TOOLCHAIN_SETUP_JTREG |
510 |
589 |
511 # Restore old path without tools dir |
590 # Restore old path without tools dir |