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