common/autoconf/platform.m4

Fri, 07 Sep 2018 10:22:27 +0800

author
aoqi
date
Fri, 07 Sep 2018 10:22:27 +0800
changeset 2188
d75ef5fa5b02
parent 2164
d880fd7491af
child 2316
64a3eeabf6e5
permissions
-rw-r--r--

#7535 BUILDER_NAME supports Fedora 23-29

     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
    23 # questions.
    24 #
    26 #
    27 # This file has been modified by Loongson Technology in 2018. These
    28 # modifications are Copyright (c) 2018 Loongson Technology, and are made
    29 # available on the same license terms set forth above.
    30 #
    32 # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
    33 # Converts autoconf style CPU name to OpenJDK style, into
    34 # VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
    35 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
    36 [
    37   # First argument is the cpu name from the trip/quad
    38   case "$1" in
    39     x86_64)
    40       VAR_CPU=x86_64
    41       VAR_CPU_ARCH=x86
    42       VAR_CPU_BITS=64
    43       VAR_CPU_ENDIAN=little
    44       ;;
    45     i?86)
    46       VAR_CPU=x86
    47       VAR_CPU_ARCH=x86
    48       VAR_CPU_BITS=32
    49       VAR_CPU_ENDIAN=little
    50       ;;
    51     arm*)
    52       VAR_CPU=arm
    53       VAR_CPU_ARCH=arm
    54       VAR_CPU_BITS=32
    55       VAR_CPU_ENDIAN=little
    56       ;;
    57     aarch64)
    58       VAR_CPU=aarch64
    59       VAR_CPU_ARCH=aarch64
    60       VAR_CPU_BITS=64
    61       VAR_CPU_ENDIAN=little
    62       ;;
    63     powerpc)
    64       VAR_CPU=ppc
    65       VAR_CPU_ARCH=ppc
    66       VAR_CPU_BITS=32
    67       VAR_CPU_ENDIAN=big
    68       ;;
    69     powerpc64)
    70       VAR_CPU=ppc64
    71       VAR_CPU_ARCH=ppc
    72       VAR_CPU_BITS=64
    73       VAR_CPU_ENDIAN=big
    74       ;;
    75     powerpc64le)
    76       VAR_CPU=ppc64
    77       VAR_CPU_ARCH=ppc
    78       VAR_CPU_BITS=64
    79       VAR_CPU_ENDIAN=little
    80       ;;
    81     s390)
    82       VAR_CPU=s390
    83       VAR_CPU_ARCH=s390
    84       VAR_CPU_BITS=32
    85       VAR_CPU_ENDIAN=big
    86       ;;
    87     s390x)
    88       VAR_CPU=s390x
    89       VAR_CPU_ARCH=s390
    90       VAR_CPU_BITS=64
    91       VAR_CPU_ENDIAN=big
    92       ;;
    93     sparc)
    94       VAR_CPU=sparc
    95       VAR_CPU_ARCH=sparc
    96       VAR_CPU_BITS=32
    97       VAR_CPU_ENDIAN=big
    98       ;;
    99     sparcv9|sparc64)
   100       VAR_CPU=sparcv9
   101       VAR_CPU_ARCH=sparc
   102       VAR_CPU_BITS=64
   103       VAR_CPU_ENDIAN=big
   104       ;;
   105     mips64el)
   106       VAR_CPU=mips64
   107       VAR_CPU_ARCH=mips
   108       VAR_CPU_BITS=64
   109       VAR_CPU_ENDIAN=little
   110       ;;
   111     *)
   112       AC_MSG_ERROR([unsupported cpu $1])
   113       ;;
   114   esac
   115 ])
   117 # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
   118 # Converts autoconf style OS name to OpenJDK style, into
   119 # VAR_OS and VAR_OS_API.
   120 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
   121 [
   122   case "$1" in
   123     *linux*)
   124       VAR_OS=linux
   125       VAR_OS_API=posix
   126       VAR_OS_ENV=linux
   127       ;;
   128     *solaris*)
   129       VAR_OS=solaris
   130       VAR_OS_API=posix
   131       VAR_OS_ENV=solaris
   132       ;;
   133     *darwin*)
   134       VAR_OS=macosx
   135       VAR_OS_API=posix
   136       VAR_OS_ENV=macosx
   137       ;;
   138     *bsd*)
   139       VAR_OS=bsd
   140       VAR_OS_API=posix
   141       VAR_OS_ENV=bsd
   142       ;;
   143     *cygwin*)
   144       VAR_OS=windows
   145       VAR_OS_API=winapi
   146       VAR_OS_ENV=windows.cygwin
   147       ;;
   148     *mingw*)
   149       VAR_OS=windows
   150       VAR_OS_API=winapi
   151       VAR_OS_ENV=windows.msys
   152       ;;
   153     *aix*)
   154       VAR_OS=aix
   155       VAR_OS_API=posix
   156       VAR_OS_ENV=aix
   157       ;;
   158     *)
   159       AC_MSG_ERROR([unsupported operating system $1])
   160       ;;
   161   esac
   162 ])
   164 # Expects $host_os $host_cpu $build_os and $build_cpu
   165 # and $with_target_bits to have been setup!
   166 #
   167 # Translate the standard triplet(quadruplet) definition
   168 # of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
   169 # OPENJDK_BUILD_OS, etc.
   170 AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
   171 [
   172   # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
   173   # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
   174   # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
   175   # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.
   176   OPENJDK_TARGET_AUTOCONF_NAME="$host"
   177   OPENJDK_BUILD_AUTOCONF_NAME="$build"
   178   AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME)
   179   AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME)
   181   # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
   182   PLATFORM_EXTRACT_VARS_FROM_OS($build_os)
   183   PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
   184   # ..and setup our own variables. (Do this explicitely to facilitate searching)
   185   OPENJDK_BUILD_OS="$VAR_OS"
   186   OPENJDK_BUILD_OS_API="$VAR_OS_API"
   187   OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV"
   188   OPENJDK_BUILD_CPU="$VAR_CPU"
   189   OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
   190   OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
   191   OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
   192   AC_SUBST(OPENJDK_BUILD_OS)
   193   AC_SUBST(OPENJDK_BUILD_OS_API)
   194   AC_SUBST(OPENJDK_BUILD_CPU)
   195   AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
   196   AC_SUBST(OPENJDK_BUILD_CPU_BITS)
   197   AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
   199   AC_MSG_CHECKING([openjdk-build os-cpu])
   200   AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU])
   202   # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
   203   PLATFORM_EXTRACT_VARS_FROM_OS($host_os)
   204   PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
   205   # ... and setup our own variables. (Do this explicitely to facilitate searching)
   206   OPENJDK_TARGET_OS="$VAR_OS"
   207   OPENJDK_TARGET_OS_API="$VAR_OS_API"
   208   OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
   209   OPENJDK_TARGET_CPU="$VAR_CPU"
   210   OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
   211   OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
   212   OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
   213   AC_SUBST(OPENJDK_TARGET_OS)
   214   AC_SUBST(OPENJDK_TARGET_OS_API)
   215   AC_SUBST(OPENJDK_TARGET_CPU)
   216   AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
   217   AC_SUBST(OPENJDK_TARGET_CPU_BITS)
   218   AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN)
   220   AC_MSG_CHECKING([openjdk-target os-cpu])
   221   AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
   222 ])
   224 # Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
   225 # accordingly. Must be done after setting up build and target system, but before
   226 # doing anything else with these values.
   227 AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS],
   228 [
   229   AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
   230        [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
   232   # We have three types of compiles:
   233   # native  == normal compilation, target system == build system
   234   # cross   == traditional cross compilation, target system != build system; special toolchain needed
   235   # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines
   236   #
   237   if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then
   238     # We're doing a proper cross-compilation
   239     COMPILE_TYPE="cross"
   240   else
   241     COMPILE_TYPE="native"
   242   fi
   244   if test "x$with_target_bits" != x; then
   245     if test "x$COMPILE_TYPE" = "xcross"; then
   246       AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.])
   247     fi
   249     if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   250       # A reduced build is requested
   251       COMPILE_TYPE="reduced"
   252       OPENJDK_TARGET_CPU_BITS=32
   253       if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
   254         OPENJDK_TARGET_CPU=x86
   255       elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
   256         OPENJDK_TARGET_CPU=sparc
   257       else
   258         AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9])
   259       fi
   260     elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   261       AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.])
   262     elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then
   263       AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning])
   264     else
   265       AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
   266     fi
   267   fi
   268   AC_SUBST(COMPILE_TYPE)
   270   AC_MSG_CHECKING([compilation type])
   271   AC_MSG_RESULT([$COMPILE_TYPE])
   272 ])
   274 # Setup the legacy variables, for controlling the old makefiles.
   275 #
   276 AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
   277 [
   278   # Also store the legacy naming of the cpu.
   279   # Ie i586 and amd64 instead of x86 and x86_64
   280   OPENJDK_TARGET_CPU_LEGACY="$OPENJDK_TARGET_CPU"
   281   if test "x$OPENJDK_TARGET_CPU" = xx86; then
   282     OPENJDK_TARGET_CPU_LEGACY="i586"
   283   elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
   284     # On all platforms except MacOSX replace x86_64 with amd64.
   285     OPENJDK_TARGET_CPU_LEGACY="amd64"
   286   fi
   287   AC_SUBST(OPENJDK_TARGET_CPU_LEGACY)
   289   # And the second legacy naming of the cpu.
   290   # Ie i386 and amd64 instead of x86 and x86_64.
   291   OPENJDK_TARGET_CPU_LEGACY_LIB="$OPENJDK_TARGET_CPU"
   292   if test "x$OPENJDK_TARGET_CPU" = xx86; then
   293     OPENJDK_TARGET_CPU_LEGACY_LIB="i386"
   294   elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
   295     OPENJDK_TARGET_CPU_LEGACY_LIB="amd64"
   296   elif test "x$OPENJDK_TARGET_CPU" = xmips64 && test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
   297     OPENJDK_TARGET_CPU_LEGACY_LIB="mips64el"
   298   fi
   299   AC_SUBST(OPENJDK_TARGET_CPU_LEGACY_LIB)
   301   # This is the name of the cpu (but using i386 and amd64 instead of
   302   # x86 and x86_64, respectively), preceeded by a /, to be used when
   303   # locating libraries. On macosx, it's empty, though.
   304   OPENJDK_TARGET_CPU_LIBDIR="/$OPENJDK_TARGET_CPU_LEGACY_LIB"
   305   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   306     OPENJDK_TARGET_CPU_LIBDIR=""
   307   fi
   308   AC_SUBST(OPENJDK_TARGET_CPU_LIBDIR)
   310   # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
   311   # /amd64 or /sparcv9. This string is appended to some library paths, like this:
   312   # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so
   313   OPENJDK_TARGET_CPU_ISADIR=""
   314   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   315     if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
   316       OPENJDK_TARGET_CPU_ISADIR="/amd64"
   317     elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
   318       OPENJDK_TARGET_CPU_ISADIR="/sparcv9"
   319     fi
   320   fi
   321   AC_SUBST(OPENJDK_TARGET_CPU_ISADIR)
   323   # Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property
   324   OPENJDK_TARGET_CPU_OSARCH="$OPENJDK_TARGET_CPU"
   325   if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xx86; then
   326     # On linux only, we replace x86 with i386.
   327     OPENJDK_TARGET_CPU_OSARCH="i386"
   328   elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
   329     # On all platforms except macosx, we replace x86_64 with amd64.
   330     OPENJDK_TARGET_CPU_OSARCH="amd64"
   331   elif test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xmips64 && test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
   332     # Jin: to be exactly same with OpenJDK 6(mips64)
   333     # System.getProperty("os.arch"): mips64 -> mips64el
   334     OPENJDK_TARGET_CPU_OSARCH="mips64el"
   335   fi
   336   AC_SUBST(OPENJDK_TARGET_CPU_OSARCH)
   338   OPENJDK_TARGET_CPU_JLI="$OPENJDK_TARGET_CPU"
   339   if test "x$OPENJDK_TARGET_CPU" = xx86; then
   340     OPENJDK_TARGET_CPU_JLI="i386"
   341   elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
   342     # On all platforms except macosx, we replace x86_64 with amd64.
   343     OPENJDK_TARGET_CPU_JLI="amd64"
   344   elif test "x$OPENJDK_TARGET_CPU" = xmips64 && test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
   345     OPENJDK_TARGET_CPU_JLI="mips64el"
   346   fi
   347   # Now setup the -D flags for building libjli.
   348   OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'"
   349   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   350     if test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc; then
   351       OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'"
   352     elif test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
   353       OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
   354     fi
   355   fi
   356   if test "x$OPENJDK_TARGET_CPU" = xmips64 && test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
   357     OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"mips32el\"' -DLIBARCH64NAME='\"mips64el\"'"
   358   fi
   359   AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS)
   361   # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths.
   362   if test "x$OPENJDK_TARGET_OS_API" = xposix; then
   363     OPENJDK_TARGET_OS_API_DIR="solaris"
   364   fi
   365   if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then
   366     OPENJDK_TARGET_OS_API_DIR="windows"
   367   fi
   368   AC_SUBST(OPENJDK_TARGET_OS_API_DIR)
   370   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   371       OPENJDK_TARGET_OS_EXPORT_DIR=macosx
   372   else
   373       OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_API_DIR}
   374   fi
   375   AC_SUBST(OPENJDK_TARGET_OS_EXPORT_DIR)
   377   if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   378     A_LP64="LP64:="
   379     # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
   380     # unpack200.exe
   381     if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xmacosx; then
   382       ADD_LP64="-D_LP64=1"
   383     fi
   384   fi
   385   AC_SUBST(LP64,$A_LP64)
   387   if test "x$COMPILE_TYPE" = "xcross"; then
   388     # FIXME: ... or should this include reduced builds..?
   389     DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_TARGET_CPU_LEGACY"
   390   else
   391     DEFINE_CROSS_COMPILE_ARCH=""
   392   fi
   393   AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
   395   # ZERO_ARCHDEF is used to enable architecture-specific code
   396   case "${OPENJDK_TARGET_CPU}" in
   397     ppc)     ZERO_ARCHDEF=PPC32 ;;
   398     ppc64)   ZERO_ARCHDEF=PPC64 ;;
   399     s390*)   ZERO_ARCHDEF=S390  ;;
   400     sparc*)  ZERO_ARCHDEF=SPARC ;;
   401     x86_64*) ZERO_ARCHDEF=AMD64 ;;
   402     x86)     ZERO_ARCHDEF=IA32  ;;
   403     *)      ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z)
   404   esac
   405   AC_SUBST(ZERO_ARCHDEF)
   406 ])
   408 AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
   409 [
   410   if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   411     REQUIRED_OS_NAME=SunOS
   412     REQUIRED_OS_VERSION=5.10
   413   fi
   414   if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
   415     REQUIRED_OS_NAME=Linux
   416     REQUIRED_OS_VERSION=2.6
   417   fi
   418   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   419     REQUIRED_OS_NAME=Windows
   420     if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
   421       REQUIRED_OS_VERSION=5.2
   422     else
   423       REQUIRED_OS_VERSION=5.1
   424     fi
   425   fi
   426   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   427     REQUIRED_OS_NAME=Darwin
   428     REQUIRED_OS_VERSION=11.2
   429   fi
   431   AC_SUBST(REQUIRED_OS_NAME)
   432   AC_SUBST(REQUIRED_OS_VERSION)
   433 ])
   435 #%%% Build and target systems %%%
   436 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
   437 [
   438   # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
   439   # is confusing; it assumes you are cross-compiling a cross-compiler (!)  and "target" is thus the target of the
   440   # product you're building. The target of this build is called "host". Since this is confusing to most people, we
   441   # have not adopted that system, but use "target" as the platform we are building for. In some places though we need
   442   # to use the configure naming style.
   443   AC_CANONICAL_BUILD
   444   AC_CANONICAL_HOST
   445   AC_CANONICAL_TARGET
   447   PLATFORM_EXTRACT_TARGET_AND_BUILD
   448   PLATFORM_SETUP_TARGET_CPU_BITS
   449   PLATFORM_SET_RELEASE_FILE_OS_VALUES
   450   PLATFORM_SETUP_LEGACY_VARS
   451 ])
   453 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
   454 [
   455   ###############################################################################
   457   # Note that this is the build platform OS version!
   459   OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
   460   OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
   461   OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
   462   OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
   463   AC_SUBST(OS_VERSION_MAJOR)
   464   AC_SUBST(OS_VERSION_MINOR)
   465   AC_SUBST(OS_VERSION_MICRO)
   466 ])
   468 # Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS.
   469 # Add -mX to various FLAGS variables.
   470 AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
   471 [
   472   # When we add flags to the "official" CFLAGS etc, we need to
   473   # keep track of these additions in ADDED_CFLAGS etc. These
   474   # will later be checked to make sure only controlled additions
   475   # have been made to CFLAGS etc.
   476   ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
   477   ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
   478   ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
   480   CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
   481   CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
   482   LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
   484   CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
   485   CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
   486   LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
   487 ])
   489 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
   490 [
   491   ###############################################################################
   492   #
   493   # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
   494   # (The JVM can use 32 or 64 bit Java pointers but that decision
   495   # is made at runtime.)
   496   #
   498   if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
   499     # Always specify -m flag on Solaris
   500     # And -q on AIX because otherwise the compiler produces 32-bit objects by default
   501     PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
   502   elif test "x$COMPILE_TYPE" = xreduced; then
   503     if test "x$OPENJDK_TARGET_OS" != xwindows; then
   504       # Specify -m if running reduced on other Posix platforms
   505       PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
   506     fi
   507   fi
   509   # Make compilation sanity check
   510   AC_CHECK_HEADERS([stdio.h], , [
   511     AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
   512     if test "x$COMPILE_TYPE" = xreduced; then
   513       AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.])
   514     elif test "x$COMPILE_TYPE" = xcross; then
   515       AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
   516     fi
   517     AC_MSG_ERROR([Cannot continue.])
   518   ])
   520   AC_CHECK_SIZEOF([int *], [1111])
   522   # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
   523   if test "x$ac_cv_sizeof_int_p" = x; then
   524     # The test failed, lets stick to the assumed value.
   525     AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
   526   else
   527     TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
   529     if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
   530       # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects
   531       # Let's try to implicitely set the compilers target architecture and retry the test
   532       AC_MSG_NOTICE([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS).])
   533       AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}])
   534       PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
   536       # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value!
   537       unset ac_cv_sizeof_int_p
   538       # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF
   539       cat >>confdefs.h <<_ACEOF
   540 #undef SIZEOF_INT_P
   541 _ACEOF
   543       AC_CHECK_SIZEOF([int *], [1111])
   545       TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
   547       if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
   548         AC_MSG_ERROR([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
   549       fi
   550     fi
   551   fi
   553   AC_MSG_CHECKING([for target address size])
   554   AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])
   555 ])
   557 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
   558 [
   559   ###############################################################################
   560   #
   561   # Is the target little of big endian?
   562   #
   563   AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
   565   if test "x$ENDIAN" = xuniversal_endianness; then
   566     AC_MSG_ERROR([Building with both big and little endianness is not supported])
   567   fi
   568   if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
   569     AC_MSG_ERROR([The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)])
   570   fi
   571 ])
   573 AC_DEFUN([GET_BUILDER_AND_HOST_DATA],
   574 [
   575 BUILDER_NAME="$build_os"
   576 BUILDER_ID="Custom build ($(date))"
   577 if test -f /etc/issue; then
   578   etc_issue_info=`cat /etc/issue`
   579   if test -n "$etc_issue_info"; then
   580     BUILDER_NAME=`cat /etc/issue | head -n 1 | cut -d " " -f 1`
   581   fi
   582 fi
   583 if test -f /etc/redhat-release; then
   584   etc_issue_info=`cat /etc/redhat-release`
   585   if test -n "$etc_issue_info"; then
   586     BUILDER_NAME=`cat /etc/redhat-release | head -n 1 | cut -d " " -f 1`
   587   fi
   588 fi
   589 if test -f /etc/neokylin-release; then
   590   etc_issue_info=`cat /etc/neokylin-release`
   591   if test -n "$etc_issue_info"; then
   592     BUILDER_NAME=`cat /etc/neokylin-release | head -n 1 | cut -d " " -f 1`
   593   fi
   594 fi
   595 if test -z "$BUILDER_NAME"; then
   596   BUILDER_NAME="unknown"
   597 fi
   598 if test -n "$OPENJDK_TARGET_CPU_OSARCH"; then
   599   HOST_NAME="$OPENJDK_TARGET_CPU_OSARCH"
   600 else
   601   HOST_NAME="unknown"
   602 fi
   603 if test -f "/usr/bin/cpp"; then
   604   # gcc_with_arch_info=`gcc -v 2>&1 | grep '\-\-with-arch=' | sed 's/.*--with-arch=//;s/ .*$//'`
   605   gcc_with_arch_info=`cpp -dM /dev/null | grep '\<_MIPS_ARCH\>' | sed 's/^#define _MIPS_ARCH "//;s/"$//'`
   606   if test -n "$gcc_with_arch_info"; then
   607     HOST_NAME="$gcc_with_arch_info"
   608   fi
   609 fi
   610 AC_SUBST(BUILDER_ID)
   611 AC_SUBST(BUILDER_NAME)
   612 AC_SUBST(HOST_NAME)
   613 ])

mercurial