jdk/make/tools/freetypecheck/freetypecheck.c
author duke
Wed, 05 Jul 2017 18:16:12 +0200
changeset 13187 b820143a6f1c
parent 7668 d4a77089c587
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
7668
d4a77089c587 6962318: Update copyright year
ohair
parents: 5667
diff changeset
     2
 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3640
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3640
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3640
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3640
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3640
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/* Test program for freetype sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
   Prints "Failed" messages to STDOUT if check fails. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
137
6a67379970da 6674226: Warning errors in freetypecheck
ohair
parents: 2
diff changeset
    29
#include <stdio.h>
6a67379970da 6674226: Warning errors in freetypecheck
ohair
parents: 2
diff changeset
    30
#include <string.h>
6a67379970da 6674226: Warning errors in freetypecheck
ohair
parents: 2
diff changeset
    31
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "ft2build.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include FT_FREETYPE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
3640
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    35
#ifdef _MSC_VER
5667
e9e265b814f3 6961061: make/tools/freetypecheck doesn't build with VS2010 : breaks openjdk builds
prr
parents: 5506
diff changeset
    36
#if _MSC_VER > 1400 && _MSC_VER < 1600
3640
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    37
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    38
/*
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    39
 * When building for Microsoft Windows, your program has a dependency
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    40
 * on msvcr??.dll.
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    41
 *
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    42
 * When using Visual Studio 2005 or later, that must be recorded in
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    43
 * the <program>.exe.manifest file.
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    44
 *
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    45
 * Reference:
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    46
 *     C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    47
 */
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    48
#include <crtassem.h>
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    49
#ifdef _M_IX86
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    50
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    51
#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    52
        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    53
        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    54
        "processorArchitecture='x86' "                                  \
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    55
        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    56
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    57
#endif /* _M_IX86 */
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    58
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    59
//This may not be necessary yet for the Windows 64-bit build, but it
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    60
//will be when that build environment is updated.  Need to test to see
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    61
//if it is harmless:
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    62
#ifdef _M_AMD64
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    63
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    64
#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    65
        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    66
        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    67
        "processorArchitecture='amd64' "                                \
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    68
        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    69
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    70
#endif  /* _M_AMD64 */
5667
e9e265b814f3 6961061: make/tools/freetypecheck doesn't build with VS2010 : breaks openjdk builds
prr
parents: 5506
diff changeset
    71
#endif  /* _MSC_VER > 1400 && _MSC_VER < 1600 */
3640
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    72
#endif  /* _MSC_VER */
fd536f8d24a6 6705913: freetype_versioncheck.exe - Unable To Locate Component
tbell
parents: 715
diff changeset
    73
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#define QUOTEMACRO(x) QUOTEME(x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
#define QUOTEME(x) #x
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
137
6a67379970da 6674226: Warning errors in freetypecheck
ohair
parents: 2
diff changeset
    77
int main(int argc, char** argv) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
   char v[50];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
   FT_Int major, minor, patch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
   FT_Library library;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
   sprintf(v, "%d.%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
   printf("Required version of freetype: %s\n",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
       QUOTEMACRO(REQUIRED_FREETYPE_VERSION));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
   printf("Detected freetype headers: %s\n", v);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
   if (strcmp(v, QUOTEMACRO(REQUIRED_FREETYPE_VERSION)) < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
       printf("Failed: headers are too old.\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
   FT_Init_FreeType(&library);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
   FT_Library_Version(library, &major, &minor, &patch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
   sprintf(v, "%d.%d.%d", major, minor, patch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
   printf("Detected freetype library: %s\n", v);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
   if (strcmp(v, QUOTEMACRO(REQUIRED_FREETYPE_VERSION)) < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
      printf("Failed: too old library.\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
   return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
}