configure.ac revision 939:3ef3f4174c2b
187866Ssheldonh#
287866Ssheldonh# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
387866Ssheldonh# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
487866Ssheldonh#
587866Ssheldonh# This code is free software; you can redistribute it and/or modify it
687866Ssheldonh# under the terms of the GNU General Public License version 2 only, as
787866Ssheldonh# published by the Free Software Foundation.  Oracle designates this
887866Ssheldonh# particular file as subject to the "Classpath" exception as provided
987866Ssheldonh# by Oracle in the LICENSE file that accompanied this code.
1087866Ssheldonh#
1187866Ssheldonh# This code is distributed in the hope that it will be useful, but WITHOUT
1287866Ssheldonh# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1387866Ssheldonh# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1487866Ssheldonh# version 2 for more details (a copy is included in the LICENSE file that
1587866Ssheldonh# accompanied this code).
1687866Ssheldonh#
1787866Ssheldonh# You should have received a copy of the GNU General Public License version
1887866Ssheldonh# 2 along with this work; if not, write to the Free Software Foundation,
1987866Ssheldonh# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2087866Ssheldonh#
2187866Ssheldonh# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2287866Ssheldonh# or visit www.oracle.com if you need additional information or have any
2387866Ssheldonh# questions.
2487866Ssheldonh#
2587866Ssheldonh
2687866Ssheldonh###############################################################################
2787866Ssheldonh#
2887866Ssheldonh# Includes and boilerplate
2987866Ssheldonh#
3087866Ssheldonh###############################################################################
3187866Ssheldonh
3288282Ssheldonh
3387866SsheldonhAC_PREREQ([2.61])
3487866SsheldonhAC_INIT(OpenJDK, jdk8, build-dev@openjdk.java.net,,http://openjdk.java.net)
3587866Ssheldonh
3687866SsheldonhAC_CONFIG_AUX_DIR([build-aux])
3787866Ssheldonhm4_include([build-aux/pkg.m4])
3887866Ssheldonh
3987866Ssheldonh# Include these first...
4087866Ssheldonhm4_include([basics.m4])
4187866Ssheldonhm4_include([basics_windows.m4])
4287866Ssheldonhm4_include([builddeps.m4])
4387866Ssheldonh# ... then the rest
4487866Ssheldonhm4_include([boot-jdk.m4])
4587866Ssheldonhm4_include([build-performance.m4])
4687866Ssheldonhm4_include([help.m4])
4787866Ssheldonhm4_include([jdk-options.m4])
4887866Ssheldonhm4_include([libraries.m4])
4987866Ssheldonhm4_include([platform.m4])
5087866Ssheldonhm4_include([source-dirs.m4])
5187866Ssheldonhm4_include([toolchain.m4])
5287866Ssheldonhm4_include([toolchain_windows.m4])
5388282Ssheldonh
5488282SsheldonhAC_DEFUN_ONCE([CUSTOM_EARLY_HOOK])
5588282SsheldonhAC_DEFUN_ONCE([CUSTOM_LATE_HOOK])
5688282Ssheldonh
5788282Ssheldonh# This line needs to be here, verbatim, after all includes and the dummy hook
5888282Ssheldonh# definitions. It is replaced with custom functionality when building
5988282Ssheldonh# custom sources.
6088282Ssheldonh#CUSTOM_AUTOCONF_INCLUDE
6188282Ssheldonh
6287866Ssheldonh# Do not change or remove the following line, it is needed for consistency checks:
6387866SsheldonhDATE_WHEN_GENERATED=@DATE_WHEN_GENERATED@
6487866Ssheldonh
6587866Ssheldonh###############################################################################
6687866Ssheldonh#
6787866Ssheldonh# Initialization / Boot-strapping
6887866Ssheldonh#
6987866Ssheldonh# The bootstrapping process needs to solve the "chicken or the egg" problem,
7087866Ssheldonh# thus it jumps back and forth, each time gaining something needed later on.
7187866Ssheldonh#
7287866Ssheldonh###############################################################################
7387866Ssheldonh
7487866Ssheldonh# Basic initialization that must happen first of all
7587866SsheldonhBASIC_INIT
7687866SsheldonhBASIC_SETUP_FUNDAMENTAL_TOOLS
7787866Ssheldonh
7887866Ssheldonh# Now we can determine OpenJDK build and target platforms. This is required to
7987866Ssheldonh# have early on.
8087866SsheldonhPLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET
8187866Ssheldonh
8287866Ssheldonh# Continue setting up basic stuff. Most remaining code require fundamental tools.
8387866SsheldonhBASIC_SETUP_PATHS
8487866SsheldonhBASIC_SETUP_LOGGING
8587866Ssheldonh
8687866Ssheldonh# Check if it's a pure open build or if custom sources are to be used.
8787866SsheldonhJDKOPT_SETUP_OPEN_OR_CUSTOM
8887866Ssheldonh
8987866Ssheldonh# These are needed to be able to create a configuration name (and thus the output directory)
9087866SsheldonhJDKOPT_SETUP_JDK_VARIANT
9187866SsheldonhJDKOPT_SETUP_JVM_INTERPRETER
9287866SsheldonhJDKOPT_SETUP_JVM_VARIANTS
9387866SsheldonhJDKOPT_SETUP_DEBUG_LEVEL
9487866Ssheldonh
9587866Ssheldonh# With basic setup done, call the custom early hook.
9687866SsheldonhCUSTOM_EARLY_HOOK
9787866Ssheldonh
9887866Ssheldonh# To properly create a configuration name, we need to have the OpenJDK target
9987866Ssheldonh# and options (variants and debug level) parsed.
10087866SsheldonhBASIC_SETUP_OUTPUT_DIR
10187866Ssheldonh
10287866Ssheldonh# Must be done before we can call HELP_MSG_MISSING_DEPENDENCY.
10387866SsheldonhHELP_SETUP_DEPENDENCY_HELP
10487866Ssheldonh
10587866Ssheldonh# Setup tools that requires more complex handling, or that is not needed by the configure script.
10687866SsheldonhBASIC_SETUP_COMPLEX_TOOLS
10787866Ssheldonh
10887866Ssheldonh# Check if pkg-config is available.
10987866SsheldonhPKG_PROG_PKG_CONFIG
11087866Ssheldonh
11187866Ssheldonh# After basic tools have been setup, we can check build os specific details.
11287866SsheldonhPLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION
11387866Ssheldonh
11487866Ssheldonh# Setup builddeps, for automatic downloading of tools we need.
11587866Ssheldonh# This is needed before we can call BDEPS_CHECK_MODULE, which is done in
11687866Ssheldonh# boot-jdk setup, but we need to have basic tools setup first.
11787866SsheldonhBDEPS_CONFIGURE_BUILDDEPS
11887866SsheldonhBDEPS_SCAN_FOR_BUILDDEPS
11987866Ssheldonh
12087866Ssheldonh###############################################################################
12187866Ssheldonh#
12287866Ssheldonh# Determine OpenJDK variants, options and version numbers.
12387866Ssheldonh#
12487866Ssheldonh###############################################################################
12587866Ssheldonh
12687866Ssheldonh# We need build & target for this.
12787866SsheldonhJDKOPT_SETUP_JDK_OPTIONS
12887866SsheldonhJDKOPT_SETUP_JDK_VERSION_NUMBERS
12987866Ssheldonh
13087866Ssheldonh###############################################################################
13187866Ssheldonh#
13287866Ssheldonh# Setup BootJDK, used to bootstrap the build.
13387866Ssheldonh#
13487866Ssheldonh###############################################################################
13587866Ssheldonh
13687866SsheldonhBOOTJDK_SETUP_BOOT_JDK
13787866SsheldonhBOOTJDK_SETUP_BOOT_JDK_ARGUMENTS
13887866Ssheldonh
13987866Ssheldonh###############################################################################
14087866Ssheldonh#
14187866Ssheldonh# Configure the sources to use. We can add or override individual directories.
14287866Ssheldonh#
14387866Ssheldonh###############################################################################
14487866Ssheldonh
14587866SsheldonhSRCDIRS_SETUP_TOPDIRS
14687866SsheldonhSRCDIRS_SETUP_ALTERNATIVE_TOPDIRS
14787866SsheldonhSRCDIRS_SETUP_OUTPUT_DIRS
14887866Ssheldonh
14987866Ssheldonh###############################################################################
15087866Ssheldonh#
15187866Ssheldonh# Setup the toolchain (compilers etc), i.e. the tools that need to be
15287866Ssheldonh# cross-compilation aware.
15387866Ssheldonh#
15487866Ssheldonh###############################################################################
15587866Ssheldonh
15687866SsheldonhTOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS
15787866Ssheldonh# Locate the actual tools
15887866SsheldonhTOOLCHAIN_SETUP_PATHS
15987866Ssheldonh
16087866Ssheldonh# FIXME: Currently we must test this after paths but before flags. Fix!
16187866Ssheldonh
16287866Ssheldonh# And we can test some aspects on the target using configure macros.
16387866SsheldonhPLATFORM_SETUP_OPENJDK_TARGET_BITS
16487866SsheldonhPLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS
16587866Ssheldonh
16687866Ssheldonh# Configure flags for the tools
16787866SsheldonhTOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS
16887866SsheldonhTOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION
16987866SsheldonhTOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK
17087866SsheldonhTOOLCHAIN_SETUP_COMPILER_FLAGS_MISC
17187866Ssheldonh
17287866Ssheldonh# Setup debug symbols (need objcopy from the toolchain for that)
17387866SsheldonhJDKOPT_SETUP_DEBUG_SYMBOLS
17487866Ssheldonh
17587866Ssheldonh###############################################################################
17687866Ssheldonh#
17787866Ssheldonh# Check dependencies for external and internal libraries.
17887866Ssheldonh#
17987866Ssheldonh###############################################################################
18087866Ssheldonh
18187866SsheldonhLIB_SETUP_INIT
18287866SsheldonhLIB_SETUP_X11
18387866SsheldonhLIB_SETUP_CUPS
18487866SsheldonhLIB_SETUP_FREETYPE
18587866SsheldonhLIB_SETUP_ALSA
18688282SsheldonhLIB_SETUP_MISC_LIBS
18788282SsheldonhLIB_SETUP_STATIC_LINK_LIBSTDCPP
18888282Ssheldonh
18987866Ssheldonh# After we have toolchain and the paths to all libraries (needed by msys), we can compile the fixpath helper
19088282SsheldonhBASIC_COMPILE_FIXPATH
19188282Ssheldonh
19288282Ssheldonh###############################################################################
19387866Ssheldonh#
19487866Ssheldonh# We need to do some final tweaking, when everything else is done.
19587866Ssheldonh#
19687866Ssheldonh###############################################################################
19787866Ssheldonh
19888282SsheldonhJDKOPT_SETUP_BUILD_TWEAKS
19988282SsheldonhJDKOPT_DETECT_INTREE_EC
20088282Ssheldonh
20187866Ssheldonh###############################################################################
20288282Ssheldonh#
20388282Ssheldonh# Configure parts of the build that only affect the build performance,
20488282Ssheldonh# not the result.
20587866Ssheldonh#
20687866Ssheldonh###############################################################################
20787866Ssheldonh
20887866SsheldonhBPERF_SETUP_BUILD_CORES
20987866SsheldonhBPERF_SETUP_BUILD_MEMORY
21087866SsheldonhBPERF_SETUP_BUILD_JOBS
21187866Ssheldonh
21288282Ssheldonh# Setup smart javac (after cores and memory have been setup)
21387866SsheldonhBPERF_SETUP_SMART_JAVAC
21487866Ssheldonh
21587866Ssheldonh# Can the C/C++ compiler use precompiled headers?
21688282SsheldonhBPERF_SETUP_PRECOMPILED_HEADERS
21787866Ssheldonh
21888282Ssheldonh# Setup use of ccache, if available
21988282SsheldonhBPERF_SETUP_CCACHE
22088282Ssheldonh
22188282Ssheldonh###############################################################################
22288282Ssheldonh#
22388282Ssheldonh# And now the finish...
22487866Ssheldonh#
22587866Ssheldonh###############################################################################
22687866Ssheldonh
22787866Ssheldonh# Check for some common pitfalls
22887866SsheldonhBASIC_TEST_USABILITY_ISSUES
22987866Ssheldonh
23087866Ssheldonh# At the end, call the custom hook. (Dummy macro if no custom sources available)
23187866SsheldonhCUSTOM_LATE_HOOK
23287866Ssheldonh
23387866Ssheldonh# We're messing a bit with internal autoconf variables to put the config.status
23487866Ssheldonh# in the output directory instead of the current directory.
235319980SjpaetzelCONFIG_STATUS="$OUTPUT_ROOT/config.status"
236319980Sjpaetzel# Create the actual output files. Now the main work of configure is done.
23787866SsheldonhAC_OUTPUT
23887866Ssheldonh
23987866Ssheldonh# Make the compare script executable
24087866Ssheldonh$CHMOD +x $OUTPUT_ROOT/compare.sh
24188282Ssheldonh
24287866Ssheldonh# Finally output some useful information to the user
24387866SsheldonhHELP_PRINT_SUMMARY_AND_WARNINGS
24487866Ssheldonh