1 #
2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
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
237 if test "x$x_includes" = "xNONE"; then
238 x_includes="$SYS_ROOT/usr/include/X11"
239 fi
240 if test "x$x_libraries" = "xNONE"; then
241 x_libraries="$SYS_ROOT/usr/lib"
242 fi
243 ],
244 [])
245
246 # Store the CFLAGS etal passed to the configure script.
247 ORG_CFLAGS="$CFLAGS"
248 ORG_CXXFLAGS="$CXXFLAGS"
249 ORG_OBJCFLAGS="$OBJCFLAGS"
250
251 # autoconf magic only relies on PATH, so update it if tools dir is specified
252 OLD_PATH="$PATH"
253 if test "x$TOOLS_DIR" != x; then
254 PATH=$TOOLS_DIR:$PATH
255 fi
256
257
258 ### Locate C compiler (CC)
259
260 # On windows, only cl.exe is supported.
261 # On Solaris, cc is preferred to gcc.
262 # Elsewhere, gcc is preferred to cc.
263
264 if test "x$CC" != x; then
265 COMPILER_CHECK_LIST="$CC"
266 elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
267 COMPILER_CHECK_LIST="cl"
268 elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
269 COMPILER_CHECK_LIST="cc gcc"
270 elif test "x$OPENJDK_TARGET_OS" = "xaix"; then
271 # Do not probe for cc on AIX.
272 COMPILER_CHECK_LIST="xlc_r"
273 else
274 COMPILER_CHECK_LIST="gcc cc"
275 fi
276
460
461 # Find the right assembler.
462 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
463 AC_PATH_PROG(AS, as)
464 BASIC_FIXUP_EXECUTABLE(AS)
465 else
466 AS="$CC -c"
467 fi
468 AC_SUBST(AS)
469
470 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
471 AC_PATH_PROG(NM, nm)
472 BASIC_FIXUP_EXECUTABLE(NM)
473 AC_PATH_PROG(GNM, gnm)
474 BASIC_FIXUP_EXECUTABLE(GNM)
475 AC_PATH_PROG(STRIP, strip)
476 BASIC_FIXUP_EXECUTABLE(STRIP)
477 AC_PATH_PROG(MCS, mcs)
478 BASIC_FIXUP_EXECUTABLE(MCS)
479 elif test "x$OPENJDK_TARGET_OS" != xwindows; then
480 AC_CHECK_TOOL(NM, nm)
481 BASIC_FIXUP_EXECUTABLE(NM)
482 GNM="$NM"
483 AC_SUBST(GNM)
484 AC_CHECK_TOOL(STRIP, strip)
485 BASIC_FIXUP_EXECUTABLE(STRIP)
486 fi
487
488 # objcopy is used for moving debug symbols to separate files when
489 # full debug symbols are enabled.
490 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
491 AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
492 # Only call fixup if objcopy was found.
493 if test -n "$OBJCOPY"; then
494 BASIC_FIXUP_EXECUTABLE(OBJCOPY)
495 fi
496 fi
497
498 AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
499 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.
501 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
508
509 TOOLCHAIN_SETUP_JTREG
510
511 # Restore old path without tools dir
512 PATH="$OLD_PATH"
513 ])
514
515
516 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS],
517 [
518
519 ###############################################################################
520 #
521 # How to compile shared libraries.
522 #
523
524 if test "x$GCC" = xyes; then
525 COMPILER_NAME=gcc
526 PICFLAG="-fPIC"
527 LIBRARY_PREFIX=lib
528 SHARED_LIBRARY='lib[$]1.so'
|
1 #
2 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
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
237 if test "x$x_includes" = "xNONE"; then
238 x_includes="$SYS_ROOT/usr/include/X11"
239 fi
240 if test "x$x_libraries" = "xNONE"; then
241 x_libraries="$SYS_ROOT/usr/lib"
242 fi
243 ],
244 [])
245
246 # Store the CFLAGS etal passed to the configure script.
247 ORG_CFLAGS="$CFLAGS"
248 ORG_CXXFLAGS="$CXXFLAGS"
249 ORG_OBJCFLAGS="$OBJCFLAGS"
250
251 # autoconf magic only relies on PATH, so update it if tools dir is specified
252 OLD_PATH="$PATH"
253 if test "x$TOOLS_DIR" != x; then
254 PATH=$TOOLS_DIR:$PATH
255 fi
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
337
338 ### Locate C compiler (CC)
339
340 # On windows, only cl.exe is supported.
341 # On Solaris, cc is preferred to gcc.
342 # Elsewhere, gcc is preferred to cc.
343
344 if test "x$CC" != x; then
345 COMPILER_CHECK_LIST="$CC"
346 elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
347 COMPILER_CHECK_LIST="cl"
348 elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
349 COMPILER_CHECK_LIST="cc gcc"
350 elif test "x$OPENJDK_TARGET_OS" = "xaix"; then
351 # Do not probe for cc on AIX.
352 COMPILER_CHECK_LIST="xlc_r"
353 else
354 COMPILER_CHECK_LIST="gcc cc"
355 fi
356
540
541 # Find the right assembler.
542 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
543 AC_PATH_PROG(AS, as)
544 BASIC_FIXUP_EXECUTABLE(AS)
545 else
546 AS="$CC -c"
547 fi
548 AC_SUBST(AS)
549
550 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
551 AC_PATH_PROG(NM, nm)
552 BASIC_FIXUP_EXECUTABLE(NM)
553 AC_PATH_PROG(GNM, gnm)
554 BASIC_FIXUP_EXECUTABLE(GNM)
555 AC_PATH_PROG(STRIP, strip)
556 BASIC_FIXUP_EXECUTABLE(STRIP)
557 AC_PATH_PROG(MCS, mcs)
558 BASIC_FIXUP_EXECUTABLE(MCS)
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
564 AC_CHECK_TOOL(NM, nm)
565 BASIC_FIXUP_EXECUTABLE(NM)
566 GNM="$NM"
567 AC_SUBST(GNM)
568 AC_CHECK_TOOL(STRIP, strip)
569 BASIC_FIXUP_EXECUTABLE(STRIP)
570 fi
571
572 # objcopy is used for moving debug symbols to separate files when
573 # full debug symbols are enabled.
574 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
575 AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
576 # Only call fixup if objcopy was found.
577 if test -n "$OBJCOPY"; then
578 BASIC_FIXUP_EXECUTABLE(OBJCOPY)
579 fi
580 fi
581
582 AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
583 if test "x$OBJDUMP" != x; then
584 # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
585 BASIC_FIXUP_EXECUTABLE(OBJDUMP)
586 fi
587
588 TOOLCHAIN_SETUP_JTREG
589
590 # Restore old path without tools dir
591 PATH="$OLD_PATH"
592 ])
593
594
595 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS],
596 [
597
598 ###############################################################################
599 #
600 # How to compile shared libraries.
601 #
602
603 if test "x$GCC" = xyes; then
604 COMPILER_NAME=gcc
605 PICFLAG="-fPIC"
606 LIBRARY_PREFIX=lib
607 SHARED_LIBRARY='lib[$]1.so'
|