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