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