make/autoconf/flags-other.m4
branchihse-cflags-rewrite-branch
changeset 56124 b2b9dfdc39c8
parent 48854 345f41527dcc
child 56146 d019a80c41c0
equal deleted inserted replaced
56123:9794cd2de23a 56124:b2b9dfdc39c8
       
     1 #
       
     2 # Copyright (c) 2011, 2018, 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
       
    23 # questions.
       
    24 #
       
    25 
       
    26 ################################################################################
       
    27 #
       
    28 # Setup flags for other tools than C/C++ compiler
       
    29 #
       
    30 
       
    31 
       
    32 AC_DEFUN([FLAGS_SETUP_ARFLAGS],
       
    33 [
       
    34   # FIXME: figure out if we should select AR flags depending on OS or toolchain.
       
    35   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
       
    36     ARFLAGS="-r"
       
    37   elif test "x$OPENJDK_TARGET_OS" = xaix; then
       
    38     ARFLAGS="-X64"
       
    39   elif test "x$OPENJDK_TARGET_OS" = xwindows; then
       
    40     # lib.exe is used as AR to create static libraries.
       
    41     ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
       
    42   else
       
    43     ARFLAGS=""
       
    44   fi
       
    45   AC_SUBST(ARFLAGS)
       
    46 ])
       
    47 
       
    48 AC_DEFUN([FLAGS_SETUP_STRIPFLAGS],
       
    49 [
       
    50   ## Setup strip.
       
    51   # FIXME: should this really be per platform, or should it be per toolchain type?
       
    52   # strip is not provided by clang or solstudio; so guessing platform makes most sense.
       
    53   # FIXME: we should really only export STRIPFLAGS from here, not POST_STRIP_CMD.
       
    54   if test "x$OPENJDK_TARGET_OS" = xlinux; then
       
    55     STRIPFLAGS="-g"
       
    56   elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
       
    57     STRIPFLAGS="-x"
       
    58   elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
       
    59     STRIPFLAGS="-S"
       
    60   elif test "x$OPENJDK_TARGET_OS" = xaix; then
       
    61     STRIPFLAGS="-X32_64"
       
    62   fi
       
    63 
       
    64   AC_SUBST(STRIPFLAGS)
       
    65 ])
       
    66 
       
    67 AC_DEFUN([FLAGS_SETUP_RCFLAGS],
       
    68 [
       
    69   # On Windows, we need to set RC flags.
       
    70   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
       
    71     RC_FLAGS="-nologo -l0x409"
       
    72     JVM_RCFLAGS="-nologo"
       
    73     if test "x$DEBUG_LEVEL" = xrelease; then
       
    74       RC_FLAGS="$RC_FLAGS -DNDEBUG"
       
    75       JVM_RCFLAGS="$JVM_RCFLAGS -DNDEBUG"
       
    76     fi
       
    77 
       
    78     # The version variables used to create RC_FLAGS may be overridden
       
    79     # in a custom configure script, or possibly the command line.
       
    80     # Let those variables be expanded at make time in spec.gmk.
       
    81     # The \$ are escaped to the shell, and the $(...) variables
       
    82     # are evaluated by make.
       
    83     RC_FLAGS="$RC_FLAGS \
       
    84         -D\"JDK_VERSION_STRING=\$(VERSION_STRING)\" \
       
    85         -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
       
    86         -D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
       
    87         -D\"JDK_VER=\$(VERSION_NUMBER)\" \
       
    88         -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
       
    89         -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_FEATURE)\" \
       
    90         -D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
       
    91 
       
    92     JVM_RCFLAGS="$JVM_RCFLAGS \
       
    93         -D\"HS_BUILD_ID=\$(VERSION_STRING)\" \
       
    94         -D\"HS_COMPANY=\$(COMPANY_NAME)\" \
       
    95         -D\"JDK_DOTVER=\$(VERSION_NUMBER_FOUR_POSITIONS)\" \
       
    96         -D\"HS_COPYRIGHT=Copyright $COPYRIGHT_YEAR\" \
       
    97         -D\"HS_NAME=\$(PRODUCT_NAME) \$(VERSION_SHORT)\" \
       
    98         -D\"JDK_VER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\" \
       
    99         -D\"HS_FNAME=jvm.dll\" \
       
   100         -D\"HS_INTERNAL_NAME=jvm\""
       
   101   fi
       
   102   AC_SUBST(RC_FLAGS)
       
   103   AC_SUBST(JVM_RCFLAGS)
       
   104 ])
       
   105 
       
   106 AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
       
   107 [
       
   108   # COMPILER_TARGET_BITS_FLAG  : option for selecting 32- or 64-bit output
       
   109   # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
       
   110   # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
       
   111   #                              commands produced by the link step (currently AIX only)
       
   112   if test "x$TOOLCHAIN_TYPE" = xxlc; then
       
   113     COMPILER_TARGET_BITS_FLAG="-q"
       
   114     COMPILER_COMMAND_FILE_FLAG="-f"
       
   115     COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
       
   116   else
       
   117     COMPILER_TARGET_BITS_FLAG="-m"
       
   118     COMPILER_COMMAND_FILE_FLAG="@"
       
   119     COMPILER_BINDCMD_FILE_FLAG=""
       
   120 
       
   121     # The solstudio linker does not support @-files.
       
   122     if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
       
   123       COMPILER_COMMAND_FILE_FLAG=
       
   124     fi
       
   125 
       
   126     # Check if @file is supported by gcc
       
   127     if test "x$TOOLCHAIN_TYPE" = xgcc; then
       
   128       AC_MSG_CHECKING([if @file is supported by gcc])
       
   129       # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
       
   130       $ECHO "" "--version" > command.file
       
   131       if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
       
   132         AC_MSG_RESULT(yes)
       
   133         COMPILER_COMMAND_FILE_FLAG="@"
       
   134       else
       
   135         AC_MSG_RESULT(no)
       
   136         COMPILER_COMMAND_FILE_FLAG=
       
   137       fi
       
   138       $RM command.file
       
   139     fi
       
   140   fi
       
   141 
       
   142   AC_SUBST(COMPILER_TARGET_BITS_FLAG)
       
   143   AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
       
   144   AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
       
   145 
       
   146   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
       
   147     CC_OUT_OPTION=-Fo
       
   148     EXE_OUT_OPTION=-out:
       
   149     LD_OUT_OPTION=-out:
       
   150     AR_OUT_OPTION=-out:
       
   151   else
       
   152     # The option used to specify the target .o,.a or .so file.
       
   153     # When compiling, how to specify the to be created object file.
       
   154     CC_OUT_OPTION='-o$(SPACE)'
       
   155     # When linking, how to specify the to be created executable.
       
   156     EXE_OUT_OPTION='-o$(SPACE)'
       
   157     # When linking, how to specify the to be created dynamically linkable library.
       
   158     LD_OUT_OPTION='-o$(SPACE)'
       
   159     # When archiving, how to specify the to be create static archive for object files.
       
   160     AR_OUT_OPTION='rcs$(SPACE)'
       
   161   fi
       
   162   AC_SUBST(CC_OUT_OPTION)
       
   163   AC_SUBST(EXE_OUT_OPTION)
       
   164   AC_SUBST(LD_OUT_OPTION)
       
   165   AC_SUBST(AR_OUT_OPTION)
       
   166 
       
   167   # Generate make dependency files
       
   168   if test "x$TOOLCHAIN_TYPE" = xgcc; then
       
   169     C_FLAG_DEPS="-MMD -MF"
       
   170   elif test "x$TOOLCHAIN_TYPE" = xclang; then
       
   171     C_FLAG_DEPS="-MMD -MF"
       
   172   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
       
   173     C_FLAG_DEPS="-xMMD -xMF"
       
   174   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
       
   175     C_FLAG_DEPS="-qmakedep=gcc -MF"
       
   176   fi
       
   177   CXX_FLAG_DEPS="$C_FLAG_DEPS"
       
   178   AC_SUBST(C_FLAG_DEPS)
       
   179   AC_SUBST(CXX_FLAG_DEPS)
       
   180 ])
       
   181