1 #
   2 # Copyright (c) 2005, 2010, 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   FREE_SPACE := $(shell $(DF) -b $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$2;}')
  73   TEMP_FREE_SPACE := $(shell $(DF) -b $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$2;}')
  74   # What kind of system we are using (Variations are Solaris and OpenSolaris)
  75   OS_VERSION := $(shell uname -r)
  76   OS_VARIANT_NAME := $(strip $(shell head -1 /etc/release | awk '{print $$1;}') )
  77   OS_VARIANT_VERSION := $(OS_VERSION)
  78   REQ_PATCH_LIST = $(JDK_TOPDIR)/make/PatchList.solaris
  79   ifeq ($(ARCH_FAMILY), sparc)
  80     PATCH_POSITION = $$4
  81   else
  82     PATCH_POSITION = $$6
  83   endif
  84   ifndef OPENJDK
  85     _GCC_VER :=$(shell $(GCC) -dumpversion 2>&1 )
  86     GCC_VER  :=$(call GetVersion,"$(_GCC_VER)")
  87   endif
  88 endif
  89 
  90 ifeq ($(PLATFORM), linux)
  91   FREE_SPACE := $(shell $(DF) --sync -kP $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
  92   TEMP_FREE_SPACE := $(shell $(DF) --sync -kP $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
  93   # What kind of system we are using (Variation is the Linux vendor)
  94   OS_VERSION := $(shell uname -r)
  95   OS_VARIANT_NAME := $(shell \
  96     if [ -f /etc/fedora-release ] ; then \
  97       echo "Fedora"; \
  98     elif [ -f /etc/redhat-release ] ; then \
  99       echo "RedHat"; \
 100     elif [ -f /etc/SuSE-release ] ; then \
 101       echo "SuSE"; \
 102     else \
 103       echo "Unknown"; \
 104     fi)
 105   OS_VARIANT_VERSION := $(shell \
 106     if [ "$(OS_VARIANT_NAME)" = "Fedora" ] ; then \
 107       $(CAT) /etc/fedora-release | $(HEAD) -1 | $(NAWK) '{ print $$3; }' ; \
 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), windows)
 117   FREE_SPACE := $(shell $(DF) -kP $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
 118   TEMP_FREE_SPACE := $(shell $(DF) -kP $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
 119   # Windows 2000 is 5.0, Windows XP is 5.1, Windows 2003 is 5.2
 120   #    Assume 5.0 (Windows 2000) if systeminfo does not help
 121   WINDOWS_MAPPING-5.0 := Windows2000
 122   WINDOWS_MAPPING-5.1 := WindowsXP
 123   WINDOWS_MAPPING-5.2 := Windows2003
 124   # What kind of system we are using (Variation is the common name)
 125   _OS_VERSION := \
 126     $(shell systeminfo 2> $(DEV_NULL) | \
 127             egrep '^OS Version:' | \
 128             awk '{print $$3;}' )
 129   ifeq ($(_OS_VERSION),)
 130     OS_VERSION = 5.0
 131   else
 132     OS_VERSION = $(call MajorVersion,$(_OS_VERSION)).$(call MinorVersion,$(_OS_VERSION))
 133   endif
 134   OS_VARIANT_NAME := $(WINDOWS_MAPPING-$(OS_VERSION))
 135   OS_VARIANT_VERSION := $(OS_VERSION)
 136   ifdef USING_CYGWIN
 137     # CYGWIN version
 138     _CYGWIN_VER := $(SYSTEM_UNAME)
 139     CYGWIN_VER  :=$(call GetVersion,$(_CYGWIN_VER))
 140   endif
 141   DXSDK_VER := $(shell $(EGREP) DIRECT3D_VERSION $(DXSDK_INCLUDE_PATH)/d3d9.h 2>&1 | \
 142     $(EGREP) "\#define" | $(NAWK) '{print $$3}')
 143 endif
 144 
 145 # Get the version numbers of what we are using
 146 _MAKE_VER  :=$(shell $(MAKE) --version 2>&1 | $(HEAD) -n 1)
 147 _ZIP_VER   :=$(shell $(ZIPEXE) -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^Zip')
 148 _UNZIP_VER :=$(shell $(UNZIP)  -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^UnZip')
 149 _BOOT_VER  :=$(shell $(BOOTDIR)/bin/java -version 2>&1 | $(HEAD) -n 1)
 150 MAKE_VER   :=$(call GetVersion,"$(_MAKE_VER)")
 151 ZIP_VER    :=$(call GetVersion,"$(_ZIP_VER)")
 152 UNZIP_VER  :=$(call GetVersion,"$(_UNZIP_VER)")
 153 BOOT_VER   :=$(call GetVersion,"$(_BOOT_VER)")
 154 
 155 _ANT_VER:=$(shell $(ANT) -version 2>&1 )
 156 ANT_VER:=$(call GetVersion,"$(_ANT_VER)")
 157 
 158 ifdef ALT_BINDIR
 159   ALT_BINDIR_VERSION := $(shell $(ALT_BINDIR)/java$(EXE_SUFFIX) -version 2>&1  | $(NAWK) -F'"' '{ print $$2 }')
 160   ALT_BINDIR_OK := $(shell $(ECHO) $(ALT_BINDIR_VERSION) | $(EGREP) -c '^$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)')
 161 endif
 162 
 163 INSTALL_PATCHES_FILE = $(TEMPDIR)/installed.patches
 164 
 165 # Get ALL_SETTINGS defined
 166 include $(JDK_MAKE_SHARED_DIR)/Sanity-Settings.gmk
 167 
 168 .PHONY: \
 169         sane-copyrightyear\
 170         sane-settings \
 171         sane-insane \
 172         sane-build_number \
 173         sane-os_version \
 174         sane-memory_check \
 175         sane-windows \
 176         sane-locale \
 177         sane-linux \
 178         sane-cygwin \
 179         sane-cygwin-shell \
 180         sane-mks \
 181         sane-arch_data_model \
 182         sane-os_patch_level \
 183         sane-classpath \
 184         sane-java_home \
 185         sane-fonts \
 186         sane-binary-plugs \
 187         sane-variant \
 188         sane-ld_library_path \
 189         sane-ld_library_path_64 \
 190         sane-ld_options \
 191         sane-ld_run_path \
 192         sane-makeflags \
 193         sane-alt_outputdir \
 194         sane-outputdir \
 195         sane-alt_bootdir \
 196         sane-bootdir \
 197         sane-local-bootdir \
 198         sane-cups \
 199         sane-devtools_path \
 200         sane-compiler_path \
 201         sane-unixcommand_path \
 202         sane-usrbin_path \
 203         sane-unixccs_path \
 204         sane-docs_import \
 205         sane-math_iso \
 206         sane-libCrun \
 207         sane-odbcdir \
 208         sane-msdevtools_path \
 209         sane-hotspot_binaries \
 210         sane-hotspot_import \
 211         sane-hotspot_import_dir \
 212         sane-hotspot_import_include \
 213         sane-compiler \
 214         sane-link \
 215         sane-cacerts \
 216         sane-alsa-headers \
 217         sane-ant_version \
 218         sane-zip_version \
 219         sane-unzip_version \
 220         sane-msvcrt_path \
 221         sane-freetype \
 222         sane-build_modules
 223 
 224 ######################################################
 225 # check for COPYRIGHT_YEAR variable
 226 ######################################################
 227 sane-copyrightyear:
 228 ifdef ALT_COPYRIGHT_YEAR
 229         @$(ECHO) "WARNING: ALT_COPYRIGHT_YEAR but not the current year\n" \
 230                                  " will be used for copyright year.\n " \
 231                 "" >>$(WARNING_FILE)
 232 endif
 233 
 234 ######################################################
 235 # check for INSANE variable
 236 ######################################################
 237 sane-insane:
 238 ifdef INSANE
 239         @$(ECHO) "WARNING: You are building in 'INSANE' mode. You \n" \
 240            "        should not use this mode, and in fact, \n" \
 241            "        it may be removed at any time. If you \n" \
 242            "        have build problems as a result of using \n" \
 243            "        INSANE mode, then you should not expect \n" \
 244            "        assistance from anyone with the problems \n" \
 245            "        or consequences you experience. \n" \
 246            "" >> $(WARNING_FILE)
 247 endif
 248 
 249 ######################################################
 250 # check for GNU Make version
 251 ######################################################
 252 MAKE_CHECK :=$(call CheckVersions,$(MAKE_VER),$(REQUIRED_MAKE_VER))
 253 sane-make:
 254         @if [ "$(MAKE_CHECK)" != "same" -a "$(MAKE_CHECK)" != "newer" ]; then \
 255           $(ECHO) "WARNING: The version of make being used is older than \n" \
 256             "      the required version of '$(REQUIRED_MAKE_VER)'. \n" \
 257             "      The version of make found was '$(MAKE_VER)'. \n" \
 258             "" >> $(WARNING_FILE) ; \
 259         fi
 260 
 261 ######################################################
 262 # Check the BUILD_NUMBER to make sure it contains bNN
 263 ######################################################
 264 sane-build_number: 
 265         @if [ "`$(ECHO) $(BUILD_NUMBER) | $(SED) 's@.*b[0-9][0-9]*.*@bNN@'`" != "bNN" ] ; then \
 266             $(ECHO) "WARNING: The BUILD_NUMBER needs to contain b[0-9][0-9]*. Currently BUILD_NUMBER=$(BUILD_NUMBER). \n" \
 267               "        This has been known to cause build failures. \n" \
 268               "" >> $(WARNING_FILE) ; \
 269         fi
 270 
 271 ######################################################
 272 # Check the ARCH_DATA_MODEL setting
 273 ######################################################
 274 sane-arch_data_model:
 275         @if [ "$(ARCH_DATA_MODEL)" != 32 -a "$(ARCH_DATA_MODEL)" != 64 ]; then \
 276             $(ECHO) "ERROR: The setting of ARCH_DATA_MODEL must be 32 or 64.\n" \
 277               "      $(YOU_ARE_USING) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL). \n" \
 278               "" >> $(ERROR_FILE) ; \
 279         fi
 280 
 281 ######################################################
 282 # Check the OS version (windows and linus have release name checks)
 283 #   NOTE: OPENJDK explicitly does not check for OS release information.
 284 #         Unless we know for sure that it will not build somewhere, we cannot
 285 #         generate a fatal sanity error, and a warning about the official
 286 #         build platform just becomes clutter.
 287 ######################################################
 288 ifndef OPENJDK
 289   OS_VERSION_CHECK := \
 290     $(call CheckVersions,$(OS_VERSION),$(REQUIRED_OS_VERSION))
 291   ifeq ($(OS_VARIANT_NAME),$(REQUIRED_OS_VARIANT_NAME))
 292     OS_VARIANT_VERSION_CHECK := \
 293       $(call CheckVersions,$(OS_VARIANT_VERSION),$(REQUIRED_OS_VARIANT_VERSION))
 294   endif
 295 endif
 296 sane-os_version:: sane-arch_data_model sane-memory_check sane-locale sane-os_patch_level
 297 ifndef OPENJDK
 298   ifneq ($(OS_VARIANT_NAME),$(REQUIRED_OS_VARIANT_NAME))
 299     ifeq ($(OS_VERSION_CHECK),missing)
 300         @$(call OfficialErrorMessage,OS version,$(OS_VERSION),$(REQUIRED_OS_VERSION))
 301     endif
 302     ifneq ($(OS_VERSION_CHECK),same)
 303         @$(call OfficialWarningMessage,OS version,$(OS_VERSION),$(REQUIRED_OS_VERSION))
 304     endif
 305         @$(call OfficialWarningMessage,OS variant,$(OS_VARIANT_NAME),$(REQUIRED_OS_VARIANT_NAME))
 306   else
 307     ifneq ($(OS_VARIANT_VERSION_CHECK),same)
 308         @$(call OfficialWarningMessage,$(OS_VARIANT_NAME) version,$(OS_VARIANT_VERSION),$(REQUIRED_OS_VARIANT_VERSION))
 309     endif
 310   endif
 311 endif # OPENJDK
 312 
 313 ifeq ($(PLATFORM), windows)
 314   sane-os_version:: sane-cygwin sane-mks sane-cygwin-shell
 315 endif
 316 
 317 ######################################################
 318 # Check the memory available on this machine
 319 ######################################################
 320 sane-memory_check:
 321         @if [ "$(LOW_MEMORY_MACHINE)" = "true" ]; then \
 322           $(ECHO) "WARNING: This machine appears to only have $(MB_OF_MEMORY)Mb of physical memory, \n" \
 323             "        builds on this machine could be slow. \n" \
 324             "" >> $(WARNING_FILE) ; \
 325         fi
 326 
 327 ######################################################
 328 # Check the locale (value of LC_ALL, not being empty or ==C can be a problem)
 329 ######################################################
 330 sane-locale:
 331 ifneq ($(PLATFORM), windows)
 332         @if [ "$(LC_ALL)" != "" -a "$(LC_ALL)" != "C" ]; then \
 333           $(ECHO) "WARNING: LC_ALL has been set to $(LC_ALL), this can cause build failures. \n" \
 334             "        Try setting LC_ALL to \"C\". \n" \
 335             "" >> $(WARNING_FILE) ; \
 336         fi
 337         @if [ "$(LANG)" != "" -a "$(LANG)" != "C" ]; then \
 338           $(ECHO) "WARNING: LANG has been set to $(LANG), this can cause build failures. \n" \
 339             "        Try setting LANG to \"C\". \n" \
 340             "" >> $(WARNING_FILE) ; \
 341         fi
 342 endif
 343 
 344 ######################################################
 345 # Check the Windows cygwin version
 346 ######################################################
 347 ifeq ($(PLATFORM), windows)
 348   CYGWIN_CHECK :=$(call CheckVersions,$(CYGWIN_VER),$(REQUIRED_CYGWIN_VER))
 349 sane-cygwin:
 350   ifdef USING_CYGWIN
 351     ifeq ($(CYGWIN_CHECK),missing)
 352         @$(call OfficialErrorMessage,CYGWIN version,$(CYGWIN_VER),$(REQUIRED_CYGWIN_VER))
 353     endif
 354     ifeq ($(CYGWIN_CHECK),older)
 355         @$(call OfficialWarningMessage,CYGWIN version,$(CYGWIN_VER),$(REQUIRED_CYGWIN_VER))
 356     endif
 357   endif
 358 endif
 359 
 360 ######################################################
 361 # Check the cygwin shell is used, not cmd.exe
 362 ######################################################
 363 ifeq ($(PLATFORM), windows)
 364 sane-cygwin-shell:
 365   ifdef USING_CYGWIN
 366         @if [ "$(SHLVL)" = "" -a "$(_)" = "" ]; then \
 367           $(ECHO) "ERROR: You are using an unsupported shell. \n" \
 368             "      Use either sh, bash, ksh, zsh, or tcsh. \n" \
 369             "      Using the cmd.exe utility is not supported. \n" \
 370             "      If you still want to try your current shell, \n" \
 371             "      please export SHLVL=1 when running $(MAKE).  \n" \
 372             "" >> $(ERROR_FILE) ; \
 373         fi
 374   endif
 375 endif
 376 
 377 ######################################################
 378 # Check the Windows mks version
 379 ######################################################
 380 ifeq ($(PLATFORM), windows)
 381     MKS_CHECK :=$(call CheckVersions,$(MKS_VER),$(REQUIRED_MKS_VER))
 382 sane-mks:
 383   ifndef USING_CYGWIN
 384     ifeq ($(MKS_CHECK),missing)
 385         @$(call OfficialErrorMessage,MKS version,$(MKS_VER),$(REQUIRED_MKS_VER))
 386     endif
 387     ifeq ($(MKS_CHECK),older)
 388         @$(call OfficialErrorMessage,MKS version,$(MKS_VER),$(REQUIRED_MKS_VER))
 389     endif
 390   endif
 391 endif
 392 
 393 ######################################################
 394 # Get list of installed patches (this file has a particular format)
 395 ######################################################
 396 $(INSTALL_PATCHES_FILE):
 397         @$(prep-target)
 398 ifeq ($(PLATFORM), solaris)
 399   ifeq ($(OS_VERSION),$(REQUIRED_OS_VERSION))
 400         $(SHOWREV) -p > $@ 2>&1
 401   endif
 402 endif
 403         @$(ECHO) "" >> $@
 404 
 405 ######################################################
 406 # Check list of Solaris patches
 407 ######################################################
 408 sane-os_patch_level: $(INSTALL_PATCHES_FILE)
 409 ifeq ($(PLATFORM), solaris)
 410   ifeq ($(OS_VERSION),$(REQUIRED_OS_VERSION))
 411         @$(NAWK) 'BEGIN { \
 412     readingInstallPatches = 0; \
 413     requiredCount = 0; \
 414     installCount = 0; \
 415 } \
 416 { \
 417     if (readingInstallPatches) { \
 418         if ($$1=="Patch:") { \
 419             ns = split($$2,parts,"-");  \
 420             installPatchNo[installCount]=parts[1]; \
 421             installPatchRev[installCount]=parts[2]; \
 422             installCount++; \
 423         } \
 424     } \
 425      \
 426     if (!readingInstallPatches) { \
 427         if (index($$1,"#") != 0) continue; \
 428         if (match($$1,"BUILD") > 0 \
 429         && $$2 == $(OS_VERSION) \
 430         && ($$7 == "REQ" || $$7 == "req") \
 431         && $(PATCH_POSITION) != "none" \
 432         && $(PATCH_POSITION) != "NONE") { \
 433             ns = split($(PATCH_POSITION),parts,"-");  \
 434             requiredPatchNo[requiredCount]=parts[1]; \
 435             requiredPatchRev[requiredCount]=parts[2]; \
 436             requiredCount++; \
 437        } \
 438     } \
 439 } \
 440 END { \
 441     errorCount=0; \
 442     for (i=0; i<requiredCount; i++) { \
 443         foundMatch = 0; \
 444         for (j=0; j<installCount; j++) { \
 445             if (installPatchNo[j] == requiredPatchNo[i] \
 446             && installPatchRev[j] >= requiredPatchRev[i]) { \
 447                 foundMatch = 1; \
 448                 break; \
 449             } \
 450         } \
 451         if ( foundMatch == 0) { \
 452             printf("WARNING: Your solaris install is missing the required patch %s-%s\n", requiredPatchNo[i], requiredPatchRev[i] ); \
 453             printf("         Please update your your system patches or build on a different machine.\n\n" ); \
 454             errorCount++; \
 455         } \
 456     } \
 457 }' $(REQ_PATCH_LIST) readingInstallPatches=1 $(INSTALL_PATCHES_FILE) >> $(WARNING_FILE)
 458   endif
 459 endif # PLATFORM
 460 
 461 ######################################################
 462 # CLASSPATH cannot be set, unless you are insane.
 463 ######################################################
 464 sane-classpath:
 465 ifdef CLASSPATH
 466         @$(ECHO) "ERROR: Your CLASSPATH environment variable is set.  This will \n" \
 467            "      most likely cause the build to fail.  Please unset it \n" \
 468            "      and start your build again. \n" \
 469            "" >> $(ERROR_FILE)
 470 endif
 471 
 472 ######################################################
 473 # JAVA_HOME cannot be set, unless you are insane.
 474 ######################################################
 475 sane-java_home:
 476 ifdef JAVA_HOME
 477         @$(ECHO) "ERROR: Your JAVA_HOME environment variable is set.  This will \n" \
 478            "      most likely cause the build to fail.  Please unset it \n" \
 479            "      and start your build again. \n" \
 480            "" >> $(ERROR_FILE)
 481 endif
 482 
 483 ######################################################
 484 # Make sure the fonts are there
 485 # Exceptions are when explicitly building OPENJDK, or
 486 # when the entire CLOSED_SRC dir is excluded, so we are
 487 # implicitly building OPENJDK
 488 ######################################################
 489 FONT_FILE=$(CLOSED_SRC)/share/lib/fonts/LucidaTypewriterRegular.ttf
 490 sane-fonts:
 491 ifndef OPENJDK
 492         @if [ -d $(CLOSED_SRC) ] ; then \
 493          if [ ! -f $(FONT_FILE) ] ; then \
 494           $(ECHO) "ERROR: Missing $(FONT_FILE). \n" \
 495            "      Verify you have downloaded and overlayed on the source area all the binary files. \n" \
 496            "" >> $(ERROR_FILE); \
 497         fi \
 498         fi
 499 endif
 500 
 501 ######################################################
 502 # If building OPENJDK check pre-built binaries are
 503 # available for binary plug source components.
 504 ######################################################
 505 ifdef OPENJDK
 506 sane-binary-plugs:
 507   ifeq ($(IMPORT_BINARY_PLUGS),true)
 508         @if [ ! -d "$(BINARY_PLUGS_PATH)" ]; then \
 509           $(ECHO) "WARNING: Can't locate pre-built libraries. \n" \
 510             "      Please check your access to \n" \
 511             "          $(BINARY_PLUGS_PATH) \n" \
 512             "      and/or check your value of ALT_BINARY_PLUGS_PATH. \n" \
 513            "" >> $(WARNING_FILE); \
 514         fi
 515   endif
 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         @# OUTPUTDIR must have enough free space...
 729         @#
 730         @if [ $(FREE_SPACE) -lt $(REQUIRED_FREE_SPACE) ]; then \
 731           $(ECHO) "WARNING: You may not have enough free space in your OUTPUTDIR. The \n" \
 732             "        current value of OUTPUTDIR is \n" \
 733             "            $(OUTPUTDIR) \n" \
 734             "        You need "$(REQUIRED_FREE_SPACE)" Kbytes free on this device to build \n" \
 735             "        and it appears that only "$(FREE_SPACE)" Kbytes are free. \n" \
 736             "        Either obtain more space or set ALT_OUTPUTDIR to a larger disk. \n" \
 737             "" >> $(WARNING_FILE) ; \
 738         fi
 739 
 740 ######################################################
 741 # if specified, ALT_BOOTDIR must point to non-relative path if set
 742 ######################################################
 743 sane-alt_bootdir:
 744 ifdef ALT_BOOTDIR
 745         @if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
 746           $(ECHO) "ERROR: ALT_BOOTDIR must be an Absolute Path Name, \n" \
 747             "      not a Relative Path Name. \n" \
 748             "      The current value of ALT_BOOTDIR is \n" \
 749             "          $(ALT_BOOTDIR) \n" \
 750             "      Please fix this and continue your build. \n" \
 751             "" >> $(ERROR_FILE) ; \
 752         fi
 753 endif
 754 
 755 ######################################################
 756 # BOOTDIR must point to a valid JDK.
 757 ######################################################
 758 BOOT_CHECK :=$(call CheckVersions,$(BOOT_VER),$(REQUIRED_BOOT_VER))
 759 sane-bootdir:
 760         @if [ "$(BOOT_CHECK)" != "same" -a "$(BOOT_CHECK)" != "newer" ]; then \
 761           $(ECHO) "ERROR: Your BOOTDIR environment variable does not point \n" \
 762             "      to a valid JDK for bootstrapping this build. \n" \
 763             "      A JDK $(JDK_MINOR_VERSION) $(MARKET_NAME) build must be bootstrapped using  \n" \
 764             "      JDK $(PREVIOUS_JDK_VERSION) fcs (or later). \n" \
 765             "      Apparently, your bootstrap JDK is version $(BOOT_VER) \n" \
 766             "      Please update your ALT_BOOTDIR setting and start your build again. \n" \
 767             "" >> $(ERROR_FILE) ; \
 768         fi
 769 
 770 ######################################################
 771 # BOOTDIR is recommended to reside on a local drive
 772 ######################################################
 773 sane-local-bootdir:
 774 ifeq ($(PLATFORM), windows)
 775         @if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -c '^[jJ]:'` -ne 0 ]; then \
 776           $(ECHO) "WARNING: Your BOOTDIR is located on the J: drive. Often the J:\n" \
 777             "        drive is mapped over a network. Using a mapped drive for\n" \
 778             "        the BOOTDIR may significantly slow down the build process.\n" \
 779             "        You may want to consider using the ALT_BOOTDIR variable\n" \
 780             "        to point the build to another location for the BOOTDIR instead. \n" \
 781             "        Your current BOOTDIR is:\n" \
 782             "           $(BOOTDIR) \n" \
 783             "" >> $(WARNING_FILE) ; \
 784         fi
 785 endif
 786 
 787 ######################################################
 788 # CACERTS_FILE must be absoulte path and readable
 789 ######################################################
 790 sane-cacerts:
 791   ifdef ALT_CACERTS_FILE
 792         @if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
 793           $(ECHO) "ERROR: ALT_CACERTS_FILE must be an Absolute Path Name, \n" \
 794             "      not a Relative Path Name. \n" \
 795             "      The current value of ALT_CACERTS_FILE is \n" \
 796             "          $(ALT_CACERTS_FILE) \n" \
 797             "      Please fix this and continue your build. \n" \
 798             "" >> $(ERROR_FILE) ; \
 799         fi
 800   endif
 801         @#
 802         @# CACERTS_FILE must be readable
 803         @#
 804         @if [ ! -r "$(subst \,/,$(CACERTS_FILE))" ]; then \
 805           $(ECHO) "ERROR: You do not have access to a valid cacerts file. \n" \
 806             "      Please check your access to \n" \
 807             "          $(subst \,/,$(CACERTS_FILE)) \n" \
 808             "      and/or check your value of ALT_CACERTS_FILE. \n" \
 809             "" >> $(ERROR_FILE) ; \
 810         fi
 811         @#
 812         @# CACERTS_FILE must be a file
 813         @#
 814         @if [ -d "$(subst \,/,$(CACERTS_FILE))" ]; then \
 815           $(ECHO) "ERROR: You do not have access to a valid cacerts file.\n" \
 816             "      The value of CACERTS_FILE must point to a normal file.\n" \
 817             "      Please check your access to \n" \
 818             "          $(subst \,/,$(CACERTS_FILE)) \n" \
 819             "      and/or check your value of ALT_CACERTS_FILE. \n" \
 820             "" >> $(ERROR_FILE) ; \
 821         fi
 822 
 823 
 824 ######################################################
 825 # Check for availability of FreeType (OpenJDK specific)
 826 ######################################################
 827 
 828 ifdef OPENJDK
 829 
 830 # The freetypecheck Makefile prints out "Failed" if not good enough
 831 $(TEMPDIR)/freetypeinfo: FRC
 832         @$(prep-target)
 833         @(($(CD) $(BUILDDIR)/tools/freetypecheck && $(MAKE)) || \
 834             $(ECHO) "Failed to build freetypecheck." ) > $@
 835 
 836 sane-freetype: $(TEMPDIR)/freetypeinfo
 837         @if [ "`$(CAT) $< | $(GREP) Fail`" != "" ]; then \
 838           $(ECHO) "ERROR: FreeType version " $(REQUIRED_FREETYPE_VERSION) \
 839                   " or higher is required. \n" \
 840                   "`$(CAT) $<`  \n" >> $(ERROR_FILE) ; \
 841         fi
 842 
 843 else
 844 #do nothing  (not OpenJDK)
 845 sane-freetype: 
 846 endif
 847 
 848 ######################################################
 849 # if specified, BUILD_MODULES must contain valid values.
 850 ######################################################
 851 MODULES_REGEX="all|base|desktop|management|enterprise|misc|tools"
 852 sane-build_modules:
 853 ifdef BUILD_MODULES
 854         @for m in $(BUILD_MODULES) ; do \
 855             valid=`$(ECHO) $$m | $(EGREP) $(MODULES_REGEX)`; \
 856             if [ "x$$valid" = "x" ] ; then \
 857                 $(ECHO) "ERROR: $$m set in the BUILD_MODULES variable is invalid.\n" \
 858                 "" >> $(ERROR_FILE); \
 859             fi \
 860         done
 861 endif
 862 
 863 ######################################################
 864 # CUPS_HEADERS_PATH must be valid
 865 ######################################################
 866 sane-cups:
 867 ifneq ($(PLATFORM), windows)
 868         @if [ ! -r $(CUPS_HEADERS_PATH)/cups/cups.h ]; then \
 869           $(ECHO) "ERROR: You do not have access to valid Cups header files. \n" \
 870             "      Please check your access to \n" \
 871             "          $(CUPS_HEADERS_PATH)/cups/cups.h \n" \
 872             "      and/or check your value of ALT_CUPS_HEADERS_PATH, \n" \
 873             "      CUPS is frequently pre-installed on many systems, \n" \
 874             "      or may be downloaded from http://www.cups.org \n" \
 875             "" >> $(ERROR_FILE) ; \
 876         fi
 877 endif
 878 
 879 ######################################################
 880 # Check for existence of DEVTOOLS_PATH
 881 ######################################################
 882 sane-devtools_path:
 883         @if [ "$(DEVTOOLS_PATH)" != "" -a ! -r "$(DEVTOOLS_PATH)" ]; then \
 884           $(ECHO) "ERROR: You do not have a valid DEVTOOLS_PATH setting. \n" \
 885             "      Please check your access to \n" \
 886             "          $(DEVTOOLS_PATH) \n" \
 887             "      and/or check your value of ALT_DEVTOOLS_PATH. \n" \
 888             "" >> $(ERROR_FILE) ; \
 889         fi
 890 
 891 ######################################################
 892 # Check for existence of MS_RUNTIME_LIBRARIES
 893 ######################################################
 894 sane-msvcrt_path:
 895 ifeq ($(PLATFORM), windows)
 896         @if [ ! -r "$(MSVCRT_DLL_PATH)/msvcrt.dll" ]; then \
 897           $(ECHO) "ERROR: You do not have access to msvcrt.dll. \n" \
 898             "      Please check your access to \n" \
 899             "          $(MSVCRT_DLL_PATH) \n" \
 900             "      and/or check your value of ALT_MSVCRT_DLL_PATH. \n" \
 901             "" >> $(ERROR_FILE) ; \
 902         fi
 903   ifneq ($(MSVCRNN_DLL),)
 904         @if [ ! -r "$(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)" ]; then \
 905           $(ECHO) "ERROR: You do not have access to $(MSVCRNN_DLL). \n" \
 906             "      Please check your access to \n" \
 907             "          $(MSVCRNN_DLL_PATH) \n" \
 908             "      and/or check your value of ALT_MSVCRNN_DLL_PATH. \n" \
 909             "" >> $(ERROR_FILE) ; \
 910         fi
 911   endif
 912 endif
 913 
 914 ######################################################
 915 # Check for existence of COMPILER_PATH
 916 ######################################################
 917 sane-compiler_path:
 918         @if [ "$(COMPILER_PATH)" != "" -a ! -r "$(COMPILER_PATH)" ]; then \
 919           $(ECHO) "ERROR: You do not have a valid COMPILER_PATH setting. \n" \
 920             "      Please check your access to \n" \
 921             "          $(COMPILER_PATH) \n" \
 922             "      and/or check your value of ALT_COMPILER_PATH. \n" \
 923             "" >> $(ERROR_FILE) ; \
 924         fi
 925 
 926 ######################################################
 927 # Check for existence of UNIXCOMMAND_PATH
 928 ######################################################
 929 sane-unixcommand_path:
 930         @if [ "$(UNIXCOMMAND_PATH)" != "" -a ! -r "$(UNIXCOMMAND_PATH)" ]; then \
 931           $(ECHO) "ERROR: You do not have a valid UNIXCOMMAND_PATH setting. \n" \
 932             "      Please check your access to \n" \
 933             "          $(UNIXCOMMAND_PATH) \n" \
 934             "      and/or check your value of ALT_UNIXCOMMAND_PATH. \n" \
 935             "" >> $(ERROR_FILE) ; \
 936         fi
 937 ifeq ($(PLATFORM), windows)
 938         @for utility in cpio ar file m4 ; do \
 939           if [ ! -r "`$(WHICH) $${utility}`" ]; then \
 940             $(ECHO) "WARNING: You do not have the utility $${utility} in the \n" \
 941               "      directory $(UNIXCOMMAND_PATH). \n" \
 942               "      The utilities cpio, ar, file, and m4 are required. \n" \
 943               "" >> $(WARNING_FILE) ; \
 944           fi; \
 945         done
 946 endif
 947 
 948 ######################################################
 949 # Check for existence of USRBIN_PATH on linux
 950 ######################################################
 951 sane-usrbin_path:
 952 ifeq ($(PLATFORM), linux)
 953         @if [ "$(USRBIN_PATH)" != "" -a ! -r "$(USRBIN_PATH)" ]; then \
 954             $(ECHO) "ERROR: You do not have a valid USRBIN_PATH setting. \n" \
 955               "      Please check your access to \n" \
 956               "          $(USRBIN_PATH)  \n" \
 957               "      and/or check your value of ALT_USRBIN_PATH. \n" \
 958               "" >> $(ERROR_FILE) ; \
 959           fi
 960 endif
 961 
 962 ######################################################
 963 # Check for existence of UNIXCCS_PATH on solaris
 964 ######################################################
 965 sane-unixccs_path:
 966 ifeq ($(PLATFORM), solaris)
 967         @if [ "$(UNIXCCS_PATH)" != "" -a ! -r "$(UNIXCCS_PATH)" ]; then \
 968           $(ECHO) "ERROR: You do not have a valid UNIXCCS_PATH setting. \n" \
 969             "      Please check your access to \n" \
 970             "          $(UNIXCCS_PATH) \n" \
 971             "      and/or check your value of ALT_UNIXCCS_PATH. \n" \
 972             "" >> $(ERROR_FILE) ; \
 973           fi
 974 endif
 975 
 976 ######################################################
 977 # Verify the docs directory exists
 978 ######################################################
 979 sane-docs_import:
 980         @if [ ! -d "$(HOTSPOT_DOCS_IMPORT_PATH)" ]; then \
 981             $(ECHO) "WARNING: The directory HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_DOCS_IMPORT_PATH) \n" \
 982               "      does not exist, check your value of ALT_HOTSPOT_DOCS_IMPORT_PATH. \n" \
 983               "" >> $(WARNING_FILE) ; \
 984         fi
 985 
 986 ######################################################
 987 # Check for possible problem regarding __fabsf,  math_iso.h and the libm patch.
 988 #    Hotspot should have been changed in Mustang 6.0 Build 47 to not depend
 989 #    on __fabsf, this is just checking that fact now.
 990 ######################################################
 991 sane-math_iso:
 992 ifeq ($(PLATFORM), solaris)
 993         @if [ -f $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
 994           if [ "`$(NM) $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) | $(GREP) __fabsf`" != "" ]; then \
 995             $(ECHO) "WARNING: This version of hotspot relies on __fabsf \n" \
 996               "        which is not always available on Solaris 8 and 9 machines \n" \
 997               "        unless they have the latest libm patch and the file \n" \
 998               "        /usr/include/iso/math_iso.h which can trigger this dependency.\n" \
 999               "        Hotspot should NOT be dependent on this extern, check the \n" \
1000               "        version of the hotspot library you are using. \n" \
1001               "" >> $(WARNING_FILE) ; \
1002             fi; \
1003         fi
1004 endif
1005 
1006 ######################################################
1007 # Check for possible patch problem regarding /usr/lib/libCrun.so
1008 ######################################################
1009 sane-libCrun:
1010 ifeq ($(PLATFORM), solaris)
1011         @if [ "`$(NM) /usr/lib/libCrun.so.1 | $(GREP) __1c2n6FIpv_0_`" = "" ]; then \
1012           $(ECHO) "WARNING: The file /usr/lib/libCrun.so.1 is missing the extern \n" \
1013             "        __1c2n6FIpv_0_ which indicates that the system is missing \n" \
1014             "        a required Solaris patch, or you are using a pre-FCS release \n" \
1015             "        of Solaris 10. You need the latest /usr/lib/libCrun.so.1 \n" \
1016             "        which comes with the FCS release of Solaris 10 and available \n" \
1017             "        through the latest Solaris 8 or 9 C++ runtime patches. \n" \
1018             "" >> $(WARNING_FILE) ; \
1019         fi
1020 endif
1021 
1022 ######################################################
1023 # Check for existence of MSDEVTOOLS_PATH on windows
1024 ######################################################
1025 sane-msdevtools_path:
1026 ifeq ($(PLATFORM), windows)
1027         @if [ "$(MSDEVTOOLS_PATH)" != "" -a ! -r "$(MSDEVTOOLS_PATH)" ]; then \
1028           $(ECHO) "ERROR: You do not have a valid MSDEVTOOLS_PATH setting. \n" \
1029             "      Please check your access to \n" \
1030             "          $(MSDEVTOOLS_PATH) \n" \
1031             "      and/or check your value of ALT_MSDEVTOOLS_PATH. \n" \
1032             "" >> $(ERROR_FILE) ; \
1033         fi
1034 endif
1035 
1036 ######################################################
1037 # Check for existence of Hotspot binaries
1038 ######################################################
1039 sane-hotspot_binaries:
1040 ifeq ($(ARCH_DATA_MODEL), 32)
1041         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
1042           $(ECHO) "ERROR: HOTSPOT_CLIENT_PATH does not point to a valid HotSpot VM. \n" \
1043             "      Please check your access to \n" \
1044             "          $(HOTSPOT_CLIENT_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) \n" \
1045             "      and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1046             "" >> $(ERROR_FILE) ; \
1047         fi
1048 endif
1049         @if [ ! -r $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
1050           $(ECHO) "ERROR: HOTSPOT_SERVER_PATH does not point to a valid HotSpot VM. \n" \
1051             "      Please check your access to \n" \
1052             "          $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) \n" \
1053             "      and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1054             "" >> $(ERROR_FILE) ; \
1055         fi
1056         @#
1057         @# Check value of HOTSPOT_LIB_PATH
1058         @#
1059 ifeq ($(PLATFORM), windows)
1060         @if [ ! -r $(HOTSPOT_LIB_PATH)/jvm.lib ]; then \
1061           $(ECHO) "ERROR: HOTSPOT_LIB_PATH does not point to a valid HotSpot library. \n" \
1062             "      Please check your access to \n" \
1063             "          $(HOTSPOT_LIB_PATH)/jvm.lib \n" \
1064             "      and/or check your value of ALT_HOTSPOT_LIB_PATH. \n" \
1065             "" >> $(ERROR_FILE) ; \
1066         fi
1067         @#
1068         @# Check for the .map files - its OK if they are not there..
1069         @#
1070   ifeq ($(ARCH_DATA_MODEL), 32)
1071         @# There is no 64-bit HotSpot client VM
1072         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/jvm.map ]; then \
1073           $(ECHO) "WARNING: HOTSPOT_CLIENT_PATH does not point to valid HotSpot .map files. \n" \
1074             "        These files are optional and aid in the debugging of the JVM. \n" \
1075             "        Please check your access to \n" \
1076             "          $(HOTSPOT_CLIENT_PATH)/jvm.map \n" \
1077             "        and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1078             "" >> $(WARNING_FILE) ; \
1079         fi
1080         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/jvm.pdb ]; then \
1081           $(ECHO) "WARNING: HOTSPOT_CLIENT_PATH does not point to valid HotSpot .pdb files. \n" \
1082             "        These files are optional and aid in the debugging of the JVM. \n" \
1083             "        Please check your access to \n" \
1084             "          $(HOTSPOT_CLIENT_PATH)/jvm.pdb \n" \
1085             "        and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1086             "" >> $(WARNING_FILE) ; \
1087         fi
1088   endif
1089         @if [ ! -r $(HOTSPOT_SERVER_PATH)/jvm.map ]; then \
1090           $(ECHO) "WARNING: HOTSPOT_SERVER_PATH does not point to valid HotSpot .map 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_SERVER_PATH)/jvm.map \n" \
1094             "        and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1095             "" >> $(WARNING_FILE) ; \
1096         fi
1097         @if [ ! -r $(HOTSPOT_SERVER_PATH)/jvm.pdb ]; then \
1098           $(ECHO) "WARNING: HOTSPOT_SERVER_PATH does not point to valid HotSpot .pdb files. \n" \
1099             "        These files are optional and aid in the debugging of the JVM. \n" \
1100             "        Please check your access to \n" \
1101             "          $(HOTSPOT_SERVER_PATH)/jvm.pdb \n" \
1102             "        and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1103             "" >> $(WARNING_FILE) ; \
1104         fi
1105 endif   
1106 
1107 
1108 ######################################################
1109 # Check for existence of misc Hotspot imported files
1110 ######################################################
1111 HOTSPOT_INCLUDE_FILE_LIST  = jvmti.h
1112 HOTSPOT_INCLUDE_FILE_LIST  += jvmticmlr.h
1113 #HOTSPOT_INCLUDE_FILE_LIST += jni.h jni_md.h
1114 #HOTSPOT_INCLUDE_FILE_LIST += jvm.h jvm_md.h
1115 #HOTSPOT_INCLUDE_FILE_LIST += jmm.h
1116 TMP_SDK_INCLUDE_FILE_LIST=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.h)
1117 TMP_SDK_INCLUDE_FILE_DIFFS=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.hdiffs)
1118 
1119 # These include files must have a pattern: 'version: MAJOR.MINOR.MICRO'
1120 #    where MACRO, MINOR, and MICRO are numbers, e.g. 1.0.1, 0.2.90, etc.
1121 #    The critical version we are checking is MAJOR.MINOR, we print all three
1122 #    when we detect an error.
1123 
1124 TMP_SDK_INCLUDE_FIND_VERSION= $(EGREP) 'version:'
1125 TMP_SDK_INCLUDE_GET_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \
1126                 $(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9].*@\1@'
1127 TMP_SDK_INCLUDE_GET_FULL_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \
1128                 $(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*@\1@'
1129 
1130 # Compare an interface file (Rule creates 2 temp files: %.h and %.h.IMPORT)
1131 #    Files jvm.h, jvm_md.h and jmm.h are special in that they are not publicly 
1132 #    exported but do represent VM interfaces used by the rest of the jdk.
1133 #    So these 3 will not be found in a promoted build and can only
1134 #    be checked when this represents a full control build (i.e. the
1135 #    HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory).
1136 $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
1137         @$(install-non-module-file)
1138         @$(RM) $@.IMPORT
1139         @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \
1140           $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \
1141         elif [ "$(@F)" != "jvm.h" -a "$(@F)" != "jmm.h" ] ; then \
1142           $(ECHO) "WARNING: HOTSPOT_IMPORT_PATH does not contain the interface file $(@F). \n" \
1143             "        Check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1144             "" >> $(WARNING_FILE) ; \
1145           $(CP) $< $@.IMPORT; \
1146         else \
1147           $(CP) $< $@.IMPORT; \
1148         fi
1149 
1150 $(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h
1151         @$(install-non-module-file)
1152         @$(RM) $@.IMPORT
1153         @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \
1154           $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \
1155         elif [ "$(@F)" != "jvm_md.h" ] ; then \
1156           $(ECHO) "WARNING: HOTSPOT_IMPORT_PATH does not contain the interface file $(@F). \n" \
1157             "        Check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1158             "" >> $(WARNING_FILE) ; \
1159           $(CP) $< $@.IMPORT; \
1160         else \
1161           $(CP) $< $@.IMPORT; \
1162         fi
1163 
1164 # Compares the two tempfiles: %.h and %.h.IMPORT, answer in %.hdiffs
1165 #   Note: Putting anything into the hdiffs file will trigger generic IMPORT
1166 #         warning message in hotspot_import_include.
1167 #   First checks the major.minor versions, the micro number can differ.
1168 #   Second checks the full version.
1169 #   Lastly does a full diff if the full version differs or it has no version
1170 $(TEMPDIR)/%.hdiffs: $(TEMPDIR)/%.h
1171         @$(prep-target)
1172         @$(TOUCH) $@
1173         @if [ "`$(CAT) $<        | $(TMP_SDK_INCLUDE_GET_VERSION)`" != \
1174               "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_VERSION)`" ] ; then \
1175             $(ECHO) "WARNING: The file $(<F) is not the same interface as the VM version.\n " \
1176               "        this workspace has $(<F) `$(CAT) $< | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)` and \n " \
1177               "        HOTSPOT_IMPORT_PATH contains $(<F) `$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)` \n" \
1178             "" >> $(WARNING_FILE) ; \
1179              $(ECHO) "Version mis-match" > $@ ; \
1180         fi
1181         @if [ "`$(CAT) $<        | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" != \
1182                "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" ] ; then \
1183           $(RM) $<.filtered  $<.IMPORT.filtered; \
1184           $(EGREP) -v 'VERSION' $< > $<.filtered; \
1185           $(EGREP) -v 'VERSION' $<.IMPORT > $<.IMPORT.filtered; \
1186           ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \
1187         elif [ "`$(CAT) $< | $(TMP_SDK_INCLUDE_FIND_VERSION)`" = "" ] ; then \
1188           $(RM) $<.filtered  $<.IMPORT.filtered; \
1189           $(EGREP) -v '@\(#\)' $< > $<.filtered; \
1190           $(EGREP) -v '@\(#\)' $<.IMPORT > $<.IMPORT.filtered; \
1191           ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \
1192         fi
1193 
1194 # Verify all imported hotspot files
1195 sane-hotspot_import:: sane-hotspot_import_dir sane-hotspot_import_include
1196 
1197 # Verify the base directory exists
1198 sane-hotspot_import_dir:
1199         @$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS)
1200         @$(RM) $(TMP_SDK_INCLUDE_FILE_LIST)
1201         @if [ ! -d "$(HOTSPOT_IMPORT_PATH)" ]; then \
1202             $(ECHO) "WARNING: The directory HOTSPOT_IMPORT_PATH=$(HOTSPOT_IMPORT_PATH) \n" \
1203               "      does not exist, check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1204               "" >> $(WARNING_FILE) ; \
1205         fi
1206 
1207 # Verify hotspot include files
1208 sane-hotspot_import_include: $(TMP_SDK_INCLUDE_FILE_LIST) $(TMP_SDK_INCLUDE_FILE_DIFFS)
1209         @if [ "`$(CAT) $(TMP_SDK_INCLUDE_FILE_DIFFS)`" != "" ] ; then \
1210           $(ECHO) "WARNING: Possible HotSpot VM interface conflict. \n" \
1211             "        HOTSPOT_IMPORT_PATH is used to import files from the VM build. \n" \
1212             "        It is also used to verify that any copied files are consistent between \n" \
1213             "        these two components. It has been detected that one or more of the \n" \
1214             "        VM interface files inside this workspace may not match the interfaces \n" \
1215             "        exported by the VM, or the VM versions could not be found. \n" \
1216             "        The list of VM interface files is: \n" \
1217             "            $(HOTSPOT_INCLUDE_FILE_LIST). \n" \
1218             "        This workspace has copies of these files at: \n" \
1219             "          $(SHARE_SRC)/javavm/export and $(PLATFORM_SRC)/javavm/export \n" \
1220             "        for build purposes, and they should contain the same interfaces \n" \
1221             "        as the VM versions imported from: \n" \
1222             "          \$$(HOTSPOT_IMPORT_PATH)/include \n" \
1223             "               (i.e. $(HOTSPOT_IMPORT_PATH)/include) \n" \
1224             "        If an interface indeed doesn't match, then the use of this interface \n" \
1225             "        at JDK runtime could cause serious errors. \n" \
1226             "" >> $(WARNING_FILE) ; \
1227             for i in $(TMP_SDK_INCLUDE_FILE_DIFFS); do \
1228                 if [ -s $$i ] ; then \
1229                   $(ECHO) " " >> $(WARNING_FILE); \
1230                   $(ECHO) "VM Interface Differences: $$i" >> $(WARNING_FILE); \
1231                   $(CAT) $$i >> $(WARNING_FILE); \
1232                   $(ECHO) " " >> $(WARNING_FILE); \
1233                 fi; \
1234             done; \
1235         fi
1236         @$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS)
1237         @$(RM) $(TMP_SDK_INCLUDE_FILE_LIST)
1238 
1239 # The JDI-SA feature is not currently released on some platforms.
1240 # See the Defs-<arch>.gmk files.
1241 
1242 ifeq ($(INCLUDE_SA), true)
1243 # Verify that hotspot Serviceability Agent files are present.  To keep 
1244 # it simple, we will just check for one of them.  The others have arch 
1245 # dependent paths.
1246 
1247 sane-hotspot_import::
1248         @if [ ! -r  $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \
1249           $(ECHO) "WARNING: File $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar does not exist.\n" \
1250             "        The JDI binding for the Serviceability Agent will not be included in the build.\n" \
1251             "        Please check your access to\n" \
1252             "          $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar\n" \
1253             "        and/or check your value of ALT_HOTSPOT_IMPORT_PATH.\n" \
1254             "" >> $(WARNING_FILE) ; \
1255          fi
1256 endif
1257 
1258 ######################################################
1259 # Check the ant version
1260 ######################################################
1261 ANT_CHECK :=$(call CheckVersions,$(ANT_VER),$(REQUIRED_ANT_VER))
1262 sane-ant_version:
1263         @if [ "$(ANT_CHECK)" != "same" \
1264               -a "$(ANT_CHECK)" != "newer" ]; then \
1265           $(ECHO) "WARNING: The version of ant being used is older than \n" \
1266             "      the required version of '$(REQUIRED_ANT_VER)'. \n" \
1267             "      The version of ant found was '$(ANT_VER)'. \n" \
1268             "" >> $(WARNING_FILE) ; \
1269         fi
1270 
1271 ######################################################
1272 # Check the zip file version
1273 ######################################################
1274 ZIP_CHECK :=$(call CheckVersions,$(ZIP_VER),$(REQUIRED_ZIP_VER))
1275 sane-zip_version: sane-unzip_version
1276         @if [ "$(ZIP_CHECK)" != "same" -a "$(ZIP_CHECK)" != "newer" ]; then \
1277           $(ECHO) "WARNING: The version of zip being used is older than \n" \
1278             "      the required version of '$(REQUIRED_ZIP_VER)'. \n" \
1279             "      The version of zip found was '$(ZIP_VER)'. \n" \
1280             "" >> $(WARNING_FILE) ; \
1281         fi
1282 
1283 ######################################################
1284 # Check the unzip file version
1285 ######################################################
1286 UNZIP_CHECK :=$(call CheckVersions,$(UNZIP_VER),$(REQUIRED_UNZIP_VER))
1287 sane-unzip_version:
1288         @if [ "$(UNZIP_CHECK)" != "same" -a "$(UNZIP_CHECK)" != "newer" ]; then \
1289           $(ECHO) "WARNING: The version of unzip being used is older than \n" \
1290             "      the required version of '$(REQUIRED_UNZIP_VER)'. \n" \
1291             "      The version of unzip found was '$(UNZIP_VER)'. \n" \
1292             "" >> $(WARNING_FILE) ; \
1293         fi
1294 
1295 ######################################################
1296 # Check for windows DirectX sdk directory
1297 ######################################################
1298 sane-dxsdk:
1299 ifeq ($(PLATFORM), windows)
1300         @if [ ! -r $(DXSDK_INCLUDE_PATH)/d3d9.h  ]; then \
1301         $(ECHO) "ERROR: You do not have access to a valid DirectX SDK Include dir.\n" \
1302           "      The value of DXSDK_INCLUDE_PATH must point a valid DX SDK dir.\n" \
1303           "      Please check your access to \n" \
1304           "          $(DXSDK_INCLUDE_PATH) \n" \
1305           "      and/or check your value of ALT_DXSDK_PATH or ALT_DXSDK_INCLUDE_PATH.\n" \
1306           "      Microsoft DirectX 9 SDK (Summer 2004 Update or newer) can be downloaded from the following location:\n" \
1307           "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
1308           "      Or  http://www.microsoft.com/directx\n" \
1309           "" >> $(ERROR_FILE) ; \
1310         else \
1311           if [ ! "$(DXSDK_VER)" = "$(REQUIRED_DXSDK_VER)" ]; then \
1312           $(ECHO) "ERROR: The DirectX SDK must be version $(REQUIRED_DXSDK_VER).\n" \
1313             "      $(YOU_ARE_USING) DirectX SDK version: $(DXSDK_VER)\n" \
1314             "      The DirectX SDK was obtained from the following location: \n" \
1315             "          $(DXSDK_PATH) \n" \
1316             "      Please change your DirectX SDK. \n" \
1317             "      Microsoft DirectX 9 SDK (Summer 2004 Update or newer) can be downloaded from the following location:\n" \
1318             "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
1319             "      Or  http://www.microsoft.com/directx\n" \
1320             "" >> $(ERROR_FILE) ; \
1321           else \
1322             if [ -r $(DXSDK_INCLUDE_PATH)/basetsd.h ]; then \
1323               if [ `$(EGREP) -c __int3264 $(DXSDK_INCLUDE_PATH)/basetsd.h` -ne 0 ]; then \
1324               $(ECHO) "WARNING: The DirectX SDK Include directory contains a newer basetsd.h,\n" \
1325                 "      which may indicate that you're using an incorrect version of DirectX SDK.\n" \
1326                 "      This may result in a build failure.\n" \
1327                 "      The DirectX SDK Include dir was obtained from the following location:\n" \
1328                 "         $(DXSDK_INCLUDE_PATH) \n" \
1329                 "      Please change your DirectX SDK to version 9 (Summer 2004 Update or newer).\n" \
1330                 "      Microsoft DirectX 9 SDK can be downloaded from the following location:\n" \
1331                 "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
1332                 "      Or  http://www.microsoft.com/directx\n" \
1333                 "" >> $(WARNING_FILE) ; \
1334               fi \
1335             fi \
1336           fi \
1337         fi
1338 endif
1339 
1340 ######################################################
1341 # Check the linker version(s)
1342 ######################################################
1343 ifeq ($(PLATFORM), windows)
1344   LINK_CHECK  :=$(call CheckVersions,$(LINK_VER),$(REQUIRED_LINK_VER))
1345 endif
1346 sane-link:
1347 ifdef LINK_VER
1348         @if [ "$(LINK_CHECK)" = "missing" ]; then \
1349           $(ECHO) "ERROR: The Linker version is undefined. \n" \
1350             "" >> $(ERROR_FILE) ; \
1351         fi
1352         @if [ "$(LINK_CHECK)" != "same" ]; then \
1353           $(ECHO) "WARNING: To build Java 2 SDK $(JDK_VERSION) you need : \n" \
1354             "      $(REQUIRED_COMPILER_VERSION) - link.exe version \"$(REQUIRED_LINK_VER)\" \n" \
1355               "      Specifically the $(REQUIRED_COMPILER_NAME) link.exe. \n " \
1356             "      $(YOU_ARE_USING) Linker version \"$(LINK_VER)\" \n" \
1357             "" >> $(WARNING_FILE) ; \
1358         fi
1359 endif
1360 
1361 ######################################################
1362 # Check the compiler version(s)
1363 ######################################################
1364 CC_CHECK  :=$(call CheckVersions,$(CC_VER),$(REQUIRED_CC_VER))
1365 sane-compiler: sane-link
1366         @if [ "$(CC_CHECK)" = "missing" ]; then \
1367           $(ECHO) "ERROR: The Compiler version is undefined. \n" \
1368             "" >> $(ERROR_FILE) ; \
1369         fi
1370 ifndef OPENJDK
1371         @if [ "$(CC_CHECK)" != "same" ]; then \
1372               $(ECHO) "WARNING: The $(PLATFORM) compiler is not version $(REQUIRED_COMPILER_VERSION) $(REQUIRED_CC_VER) \n" \
1373               "      Specifically the $(REQUIRED_COMPILER_NAME) compiler. \n " \
1374               "      $(YOU_ARE_USING) $(COMPILER_VERSION): $(CC_VER) \n" \
1375               "      The compiler was obtained from the following location: \n" \
1376               "          $(COMPILER_PATH) \n" \
1377               "" >> $(WARNING_FILE) ; \
1378          fi
1379 endif
1380 
1381 ######################################################
1382 # Check that ALSA headers and libs are installed and 
1383 # that the header has the right version. We only
1384 # need /usr/include/alsa/version.h and /usr/lib/libasound.so
1385 ######################################################
1386 
1387 ifdef REQUIRED_ALSA_VERSION
1388   ALSA_CHECK := $(call CheckVersions,$(ALSA_VERSION),$(REQUIRED_ALSA_VERSION))
1389 endif
1390 sane-alsa-headers:
1391 ifdef REQUIRED_ALSA_VERSION
1392         if [ "$(ALSA_CHECK)" != "same" -a "$(ALSA_CHECK)" != "newer"  ] ; then \
1393             $(ECHO) "ERROR: The ALSA version must be $(REQUIRED_ALSA_VERSION) or higher. \n" \
1394               "      You have the following ALSA version installed: $${alsa_version) \n" \
1395               "      Please reinstall ALSA (drivers and lib). You can download \n" \
1396               "      the source distribution from http://www.alsa-project.org \n" \
1397               "      or go to http://www.freshrpms.net/docs/alsa/ for precompiled RPM packages. \n" \
1398               "" >> $(ERROR_FILE) ; \
1399           fi \
1400         else \
1401           $(ECHO) "ERROR: You seem to not have installed ALSA $(REQUIRED_ALSA_VERSION) or higher. \n" \
1402           "      Please install ALSA (drivers and lib). You can download the \n" \
1403           "      source distribution from http://www.alsa-project.org or go to \n" \
1404           "      http://www.freshrpms.net/docs/alsa/ for precompiled RPM packages. \n" \
1405           "" >> $(ERROR_FILE) ; \
1406         fi
1407 endif
1408 
1409 # If a sanity file doesn't exist, just make sure it's dir exists
1410 $(SANITY_FILES):
1411         -@$(prep-target)
1412 
1413 ######################################################
1414 # dump out the variable settings...
1415 ######################################################
1416 sane-settings::
1417         @$(ECHO)  >> $(MESSAGE_FILE)
1418         @$(ECHO) $(ALL_SETTINGS)  >> $(MESSAGE_FILE)
1419         @$(ECHO)  >> $(MESSAGE_FILE)
1420 
1421 ######################################################
1422 # Check for existence of DEPLOY_MSSDK on windows
1423 ######################################################
1424 sane-mssdk_path:
1425 ifeq ($(PLATFORM), windows)
1426         @if [ -z "$(DEPLOY_MSSDK)" ]; then \
1427           $(ECHO) "WARNING: Your DEPLOY_MSSDK setting is empty.\n" \
1428             "        It is recommended to set ALT_DEPLOY_MSSDK.\n" \
1429             "" >> $(WARNING_FILE) ; \
1430         fi
1431         @if [ ! -r "$(DEPLOY_MSSDK)" ]; then \
1432           $(ECHO) "ERROR: You do not have a valid DEPLOY_MSSDK setting. \n" \
1433             "      Please check your access to \n" \
1434             "          $(DEPLOY_MSSDK) \n" \
1435             "      and/or check your value of ALT_DEPLOY_MSSDK. \n" \
1436             "" >> $(ERROR_FILE) ; \
1437         fi
1438 endif
1439 
1440 ######################################################
1441 # Check for existence of INSTALL_MSSDK on windows
1442 ######################################################
1443 sane-install-mssdk_path:
1444 ifeq ($(PLATFORM), windows)
1445         @if [ -z "$(INSTALL_MSSDK)" ]; then \
1446           $(ECHO) "WARNING: Your INSTALL_MSSDK setting is empty.\n" \
1447             "        It is recommended to set ALT_INSTALL_MSSDK.\n" \
1448             "" >> $(WARNING_FILE) ; \
1449         fi
1450         @if [ ! -r "$(INSTALL_MSSDK)" ]; then \
1451           $(ECHO) "ERROR: You do not have a valid INSTALL_MSSDK setting. \n" \
1452             "      Please check your access to \n" \
1453             "          $(INSTALL_MSSDK) \n" \
1454             "      and/or check your value of ALT_INSTALL_MSSDK. \n" \
1455             "" >> $(ERROR_FILE) ; \
1456         fi
1457 endif
1458 
1459 ######################################################
1460 # Check for existence of INSTALL_MSIVAL2 on windows
1461 ######################################################
1462 sane-install-msival2_path:
1463 ifeq ($(PLATFORM), windows)
1464         @if [ -z "$(INSTALL_MSIVAL2)" ]; then \
1465           $(ECHO) "WARNING: Your INSTALL_MSIVAL2 setting is empty.\n" \
1466             "        It is recommended to set ALT_INSTALL_MSIVAL2.\n" \
1467             "" >> $(WARNING_FILE) ; \
1468         fi
1469         @if [ ! -r "$(INSTALL_MSIVAL2)" ]; then \
1470           $(ECHO) "ERROR: You do not have a valid INSTALL_MSIVAL2 setting. \n" \
1471             "      Please check your access to \n" \
1472             "          $(INSTALL_MSIVAL2) \n" \
1473             "      and/or check your value of ALT_INSTALL_MSIVAL2. \n" \
1474             "" >> $(ERROR_FILE) ; \
1475         fi
1476 endif
1477 
1478 ######################################################
1479 # Check the Solaris GNU c++ compiler for solaris plugin
1480 ######################################################
1481 sane-gcc-compiler:
1482 ifeq ($(PLATFORM), solaris)
1483   ifndef OPENJDK
1484     @if [ -r $(GCC_COMPILER_PATH) ]; then \
1485           if [ ! "$(GCC_VER)" = $(REQUIRED_GCC_VERSION) ]; then \
1486             $(ECHO) "ERROR: The Solaris GCC compiler version must be $(REQUIRED_GCC_VERSION). \n" \
1487               "      You are using the following compiler version: $(GCC_VER) \n" \
1488               "      The compiler was obtained from the following location: \n" \
1489               "          $(GCC_COMPILER_PATH) \n" \
1490               "      Please change your compiler. \n" \
1491               "" >> $(ERROR_FILE) ; \
1492     fi \
1493         else \
1494           $(ECHO) "ERROR: You do not have a valid GCC_COMPILER_PATH setting. \n" \
1495             "      Please check your access to \n" \
1496             "          $(GCC_COMPILER_PATH) \n" \
1497             "      and/or check your value of ALT_GCC_COMPILER_PATH. \n" \
1498             "      This will affect you if you build the plugin target. \n" \
1499             "" >> $(ERROR_FILE) ; \
1500         fi
1501   endif
1502 
1503   ifeq ($(PLATFORM), linux)
1504     ifdef ALT_GCC29_COMPILER_PATH
1505         @if [ ! -x $(ALT_GCC29_COMPILER_PATH)/bin/gcc ]; then \
1506             $(ECHO) "ERROR: You do not have a valid ALT_GCC29_COMPILER_PATH setting. \n" \
1507                  "      Please check your access to \n" \
1508                  "      $(ALT_GCC29_COMPILER_PATH)/bin/gcc \n" \
1509                  "      This will affect you if you build the plugin target. \n" \
1510                  "" >> $(ERROR_FILE) ; \
1511     fi
1512     endif
1513     ifdef ALT_GCC29_PLUGIN_LIB_PATH
1514         @if [ ! -r $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so ]; then \
1515             $(ECHO) "Error: You do not have a valid ALT_GCC29_PLUGIN_LIB_PATH setting. \n" \
1516                         " Please check your access to \n" \
1517                         " $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so \n" \
1518                         " This will affect you if you build the plugin target, specifically for gcc 2.9 version of OJI plugin library. \n" \
1519                         "" >> $(ERROR_FILE) ; \
1520         fi
1521     else
1522         @if [ ! -r $(GCC29_COMPILER_PATH) ]; then \
1523             $(ECHO) "ERROR: You do not have a valid GCC29_COMPILER_PATH setting. \n" \
1524                     " Please check your access to \n" \
1525                     " $(GCC29_COMPILER_PATH) \n" \
1526                     " and/or check your value of ALT_GCC29_COMPILER_PATH. \n" \
1527                     " This will affect you if you build the plugin target. \n" \
1528                     "" >> $(ERROR_FILE) ; \
1529         fi
1530     endif
1531   endif
1532 endif
1533 
1534 
1535 ######################################################
1536 # MOZILLA_HEADERS_PATH must be valid
1537 ######################################################
1538 sane-mozilla:
1539 ifeq ($(ARCH_DATA_MODEL), 32)
1540   ifdef ALT_MOZILLA_HEADERS_PATH
1541         @if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
1542           $(ECHO) "ERROR: ALT_MOZILLA_HEADERS_PATH must be an Absolute Path Name, \n" \
1543             "      not a Relative Path Name. \n" \
1544             "      The current value of ALT_MOZILLA_HEADERS_PATH is \n" \
1545             "          $(ALT_MOZILLA_HEADERS_PATH) \n" \
1546             "      Please fix this and continue your build. \n" \
1547             "" >> $(ERROR_FILE) ; \
1548         fi
1549   endif
1550         @#
1551         @# MOZILLA_HEADERS_PATH must be valid....
1552         @#
1553   ifeq ($(PLATFORM), windows)
1554         @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18.win32/java/bool.h ]; then \
1555           $(ECHO) "ERROR: You do not have access to valid Mozilla header files. \n" \
1556             "      Please check your access to \n" \
1557             "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18.win32/java/bool.h \n" \
1558             "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
1559             "      and on Windows, ALT_JDK_JAVA_DRIVE. \n" \
1560             "" >> $(ERROR_FILE) ; \
1561         fi
1562   else
1563         @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18/java/bool.h ]; then \
1564           $(ECHO) "ERROR: You do not have access to valid Mozilla header files. \n" \
1565             "      Please check your access to \n" \
1566             "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18/java/bool.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         @# Check for presence of headers required for new Java Plug-In ("plugin2")
1573         @#
1574         @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/plugin2_mozilla_headers/npapi.h ]; then \
1575           $(ECHO) "ERROR: You do not have access to valid Mozilla header files for the new Java Plug-In. \n" \
1576             "      Please check your access to \n" \
1577             "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/plugin2_mozilla_headers/npapi.h \n" \
1578             "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
1579             "" >> $(ERROR_FILE) ; \
1580         fi
1581 endif
1582 
1583 
1584 ######################################################
1585 # Make sure Java Kernel VM is accessible
1586 ######################################################
1587 sane-kernel-vm:
1588 ifeq ($(PLATFORM), windows)
1589   ifeq ($(ARCH_DATA_MODEL), 32)
1590         @if [ ! -r $(HOTSPOT_KERNEL_PATH)/jvm.dll ]; then \
1591             $(ECHO) "WARNING: Your HOTSPOT_IMPORT_PATH does not include a Kernel VM... \n" \
1592                     "     The kernel installer may not be built (unless hotspot is also). \n" \
1593                     "     $(HOTSPOT_KERNEL_PATH)/jvm.dll \n" \
1594                     "     Please check the value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1595                     >> $(WARNING_FILE) ; \
1596         fi
1597   endif
1598 endif
1599 
1600 
1601 ######################################################
1602 # SECURITY_BASELINE_131 test
1603 ######################################################
1604 security_baseline_131:
1605 ifeq ($(PLATFORM), windows)
1606         @if [ -z "$(SECURITY_BASELINE_131)" ]; then \
1607             $(ECHO) "WARNING: Your SECURITY_BASELINE_131 setting is empty.\n" \
1608                 "        Setting it to the default value of 1.3.1_20.\n" \
1609                 "        It is recommended to set SECURITY_BASELINE_131.\n" \
1610                 "" >> $(WARNING_FILE) ; \
1611         fi
1612 endif
1613 
1614 ######################################################
1615 # SECURITY_BASELINE_142 test
1616 ######################################################
1617 security_baseline_142:
1618 ifeq ($(PLATFORM), windows)
1619         @if [ -z "$(SECURITY_BASELINE_142)" ]; then \
1620             $(ECHO) "WARNING: Your SECURITY_BASELINE_142 setting is empty.\n" \
1621                 "        Setting it to the default value of 1.4.2_10.\n" \
1622                 "        It is recommended to set SECURITY_BASELINE_142.\n" \
1623                 "" >> $(WARNING_FILE) ; \
1624         fi
1625 endif
1626 
1627 ######################################################
1628 # SECURITY_BASELINE_150 test
1629 ######################################################
1630 security_baseline_150:
1631 ifeq ($(PLATFORM), windows)
1632         @if [ -z "$(SECURITY_BASELINE_150)" ]; then \
1633             $(ECHO) "WARNING: Your SECURITY_BASELINE_150 setting is empty.\n" \
1634                 "        Setting it to the default value of 1.5.0_07.\n" \
1635                 "        It is recommended to set SECURITY_BASELINE_150.\n" \
1636                 "" >> $(WARNING_FILE) ; \
1637         fi
1638 endif
1639 
1640 ######################################################
1641 # SECURITY_BASELINE_160 test
1642 ######################################################
1643 security_baseline_160:
1644 ifeq ($(PLATFORM), windows)
1645         @if [ -z "$(SECURITY_BASELINE_160)" ]; then \
1646             $(ECHO) "WARNING: Your SECURITY_BASELINE_160 setting is empty.\n" \
1647                 "        Setting it to the default value of 1.6.0_11.\n" \
1648                 "        It is recommended to set SECURITY_BASELINE_160.\n" \
1649                 "" >> $(WARNING_FILE) ; \
1650         fi
1651 endif
1652 
1653 
1654 ######################################################
1655 # this should be the last rule in any target's sanity rule.
1656 ######################################################
1657 sane-lastrule:
1658 ifndef EXTERNALSANITYCONTROL
1659         @if [ -r $(MESSAGE_FILE) ]; then \
1660           $(CAT) $(MESSAGE_FILE) ; \
1661         fi
1662         @if [ -r $(WARNING_FILE) ]; then \
1663           $(CAT) $(WARNING_FILE) ; \
1664         fi
1665         @if [ "x$(INSANE)" != x ]; then \
1666           $(ECHO) "INSANE mode requested. \n" \
1667             "Sanity will not force a build termination, even with errors.\n" \
1668             "" >> $(ERROR_FILE); \
1669         fi
1670         @if [ -r $(ERROR_FILE) ]; then \
1671           if [ "x$(INSANE)" = x ]; then \
1672             $(ECHO) "Exiting because of the above error(s). \n" \
1673               "">> $(ERROR_FILE); \
1674           fi ; \
1675           $(CAT) $(ERROR_FILE) ; \
1676           if [ "x$(INSANE)" = x ]; then \
1677             exit 1 ; \
1678           fi ; \
1679         fi
1680 ifdef PEDANTIC
1681         @if [ -r $(WARNING_FILE) ]; then \
1682           $(ECHO) "PEDANTIC mode requested. \n" \
1683             "Exiting because of the above warning(s). \n" \
1684             "" >> $(ERROR_FILE); \
1685           $(CAT) $(ERROR_FILE) ; \
1686           exit 1 ; \
1687         fi
1688 endif # PEDANTIC
1689         @if [ ! -r $(ERROR_FILE) ]; then \
1690           $(ECHO) "Sanity check passed." ; \
1691         fi
1692 endif #  EXTERNALSANITYCONTROL
1693