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