1 #
   2 # Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 #
  27 # WARNING: This file is shared with other workspaces.
  28 #
  29 
  30 #
  31 # Shared sanity rules for the JDK builds.
  32 #
  33 
  34 .SUFFIXES: .hdiffs
  35 
  36 # All files created during sanity checking
  37 
  38 SANITY_FILES =  $(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE)
  39 
  40 # How to say "The Release Engineering people use this"
  41 THE_OFFICIAL_USES=The official builds on $(PLATFORM) use
  42 
  43 # How to say "You are using:"
  44 YOU_ARE_USING=You appear to be using
  45 
  46 # Error message
  47 define SanityError
  48 $(ECHO) "ERROR: $1\n" >> $(ERROR_FILE)
  49 endef
  50 
  51 # Warning message
  52 define SanityWarning
  53 $(ECHO) "WARNING: $1\n" >> $(WARNING_FILE)
  54 endef
  55 
  56 # Official version error message: name version required_version
  57 define OfficialErrorMessage
  58 $(call SanityError,\
  59 $(THE_OFFICIAL_USES) $1 $3. Your $1 $(if $2,undefined,$2) will not work.)
  60 endef
  61 
  62 # Official version warning message: name version required_version
  63 define OfficialWarningMessage
  64 $(call SanityWarning,\
  65 $(THE_OFFICIAL_USES) $1 $3. $(YOU_ARE_USING) $1 $2.)
  66 endef
  67 
  68 
  69 # Settings and rules to validate the JDK build environment.
  70 
  71 ifeq ($(PLATFORM), solaris)
  72   # What kind of system we are using (Variations are Solaris and OpenSolaris)
  73   OS_VERSION := $(shell uname -r)
  74   OS_VARIANT_NAME := $(strip $(shell head -1 /etc/release | awk '{print $$1;}') )
  75   OS_VARIANT_VERSION := $(OS_VERSION)
  76   REQ_PATCH_LIST = $(JDK_TOPDIR)/make/PatchList.solaris
  77   ifeq ($(ARCH_FAMILY), sparc)
  78     PATCH_POSITION = $$4
  79   else
  80     PATCH_POSITION = $$6
  81   endif
  82   ifndef OPENJDK
  83     _GCC_VER :=$(shell $(GCC) -dumpversion 2>&1 )
  84     GCC_VER  :=$(call GetVersion,"$(_GCC_VER)")
  85   endif
  86 endif
  87 
  88 ifeq ($(PLATFORM), linux)
  89   # What kind of system we are using (Variation is the Linux vendor)
  90   OS_VERSION := $(shell uname -r)
  91   OS_VARIANT_NAME := $(shell \
  92     if [ -f /etc/fedora-release ] ; then \
  93       echo "Fedora"; \
  94     elif [ -f /etc/redhat-release ] ; then \
  95       echo "RedHat"; \
  96     elif [ -f /etc/SuSE-release ] ; then \
  97       echo "SuSE"; \
  98     elif [ -f /etc/lsb-release ] ; then \
  99       $(EGREP) DISTRIB_ID /etc/lsb-release | $(SED) -e 's@.*DISTRIB_ID=\(.*\)@\1@'; \
 100     else \
 101       echo "Unknown"; \
 102     fi)
 103   OS_VARIANT_VERSION := $(shell \
 104     if [ "$(OS_VARIANT_NAME)" = "Fedora" ] ; then \
 105       $(CAT) /etc/fedora-release | $(HEAD) -1 | $(NAWK) '{ print $$3; }' ; \
 106     elif [ -f /etc/lsb-release ] ; then \
 107       $(EGREP) DISTRIB_RELEASE /etc/lsb-release | $(SED) -e 's@.*DISTRIB_RELEASE=\(.*\)@\1@'; \
 108     fi)
 109   ALSA_INCLUDE=/usr/include/alsa/version.h
 110   ALSA_LIBRARY=/usr/lib/libasound.so
 111   _ALSA_VERSION := $(shell $(EGREP) SND_LIB_VERSION_STR $(ALSA_INCLUDE) | \
 112            $(SED) -e 's@.*"\(.*\)".*@\1@' )
 113   ALSA_VERSION := $(call GetVersion,$(_ALSA_VERSION))
 114 endif
 115 
 116 ifeq ($(PLATFORM), macosx)
 117   # What kind of system we are using
 118   OS_VERSION := $(shell uname -r)
 119   OS_VARIANT_NAME := MacOSX
 120   OS_VARIANT_VERSION := $(shell sw_vers -productVersion)
 121 endif
 122 
 123 ifeq ($(PLATFORM), windows)
 124   # Windows 2000 is 5.0, Windows XP is 5.1, Windows 2003 is 5.2
 125   #    Assume 5.0 (Windows 2000) if systeminfo does not help
 126   WINDOWS_MAPPING-5.0 := Windows2000
 127   WINDOWS_MAPPING-5.1 := WindowsXP
 128   WINDOWS_MAPPING-5.2 := Windows2003
 129   # What kind of system we are using (Variation is the common name)
 130   _OS_VERSION := \
 131     $(shell systeminfo 2> $(DEV_NULL) | \
 132             egrep '^OS Version:' | \
 133             awk '{print $$3;}' )
 134   ifeq ($(_OS_VERSION),)
 135     OS_VERSION = 5.0
 136   else
 137     OS_VERSION = $(call MajorVersion,$(_OS_VERSION)).$(call MinorVersion,$(_OS_VERSION))
 138   endif
 139   OS_VARIANT_NAME := $(WINDOWS_MAPPING-$(OS_VERSION))
 140   OS_VARIANT_VERSION := $(OS_VERSION)
 141   ifdef USING_CYGWIN
 142     # CYGWIN version
 143     _CYGWIN_VER := $(SYSTEM_UNAME)
 144     CYGWIN_VER  :=$(call GetVersion,$(_CYGWIN_VER))
 145   endif
 146   DXSDK_VER := $(shell $(EGREP) DIRECT3D_VERSION $(DXSDK_INCLUDE_PATH)/d3d9.h 2>&1 | \
 147     $(EGREP) "\#define" | $(NAWK) '{print $$3}')
 148 endif
 149 
 150 # Get the version numbers of what we are using
 151 _MAKE_VER  :=$(shell $(MAKE) --version 2>&1 | $(HEAD) -n 1)
 152 _ZIP_VER   :=$(shell $(ZIPEXE) -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^Zip')
 153 _UNZIP_VER :=$(shell $(UNZIP)  -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^UnZip')
 154 _BOOT_VER  :=$(shell $(BOOTDIR)/bin/java -version 2>&1 | $(HEAD) -n 1)
 155 MAKE_VER   :=$(call GetVersion,"$(_MAKE_VER)")
 156 ZIP_VER    :=$(call GetVersion,"$(_ZIP_VER)")
 157 UNZIP_VER  :=$(call GetVersion,"$(_UNZIP_VER)")
 158 BOOT_VER   :=$(call GetVersion,"$(_BOOT_VER)")
 159 
 160 _ANT_VER:=$(shell $(ANT) -version 2>&1 )
 161 ANT_VER:=$(call GetVersion,"$(_ANT_VER)")
 162 
 163 ifdef ALT_BINDIR
 164   ALT_BINDIR_VERSION := $(shell $(ALT_BINDIR)/java$(EXE_SUFFIX) -version 2>&1  | $(NAWK) -F'"' '{ print $$2 }')
 165   ALT_BINDIR_OK := $(shell $(ECHO) $(ALT_BINDIR_VERSION) | $(EGREP) -c '^$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)')
 166 endif
 167 
 168 INSTALL_PATCHES_FILE = $(TEMPDIR)/installed.patches
 169 
 170 # Get ALL_SETTINGS defined
 171 include $(JDK_MAKE_SHARED_DIR)/Sanity-Settings.gmk
 172 
 173 .PHONY: \
 174         sane-copyrightyear\
 175         sane-settings \
 176         sane-insane \
 177         sane-build_number \
 178         sane-os_version \
 179         sane-memory_check \
 180         sane-windows \
 181         sane-locale \
 182         sane-linux \
 183         sane-cygwin \
 184         sane-cygwin-shell \
 185         sane-mks \
 186         sane-arch_data_model \
 187         sane-os_patch_level \
 188         sane-classpath \
 189         sane-java_home \
 190         sane-fonts \
 191         sane-variant \
 192         sane-ld_library_path \
 193         sane-ld_library_path_64 \
 194         sane-ld_options \
 195         sane-ld_run_path \
 196         sane-makeflags \
 197         sane-alt_outputdir \
 198         sane-outputdir \
 199         sane-alt_bootdir \
 200         sane-bootdir \
 201         sane-local-bootdir \
 202         sane-cups \
 203         sane-devtools_path \
 204         sane-compiler_path \
 205         sane-unixcommand_path \
 206         sane-usrbin_path \
 207         sane-unixccs_path \
 208         sane-docs_import \
 209         sane-math_iso \
 210         sane-libCrun \
 211         sane-msdevtools_path \
 212         sane-hotspot_binaries \
 213         sane-hotspot_import \
 214         sane-hotspot_import_dir \
 215         sane-hotspot_import_include \
 216         sane-compiler \
 217         sane-link \
 218         sane-cacerts \
 219         sane-alsa-headers \
 220         sane-ant_version \
 221         sane-zip_version \
 222         sane-unzip_version \
 223         sane-msvcrt_path \
 224         sane-freetype
 225 
 226 ######################################################
 227 # check for COPYRIGHT_YEAR variable
 228 ######################################################
 229 sane-copyrightyear:
 230 ifdef ALT_COPYRIGHT_YEAR
 231         @$(ECHO) "WARNING: ALT_COPYRIGHT_YEAR but not the current year\n" \
 232                                  " will be used for copyright year.\n " \
 233                 "" >>$(WARNING_FILE)
 234 endif
 235 
 236 ######################################################
 237 # check for INSANE variable
 238 ######################################################
 239 sane-insane:
 240 ifdef INSANE
 241         @$(ECHO) "WARNING: You are building in 'INSANE' mode. You \n" \
 242            "        should not use this mode, and in fact, \n" \
 243            "        it may be removed at any time. If you \n" \
 244            "        have build problems as a result of using \n" \
 245            "        INSANE mode, then you should not expect \n" \
 246            "        assistance from anyone with the problems \n" \
 247            "        or consequences you experience. \n" \
 248            "" >> $(WARNING_FILE)
 249 endif
 250 
 251 ######################################################
 252 # check for GNU Make version
 253 ######################################################
 254 MAKE_CHECK :=$(call CheckVersions,$(MAKE_VER),$(REQUIRED_MAKE_VER))
 255 sane-make:
 256         @if [ "$(MAKE_CHECK)" != "same" -a "$(MAKE_CHECK)" != "newer" ]; then \
 257           $(ECHO) "ERROR: The version of make being used is older than \n" \
 258             "      the required version of '$(REQUIRED_MAKE_VER)'. \n" \
 259             "      The version of make found was '$(MAKE_VER)'. \n" \
 260             "" >> $(ERROR_FILE) ; \
 261         fi
 262 
 263 ######################################################
 264 # Check the BUILD_NUMBER to make sure it contains bNN
 265 ######################################################
 266 sane-build_number: 
 267         @if [ "`$(ECHO) $(BUILD_NUMBER) | $(SED) 's@.*b[0-9][0-9]*.*@bNN@'`" != "bNN" ] ; then \
 268             $(ECHO) "WARNING: The BUILD_NUMBER needs to contain b[0-9][0-9]*. Currently BUILD_NUMBER=$(BUILD_NUMBER). \n" \
 269               "        This has been known to cause build failures. \n" \
 270               "" >> $(WARNING_FILE) ; \
 271         fi
 272 
 273 ######################################################
 274 # Check the ARCH_DATA_MODEL setting
 275 ######################################################
 276 sane-arch_data_model:
 277         @if [ "$(ARCH_DATA_MODEL)" != 32 -a "$(ARCH_DATA_MODEL)" != 64 ]; then \
 278             $(ECHO) "ERROR: The setting of ARCH_DATA_MODEL must be 32 or 64.\n" \
 279               "      $(YOU_ARE_USING) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL). \n" \
 280               "" >> $(ERROR_FILE) ; \
 281         fi
 282 ifdef BUILD_CLIENT_ONLY
 283         @if [ "$(ARCH_DATA_MODEL)" != 32 ]; then \
 284            $(ECHO) "WARNING: You have requested BUILD_CLIENT_ONLY in a 64-bit build.\n" \
 285              "" >> $(WARNING_FILE) ; \
 286         fi
 287 endif
 288 
 289 ######################################################
 290 # Check the OS version (windows and linux have release name checks)
 291 #   NOTE: OPENJDK explicitly does not check for OS release information.
 292 #         Unless we know for sure that it will not build somewhere, we cannot
 293 #         generate a fatal sanity error, and a warning about the official
 294 #         build platform just becomes clutter.
 295 ######################################################
 296 ifndef OPENJDK
 297   OS_VERSION_CHECK := \
 298     $(call CheckVersions,$(OS_VERSION),$(REQUIRED_OS_VERSION))
 299   ifeq ($(OS_VARIANT_NAME),$(REQUIRED_OS_VARIANT_NAME))
 300     OS_VARIANT_VERSION_CHECK := \
 301       $(call CheckVersions,$(OS_VARIANT_VERSION),$(REQUIRED_OS_VARIANT_VERSION))
 302   endif
 303 endif
 304 sane-os_version:: sane-arch_data_model sane-memory_check sane-locale sane-os_patch_level
 305 ifndef OPENJDK
 306   ifneq ($(OS_VARIANT_NAME),$(REQUIRED_OS_VARIANT_NAME))
 307     ifeq ($(OS_VERSION_CHECK),missing)
 308         @$(call OfficialErrorMessage,OS version,$(OS_VERSION),$(REQUIRED_OS_VERSION))
 309     endif
 310     ifneq ($(OS_VERSION_CHECK),same)
 311         @$(call OfficialWarningMessage,OS version,$(OS_VERSION),$(REQUIRED_OS_VERSION))
 312     endif
 313         @$(call OfficialWarningMessage,OS variant,$(OS_VARIANT_NAME),$(REQUIRED_OS_VARIANT_NAME))
 314   else
 315     ifneq ($(OS_VARIANT_VERSION_CHECK),same)
 316         @$(call OfficialWarningMessage,$(OS_VARIANT_NAME) version,$(OS_VARIANT_VERSION),$(REQUIRED_OS_VARIANT_VERSION))
 317     endif
 318   endif
 319 endif # OPENJDK
 320 
 321 ifeq ($(PLATFORM), windows)
 322   sane-os_version:: sane-cygwin sane-mks sane-cygwin-shell
 323 endif
 324 
 325 ######################################################
 326 # Check the memory available on this machine
 327 ######################################################
 328 sane-memory_check:
 329         @if [ "$(LOW_MEMORY_MACHINE)" = "true" ]; then \
 330           $(ECHO) "WARNING: This machine appears to only have $(MB_OF_MEMORY)Mb of physical memory, \n" \
 331             "        builds on this machine could be slow. \n" \
 332             "" >> $(WARNING_FILE) ; \
 333         fi
 334 
 335 ######################################################
 336 # Check the locale (value of LC_ALL, not being empty or ==C can be a problem)
 337 ######################################################
 338 sane-locale:
 339 ifneq ($(PLATFORM), windows)
 340         @if [ "$(LC_ALL)" != "" -a "$(LC_ALL)" != "C" ]; then \
 341           $(ECHO) "WARNING: LC_ALL has been set to $(LC_ALL), this can cause build failures. \n" \
 342             "        Try setting LC_ALL to 'C'. \n" \
 343             "" >> $(WARNING_FILE) ; \
 344         fi
 345         @if [ "$(LANG)" != "" -a "$(LANG)" != "C" ]; then \
 346           $(ECHO) "WARNING: LANG has been set to $(LANG), this can cause build failures. \n" \
 347             "        Try setting LANG to 'C'. \n" \
 348             "" >> $(WARNING_FILE) ; \
 349         fi
 350 ifeq ($(PLATFORM), macosx)
 351         @if [ "$(LANG)" = "" ]; then \
 352           $(ECHO) "ERROR: LANG must be set on Mac OS X. Recommended value is \"C\"" >> $(ERROR_FILE) ; \
 353         fi
 354 endif
 355 endif
 356 
 357 
 358 ######################################################
 359 # Check the Windows cygwin version
 360 ######################################################
 361 ifeq ($(PLATFORM), windows)
 362   CYGWIN_CHECK :=$(call CheckVersions,$(CYGWIN_VER),$(REQUIRED_CYGWIN_VER))
 363 sane-cygwin:
 364   ifdef USING_CYGWIN
 365     ifeq ($(CYGWIN_CHECK),missing)
 366         @$(call OfficialErrorMessage,CYGWIN version,$(CYGWIN_VER),$(REQUIRED_CYGWIN_VER))
 367     endif
 368     ifeq ($(CYGWIN_CHECK),older)
 369         @$(call OfficialWarningMessage,CYGWIN version,$(CYGWIN_VER),$(REQUIRED_CYGWIN_VER))
 370     endif
 371   endif
 372 endif
 373 
 374 ######################################################
 375 # Check the cygwin shell is used, not cmd.exe
 376 ######################################################
 377 ifeq ($(PLATFORM), windows)
 378 sane-cygwin-shell:
 379   ifdef USING_CYGWIN
 380         @if [ "$(SHLVL)" = "" -a "$(_)" = "" ]; then \
 381           $(ECHO) "ERROR: You are using an unsupported shell. \n" \
 382             "      Use either sh, bash, ksh, zsh, or tcsh. \n" \
 383             "      Using the cmd.exe utility is not supported. \n" \
 384             "      If you still want to try your current shell, \n" \
 385             "      please export SHLVL=1 when running $(MAKE).  \n" \
 386             "" >> $(ERROR_FILE) ; \
 387         fi
 388   endif
 389 endif
 390 
 391 ######################################################
 392 # Check the Windows mks version
 393 ######################################################
 394 ifeq ($(PLATFORM), windows)
 395     MKS_CHECK :=$(call CheckVersions,$(MKS_VER),$(REQUIRED_MKS_VER))
 396 sane-mks:
 397   ifdef USING_MKS
 398     ifeq ($(MKS_CHECK),missing)
 399         @$(call OfficialErrorMessage,MKS version,$(MKS_VER),$(REQUIRED_MKS_VER))
 400     endif
 401     ifeq ($(MKS_CHECK),older)
 402         @$(call OfficialErrorMessage,MKS version,$(MKS_VER),$(REQUIRED_MKS_VER))
 403     endif
 404   endif
 405 endif
 406 
 407 ######################################################
 408 # Get list of installed patches (this file has a particular format)
 409 ######################################################
 410 $(INSTALL_PATCHES_FILE):
 411         @$(prep-target)
 412 ifeq ($(PLATFORM), solaris)
 413   ifeq ($(OS_VERSION),$(REQUIRED_OS_VERSION))
 414         $(SHOWREV) -p > $@ 2>&1
 415   endif
 416 endif
 417         @$(ECHO) "" >> $@
 418 
 419 ######################################################
 420 # Check list of Solaris patches
 421 ######################################################
 422 sane-os_patch_level: $(INSTALL_PATCHES_FILE)
 423 ifeq ($(PLATFORM), solaris)
 424   ifeq ($(OS_VERSION),$(REQUIRED_OS_VERSION))
 425         @$(NAWK) 'BEGIN { \
 426     readingInstallPatches = 0; \
 427     requiredCount = 0; \
 428     installCount = 0; \
 429 } \
 430 { \
 431     if (readingInstallPatches) { \
 432         if ($$1=="Patch:") { \
 433             ns = split($$2,parts,"-");  \
 434             installPatchNo[installCount]=parts[1]; \
 435             installPatchRev[installCount]=parts[2]; \
 436             installCount++; \
 437         } \
 438     } \
 439      \
 440     if (!readingInstallPatches) { \
 441         if (index($$1,"#") != 0) continue; \
 442         if (match($$1,"BUILD") > 0 \
 443         && $$2 == $(OS_VERSION) \
 444         && ($$7 == "REQ" || $$7 == "req") \
 445         && $(PATCH_POSITION) != "none" \
 446         && $(PATCH_POSITION) != "NONE") { \
 447             ns = split($(PATCH_POSITION),parts,"-");  \
 448             requiredPatchNo[requiredCount]=parts[1]; \
 449             requiredPatchRev[requiredCount]=parts[2]; \
 450             requiredCount++; \
 451        } \
 452     } \
 453 } \
 454 END { \
 455     errorCount=0; \
 456     for (i=0; i<requiredCount; i++) { \
 457         foundMatch = 0; \
 458         for (j=0; j<installCount; j++) { \
 459             if (installPatchNo[j] == requiredPatchNo[i] \
 460             && installPatchRev[j] >= requiredPatchRev[i]) { \
 461                 foundMatch = 1; \
 462                 break; \
 463             } \
 464         } \
 465         if ( foundMatch == 0) { \
 466             printf("WARNING: Your solaris install is missing the required patch %s-%s\n", requiredPatchNo[i], requiredPatchRev[i] ); \
 467             printf("         Please update your your system patches or build on a different machine.\n\n" ); \
 468             errorCount++; \
 469         } \
 470     } \
 471 }' $(REQ_PATCH_LIST) readingInstallPatches=1 $(INSTALL_PATCHES_FILE) >> $(WARNING_FILE)
 472   endif
 473 endif # PLATFORM
 474 
 475 ######################################################
 476 # CLASSPATH cannot be set, unless you are insane.
 477 ######################################################
 478 sane-classpath:
 479 ifdef CLASSPATH
 480         @$(ECHO) "ERROR: Your CLASSPATH environment variable is set.  This will \n" \
 481            "      most likely cause the build to fail.  Please unset it \n" \
 482            "      and start your build again. \n" \
 483            "" >> $(ERROR_FILE)
 484 endif
 485 
 486 ######################################################
 487 # JAVA_HOME cannot be set, unless you are insane.
 488 ######################################################
 489 sane-java_home:
 490 ifdef JAVA_HOME
 491         @$(ECHO) "ERROR: Your JAVA_HOME environment variable is set.  This will \n" \
 492            "      most likely cause the build to fail.  Please unset it \n" \
 493            "      and start your build again. \n" \
 494            "" >> $(ERROR_FILE)
 495 endif
 496 
 497 ######################################################
 498 # Make sure the fonts are there
 499 # Exceptions are when explicitly building OPENJDK, or
 500 # when the entire CLOSED_SRC dir is excluded, so we are
 501 # implicitly building OPENJDK
 502 ######################################################
 503 FONT_FILE=$(CLOSED_SRC)/share/lib/fonts/LucidaTypewriterRegular.ttf
 504 sane-fonts:
 505 ifndef OPENJDK
 506         @if [ -d $(CLOSED_SRC) ] ; then \
 507          if [ ! -f $(FONT_FILE) ] ; then \
 508           $(ECHO) "ERROR: Missing $(FONT_FILE). \n" \
 509            "      Verify you have downloaded and overlayed on the source area all the binary files. \n" \
 510            "" >> $(ERROR_FILE); \
 511         fi \
 512         fi
 513 endif
 514 
 515 ######################################################
 516 # VARIANT must be set to DBG or OPT
 517 ######################################################
 518 sane-variant:
 519         @if [ "$(VARIANT)" != DBG -a "$(VARIANT)" != OPT ] ; then \
 520           $(ECHO) "ERROR: Your VARIANT environment variable is set to $(VARIANT). \n" \
 521            "      Needs to be set to DBG or OPT \n" \
 522            "" >> $(ERROR_FILE); \
 523         fi
 524 
 525 ######################################################
 526 # LD_LIBRARY_PATH should not be set, unless you are insane.
 527 ######################################################
 528 sane-ld_library_path:
 529 ifdef LD_LIBRARY_PATH
 530         @$(ECHO) "ERROR: Your LD_LIBRARY_PATH environment variable is set.  This may \n" \
 531            "      produce binaries binaries incorrectly.  Please unset it \n" \
 532            "      and start your build again. \n" \
 533            "" >> $(ERROR_FILE)
 534 endif
 535 
 536 ######################################################
 537 # LD_LIBRARY_PATH_64 should not be set, unless you are insane.
 538 ######################################################
 539 sane-ld_library_path_64:
 540 ifdef LD_LIBRARY_PATH_64
 541         @$(ECHO) "ERROR: Your LD_LIBRARY_PATH_64 environment variable is set.  This may \n" \
 542            "      produce binaries binaries incorrectly.  Please unset it \n" \
 543            "      and start your build again. \n" \
 544            "" >> $(ERROR_FILE)
 545 endif
 546 
 547 ######################################################
 548 # LD_OPTIONS should not be set, unless you are insane.
 549 ######################################################
 550 sane-ld_options:
 551 ifdef LD_OPTIONS
 552         @$(ECHO) "ERROR: Your LD_OPTIONS environment variable is set.  This may \n" \
 553            "      produce binaries binaries incorrectly.  Please unset it \n" \
 554            "      and start your build again. \n" \
 555            "" >> $(ERROR_FILE)
 556 endif
 557 
 558 ######################################################
 559 # LD_RUN_PATH should not be set, unless you are insane.
 560 ######################################################
 561 sane-ld_run_path:
 562 ifdef LD_RUN_PATH
 563         @$(ECHO) "ERROR: Your LD_RUN_PATH environment variable is set.  This may \n" \
 564            "      produce binaries binaries incorrectly.  Please unset it \n" \
 565            "      produce binaries binaries incorrectly.  Please unset it \n" \
 566            "      and start your build again. \n" \
 567            "" >> $(ERROR_FILE)
 568 endif
 569 
 570 ######################################################
 571 # MAKEFLAGS cannot be set, unless you are insane.
 572 ######################################################
 573 ifeq ($(PLATFORM), windows)
 574 ifdef USING_CYGWIN
 575 REAL_MAKEFLAGS:=$(subst --unix,,$(MAKEFLAGS))
 576 else
 577 REAL_MAKEFLAGS:=$(MAKEFLAGS)
 578 endif
 579 else
 580 REAL_MAKEFLAGS:=$(MAKEFLAGS)
 581 endif
 582 sane-makeflags:
 583 # ifneq ($(strip $(REAL_MAKEFLAGS)),)
 584 ifeq ($(origin MAKEFLAGS),environment)
 585         @#
 586         @# it is unacceptable to have the-e or --environment-overrides value in MAKEFLAGS
 587         @#
 588         @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(e|--environment-overrides)( |$$)'` -ne 0 ]; then \
 589           $(ECHO) "ERROR: Either the build was started with the flag -e or \n" \
 590             "      --environment-overrides, or the MAKEFLAGS environment \n" \
 591             "      variable has this value set.  This will cause any \n" \
 592             "      environment variables you have defined to override \n" \
 593             "      the values defined by the makefiles. This practice is \n" \
 594             "      not recommemded by the authors of GNU Make, and \n" \
 595             "      will lead to an improper build. \n" \
 596             "      Please fix and restart the build. \n" \
 597             "" >> $(ERROR_FILE) ; \
 598         fi
 599         @#
 600         @# it is unacceptable to havethe -i or --ignore-errors value in MAKEFLAGS
 601         @#
 602         @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(i|--ignore-errors)( |$$)'` -ne 0 ]; then \
 603           $(ECHO) "ERROR: Either the build was started with the flag -i or \n" \
 604             "      --ignore-errors, or the MAKEFLAGS environment \n" \
 605             "      variable has this value set. 1111 You will be unable \n" \
 606             "      to determine if the build is broken or not. \n" \
 607             "      Please fix and restart the build. \n" \
 608             "" >> $(ERROR_FILE) ; \
 609         fi
 610         @#
 611         @# it is unacceptable to have the -I or --include-dir value in MAKEFLAGS
 612         @#
 613         @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(I|--include-dir)( |$$)'` -ne 0 ]; then \
 614           $(ECHO) "ERROR: Either the build was started with the flag -I or \n" \
 615             "      --include-dir, or the MAKEFLAGS environment \n" \
 616             "      variable has this value set.  This will render your \n" \
 617             "      build questionable as not all the rules and depenencies \n" \
 618             "      are captured by the build. \n" \
 619             "      Please fix and restart the build. \n" \
 620             "" >> $(ERROR_FILE) ; \
 621         fi
 622         @#
 623         @# it is unacceptable to have the -k or --keep-going value in MAKEFLAGS:
 624         @#
 625         @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(k|--keep-going)( |$$)'` -ne 0 ]; then \
 626           $(ECHO) "ERROR: Either the build was started with the flag -k or \n" \
 627             "      --keep-going, or the MAKEFLAGS environment \n" \
 628             "      variable has this value set. 222 You will be unable \n" \
 629             "      to determine if the build is broken or not. \n" \
 630             "      Please fix and restart the build.  \n" \
 631             "" >> $(ERROR_FILE) ; \
 632         fi
 633         @#
 634         @# it is unacceptable to have the -o or --assume-old or --old-filevalue in MAKEFLAGS:
 635         @# Note - this rule never gets invoked because it is processed out
 636         @#        in GNU Make startup
 637         @#
 638         @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(o|--assume-old|--old-file)( |$$)'` -ne 0 ]; then \
 639           $(ECHO) "ERROR: Either the build was started with the flag -o or \n" \
 640             "      --assume-old or --old-file, or the MAKEFLAGS environment \n" \
 641             "      variable has this value set.  This could prevent the \n" \
 642             "      build from executing rules it should, thus rendering a \n" \
 643             "      questionable result. \n" \
 644             "      Please fix and restart the build. \n" \
 645             "" >> $(ERROR_FILE) ; \
 646         fi
 647         @#
 648         @# it is unacceptable to have the -r or --nobuiltin-rules value in MAKEFLAGS
 649         @#
 650         @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(r|--no-builtin-rules)( |$$)'` -ne 0 ]; then \
 651           $(ECHO) "ERROR: Either the build was started with the flag -r or \n" \
 652             "      --no-builtin-rules, or the MAKEFLAGS environment \n" \
 653             "      variable has this value set.  This may break the build \n" \
 654             "      by not allowing builtin rules that may be required. \n" \
 655             "      Please fix and restart the build. \n" \
 656             "" >> $(ERROR_FILE) ; \
 657         fi
 658         @#
 659         @# it is unacceptable to have the -t or --touch value in MAKEFLAGS
 660         @# Note - this rule never gets invoked because it is processed out
 661         @#        in GNU Make startup
 662         @#
 663         @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(t|--touch)( |$$)'` -ne 0 ]; then \
 664           $(ECHO) "ERROR: Either the build was started with the flag -t or \n" \
 665             "      --touch, or the MAKEFLAGS environment \n" \
 666             "      variable has this value set.  This will leave the \n" \
 667             "      build in a unclear state and could lead to not executing \n" \
 668             "      rules which should be executed. \n" \
 669             "      Please fix and restart the build. \n" \
 670             "" >> $(ERROR_FILE) ; \
 671         fi
 672         @#
 673         @# show what is in MAKEFLAGS so the user is aware...
 674         @#
 675         @$(ECHO) "WARNING: Your MAKEFLAGS environment variable is set. \n" \
 676            "        You should be very careful about the values set here. \n" \
 677            "\n" \
 678            "        MAKEFLAGS is set to =>$(MAKEFLAGS)<= \n" \
 679            "" >> $(WARNING_FILE)
 680 endif
 681 
 682 ######################################################
 683 # if specified, ALT_OUTPUTDIR must point to non-relative path if set
 684 ######################################################
 685 sane-alt_outputdir:
 686 ifdef ALT_OUTPUTDIR
 687         @if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
 688           $(ECHO) "ERROR: ALT_OUTPUTDIR must be an Absolute Path Name, \n" \
 689             "      not a Relative Path Name. \n" \
 690             "" >> $(ERROR_FILE) ; \
 691         fi
 692   ifeq ($(PLATFORM), windows)
 693         @if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)'` -ne 1 ]; then \
 694           $(ECHO) "ERROR: On windows, ALT_OUTPUTDIR must contain the drive letter. \n" \
 695             "" >> $(ERROR_FILE) ; \
 696         fi
 697   endif
 698 endif
 699 
 700 ######################################################
 701 # OUTPUTDIR tests
 702 ######################################################
 703 sane-outputdir:
 704         @#
 705         @# OUTPUTDIR must be a directory...
 706         @#
 707         @if [ ! -d "$(OUTPUTDIR)" ]; then \
 708           $(ECHO) "ERROR: OUTPUTDIR must be an existing directory. The current \n" \
 709             "      value of OUTPUTDIR is \n" \
 710             "          $(OUTPUTDIR) \n" \
 711             "      Please check your value of ALT_OUTPUTDIR. \n" \
 712             "" >> $(ERROR_FILE) ; \
 713         fi
 714         @#
 715         @# OUTPUTDIR must be writeable by user...
 716         @#
 717         @if [ ! -w "$(OUTPUTDIR)" ]; then \
 718           $(ECHO) "ERROR: You must have write permissions to OUTPUTDIR. The \n" \
 719             "      current value of OUTPUTDIR is \n" \
 720             "          $(OUTPUTDIR) \n" \
 721             "      Either obtain these permissions or set ALT_OUTPUTDIR. \n" \
 722             "" >> $(ERROR_FILE) ; \
 723         fi
 724 
 725 ######################################################
 726 # if specified, ALT_BOOTDIR must point to non-relative path if set
 727 ######################################################
 728 sane-alt_bootdir:
 729 ifdef ALT_BOOTDIR
 730         @if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
 731           $(ECHO) "ERROR: ALT_BOOTDIR must be an Absolute Path Name, \n" \
 732             "      not a Relative Path Name. \n" \
 733             "      The current value of ALT_BOOTDIR is \n" \
 734             "          $(ALT_BOOTDIR) \n" \
 735             "      Please fix this and continue your build. \n" \
 736             "" >> $(ERROR_FILE) ; \
 737         fi
 738 endif
 739 
 740 ######################################################
 741 # BOOTDIR must point to a valid JDK.
 742 ######################################################
 743 BOOT_CHECK :=$(call CheckVersions,$(BOOT_VER),$(REQUIRED_BOOT_VER))
 744 sane-bootdir:
 745         @if [ "$(BOOT_CHECK)" != "same" -a "$(BOOT_CHECK)" != "newer" ]; then \
 746           $(ECHO) "ERROR: Your BOOTDIR environment variable does not point \n" \
 747             "      to a valid JDK for bootstrapping this build. \n" \
 748             "      A JDK $(JDK_MINOR_VERSION) $(MARKET_NAME) build must be bootstrapped using  \n" \
 749             "      JDK $(PREVIOUS_JDK_VERSION) fcs (or later). \n" \
 750             "      Apparently, your bootstrap JDK is version $(BOOT_VER) \n" \
 751             "      Please update your ALT_BOOTDIR setting and start your build again. \n" \
 752             "" >> $(ERROR_FILE) ; \
 753         fi
 754 
 755 ######################################################
 756 # BOOTDIR is recommended to reside on a local drive
 757 ######################################################
 758 sane-local-bootdir:
 759 ifeq ($(PLATFORM), windows)
 760         @if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -c '^[jJ]:'` -ne 0 ]; then \
 761           $(ECHO) "WARNING: Your BOOTDIR is located on the J: drive. Often the J:\n" \
 762             "        drive is mapped over a network. Using a mapped drive for\n" \
 763             "        the BOOTDIR may significantly slow down the build process.\n" \
 764             "        You may want to consider using the ALT_BOOTDIR variable\n" \
 765             "        to point the build to another location for the BOOTDIR instead. \n" \
 766             "        Your current BOOTDIR is:\n" \
 767             "           $(BOOTDIR) \n" \
 768             "" >> $(WARNING_FILE) ; \
 769         fi
 770 endif
 771 
 772 ######################################################
 773 # CACERTS_FILE must be absoulte path and readable
 774 ######################################################
 775 sane-cacerts:
 776   ifdef ALT_CACERTS_FILE
 777         @if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
 778           $(ECHO) "ERROR: ALT_CACERTS_FILE must be an Absolute Path Name, \n" \
 779             "      not a Relative Path Name. \n" \
 780             "      The current value of ALT_CACERTS_FILE is \n" \
 781             "          $(ALT_CACERTS_FILE) \n" \
 782             "      Please fix this and continue your build. \n" \
 783             "" >> $(ERROR_FILE) ; \
 784         fi
 785   endif
 786         @#
 787         @# CACERTS_FILE must be readable
 788         @#
 789         @if [ ! -r "$(subst \,/,$(CACERTS_FILE))" ]; then \
 790           $(ECHO) "ERROR: You do not have access to a valid cacerts file. \n" \
 791             "      Please check your access to \n" \
 792             "          $(subst \,/,$(CACERTS_FILE)) \n" \
 793             "      and/or check your value of ALT_CACERTS_FILE. \n" \
 794             "" >> $(ERROR_FILE) ; \
 795         fi
 796         @#
 797         @# CACERTS_FILE must be a file
 798         @#
 799         @if [ -d "$(subst \,/,$(CACERTS_FILE))" ]; then \
 800           $(ECHO) "ERROR: You do not have access to a valid cacerts file.\n" \
 801             "      The value of CACERTS_FILE must point to a normal file.\n" \
 802             "      Please check your access to \n" \
 803             "          $(subst \,/,$(CACERTS_FILE)) \n" \
 804             "      and/or check your value of ALT_CACERTS_FILE. \n" \
 805             "" >> $(ERROR_FILE) ; \
 806         fi
 807 
 808 
 809 ######################################################
 810 # Check for availability of FreeType (OpenJDK specific)
 811 ######################################################
 812 
 813 ifdef OPENJDK
 814   ifndef CROSS_COMPILE_ARCH
 815     # The freetypecheck Makefile prints out "Failed" if not good enough
 816     $(TEMPDIR)/freetypeinfo: FRC
 817         @$(prep-target)
 818         @(($(CD) $(BUILDDIR)/tools/freetypecheck && $(MAKE)) || \
 819             $(ECHO) "Failed to build freetypecheck." ) > $@
 820 
 821     sane-freetype: $(TEMPDIR)/freetypeinfo
 822         @if [ "`$(CAT) $< | $(GREP) Fail`" != "" ]; then \
 823           $(ECHO) "ERROR: FreeType version " $(REQUIRED_FREETYPE_VERSION) \
 824                   " or higher is required. \n" \
 825                   "`$(CAT) $<`  \n" >> $(ERROR_FILE) ; \
 826         fi
 827   else
 828     #do nothing  (cross-compiling)
 829     sane-freetype: 
 830   endif
 831 else
 832   #do nothing  (not OpenJDK)
 833   sane-freetype: 
 834 endif
 835 
 836 ######################################################
 837 # CUPS_HEADERS_PATH must be valid
 838 ######################################################
 839 sane-cups:
 840 ifneq ($(PLATFORM), windows)
 841         @if [ ! -r $(CUPS_HEADERS_PATH)/cups/cups.h ]; then \
 842           $(ECHO) "ERROR: You do not have access to valid Cups header files. \n" \
 843             "      Please check your access to \n" \
 844             "          $(CUPS_HEADERS_PATH)/cups/cups.h \n" \
 845             "      and/or check your value of ALT_CUPS_HEADERS_PATH, \n" \
 846             "      CUPS is frequently pre-installed on many systems, \n" \
 847             "      or may be downloaded from http://www.cups.org \n" \
 848             "" >> $(ERROR_FILE) ; \
 849         fi
 850 endif
 851 
 852 ######################################################
 853 # Check for existence of DEVTOOLS_PATH
 854 # All needed tools come with base system on Apple
 855 ######################################################
 856 sane-devtools_path:
 857 ifneq ($(OS_VENDOR), Apple)
 858         @if [ "$(DEVTOOLS_PATH)" != "" -a ! -r "$(DEVTOOLS_PATH)" ]; then \
 859           $(ECHO) "ERROR: You do not have a valid DEVTOOLS_PATH setting. \n" \
 860             "      Please check your access to \n" \
 861             "          $(DEVTOOLS_PATH) \n" \
 862             "      and/or check your value of ALT_DEVTOOLS_PATH. \n" \
 863             "" >> $(ERROR_FILE) ; \
 864         fi
 865 endif
 866 
 867 ######################################################
 868 # Check for existence of MS_RUNTIME_LIBRARIES
 869 ######################################################
 870 sane-msvcrt_path:
 871 ifeq ($(PLATFORM), windows)
 872   ifneq ($(MSVCRNN_DLL),)
 873         @if [ ! -r "$(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)" ]; then \
 874           $(ECHO) "ERROR: You do not have access to $(MSVCRNN_DLL). \n" \
 875             "      Please check your access to \n" \
 876             "          $(MSVCRNN_DLL_PATH) \n" \
 877             "      and/or check your value of ALT_MSVCRNN_DLL_PATH. \n" \
 878             "" >> $(ERROR_FILE) ; \
 879         fi
 880   endif
 881 endif
 882 
 883 ######################################################
 884 # Check for existence of COMPILER_PATH
 885 ######################################################
 886 sane-compiler_path:
 887         @if [ "$(COMPILER_PATH)" != "" -a ! -r "$(COMPILER_PATH)" ]; then \
 888           $(ECHO) "ERROR: You do not have a valid COMPILER_PATH setting. \n" \
 889             "      Please check your access to \n" \
 890             "          $(COMPILER_PATH) \n" \
 891             "      and/or check your value of ALT_COMPILER_PATH. \n" \
 892             "" >> $(ERROR_FILE) ; \
 893         fi
 894 
 895 ######################################################
 896 # Check for existence of UNIXCOMMAND_PATH
 897 ######################################################
 898 sane-unixcommand_path:
 899         @if [ "$(UNIXCOMMAND_PATH)" != "" -a ! -r "$(UNIXCOMMAND_PATH)" ]; then \
 900           $(ECHO) "ERROR: You do not have a valid UNIXCOMMAND_PATH setting. \n" \
 901             "      Please check your access to \n" \
 902             "          $(UNIXCOMMAND_PATH) \n" \
 903             "      and/or check your value of ALT_UNIXCOMMAND_PATH. \n" \
 904             "" >> $(ERROR_FILE) ; \
 905         fi
 906 ifeq ($(PLATFORM), windows)
 907 ifeq ($(USING_MSYS), true)
 908         @for utility in $(AR) $(FILE) $(M4) ; do \
 909           if [ ! -r "`$(WHICH) $${utility}`" ]; then \
 910             $(ECHO) "WARNING: You do not have the utility $${utility} in the \n" \
 911               "      directory $(UNIXCOMMAND_PATH). \n" \
 912               "      The utilities ar, file and m4 are required. \n" \
 913               "" >> $(WARNING_FILE) ; \
 914           fi; \
 915         done
 916 else
 917         @for utility in $(AR) $(CPIO) $(FILE) $(M4) ; do \
 918           if [ ! -r "`$(WHICH) $${utility}`" ]; then \
 919             $(ECHO) "WARNING: You do not have the utility $${utility} in the \n" \
 920               "      directory $(UNIXCOMMAND_PATH). \n" \
 921               "      The utilities ar, cpio, file and m4 are required. \n" \
 922               "" >> $(WARNING_FILE) ; \
 923           fi; \
 924         done
 925 endif
 926 endif
 927 
 928 ######################################################
 929 # Check for existence of USRBIN_PATH on linux
 930 ######################################################
 931 sane-usrbin_path:
 932 ifeq ($(PLATFORM), linux)
 933         @if [ "$(USRBIN_PATH)" != "" -a ! -r "$(USRBIN_PATH)" ]; then \
 934             $(ECHO) "ERROR: You do not have a valid USRBIN_PATH setting. \n" \
 935               "      Please check your access to \n" \
 936               "          $(USRBIN_PATH)  \n" \
 937               "      and/or check your value of ALT_USRBIN_PATH. \n" \
 938               "" >> $(ERROR_FILE) ; \
 939           fi
 940 endif
 941 
 942 ######################################################
 943 # Check for existence of UNIXCCS_PATH on solaris
 944 ######################################################
 945 sane-unixccs_path:
 946 ifeq ($(PLATFORM), solaris)
 947         @if [ "$(UNIXCCS_PATH)" != "" -a ! -r "$(UNIXCCS_PATH)" ]; then \
 948           $(ECHO) "ERROR: You do not have a valid UNIXCCS_PATH setting. \n" \
 949             "      Please check your access to \n" \
 950             "          $(UNIXCCS_PATH) \n" \
 951             "      and/or check your value of ALT_UNIXCCS_PATH. \n" \
 952             "" >> $(ERROR_FILE) ; \
 953           fi
 954 endif
 955 
 956 ######################################################
 957 # Verify the docs directory exists
 958 ######################################################
 959 sane-docs_import:
 960         @if [ ! -d "$(HOTSPOT_DOCS_IMPORT_PATH)" ]; then \
 961             $(ECHO) "WARNING: The directory HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_DOCS_IMPORT_PATH) \n" \
 962               "      does not exist, check your value of ALT_HOTSPOT_DOCS_IMPORT_PATH. \n" \
 963               "" >> $(WARNING_FILE) ; \
 964         fi
 965 
 966 ######################################################
 967 # Check for possible problem regarding __fabsf,  math_iso.h and the libm patch.
 968 #    Hotspot should have been changed in Mustang 6.0 Build 47 to not depend
 969 #    on __fabsf, this is just checking that fact now.
 970 ######################################################
 971 sane-math_iso:
 972 ifeq ($(PLATFORM), solaris)
 973         @if [ -f $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
 974           if [ "`$(NM) $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) | $(GREP) __fabsf`" != "" ]; then \
 975             $(ECHO) "WARNING: This version of hotspot relies on __fabsf \n" \
 976               "        which is not always available on Solaris 8 and 9 machines \n" \
 977               "        unless they have the latest libm patch and the file \n" \
 978               "        /usr/include/iso/math_iso.h which can trigger this dependency.\n" \
 979               "        Hotspot should NOT be dependent on this extern, check the \n" \
 980               "        version of the hotspot library you are using. \n" \
 981               "" >> $(WARNING_FILE) ; \
 982             fi; \
 983         fi
 984 endif
 985 
 986 ######################################################
 987 # Check for possible patch problem regarding /usr/lib/libCrun.so
 988 ######################################################
 989 sane-libCrun:
 990 ifeq ($(PLATFORM), solaris)
 991         @if [ "`$(NM) /usr/lib/libCrun.so.1 | $(GREP) __1c2n6FIpv_0_`" = "" ]; then \
 992           $(ECHO) "WARNING: The file /usr/lib/libCrun.so.1 is missing the extern \n" \
 993             "        __1c2n6FIpv_0_ which indicates that the system is missing \n" \
 994             "        a required Solaris patch, or you are using a pre-FCS release \n" \
 995             "        of Solaris 10. You need the latest /usr/lib/libCrun.so.1 \n" \
 996             "        which comes with the FCS release of Solaris 10 and available \n" \
 997             "        through the latest Solaris 8 or 9 C++ runtime patches. \n" \
 998             "" >> $(WARNING_FILE) ; \
 999         fi
1000 endif
1001 
1002 ######################################################
1003 # Check for existence of the extra tools on windows
1004 ######################################################
1005 sane-msdevtools_path:
1006 ifeq ($(PLATFORM), windows)
1007   ifeq ($(wildcard $(RC)),)
1008         @$(ECHO) "ERROR: Cannot find the RC utility from path: $(RC)\n" \
1009             "      This is normally obtained from the WINDOWSSDKDIR." \
1010             "" >> $(ERROR_FILE)
1011   endif
1012   # MinGW/MSYS make 3.81 will not tolerate a path with a quoted substring
1013   ifeq ($(wildcard $(subst ",,$(DUMPBIN))),)
1014         @$(ECHO) "ERROR: Cannot find the DUMPBIN utility from path: $(DUMPBIN)\n" \
1015             "      This is normally obtained from the COMPILER_PATH." \
1016             "" >> $(ERROR_FILE)
1017   endif
1018 endif
1019 
1020 ######################################################
1021 # Check for existence of Hotspot binaries
1022 ######################################################
1023 sane-hotspot_binaries:
1024 ifeq ($(ARCH_DATA_MODEL), 32)
1025         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
1026           $(ECHO) "ERROR: HOTSPOT_CLIENT_PATH does not point to a valid HotSpot VM. \n" \
1027             "      Please check your access to \n" \
1028             "          $(HOTSPOT_CLIENT_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) \n" \
1029             "      and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1030             "" >> $(ERROR_FILE) ; \
1031         fi
1032 endif
1033         @if [ ! -r $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
1034           $(ECHO) "ERROR: HOTSPOT_SERVER_PATH does not point to a valid HotSpot VM. \n" \
1035             "      Please check your access to \n" \
1036             "          $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) \n" \
1037             "      and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1038             "" >> $(ERROR_FILE) ; \
1039         fi
1040         @#
1041         @# Check value of HOTSPOT_LIB_PATH
1042         @#
1043 ifeq ($(PLATFORM), windows)
1044         @if [ ! -r $(HOTSPOT_LIB_PATH)/jvm.lib ]; then \
1045           $(ECHO) "ERROR: HOTSPOT_LIB_PATH does not point to a valid HotSpot library. \n" \
1046             "      Please check your access to \n" \
1047             "          $(HOTSPOT_LIB_PATH)/jvm.lib \n" \
1048             "      and/or check your value of ALT_HOTSPOT_LIB_PATH. \n" \
1049             "" >> $(ERROR_FILE) ; \
1050         fi
1051   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
1052         @#
1053         @# Check for the .map files - its OK if they are not there..
1054         @#
1055     ifeq ($(ARCH_DATA_MODEL), 32)
1056         @# There is no 64-bit HotSpot client VM
1057       ifeq ($(ZIP_DEBUGINFO_FILES),1)
1058         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/jvm.diz ]; then \
1059           $(ECHO) "WARNING: HOTSPOT_CLIENT_PATH does not point to valid HotSpot .diz files. \n" \
1060             "        These files are optional and aid in the debugging of the JVM. \n" \
1061             "        Please check your access to \n" \
1062             "          $(HOTSPOT_CLIENT_PATH)/jvm.diz \n" \
1063             "        and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1064             "" >> $(WARNING_FILE) ; \
1065         fi
1066       else
1067         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/jvm.map ]; then \
1068           $(ECHO) "WARNING: HOTSPOT_CLIENT_PATH does not point to valid HotSpot .map files. \n" \
1069             "        These files are optional and aid in the debugging of the JVM. \n" \
1070             "        Please check your access to \n" \
1071             "          $(HOTSPOT_CLIENT_PATH)/jvm.map \n" \
1072             "        and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1073             "" >> $(WARNING_FILE) ; \
1074         fi
1075         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/jvm.pdb ]; then \
1076           $(ECHO) "WARNING: HOTSPOT_CLIENT_PATH does not point to valid HotSpot .pdb files. \n" \
1077             "        These files are optional and aid in the debugging of the JVM. \n" \
1078             "        Please check your access to \n" \
1079             "          $(HOTSPOT_CLIENT_PATH)/jvm.pdb \n" \
1080             "        and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1081             "" >> $(WARNING_FILE) ; \
1082         fi
1083       endif
1084     endif
1085     ifeq ($(ZIP_DEBUGINFO_FILES),1)
1086         @if [ ! -r $(HOTSPOT_SERVER_PATH)/jvm.diz ]; then \
1087           $(ECHO) "WARNING: HOTSPOT_SERVER_PATH does not point to valid HotSpot .diz files. \n" \
1088             "        These files are optional and aid in the debugging of the JVM. \n" \
1089             "        Please check your access to \n" \
1090             "          $(HOTSPOT_SERVER_PATH)/jvm.diz \n" \
1091             "        and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1092             "" >> $(WARNING_FILE) ; \
1093         fi
1094     else
1095         @if [ ! -r $(HOTSPOT_SERVER_PATH)/jvm.map ]; then \
1096           $(ECHO) "WARNING: HOTSPOT_SERVER_PATH does not point to valid HotSpot .map files. \n" \
1097             "        These files are optional and aid in the debugging of the JVM. \n" \
1098             "        Please check your access to \n" \
1099             "          $(HOTSPOT_SERVER_PATH)/jvm.map \n" \
1100             "        and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1101             "" >> $(WARNING_FILE) ; \
1102         fi
1103         @if [ ! -r $(HOTSPOT_SERVER_PATH)/jvm.pdb ]; then \
1104           $(ECHO) "WARNING: HOTSPOT_SERVER_PATH does not point to valid HotSpot .pdb files. \n" \
1105             "        These files are optional and aid in the debugging of the JVM. \n" \
1106             "        Please check your access to \n" \
1107             "          $(HOTSPOT_SERVER_PATH)/jvm.pdb \n" \
1108             "        and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1109             "" >> $(WARNING_FILE) ; \
1110         fi
1111     endif
1112   endif 
1113 endif   
1114 
1115 
1116 ######################################################
1117 # Check for existence of misc Hotspot imported files
1118 ######################################################
1119 HOTSPOT_INCLUDE_FILE_LIST  = jvmti.h
1120 HOTSPOT_INCLUDE_FILE_LIST  += jvmticmlr.h
1121 #HOTSPOT_INCLUDE_FILE_LIST += jni.h jni_md.h
1122 #HOTSPOT_INCLUDE_FILE_LIST += jvm.h jvm_md.h
1123 #HOTSPOT_INCLUDE_FILE_LIST += jmm.h
1124 TMP_SDK_INCLUDE_FILE_LIST=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.h)
1125 TMP_SDK_INCLUDE_FILE_DIFFS=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.hdiffs)
1126 
1127 # These include files must have a pattern: 'version: MAJOR.MINOR.MICRO'
1128 #    where MACRO, MINOR, and MICRO are numbers, e.g. 1.0.1, 0.2.90, etc.
1129 #    The critical version we are checking is MAJOR.MINOR, we print all three
1130 #    when we detect an error.
1131 
1132 TMP_SDK_INCLUDE_FIND_VERSION= $(EGREP) 'version:'
1133 TMP_SDK_INCLUDE_GET_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \
1134                 $(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9].*@\1@'
1135 TMP_SDK_INCLUDE_GET_FULL_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \
1136                 $(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*@\1@'
1137 
1138 # Compare an interface file (Rule creates 2 temp files: %.h and %.h.IMPORT)
1139 #    Files jvm.h, jvm_md.h and jmm.h are special in that they are not publicly 
1140 #    exported but do represent VM interfaces used by the rest of the jdk.
1141 #    So these 3 will not be found in a promoted build and can only
1142 #    be checked when this represents a full control build (i.e. the
1143 #    HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory).
1144 $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
1145         @$(install-file)
1146         @$(RM) $@.IMPORT
1147         @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \
1148           $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \
1149         elif [ "$(@F)" != "jvm.h" -a "$(@F)" != "jmm.h" ] ; then \
1150           $(ECHO) "WARNING: HOTSPOT_IMPORT_PATH does not contain the interface file $(@F). \n" \
1151             "        Check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1152             "" >> $(WARNING_FILE) ; \
1153           $(CP) $< $@.IMPORT; \
1154         else \
1155           $(CP) $< $@.IMPORT; \
1156         fi
1157 
1158 $(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h
1159         @$(install-file)
1160         @$(RM) $@.IMPORT
1161         @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \
1162           $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \
1163         elif [ "$(@F)" != "jvm_md.h" ] ; then \
1164           $(ECHO) "WARNING: HOTSPOT_IMPORT_PATH does not contain the interface file $(@F). \n" \
1165             "        Check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1166             "" >> $(WARNING_FILE) ; \
1167           $(CP) $< $@.IMPORT; \
1168         else \
1169           $(CP) $< $@.IMPORT; \
1170         fi
1171 
1172 # Compares the two tempfiles: %.h and %.h.IMPORT, answer in %.hdiffs
1173 #   Note: Putting anything into the hdiffs file will trigger generic IMPORT
1174 #         warning message in hotspot_import_include.
1175 #   First checks the major.minor versions, the micro number can differ.
1176 #   Second checks the full version.
1177 #   Lastly does a full diff if the full version differs or it has no version
1178 $(TEMPDIR)/%.hdiffs: $(TEMPDIR)/%.h
1179         @$(prep-target)
1180         @$(TOUCH) $@
1181         @if [ "`$(CAT) $<        | $(TMP_SDK_INCLUDE_GET_VERSION)`" != \
1182               "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_VERSION)`" ] ; then \
1183             $(ECHO) "WARNING: The file $(<F) is not the same interface as the VM version.\n " \
1184               "        this workspace has $(<F) `$(CAT) $< | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)` and \n " \
1185               "        HOTSPOT_IMPORT_PATH contains $(<F) `$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)` \n" \
1186             "" >> $(WARNING_FILE) ; \
1187              $(ECHO) "Version mis-match" > $@ ; \
1188         fi
1189         @if [ "`$(CAT) $<        | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" != \
1190                "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" ] ; then \
1191           $(RM) $<.filtered  $<.IMPORT.filtered; \
1192           $(EGREP) -v 'VERSION' $< > $<.filtered; \
1193           $(EGREP) -v 'VERSION' $<.IMPORT > $<.IMPORT.filtered; \
1194           ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \
1195         elif [ "`$(CAT) $< | $(TMP_SDK_INCLUDE_FIND_VERSION)`" = "" ] ; then \
1196           $(RM) $<.filtered  $<.IMPORT.filtered; \
1197           $(EGREP) -v '@\(#\)' $< > $<.filtered; \
1198           $(EGREP) -v '@\(#\)' $<.IMPORT > $<.IMPORT.filtered; \
1199           ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \
1200         fi
1201 
1202 # Verify all imported hotspot files
1203 sane-hotspot_import:: sane-hotspot_import_dir sane-hotspot_import_include
1204 
1205 # Verify the base directory exists
1206 sane-hotspot_import_dir:
1207         @$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS)
1208         @$(RM) $(TMP_SDK_INCLUDE_FILE_LIST)
1209         @if [ ! -d "$(HOTSPOT_IMPORT_PATH)" ]; then \
1210             $(ECHO) "WARNING: The directory HOTSPOT_IMPORT_PATH=$(HOTSPOT_IMPORT_PATH) \n" \
1211               "      does not exist, check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1212               "" >> $(WARNING_FILE) ; \
1213         fi
1214 
1215 # Verify hotspot include files
1216 sane-hotspot_import_include: $(TMP_SDK_INCLUDE_FILE_LIST) $(TMP_SDK_INCLUDE_FILE_DIFFS)
1217         @if [ "`$(CAT) $(TMP_SDK_INCLUDE_FILE_DIFFS)`" != "" ] ; then \
1218           $(ECHO) "WARNING: Possible HotSpot VM interface conflict. \n" \
1219             "        HOTSPOT_IMPORT_PATH is used to import files from the VM build. \n" \
1220             "        It is also used to verify that any copied files are consistent between \n" \
1221             "        these two components. It has been detected that one or more of the \n" \
1222             "        VM interface files inside this workspace may not match the interfaces \n" \
1223             "        exported by the VM, or the VM versions could not be found. \n" \
1224             "        The list of VM interface files is: \n" \
1225             "            $(HOTSPOT_INCLUDE_FILE_LIST). \n" \
1226             "        This workspace has copies of these files at: \n" \
1227             "          $(SHARE_SRC)/javavm/export and $(PLATFORM_SRC)/javavm/export \n" \
1228             "        for build purposes, and they should contain the same interfaces \n" \
1229             "        as the VM versions imported from: \n" \
1230             "          \$$(HOTSPOT_IMPORT_PATH)/include \n" \
1231             "               (i.e. $(HOTSPOT_IMPORT_PATH)/include) \n" \
1232             "        If an interface indeed doesn't match, then the use of this interface \n" \
1233             "        at JDK runtime could cause serious errors. \n" \
1234             "" >> $(WARNING_FILE) ; \
1235             for i in $(TMP_SDK_INCLUDE_FILE_DIFFS); do \
1236                 if [ -s $$i ] ; then \
1237                   $(ECHO) " " >> $(WARNING_FILE); \
1238                   $(ECHO) "VM Interface Differences: $$i" >> $(WARNING_FILE); \
1239                   $(CAT) $$i >> $(WARNING_FILE); \
1240                   $(ECHO) " " >> $(WARNING_FILE); \
1241                 fi; \
1242             done; \
1243         fi
1244         @$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS)
1245         @$(RM) $(TMP_SDK_INCLUDE_FILE_LIST)
1246 
1247 # The JDI-SA feature is not currently released on some platforms.
1248 # See the Defs-<arch>.gmk files.
1249 
1250 ifeq ($(INCLUDE_SA), true)
1251 # Verify that hotspot Serviceability Agent files are present.  To keep 
1252 # it simple, we will just check for one of them.  The others have arch 
1253 # dependent paths.
1254 
1255 sane-hotspot_import::
1256         @if [ ! -r  $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \
1257           $(ECHO) "WARNING: File $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar does not exist.\n" \
1258             "        The JDI binding for the Serviceability Agent will not be included in the build.\n" \
1259             "        Please check your access to\n" \
1260             "          $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar\n" \
1261             "        and/or check your value of ALT_HOTSPOT_IMPORT_PATH.\n" \
1262             "" >> $(WARNING_FILE) ; \
1263          fi
1264 endif
1265 
1266 ######################################################
1267 # Check the ant version
1268 ######################################################
1269 ANT_CHECK :=$(call CheckVersions,$(ANT_VER),$(REQUIRED_ANT_VER))
1270 sane-ant_version:
1271         @if [ "$(ANT_CHECK)" != "same" \
1272               -a "$(ANT_CHECK)" != "newer" ]; then \
1273           $(ECHO) "ERROR: The version of ant being used is older than \n" \
1274             "      the required version of '$(REQUIRED_ANT_VER)'. \n" \
1275             "      The version of ant found was '$(ANT_VER)'. \n" \
1276             "" >> $(ERROR_FILE) ; \
1277         fi
1278 
1279 ######################################################
1280 # Check the zip file version
1281 ######################################################
1282 ZIP_CHECK :=$(call CheckVersions,$(ZIP_VER),$(REQUIRED_ZIP_VER))
1283 sane-zip_version: sane-unzip_version
1284         @if [ "$(ZIP_CHECK)" != "same" -a "$(ZIP_CHECK)" != "newer" ]; then \
1285           $(ECHO) "WARNING: The version of zip being used is older than \n" \
1286             "      the required version of '$(REQUIRED_ZIP_VER)'. \n" \
1287             "      The version of zip found was '$(ZIP_VER)'. \n" \
1288             "" >> $(WARNING_FILE) ; \
1289         fi
1290 
1291 ######################################################
1292 # Check the unzip file version
1293 ######################################################
1294 UNZIP_CHECK :=$(call CheckVersions,$(UNZIP_VER),$(REQUIRED_UNZIP_VER))
1295 sane-unzip_version:
1296         @if [ "$(UNZIP_CHECK)" != "same" -a "$(UNZIP_CHECK)" != "newer" ]; then \
1297           $(ECHO) "WARNING: The version of unzip being used is older than \n" \
1298             "      the required version of '$(REQUIRED_UNZIP_VER)'. \n" \
1299             "      The version of unzip found was '$(UNZIP_VER)'. \n" \
1300             "" >> $(WARNING_FILE) ; \
1301         fi
1302 
1303 ######################################################
1304 # Check for windows DirectX sdk directory
1305 ######################################################
1306 sane-dxsdk:
1307 ifeq ($(PLATFORM), windows)
1308         @if [ ! -r $(DXSDK_INCLUDE_PATH)/d3d9.h  ]; then \
1309         $(ECHO) "ERROR: You do not have access to a valid DirectX SDK Include dir.\n" \
1310           "      The value of DXSDK_INCLUDE_PATH must point a valid DX SDK dir.\n" \
1311           "      Please check your access to \n" \
1312           "          $(DXSDK_INCLUDE_PATH) \n" \
1313           "      and/or check your value of ALT_DXSDK_PATH or ALT_DXSDK_INCLUDE_PATH.\n" \
1314           "      Microsoft DirectX 9 SDK (Summer 2004 Update or newer) can be downloaded from the following location:\n" \
1315           "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
1316           "      Or  http://www.microsoft.com/directx\n" \
1317           "" >> $(ERROR_FILE) ; \
1318         else \
1319           if [ ! "$(DXSDK_VER)" = "$(REQUIRED_DXSDK_VER)" ]; then \
1320           $(ECHO) "ERROR: The DirectX SDK must be version $(REQUIRED_DXSDK_VER).\n" \
1321             "      $(YOU_ARE_USING) DirectX SDK version: $(DXSDK_VER)\n" \
1322             "      The DirectX SDK was obtained from the following location: \n" \
1323             "          $(DXSDK_PATH) \n" \
1324             "      Please change your DirectX SDK. \n" \
1325             "      Microsoft DirectX 9 SDK (Summer 2004 Update or newer) can be downloaded from the following location:\n" \
1326             "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
1327             "      Or  http://www.microsoft.com/directx\n" \
1328             "" >> $(ERROR_FILE) ; \
1329           else \
1330             if [ -r $(DXSDK_INCLUDE_PATH)/basetsd.h ]; then \
1331               if [ `$(EGREP) -c __int3264 $(DXSDK_INCLUDE_PATH)/basetsd.h` -ne 0 ]; then \
1332               $(ECHO) "WARNING: The DirectX SDK Include directory contains a newer basetsd.h,\n" \
1333                 "      which may indicate that you're using an incorrect version of DirectX SDK.\n" \
1334                 "      This may result in a build failure.\n" \
1335                 "      The DirectX SDK Include dir was obtained from the following location:\n" \
1336                 "         $(DXSDK_INCLUDE_PATH) \n" \
1337                 "      Please change your DirectX SDK to version 9 (Summer 2004 Update or newer).\n" \
1338                 "      Microsoft DirectX 9 SDK can be downloaded from the following location:\n" \
1339                 "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
1340                 "      Or  http://www.microsoft.com/directx\n" \
1341                 "" >> $(WARNING_FILE) ; \
1342               fi \
1343             fi \
1344           fi \
1345         fi
1346 endif
1347 
1348 ######################################################
1349 # Check the linker version(s)
1350 ######################################################
1351 ifeq ($(PLATFORM), windows)
1352   LINK_CHECK  :=$(call CheckVersions,$(LINK_VER),$(REQUIRED_LINK_VER))
1353 endif
1354 sane-link:
1355 ifdef LINK_VER
1356         @if [ "$(LINK_CHECK)" = "missing" ]; then \
1357           $(ECHO) "ERROR: The Linker version is undefined. \n" \
1358             "" >> $(ERROR_FILE) ; \
1359         fi
1360         @if [ "$(LINK_CHECK)" != "same" ]; then \
1361           $(ECHO) "WARNING: To build Java 2 SDK $(JDK_VERSION) you need : \n" \
1362             "      $(REQUIRED_COMPILER_VERSION) - link.exe version '$(REQUIRED_LINK_VER)' \n" \
1363               "      Specifically the $(REQUIRED_COMPILER_NAME) link.exe. \n " \
1364             "      $(YOU_ARE_USING) Linker version '$(LINK_VER)' \n" \
1365             "" >> $(WARNING_FILE) ; \
1366         fi
1367 endif
1368 
1369 ######################################################
1370 # Check the compiler version(s)
1371 ######################################################
1372 ifdef REQUIRED_CC_VER
1373   CC_CHECK  :=$(call CheckVersions,$(CC_VER),$(REQUIRED_CC_VER))
1374 endif
1375 sane-compiler: sane-link
1376 ifdef REQUIRED_CC_VER
1377         @if [ "$(CC_CHECK)" = "missing" ]; then \
1378           $(ECHO) "ERROR: The Compiler version is undefined. \n" \
1379             "" >> $(ERROR_FILE) ; \
1380         fi
1381   ifndef OPENJDK
1382         @if [ "$(CC_CHECK)" != "same" ]; then \
1383               $(ECHO) "WARNING: The $(PLATFORM) compiler is not version $(REQUIRED_COMPILER_VERSION) $(REQUIRED_CC_VER) \n" \
1384               "      Specifically the $(REQUIRED_COMPILER_NAME) compiler. \n " \
1385               "      $(YOU_ARE_USING) $(COMPILER_VERSION): $(CC_VER) \n" \
1386               "      The compiler was obtained from the following location: \n" \
1387               "          $(COMPILER_PATH) \n" \
1388               "" >> $(WARNING_FILE) ; \
1389          fi
1390   endif
1391 endif
1392 
1393 ######################################################
1394 # Check that ALSA headers and libs are installed and 
1395 # that the header has the right version. We only
1396 # need /usr/include/alsa/version.h and /usr/lib/libasound.so
1397 ######################################################
1398 
1399 ifdef REQUIRED_ALSA_VERSION
1400   ALSA_CHECK := $(call CheckVersions,$(ALSA_VERSION),$(REQUIRED_ALSA_VERSION))
1401 endif
1402 sane-alsa-headers:
1403 ifdef REQUIRED_ALSA_VERSION
1404         @if [ "$(ALSA_CHECK)" != "missing" ] ; then \
1405             if [ "$(ALSA_CHECK)" != "same" -a "$(ALSA_CHECK)" != "newer"  ] ; then \
1406                 $(ECHO) "ERROR: The ALSA version must be $(REQUIRED_ALSA_VERSION) or higher. \n" \
1407                 "      You have the following ALSA version installed: $${alsa_version} \n" \
1408                 "      Please reinstall ALSA (drivers and lib). You can download \n" \
1409                 "      the source distribution from http://www.alsa-project.org \n" \
1410                 "      or go to http://www.freshrpms.net/docs/alsa/ for precompiled RPM packages. \n" \
1411                 "" >> $(ERROR_FILE) ; \
1412             fi ; \
1413         else \
1414             $(ECHO) "ERROR: You seem to not have installed ALSA $(REQUIRED_ALSA_VERSION) or higher. \n" \
1415             "      Please install ALSA (drivers and lib). You can download the \n" \
1416             "      source distribution from http://www.alsa-project.org or go to \n" \
1417             "      http://www.freshrpms.net/docs/alsa/ for precompiled RPM packages. \n" \
1418             "" >> $(ERROR_FILE) ; \
1419         fi
1420 endif
1421 
1422 # If a sanity file doesn't exist, just make sure it's dir exists
1423 $(SANITY_FILES):
1424         -@$(prep-target)
1425 
1426 ######################################################
1427 # dump out the variable settings...
1428 ######################################################
1429 sane-settings::
1430         @$(ECHO)  >> $(MESSAGE_FILE)
1431         @$(ECHO) $(ALL_SETTINGS)  >> $(MESSAGE_FILE)
1432         @$(ECHO)  >> $(MESSAGE_FILE)
1433 
1434 ######################################################
1435 # Check for existence of DEPLOY_MSSDK on windows
1436 ######################################################
1437 sane-mssdk_path:
1438 ifeq ($(PLATFORM), windows)
1439         @if [ -z "$(DEPLOY_MSSDK)" ]; then \
1440           $(ECHO) "WARNING: Your DEPLOY_MSSDK setting is empty.\n" \
1441             "        It is recommended to set ALT_DEPLOY_MSSDK.\n" \
1442             "" >> $(WARNING_FILE) ; \
1443         fi
1444         @if [ ! -r "$(DEPLOY_MSSDK)" ]; then \
1445           $(ECHO) "ERROR: You do not have a valid DEPLOY_MSSDK setting. \n" \
1446             "      Please check your access to \n" \
1447             "          $(DEPLOY_MSSDK) \n" \
1448             "      and/or check your value of ALT_DEPLOY_MSSDK. \n" \
1449             "" >> $(ERROR_FILE) ; \
1450         fi
1451 endif
1452 
1453 ######################################################
1454 # Check for existence of the MSSDK on windows
1455 ######################################################
1456 sane-install-mssdk_path:
1457 ifeq ($(PLATFORM), windows)
1458         @if [ -z "$(WINDOWSSDKDIR)" ]; then \
1459           $(ECHO) "WARNING: Your WINDOWSSDKDIR setting is empty.\n" \
1460             "        It is recommended to set ALT_WINDOWSSDKDIR.\n" \
1461             "" >> $(WARNING_FILE) ; \
1462         fi
1463         @if [ ! -r "$(WINDOWSSDKDIR)" ]; then \
1464           $(ECHO) "ERROR: You do not have a valid WINDOWSSDKDIR setting. \n" \
1465             "      Please check your access to \n" \
1466             "          $(WINDOWSSDKDIR) \n" \
1467             "      and/or check your value of ALT_WINDOWSSDKDIR. \n" \
1468             "" >> $(ERROR_FILE) ; \
1469         fi
1470         @if [ -z "$(INSTALL_MSSDK)" ]; then \
1471           $(ECHO) "WARNING: Your INSTALL_MSSDK setting is empty.\n" \
1472             "        It is recommended to set ALT_INSTALL_MSSDK.\n" \
1473             "" >> $(WARNING_FILE) ; \
1474         fi
1475         @if [ ! -r "$(INSTALL_MSSDK)" ]; then \
1476           $(ECHO) "ERROR: You do not have a valid INSTALL_MSSDK setting. \n" \
1477             "      Please check your access to \n" \
1478             "          $(INSTALL_MSSDK) \n" \
1479             "      and/or check your value of ALT_INSTALL_MSSDK. \n" \
1480             "" >> $(ERROR_FILE) ; \
1481         fi
1482 endif
1483 
1484 ######################################################
1485 # Check the GNU C++ compiler for OJI plugin
1486 ######################################################
1487 sane-gcc-compiler:
1488 ifndef OPENJDK
1489   ifeq ($(PLATFORM), linux)
1490     ifeq ($(ARCH_DATA_MODEL), 32)
1491     ifdef ALT_GCC29_COMPILER_PATH
1492         @if [ ! -x $(ALT_GCC29_COMPILER_PATH)/bin/gcc ]; then \
1493             $(ECHO) "ERROR: You do not have a valid ALT_GCC29_COMPILER_PATH setting. \n" \
1494                  "      Please check your access to \n" \
1495                  "      $(ALT_GCC29_COMPILER_PATH)/bin/gcc \n" \
1496                  "      This will affect you if you build the plugin target. \n" \
1497                  "" >> $(ERROR_FILE) ; \
1498     fi
1499       else
1500     ifdef ALT_GCC29_PLUGIN_LIB_PATH
1501         @if [ ! -r $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so ]; then \
1502             $(ECHO) "Error: You do not have a valid ALT_GCC29_PLUGIN_LIB_PATH setting. \n" \
1503                         " Please check your access to \n" \
1504                         " $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so \n" \
1505                         " This will affect you if you build the plugin target, specifically for gcc 2.9 version of OJI plugin library. \n" \
1506                         "" >> $(ERROR_FILE) ; \
1507         fi
1508     else
1509         @if [ ! -r $(GCC29_COMPILER_PATH) ]; then \
1510             $(ECHO) "ERROR: You do not have a valid GCC29_COMPILER_PATH setting. \n" \
1511                     " Please check your access to \n" \
1512                     " $(GCC29_COMPILER_PATH) \n" \
1513               " and/or check your value of ALT_GCC29_COMPILER_PATH or ALT_GCC29_PLUGIN_LIB_PATH \n" \
1514                     " This will affect you if you build the plugin target. \n" \
1515                     "" >> $(ERROR_FILE) ; \
1516         fi
1517         endif # ALT_GCC29_PLUGIN_LIB_PATH
1518       endif # ALT_GCC29_COMPILER_PATH 
1519     endif # ARCH_DATA_MODEL, 32
1520   endif # LINUX
1521 endif  # OPEN_JDK
1522 
1523 
1524 ######################################################
1525 # MOZILLA_HEADERS_PATH must be valid
1526 ######################################################
1527 sane-mozilla:
1528 ifeq ($(ARCH_DATA_MODEL), 32)
1529   ifdef ALT_MOZILLA_HEADERS_PATH
1530         @if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
1531           $(ECHO) "ERROR: ALT_MOZILLA_HEADERS_PATH must be an Absolute Path Name, \n" \
1532             "      not a Relative Path Name. \n" \
1533             "      The current value of ALT_MOZILLA_HEADERS_PATH is \n" \
1534             "          $(ALT_MOZILLA_HEADERS_PATH) \n" \
1535             "      Please fix this and continue your build. \n" \
1536             "" >> $(ERROR_FILE) ; \
1537         fi
1538   endif
1539         @#
1540         @# MOZILLA_HEADERS_PATH must be valid....
1541         @#
1542   ifeq ($(PLATFORM), windows)
1543         @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18.win32/java/bool.h ]; then \
1544           $(ECHO) "ERROR: You do not have access to valid Mozilla header files. \n" \
1545             "      Please check your access to \n" \
1546             "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18.win32/java/bool.h \n" \
1547             "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
1548             "      and on Windows, ALT_JDK_JAVA_DRIVE. \n" \
1549             "" >> $(ERROR_FILE) ; \
1550         fi
1551   else
1552         @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18/java/bool.h ]; then \
1553           $(ECHO) "ERROR: You do not have access to valid Mozilla header files. \n" \
1554             "      Please check your access to \n" \
1555             "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18/java/bool.h \n" \
1556             "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
1557             "" >> $(ERROR_FILE) ; \
1558         fi
1559   endif
1560         @#
1561         @# Check for presence of headers required for new Java Plug-In ("plugin2")
1562         @#
1563         @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/plugin2_mozilla_headers/npapi.h ]; then \
1564           $(ECHO) "ERROR: You do not have access to valid Mozilla header files for the new Java Plug-In. \n" \
1565             "      Please check your access to \n" \
1566             "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/plugin2_mozilla_headers/npapi.h \n" \
1567             "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
1568             "" >> $(ERROR_FILE) ; \
1569         fi
1570 endif
1571 
1572 
1573 ######################################################
1574 # Make sure Java Kernel VM is accessible
1575 ######################################################
1576 sane-kernel-vm:
1577 ifeq ($(PLATFORM), windows)
1578   ifeq ($(ARCH_DATA_MODEL), 32)
1579         @if [ ! -r $(HOTSPOT_KERNEL_PATH)/jvm.dll ]; then \
1580             $(ECHO) "WARNING: Your HOTSPOT_IMPORT_PATH does not include a Kernel VM... \n" \
1581                     "     The kernel installer may not be built (unless hotspot is also). \n" \
1582                     "     $(HOTSPOT_KERNEL_PATH)/jvm.dll \n" \
1583                     "     Please check the value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1584                     >> $(WARNING_FILE) ; \
1585         fi
1586   endif
1587 endif
1588 
1589 ######################################################
1590 # this should be the last rule in any target's sanity rule.
1591 ######################################################
1592 sane-lastrule:
1593 ifndef EXTERNALSANITYCONTROL
1594         @if [ -r $(MESSAGE_FILE) ]; then \
1595           $(CAT) $(MESSAGE_FILE) ; \
1596         fi
1597         @if [ -r $(WARNING_FILE) ]; then \
1598           $(CAT) $(WARNING_FILE) ; \
1599         fi
1600         @if [ "x$(INSANE)" != x ]; then \
1601           $(ECHO) "INSANE mode requested. \n" \
1602             "Sanity will not force a build termination, even with errors.\n" \
1603             "" >> $(ERROR_FILE); \
1604         fi
1605         @if [ -r $(ERROR_FILE) ]; then \
1606           if [ "x$(INSANE)" = x ]; then \
1607             $(ECHO) "Exiting because of the above error(s). \n" \
1608               "">> $(ERROR_FILE); \
1609           fi ; \
1610           $(CAT) $(ERROR_FILE) ; \
1611           if [ "x$(INSANE)" = x ]; then \
1612             exit 1 ; \
1613           fi ; \
1614         fi
1615 ifdef PEDANTIC
1616         @if [ -r $(WARNING_FILE) ]; then \
1617           $(ECHO) "PEDANTIC mode requested. \n" \
1618             "Exiting because of the above warning(s). \n" \
1619             "" >> $(ERROR_FILE); \
1620           $(CAT) $(ERROR_FILE) ; \
1621           exit 1 ; \
1622         fi
1623 endif # PEDANTIC
1624         @if [ ! -r $(ERROR_FILE) ]; then \
1625           $(ECHO) "Sanity check passed." ; \
1626         fi
1627 endif #  EXTERNALSANITYCONTROL
1628