< prev index next >

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'


 372   fi
 373 
 374   if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
 375     AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
 376   fi
 377 
 378   AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
 379       [extra flags to be used when compiling jdk c-files])])
 380 
 381   AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
 382       [extra flags to be used when compiling jdk c++-files])])
 383 
 384   AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
 385       [extra flags to be used when linking jdk])])
 386 
 387   CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags"
 388   CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags"
 389   LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
 390 
 391   # Hotspot needs these set in their legacy form
 392   LEGACY_EXTRA_CFLAGS=$with_extra_cflags
 393   LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
 394   LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
 395 
 396   AC_SUBST(LEGACY_EXTRA_CFLAGS)
 397   AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
 398   AC_SUBST(LEGACY_EXTRA_LDFLAGS)
 399 
 400   ###############################################################################
 401   #
 402   # Now setup the CFLAGS and LDFLAGS for the JDK build.
 403   # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
 404   #
 405 
 406   # Setup compiler/platform specific flags to CFLAGS_JDK,
 407   # CXXFLAGS_JDK and CCXXFLAGS_JDK (common to C and CXX?)
 408   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 409     # these options are used for both C and C++ compiles
 410     CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
 411         -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
 412     case $OPENJDK_TARGET_CPU_ARCH in
 413       arm )
 414         # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing


 473 
 474   # Setup LP64
 475   CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 476 
 477   # Set some common defines. These works for all compilers, but assume
 478   # -D is universally accepted.
 479 
 480   # Setup endianness
 481   if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
 482     # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
 483     #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
 484     #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
 485     #   Note: -Dmacro         is the same as    #define macro 1
 486     #         -Dmacro=        is the same as    #define macro
 487     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 488       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
 489     else
 490       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
 491     fi
 492   else





 493     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"

 494   fi
 495   
 496   # Setup target OS define. Use OS target name but in upper case.
 497   OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 498   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
 499 
 500   # Setup target CPU
 501   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
 502   
 503   # Setup debug/release defines
 504   if test "x$DEBUG_LEVEL" = xrelease; then
 505     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
 506     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 507       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
 508     fi
 509   else
 510     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
 511   fi
 512 
 513   # 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'


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


 499 
 500   # Setup LP64
 501   CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 502 
 503   # Set some common defines. These works for all compilers, but assume
 504   # -D is universally accepted.
 505 
 506   # Setup endianness
 507   if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
 508     # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
 509     #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
 510     #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
 511     #   Note: -Dmacro         is the same as    #define macro 1
 512     #         -Dmacro=        is the same as    #define macro
 513     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 514       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
 515     else
 516       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
 517     fi
 518   else
 519     # Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they
 520     # are defined in the system?
 521     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 522       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN="
 523     else
 524       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
 525     fi
 526   fi
 527   
 528   # Setup target OS define. Use OS target name but in upper case.
 529   OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 530   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
 531 
 532   # Setup target CPU
 533   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
 534   
 535   # Setup debug/release defines
 536   if test "x$DEBUG_LEVEL" = xrelease; then
 537     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
 538     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 539       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
 540     fi
 541   else
 542     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
 543   fi
 544 
 545   # Setup release name


< prev index next >