common/autoconf/toolchain.m4

Mon, 16 Oct 2017 15:57:35 +0800

author
aoqi
date
Mon, 16 Oct 2017 15:57:35 +0800
changeset 1482
8fb429038513
parent 1404
17e06bbf496e
parent 1133
50aaf272884f
child 2003
2224002fc647
permissions
-rw-r--r--

merge

     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 # $1 = compiler to test (CC or CXX)
    27 # $2 = human readable name of compiler (C or C++)
    28 AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
    29 [
    30   COMPILER=[$]$1
    31   COMPILER_NAME=$2
    33   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
    34     # Make sure we use the Sun Studio compiler and not gcc on Solaris, which won't work
    35     COMPILER_VERSION_TEST=`$COMPILER -V 2>&1 | $HEAD -n 1`
    36     $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
    37     if test $? -ne 0; then
    38       GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
    40       AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.])
    41       AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"])
    42       AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.])
    43     else
    44       COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/p"`
    45       COMPILER_VENDOR="Sun Studio"
    46     fi
    47   elif test  "x$OPENJDK_TARGET_OS" = xaix; then
    48       COMPILER_VERSION_TEST=`$COMPILER -qversion  2>&1 | $TAIL -n 1`
    49       $ECHO $COMPILER_VERSION_TEST | $GREP "^Version: " > /dev/null
    50       if test $? -ne 0; then
    51         AC_MSG_ERROR([Failed to detect the compiler version of $COMPILER ....])
    52       else
    53         COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n 's/Version: \([0-9][0-9]\.[0-9][0-9]*\).*/\1/p'`
    54         COMPILER_VENDOR='IBM'
    55       fi
    56   elif test  "x$OPENJDK_TARGET_OS" = xwindows; then
    57     # First line typically looks something like:
    58     # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
    59     COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
    60     COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \(@<:@1-9@:>@@<:@0-9.@:>@*\) .*/\1/p"`
    61     COMPILER_VENDOR="Microsoft CL.EXE"
    62     COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"`
    63     if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
    64       if test "x$COMPILER_CPU_TEST" != "x80x86"; then
    65         AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".])
    66       fi
    67     elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
    68       if test "x$COMPILER_CPU_TEST" != "xx64"; then
    69         AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
    70       fi
    71     fi
    72   else
    73     COMPILER_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
    74     # Check that this is likely to be GCC.
    75     $COMPILER --version 2>&1 | $GREP "Free Software Foundation" > /dev/null
    76     if test $? -ne 0; then
    77       AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required GCC compiler.])
    78       AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_TEST"])
    79       AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.])
    80     fi
    82     # First line typically looks something like:
    83     # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
    84     COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"`
    85     COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"`
    86   fi
    87   # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker)
    88   $1_VERSION="$COMPILER_VERSION"
    89   # This sets CC_VENDOR or CXX_VENDOR. (This comment is a grep marker)
    90   $1_VENDOR="$COMPILER_VENDOR"
    92   AC_MSG_NOTICE([Using $COMPILER_VENDOR $COMPILER_NAME compiler version $COMPILER_VERSION (located at $COMPILER)])
    93 ])
    96 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS],
    97 [
    98   ###############################################################################
    99   #
   100   # Configure the development tool paths and potential sysroot.
   101   #
   102   AC_LANG(C++)
   104   # The option used to specify the target .o,.a or .so file.
   105   # When compiling, how to specify the to be created object file.
   106   CC_OUT_OPTION='-o$(SPACE)'
   107   # When linking, how to specify the to be created executable.
   108   EXE_OUT_OPTION='-o$(SPACE)'
   109   # When linking, how to specify the to be created dynamically linkable library.
   110   LD_OUT_OPTION='-o$(SPACE)'
   111   # When archiving, how to specify the to be create static archive for object files.
   112   AR_OUT_OPTION='rcs$(SPACE)'
   113   AC_SUBST(CC_OUT_OPTION)
   114   AC_SUBST(EXE_OUT_OPTION)
   115   AC_SUBST(LD_OUT_OPTION)
   116   AC_SUBST(AR_OUT_OPTION)
   117 ])
   119 # $1 = compiler to test (CC or CXX)
   120 # $2 = human readable name of compiler (C or C++)
   121 # $3 = list of compiler names to search for
   122 AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
   123 [
   124   COMPILER_NAME=$2
   126   $1=
   127   # If TOOLS_DIR is set, check for all compiler names in there first
   128   # before checking the rest of the PATH.
   129   if test -n "$TOOLS_DIR"; then
   130     PATH_save="$PATH"
   131     PATH="$TOOLS_DIR"
   132     AC_PATH_PROGS(TOOLS_DIR_$1, $3)
   133     $1=$TOOLS_DIR_$1
   134     PATH="$PATH_save"
   135   fi
   137   # AC_PATH_PROGS can't be run multiple times with the same variable,
   138   # so create a new name for this run.
   139   if test "x[$]$1" = x; then
   140     AC_PATH_PROGS(POTENTIAL_$1, $3)
   141     $1=$POTENTIAL_$1
   142   fi
   144   if test "x[$]$1" = x; then
   145     HELP_MSG_MISSING_DEPENDENCY([devkit])
   146     AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
   147   fi
   148   BASIC_FIXUP_EXECUTABLE($1)
   149   TEST_COMPILER="[$]$1"
   150   # Don't remove symbolic links on AIX because 'xlc_r' and 'xlC_r' may all be links
   151   # to 'xlc' but it is crucial that we invoke the compiler with the right name!
   152   if test "x$OPENJDK_BUILD_OS" != xaix; then
   153     AC_MSG_CHECKING([resolved symbolic links for $1])
   154     BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
   155     AC_MSG_RESULT([$TEST_COMPILER])
   156   fi
   157   AC_MSG_CHECKING([if $1 is disguised ccache])
   159   COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
   160   if test "x$COMPILER_BASENAME" = "xccache"; then
   161     AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
   162     # We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
   163     # We want to control ccache invocation ourselves, so ignore this cc and try
   164     # searching again.
   166     # Remove the path to the fake ccache cc from the PATH
   167     RETRY_COMPILER_SAVED_PATH="$PATH"
   168     COMPILER_DIRNAME=`$DIRNAME [$]$1`
   169     PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
   171     # Try again looking for our compiler
   172     AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
   173     BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
   174     PATH="$RETRY_COMPILER_SAVED_PATH"
   176     AC_MSG_CHECKING([for resolved symbolic links for $1])
   177     BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
   178     AC_MSG_RESULT([$PROPER_COMPILER_$1])
   179     $1="$PROPER_COMPILER_$1"
   180   else
   181     AC_MSG_RESULT([no, keeping $1])
   182     $1="$TEST_COMPILER"
   183   fi
   184   TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
   185 ])
   188 AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
   189 [
   190   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   191     TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
   192     TOOLCHAIN_SETUP_MSVCR_DLL
   193     BASIC_DEPRECATED_ARG_WITH([dxsdk])
   194     BASIC_DEPRECATED_ARG_WITH([dxsdk-lib])
   195     BASIC_DEPRECATED_ARG_WITH([dxsdk-include])
   196   fi
   198   AC_SUBST(MSVCR_DLL)
   200   # If --build AND --host is set, then the configure script will find any
   201   # cross compilation tools in the PATH. Cross compilation tools
   202   # follows the cross compilation standard where they are prefixed with ${host}.
   203   # For example the binary i686-sun-solaris2.10-gcc
   204   # will cross compile for i686-sun-solaris2.10
   205   # If neither of build and host is not set, then build=host and the
   206   # default compiler found in the path will be used.
   207   # Setting only --host, does not seem to be really supported.
   208   # Please set both --build and --host if you want to cross compile.
   210   if test "x$COMPILE_TYPE" = "xcross"; then
   211     # Now we to find a C/C++ compiler that can build executables for the build
   212     # platform. We can't use the AC_PROG_CC macro, since it can only be used
   213     # once. Also, we need to do this before adding a tools dir to the path,
   214     # otherwise we might pick up cross-compilers which don't use standard naming.
   215     # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
   216     # to wait until they are properly discovered.
   217     AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
   218     BASIC_FIXUP_EXECUTABLE(BUILD_CC)
   219     AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
   220     BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
   221     AC_PATH_PROG(BUILD_LD, ld)
   222     BASIC_FIXUP_EXECUTABLE(BUILD_LD)
   223   fi
   224   AC_SUBST(BUILD_CC)
   225   AC_SUBST(BUILD_CXX)
   226   AC_SUBST(BUILD_LD)
   228   # If a devkit is found on the builddeps server, then prepend its path to the
   229   # PATH variable. If there are cross compilers available in the devkit, these
   230   # will be found by AC_PROG_CC et al.
   231   DEVKIT=
   232   BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
   233       [
   234         # Found devkit
   235         PATH="$DEVKIT/bin:$PATH"
   236         SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root"
   237         if test "x$x_includes" = "xNONE"; then
   238           x_includes="$SYS_ROOT/usr/include/X11"
   239         fi
   240         if test "x$x_libraries" = "xNONE"; then
   241           x_libraries="$SYS_ROOT/usr/lib"
   242         fi
   243       ],
   244       [])
   246   # Store the CFLAGS etal passed to the configure script.
   247   ORG_CFLAGS="$CFLAGS"
   248   ORG_CXXFLAGS="$CXXFLAGS"
   249   ORG_OBJCFLAGS="$OBJCFLAGS"
   251   # autoconf magic only relies on PATH, so update it if tools dir is specified
   252   OLD_PATH="$PATH"
   253   if test "x$TOOLS_DIR" != x; then
   254     PATH=$TOOLS_DIR:$PATH
   255   fi
   257   # Before we locate the compilers, we need to sanitize the Xcode build environment
   258   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   259     # determine path to Xcode developer directory
   260     # can be empty in which case all the tools will rely on a sane Xcode 4 installation
   261     SET_DEVELOPER_DIR=
   263     if test -n "$XCODE_PATH"; then
   264       DEVELOPER_DIR="$XCODE_PATH"/Contents/Developer
   265     fi
   267     # DEVELOPER_DIR could also be provided directly
   268     AC_MSG_CHECKING([Determining if we need to set DEVELOPER_DIR])
   269     if test -n "$DEVELOPER_DIR"; then
   270       if test ! -d "$DEVELOPER_DIR"; then
   271         AC_MSG_ERROR([Xcode Developer path does not exist: $DEVELOPER_DIR, please provide a path to the Xcode 4 application bundle using --with-xcode-path])
   272       fi
   273       if test ! -f "$DEVELOPER_DIR"/usr/bin/xcodebuild; then
   274         AC_MSG_ERROR([Xcode Developer path is not valid: $DEVELOPER_DIR, it must point to Contents/Developer inside an Xcode application bundle])
   275       fi
   276       # make it visible to all the tools immediately
   277       export DEVELOPER_DIR
   278       SET_DEVELOPER_DIR="export DEVELOPER_DIR := $DEVELOPER_DIR"
   279       AC_MSG_RESULT([yes ($DEVELOPER_DIR)])
   280     else
   281       AC_MSG_RESULT([no])
   282     fi
   283     AC_SUBST(SET_DEVELOPER_DIR)
   285     AC_PATH_PROG(XCODEBUILD, xcodebuild)
   286     if test -z "$XCODEBUILD"; then
   287       AC_MSG_ERROR([The xcodebuild tool was not found, the Xcode command line tools are required to build on Mac OS X])
   288     fi
   290     # Fail-fast: verify we're building on Xcode 4, we cannot build with Xcode 5 or later
   291     XCODE_VERSION=`$XCODEBUILD -version | grep '^Xcode ' | sed 's/Xcode //'`
   292     XC_VERSION_PARTS=( ${XCODE_VERSION//./ } )
   293     if test ! "${XC_VERSION_PARTS[[0]]}" = "4"; then
   294       AC_MSG_ERROR([Xcode 4 is required to build JDK 8, the version found was $XCODE_VERSION. Use --with-xcode-path to specify the location of Xcode 4 or make Xcode 4 active by using xcode-select.])
   295     fi
   297     # Some versions of Xcode 5 command line tools install gcc and g++ as symlinks to
   298     # clang and clang++, which will break the build. So handle that here if we need to.
   299     if test -L "/usr/bin/gcc" -o -L "/usr/bin/g++"; then
   300       # use xcrun to find the real gcc and add it's directory to PATH
   301       # then autoconf magic will find it
   302       AC_MSG_NOTICE([Found gcc symlinks to clang in /usr/bin, adding path to real gcc to PATH])
   303       XCODE_BIN_PATH=$(dirname `xcrun -find gcc`)
   304       PATH="$XCODE_BIN_PATH":$PATH
   305     fi
   307     # Determine appropriate SDKPATH, don't use SDKROOT as it interferes with the stub tools
   308     AC_MSG_CHECKING([Determining Xcode SDK path])
   309     # allow SDKNAME to be set to override the default SDK selection
   310     SDKPATH=`"$XCODEBUILD" -sdk ${SDKNAME:-macosx} -version | grep '^Path: ' | sed 's/Path: //'`
   311     if test -n "$SDKPATH"; then
   312       AC_MSG_RESULT([$SDKPATH])
   313     else
   314       AC_MSG_RESULT([(none, will use system headers and frameworks)])
   315     fi
   316     AC_SUBST(SDKPATH)
   318     # Perform a basic sanity test
   319     if test ! -f "$SDKPATH/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
   320       AC_MSG_ERROR([Unable to find required framework headers, provide a valid path to Xcode 4 using --with-xcode-path])
   321     fi
   323     # if SDKPATH is non-empty then we need to add -isysroot and -iframework for gcc and g++
   324     if test -n "$SDKPATH"; then
   325       # We need -isysroot <path> and -iframework<path>/System/Library/Frameworks
   326       CFLAGS_JDK="${CFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\""
   327       CXXFLAGS_JDK="${CXXFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\""
   328       LDFLAGS_JDK="${LDFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\""
   329     fi
   331     # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
   332     # setting this here means it doesn't have to be peppered throughout the forest
   333     CFLAGS_JDK="$CFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\""
   334     CXXFLAGS_JDK="$CXXFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\""
   335     LDFLAGS_JDK="$LDFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\""
   336   fi
   338   ### Locate C compiler (CC)
   340   # On windows, only cl.exe is supported.
   341   # On Solaris, cc is preferred to gcc.
   342   # Elsewhere, gcc is preferred to cc.
   344   if test "x$CC" != x; then
   345     COMPILER_CHECK_LIST="$CC"
   346   elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   347     COMPILER_CHECK_LIST="cl"
   348   elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   349     COMPILER_CHECK_LIST="cc gcc"
   350   elif test "x$OPENJDK_TARGET_OS" = "xaix"; then
   351     # Do not probe for cc on AIX.
   352     COMPILER_CHECK_LIST="xlc_r"
   353   else
   354     COMPILER_CHECK_LIST="gcc cc"
   355   fi
   357   TOOLCHAIN_FIND_COMPILER([CC],[C],[$COMPILER_CHECK_LIST])
   358   # Now that we have resolved CC ourself, let autoconf have its go at it
   359   AC_PROG_CC([$CC])
   361   # Option used to tell the compiler whether to create 32- or 64-bit executables
   362   # Notice that CC contains the full compiler path at this point.
   363   case $CC in
   364     *xlc_r) COMPILER_TARGET_BITS_FLAG="-q";;
   365     *)      COMPILER_TARGET_BITS_FLAG="-m";;
   366   esac
   367   AC_SUBST(COMPILER_TARGET_BITS_FLAG)
   369   ### Locate C++ compiler (CXX)
   371   if test "x$CXX" != x; then
   372     COMPILER_CHECK_LIST="$CXX"
   373   elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   374     COMPILER_CHECK_LIST="cl"
   375   elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   376     COMPILER_CHECK_LIST="CC g++"
   377   elif test "x$OPENJDK_TARGET_OS" = "xaix"; then
   378     # Do not probe for CC on AIX .
   379     COMPILER_CHECK_LIST="xlC_r"
   380   else
   381     COMPILER_CHECK_LIST="g++ CC"
   382   fi
   384   TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST])
   385   # Now that we have resolved CXX ourself, let autoconf have its go at it
   386   AC_PROG_CXX([$CXX])
   388   ### Locate other tools
   390   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   391     AC_PROG_OBJC
   392     BASIC_FIXUP_EXECUTABLE(OBJC)
   393   else
   394     OBJC=
   395   fi
   397   # Restore the flags to the user specified values.
   398   # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
   399   CFLAGS="$ORG_CFLAGS"
   400   CXXFLAGS="$ORG_CXXFLAGS"
   401   OBJCFLAGS="$ORG_OBJCFLAGS"
   403   LD="$CC"
   404   LDEXE="$CC"
   405   LDCXX="$CXX"
   406   LDEXECXX="$CXX"
   407   AC_SUBST(LD)
   408   # LDEXE is the linker to use, when creating executables.
   409   AC_SUBST(LDEXE)
   410   # Linking C++ libraries.
   411   AC_SUBST(LDCXX)
   412   # Linking C++ executables.
   413   AC_SUBST(LDEXECXX)
   415   if test "x$OPENJDK_TARGET_OS" != xwindows; then
   416     AC_CHECK_TOOL(AR, ar)
   417     BASIC_FIXUP_EXECUTABLE(AR)
   418   fi
   419   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   420     ARFLAGS="-r"
   421   elif test "x$OPENJDK_TARGET_OS" = xaix; then
   422     ARFLAGS="-X64"
   423   else
   424     ARFLAGS=""
   425   fi
   426   AC_SUBST(ARFLAGS)
   428   # For hotspot, we need these in Windows mixed path; other platforms keep them the same
   429   HOTSPOT_CXX="$CXX"
   430   HOTSPOT_LD="$LD"
   431   AC_SUBST(HOTSPOT_CXX)
   432   AC_SUBST(HOTSPOT_LD)
   434   COMPILER_NAME=gcc
   435   COMPILER_TYPE=CC
   436   AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
   437     # For now, assume that we are always compiling using cl.exe.
   438     CC_OUT_OPTION=-Fo
   439     EXE_OUT_OPTION=-out:
   440     LD_OUT_OPTION=-out:
   441     AR_OUT_OPTION=-out:
   442     # On Windows, reject /usr/bin/link (as determined in CYGWIN_LINK), which is a cygwin
   443     # program for something completely different.
   444     AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK])
   445     # Since we must ignore the first found link, WINLD will contain
   446     # the full path to the link.exe program.
   447     BASIC_FIXUP_EXECUTABLE(WINLD)
   448     printf "Windows linker was found at $WINLD\n"
   449     AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
   450     "$WINLD" --version > /dev/null
   451     if test $? -eq 0 ; then
   452       AC_MSG_RESULT([no])
   453       AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.])
   454     else
   455       AC_MSG_RESULT([yes])
   456     fi
   457     LD="$WINLD"
   458     LDEXE="$WINLD"
   459     LDCXX="$WINLD"
   460     LDEXECXX="$WINLD"
   462     AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
   463     BASIC_FIXUP_EXECUTABLE(MT)
   464     # The resource compiler
   465     AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
   466     BASIC_FIXUP_EXECUTABLE(RC)
   468     # For hotspot, we need these in Windows mixed path,
   469     # so rewrite them all. Need added .exe suffix.
   470     HOTSPOT_CXX="$CXX.exe"
   471     HOTSPOT_LD="$LD.exe"
   472     HOTSPOT_MT="$MT.exe"
   473     HOTSPOT_RC="$RC.exe"
   474     BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX)
   475     BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD)
   476     BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT)
   477     BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC)
   478     AC_SUBST(HOTSPOT_MT)
   479     AC_SUBST(HOTSPOT_RC)
   481     RC_FLAGS="-nologo -l 0x409 -r"
   482     AS_IF([test "x$VARIANT" = xOPT], [
   483     RC_FLAGS="$RC_FLAGS -d NDEBUG"
   484   ])
   486   # The version variables used to create RC_FLAGS may be overridden
   487   # in a custom configure script, or possibly the command line.
   488   # Let those variables be expanded at make time in spec.gmk.
   489   # The \$ are escaped to the shell, and the $(...) variables
   490   # are evaluated by make.
   491   RC_FLAGS="$RC_FLAGS \
   492       -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \
   493       -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \
   494       -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
   495       -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(COOKED_JDK_UPDATE_VERSION).\$(COOKED_BUILD_NUMBER)\" \
   496       -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
   497       -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
   498       -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(COOKED_JDK_UPDATE_VERSION),\$(COOKED_BUILD_NUMBER)\""
   500   # lib.exe is used to create static libraries.
   501   AC_CHECK_PROG([WINAR], [lib],[lib],,,)
   502   BASIC_FIXUP_EXECUTABLE(WINAR)
   503   AR="$WINAR"
   504   ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
   506   AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
   507       BASIC_FIXUP_EXECUTABLE(DUMPBIN)
   509       COMPILER_TYPE=CL
   510       CCXXFLAGS="$CCXXFLAGS -nologo"
   511   ])
   512   AC_SUBST(RC_FLAGS)
   513   AC_SUBST(COMPILER_TYPE)
   515   AC_PROG_CPP
   516   BASIC_FIXUP_EXECUTABLE(CPP)
   518   AC_PROG_CXXCPP
   519   BASIC_FIXUP_EXECUTABLE(CXXCPP)
   521   if test "x$COMPILE_TYPE" != "xcross"; then
   522     # If we are not cross compiling, use the same compilers for
   523     # building the build platform executables. The cross-compilation
   524     # case needed to be done earlier, but this can only be done after
   525     # the native tools have been localized.
   526     BUILD_CC="$CC"
   527     BUILD_CXX="$CXX"
   528     BUILD_LD="$LD"
   529   fi
   531   # for solaris we really need solaris tools, and not gnu equivalent
   532   #   these seems to normally reside in /usr/ccs/bin so add that to path before
   533   #   starting to probe
   534   #
   535   #   NOTE: I add this /usr/ccs/bin after TOOLS but before OLD_PATH
   536   #         so that it can be overriden --with-tools-dir
   537   if test "x$OPENJDK_BUILD_OS" = xsolaris; then
   538     PATH="${TOOLS_DIR}:/usr/ccs/bin:${OLD_PATH}"
   539   fi
   541   # Find the right assembler.
   542   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   543     AC_PATH_PROG(AS, as)
   544     BASIC_FIXUP_EXECUTABLE(AS)
   545   else
   546     AS="$CC -c"
   547   fi
   548   AC_SUBST(AS)
   550   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   551     AC_PATH_PROG(NM, nm)
   552     BASIC_FIXUP_EXECUTABLE(NM)
   553     AC_PATH_PROG(GNM, gnm)
   554     BASIC_FIXUP_EXECUTABLE(GNM)
   555     AC_PATH_PROG(STRIP, strip)
   556     BASIC_FIXUP_EXECUTABLE(STRIP)
   557     AC_PATH_PROG(MCS, mcs)
   558     BASIC_FIXUP_EXECUTABLE(MCS)
   559   elif test "x$OPENJDK_TARGET_OS" != xwindows; then
   560     AC_PATH_PROG(OTOOL, otool)
   561     if test "x$OTOOL" = "x"; then
   562       OTOOL="true"
   563     fi
   564     AC_CHECK_TOOL(NM, nm)
   565     BASIC_FIXUP_EXECUTABLE(NM)
   566     GNM="$NM"
   567     AC_SUBST(GNM)
   568     AC_CHECK_TOOL(STRIP, strip)
   569     BASIC_FIXUP_EXECUTABLE(STRIP)
   570   fi
   572   # objcopy is used for moving debug symbols to separate files when
   573   # full debug symbols are enabled.
   574   if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
   575     AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
   576     # Only call fixup if objcopy was found.
   577     if test -n "$OBJCOPY"; then
   578       BASIC_FIXUP_EXECUTABLE(OBJCOPY)
   579     fi
   580   fi
   582   AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
   583   if test "x$OBJDUMP" != x; then
   584     # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
   585     BASIC_FIXUP_EXECUTABLE(OBJDUMP)
   586   fi
   588   TOOLCHAIN_SETUP_JTREG
   590   # Restore old path without tools dir
   591   PATH="$OLD_PATH"
   592 ])
   595 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS],
   596 [
   598   ###############################################################################
   599   #
   600   # How to compile shared libraries.
   601   #
   603   if test "x$GCC" = xyes; then
   604     COMPILER_NAME=gcc
   605     PICFLAG="-fPIC"
   606     LIBRARY_PREFIX=lib
   607     SHARED_LIBRARY='lib[$]1.so'
   608     STATIC_LIBRARY='lib[$]1.a'
   609     SHARED_LIBRARY_FLAGS="-shared"
   610     SHARED_LIBRARY_SUFFIX='.so'
   611     STATIC_LIBRARY_SUFFIX='.a'
   612     OBJ_SUFFIX='.o'
   613     EXE_SUFFIX=''
   614     SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1'
   615     SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1'
   616     C_FLAG_REORDER=''
   617     CXX_FLAG_REORDER=''
   618     SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
   619     SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
   620     LD="$CC"
   621     LDEXE="$CC"
   622     LDCXX="$CXX"
   623     LDEXECXX="$CXX"
   624     POST_STRIP_CMD="$STRIP -g"
   626     # Linking is different on MacOSX
   627     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   628       # Might change in the future to clang.
   629       COMPILER_NAME=gcc
   630       SHARED_LIBRARY='lib[$]1.dylib'
   631       SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
   632       SHARED_LIBRARY_SUFFIX='.dylib'
   633       EXE_SUFFIX=''
   634       SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'
   635       SET_SHARED_LIBRARY_MAPFILE=''
   636       SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
   637       SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
   638       POST_STRIP_CMD="$STRIP -S"
   639     fi
   640   else
   641     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   642       # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler
   643       COMPILER_NAME=ossc
   644       PICFLAG="-KPIC"
   645       LIBRARY_PREFIX=lib
   646       SHARED_LIBRARY='lib[$]1.so'
   647       STATIC_LIBRARY='lib[$]1.a'
   648       SHARED_LIBRARY_FLAGS="-G"
   649       SHARED_LIBRARY_SUFFIX='.so'
   650       STATIC_LIBRARY_SUFFIX='.a'
   651       OBJ_SUFFIX='.o'
   652       EXE_SUFFIX=''
   653       SET_SHARED_LIBRARY_NAME=''
   654       SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
   655       C_FLAG_REORDER='-xF'
   656       CXX_FLAG_REORDER='-xF'
   657       SET_SHARED_LIBRARY_ORIGIN='-R\$$$$ORIGIN[$]1'
   658       SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
   659       CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
   660       CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
   661       CFLAGS_JDKLIB_EXTRA='-xstrconst'
   662       POST_STRIP_CMD="$STRIP -x"
   663       POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
   664     fi
   665     if test "x$OPENJDK_TARGET_OS" = xaix; then
   666         COMPILER_NAME=xlc
   667         PICFLAG="-qpic=large"
   668         LIBRARY_PREFIX=lib
   669         SHARED_LIBRARY='lib[$]1.so'
   670         STATIC_LIBRARY='lib[$]1.a'
   671         SHARED_LIBRARY_FLAGS="-qmkshrobj"
   672         SHARED_LIBRARY_SUFFIX='.so'
   673         STATIC_LIBRARY_SUFFIX='.a'
   674         OBJ_SUFFIX='.o'
   675         EXE_SUFFIX=''
   676         SET_SHARED_LIBRARY_NAME=''
   677         SET_SHARED_LIBRARY_MAPFILE=''
   678         C_FLAG_REORDER=''
   679         CXX_FLAG_REORDER=''
   680         SET_SHARED_LIBRARY_ORIGIN=''
   681         SET_EXECUTABLE_ORIGIN=""
   682         CFLAGS_JDK=""
   683         CXXFLAGS_JDK=""
   684         CFLAGS_JDKLIB_EXTRA=''
   685         POST_STRIP_CMD="$STRIP -X32_64"
   686         POST_MCS_CMD=""
   687     fi
   688     if test "x$OPENJDK_TARGET_OS" = xwindows; then
   689       # If it is not gcc, then assume it is the MS Visual Studio compiler
   690       COMPILER_NAME=cl
   691       PICFLAG=""
   692       LIBRARY_PREFIX=
   693       SHARED_LIBRARY='[$]1.dll'
   694       STATIC_LIBRARY='[$]1.lib'
   695       SHARED_LIBRARY_FLAGS="-LD"
   696       SHARED_LIBRARY_SUFFIX='.dll'
   697       STATIC_LIBRARY_SUFFIX='.lib'
   698       OBJ_SUFFIX='.obj'
   699       EXE_SUFFIX='.exe'
   700       SET_SHARED_LIBRARY_NAME=''
   701       SET_SHARED_LIBRARY_MAPFILE=''
   702       SET_SHARED_LIBRARY_ORIGIN=''
   703       SET_EXECUTABLE_ORIGIN=''
   704     fi
   705   fi
   707   AC_SUBST(COMPILER_NAME)
   708   AC_SUBST(OBJ_SUFFIX)
   709   AC_SUBST(SHARED_LIBRARY)
   710   AC_SUBST(STATIC_LIBRARY)
   711   AC_SUBST(LIBRARY_PREFIX)
   712   AC_SUBST(SHARED_LIBRARY_SUFFIX)
   713   AC_SUBST(STATIC_LIBRARY_SUFFIX)
   714   AC_SUBST(EXE_SUFFIX)
   715   AC_SUBST(SHARED_LIBRARY_FLAGS)
   716   AC_SUBST(SET_SHARED_LIBRARY_NAME)
   717   AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
   718   AC_SUBST(C_FLAG_REORDER)
   719   AC_SUBST(CXX_FLAG_REORDER)
   720   AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
   721   AC_SUBST(SET_EXECUTABLE_ORIGIN)
   722   AC_SUBST(POST_STRIP_CMD)
   723   AC_SUBST(POST_MCS_CMD)
   725   # The (cross) compiler is now configured, we can now test capabilities
   726   # of the target platform.
   727 ])
   729 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
   730 [
   732   ###############################################################################
   733   #
   734   # Setup the opt flags for different compilers
   735   # and different operating systems.
   736   #
   738   #
   739   # NOTE: check for -mstackrealign needs to be below potential addition of -m32
   740   #
   741   if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then
   742     # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
   743     # While waiting for a better solution, the current workaround is to use -mstackrealign.
   744     CFLAGS="$CFLAGS -mstackrealign"
   745     AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign])
   746     AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
   747         [
   748           AC_MSG_RESULT([yes])
   749         ],
   750         [
   751           AC_MSG_RESULT([no])
   752           AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
   753         ]
   754     )
   755   fi
   757   C_FLAG_DEPS="-MMD -MF"
   758   CXX_FLAG_DEPS="-MMD -MF"
   760   case $COMPILER_TYPE in
   761     CC )
   762       case $COMPILER_NAME in
   763         gcc )
   764           case $OPENJDK_TARGET_OS in
   765             macosx )
   766               # On MacOSX we optimize for size, something
   767               # we should do for all platforms?
   768               C_O_FLAG_HI="-Os"
   769               C_O_FLAG_NORM="-Os"
   770               C_O_FLAG_NONE=""
   771               ;;
   772             *)
   773               C_O_FLAG_HI="-O3"
   774               C_O_FLAG_NORM="-O2"
   775               C_O_FLAG_NONE="-O0"
   776               ;;
   777           esac
   778           CXX_O_FLAG_HI="$C_O_FLAG_HI"
   779           CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
   780           CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
   781           CFLAGS_DEBUG_SYMBOLS="-g"
   782           CXXFLAGS_DEBUG_SYMBOLS="-g"
   783           if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
   784             CFLAGS_DEBUG_SYMBOLS="-g1"
   785             CXXFLAGS_DEBUG_SYMBOLS="-g1"
   786           fi
   787           ;;
   788         ossc )
   789           #
   790           # Forte has different names for this with their C++ compiler...
   791           #
   792           C_FLAG_DEPS="-xMMD -xMF"
   793           CXX_FLAG_DEPS="-xMMD -xMF"
   795           # Extra options used with HIGHEST
   796           #
   797           # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
   798           #          done with care, there are some assumptions below that need to
   799           #          be understood about the use of pointers, and IEEE behavior.
   800           #
   801           # Use non-standard floating point mode (not IEEE 754)
   802           CC_HIGHEST="$CC_HIGHEST -fns"
   803           # Do some simplification of floating point arithmetic (not IEEE 754)
   804           CC_HIGHEST="$CC_HIGHEST -fsimple"
   805           # Use single precision floating point with 'float'
   806           CC_HIGHEST="$CC_HIGHEST -fsingle"
   807           # Assume memory references via basic pointer types do not alias
   808           #   (Source with excessing pointer casting and data access with mixed
   809           #    pointer types are not recommended)
   810           CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
   811           # Use intrinsic or inline versions for math/std functions
   812           #   (If you expect perfect errno behavior, do not use this)
   813           CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all"
   814           # Loop data dependency optimizations (need -xO3 or higher)
   815           CC_HIGHEST="$CC_HIGHEST -xdepend"
   816           # Pointer parameters to functions do not overlap
   817           #   (Similar to -xalias_level=basic usage, but less obvious sometimes.
   818           #    If you pass in multiple pointers to the same data, do not use this)
   819           CC_HIGHEST="$CC_HIGHEST -xrestrict"
   820           # Inline some library routines
   821           #   (If you expect perfect errno behavior, do not use this)
   822           CC_HIGHEST="$CC_HIGHEST -xlibmil"
   823           # Use optimized math routines
   824           #   (If you expect perfect errno behavior, do not use this)
   825           #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
   826           #CC_HIGHEST="$CC_HIGHEST -xlibmopt"
   828           if test "x$OPENJDK_TARGET_CPU" = xsparc; then
   829             CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
   830             CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
   831           fi
   833           case $OPENJDK_TARGET_CPU_ARCH in
   834             x86)
   835               C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr"
   836               C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
   837               C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
   838               C_O_FLAG_NONE="-xregs=no%frameptr"
   839               CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
   840               CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
   841               CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
   842               CXX_O_FLAG_NONE="-xregs=no%frameptr"
   843               if test "x$OPENJDK_TARGET_CPU" = xx86; then
   844                 C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
   845                 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
   846               fi
   847               ;;
   848             sparc)
   849               CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
   850               CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
   851               C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
   852               C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
   853               C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
   854               C_O_FLAG_NONE=""
   855               CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
   856               CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
   857               CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
   858               CXX_O_FLAG_NONE=""
   859               ;;
   860           esac
   862           CFLAGS_DEBUG_SYMBOLS="-g -xs"
   863           CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
   864           ;;
   865         xlc )
   866           C_FLAG_DEPS="-qmakedep=gcc -MF"
   867           CXX_FLAG_DEPS="-qmakedep=gcc -MF"
   868           C_O_FLAG_HIGHEST="-O3"
   869           C_O_FLAG_HI="-O3 -qstrict"
   870           C_O_FLAG_NORM="-O2"
   871           C_O_FLAG_NONE=""
   872           CXX_O_FLAG_HIGHEST="-O3"
   873           CXX_O_FLAG_HI="-O3 -qstrict"
   874           CXX_O_FLAG_NORM="-O2"
   875           CXX_O_FLAG_NONE=""
   876           CFLAGS_DEBUG_SYMBOLS="-g"
   877           CXXFLAGS_DEBUG_SYMBOLS="-g"
   878           LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
   879           CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
   880           CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
   881           ;;
   882       esac
   883       ;;
   884     CL )
   885       C_O_FLAG_HIGHEST="-O2"
   886       C_O_FLAG_HI="-O1"
   887       C_O_FLAG_NORM="-O1"
   888       C_O_FLAG_NONE="-Od"
   889       CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
   890       CXX_O_FLAG_HI="$C_O_FLAG_HI"
   891       CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
   892       CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
   893       ;;
   894   esac
   896   if test -z "$C_O_FLAG_HIGHEST"; then
   897     C_O_FLAG_HIGHEST="$C_O_FLAG_HI"
   898   fi
   900   if test -z "$CXX_O_FLAG_HIGHEST"; then
   901     CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HI"
   902   fi
   904   AC_SUBST(C_O_FLAG_HIGHEST)
   905   AC_SUBST(C_O_FLAG_HI)
   906   AC_SUBST(C_O_FLAG_NORM)
   907   AC_SUBST(C_O_FLAG_NONE)
   908   AC_SUBST(CXX_O_FLAG_HIGHEST)
   909   AC_SUBST(CXX_O_FLAG_HI)
   910   AC_SUBST(CXX_O_FLAG_NORM)
   911   AC_SUBST(CXX_O_FLAG_NONE)
   912   AC_SUBST(C_FLAG_DEPS)
   913   AC_SUBST(CXX_FLAG_DEPS)
   914 ])
   916 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK],
   917 [
   919   if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
   920     AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
   921   fi
   923   if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
   924     AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
   925   fi
   927   if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
   928     AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
   929   fi
   931   AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
   932       [extra flags to be used when compiling jdk c-files])])
   934   AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
   935       [extra flags to be used when compiling jdk c++-files])])
   937   AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
   938       [extra flags to be used when linking jdk])])
   940   CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags"
   941   CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags"
   942   LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
   944   # Hotspot needs these set in their legacy form
   945   LEGACY_EXTRA_CFLAGS=$with_extra_cflags
   946   LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
   947   LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
   949   AC_SUBST(LEGACY_EXTRA_CFLAGS)
   950   AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
   951   AC_SUBST(LEGACY_EXTRA_LDFLAGS)
   953   ###############################################################################
   954   #
   955   # Now setup the CFLAGS and LDFLAGS for the JDK build.
   956   # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
   957   #
   958   case $COMPILER_NAME in
   959     gcc )
   960       CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
   961       -pipe \
   962       -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
   963       case $OPENJDK_TARGET_CPU_ARCH in
   964         arm )
   965           # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
   966           CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
   967           ;;
   968         ppc )
   969           # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing
   970           ;;
   971         * )
   972           CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer"
   973           CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
   974           ;;
   975       esac
   976       ;;
   977     ossc )
   978       CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
   979       case $OPENJDK_TARGET_CPU_ARCH in
   980         x86 )
   981           CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
   982           CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
   983           ;;
   984       esac
   986       CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
   987       CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
   989       LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
   990       LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
   991       ;;
   992     xlc )
   993       CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   994       CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   996       LDFLAGS_JDK="$LDFLAGS_JDK"
   997       LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK"
   998       ;;
   999     cl )
  1000       CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
  1001       -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
  1002       -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
  1003       -DWIN32 -DIAL"
  1004       case $OPENJDK_TARGET_CPU in
  1005         x86 )
  1006           CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
  1007           ;;
  1008         x86_64 )
  1009           CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
  1010           ;;
  1011       esac
  1012       ;;
  1013   esac
  1015   ###############################################################################
  1017   # Adjust flags according to debug level.
  1018   case $DEBUG_LEVEL in
  1019     fastdebug )
  1020       CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
  1021       CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
  1022       C_O_FLAG_HI="$C_O_FLAG_NORM"
  1023       C_O_FLAG_NORM="$C_O_FLAG_NORM"
  1024       CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
  1025       CXX_O_FLAG_NORM="$CXX_O_FLAG_NORM"
  1026       JAVAC_FLAGS="$JAVAC_FLAGS -g"
  1027       ;;
  1028     slowdebug )
  1029       CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
  1030       CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
  1031       C_O_FLAG_HI="$C_O_FLAG_NONE"
  1032       C_O_FLAG_NORM="$C_O_FLAG_NONE"
  1033       CXX_O_FLAG_HI="$CXX_O_FLAG_NONE"
  1034       CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
  1035       JAVAC_FLAGS="$JAVAC_FLAGS -g"
  1036       ;;
  1037   esac
  1039   CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
  1041   # The package path is used only on macosx?
  1042   PACKAGE_PATH=/opt/local
  1043   AC_SUBST(PACKAGE_PATH)
  1045   if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
  1046     # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
  1047     #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
  1048     #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
  1049     #   Note: -Dmacro         is the same as    #define macro 1
  1050     #         -Dmacro=        is the same as    #define macro
  1051     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
  1052       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
  1053     else
  1054       CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
  1055     fi
  1056   else
  1057     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
  1058   fi
  1059   if test "x$OPENJDK_TARGET_OS" = xlinux; then
  1060     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX"
  1061   fi
  1062   if test "x$OPENJDK_TARGET_OS" = xwindows; then
  1063     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS"
  1064   fi
  1065   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
  1066     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS"
  1067   fi
  1068   if test "x$OPENJDK_TARGET_OS" = xaix; then
  1069     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DAIX -DPPC64"
  1070   fi
  1071   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
  1072     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
  1073     # Setting these parameters makes it an error to link to macosx APIs that are
  1074     # newer than the given OS version and makes the linked binaries compatible even
  1075     # if built on a newer version of the OS.
  1076     # The expected format is X.Y.Z
  1077     MACOSX_VERSION_MIN=10.7.0
  1078     AC_SUBST(MACOSX_VERSION_MIN)
  1079     # The macro takes the version with no dots, ex: 1070
  1080     # Let the flags variables get resolved in make for easier override on make
  1081     # command line.
  1082     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
  1083     LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
  1084   fi
  1085   if test "x$OPENJDK_TARGET_OS" = xbsd; then
  1086     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
  1087   fi
  1088   if test "x$DEBUG_LEVEL" = xrelease; then
  1089     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
  1090   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
  1091     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
  1092   fi
  1093   else
  1094     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
  1095   fi
  1097   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
  1098   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
  1100   CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
  1101       -I${JDK_OUTPUTDIR}/include \
  1102       -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
  1103       -I${JDK_TOPDIR}/src/share/javavm/export \
  1104       -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \
  1105       -I${JDK_TOPDIR}/src/share/native/common \
  1106       -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
  1108   # The shared libraries are compiled using the picflag.
  1109   CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
  1110   CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
  1112   # Executable flags
  1113   CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK"
  1114   CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK"
  1116   # Now this is odd. The JDK native libraries have to link against libjvm.so
  1117   # On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
  1118   # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
  1119   # is identical for client and server? Yes. Which is picked at runtime (client or server)?
  1120   # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
  1121   # libraries will link to whatever is in memory. Yuck.
  1123   # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
  1124   if test "x$COMPILER_NAME" = xcl; then
  1125     LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
  1126     if test "x$OPENJDK_TARGET_CPU" = xx86; then
  1127       LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
  1128     fi
  1129     # TODO: make -debug optional "--disable-full-debug-symbols"
  1130     LDFLAGS_JDK="$LDFLAGS_JDK -debug"
  1131     LDFLAGS_JDKLIB="${LDFLAGS_JDK} -dll -libpath:${JDK_OUTPUTDIR}/lib"
  1132     LDFLAGS_JDKLIB_SUFFIX=""
  1133     if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
  1134       LDFLAGS_STACK_SIZE=1048576
  1135     else
  1136       LDFLAGS_STACK_SIZE=327680
  1137     fi
  1138     LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE"
  1139   else
  1140     if test "x$COMPILER_NAME" = xgcc; then
  1141       # If this is a --hash-style=gnu system, use --hash-style=both, why?
  1142       HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
  1143       if test -n "$HAS_GNU_HASH"; then
  1144         LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both "
  1145       fi
  1146       if test "x$OPENJDK_TARGET_OS" = xlinux; then
  1147         # And since we now know that the linker is gnu, then add -z defs, to forbid
  1148         # undefined symbols in object files.
  1149         LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
  1150         if test "x$DEBUG_LEVEL" = "xrelease"; then
  1151           # When building release libraries, tell the linker optimize them.
  1152           # Should this be supplied to the OSS linker as well?
  1153           LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
  1154         fi
  1155       fi
  1156     fi
  1157     LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
  1158         -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
  1160     # On some platforms (mac) the linker warns about non existing -L dirs.
  1161     # Add server first if available. Linking aginst client does not always produce the same results.
  1162     # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
  1163     # Default to server for other variants.
  1164     if test "x$JVM_VARIANT_SERVER" = xtrue; then
  1165       LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
  1166     elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
  1167       LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
  1168     elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
  1169       LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
  1170     else
  1171       LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
  1172     fi
  1174     LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
  1175     if test "x$COMPILER_NAME" = xossc; then
  1176       LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
  1177     fi
  1179     LDFLAGS_JDKEXE="${LDFLAGS_JDK}"
  1180     if test "x$OPENJDK_TARGET_OS" = xlinux; then
  1181       LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined"
  1182     fi
  1183   fi
  1185   AC_SUBST(CFLAGS_JDKLIB)
  1186   AC_SUBST(CFLAGS_JDKEXE)
  1188   AC_SUBST(CXXFLAGS_JDKLIB)
  1189   AC_SUBST(CXXFLAGS_JDKEXE)
  1191   AC_SUBST(LDFLAGS_JDKLIB)
  1192   AC_SUBST(LDFLAGS_JDKEXE)
  1193   AC_SUBST(LDFLAGS_JDKLIB_SUFFIX)
  1194   AC_SUBST(LDFLAGS_JDKEXE_SUFFIX)
  1195   AC_SUBST(LDFLAGS_CXX_JDK)
  1196 ])
  1199 # TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
  1200 #                                   [RUN-IF-FALSE])
  1201 # ------------------------------------------------------------
  1202 # Check that the c and c++ compilers support an argument
  1203 AC_DEFUN([TOOLCHAIN_COMPILER_CHECK_ARGUMENTS],
  1205   AC_MSG_CHECKING([if compiler supports "$1"])
  1206   supports=yes
  1208   saved_cflags="$CFLAGS"
  1209   CFLAGS="$CFLAGS $1"
  1210   AC_LANG_PUSH([C])
  1211   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], 
  1212       [supports=no])
  1213   AC_LANG_POP([C])
  1214   CFLAGS="$saved_cflags"
  1216   saved_cxxflags="$CXXFLAGS"
  1217   CXXFLAGS="$CXXFLAG $1"
  1218   AC_LANG_PUSH([C++])
  1219   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], 
  1220       [supports=no])
  1221   AC_LANG_POP([C++])
  1222   CXXFLAGS="$saved_cxxflags"
  1224   AC_MSG_RESULT([$supports])
  1225   if test "x$supports" = "xyes" ; then
  1226     m4_ifval([$2], [$2], [:])
  1227   else
  1228     m4_ifval([$3], [$3], [:])
  1229   fi
  1230 ])
  1232 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_MISC],
  1234   # Some Zero and Shark settings.
  1235   # ZERO_ARCHFLAG tells the compiler which mode to build for
  1236   case "${OPENJDK_TARGET_CPU}" in
  1237     s390)
  1238       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
  1239       ;;
  1240     *)
  1241       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
  1242   esac
  1243   TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
  1244   AC_SUBST(ZERO_ARCHFLAG)
  1246   # Check that the compiler supports -mX (or -qX on AIX) flags
  1247   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
  1248   TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
  1249       [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
  1250       [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
  1251   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
  1254   # Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed in executable.'
  1255   USING_BROKEN_SUSE_LD=no
  1256   if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$GCC" = xyes; then
  1257     AC_MSG_CHECKING([for broken SuSE 'ld' which only understands anonymous version tags in executables])
  1258     echo "SUNWprivate_1.1 { local: *; };" > version-script.map
  1259     echo "int main() { }" > main.c
  1260     if $CXX -Xlinker -version-script=version-script.map main.c 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
  1261       AC_MSG_RESULT(no)
  1262       USING_BROKEN_SUSE_LD=no
  1263     else
  1264       AC_MSG_RESULT(yes)
  1265       USING_BROKEN_SUSE_LD=yes
  1266     fi
  1267     rm -rf version-script.map main.c
  1268   fi
  1269   AC_SUBST(USING_BROKEN_SUSE_LD)
  1270 ])
  1272 # Setup the JTREG paths
  1273 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
  1275   AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
  1276       [Regression Test Harness @<:@probed@:>@])],
  1277       [],
  1278       [with_jtreg=no])
  1280   if test "x$with_jtreg" = xno; then
  1281     # jtreg disabled
  1282     AC_MSG_CHECKING([for jtreg])
  1283     AC_MSG_RESULT(no)
  1284   else
  1285     if test "x$with_jtreg" != xyes; then
  1286       # with path specified.
  1287       JT_HOME="$with_jtreg"
  1288     fi
  1290     if test "x$JT_HOME" != x; then
  1291       AC_MSG_CHECKING([for jtreg])
  1293       # use JT_HOME enviroment var.
  1294       BASIC_FIXUP_PATH([JT_HOME])
  1296       # jtreg win32 script works for everybody
  1297       JTREGEXE="$JT_HOME/bin/jtreg"
  1299       if test ! -f "$JTREGEXE"; then
  1300         AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
  1301       fi
  1303       AC_MSG_RESULT($JTREGEXE)
  1304     else
  1305       # try to find jtreg on path
  1306       BASIC_REQUIRE_PROG(JTREGEXE, jtreg)
  1307       JT_HOME="`$DIRNAME $JTREGEXE`"
  1308     fi
  1309   fi
  1311   AC_SUBST(JT_HOME)
  1312   AC_SUBST(JTREGEXE)
  1313 ])

mercurial