view jdk/make/common/shared/Sanity.gmk @ 4:420c4a9702eb jdk6-b07

Import b07
author Mark Wielaard <mark@klomp.org>
date Thu, 20 Mar 2008 00:00:00 +0100
parents a5c0d00d3895
children 7c56bb8ffc4b
line wrap: on
line source

#
# Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#

#
# WARNING: This file is shared with other workspaces.
#

#
# Shared sanity rules for the JDK builds.
#

.SUFFIXES: .hdiffs

# All files created during sanity checking

SANITY_FILES =  $(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE)

# How to say "The Release Engineering people use this"
THE_OFFICIAL_USES=The official $(PLATFORM) builds use

# How to say "You are using:"
YOU_ARE_USING=You appear to be using

# Settings and rules to validate the JDK build environment.

ifeq ($(PLATFORM), solaris)
  FREE_SPACE := $(shell $(DF) -b $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$2;}')
  TEMP_FREE_SPACE := $(shell $(DF) -b $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$2;}')
  REQ_PATCH_LIST = $(JDK_TOPDIR)/make/PatchList.solaris
  ifeq ($(ARCH_FAMILY), sparc)
    PATCH_POSITION = $$4
  else
    PATCH_POSITION = $$6
  endif
endif

ifeq ($(PLATFORM), linux)
  FREE_SPACE := $(shell $(DF) --sync -kP $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
  TEMP_FREE_SPACE := $(shell $(DF) --sync -kP $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
  ifeq ($(ARCH), amd64)
    LINUX_VERSION := $(shell \
        if [ -r "$(LINUX_VERSION_INFO)" ] ; then \
          $(CAT) $(LINUX_VERSION_INFO) | $(TAIL) -1 | $(NAWK) '{ print $$3; }';\
        else \
          $(ECHO) "Unknown linux"; \
        fi )
  else
    LINUX_VERSION := $(shell \
        if [ -r "$(LINUX_VERSION_INFO)" ] ; then \
          $(NAWK) '{ print $$4" "$$5; }' $(LINUX_VERSION_INFO) ; \
        else \
          $(ECHO) "Unknown linux"; \
        fi )
  endif
  ifneq ($(ARCH), ia64)
    # dummy program that outputs ALSA's version (created in target sane-alsa-versioncheck)
    ALSA_VERSION_CHECK = $(TEMPDIR)/alsaversioncheck
    ALSA_VERSION = `if [ -f "$(ALSA_VERSION_CHECK)" ] ; then $(ALSA_VERSION_CHECK) ; fi`
  endif
endif

ifeq ($(PLATFORM), windows)
  WINVER=$(JDK_TOPDIR)/make/tools/winver/bin/winver.exe
  FREE_SPACE := $(shell $(DF) -kP $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
  TEMP_FREE_SPACE := $(shell $(DF) -kP $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
  WINDOWS_VERSION := $(shell \
      if [ -x $(WINVER) ]; then \
	$(WINVER) ; \
      else \
	$(ECHO) "Unknown Windows Version"; \
      fi)
  DXSDK_VER := $(shell $(EGREP) DIRECTDRAW_VERSION $(DXSDK_INCLUDE_PATH)/ddraw.h 2>&1 | \
    $(EGREP) "\#define" | $(NAWK) '{print $$3}')
endif

# Get the version numbers of what we are using
_MAKE_VER  :=$(shell $(MAKE) --version 2>&1 | $(HEAD) -n 1)
_ZIP_VER   :=$(shell $(ZIPEXE) -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^Zip')
_UNZIP_VER :=$(shell $(UNZIP)  -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^UnZip')
_BOOT_VER  :=$(shell $(BOOTDIR)/bin/java -version 2>&1 | $(HEAD) -n 1)
MAKE_VER   :=$(call GetVersion,"$(_MAKE_VER)")
ZIP_VER    :=$(call GetVersion,"$(_ZIP_VER)")
UNZIP_VER  :=$(call GetVersion,"$(_UNZIP_VER)")
BOOT_VER   :=$(call GetVersion,"$(_BOOT_VER)")

REQUIRED_ANT_VER      := 1.6.3
_ANT_VER              :=$(shell $(ANT) -version 2>&1 )
ANT_VER               :=$(call GetVersion,"$(_ANT_VER)")

REQUIRED_FINDBUGS_VER := 1.1
_FINDBUGS_VER         :=$(shell $(FINDBUGS) -version 2>&1 )
FINDBUGS_VER          :=$(call GetVersion,"$(_FINDBUGS_VER)")

ifdef ALT_BINDIR
  ALT_BINDIR_VERSION := $(shell $(ALT_BINDIR)/java$(EXE_SUFFIX) -version 2>&1  | $(NAWK) -F'"' '{ print $$2 }')
  ALT_BINDIR_OK := $(shell $(ECHO) $(ALT_BINDIR_VERSION) | $(EGREP) -c '^$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)')
endif

INSTALL_PATCHES_FILE = $(TEMPDIR)/installed.patches

# Get ALL_SETTINGS defined
include $(JDK_MAKE_SHARED_DIR)/Sanity-Settings.gmk

.PHONY: \
	sane-copyrightyear\
	sane-settings \
	sane-insane \
	sane-build_number \
	sane-os_version \
	sane-memory_check \
	sane-windows \
	sane-locale \
	sane-linux \
	sane-cygwin \
	sane-cygwin-shell \
	sane-mks \
	sane-arch_data_model \
	sane-os_patch_level \
	sane-classpath \
	sane-java_home \
	sane-fonts \
	sane-binary-plugs \
	sane-variant \
	sane-ld_library_path \
	sane-ld_library_path_64 \
	sane-ld_options \
	sane-ld_run_path \
	sane-makeflags \
	sane-alt_outputdir \
	sane-outputdir \
	sane-alt_bootdir \
	sane-bootdir \
	sane-motif \
        sane-cups \
	sane-devtools_path \
	sane-compiler_path \
	sane-unixcommand_path \
	sane-usrbin_path \
	sane-unixccs_path \
	sane-docs_import \
	sane-math_iso \
	sane-libCrun \
	sane-odbcdir \
	sane-msdevtools_path \
	sane-hotspot_binaries \
	sane-hotspot_import \
	sane-hotspot_import_dir \
	sane-hotspot_import_include \
	sane-compiler \
	sane-link \
	sane-cacerts \
	sane-alsa-versioncheck \
	sane-alsa-headers \
	sane-ant_version \
	sane-findbugs_version \
	sane-zip_version \
	sane-unzip_version \
 	sane-msvcrt_path \
        sane-freetype

######################################################
# check for COPYRIGHT_YEAR variable
######################################################
sane-copyrightyear:
ifdef ALT_COPYRIGHT_YEAR
	@$(ECHO) "WARNING: ALT_COPYRIGHT_YEAR but not the current year\n" \
			 	 " will be used for copyright year.\n " \
		"" >>$(WARNING_FILE)
endif

######################################################
# check for INSANE variable
######################################################
sane-insane:
ifdef INSANE
	@$(ECHO) "WARNING: You are building in 'INSANE' mode. You \n" \
	   "        should not use this mode, and in fact, \n" \
	   "        it may be removed at any time. If you \n" \
	   "        have build problems as a result of using \n" \
	   "        INSANE mode, then you should not expect \n" \
	   "        assistance from anyone with the problems \n" \
	   "        or consequences you experience. \n" \
	   "" >> $(WARNING_FILE)
endif

######################################################
# check for GNU Make version
######################################################
MAKE_CHECK :=$(call CheckVersions,$(MAKE_VER),$(REQUIRED_MAKE_VER))
sane-make:
	@if [ "$(MAKE_CHECK)" != "same" -a "$(MAKE_CHECK)" != "newer" ]; then \
	  $(ECHO) "WARNING: The version of make being used is older than \n" \
	    "      the required version of '$(REQUIRED_MAKE_VER)'. \n" \
	    "      The version of make found was '$(MAKE_VER)'. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi

######################################################
# Check the BUILD_NUMBER to make sure it contains bNN
######################################################
sane-build_number: 
	@if [ "`$(ECHO) $(BUILD_NUMBER) | $(SED) 's@.*b[0-9][0-9]*.*@bNN@'`" != "bNN" ] ; then \
	    $(ECHO) "WARNING: The BUILD_NUMBER needs to contain b[0-9][0-9]*. Currently BUILD_NUMBER=$(BUILD_NUMBER). \n" \
	      "        This has been known to cause build failures. \n" \
	      "" >> $(WARNING_FILE) ; \
	fi

######################################################
# Check the ARCH_DATA_MODEL setting
######################################################
sane-arch_data_model:
	@if [ "$(ARCH_DATA_MODEL)" != 32 -a "$(ARCH_DATA_MODEL)" != 64 ]; then \
	    $(ECHO) "ERROR: The setting of ARCH_DATA_MODEL must be 32 or 64.\n" \
	      "      $(YOU_ARE_USING) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL). \n" \
	      "" >> $(ERROR_FILE) ; \
	fi

######################################################
# Check the OS version (windows and linus have release name checks)
#   NOTE: OPENJDK explicitly does not check for OS release information.
#         Unless we know for sure that it will not build somewhere, we cannot
#         generate a fatal sanity error, and a warning about the official
#         build platform just becomes clutter.
######################################################
OS_CHECK :=$(call CheckVersions,$(OS_VERSION),$(REQUIRED_OS_VERSION))
sane-os_version:: sane-arch_data_model sane-memory_check sane-locale sane-os_patch_level
ifndef OPENJDK
	@if [ "$(OS_CHECK)" = "missing" ]; then \
	  $(ECHO) "ERROR: The $(PLATFORM) OS version is undefined (Try: uname -r). \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@if [ "$(OS_CHECK)" != "same" ]; then \
	  $(ECHO) "WARNING: $(THE_OFFICIAL_USES) OS version $(REQUIRED_OS_VERSION). \n" \
	    "        $(YOU_ARE_USING) OS version $(OS_VERSION). \n" \
	    "" >> $(WARNING_FILE) ; \
	fi
  ifeq ($(PLATFORM), windows)
	@if [ "$(WINDOWS_VERSION)" != "$(REQUIRED_WINDOWS_VERSION)" ]; then \
	    $(ECHO) "WARNING: $(YOU_ARE_USING) an unsupported version of $(REQUIRED_WINDOWS_NAME). \n" \
	      "        The supported version is $(REQUIRED_WINDOWS_NAME) $(REQUIRED_WINDOWS_VERSION). \n" \
	      "        $(YOU_ARE_USING) $(WINDOWS_VERSION) \n" \
	      "" >> $(WARNING_FILE) ; \
	fi
  endif # windows
  ifeq ($(PLATFORM), linux)
	@if [ `$(ECHO) "$(LINUX_VERSION)" | $(EGREP) -c '$(REQUIRED_LINUX_VER)'` -ne 1 ]; then \
	  $(ECHO) "WARNING: The build is being done on Linux $(LINUX_VERSION). \n" \
	    "        $(THE_OFFICIAL_USES) Linux $(REQUIRED_LINUX_VER), \n" \
	    "        specifically Linux $(REQUIRED_LINUX_FULLVER). \n" \
	    "        The version found was '$(OS_VERSION)'. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi
  endif # linux
endif # OPENJDK

ifeq ($(PLATFORM), windows)
  sane-os_version:: sane-cygwin sane-mks sane-cygwin-shell
endif

######################################################
# Check the memory available on this machine
######################################################
sane-memory_check:
	@if [ "$(LOW_MEMORY_MACHINE)" = "true" ]; then \
	  $(ECHO) "WARNING: This machine appears to only have $(MB_OF_MEMORY)Mb of physical memory, \n" \
	    "        builds on this machine could be slow. \n" \
	    "" >> $(WARNING_FILE) ; \
        fi

######################################################
# Check the locale (value of LC_ALL, not being empty or ==C can be a problem)
######################################################
sane-locale:
ifneq ($(PLATFORM), windows)
	@if [ "$(LC_ALL)" != "" -a "$(LC_ALL)" != "C" ]; then \
	  $(ECHO) "WARNING: LC_ALL has been set to $(LC_ALL), this can cause build failures. \n" \
	    "        Try setting LC_ALL to \"C\". \n" \
	    "" >> $(WARNING_FILE) ; \
        fi
	@if [ "$(LANG)" != "" -a "$(LANG)" != "C" ]; then \
	  $(ECHO) "WARNING: LANG has been set to $(LANG), this can cause build failures. \n" \
	    "        Try setting LANG to \"C\". \n" \
	    "" >> $(WARNING_FILE) ; \
        fi
endif

######################################################
# Check the Windows cygwin version
######################################################
ifeq ($(PLATFORM), windows)
  CYGWIN_CHECK :=$(call CheckVersions,$(CYGWIN_VER),$(REQUIRED_CYGWIN_VER))
sane-cygwin:
  ifdef USING_CYGWIN
	@if [ "$(CYGWIN_CHECK)" = "missing" ]; then \
	  $(ECHO) "ERROR: The CYGWIN version is undefined. \n" \
	    "      $(THE_OFFICIAL_USES) CYGWIN $(REQUIRED_CYGWIN_VER). \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@if [ "$(CYGWIN_CHECK)" = "older" ]; then \
	  $(ECHO) "ERROR: The build cannot be done on CYGWIN $(CYGWIN_VER). \n" \
	    "      Use CYGWIN $(REQUIRED_CYGWIN_VER) or higher. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  endif
endif

######################################################
# Check the cygwin shell is used, not cmd.exe
######################################################
ifeq ($(PLATFORM), windows)
sane-cygwin-shell:
  ifdef USING_CYGWIN
	@if [ "$(SHLVL)" = "" -a "$(_)" = "" ]; then \
	  $(ECHO) "ERROR: You are using an unsupported shell. \n" \
	    "      Use either sh, bash, ksh, zsh, or tcsh. \n" \
	    "      Using the cmd.exe utility is not supported. \n" \
	    "      If you still want to try your current shell, \n" \
	    "      please export SHLVL=1 when running $(MAKE).  \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  endif
endif

######################################################
# Check the Windows mks version
######################################################
ifeq ($(PLATFORM), windows)
    MKS_CHECK :=$(call CheckVersions,$(MKS_VER),$(REQUIRED_MKS_VER))
sane-mks:
  ifndef USING_CYGWIN
	@if [ "$(MKS_CHECK)" = "missing" ]; then \
	  $(ECHO) "ERROR: The MKS version is undefined. \n" \
	    "      $(THE_OFFICIAL_USES) MKS $(REQUIRED_MKS_VER). \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@if [ "$(MKS_CHECK)" = "older" ]; then \
	  $(ECHO) "ERROR: The build cannot be done on MKS $(MKS_VER). \n" \
	    "      Use MKS $(REQUIRED_MKS_VER) or higher. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  endif
endif

######################################################
# Get list of installed patches (this file has a particular format)
######################################################
$(INSTALL_PATCHES_FILE):
	@$(prep-target)
ifeq ($(PLATFORM), solaris)
  ifeq ($(OS_VERSION),$(REQUIRED_OS_VERSION))
	$(SHOWREV) -p > $@ 2>&1
  endif
endif
	@$(ECHO) "" >> $@

######################################################
# Check list of Solaris patches
######################################################
sane-os_patch_level: $(INSTALL_PATCHES_FILE)
ifeq ($(PLATFORM), solaris)
  ifeq ($(OS_VERSION),$(REQUIRED_OS_VERSION))
	@$(NAWK) 'BEGIN { \
    readingInstallPatches = 0; \
    requiredCount = 0; \
    installCount = 0; \
} \
{ \
    if (readingInstallPatches) { \
        if ($$1=="Patch:") { \
            ns = split($$2,parts,"-");  \
            installPatchNo[installCount]=parts[1]; \
            installPatchRev[installCount]=parts[2]; \
            installCount++; \
        } \
    } \
     \
    if (!readingInstallPatches) { \
        if (index($$1,"#") != 0) continue; \
        if (match($$1,"BUILD") > 0 \
        && $$2 == $(OS_VERSION) \
        && ($$7 == "REQ" || $$7 == "req") \
        && $(PATCH_POSITION) != "none" \
        && $(PATCH_POSITION) != "NONE") { \
            ns = split($(PATCH_POSITION),parts,"-");  \
            requiredPatchNo[requiredCount]=parts[1]; \
            requiredPatchRev[requiredCount]=parts[2]; \
            requiredCount++; \
       } \
    } \
} \
END { \
    errorCount=0; \
    for (i=0; i<requiredCount; i++) { \
        foundMatch = 0; \
        for (j=0; j<installCount; j++) { \
            if (installPatchNo[j] == requiredPatchNo[i] \
            && installPatchRev[j] >= requiredPatchRev[i]) { \
                foundMatch = 1; \
                break; \
            } \
        } \
        if ( foundMatch == 0) { \
            printf("WARNING: Your solaris install is missing the required patch %s-%s\n", requiredPatchNo[i], requiredPatchRev[i] ); \
            printf("         Please update your your system patches or build on a different machine.\n\n" ); \
            errorCount++; \
        } \
    } \
}' $(REQ_PATCH_LIST) readingInstallPatches=1 $(INSTALL_PATCHES_FILE) >> $(WARNING_FILE)
  endif
endif # PLATFORM

######################################################
# CLASSPATH cannot be set, unless you are insane.
######################################################
sane-classpath:
ifdef CLASSPATH
	@$(ECHO) "ERROR: Your CLASSPATH environment variable is set.  This will \n" \
	   "      most likely cause the build to fail.  Please unset it \n" \
	   "      and start your build again. \n" \
	   "" >> $(ERROR_FILE)
endif

######################################################
# JAVA_HOME cannot be set, unless you are insane.
######################################################
sane-java_home:
ifdef JAVA_HOME
	@$(ECHO) "ERROR: Your JAVA_HOME environment variable is set.  This will \n" \
	   "      most likely cause the build to fail.  Please unset it \n" \
	   "      and start your build again. \n" \
	   "" >> $(ERROR_FILE)
endif

######################################################
# Make sure the fonts are there
# Exceptions are when explicitly building OPENJDK, or
# when the entire CLOSED_SRC dir is excluded, so we are
# implicitly building OPENJDK
######################################################
FONT_FILE=$(CLOSED_SRC)/share/lib/fonts/LucidaTypewriterRegular.ttf
sane-fonts:
ifndef OPENJDK
	@if [ -d $(CLOSED_SRC) ] ; then \
	 if [ ! -f $(FONT_FILE) ] ; then \
	  $(ECHO) "ERROR: Missing $(FONT_FILE). \n" \
	   "      Verify you have downloaded and overlayed on the source area all the binary files. \n" \
	   "" >> $(ERROR_FILE); \
	fi \
	fi
endif

######################################################
# If building OPENJDK check pre-built binaries are
# available for binary plug source components.
######################################################
ifdef OPENJDK
sane-binary-plugs:
ifeq ($(IMPORT_BINARY_PLUGS),true)
	@if [ ! -d "$(BINARY_PLUGS_PATH)" ]; then \
	  $(ECHO) "ERROR: Can't locate pre-built libraries. \n" \
	    "      Please check your access to \n" \
	    "          $(BINARY_PLUGS_PATH) \n" \
	    "      and/or check your value of ALT_BINARY_PLUGS_PATH. \n" \
	   "" >> $(ERROR_FILE); \
	fi
endif
endif

######################################################
# VARIANT must be set to DBG or OPT
######################################################
sane-variant:
	@if [ "$(VARIANT)" != DBG -a "$(VARIANT)" != OPT ] ; then \
	  $(ECHO) "ERROR: Your VARIANT environment variable is set to $(VARIANT). \n" \
	   "      Needs to be set to DBG or OPT \n" \
	   "" >> $(ERROR_FILE); \
	fi

######################################################
# LD_LIBRARY_PATH should not be set, unless you are insane.
######################################################
sane-ld_library_path:
ifdef LD_LIBRARY_PATH
	@$(ECHO) "ERROR: Your LD_LIBRARY_PATH environment variable is set.  This may \n" \
	   "      produce binaries binaries incorrectly.  Please unset it \n" \
	   "      and start your build again. \n" \
	   "" >> $(ERROR_FILE)
endif

######################################################
# LD_LIBRARY_PATH_64 should not be set, unless you are insane.
######################################################
sane-ld_library_path_64:
ifdef LD_LIBRARY_PATH_64
	@$(ECHO) "ERROR: Your LD_LIBRARY_PATH_64 environment variable is set.  This may \n" \
	   "      produce binaries binaries incorrectly.  Please unset it \n" \
	   "      and start your build again. \n" \
	   "" >> $(ERROR_FILE)
endif

######################################################
# LD_OPTIONS should not be set, unless you are insane.
######################################################
sane-ld_options:
ifdef LD_OPTIONS
	@$(ECHO) "ERROR: Your LD_OPTIONS environment variable is set.  This may \n" \
	   "      produce binaries binaries incorrectly.  Please unset it \n" \
	   "      and start your build again. \n" \
	   "" >> $(ERROR_FILE)
endif

######################################################
# LD_RUN_PATH should not be set, unless you are insane.
######################################################
sane-ld_run_path:
ifdef LD_RUN_PATH
	@$(ECHO) "ERROR: Your LD_RUN_PATH environment variable is set.  This may \n" \
	   "      produce binaries binaries incorrectly.  Please unset it \n" \
	   "      produce binaries binaries incorrectly.  Please unset it \n" \
	   "      and start your build again. \n" \
	   "" >> $(ERROR_FILE)
endif

######################################################
# MAKEFLAGS cannot be set, unless you are insane.
######################################################
ifeq ($(PLATFORM), windows)
ifdef USING_CYGWIN
REAL_MAKEFLAGS:=$(subst --unix,,$(MAKEFLAGS))
else
REAL_MAKEFLAGS:=$(MAKEFLAGS)
endif
else
REAL_MAKEFLAGS:=$(MAKEFLAGS)
endif
sane-makeflags:
# ifneq ($(strip $(REAL_MAKEFLAGS)),)
ifeq ($(origin MAKEFLAGS),environment)
	@#
	@# it is unacceptable to have the-e or --environment-overrides value in MAKEFLAGS
	@#
	@if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(e|--environment-overrides)( |$$)'` -ne 0 ]; then \
	  $(ECHO) "ERROR: Either the build was started with the flag -e or \n" \
	    "      --environment-overrides, or the MAKEFLAGS environment \n" \
	    "      variable has this value set.  This will cause any \n" \
	    "      environment variables you have defined to override \n" \
	    "      the values defined by the makefiles. This practice is \n" \
	    "      not recommemded by the authors of GNU Make, and \n" \
	    "      will lead to an improper build. \n" \
	    "      Please fix and restart the build. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# it is unacceptable to havethe -i or --ignore-errors value in MAKEFLAGS
	@#
	@if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(i|--ignore-errors)( |$$)'` -ne 0 ]; then \
	  $(ECHO) "ERROR: Either the build was started with the flag -i or \n" \
	    "      --ignore-errors, or the MAKEFLAGS environment \n" \
	    "      variable has this value set. 1111 You will be unable \n" \
	    "      to determine if the build is broken or not. \n" \
	    "      Please fix and restart the build. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# it is unacceptable to have the -I or --include-dir value in MAKEFLAGS
	@#
	@if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(I|--include-dir)( |$$)'` -ne 0 ]; then \
	  $(ECHO) "ERROR: Either the build was started with the flag -I or \n" \
	    "      --include-dir, or the MAKEFLAGS environment \n" \
	    "      variable has this value set.  This will render your \n" \
	    "      build questionable as not all the rules and depenencies \n" \
	    "      are captured by the build. \n" \
	    "      Please fix and restart the build. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# it is unacceptable to have the -k or --keep-going value in MAKEFLAGS:
	@#
	@if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(k|--keep-going)( |$$)'` -ne 0 ]; then \
	  $(ECHO) "ERROR: Either the build was started with the flag -k or \n" \
	    "      --keep-going, or the MAKEFLAGS environment \n" \
	    "      variable has this value set. 222 You will be unable \n" \
	    "      to determine if the build is broken or not. \n" \
	    "      Please fix and restart the build.  \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# it is unacceptable to have the -o or --assume-old or --old-filevalue in MAKEFLAGS:
	@# Note - this rule never gets invoked because it is processed out
	@#        in GNU Make startup
	@#
	@if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(o|--assume-old|--old-file)( |$$)'` -ne 0 ]; then \
	  $(ECHO) "ERROR: Either the build was started with the flag -o or \n" \
	    "      --assume-old or --old-file, or the MAKEFLAGS environment \n" \
	    "      variable has this value set.  This could prevent the \n" \
	    "      build from executing rules it should, thus rendering a \n" \
	    "      questionable result. \n" \
	    "      Please fix and restart the build. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# it is unacceptable to have the -r or --nobuiltin-rules value in MAKEFLAGS
	@#
	@if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(r|--no-builtin-rules)( |$$)'` -ne 0 ]; then \
	  $(ECHO) "ERROR: Either the build was started with the flag -r or \n" \
	    "      --no-builtin-rules, or the MAKEFLAGS environment \n" \
	    "      variable has this value set.  This may break the build \n" \
	    "      by not allowing builtin rules that may be required. \n" \
	    "      Please fix and restart the build. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# it is unacceptable to have the -t or --touch value in MAKEFLAGS
	@# Note - this rule never gets invoked because it is processed out
	@#        in GNU Make startup
	@#
	@if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(t|--touch)( |$$)'` -ne 0 ]; then \
	  $(ECHO) "ERROR: Either the build was started with the flag -t or \n" \
	    "      --touch, or the MAKEFLAGS environment \n" \
	    "      variable has this value set.  This will leave the \n" \
	    "      build in a unclear state and could lead to not executing \n" \
	    "      rules which should be executed. \n" \
	    "      Please fix and restart the build. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# show what is in MAKEFLAGS so the user is aware...
	@#
	@$(ECHO) "WARNING: Your MAKEFLAGS environment variable is set. \n" \
	   "        You should be very careful about the values set here. \n" \
	   "\n" \
	   "        MAKEFLAGS is set to =>$(MAKEFLAGS)<= \n" \
	   "" >> $(WARNING_FILE)
endif

######################################################
# if specified, ALT_OUTPUTDIR must point to non-relative path if set
######################################################
sane-alt_outputdir:
ifdef ALT_OUTPUTDIR
	@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
	  $(ECHO) "ERROR: ALT_OUTPUTDIR must be an Absolute Path Name, \n" \
	    "      not a Relative Path Name. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  ifeq ($(PLATFORM), windows)
	@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -ci '^([a-z]:)'` -ne 1 ]; then \
	  $(ECHO) "ERROR: On windows, ALT_OUTPUTDIR must contain the drive letter. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  endif
endif

######################################################
# OUTPUTDIR tests
######################################################
sane-outputdir:
	@#
	@# OUTPUTDIR must be a directory...
	@#
	@if [ ! -d "$(OUTPUTDIR)" ]; then \
	  $(ECHO) "ERROR: OUTPUTDIR must be an existing directory. The current \n" \
	    "      value of OUTPUTDIR is \n" \
	    "          $(OUTPUTDIR) \n" \
	    "      Please check your value of ALT_OUTPUTDIR. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# OUTPUTDIR must be writeable by user...
	@#
	@if [ ! -w "$(OUTPUTDIR)" ]; then \
	  $(ECHO) "ERROR: You must have write permissions to OUTPUTDIR. The \n" \
	    "      current value of OUTPUTDIR is \n" \
	    "          $(OUTPUTDIR) \n" \
	    "      Either obtain these permissions or set ALT_OUTPUTDIR. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# OUTPUTDIR must have enough free space...
	@#
	@if [ $(FREE_SPACE) -lt $(REQUIRED_FREE_SPACE) ]; then \
	  $(ECHO) "WARNING: You may not have enough free space in your OUTPUTDIR. The \n" \
	    "        current value of OUTPUTDIR is \n" \
	    "            $(OUTPUTDIR) \n" \
	    "        You need "$(REQUIRED_FREE_SPACE)" Kbytes free on this device to build \n" \
	    "        and it appears that only "$(FREE_SPACE)" Kbytes are free. \n" \
	    "        Either obtain more space or set ALT_OUTPUTDIR to a larger disk. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi

######################################################
# if specified, ALT_BOOTDIR must point to non-relative path if set
######################################################
sane-alt_bootdir:
ifdef ALT_BOOTDIR
	@if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
	  $(ECHO) "ERROR: ALT_BOOTDIR must be an Absolute Path Name, \n" \
	    "      not a Relative Path Name. \n" \
	    "      The current value of ALT_BOOTDIR is \n" \
	    "          $(ALT_BOOTDIR) \n" \
	    "      Please fix this and continue your build. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
endif

######################################################
# BOOTDIR must point to a valid JDK.
######################################################
BOOT_CHECK :=$(call CheckVersions,$(BOOT_VER),$(REQUIRED_BOOT_VER))
sane-bootdir:
	@if [ "$(BOOT_CHECK)" != "same" -a "$(BOOT_CHECK)" != "newer" ]; then \
	  $(ECHO) "ERROR: Your BOOTDIR environment variable does not point \n" \
	    "      to a valid JDK for bootstrapping this build. \n" \
	    "      A JDK $(JDK_MINOR_VERSION) $(MARKET_NAME) build must be bootstrapped using  \n" \
	    "      JDK $(PREVIOUS_JDK_VERSION) fcs (or later). \n" \
	    "      Apparently, your bootstrap JDK is version $(BOOT_VER) \n" \
	    "      Please update your ALT_BOOTDIR setting and start your build again. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi

######################################################
# CACERTS_FILE must be absoulte path and readable
######################################################
sane-cacerts:
  ifdef ALT_CACERTS_FILE
	@if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
	  $(ECHO) "ERROR: ALT_CACERTS_FILE must be an Absolute Path Name, \n" \
	    "      not a Relative Path Name. \n" \
	    "      The current value of ALT_CACERTS_FILE is \n" \
	    "          $(ALT_CACERTS_FILE) \n" \
	    "      Please fix this and continue your build. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  endif
	@#
	@# CACERTS_FILE must be readable
	@#
	@if [ ! -r "$(subst \,/,$(CACERTS_FILE))" ]; then \
	  $(ECHO) "ERROR: You do not have access to a valid cacerts file. \n" \
	    "      Please check your access to \n" \
	    "          $(subst \,/,$(CACERTS_FILE)) \n" \
	    "      and/or check your value of ALT_CACERTS_FILE. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# CACERTS_FILE must be a file
	@#
	@if [ -d "$(subst \,/,$(CACERTS_FILE))" ]; then \
	  $(ECHO) "ERROR: You do not have access to a valid cacerts file.\n" \
	    "      The value of CACERTS_FILE must point to a normal file.\n" \
	    "      Please check your access to \n" \
	    "          $(subst \,/,$(CACERTS_FILE)) \n" \
	    "      and/or check your value of ALT_CACERTS_FILE. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi

######################################################
# Check for existence of Motif in the bootstrap area
######################################################
MOTIF_CHECK_FILE=$(MOTIF_INCLUDE)/Xm/AtomMgr.h
sane-motif:
ifneq ($(PLATFORM), windows)
  ifeq ($(MOTIF_REQUIRED), true)
    ifeq ($(PLATFORM), solaris)
	@if [ ! -r $(MOTIF_LIB)/libXm.so ]; then \
	  $(ECHO) "ERROR: You do not have access to a valid Motif 2.1 library. \n" \
	    "      Please check your access to \n" \
	    "          $(MOTIF_LIB)/libXm.so \n" \
	    "      and/or check your value of ALT_MOTIF_DIR. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
    endif  
    ifeq ($(PLATFORM), linux)
	@if [ ! -r $(MOTIF_LIB)/libXm.a ]; then \
	  $(ECHO) "ERROR: You do not have access to a valid Motif 2.1 library. \n" \
	    "      Please check your access to \n" \
	    "          $(MOTIF_LIB)/libXm.a \n" \
	    "      and/or check your value of ALT_MOTIF_DIR. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
    endif  
  endif  
	@if [ ! -r $(MOTIF_CHECK_FILE) ]; then \
	  $(ECHO) "ERROR: You do not have access to valid Motif 2.1 header files. \n" \
	    "      Please check your access to (for example) \n" \
	    "          $(MOTIF_CHECK_FILE) \n" \
	    "      and/or check your value of ALT_MOTIF_DIR. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
endif

######################################################
# Check for availability of FreeType (OpenJDK specific)
######################################################

ifdef OPENJDK

#name of test program that prints out "Failed" if freetype is not good enough
FREETYPE_VERSION_CHECK_NAME = freetype_versioncheck
FREETYPE_VERSION_CHECK = $(TEMPDIR)/$(FREETYPE_VERSION_CHECK_NAME)$(EXE_SUFFIX)

sane-freetype:
	@-($(CD) $(BUILDDIR)/tools/freetypecheck && \
	$(MAKE) REQUIRED_FREETYPE_VERSION=$(REQUIRED_FREETYPE_VERSION) \
	        FT_TEST=$(FREETYPE_VERSION_CHECK_NAME) \
	        FT_HEADERS=$(FREETYPE_HEADERS_PATH) \
	        FT_LIB=$(FREETYPE_LIB_PATH) \
	        XARCH=$(XARCH))
	@if [ ! -r $(FREETYPE_VERSION_CHECK) -o \
	  "`$(FREETYPE_VERSION_CHECK) | $(GREP) Fail`" != "" ]; then \
	  $(ECHO) "ERROR: FreeType version " $(REQUIRED_FREETYPE_VERSION) \
	          "or higher is required. \n" >> $(ERROR_FILE) ; \
	fi

else
#do nothing  (not OpenJDK)
sane-freetype: 
endif

######################################################
# CUPS_HEADERS_PATH must be valid
######################################################
sane-cups:
ifneq ($(PLATFORM), windows)
	@if [ ! -r $(CUPS_HEADERS_PATH)/cups/cups.h ]; then \
	  $(ECHO) "ERROR: You do not have access to valid Cups header files. \n" \
	    "      Please check your access to \n" \
	    "          $(CUPS_HEADERS_PATH)/cups/cups.h \n" \
	    "      and/or check your value of ALT_CUPS_HEADERS_PATH, \n" \
	    "      CUPS is frequently pre-installed on many systems, \n" \
            "      or may be downloaded from http://www.cups.org \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
endif

######################################################
# Check for existence of DEVTOOLS_PATH
######################################################
sane-devtools_path:
	@if [ "$(DEVTOOLS_PATH)" != "" -a ! -r "$(DEVTOOLS_PATH)" ]; then \
	  $(ECHO) "ERROR: You do not have a valid DEVTOOLS_PATH setting. \n" \
	    "      Please check your access to \n" \
	    "          $(DEVTOOLS_PATH) \n" \
	    "      and/or check your value of ALT_DEVTOOLS_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi

######################################################
# Check for existence of MS_RUNTIME_LIBRARIES
######################################################
sane-msvcrt_path:
ifeq ($(PLATFORM), windows)
	@if [ ! -r "$(MSVCRT_DLL_PATH)/msvcrt.dll" ]; then \
	  $(ECHO) "ERROR: You do not have access to msvcrt.dll. \n" \
	    "      Please check your access to \n" \
	    "          $(MSVCRT_DLL_PATH) \n" \
	    "      and/or check your value of ALT_MSVCRT_DLL_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  ifeq ($(ARCH_DATA_MODEL), 32)
    ifeq ($(COMPILER_VERSION), VS2003)
	@if [ ! -r "$(MSVCR71_DLL_PATH)/msvcr71.dll" ]; then \
	  $(ECHO) "ERROR: You do not have access to msvcr71.dll. \n" \
	    "      Please check your access to \n" \
	    "          $(MSVCR71_DLL_PATH) \n" \
	    "      and/or check your value of ALT_MSVCR71_DLL_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
    endif
  endif
endif

######################################################
# Check for existence of COMPILER_PATH
######################################################
sane-compiler_path:
	@if [ "$(COMPILER_PATH)" != "" -a ! -r "$(COMPILER_PATH)" ]; then \
	  $(ECHO) "ERROR: You do not have a valid COMPILER_PATH setting. \n" \
	    "      Please check your access to \n" \
	    "          $(COMPILER_PATH) \n" \
	    "      and/or check your value of ALT_COMPILER_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi

######################################################
# Check for existence of UNIXCOMMAND_PATH
######################################################
sane-unixcommand_path:
	@if [ "$(UNIXCOMMAND_PATH)" != "" -a ! -r "$(UNIXCOMMAND_PATH)" ]; then \
	  $(ECHO) "ERROR: You do not have a valid UNIXCOMMAND_PATH setting. \n" \
	    "      Please check your access to \n" \
	    "          $(UNIXCOMMAND_PATH) \n" \
	    "      and/or check your value of ALT_UNIXCOMMAND_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
ifeq ($(PLATFORM), windows)
	@for utility in cpio ar file m4 ; do \
	  if [ ! -r "`$(WHICH) $${utility}`" ]; then \
	    $(ECHO) "WARNING: You do not have the utility $${utility} in the \n" \
	      "      directory $(UNIXCOMMAND_PATH). \n" \
	      "      The utilities cpio, ar, file, and m4 are required. \n" \
	      "" >> $(WARNING_FILE) ; \
	  fi; \
	done
endif

######################################################
# Check for existence of USRBIN_PATH on linux
######################################################
sane-usrbin_path:
ifeq ($(PLATFORM), linux)
	@if [ "$(USRBIN_PATH)" != "" -a ! -r "$(USRBIN_PATH)" ]; then \
	    $(ECHO) "ERROR: You do not have a valid USRBIN_PATH setting. \n" \
	      "      Please check your access to \n" \
	      "          $(USRBIN_PATH)  \n" \
	      "      and/or check your value of ALT_USRBIN_PATH. \n" \
	      "" >> $(ERROR_FILE) ; \
	  fi
endif

######################################################
# Check for existence of UNIXCCS_PATH on solaris
######################################################
sane-unixccs_path:
ifeq ($(PLATFORM), solaris)
	@if [ "$(UNIXCCS_PATH)" != "" -a ! -r "$(UNIXCCS_PATH)" ]; then \
	  $(ECHO) "ERROR: You do not have a valid UNIXCCS_PATH setting. \n" \
	    "      Please check your access to \n" \
	    "          $(UNIXCCS_PATH) \n" \
	    "      and/or check your value of ALT_UNIXCCS_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	  fi
endif

######################################################
# Verify the docs directory exists
######################################################
sane-docs_import:
	@if [ ! -d "$(HOTSPOT_DOCS_IMPORT_PATH)" ]; then \
	    $(ECHO) "WARNING: The directory HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_DOCS_IMPORT_PATH) \n" \
	      "      does not exist, check your value of ALT_HOTSPOT_DOCS_IMPORT_PATH. \n" \
	      "" >> $(WARNING_FILE) ; \
	fi

######################################################
# Check for possible problem regarding __fabsf,  math_iso.h and the libm patch.
#    Hotspot should have been changed in Mustang 6.0 Build 47 to not depend
#    on __fabsf, this is just checking that fact now.
######################################################
sane-math_iso:
ifeq ($(PLATFORM), solaris)
	@if [ -f $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
	  if [ "`$(NM) $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) | $(GREP) __fabsf`" != "" ]; then \
	    $(ECHO) "WARNING: This version of hotspot relies on __fabsf \n" \
	      "        which is not always available on Solaris 8 and 9 machines \n" \
	      "        unless they have the latest libm patch and the file \n" \
	      "        /usr/include/iso/math_iso.h which can trigger this dependency.\n" \
	      "        Hotspot should NOT be dependent on this extern, check the \n" \
	      "        version of the hotspot library you are using. \n" \
	      "" >> $(WARNING_FILE) ; \
	    fi; \
	fi
endif

######################################################
# Check for possible patch problem regarding /usr/lib/libCrun.so
######################################################
sane-libCrun:
ifeq ($(PLATFORM), solaris)
	@if [ "`$(NM) /usr/lib/libCrun.so.1 | $(GREP) __1c2n6FIpv_0_`" = "" ]; then \
	  $(ECHO) "WARNING: The file /usr/lib/libCrun.so.1 is missing the extern \n" \
	    "        __1c2n6FIpv_0_ which indicates that the system is missing \n" \
	    "        a required Solaris patch, or you are using a pre-FCS release \n" \
	    "        of Solaris 10. You need the latest /usr/lib/libCrun.so.1 \n" \
	    "        which comes with the FCS release of Solaris 10 and available \n" \
	    "        through the latest Solaris 8 or 9 C++ runtime patches. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi
endif

######################################################
# Check for existence of MSDEVTOOLS_PATH on windows
######################################################
sane-msdevtools_path:
ifeq ($(PLATFORM), windows)
	@if [ "$(MSDEVTOOLS_PATH)" != "" -a ! -r "$(MSDEVTOOLS_PATH)" ]; then \
	  $(ECHO) "ERROR: You do not have a valid MSDEVTOOLS_PATH setting. \n" \
	    "      Please check your access to \n" \
	    "          $(MSDEVTOOLS_PATH) \n" \
	    "      and/or check your value of ALT_MSDEVTOOLS_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
endif

######################################################
# Check for existence of Hotspot binaries
######################################################
sane-hotspot_binaries:
ifeq ($(ARCH_DATA_MODEL), 32)
	@if [ ! -r $(HOTSPOT_CLIENT_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
	  $(ECHO) "ERROR: HOTSPOT_CLIENT_PATH does not point to a valid HotSpot VM. \n" \
	    "      Please check your access to \n" \
	    "          $(HOTSPOT_CLIENT_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) \n" \
	    "      and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
endif
	@if [ ! -r $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
	  $(ECHO) "ERROR: HOTSPOT_SERVER_PATH does not point to a valid HotSpot VM. \n" \
	    "      Please check your access to \n" \
	    "          $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) \n" \
	    "      and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# Check value of HOTSPOT_LIB_PATH
	@#
ifeq ($(PLATFORM), windows)
	@if [ ! -r $(HOTSPOT_LIB_PATH)/jvm.lib ]; then \
	  $(ECHO) "ERROR: HOTSPOT_LIB_PATH does not point to a valid HotSpot library. \n" \
	    "      Please check your access to \n" \
	    "          $(HOTSPOT_LIB_PATH)/jvm.lib \n" \
	    "      and/or check your value of ALT_HOTSPOT_LIB_PATH. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@#
	@# Check for the .map files - its OK if they are not there..
	@#
  ifeq ($(ARCH_DATA_MODEL), 32)
	@# There is no 64-bit HotSpot client VM
	@if [ ! -r $(HOTSPOT_CLIENT_PATH)/jvm.map ]; then \
	  $(ECHO) "WARNING: HOTSPOT_CLIENT_PATH does not point to valid HotSpot .map files. \n" \
	    "        These files are optional and aid in the debugging of the JVM. \n" \
	    "        Please check your access to \n" \
	    "          $(HOTSPOT_CLIENT_PATH)/jvm.map \n" \
	    "        and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi
	@if [ ! -r $(HOTSPOT_CLIENT_PATH)/jvm.pdb ]; then \
	  $(ECHO) "WARNING: HOTSPOT_CLIENT_PATH does not point to valid HotSpot .pdb files. \n" \
	    "        These files are optional and aid in the debugging of the JVM. \n" \
	    "        Please check your access to \n" \
	    "          $(HOTSPOT_CLIENT_PATH)/jvm.pdb \n" \
	    "        and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi
  endif
	@if [ ! -r $(HOTSPOT_SERVER_PATH)/jvm.map ]; then \
	  $(ECHO) "WARNING: HOTSPOT_SERVER_PATH does not point to valid HotSpot .map files. \n" \
	    "        These files are optional and aid in the debugging of the JVM. \n" \
	    "        Please check your access to \n" \
	    "          $(HOTSPOT_SERVER_PATH)/jvm.map \n" \
	    "        and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi
	@if [ ! -r $(HOTSPOT_SERVER_PATH)/jvm.pdb ]; then \
	  $(ECHO) "WARNING: HOTSPOT_SERVER_PATH does not point to valid HotSpot .pdb files. \n" \
	    "        These files are optional and aid in the debugging of the JVM. \n" \
	    "        Please check your access to \n" \
	    "          $(HOTSPOT_SERVER_PATH)/jvm.pdb \n" \
	    "        and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi
endif	


######################################################
# Check for existence of misc Hotspot imported files
######################################################
HOTSPOT_INCLUDE_FILE_LIST  = jvmti.h
#HOTSPOT_INCLUDE_FILE_LIST += jni.h jni_md.h
#HOTSPOT_INCLUDE_FILE_LIST += jvm.h jvm_md.h
#HOTSPOT_INCLUDE_FILE_LIST += jmm.h
TMP_SDK_INCLUDE_FILE_LIST=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.h)
TMP_SDK_INCLUDE_FILE_DIFFS=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.hdiffs)

# These include files must have a pattern: 'version: MAJOR.MINOR.MICRO'
#    where MACRO, MINOR, and MICRO are numbers, e.g. 1.0.1, 0.2.90, etc.
#    The critical version we are checking is MAJOR.MINOR, we print all three
#    when we detect an error.

TMP_SDK_INCLUDE_FIND_VERSION= $(EGREP) 'version:'
TMP_SDK_INCLUDE_GET_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \
		$(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9].*@\1@'
TMP_SDK_INCLUDE_GET_FULL_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \
		$(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*@\1@'

# Compare an interface file (Rule creates 2 temp files: %.h and %.h.IMPORT)
#    Files jvm.h, jvm_md.h and jmm.h are special in that they are not publicly 
#    exported but do represent VM interfaces used by the rest of the jdk.
#    So these 3 will not be found in a promoted build and can only
#    be checked when this represents a full control build (i.e. the
#    HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory).
$(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
	@$(install-file)
	@$(RM) $@.IMPORT
	@if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \
	  $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \
	elif [ "$(@F)" != "jvm.h" -a "$(@F)" != "jmm.h" ] ; then \
	  $(ECHO) "WARNING: HOTSPOT_IMPORT_PATH does not contain the interface file $(@F). \n" \
	    "        Check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
	    "" >> $(WARNING_FILE) ; \
	  $(CP) $< $@.IMPORT; \
	else \
	  $(CP) $< $@.IMPORT; \
	fi

$(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h
	@$(install-file)
	@$(RM) $@.IMPORT
	@if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \
	  $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \
	elif [ "$(@F)" != "jvm_md.h" ] ; then \
	  $(ECHO) "WARNING: HOTSPOT_IMPORT_PATH does not contain the interface file $(@F). \n" \
	    "        Check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
	    "" >> $(WARNING_FILE) ; \
	  $(CP) $< $@.IMPORT; \
	else \
	  $(CP) $< $@.IMPORT; \
	fi

# Compares the two tempfiles: %.h and %.h.IMPORT, answer in %.hdiffs
#   Note: Putting anything into the hdiffs file will trigger generic IMPORT
#         warning message in hotspot_import_include.
#   First checks the major.minor versions, the micro number can differ.
#   Second checks the full version.
#   Lastly does a full diff if the full version differs or it has no version
$(TEMPDIR)/%.hdiffs: $(TEMPDIR)/%.h
	@$(prep-target)
	@$(TOUCH) $@
	@if [ "`$(CAT) $<        | $(TMP_SDK_INCLUDE_GET_VERSION)`" != \
	      "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_VERSION)`" ] ; then \
	    $(ECHO) "WARNING: The file $(<F) is not the same interface as the VM version.\n " \
	      "        this workspace has $(<F) `$(CAT) $< | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)` and \n " \
	      "        HOTSPOT_IMPORT_PATH contains $(<F) `$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)` \n" \
	    "" >> $(WARNING_FILE) ; \
	     $(ECHO) "Version mis-match" > $@ ; \
	fi
	@if [ "`$(CAT) $<        | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" != \
               "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" ] ; then \
          $(RM) $<.filtered  $<.IMPORT.filtered; \
          $(EGREP) -v 'VERSION' $< > $<.filtered; \
          $(EGREP) -v 'VERSION' $<.IMPORT > $<.IMPORT.filtered; \
          ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \
        elif [ "`$(CAT) $< | $(TMP_SDK_INCLUDE_FIND_VERSION)`" = "" ] ; then \
          $(RM) $<.filtered  $<.IMPORT.filtered; \
          $(EGREP) -v '@\(#\)' $< > $<.filtered; \
          $(EGREP) -v '@\(#\)' $<.IMPORT > $<.IMPORT.filtered; \
          ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \
	fi

# Verify all imported hotspot files
sane-hotspot_import:: sane-hotspot_import_dir sane-hotspot_import_include

# Verify the base directory exists
sane-hotspot_import_dir:
	@$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS)
	@$(RM) $(TMP_SDK_INCLUDE_FILE_LIST)
	@if [ ! -d "$(HOTSPOT_IMPORT_PATH)" ]; then \
	    $(ECHO) "WARNING: The directory HOTSPOT_IMPORT_PATH=$(HOTSPOT_IMPORT_PATH) \n" \
	      "      does not exist, check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
	      "" >> $(WARNING_FILE) ; \
	fi

# Verify hotspot include files
sane-hotspot_import_include: $(TMP_SDK_INCLUDE_FILE_LIST) $(TMP_SDK_INCLUDE_FILE_DIFFS)
	@if [ "`$(CAT) $(TMP_SDK_INCLUDE_FILE_DIFFS)`" != "" ] ; then \
	  $(ECHO) "WARNING: Possible HotSpot VM interface conflict. \n" \
	    "        HOTSPOT_IMPORT_PATH is used to import files from the VM build. \n" \
	    "        It is also used to verify that any copied files are consistent between \n" \
	    "        these two components. It has been detected that one or more of the \n" \
	    "        VM interface files inside this workspace may not match the interfaces \n" \
	    "        exported by the VM, or the VM versions could not be found. \n" \
	    "        The list of VM interface files is: \n" \
	    "            $(HOTSPOT_INCLUDE_FILE_LIST). \n" \
	    "        This workspace has copies of these files at: \n" \
	    "          $(SHARE_SRC)/javavm/export and $(PLATFORM_SRC)/javavm/export \n" \
	    "        for build purposes, and they should contain the same interfaces \n" \
	    "        as the VM versions imported from: \n" \
	    "          \$$(HOTSPOT_IMPORT_PATH)/include \n" \
	    "               (i.e. $(HOTSPOT_IMPORT_PATH)/include) \n" \
	    "        If an interface indeed doesn't match, then the use of this interface \n" \
	    "        at JDK runtime could cause serious errors. \n" \
	    "" >> $(WARNING_FILE) ; \
	    for i in $(TMP_SDK_INCLUDE_FILE_DIFFS); do \
		if [ -s $$i ] ; then \
		  $(ECHO) " " >> $(WARNING_FILE); \
		  $(ECHO) "VM Interface Differences: $$i" >> $(WARNING_FILE); \
		  $(CAT) $$i >> $(WARNING_FILE); \
		  $(ECHO) " " >> $(WARNING_FILE); \
		fi; \
	    done; \
	fi
	@$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS)
	@$(RM) $(TMP_SDK_INCLUDE_FILE_LIST)

# The JDI-SA feature is not currently released on some platforms.
# See the Defs-<arch>.gmk files.

ifeq ($(INCLUDE_SA), true)
# Verify that hotspot Serviceability Agent files are present.  To keep 
# it simple, we will just check for one of them.  The others have arch 
# dependent paths.

sane-hotspot_import::
	@if [ ! -r  $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \
	  $(ECHO) "WARNING: File $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar does not exist.\n" \
	    "        The JDI binding for the Serviceability Agent will not be included in the build.\n" \
	    "        Please check your access to\n" \
	    "          $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar\n" \
	    "        and/or check your value of ALT_HOTSPOT_IMPORT_PATH.\n" \
	    "" >> $(WARNING_FILE) ; \
	 fi
endif

######################################################
# Check the ant version
######################################################
ANT_CHECK :=$(call CheckVersions,$(ANT_VER),$(REQUIRED_ANT_VER))
sane-ant_version:
	@if [ "$(ANT_CHECK)" != "same" \
	      -a "$(ANT_CHECK)" != "newer" ]; then \
	  $(ECHO) "WARNING: The version of ant being used is older than \n" \
	    "      the required version of '$(REQUIRED_ANT_VER)'. \n" \
	    "      The version of ant found was '$(ANT_VER)'. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi

######################################################
# Check the findbugs version
######################################################
FINDBUGS_CHECK :=$(call CheckVersions,$(FINDBUGS_VER),$(REQUIRED_FINDBUGS_VER))
sane-findbugs_version:
	@if [ "$(FINDBUGS_CHECK)" != "same" \
	      -a "$(FINDBUGS_CHECK)" != "newer" ]; then \
	  $(ECHO) "WARNING: The version of findbugs being used is older than \n" \
	    "      the required version of '$(REQUIRED_FINDBUGS_VER)'. \n" \
	    "      The version of findbugs found was '$(FINDBUGS_VER)'. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi

######################################################
# Check the zip file version
######################################################
ZIP_CHECK :=$(call CheckVersions,$(ZIP_VER),$(REQUIRED_ZIP_VER))
sane-zip_version: sane-unzip_version
	@if [ "$(ZIP_CHECK)" != "same" -a "$(ZIP_CHECK)" != "newer" ]; then \
	  $(ECHO) "WARNING: The version of zip being used is older than \n" \
	    "      the required version of '$(REQUIRED_ZIP_VER)'. \n" \
	    "      The version of zip found was '$(ZIP_VER)'. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi

######################################################
# Check the unzip file version
######################################################
UNZIP_CHECK :=$(call CheckVersions,$(UNZIP_VER),$(REQUIRED_UNZIP_VER))
sane-unzip_version:
	@if [ "$(UNZIP_CHECK)" != "same" -a "$(UNZIP_CHECK)" != "newer" ]; then \
	  $(ECHO) "WARNING: The version of unzip being used is older than \n" \
	    "      the required version of '$(REQUIRED_UNZIP_VER)'. \n" \
	    "      The version of unzip found was '$(UNZIP_VER)'. \n" \
	    "" >> $(WARNING_FILE) ; \
	fi

######################################################
# Check for windows DirectX sdk directory
######################################################
sane-dxsdk:
ifeq ($(PLATFORM), windows)
	@if [ ! -r $(DXSDK_INCLUDE_PATH)/ddraw.h  ]; then \
	$(ECHO) "ERROR: You do not have access to a valid DirectX SDK Include dir.\n" \
	  "      The value of DXSDK_INCLUDE_PATH must point a valid DX SDK dir.\n" \
	  "      Please check your access to \n" \
	  "          $(DXSDK_INCLUDE_PATH) \n" \
	  "      and/or check your value of ALT_DXSDK_PATH or ALT_DXSDK_INCLUDE_PATH.\n" \
	  "      Microsoft DirectX 9 SDK (Summer 2004 Update or newer) can be downloaded from the following location:\n" \
	  "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
	  "      Or  http://www.microsoft.com/directx\n" \
	  "" >> $(ERROR_FILE) ; \
	else \
	  if [ ! "$(DXSDK_VER)" = "$(REQUIRED_DXSDK_VER)" ]; then \
	  $(ECHO) "ERROR: The DirectX SDK must be version $(REQUIRED_DXSDK_VER).\n" \
	    "      $(YOU_ARE_USING) DirectX SDK version: $(DXSDK_VER)\n" \
	    "      The DirectX SDK was obtained from the following location: \n" \
	    "          $(DXSDK_PATH) \n" \
	    "      Please change your DirectX SDK. \n" \
	    "      Microsoft DirectX 9 SDK (Summer 2004 Update or newer) can be downloaded from the following location:\n" \
	    "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
	    "      Or  http://www.microsoft.com/directx\n" \
	    "" >> $(ERROR_FILE) ; \
	  else \
	    if [ -r $(DXSDK_INCLUDE_PATH)/basetsd.h ]; then \
              if [ `$(EGREP) -c __int3264 $(DXSDK_INCLUDE_PATH)/basetsd.h` -ne 0 ]; then \
	      $(ECHO) "WARNING: The DirectX SDK Include directory contains a newer basetsd.h,\n" \
		"      which may indicate that you're using an incorrect version of DirectX SDK.\n" \
		"      This may result in a build failure.\n" \
		"      The DirectX SDK Include dir was obtained from the following location:\n" \
		" 	  $(DXSDK_INCLUDE_PATH) \n" \
		"      Please change your DirectX SDK to version 7 or 9 (Summer 2004 Update or newer).\n" \
	        "      Microsoft DirectX 9 SDK can be downloaded from the following location:\n" \
	        "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
		"      Or  http://www.microsoft.com/directx\n" \
  		"" >> $(WARNING_FILE) ; \
	      fi \
	    fi \
	  fi \
	fi
endif

######################################################
# Check for the Microsoft Layer for Unicode binary files
######################################################
sane-mslu:
ifeq ($(PLATFORM), windows)
  ifeq ($(ARCH_DATA_MODEL), 32)
	@if [ ! -r "$(UNICOWS_LIB_PATH)/unicows.lib" ]; then \
	$(ECHO) "ERROR: You do not have access to the Microsoft Layer for Unicode (MSLU) linktime files.\n" \
	  "      Please check your access to \n" \
          "          $(UNICOWS_LIB_PATH)/unicows.lib \n" \
          "      and/or check your value of ALT_UNICOWS_LIB_PATH \n" \
	  "" >> $(ERROR_FILE) ; \
        fi 
	@if [ ! -r "$(UNICOWS_DLL_PATH)/unicows.dll" ]; then \
	$(ECHO) "ERROR: You do not have access to the Microsoft Layer for Unicode (MSLU) runtime files.\n" \
	  "      Please check your access to \n" \
          "          $(UNICOWS_DLL_PATH)/unicows.dll \n" \
          "      and/or check your value of ALT_UNICOWS_DLL_PATH \n" \
	  "" >> $(ERROR_FILE) ; \
        fi 
  endif
endif

######################################################
# Check the linker version(s)
######################################################
ifeq ($(PLATFORM), windows)
  LINK_CHECK  :=$(call CheckVersions,$(LINK_VER),$(REQUIRED_LINK_VER))
endif
sane-link:
ifdef LINK_VER
	@if [ "$(LINK_CHECK)" = "missing" ]; then \
	  $(ECHO) "ERROR: The Linker version is undefined. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
	@if [ "$(LINK_CHECK)" != "same" ]; then \
	  $(ECHO) "WARNING: To build Java 2 SDK $(JDK_VERSION) you need : \n" \
	    "      $(COMPILER_VERSION) - link.exe version \"$(REQUIRED_LINK_VER)\" \n" \
	      "      Specifically the $(COMPILER_NAME) link.exe. \n " \
	    "      $(YOU_ARE_USING) Linker version \"$(LINK_VER)\" \n" \
	    "" >> $(WARNING_FILE) ; \
	fi
endif

######################################################
# Check the compiler version(s)
######################################################
CC_CHECK  :=$(call CheckVersions,$(CC_VER),$(REQUIRED_CC_VER))
ifeq ($(PLATFORM), solaris)
  ifeq ($(ARCH_DATA_MODEL), 32)
    GCC_CHECK :=$(call CheckVersions,$(GCC_VER),$(REQUIRED_GCC_VER))
  endif
endif
sane-compiler: sane-link
	@if [ "$(CC_CHECK)" = "missing" ]; then \
	  $(ECHO) "ERROR: The Compiler version is undefined. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
ifndef OPENJDK
	@if [ "$(CC_CHECK)" != "same" ]; then \
	      $(ECHO) "WARNING: The $(PLATFORM) compiler is not version $(COMPILER_VERSION) $(REQUIRED_CC_VER) \n" \
	      "      Specifically the $(COMPILER_NAME) $(CC_TYPE) compiler. \n " \
	      "      $(YOU_ARE_USING) compiler version: $(CC_VER) \n" \
	      "      The compiler was obtained from the following location: \n" \
	      "          $(COMPILER_PATH) \n" \
	      "" >> $(WARNING_FILE) ; \
         fi
  ifdef GCC_CHECK
	  @if [ "$(GCC_CHECK)" != "same" ]; then \
	      $(ECHO) "WARNING: The $(PLATFORM) GCC compiler must be version $(REQUIRED_GCC_VER) \n" \
	      "      $(YOU_ARE_USING) compiler version: $(GCC_VER) \n" \
	      "      The compiler was obtained from the following location: \n" \
	      "          $(GCC_COMPILER_PATH) \n" \
	      "      Please change your compiler. \n" \
	      "" >> $(WARNING_FILE) ; \
	  fi
  endif
  ifeq ($(PLATFORM), windows)
    ifeq ($(ARCH_DATA_MODEL), 64)
      ifneq ($(COMPILER_VERSION), VS2005)
	@$(ECHO) "WARNING: Should be using VS2005 compiler on 64bit platform. \n" \
	    "" >> $(WARNING_FILE)
      endif
    endif
  endif
endif

######################################################
# Check that ALSA headers and libs are installed and 
# that the header has the right version. We only
# need /usr/include/alsa/*.h and /usr/lib/libasound.so
######################################################

ifdef ALSA_VERSION_CHECK
$(ALSA_VERSION_CHECK): $(ALSA_VERSION_CHECK).c
	@$(prep-target)
	@$(CC) -lasound -o $@ $<

$(ALSA_VERSION_CHECK).c:
	@$(prep-target)
	@$(ECHO) "#include <alsa/asoundlib.h>\n" \
                  "int main(char** argv, int argc) {\n" \
                   "  printf(\"%s\", SND_LIB_VERSION_STR);\n" \
                    "  return 0;\n" \
                    "}\n" \
                    > $@
endif

sane-alsa-versioncheck: $(ALSA_VERSION_CHECK)
sane-alsa-headers: sane-alsa-versioncheck
ifdef ALSA_VERSION_CHECK
	@if [ -f "$(ALSA_VERSION_CHECK)" ]; then \
	  if [ `$(ALSA_VERSION_CHECK) | $(EGREP) -c '$(REQUIRED_ALSA_VERSION)'` -ne 1 ] ; then \
	    $(ECHO) "ERROR: The ALSA version must be 0.9.1 or higher. \n" \
	      "      You have the following ALSA version installed: $(ALSA_VERSION) \n" \
	      "      Please reinstall ALSA (drivers and lib). You can download \n" \
	      "      the source distribution from http://www.alsa-project.org \n" \
	      "      or go to http://www.freshrpms.net/docs/alsa/ for precompiled RPM packages. \n" \
	      "" >> $(ERROR_FILE) ; \
	  fi \
	else \
	  $(ECHO) "ERROR: You seem to not have installed ALSA 0.9.1 or higher. \n" \
	  "      Please install ALSA (drivers and lib). You can download the \n" \
	  "      source distribution from http://www.alsa-project.org or go to \n" \
	  "      http://www.freshrpms.net/docs/alsa/ for precompiled RPM packages. \n" \
	  "" >> $(ERROR_FILE) ; \
	fi
endif

# If a sanity file doesn't exist, just make sure it's dir exists
$(SANITY_FILES):
	-@$(prep-target)

######################################################
# dump out the variable settings...
######################################################
sane-settings:: sane-alsa-versioncheck
	@$(ECHO)  >> $(MESSAGE_FILE)
	@$(ECHO) $(ALL_SETTINGS)  >> $(MESSAGE_FILE)
	@$(ECHO)  >> $(MESSAGE_FILE)

######################################################
# Check for existence of DEPLOY_MSSDK on windows
######################################################
sane-mssdk_path:
ifeq ($(PLATFORM), windows)
	@if [ -z "$(DEPLOY_MSSDK)" ]; then \
	  $(ECHO) "WARNING: Your DEPLOY_MSSDK setting is empty.\n" \
	    "        It is recommended to set ALT_DEPLOY_MSSDK.\n" \
	    "" >> $(WARNING_FILE) ; \
	fi
	@if [ ! -r "$(DEPLOY_MSSDK)" ]; then \
	  $(ECHO) "ERROR: You do not have a valid DEPLOY_MSSDK setting. \n" \
	    "      Please check your access to \n" \
	    "          $(DEPLOY_MSSDK) \n" \
	    "      and/or check your value of ALT_DEPLOY_MSSDK. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
endif

######################################################
# Check for existence of INSTALL_MSSDK on windows
######################################################
sane-install-mssdk_path:
ifeq ($(PLATFORM), windows)
	@if [ -z "$(INSTALL_MSSDK)" ]; then \
	  $(ECHO) "WARNING: Your INSTALL_MSSDK setting is empty.\n" \
	    "        It is recommended to set ALT_INSTALL_MSSDK.\n" \
	    "" >> $(WARNING_FILE) ; \
	fi
	@if [ ! -r "$(INSTALL_MSSDK)" ]; then \
	  $(ECHO) "ERROR: You do not have a valid INSTALL_MSSDK setting. \n" \
	    "      Please check your access to \n" \
	    "          $(INSTALL_MSSDK) \n" \
	    "      and/or check your value of ALT_INSTALL_MSSDK. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
endif

######################################################
# Check for existence of INSTALL_MSIVAL2 on windows
######################################################
sane-install-msival2_path:
ifeq ($(PLATFORM), windows)
	@if [ -z "$(INSTALL_MSIVAL2)" ]; then \
	  $(ECHO) "WARNING: Your INSTALL_MSIVAL2 setting is empty.\n" \
	    "        It is recommended to set ALT_INSTALL_MSIVAL2.\n" \
	    "" >> $(WARNING_FILE) ; \
	fi
	@if [ ! -r "$(INSTALL_MSIVAL2)" ]; then \
	  $(ECHO) "ERROR: You do not have a valid INSTALL_MSIVAL2 setting. \n" \
	    "      Please check your access to \n" \
	    "          $(INSTALL_MSIVAL2) \n" \
	    "      and/or check your value of ALT_INSTALL_MSIVAL2. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
endif

######################################################
# Check the Solaris GNU c++ compiler for solaris plugin
######################################################
sane-gcc-compiler:
ifeq ($(PLATFORM), solaris)
  ifndef OPENJDK
    @if [ -r $(GCC_COMPILER_PATH) ]; then \
	  if [ ! "$(GCC_VER)" = 2.95.2 ]; then \
	    $(ECHO) "ERROR: The Solaris GCC compiler version must be 2.95.2. \n" \
	      "      You are using the following compiler version: $(GCC_VER) \n" \
	      "      The compiler was obtained from the following location: \n" \
	      "          $(GCC_COMPILER_PATH) \n" \
	      "      Please change your compiler. \n" \
	      "" >> $(ERROR_FILE) ; \
    fi \
	else \
	  $(ECHO) "ERROR: You do not have a valid GCC_COMPILER_PATH setting. \n" \
	    "      Please check your access to \n" \
	    "          $(GCC_COMPILER_PATH) \n" \
	    "      and/or check your value of ALT_GCC_COMPILER_PATH. \n" \
	    "      This will affect you if you build the plugin target. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  endif

  ifeq ($(PLATFORM), linux)
    ifdef ALT_GCC29_COMPILER_PATH
	@if [ ! -x $(ALT_GCC29_COMPILER_PATH)/bin/gcc ]; then \
 	    $(ECHO) "ERROR: You do not have a valid ALT_GCC29_COMPILER_PATH setting. \n" \
	         "      Please check your access to \n" \
	         "      $(ALT_GCC29_COMPILER_PATH)/bin/gcc \n" \
	         "      This will affect you if you build the plugin target. \n" \
	         "" >> $(ERROR_FILE) ; \
    fi
    endif
    ifdef ALT_GCC29_PLUGIN_LIB_PATH
	@if [ ! -r $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so ]; then \
	    $(ECHO) "Error: You do not have a valid ALT_GCC29_PLUGIN_LIB_PATH setting. \n" \
		        " Please check your access to \n" \
		        " $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so \n" \
		        " This will affect you if you build the plugin target, specifically for gcc 2.9 version of OJI plugin library. \n" \
		        "" >> $(ERROR_FILE) ; \
	fi
    else
	@if [ ! -r $(GCC29_COMPILER_PATH) ]; then \
	    $(ECHO) "ERROR: You do not have a valid GCC29_COMPILER_PATH setting. \n" \
	    	    " Please check your access to \n" \
	    	    " $(GCC29_COMPILER_PATH) \n" \
	    	    " and/or check your value of ALT_GCC29_COMPILER_PATH. \n" \
	    	    " This will affect you if you build the plugin target. \n" \
	    	    "" >> $(ERROR_FILE) ; \
	fi
    endif
  endif
endif


######################################################
# MOZILLA_HEADERS_PATH must be valid
######################################################
sane-mozilla:
ifeq ($(ARCH_DATA_MODEL), 32)
  ifdef ALT_MOZILLA_HEADERS_PATH
	@if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
	  $(ECHO) "ERROR: ALT_MOZILLA_HEADERS_PATH must be an Absolute Path Name, \n" \
	    "      not a Relative Path Name. \n" \
	    "      The current value of ALT_MOZILLA_HEADERS_PATH is \n" \
	    "          $(ALT_MOZILLA_HEADERS_PATH) \n" \
	    "      Please fix this and continue your build. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  endif
	@#
	@# MOZILLA_HEADERS_PATH must be valid....
	@#
  ifeq ($(PLATFORM), windows)
	@if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18.win32/java/bool.h ]; then \
	  $(ECHO) "ERROR: You do not have access to valid Mozilla header files. \n" \
	    "      Please check your access to \n" \
	    "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18.win32/java/bool.h \n" \
	    "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
	    "	   and on Windows, ALT_JDK_JAVA_DRIVE. \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  else
	@if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18/java/bool.h ]; then \
	  $(ECHO) "ERROR: You do not have access to valid Mozilla header files. \n" \
	    "      Please check your access to \n" \
	    "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18/java/bool.h \n" \
	    "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
	    "" >> $(ERROR_FILE) ; \
	fi
  endif
endif


######################################################
# SECURITY_BASELINE_142 test
######################################################
security_baseline_142:
ifeq ($(PLATFORM), windows)
	@if [ -z "$(SECURITY_BASELINE_142)" ]; then \
	    $(ECHO) "WARNING: Your SECURITY_BASELINE_142 setting is empty.\n" \
		"        Setting it to the default value of 1.4.2_10.\n" \
		"        It is recommended to set SECURITY_BASELINE_142.\n" \
		"" >> $(WARNING_FILE) ; \
	fi
endif

######################################################
# SECURITY_BASELINE_150 test
######################################################
security_baseline_150:
ifeq ($(PLATFORM), windows)
	@if [ -z "$(SECURITY_BASELINE_150)" ]; then \
	    $(ECHO) "WARNING: Your SECURITY_BASELINE_150 setting is empty.\n" \
		"        Setting it to the default value of 1.5.0_07.\n" \
		"        It is recommended to set SECURITY_BASELINE_150.\n" \
		"" >> $(WARNING_FILE) ; \
	fi
endif


######################################################
# this should be the last rule in any target's sanity rule.
######################################################
sane-lastrule:
ifndef EXTERNALSANITYCONTROL
	@if [ -r $(MESSAGE_FILE) ]; then \
	  $(CAT) $(MESSAGE_FILE) ; \
	fi
	@if [ -r $(WARNING_FILE) ]; then \
	  $(CAT) $(WARNING_FILE) ; \
	fi
	@if [ "x$(INSANE)" != x ]; then \
	  $(ECHO) "INSANE mode requested. \n" \
	    "Sanity will not force a build termination, even with errors.\n" \
	    "" >> $(ERROR_FILE); \
	fi
	@if [ -r $(ERROR_FILE) ]; then \
	  if [ "x$(INSANE)" = x ]; then \
	    $(ECHO) "Exiting because of the above error(s). \n" \
	      "">> $(ERROR_FILE); \
	  fi ; \
	  $(CAT) $(ERROR_FILE) ; \
	  if [ "x$(INSANE)" = x ]; then \
	    exit 1 ; \
	  fi ; \
	fi
ifdef PEDANTIC
	@if [ -r $(WARNING_FILE) ]; then \
	  $(ECHO) "PEDANTIC mode requested. \n" \
	    "Exiting because of the above warning(s). \n" \
	    "" >> $(ERROR_FILE); \
	  $(CAT) $(ERROR_FILE) ; \
	  exit 1 ; \
	fi
endif # PEDANTIC
	@if [ ! -r $(ERROR_FILE) ]; then \
	  $(ECHO) "Sanity check passed." ; \
	fi
endif #  EXTERNALSANITYCONTROL