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 the extra tools on windows
1024 ######################################################
1025 sane-msdevtools_path:
1026 ifeq ($(PLATFORM), windows)
1027   ifneq ($(COMPILER_VERSION), VS2010)
1028         @if [ "$(MSDEVTOOLS_PATH)" != "" -a ! -r "$(MSDEVTOOLS_PATH)" ]; then \
1029           $(ECHO) "ERROR: You do not have a valid MSDEVTOOLS_PATH setting. \n" \
1030             "      Please check your access to \n" \
1031             "          $(MSDEVTOOLS_PATH) \n" \
1032             "      and/or check your value of ALT_MSDEVTOOLS_PATH. \n" \
1033             "" >> $(ERROR_FILE) ; \
1034         fi
1035   endif
1036 endif
1037 
1038 ######################################################
1039 # Check for existence of Hotspot binaries
1040 ######################################################
1041 sane-hotspot_binaries:
1042 ifeq ($(ARCH_DATA_MODEL), 32)
1043         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
1044           $(ECHO) "ERROR: HOTSPOT_CLIENT_PATH does not point to a valid HotSpot VM. \n" \
1045             "      Please check your access to \n" \
1046             "          $(HOTSPOT_CLIENT_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) \n" \
1047             "      and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1048             "" >> $(ERROR_FILE) ; \
1049         fi
1050 endif
1051         @if [ ! -r $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \
1052           $(ECHO) "ERROR: HOTSPOT_SERVER_PATH does not point to a valid HotSpot VM. \n" \
1053             "      Please check your access to \n" \
1054             "          $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) \n" \
1055             "      and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1056             "" >> $(ERROR_FILE) ; \
1057         fi
1058         @#
1059         @# Check value of HOTSPOT_LIB_PATH
1060         @#
1061 ifeq ($(PLATFORM), windows)
1062         @if [ ! -r $(HOTSPOT_LIB_PATH)/jvm.lib ]; then \
1063           $(ECHO) "ERROR: HOTSPOT_LIB_PATH does not point to a valid HotSpot library. \n" \
1064             "      Please check your access to \n" \
1065             "          $(HOTSPOT_LIB_PATH)/jvm.lib \n" \
1066             "      and/or check your value of ALT_HOTSPOT_LIB_PATH. \n" \
1067             "" >> $(ERROR_FILE) ; \
1068         fi
1069         @#
1070         @# Check for the .map files - its OK if they are not there..
1071         @#
1072   ifeq ($(ARCH_DATA_MODEL), 32)
1073         @# There is no 64-bit HotSpot client VM
1074         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/jvm.map ]; then \
1075           $(ECHO) "WARNING: HOTSPOT_CLIENT_PATH does not point to valid HotSpot .map files. \n" \
1076             "        These files are optional and aid in the debugging of the JVM. \n" \
1077             "        Please check your access to \n" \
1078             "          $(HOTSPOT_CLIENT_PATH)/jvm.map \n" \
1079             "        and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1080             "" >> $(WARNING_FILE) ; \
1081         fi
1082         @if [ ! -r $(HOTSPOT_CLIENT_PATH)/jvm.pdb ]; then \
1083           $(ECHO) "WARNING: HOTSPOT_CLIENT_PATH does not point to valid HotSpot .pdb files. \n" \
1084             "        These files are optional and aid in the debugging of the JVM. \n" \
1085             "        Please check your access to \n" \
1086             "          $(HOTSPOT_CLIENT_PATH)/jvm.pdb \n" \
1087             "        and/or check your value of ALT_HOTSPOT_CLIENT_PATH. \n" \
1088             "" >> $(WARNING_FILE) ; \
1089         fi
1090   endif
1091         @if [ ! -r $(HOTSPOT_SERVER_PATH)/jvm.map ]; then \
1092           $(ECHO) "WARNING: HOTSPOT_SERVER_PATH does not point to valid HotSpot .map files. \n" \
1093             "        These files are optional and aid in the debugging of the JVM. \n" \
1094             "        Please check your access to \n" \
1095             "          $(HOTSPOT_SERVER_PATH)/jvm.map \n" \
1096             "        and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1097             "" >> $(WARNING_FILE) ; \
1098         fi
1099         @if [ ! -r $(HOTSPOT_SERVER_PATH)/jvm.pdb ]; then \
1100           $(ECHO) "WARNING: HOTSPOT_SERVER_PATH does not point to valid HotSpot .pdb files. \n" \
1101             "        These files are optional and aid in the debugging of the JVM. \n" \
1102             "        Please check your access to \n" \
1103             "          $(HOTSPOT_SERVER_PATH)/jvm.pdb \n" \
1104             "        and/or check your value of ALT_HOTSPOT_SERVER_PATH. \n" \
1105             "" >> $(WARNING_FILE) ; \
1106         fi
1107 endif   
1108 
1109 
1110 ######################################################
1111 # Check for existence of misc Hotspot imported files
1112 ######################################################
1113 HOTSPOT_INCLUDE_FILE_LIST  = jvmti.h
1114 HOTSPOT_INCLUDE_FILE_LIST  += jvmticmlr.h
1115 #HOTSPOT_INCLUDE_FILE_LIST += jni.h jni_md.h
1116 #HOTSPOT_INCLUDE_FILE_LIST += jvm.h jvm_md.h
1117 #HOTSPOT_INCLUDE_FILE_LIST += jmm.h
1118 TMP_SDK_INCLUDE_FILE_LIST=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.h)
1119 TMP_SDK_INCLUDE_FILE_DIFFS=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.hdiffs)
1120 
1121 # These include files must have a pattern: 'version: MAJOR.MINOR.MICRO'
1122 #    where MACRO, MINOR, and MICRO are numbers, e.g. 1.0.1, 0.2.90, etc.
1123 #    The critical version we are checking is MAJOR.MINOR, we print all three
1124 #    when we detect an error.
1125 
1126 TMP_SDK_INCLUDE_FIND_VERSION= $(EGREP) 'version:'
1127 TMP_SDK_INCLUDE_GET_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \
1128                 $(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9].*@\1@'
1129 TMP_SDK_INCLUDE_GET_FULL_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \
1130                 $(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*@\1@'
1131 
1132 # Compare an interface file (Rule creates 2 temp files: %.h and %.h.IMPORT)
1133 #    Files jvm.h, jvm_md.h and jmm.h are special in that they are not publicly 
1134 #    exported but do represent VM interfaces used by the rest of the jdk.
1135 #    So these 3 will not be found in a promoted build and can only
1136 #    be checked when this represents a full control build (i.e. the
1137 #    HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory).
1138 $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
1139         @$(install-non-module-file)
1140         @$(RM) $@.IMPORT
1141         @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \
1142           $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \
1143         elif [ "$(@F)" != "jvm.h" -a "$(@F)" != "jmm.h" ] ; then \
1144           $(ECHO) "WARNING: HOTSPOT_IMPORT_PATH does not contain the interface file $(@F). \n" \
1145             "        Check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1146             "" >> $(WARNING_FILE) ; \
1147           $(CP) $< $@.IMPORT; \
1148         else \
1149           $(CP) $< $@.IMPORT; \
1150         fi
1151 
1152 $(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h
1153         @$(install-non-module-file)
1154         @$(RM) $@.IMPORT
1155         @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \
1156           $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \
1157         elif [ "$(@F)" != "jvm_md.h" ] ; then \
1158           $(ECHO) "WARNING: HOTSPOT_IMPORT_PATH does not contain the interface file $(@F). \n" \
1159             "        Check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1160             "" >> $(WARNING_FILE) ; \
1161           $(CP) $< $@.IMPORT; \
1162         else \
1163           $(CP) $< $@.IMPORT; \
1164         fi
1165 
1166 # Compares the two tempfiles: %.h and %.h.IMPORT, answer in %.hdiffs
1167 #   Note: Putting anything into the hdiffs file will trigger generic IMPORT
1168 #         warning message in hotspot_import_include.
1169 #   First checks the major.minor versions, the micro number can differ.
1170 #   Second checks the full version.
1171 #   Lastly does a full diff if the full version differs or it has no version
1172 $(TEMPDIR)/%.hdiffs: $(TEMPDIR)/%.h
1173         @$(prep-target)
1174         @$(TOUCH) $@
1175         @if [ "`$(CAT) $<        | $(TMP_SDK_INCLUDE_GET_VERSION)`" != \
1176               "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_VERSION)`" ] ; then \
1177             $(ECHO) "WARNING: The file $(<F) is not the same interface as the VM version.\n " \
1178               "        this workspace has $(<F) `$(CAT) $< | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)` and \n " \
1179               "        HOTSPOT_IMPORT_PATH contains $(<F) `$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)` \n" \
1180             "" >> $(WARNING_FILE) ; \
1181              $(ECHO) "Version mis-match" > $@ ; \
1182         fi
1183         @if [ "`$(CAT) $<        | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" != \
1184                "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" ] ; then \
1185           $(RM) $<.filtered  $<.IMPORT.filtered; \
1186           $(EGREP) -v 'VERSION' $< > $<.filtered; \
1187           $(EGREP) -v 'VERSION' $<.IMPORT > $<.IMPORT.filtered; \
1188           ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \
1189         elif [ "`$(CAT) $< | $(TMP_SDK_INCLUDE_FIND_VERSION)`" = "" ] ; then \
1190           $(RM) $<.filtered  $<.IMPORT.filtered; \
1191           $(EGREP) -v '@\(#\)' $< > $<.filtered; \
1192           $(EGREP) -v '@\(#\)' $<.IMPORT > $<.IMPORT.filtered; \
1193           ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \
1194         fi
1195 
1196 # Verify all imported hotspot files
1197 sane-hotspot_import:: sane-hotspot_import_dir sane-hotspot_import_include
1198 
1199 # Verify the base directory exists
1200 sane-hotspot_import_dir:
1201         @$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS)
1202         @$(RM) $(TMP_SDK_INCLUDE_FILE_LIST)
1203         @if [ ! -d "$(HOTSPOT_IMPORT_PATH)" ]; then \
1204             $(ECHO) "WARNING: The directory HOTSPOT_IMPORT_PATH=$(HOTSPOT_IMPORT_PATH) \n" \
1205               "      does not exist, check your value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1206               "" >> $(WARNING_FILE) ; \
1207         fi
1208 
1209 # Verify hotspot include files
1210 sane-hotspot_import_include: $(TMP_SDK_INCLUDE_FILE_LIST) $(TMP_SDK_INCLUDE_FILE_DIFFS)
1211         @if [ "`$(CAT) $(TMP_SDK_INCLUDE_FILE_DIFFS)`" != "" ] ; then \
1212           $(ECHO) "WARNING: Possible HotSpot VM interface conflict. \n" \
1213             "        HOTSPOT_IMPORT_PATH is used to import files from the VM build. \n" \
1214             "        It is also used to verify that any copied files are consistent between \n" \
1215             "        these two components. It has been detected that one or more of the \n" \
1216             "        VM interface files inside this workspace may not match the interfaces \n" \
1217             "        exported by the VM, or the VM versions could not be found. \n" \
1218             "        The list of VM interface files is: \n" \
1219             "            $(HOTSPOT_INCLUDE_FILE_LIST). \n" \
1220             "        This workspace has copies of these files at: \n" \
1221             "          $(SHARE_SRC)/javavm/export and $(PLATFORM_SRC)/javavm/export \n" \
1222             "        for build purposes, and they should contain the same interfaces \n" \
1223             "        as the VM versions imported from: \n" \
1224             "          \$$(HOTSPOT_IMPORT_PATH)/include \n" \
1225             "               (i.e. $(HOTSPOT_IMPORT_PATH)/include) \n" \
1226             "        If an interface indeed doesn't match, then the use of this interface \n" \
1227             "        at JDK runtime could cause serious errors. \n" \
1228             "" >> $(WARNING_FILE) ; \
1229             for i in $(TMP_SDK_INCLUDE_FILE_DIFFS); do \
1230                 if [ -s $$i ] ; then \
1231                   $(ECHO) " " >> $(WARNING_FILE); \
1232                   $(ECHO) "VM Interface Differences: $$i" >> $(WARNING_FILE); \
1233                   $(CAT) $$i >> $(WARNING_FILE); \
1234                   $(ECHO) " " >> $(WARNING_FILE); \
1235                 fi; \
1236             done; \
1237         fi
1238         @$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS)
1239         @$(RM) $(TMP_SDK_INCLUDE_FILE_LIST)
1240 
1241 # The JDI-SA feature is not currently released on some platforms.
1242 # See the Defs-<arch>.gmk files.
1243 
1244 ifeq ($(INCLUDE_SA), true)
1245 # Verify that hotspot Serviceability Agent files are present.  To keep 
1246 # it simple, we will just check for one of them.  The others have arch 
1247 # dependent paths.
1248 
1249 sane-hotspot_import::
1250         @if [ ! -r  $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \
1251           $(ECHO) "WARNING: File $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar does not exist.\n" \
1252             "        The JDI binding for the Serviceability Agent will not be included in the build.\n" \
1253             "        Please check your access to\n" \
1254             "          $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar\n" \
1255             "        and/or check your value of ALT_HOTSPOT_IMPORT_PATH.\n" \
1256             "" >> $(WARNING_FILE) ; \
1257          fi
1258 endif
1259 
1260 ######################################################
1261 # Check the ant version
1262 ######################################################
1263 ANT_CHECK :=$(call CheckVersions,$(ANT_VER),$(REQUIRED_ANT_VER))
1264 sane-ant_version:
1265         @if [ "$(ANT_CHECK)" != "same" \
1266               -a "$(ANT_CHECK)" != "newer" ]; then \
1267           $(ECHO) "WARNING: The version of ant being used is older than \n" \
1268             "      the required version of '$(REQUIRED_ANT_VER)'. \n" \
1269             "      The version of ant found was '$(ANT_VER)'. \n" \
1270             "" >> $(WARNING_FILE) ; \
1271         fi
1272 
1273 ######################################################
1274 # Check the zip file version
1275 ######################################################
1276 ZIP_CHECK :=$(call CheckVersions,$(ZIP_VER),$(REQUIRED_ZIP_VER))
1277 sane-zip_version: sane-unzip_version
1278         @if [ "$(ZIP_CHECK)" != "same" -a "$(ZIP_CHECK)" != "newer" ]; then \
1279           $(ECHO) "WARNING: The version of zip being used is older than \n" \
1280             "      the required version of '$(REQUIRED_ZIP_VER)'. \n" \
1281             "      The version of zip found was '$(ZIP_VER)'. \n" \
1282             "" >> $(WARNING_FILE) ; \
1283         fi
1284 
1285 ######################################################
1286 # Check the unzip file version
1287 ######################################################
1288 UNZIP_CHECK :=$(call CheckVersions,$(UNZIP_VER),$(REQUIRED_UNZIP_VER))
1289 sane-unzip_version:
1290         @if [ "$(UNZIP_CHECK)" != "same" -a "$(UNZIP_CHECK)" != "newer" ]; then \
1291           $(ECHO) "WARNING: The version of unzip being used is older than \n" \
1292             "      the required version of '$(REQUIRED_UNZIP_VER)'. \n" \
1293             "      The version of unzip found was '$(UNZIP_VER)'. \n" \
1294             "" >> $(WARNING_FILE) ; \
1295         fi
1296 
1297 ######################################################
1298 # Check for windows DirectX sdk directory
1299 ######################################################
1300 sane-dxsdk:
1301 ifeq ($(PLATFORM), windows)
1302         @if [ ! -r $(DXSDK_INCLUDE_PATH)/d3d9.h  ]; then \
1303         $(ECHO) "ERROR: You do not have access to a valid DirectX SDK Include dir.\n" \
1304           "      The value of DXSDK_INCLUDE_PATH must point a valid DX SDK dir.\n" \
1305           "      Please check your access to \n" \
1306           "          $(DXSDK_INCLUDE_PATH) \n" \
1307           "      and/or check your value of ALT_DXSDK_PATH or ALT_DXSDK_INCLUDE_PATH.\n" \
1308           "      Microsoft DirectX 9 SDK (Summer 2004 Update or newer) can be downloaded from the following location:\n" \
1309           "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
1310           "      Or  http://www.microsoft.com/directx\n" \
1311           "" >> $(ERROR_FILE) ; \
1312         else \
1313           if [ ! "$(DXSDK_VER)" = "$(REQUIRED_DXSDK_VER)" ]; then \
1314           $(ECHO) "ERROR: The DirectX SDK must be version $(REQUIRED_DXSDK_VER).\n" \
1315             "      $(YOU_ARE_USING) DirectX SDK version: $(DXSDK_VER)\n" \
1316             "      The DirectX SDK was obtained from the following location: \n" \
1317             "          $(DXSDK_PATH) \n" \
1318             "      Please change your DirectX SDK. \n" \
1319             "      Microsoft DirectX 9 SDK (Summer 2004 Update or newer) can be downloaded from the following location:\n" \
1320             "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
1321             "      Or  http://www.microsoft.com/directx\n" \
1322             "" >> $(ERROR_FILE) ; \
1323           else \
1324             if [ -r $(DXSDK_INCLUDE_PATH)/basetsd.h ]; then \
1325               if [ `$(EGREP) -c __int3264 $(DXSDK_INCLUDE_PATH)/basetsd.h` -ne 0 ]; then \
1326               $(ECHO) "WARNING: The DirectX SDK Include directory contains a newer basetsd.h,\n" \
1327                 "      which may indicate that you're using an incorrect version of DirectX SDK.\n" \
1328                 "      This may result in a build failure.\n" \
1329                 "      The DirectX SDK Include dir was obtained from the following location:\n" \
1330                 "         $(DXSDK_INCLUDE_PATH) \n" \
1331                 "      Please change your DirectX SDK to version 9 (Summer 2004 Update or newer).\n" \
1332                 "      Microsoft DirectX 9 SDK can be downloaded from the following location:\n" \
1333                 "          http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
1334                 "      Or  http://www.microsoft.com/directx\n" \
1335                 "" >> $(WARNING_FILE) ; \
1336               fi \
1337             fi \
1338           fi \
1339         fi
1340 endif
1341 
1342 ######################################################
1343 # Check the linker version(s)
1344 ######################################################
1345 ifeq ($(PLATFORM), windows)
1346   LINK_CHECK  :=$(call CheckVersions,$(LINK_VER),$(REQUIRED_LINK_VER))
1347 endif
1348 sane-link:
1349 ifdef LINK_VER
1350         @if [ "$(LINK_CHECK)" = "missing" ]; then \
1351           $(ECHO) "ERROR: The Linker version is undefined. \n" \
1352             "" >> $(ERROR_FILE) ; \
1353         fi
1354         @if [ "$(LINK_CHECK)" != "same" ]; then \
1355           $(ECHO) "WARNING: To build Java 2 SDK $(JDK_VERSION) you need : \n" \
1356             "      $(REQUIRED_COMPILER_VERSION) - link.exe version \"$(REQUIRED_LINK_VER)\" \n" \
1357               "      Specifically the $(REQUIRED_COMPILER_NAME) link.exe. \n " \
1358             "      $(YOU_ARE_USING) Linker version \"$(LINK_VER)\" \n" \
1359             "" >> $(WARNING_FILE) ; \
1360         fi
1361 endif
1362 
1363 ######################################################
1364 # Check the compiler version(s)
1365 ######################################################
1366 CC_CHECK  :=$(call CheckVersions,$(CC_VER),$(REQUIRED_CC_VER))
1367 sane-compiler: sane-link
1368         @if [ "$(CC_CHECK)" = "missing" ]; then \
1369           $(ECHO) "ERROR: The Compiler version is undefined. \n" \
1370             "" >> $(ERROR_FILE) ; \
1371         fi
1372 ifndef OPENJDK
1373         @if [ "$(CC_CHECK)" != "same" ]; then \
1374               $(ECHO) "WARNING: The $(PLATFORM) compiler is not version $(REQUIRED_COMPILER_VERSION) $(REQUIRED_CC_VER) \n" \
1375               "      Specifically the $(REQUIRED_COMPILER_NAME) compiler. \n " \
1376               "      $(YOU_ARE_USING) $(COMPILER_VERSION): $(CC_VER) \n" \
1377               "      The compiler was obtained from the following location: \n" \
1378               "          $(COMPILER_PATH) \n" \
1379               "" >> $(WARNING_FILE) ; \
1380          fi
1381 endif
1382 
1383 ######################################################
1384 # Check that ALSA headers and libs are installed and 
1385 # that the header has the right version. We only
1386 # need /usr/include/alsa/version.h and /usr/lib/libasound.so
1387 ######################################################
1388 
1389 ifdef REQUIRED_ALSA_VERSION
1390   ALSA_CHECK := $(call CheckVersions,$(ALSA_VERSION),$(REQUIRED_ALSA_VERSION))
1391 endif
1392 sane-alsa-headers:
1393 ifdef REQUIRED_ALSA_VERSION
1394         @if [ "$(ALSA_CHECK)" != "missing" ] ; then \
1395             if [ "$(ALSA_CHECK)" != "same" -a "$(ALSA_CHECK)" != "newer"  ] ; then \
1396                 $(ECHO) "ERROR: The ALSA version must be $(REQUIRED_ALSA_VERSION) or higher. \n" \
1397                 "      You have the following ALSA version installed: $${alsa_version} \n" \
1398                 "      Please reinstall ALSA (drivers and lib). You can download \n" \
1399                 "      the source distribution from http://www.alsa-project.org \n" \
1400                 "      or go to http://www.freshrpms.net/docs/alsa/ for precompiled RPM packages. \n" \
1401                 "" >> $(ERROR_FILE) ; \
1402             fi ; \
1403         else \
1404             $(ECHO) "ERROR: You seem to not have installed ALSA $(REQUIRED_ALSA_VERSION) or higher. \n" \
1405             "      Please install ALSA (drivers and lib). You can download the \n" \
1406             "      source distribution from http://www.alsa-project.org or go to \n" \
1407             "      http://www.freshrpms.net/docs/alsa/ for precompiled RPM packages. \n" \
1408             "" >> $(ERROR_FILE) ; \
1409         fi
1410 endif
1411 
1412 # If a sanity file doesn't exist, just make sure it's dir exists
1413 $(SANITY_FILES):
1414         -@$(prep-target)
1415 
1416 ######################################################
1417 # dump out the variable settings...
1418 ######################################################
1419 sane-settings::
1420         @$(ECHO)  >> $(MESSAGE_FILE)
1421         @$(ECHO) $(ALL_SETTINGS)  >> $(MESSAGE_FILE)
1422         @$(ECHO)  >> $(MESSAGE_FILE)
1423 
1424 ######################################################
1425 # Check for existence of DEPLOY_MSSDK on windows
1426 ######################################################
1427 sane-mssdk_path:
1428 ifeq ($(PLATFORM), windows)
1429         @if [ -z "$(DEPLOY_MSSDK)" ]; then \
1430           $(ECHO) "WARNING: Your DEPLOY_MSSDK setting is empty.\n" \
1431             "        It is recommended to set ALT_DEPLOY_MSSDK.\n" \
1432             "" >> $(WARNING_FILE) ; \
1433         fi
1434         @if [ ! -r "$(DEPLOY_MSSDK)" ]; then \
1435           $(ECHO) "ERROR: You do not have a valid DEPLOY_MSSDK setting. \n" \
1436             "      Please check your access to \n" \
1437             "          $(DEPLOY_MSSDK) \n" \
1438             "      and/or check your value of ALT_DEPLOY_MSSDK. \n" \
1439             "" >> $(ERROR_FILE) ; \
1440         fi
1441 endif
1442 
1443 ######################################################
1444 # Check for existence of the MSSDK on windows
1445 ######################################################
1446 sane-install-mssdk_path:
1447 ifeq ($(PLATFORM), windows)
1448   ifeq ($(COMPILER_VERSION), VS2010)
1449         @if [ -z "$(WINDOWSSDKDIR)" ]; then \
1450           $(ECHO) "WARNING: Your WINDOWSSDKDIR setting is empty.\n" \
1451             "        It is recommended to set ALT_WINDOWSSDKDIR.\n" \
1452             "" >> $(WARNING_FILE) ; \
1453         fi
1454         @if [ ! -r "$(WINDOWSSDKDIR)" ]; then \
1455           $(ECHO) "ERROR: You do not have a valid WINDOWSSDKDIR setting. \n" \
1456             "      Please check your access to \n" \
1457             "          $(WINDOWSSDKDIR) \n" \
1458             "      and/or check your value of ALT_WINDOWSSDKDIR. \n" \
1459             "" >> $(ERROR_FILE) ; \
1460         fi
1461   endif
1462         @if [ -z "$(INSTALL_MSSDK)" ]; then \
1463           $(ECHO) "WARNING: Your INSTALL_MSSDK setting is empty.\n" \
1464             "        It is recommended to set ALT_INSTALL_MSSDK.\n" \
1465             "" >> $(WARNING_FILE) ; \
1466         fi
1467         @if [ ! -r "$(INSTALL_MSSDK)" ]; then \
1468           $(ECHO) "ERROR: You do not have a valid INSTALL_MSSDK setting. \n" \
1469             "      Please check your access to \n" \
1470             "          $(INSTALL_MSSDK) \n" \
1471             "      and/or check your value of ALT_INSTALL_MSSDK. \n" \
1472             "" >> $(ERROR_FILE) ; \
1473         fi
1474 endif
1475 
1476 ######################################################
1477 # Check for existence of INSTALL_MSIVAL2 on windows
1478 ######################################################
1479 sane-install-msival2_path:
1480 ifeq ($(PLATFORM), windows)
1481         @if [ -z "$(INSTALL_MSIVAL2)" ]; then \
1482           $(ECHO) "WARNING: Your INSTALL_MSIVAL2 setting is empty.\n" \
1483             "        It is recommended to set ALT_INSTALL_MSIVAL2.\n" \
1484             "" >> $(WARNING_FILE) ; \
1485         fi
1486         @if [ ! -r "$(INSTALL_MSIVAL2)" ]; then \
1487           $(ECHO) "ERROR: You do not have a valid INSTALL_MSIVAL2 setting. \n" \
1488             "      Please check your access to \n" \
1489             "          $(INSTALL_MSIVAL2) \n" \
1490             "      and/or check your value of ALT_INSTALL_MSIVAL2. \n" \
1491             "" >> $(ERROR_FILE) ; \
1492         fi
1493 endif
1494 
1495 ######################################################
1496 # Check the Solaris GNU c++ compiler for solaris plugin
1497 ######################################################
1498 sane-gcc-compiler:
1499 ifeq ($(PLATFORM), solaris)
1500   ifndef OPENJDK
1501     @if [ -r $(GCC_COMPILER_PATH) ]; then \
1502           if [ ! "$(GCC_VER)" = $(REQUIRED_GCC_VERSION) ]; then \
1503             $(ECHO) "ERROR: The Solaris GCC compiler version must be $(REQUIRED_GCC_VERSION). \n" \
1504               "      You are using the following compiler version: $(GCC_VER) \n" \
1505               "      The compiler was obtained from the following location: \n" \
1506               "          $(GCC_COMPILER_PATH) \n" \
1507               "      Please change your compiler. \n" \
1508               "" >> $(ERROR_FILE) ; \
1509     fi \
1510         else \
1511           $(ECHO) "ERROR: You do not have a valid GCC_COMPILER_PATH setting. \n" \
1512             "      Please check your access to \n" \
1513             "          $(GCC_COMPILER_PATH) \n" \
1514             "      and/or check your value of ALT_GCC_COMPILER_PATH. \n" \
1515             "      This will affect you if you build the plugin target. \n" \
1516             "" >> $(ERROR_FILE) ; \
1517         fi
1518   endif
1519 
1520   ifeq ($(PLATFORM), linux)
1521     ifdef ALT_GCC29_COMPILER_PATH
1522         @if [ ! -x $(ALT_GCC29_COMPILER_PATH)/bin/gcc ]; then \
1523             $(ECHO) "ERROR: You do not have a valid ALT_GCC29_COMPILER_PATH setting. \n" \
1524                  "      Please check your access to \n" \
1525                  "      $(ALT_GCC29_COMPILER_PATH)/bin/gcc \n" \
1526                  "      This will affect you if you build the plugin target. \n" \
1527                  "" >> $(ERROR_FILE) ; \
1528     fi
1529     endif
1530     ifdef ALT_GCC29_PLUGIN_LIB_PATH
1531         @if [ ! -r $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so ]; then \
1532             $(ECHO) "Error: You do not have a valid ALT_GCC29_PLUGIN_LIB_PATH setting. \n" \
1533                         " Please check your access to \n" \
1534                         " $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so \n" \
1535                         " This will affect you if you build the plugin target, specifically for gcc 2.9 version of OJI plugin library. \n" \
1536                         "" >> $(ERROR_FILE) ; \
1537         fi
1538     else
1539         @if [ ! -r $(GCC29_COMPILER_PATH) ]; then \
1540             $(ECHO) "ERROR: You do not have a valid GCC29_COMPILER_PATH setting. \n" \
1541                     " Please check your access to \n" \
1542                     " $(GCC29_COMPILER_PATH) \n" \
1543                     " and/or check your value of ALT_GCC29_COMPILER_PATH. \n" \
1544                     " This will affect you if you build the plugin target. \n" \
1545                     "" >> $(ERROR_FILE) ; \
1546         fi
1547     endif
1548   endif
1549 endif
1550 
1551 
1552 ######################################################
1553 # MOZILLA_HEADERS_PATH must be valid
1554 ######################################################
1555 sane-mozilla:
1556 ifeq ($(ARCH_DATA_MODEL), 32)
1557   ifdef ALT_MOZILLA_HEADERS_PATH
1558         @if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
1559           $(ECHO) "ERROR: ALT_MOZILLA_HEADERS_PATH must be an Absolute Path Name, \n" \
1560             "      not a Relative Path Name. \n" \
1561             "      The current value of ALT_MOZILLA_HEADERS_PATH is \n" \
1562             "          $(ALT_MOZILLA_HEADERS_PATH) \n" \
1563             "      Please fix this and continue your build. \n" \
1564             "" >> $(ERROR_FILE) ; \
1565         fi
1566   endif
1567         @#
1568         @# MOZILLA_HEADERS_PATH must be valid....
1569         @#
1570   ifeq ($(PLATFORM), windows)
1571         @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18.win32/java/bool.h ]; then \
1572           $(ECHO) "ERROR: You do not have access to valid Mozilla header files. \n" \
1573             "      Please check your access to \n" \
1574             "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18.win32/java/bool.h \n" \
1575             "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
1576             "      and on Windows, ALT_JDK_JAVA_DRIVE. \n" \
1577             "" >> $(ERROR_FILE) ; \
1578         fi
1579   else
1580         @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18/java/bool.h ]; then \
1581           $(ECHO) "ERROR: You do not have access to valid Mozilla header files. \n" \
1582             "      Please check your access to \n" \
1583             "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/mozilla_headers_18/java/bool.h \n" \
1584             "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
1585             "" >> $(ERROR_FILE) ; \
1586         fi
1587   endif
1588         @#
1589         @# Check for presence of headers required for new Java Plug-In ("plugin2")
1590         @#
1591         @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/plugin2_mozilla_headers/npapi.h ]; then \
1592           $(ECHO) "ERROR: You do not have access to valid Mozilla header files for the new Java Plug-In. \n" \
1593             "      Please check your access to \n" \
1594             "          $(subst \,/,$(MOZILLA_HEADERS_PATH))/plugin2_mozilla_headers/npapi.h \n" \
1595             "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
1596             "" >> $(ERROR_FILE) ; \
1597         fi
1598 endif
1599 
1600 
1601 ######################################################
1602 # Make sure Java Kernel VM is accessible
1603 ######################################################
1604 sane-kernel-vm:
1605 ifeq ($(PLATFORM), windows)
1606   ifeq ($(ARCH_DATA_MODEL), 32)
1607         @if [ ! -r $(HOTSPOT_KERNEL_PATH)/jvm.dll ]; then \
1608             $(ECHO) "WARNING: Your HOTSPOT_IMPORT_PATH does not include a Kernel VM... \n" \
1609                     "     The kernel installer may not be built (unless hotspot is also). \n" \
1610                     "     $(HOTSPOT_KERNEL_PATH)/jvm.dll \n" \
1611                     "     Please check the value of ALT_HOTSPOT_IMPORT_PATH. \n" \
1612                     >> $(WARNING_FILE) ; \
1613         fi
1614   endif
1615 endif
1616 
1617 
1618 ######################################################
1619 # SECURITY_BASELINE_131 test
1620 ######################################################
1621 security_baseline_131:
1622 ifeq ($(PLATFORM), windows)
1623         @if [ -z "$(SECURITY_BASELINE_131)" ]; then \
1624             $(ECHO) "WARNING: Your SECURITY_BASELINE_131 setting is empty.\n" \
1625                 "        Setting it to the default value of 1.3.1_20.\n" \
1626                 "        It is recommended to set SECURITY_BASELINE_131.\n" \
1627                 "" >> $(WARNING_FILE) ; \
1628         fi
1629 endif
1630 
1631 ######################################################
1632 # SECURITY_BASELINE_142 test
1633 ######################################################
1634 security_baseline_142:
1635 ifeq ($(PLATFORM), windows)
1636         @if [ -z "$(SECURITY_BASELINE_142)" ]; then \
1637             $(ECHO) "WARNING: Your SECURITY_BASELINE_142 setting is empty.\n" \
1638                 "        Setting it to the default value of 1.4.2_10.\n" \
1639                 "        It is recommended to set SECURITY_BASELINE_142.\n" \
1640                 "" >> $(WARNING_FILE) ; \
1641         fi
1642 endif
1643 
1644 ######################################################
1645 # SECURITY_BASELINE_150 test
1646 ######################################################
1647 security_baseline_150:
1648 ifeq ($(PLATFORM), windows)
1649         @if [ -z "$(SECURITY_BASELINE_150)" ]; then \
1650             $(ECHO) "WARNING: Your SECURITY_BASELINE_150 setting is empty.\n" \
1651                 "        Setting it to the default value of 1.5.0_07.\n" \
1652                 "        It is recommended to set SECURITY_BASELINE_150.\n" \
1653                 "" >> $(WARNING_FILE) ; \
1654         fi
1655 endif
1656 
1657 ######################################################
1658 # SECURITY_BASELINE_160 test
1659 ######################################################
1660 security_baseline_160:
1661 ifeq ($(PLATFORM), windows)
1662         @if [ -z "$(SECURITY_BASELINE_160)" ]; then \
1663             $(ECHO) "WARNING: Your SECURITY_BASELINE_160 setting is empty.\n" \
1664                 "        Setting it to the default value of 1.6.0_11.\n" \
1665                 "        It is recommended to set SECURITY_BASELINE_160.\n" \
1666                 "" >> $(WARNING_FILE) ; \
1667         fi
1668 endif
1669 
1670 
1671 ######################################################
1672 # this should be the last rule in any target's sanity rule.
1673 ######################################################
1674 sane-lastrule:
1675 ifndef EXTERNALSANITYCONTROL
1676         @if [ -r $(MESSAGE_FILE) ]; then \
1677           $(CAT) $(MESSAGE_FILE) ; \
1678         fi
1679         @if [ -r $(WARNING_FILE) ]; then \
1680           $(CAT) $(WARNING_FILE) ; \
1681         fi
1682         @if [ "x$(INSANE)" != x ]; then \
1683           $(ECHO) "INSANE mode requested. \n" \
1684             "Sanity will not force a build termination, even with errors.\n" \
1685             "" >> $(ERROR_FILE); \
1686         fi
1687         @if [ -r $(ERROR_FILE) ]; then \
1688           if [ "x$(INSANE)" = x ]; then \
1689             $(ECHO) "Exiting because of the above error(s). \n" \
1690               "">> $(ERROR_FILE); \
1691           fi ; \
1692           $(CAT) $(ERROR_FILE) ; \
1693           if [ "x$(INSANE)" = x ]; then \
1694             exit 1 ; \
1695           fi ; \
1696         fi
1697 ifdef PEDANTIC
1698         @if [ -r $(WARNING_FILE) ]; then \
1699           $(ECHO) "PEDANTIC mode requested. \n" \
1700             "Exiting because of the above warning(s). \n" \
1701             "" >> $(ERROR_FILE); \
1702           $(CAT) $(ERROR_FILE) ; \
1703           exit 1 ; \
1704         fi
1705 endif # PEDANTIC
1706         @if [ ! -r $(ERROR_FILE) ]; then \
1707           $(ECHO) "Sanity check passed." ; \
1708         fi
1709 endif #  EXTERNALSANITYCONTROL
1710