common/autoconf/flags.m4

Print this page




 102     # The version variables used to create RC_FLAGS may be overridden
 103     # in a custom configure script, or possibly the command line.
 104     # Let those variables be expanded at make time in spec.gmk.
 105     # The \$ are escaped to the shell, and the $(...) variables
 106     # are evaluated by make.
 107     RC_FLAGS="$RC_FLAGS \
 108         -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \
 109         -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \
 110         -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
 111         -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
 112         -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
 113         -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
 114         -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
 115   fi
 116   AC_SUBST(RC_FLAGS)
 117 
 118   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 119     # FIXME: likely bug, should be CCXXFLAGS_JDK? or one for C or CXX.
 120     CCXXFLAGS="$CCXXFLAGS -nologo"
 121   fi


























 122 ])
 123 
 124 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
 125 [
 126   ###############################################################################
 127   #
 128   # How to compile shared libraries.
 129   #
 130 
 131   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 132     PICFLAG="-fPIC"
 133     C_FLAG_REORDER=''
 134     CXX_FLAG_REORDER=''
 135 
 136     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 137       # Linking is different on MacOSX
 138       SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
 139       SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
 140       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
 141       SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'


 404   fi
 405 
 406   if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
 407     AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
 408   fi
 409 
 410   AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
 411       [extra flags to be used when compiling jdk c-files])])
 412 
 413   AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
 414       [extra flags to be used when compiling jdk c++-files])])
 415 
 416   AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
 417       [extra flags to be used when linking jdk])])
 418 
 419   CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags"
 420   CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags"
 421   LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
 422 
 423   # Hotspot needs these set in their legacy form
 424   LEGACY_EXTRA_CFLAGS=$with_extra_cflags
 425   LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
 426   LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
 427 
 428   AC_SUBST(LEGACY_EXTRA_CFLAGS)
 429   AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
 430   AC_SUBST(LEGACY_EXTRA_LDFLAGS)
 431 
 432   ###############################################################################
 433   #
 434   # Now setup the CFLAGS and LDFLAGS for the JDK build.
 435   # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
 436   #
 437 
 438   # Setup compiler/platform specific flags to CFLAGS_JDK,
 439   # CXXFLAGS_JDK and CCXXFLAGS_JDK (common to C and CXX?)
 440   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 441     # these options are used for both C and C++ compiles
 442     CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
 443         -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
 444     case $OPENJDK_TARGET_CPU_ARCH in
 445       arm )
 446         # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing


 504 
 505   # Setup LP64
 506   CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 507 
 508   # Set some common defines. These works for all compilers, but assume
 509   # -D is universally accepted.
 510 
 511   # Setup endianness
 512   if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
 513     # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
 514     #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
 515     #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
 516     #   Note: -Dmacro         is the same as    #define macro 1
 517     #         -Dmacro=        is the same as    #define macro
 518     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 519       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
 520     else
 521       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
 522     fi
 523   else





 524     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"

 525   fi
 526   
 527   # Setup target OS define. Use OS target name but in upper case.
 528   OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 529   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
 530 
 531   # Setup target CPU
 532   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
 533   
 534   # Setup debug/release defines
 535   if test "x$DEBUG_LEVEL" = xrelease; then
 536     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
 537     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 538       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
 539     fi
 540   else
 541     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
 542   fi
 543 
 544   # Setup release name




 102     # The version variables used to create RC_FLAGS may be overridden
 103     # in a custom configure script, or possibly the command line.
 104     # Let those variables be expanded at make time in spec.gmk.
 105     # The \$ are escaped to the shell, and the $(...) variables
 106     # are evaluated by make.
 107     RC_FLAGS="$RC_FLAGS \
 108         -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \
 109         -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \
 110         -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
 111         -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
 112         -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
 113         -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
 114         -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
 115   fi
 116   AC_SUBST(RC_FLAGS)
 117 
 118   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 119     # FIXME: likely bug, should be CCXXFLAGS_JDK? or one for C or CXX.
 120     CCXXFLAGS="$CCXXFLAGS -nologo"
 121   fi
 122 
 123   if test "x$SYSROOT" != "x"; then
 124     if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 125       if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 126         # Solaris Studio does not have a concept of sysroot. Instead we must
 127         # make sure the default include and lib dirs are appended to each 
 128         # compile and link command line.
 129         SYSROOT_CFLAGS="-I$SYSROOT/usr/include"
 130         SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
 131             -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
 132             -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
 133       fi
 134     elif test "x$TOOLCHAIN_TYPE" = xgcc; then
 135       SYSROOT_CFLAGS="--sysroot=\"$SYSROOT\""
 136       SYSROOT_LDFLAGS="--sysroot=\"$SYSROOT\""
 137     elif test "x$TOOLCHAIN_TYPE" = xclang; then
 138       SYSROOT_CFLAGS="-isysroot \"$SYSROOT\""
 139       SYSROOT_LDFLAGS="-isysroot \"$SYSROOT\""
 140     fi
 141     # Propagate the sysroot args to hotspot
 142     LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $SYSROOT_CFLAGS"
 143     LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $SYSROOT_CFLAGS"
 144     LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS"
 145   fi
 146   AC_SUBST(SYSROOT_CFLAGS)
 147   AC_SUBST(SYSROOT_LDFLAGS)
 148 ])
 149 
 150 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
 151 [
 152   ###############################################################################
 153   #
 154   # How to compile shared libraries.
 155   #
 156 
 157   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 158     PICFLAG="-fPIC"
 159     C_FLAG_REORDER=''
 160     CXX_FLAG_REORDER=''
 161 
 162     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 163       # Linking is different on MacOSX
 164       SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
 165       SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
 166       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
 167       SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'


 430   fi
 431 
 432   if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
 433     AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
 434   fi
 435 
 436   AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
 437       [extra flags to be used when compiling jdk c-files])])
 438 
 439   AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
 440       [extra flags to be used when compiling jdk c++-files])])
 441 
 442   AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
 443       [extra flags to be used when linking jdk])])
 444 
 445   CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags"
 446   CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags"
 447   LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
 448 
 449   # Hotspot needs these set in their legacy form
 450   LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $with_extra_cflags"
 451   LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $with_extra_cxxflags"
 452   LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $with_extra_ldflags"
 453 
 454   AC_SUBST(LEGACY_EXTRA_CFLAGS)
 455   AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
 456   AC_SUBST(LEGACY_EXTRA_LDFLAGS)
 457 
 458   ###############################################################################
 459   #
 460   # Now setup the CFLAGS and LDFLAGS for the JDK build.
 461   # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
 462   #
 463 
 464   # Setup compiler/platform specific flags to CFLAGS_JDK,
 465   # CXXFLAGS_JDK and CCXXFLAGS_JDK (common to C and CXX?)
 466   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 467     # these options are used for both C and C++ compiles
 468     CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
 469         -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
 470     case $OPENJDK_TARGET_CPU_ARCH in
 471       arm )
 472         # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing


 530 
 531   # Setup LP64
 532   CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 533 
 534   # Set some common defines. These works for all compilers, but assume
 535   # -D is universally accepted.
 536 
 537   # Setup endianness
 538   if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
 539     # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
 540     #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
 541     #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
 542     #   Note: -Dmacro         is the same as    #define macro 1
 543     #         -Dmacro=        is the same as    #define macro
 544     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 545       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
 546     else
 547       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
 548     fi
 549   else
 550     # Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they
 551     # are defined in the system?
 552     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 553       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN="
 554     else
 555       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
 556     fi
 557   fi
 558   
 559   # Setup target OS define. Use OS target name but in upper case.
 560   OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 561   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
 562 
 563   # Setup target CPU
 564   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
 565   
 566   # Setup debug/release defines
 567   if test "x$DEBUG_LEVEL" = xrelease; then
 568     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
 569     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 570       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
 571     fi
 572   else
 573     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
 574   fi
 575 
 576   # Setup release name