< prev index next >

common/autoconf/flags.m4

Print this page


   1 #
   2 # Copyright (c) 2011, 2014, 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


 461   AC_SUBST(C_O_FLAG_HIGHEST)
 462   AC_SUBST(C_O_FLAG_HI)
 463   AC_SUBST(C_O_FLAG_NORM)
 464   AC_SUBST(C_O_FLAG_DEBUG)
 465   AC_SUBST(C_O_FLAG_NONE)
 466   AC_SUBST(CXX_O_FLAG_HIGHEST)
 467   AC_SUBST(CXX_O_FLAG_HI)
 468   AC_SUBST(CXX_O_FLAG_NORM)
 469   AC_SUBST(CXX_O_FLAG_DEBUG)
 470   AC_SUBST(CXX_O_FLAG_NONE)
 471 ])
 472 
 473 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
 474 [
 475   # Special extras...
 476   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 477     if test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
 478       CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
 479       CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
 480     fi


 481   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 482     LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
 483     CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
 484     CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
 485   fi
 486 
 487   if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
 488     AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
 489   fi
 490 
 491   if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
 492     AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
 493   fi
 494 
 495   if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
 496     AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
 497   fi
 498 
 499   AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
 500       [extra flags to be used when compiling jdk c-files])])


 512   # Hotspot needs these set in their legacy form
 513   LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $with_extra_cflags"
 514   LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $with_extra_cxxflags"
 515   LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $with_extra_ldflags"
 516 
 517   AC_SUBST(LEGACY_EXTRA_CFLAGS)
 518   AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
 519   AC_SUBST(LEGACY_EXTRA_LDFLAGS)
 520 
 521   ###############################################################################
 522   #
 523   # Now setup the CFLAGS and LDFLAGS for the JDK build.
 524   # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
 525   #
 526 
 527   # Setup compiler/platform specific flags into
 528   #    CFLAGS_JDK    - C Compiler flags
 529   #    CXXFLAGS_JDK  - C++ Compiler flags
 530   #    COMMON_CCXXFLAGS_JDK - common to C and C++
 531   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 532     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
 533         -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
 534     case $OPENJDK_TARGET_CPU_ARCH in
 535       arm )
 536         # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
 537         CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
 538         ;;
 539       ppc )
 540         # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
 541         CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
 542         ;;
 543       * )
 544         COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
 545         CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
 546         ;;
 547     esac
 548   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 549     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
 550     if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
 551       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
 552       CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
 553     fi
 554 
 555     CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
 556     CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
 557   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 558     CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
 559     CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
 560   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 561     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK \
 562         -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
 563         -DWIN32_LEAN_AND_MEAN \
 564         -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
 565         -DWIN32 -DIAL"
 566     if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
 567       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
 568     else
 569       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
 570     fi
 571     # If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
 572     # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual


 866   # ZERO_ARCHFLAG tells the compiler which mode to build for
 867   case "${OPENJDK_TARGET_CPU}" in
 868     s390)
 869       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
 870       ;;
 871     *)
 872       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
 873   esac
 874   FLAGS_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
 875   AC_SUBST(ZERO_ARCHFLAG)
 876 
 877   # Check that the compiler supports -mX (or -qX on AIX) flags
 878   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
 879   FLAGS_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
 880       [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
 881       [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
 882   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
 883 
 884   case "${TOOLCHAIN_TYPE}" in
 885     microsoft)

 886       CFLAGS_WARNINGS_ARE_ERRORS="-WX"
 887       ;;
 888     solstudio)

 889       CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
 890       ;;
 891     gcc)










 892       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 893       ;;
 894     clang)

 895       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 896       ;;
 897   esac

 898   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
 899 ])
   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


 461   AC_SUBST(C_O_FLAG_HIGHEST)
 462   AC_SUBST(C_O_FLAG_HI)
 463   AC_SUBST(C_O_FLAG_NORM)
 464   AC_SUBST(C_O_FLAG_DEBUG)
 465   AC_SUBST(C_O_FLAG_NONE)
 466   AC_SUBST(CXX_O_FLAG_HIGHEST)
 467   AC_SUBST(CXX_O_FLAG_HI)
 468   AC_SUBST(CXX_O_FLAG_NORM)
 469   AC_SUBST(CXX_O_FLAG_DEBUG)
 470   AC_SUBST(CXX_O_FLAG_NONE)
 471 ])
 472 
 473 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
 474 [
 475   # Special extras...
 476   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 477     if test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
 478       CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
 479       CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
 480     fi
 481     CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
 482     CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
 483   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 484     LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
 485     CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
 486     CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
 487   fi
 488 
 489   if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
 490     AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
 491   fi
 492 
 493   if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
 494     AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
 495   fi
 496 
 497   if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
 498     AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
 499   fi
 500 
 501   AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
 502       [extra flags to be used when compiling jdk c-files])])


 514   # Hotspot needs these set in their legacy form
 515   LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $with_extra_cflags"
 516   LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $with_extra_cxxflags"
 517   LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $with_extra_ldflags"
 518 
 519   AC_SUBST(LEGACY_EXTRA_CFLAGS)
 520   AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
 521   AC_SUBST(LEGACY_EXTRA_LDFLAGS)
 522 
 523   ###############################################################################
 524   #
 525   # Now setup the CFLAGS and LDFLAGS for the JDK build.
 526   # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
 527   #
 528 
 529   # Setup compiler/platform specific flags into
 530   #    CFLAGS_JDK    - C Compiler flags
 531   #    CXXFLAGS_JDK  - C++ Compiler flags
 532   #    COMMON_CCXXFLAGS_JDK - common to C and C++
 533   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 534     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
 535         -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
 536     case $OPENJDK_TARGET_CPU_ARCH in
 537       arm )
 538         # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
 539         CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
 540         ;;
 541       ppc )
 542         # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
 543         CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
 544         ;;
 545       * )
 546         COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
 547         CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
 548         ;;
 549     esac
 550   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 551     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
 552     if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
 553       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"

 554     fi
 555 
 556     CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
 557     CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
 558   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 559     CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
 560     CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
 561   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 562     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK \
 563         -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
 564         -DWIN32_LEAN_AND_MEAN \
 565         -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
 566         -DWIN32 -DIAL"
 567     if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
 568       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
 569     else
 570       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
 571     fi
 572     # If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
 573     # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual


 867   # ZERO_ARCHFLAG tells the compiler which mode to build for
 868   case "${OPENJDK_TARGET_CPU}" in
 869     s390)
 870       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
 871       ;;
 872     *)
 873       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
 874   esac
 875   FLAGS_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
 876   AC_SUBST(ZERO_ARCHFLAG)
 877 
 878   # Check that the compiler supports -mX (or -qX on AIX) flags
 879   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
 880   FLAGS_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
 881       [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
 882       [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
 883   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
 884 
 885   case "${TOOLCHAIN_TYPE}" in
 886     microsoft)
 887       DISABLE_WARNING_PREFIX="-wd"
 888       CFLAGS_WARNINGS_ARE_ERRORS="-WX"
 889       ;;
 890     solstudio)
 891       DISABLE_WARNING_PREFIX="-erroff="
 892       CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
 893       ;;
 894     gcc)
 895       # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
 896       FLAGS_COMPILER_CHECK_ARGUMENTS([-Wno-this-is-a-warning-that-do-not-exist],
 897           [GCC_CAN_DISABLE_WARNINGS=true],
 898           [GCC_CAN_DISABLE_WARNINGS=false]
 899       )
 900       if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
 901         DISABLE_WARNING_PREFIX="-Wno-"
 902       else
 903         DISABLE_WARNING_PREFIX=
 904       fi
 905       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 906       ;;
 907     clang)
 908       DISABLE_WARNING_PREFIX="-Wno-"
 909       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 910       ;;
 911   esac
 912   AC_SUBST(DISABLE_WARNING_PREFIX)
 913   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
 914 ])
< prev index next >