help.m4 revision 1482:98e85b507b09
138494Sobrien#
2174294Sobrien# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
338494Sobrien# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
438494Sobrien#
538494Sobrien# This code is free software; you can redistribute it and/or modify it
638494Sobrien# under the terms of the GNU General Public License version 2 only, as
738494Sobrien# published by the Free Software Foundation.  Oracle designates this
838494Sobrien# particular file as subject to the "Classpath" exception as provided
938494Sobrien# by Oracle in the LICENSE file that accompanied this code.
1038494Sobrien#
1138494Sobrien# This code is distributed in the hope that it will be useful, but WITHOUT
1238494Sobrien# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1338494Sobrien# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1438494Sobrien# version 2 for more details (a copy is included in the LICENSE file that
1538494Sobrien# accompanied this code).
1638494Sobrien#
1738494Sobrien# You should have received a copy of the GNU General Public License version
1838494Sobrien# 2 along with this work; if not, write to the Free Software Foundation,
1938494Sobrien# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2042629Sobrien#
2138494Sobrien# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2238494Sobrien# or visit www.oracle.com if you need additional information or have any
2338494Sobrien# questions.
2438494Sobrien#
2538494Sobrien
2638494SobrienAC_DEFUN_ONCE([HELP_SETUP_DEPENDENCY_HELP],
2738494Sobrien[
2838494Sobrien  AC_CHECK_PROGS(PKGHANDLER, apt-get yum port pkgutil pkgadd)
2938494Sobrien])
3038494Sobrien
3138494SobrienAC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
3238494Sobrien[
3338494Sobrien  # Print a helpful message on how to acquire the necessary build dependency.
3438494Sobrien  # $1 is the help tag: freetype, cups, pulse, alsa etc
3538494Sobrien  MISSING_DEPENDENCY=$1
3638494Sobrien
3738494Sobrien  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
3838494Sobrien    cygwin_help $MISSING_DEPENDENCY
3938494Sobrien  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
40174294Sobrien    msys_help $MISSING_DEPENDENCY
4138494Sobrien  else
4238494Sobrien    PKGHANDLER_COMMAND=
4338494Sobrien
4438494Sobrien    case $PKGHANDLER in
4538494Sobrien      apt-get)
4638494Sobrien        apt_help     $MISSING_DEPENDENCY ;;
4738494Sobrien      yum)
4838494Sobrien        yum_help     $MISSING_DEPENDENCY ;;
4938494Sobrien      port)
5038494Sobrien        port_help    $MISSING_DEPENDENCY ;;
5138494Sobrien      pkgutil)
5238494Sobrien        pkgutil_help $MISSING_DEPENDENCY ;;
5338494Sobrien      pkgadd)
54174294Sobrien        pkgadd_help  $MISSING_DEPENDENCY ;;
5538494Sobrien    esac
5638494Sobrien
57174294Sobrien    if test "x$PKGHANDLER_COMMAND" != x; then
58174294Sobrien      HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
59174294Sobrien    fi
60174294Sobrien  fi
6138494Sobrien])
6238494Sobrien
6338494Sobriencygwin_help() {
6438494Sobrien  case $1 in
6538494Sobrien    unzip)
66174294Sobrien      PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P unzip )"
67174294Sobrien      HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
68174294Sobrien      ;;
69174294Sobrien    zip)
70174294Sobrien      PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P zip )"
71174294Sobrien      HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
72174294Sobrien      ;;
73174294Sobrien    make)
74174294Sobrien      PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P make )"
75174294Sobrien      HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
76174294Sobrien      ;;
77174294Sobrien    freetype)
78174294Sobrien      HELP_MSG="
79174294SobrienThe freetype library can now be build during the configure process.
8038494SobrienDownload the freetype sources and unpack them into an arbitrary directory:
8138494Sobrien
8238494Sobrienwget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
83174294Sobrientar -xzf freetype-2.5.3.tar.gz
8438494Sobrien
8538494SobrienThen run configure with '--with-freetype-src=<freetype_src>'. This will
8638494Sobrienautomatically build the freetype library into '<freetype_src>/lib64' for 64-bit
87174294Sobrienbuilds or into '<freetype_src>/lib32' for 32-bit builds.
8838494SobrienAfterwards you can always use '--with-freetype-include=<freetype_src>/include'
89174294Sobrienand '--with-freetype-lib=<freetype_src>/lib[32|64]' for other builds."
9038494Sobrien      ;;
91174294Sobrien  esac
9238494Sobrien}
9338494Sobrien
9438494Sobrienmsys_help() {
9538494Sobrien  PKGHANDLER_COMMAND=""
9638494Sobrien}
9738494Sobrien
9838494Sobrienapt_help() {
9938494Sobrien  case $1 in
10038494Sobrien    devkit)
10138494Sobrien      PKGHANDLER_COMMAND="sudo apt-get install build-essential" ;;
10238494Sobrien    openjdk)
10338494Sobrien      PKGHANDLER_COMMAND="sudo apt-get install openjdk-7-jdk" ;;
10438494Sobrien    alsa)
10538494Sobrien      PKGHANDLER_COMMAND="sudo apt-get install libasound2-dev" ;;
10638494Sobrien    cups)
10738494Sobrien      PKGHANDLER_COMMAND="sudo apt-get install libcups2-dev" ;;
10838494Sobrien    freetype)
10938494Sobrien      PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
11038494Sobrien    pulse)
11138494Sobrien      PKGHANDLER_COMMAND="sudo apt-get install libpulse-dev" ;;
11238494Sobrien    x11)
11338494Sobrien      PKGHANDLER_COMMAND="sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev" ;;
11438494Sobrien    ccache)
11538494Sobrien      PKGHANDLER_COMMAND="sudo apt-get install ccache" ;;
11638494Sobrien  esac
11738494Sobrien}
11838494Sobrien
11938494Sobrienyum_help() {
12038494Sobrien  case $1 in
121174294Sobrien    devkit)
122174294Sobrien      PKGHANDLER_COMMAND="sudo yum groupinstall \"Development Tools\"" ;;
12338494Sobrien    openjdk)
12438494Sobrien      PKGHANDLER_COMMAND="sudo yum install java-1.7.0-openjdk" ;;
12538494Sobrien    alsa)
12638494Sobrien      PKGHANDLER_COMMAND="sudo yum install alsa-lib-devel" ;;
12738494Sobrien    cups)
12838494Sobrien      PKGHANDLER_COMMAND="sudo yum install cups-devel" ;;
12938494Sobrien    freetype)
13038494Sobrien      PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
13138494Sobrien    pulse)
13238494Sobrien      PKGHANDLER_COMMAND="sudo yum install pulseaudio-libs-devel" ;;
13338494Sobrien    x11)
13438494Sobrien      PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXi-devel" ;;
13538494Sobrien    ccache)
13638494Sobrien      PKGHANDLER_COMMAND="sudo yum install ccache" ;;
13738494Sobrien  esac
13838494Sobrien}
13938494Sobrien
140174294Sobrienport_help() {
141174294Sobrien  PKGHANDLER_COMMAND=""
142174294Sobrien}
14338494Sobrien
14438494Sobrienpkgutil_help() {
14538494Sobrien  PKGHANDLER_COMMAND=""
14638494Sobrien}
14738494Sobrien
14838494Sobrienpkgadd_help() {
14938494Sobrien  PKGHANDLER_COMMAND=""
15038494Sobrien}
15138494Sobrien
15238494Sobrien# This function will check if we're called from the "configure" wrapper while
15338494Sobrien# printing --help. If so, we will print out additional information that can
15438494Sobrien# only be extracted within the autoconf script, and then exit. This must be
15538494Sobrien# called at the very beginning in configure.ac.
15638494SobrienAC_DEFUN_ONCE([HELP_PRINT_ADDITIONAL_HELP_AND_EXIT],
15738494Sobrien[
15838494Sobrien  if test "x$CONFIGURE_PRINT_TOOLCHAIN_LIST" != x; then
15938494Sobrien    $PRINTF "The following toolchains are available as arguments to --with-toolchain-type.\n"
16038494Sobrien    $PRINTF "Which are valid to use depends on the build platform.\n"
16138494Sobrien    for toolchain in $VALID_TOOLCHAINS_all; do
16238494Sobrien      # Use indirect variable referencing
16338494Sobrien      toolchain_var_name=TOOLCHAIN_DESCRIPTION_$toolchain
16438494Sobrien      TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
16538494Sobrien      $PRINTF "  %-10s  %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION"
16638494Sobrien    done
16738494Sobrien
16838494Sobrien    # And now exit directly
16982794Sobrien    exit 0
17082794Sobrien  fi
17182794Sobrien])
17238494Sobrien
17338494SobrienAC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
17438494Sobrien[
17538494Sobrien  # Finally output some useful information to the user
176174294Sobrien
177174294Sobrien  printf "\n"
178174294Sobrien  printf "====================================================\n"
179174294Sobrien  if test "x$no_create" != "xyes"; then
180174294Sobrien    if test "x$IS_RECONFIGURE" != "xyes"; then
181174294Sobrien      printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT"
182174294Sobrien    else
18338494Sobrien      printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT"
18438494Sobrien    fi
18538494Sobrien  else
18638494Sobrien    if test "x$IS_RECONFIGURE" != "xyes"; then
18738494Sobrien      printf "A configuration has been successfully checked but not created\n"
18838494Sobrien    else
189174294Sobrien      printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT"
19038494Sobrien    fi
19138494Sobrien  fi
19238494Sobrien  if test "x$CONFIGURE_COMMAND_LINE" != x; then
19338494Sobrien    printf "using configure arguments '$CONFIGURE_COMMAND_LINE'.\n"
19438494Sobrien  else
19538494Sobrien    printf "using default settings.\n"
19638494Sobrien  fi
19738494Sobrien
19838494Sobrien  printf "\n"
19938494Sobrien  printf "Configuration summary:\n"
20038494Sobrien  printf "* Debug level:    $DEBUG_LEVEL\n"
20138494Sobrien  printf "* HS debug level: $HOTSPOT_DEBUG_LEVEL\n"
20238494Sobrien  printf "* JDK variant:    $JDK_VARIANT\n"
20338494Sobrien  printf "* JVM variants:   $with_jvm_variants\n"
20438494Sobrien  printf "* OpenJDK target: OS: $OPENJDK_TARGET_OS, CPU architecture: $OPENJDK_TARGET_CPU_ARCH, address length: $OPENJDK_TARGET_CPU_BITS\n"
20538494Sobrien
206174294Sobrien  printf "\n"
207174294Sobrien  printf "Tools summary:\n"
208174294Sobrien  if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
209174294Sobrien    printf "* Environment:    $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION (root at $WINDOWS_ENV_ROOT_PATH)\n"
210174294Sobrien  fi
211174294Sobrien  printf "* Boot JDK:       $BOOT_JDK_VERSION (at $BOOT_JDK)\n"
212174294Sobrien  if test "x$TOOLCHAIN_VERSION" != "x"; then
213174294Sobrien    print_version=" $TOOLCHAIN_VERSION"
214174294Sobrien  fi
215174294Sobrien  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n"
216174294Sobrien  printf "* C Compiler:     Version $CC_VERSION_NUMBER (at $CC)\n"
217174294Sobrien  printf "* C++ Compiler:   Version $CXX_VERSION_NUMBER (at $CXX)\n"
218174294Sobrien
219174294Sobrien  printf "\n"
220174294Sobrien  printf "Build performance summary:\n"
221174294Sobrien  printf "* Cores to use:   $JOBS\n"
222174294Sobrien  printf "* Memory limit:   $MEMORY_SIZE MB\n"
223174294Sobrien  if test "x$CCACHE_STATUS" != "x"; then
224174294Sobrien    printf "* ccache status:  $CCACHE_STATUS\n"
225174294Sobrien  fi
226174294Sobrien  printf "\n"
22738494Sobrien
22838494Sobrien  if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xyes"; then
22938494Sobrien    printf "NOTE: You have requested to build more than one version of the JVM, which\n"
230174294Sobrien    printf "will result in longer build times.\n"
231174294Sobrien    printf "\n"
232174294Sobrien  fi
233174294Sobrien
234174294Sobrien  if test "x$FOUND_ALT_VARIABLES" != "x"; then
23538494Sobrien    printf "WARNING: You have old-style ALT_ environment variables set.\n"
23638494Sobrien    printf "These are not respected, and will be ignored. It is recommended\n"
23738494Sobrien    printf "that you clean your environment. The following variables are set:\n"
23838494Sobrien    printf "$FOUND_ALT_VARIABLES\n"
23938494Sobrien    printf "\n"
24038494Sobrien  fi
24138494Sobrien
24238494Sobrien  if test "x$OUTPUT_DIR_IS_LOCAL" != "xyes"; then
24338494Sobrien    printf "WARNING: Your build output directory is not on a local disk.\n"
24438494Sobrien    printf "This will severely degrade build performance!\n"
24538494Sobrien    printf "It is recommended that you create an output directory on a local disk,\n"
24638494Sobrien    printf "and run the configure script again from that directory.\n"
24738494Sobrien    printf "\n"
24838494Sobrien  fi
24938494Sobrien
25038494Sobrien  if test "x$IS_RECONFIGURE" = "xyes" && test "x$no_create" != "xyes"; then
251174294Sobrien    printf "WARNING: The result of this configuration has overridden an older\n"
25238494Sobrien    printf "configuration. You *should* run 'make clean' to make sure you get a\n"
25338494Sobrien    printf "proper build. Failure to do so might result in strange build problems.\n"
254174294Sobrien    printf "\n"
255174294Sobrien  fi
256174294Sobrien
257174294Sobrien  if test "x$IS_RECONFIGURE" != "xyes" && test "x$no_create" = "xyes"; then
258174294Sobrien    printf "WARNING: The result of this configuration was not saved.\n"
259174294Sobrien    printf "You should run without '--no-create | -n' to create the configuration.\n"
26038494Sobrien    printf "\n"
261174294Sobrien  fi
262174294Sobrien])
263174294Sobrien
264174294SobrienAC_DEFUN_ONCE([HELP_REPEAT_WARNINGS],
265174294Sobrien[
26638494Sobrien  # Locate config.log.
26738494Sobrien  if test -e "$CONFIGURESUPPORT_OUTPUTDIR/config.log"; then
26838494Sobrien    CONFIG_LOG_PATH="$CONFIGURESUPPORT_OUTPUTDIR"
269174294Sobrien  elif test -e "./config.log"; then
27038494Sobrien    CONFIG_LOG_PATH="."
27138494Sobrien  fi
27238494Sobrien
273174294Sobrien  if test -e "$CONFIG_LOG_PATH/config.log"; then
274174294Sobrien    $GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" > /dev/null 2>&1
27538494Sobrien    if test $? -eq 0; then
276174294Sobrien      printf "The following warnings were produced. Repeated here for convenience:\n"
277174294Sobrien      # We must quote sed expression (using []) to stop m4 from eating the [].
278174294Sobrien      $GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" | $SED -e [ 's/^configure:[0-9]*: //' ]
279174294Sobrien      printf "\n"
280174294Sobrien    fi
281119679Smbr  fi
282119679Smbr])
283119679Smbr