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