< prev index next >

common/autoconf/toolchain.m4

Print this page
rev 1735 : 8151841: Build needs additional flags to compile with GCC 6 [plus parts of 8149647 & 8032045]
Summary: C++ standard needs to be explicitly set and some optimisations turned off to build on GCC 6
Reviewed-by: erikj, dholmes, kbarrett

*** 21,33 **** # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. # # $1 = compiler to test (CC or CXX) # $2 = human readable name of compiler (C or C++) ! AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION], [ COMPILER=[$]$1 COMPILER_NAME=$2 if test "x$OPENJDK_TARGET_OS" = xsolaris; then --- 21,83 ---- # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. # + # Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called. + # Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER. + AC_DEFUN([TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS], + [ + if test "x$CC_VERSION" != "x$CXX_VERSION"; then + AC_MSG_WARN([C and C++ compiler has different version numbers, $CC_VERSION vs $CXX_VERSION.]) + AC_MSG_WARN([This typically indicates a broken setup, and is not supported]) + fi + + # We only check CC_VERSION since we assume CXX_VERSION is equal. + if [ [[ "$CC_VERSION" =~ (.*\.){3} ]] ]; then + AC_MSG_WARN([C compiler version number has more than three parts (X.Y.Z): $CC_VERSION. Comparisons might be wrong.]) + fi + + if [ [[ "$CC_VERSION" =~ [0-9]{6} ]] ]; then + AC_MSG_WARN([C compiler version number has a part larger than 99999: $CC_VERSION. Comparisons might be wrong.]) + fi + + COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "$CC_VERSION"` + ]) + + # Check if the configured compiler (C and C++) is of a specific version or + # newer. TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS must have been called before. + # + # Arguments: + # $1: The version string to check against the found version + # $2: block to run if the compiler is at least this version (>=) + # $3: block to run if the compiler is older than this version (<) + AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION], + [ + REFERENCE_VERSION=$1 + + if [ [[ "$REFERENCE_VERSION" =~ (.*\.){3} ]] ]; then + AC_MSG_ERROR([Internal error: Cannot compare to $REFERENCE_VERSION, only three parts (X.Y.Z) is supported]) + fi + + if [ [[ "$REFERENCE_VERSION" =~ [0-9]{6} ]] ]; then + AC_MSG_ERROR([Internal error: Cannot compare to $REFERENCE_VERSION, only parts < 99999 is supported]) + fi + + # Version comparison method inspired by http://stackoverflow.com/a/24067243 + COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "$REFERENCE_VERSION"` + + if test $COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then + m4_ifval([$2], [$2], [:]) + else + m4_ifval([$3], [$3], [:]) + fi + ]) + # $1 = compiler to test (CC or CXX) # $2 = human readable name of compiler (C or C++) ! AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION], [ COMPILER=[$]$1 COMPILER_NAME=$2 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
*** 79,89 **** AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.]) fi # First line typically looks something like: # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2 ! COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"` COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"` fi # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker) $1_VERSION="$COMPILER_VERSION" # This sets CC_VENDOR or CXX_VENDOR. (This comment is a grep marker) --- 129,140 ---- AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.]) fi # First line typically looks something like: # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2 ! COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | \ ! $SED -e 's/^.* \(@<:@1-9@:>@\.@<:@0-9.@:>@*\)@<:@^0-9.@:>@.*$/\1/'` COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"` fi # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker) $1_VERSION="$COMPILER_VERSION" # This sets CC_VENDOR or CXX_VENDOR. (This comment is a grep marker)
*** 179,189 **** $1="$PROPER_COMPILER_$1" else AC_MSG_RESULT([no, keeping $1]) $1="$TEST_COMPILER" fi ! TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME]) ]) AC_DEFUN([TOOLCHAIN_SETUP_PATHS], [ --- 230,240 ---- $1="$PROPER_COMPILER_$1" else AC_MSG_RESULT([no, keeping $1]) $1="$TEST_COMPILER" fi ! TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1], [$COMPILER_NAME]) ]) AC_DEFUN([TOOLCHAIN_SETUP_PATHS], [
*** 383,392 **** --- 434,449 ---- TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST]) # Now that we have resolved CXX ourself, let autoconf have its go at it AC_PROG_CXX([$CXX]) + # This is the compiler version number on the form X.Y[.Z] + AC_SUBST(CC_VERSION) + AC_SUBST(CXX_VERSION) + + TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS + ### Locate other tools if test "x$OPENJDK_TARGET_OS" = xmacosx; then AC_PROG_OBJC BASIC_FIXUP_EXECUTABLE(OBJC)
*** 505,515 **** AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,) BASIC_FIXUP_EXECUTABLE(DUMPBIN) COMPILER_TYPE=CL ! CCXXFLAGS="$CCXXFLAGS -nologo" ]) AC_SUBST(RC_FLAGS) AC_SUBST(COMPILER_TYPE) AC_PROG_CPP --- 562,573 ---- AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,) BASIC_FIXUP_EXECUTABLE(DUMPBIN) COMPILER_TYPE=CL ! # silence copyright notice and other headers. ! COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo" ]) AC_SUBST(RC_FLAGS) AC_SUBST(COMPILER_TYPE) AC_PROG_CPP
*** 952,986 **** ############################################################################### # # Now setup the CFLAGS and LDFLAGS for the JDK build. # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build. # case $COMPILER_NAME in gcc ) ! CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \ -pipe \ -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" case $OPENJDK_TARGET_CPU_ARCH in arm ) # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" ;; ppc ) # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing ;; * ) ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer" CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" ;; esac ;; ossc ) ! CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS" case $OPENJDK_TARGET_CPU_ARCH in x86 ) ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB" CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE" ;; esac CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" --- 1010,1053 ---- ############################################################################### # # Now setup the CFLAGS and LDFLAGS for the JDK build. # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build. + # CFLAGS_JDK - C Compiler flags + # CXXFLAGS_JDK - C++ Compiler flags + # COMMON_CCXXFLAGS_JDK - common to C and C++ # case $COMPILER_NAME in gcc ) ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \ -pipe \ -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" + CXXSTD_CXXFLAG="-std=gnu++98" + TOOLCHAIN_CXX_COMPILER_CHECK_ARGUMENTS([$CXXSTD_CXXFLAG $CFLAGS_WARNINGS_ARE_ERRORS], + [], [CXXSTD_CXXFLAG=""]) + CXXFLAGS_JDK="${CXXFLAGS_JDK} ${CXXSTD_CXXFLAG}" + AC_SUBST([CXXSTD_CXXFLAG]) case $OPENJDK_TARGET_CPU_ARCH in arm ) # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" ;; ppc ) # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing ;; * ) ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer" CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" ;; esac + TOOLCHAIN_CHECK_COMPILER_VERSION(6, TOOLCHAIN_SETUP_GCC6_COMPILER_FLAGS) ;; ossc ) ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS" case $OPENJDK_TARGET_CPU_ARCH in x86 ) ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB" CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE" ;; esac CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
*** 995,1014 **** LDFLAGS_JDK="$LDFLAGS_JDK" LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK" ;; cl ) ! CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \ -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \ -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ -DWIN32 -DIAL" case $OPENJDK_TARGET_CPU in x86 ) ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86" ;; x86_64 ) ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64" ;; esac ;; esac --- 1062,1081 ---- LDFLAGS_JDK="$LDFLAGS_JDK" LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK" ;; cl ) ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \ -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \ -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ -DWIN32 -DIAL" case $OPENJDK_TARGET_CPU in x86 ) ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86" ;; x86_64 ) ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64" ;; esac ;; esac
*** 1034,1044 **** CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE" JAVAC_FLAGS="$JAVAC_FLAGS -g" ;; esac ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64" # The package path is used only on macosx? PACKAGE_PATH=/opt/local AC_SUBST(PACKAGE_PATH) --- 1101,1111 ---- CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE" JAVAC_FLAGS="$JAVAC_FLAGS -g" ;; esac ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK $ADD_LP64" # The package path is used only on macosx? PACKAGE_PATH=/opt/local AC_SUBST(PACKAGE_PATH)
*** 1047,1119 **** # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). # Note: -Dmacro is the same as #define macro 1 # -Dmacro= is the same as #define macro if test "x$OPENJDK_TARGET_OS" = xsolaris; then ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN=" else ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN" fi else ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" fi if test "x$OPENJDK_TARGET_OS" = xlinux; then ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX" fi if test "x$OPENJDK_TARGET_OS" = xwindows; then ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS" fi if test "x$OPENJDK_TARGET_OS" = xsolaris; then ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS" fi if test "x$OPENJDK_TARGET_OS" = xaix; then ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DAIX -DPPC64" fi if test "x$OPENJDK_TARGET_OS" = xmacosx; then ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" # Setting these parameters makes it an error to link to macosx APIs that are # newer than the given OS version and makes the linked binaries compatible even # if built on a newer version of the OS. # The expected format is X.Y.Z MACOSX_VERSION_MIN=10.7.0 AC_SUBST(MACOSX_VERSION_MIN) # The macro takes the version with no dots, ex: 1070 # Let the flags variables get resolved in make for easier override on make # command line. ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" fi if test "x$OPENJDK_TARGET_OS" = xbsd; then ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE" fi if test "x$DEBUG_LEVEL" = xrelease; then ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG" if test "x$OPENJDK_TARGET_OS" = xsolaris; then ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED" fi else ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG" fi ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY" ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'" ! CCXXFLAGS_JDK="$CCXXFLAGS_JDK \ -I${JDK_OUTPUTDIR}/include \ -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \ -I${JDK_TOPDIR}/src/share/javavm/export \ -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \ -I${JDK_TOPDIR}/src/share/native/common \ -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common" # The shared libraries are compiled using the picflag. ! CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" ! CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA " # Executable flags ! CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK" ! CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK" # Now this is odd. The JDK native libraries have to link against libjvm.so # On 32-bit machines there is normally two distinct libjvm.so:s, client and server. # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library # is identical for client and server? Yes. Which is picked at runtime (client or server)? --- 1114,1186 ---- # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). # Note: -Dmacro is the same as #define macro 1 # -Dmacro= is the same as #define macro if test "x$OPENJDK_TARGET_OS" = xsolaris; then ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN=" else ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN" fi else ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN" fi if test "x$OPENJDK_TARGET_OS" = xlinux; then ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DLINUX" fi if test "x$OPENJDK_TARGET_OS" = xwindows; then ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DWINDOWS" fi if test "x$OPENJDK_TARGET_OS" = xsolaris; then ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DSOLARIS" fi if test "x$OPENJDK_TARGET_OS" = xaix; then ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DAIX -DPPC64" fi if test "x$OPENJDK_TARGET_OS" = xmacosx; then ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" # Setting these parameters makes it an error to link to macosx APIs that are # newer than the given OS version and makes the linked binaries compatible even # if built on a newer version of the OS. # The expected format is X.Y.Z MACOSX_VERSION_MIN=10.7.0 AC_SUBST(MACOSX_VERSION_MIN) # The macro takes the version with no dots, ex: 1070 # Let the flags variables get resolved in make for easier override on make # command line. ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" fi if test "x$OPENJDK_TARGET_OS" = xbsd; then ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE" fi if test "x$DEBUG_LEVEL" = xrelease; then ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DNDEBUG" if test "x$OPENJDK_TARGET_OS" = xsolaris; then ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DTRIMMED" fi else ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DDEBUG" fi ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY" ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'" ! COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \ -I${JDK_OUTPUTDIR}/include \ -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \ -I${JDK_TOPDIR}/src/share/javavm/export \ -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \ -I${JDK_TOPDIR}/src/share/native/common \ -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common" # The shared libraries are compiled using the picflag. ! CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" ! CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA " # Executable flags ! CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK" ! CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK" # Now this is odd. The JDK native libraries have to link against libjvm.so # On 32-bit machines there is normally two distinct libjvm.so:s, client and server. # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library # is identical for client and server? Yes. Which is picked at runtime (client or server)?
*** 1194,1210 **** AC_SUBST(LDFLAGS_JDKEXE_SUFFIX) AC_SUBST(LDFLAGS_CXX_JDK) ]) ! # TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE], # [RUN-IF-FALSE]) # ------------------------------------------------------------ ! # Check that the c and c++ compilers support an argument ! AC_DEFUN([TOOLCHAIN_COMPILER_CHECK_ARGUMENTS], [ ! AC_MSG_CHECKING([if compiler supports "$1"]) supports=yes saved_cflags="$CFLAGS" CFLAGS="$CFLAGS $1" AC_LANG_PUSH([C]) --- 1261,1277 ---- AC_SUBST(LDFLAGS_JDKEXE_SUFFIX) AC_SUBST(LDFLAGS_CXX_JDK) ]) ! # TOOLCHAIN_C_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE], # [RUN-IF-FALSE]) # ------------------------------------------------------------ ! # Check that the C compiler supports an argument ! AC_DEFUN([TOOLCHAIN_C_COMPILER_CHECK_ARGUMENTS], [ ! AC_MSG_CHECKING([if the C compiler supports "$1"]) supports=yes saved_cflags="$CFLAGS" CFLAGS="$CFLAGS $1" AC_LANG_PUSH([C])
*** 1227,1236 **** --- 1294,1345 ---- else m4_ifval([$3], [$3], [:]) fi ]) + # TOOLCHAIN_CXX_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE], + # [RUN-IF-FALSE]) + # ------------------------------------------------------------ + # Check that the C++ compiler supports an argument + AC_DEFUN([TOOLCHAIN_CXX_COMPILER_CHECK_ARGUMENTS], + [ + AC_MSG_CHECKING([if the C++ compiler supports "$1"]) + supports=yes + + AC_MSG_RESULT([$supports]) + if test "x$supports" = "xyes" ; then + m4_ifval([$2], [$2], [:]) + else + m4_ifval([$3], [$3], [:]) + fi + ]) + + # TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE], + # [RUN-IF-FALSE]) + # ------------------------------------------------------------ + # Check that the C and C++ compilers support an argument + AC_DEFUN([TOOLCHAIN_COMPILER_CHECK_ARGUMENTS], + [ + TOOLCHAIN_C_COMPILER_CHECK_ARGUMENTS([$1], + [C_COMP_SUPPORTS="yes"], + [C_COMP_SUPPORTS="no"]) + TOOLCHAIN_CXX_COMPILER_CHECK_ARGUMENTS([$1], + [CXX_COMP_SUPPORTS="yes"], + [CXX_COMP_SUPPORTS="no"]) + + AC_MSG_CHECKING([if both compilers support "$1"]) + supports=no + if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi + + AC_MSG_RESULT([$supports]) + if test "x$supports" = "xyes" ; then + m4_ifval([$2], [$2], [:]) + else + m4_ifval([$3], [$3], [:]) + fi + ]) + AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_MISC], [ # Some Zero and Shark settings. # ZERO_ARCHFLAG tells the compiler which mode to build for case "${OPENJDK_TARGET_CPU}" in
*** 1309,1313 **** --- 1418,1439 ---- fi AC_SUBST(JT_HOME) AC_SUBST(JTREGEXE) ]) + + AC_DEFUN_ONCE([TOOLCHAIN_SETUP_GCC6_COMPILER_FLAGS], + [ + # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code + # runs afoul of the more aggressive versions of these optimisations. + # Notably, value range propagation now assumes that the this pointer of C++ + # member functions is non-null. + NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks" + TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror], + [], [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""]) + AC_SUBST([NO_DELETE_NULL_POINTER_CHECKS_CFLAG]) + NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse" + TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$NO_LIFETIME_DSE_CFLAG -Werror], + [], [NO_LIFETIME_DSE_CFLAG=""]) + CFLAGS_JDK="${CFLAGS_JDK} ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}" + AC_SUBST([NO_LIFETIME_DSE_CFLAG]) + ])
< prev index next >