author | duke |
Wed, 05 Jul 2017 18:16:12 +0200 | |
changeset 13187 | b820143a6f1c |
parent 7668 | d4a77089c587 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
7668 | 2 |
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
/* Test program for freetype sanity check. |
|
27 |
Prints "Failed" messages to STDOUT if check fails. */ |
|
28 |
||
137 | 29 |
#include <stdio.h> |
30 |
#include <string.h> |
|
31 |
||
2 | 32 |
#include "ft2build.h" |
33 |
#include FT_FREETYPE_H |
|
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 | 74 |
#define QUOTEMACRO(x) QUOTEME(x) |
75 |
#define QUOTEME(x) #x |
|
76 |
||
137 | 77 |
int main(int argc, char** argv) { |
2 | 78 |
char v[50]; |
79 |
FT_Int major, minor, patch; |
|
80 |
FT_Library library; |
|
81 |
sprintf(v, "%d.%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); |
|
82 |
||
83 |
printf("Required version of freetype: %s\n", |
|
84 |
QUOTEMACRO(REQUIRED_FREETYPE_VERSION)); |
|
85 |
||
86 |
printf("Detected freetype headers: %s\n", v); |
|
87 |
if (strcmp(v, QUOTEMACRO(REQUIRED_FREETYPE_VERSION)) < 0) { |
|
88 |
printf("Failed: headers are too old.\n"); |
|
89 |
} |
|
90 |
||
91 |
FT_Init_FreeType(&library); |
|
92 |
FT_Library_Version(library, &major, &minor, &patch); |
|
93 |
sprintf(v, "%d.%d.%d", major, minor, patch); |
|
94 |
||
95 |
printf("Detected freetype library: %s\n", v); |
|
96 |
if (strcmp(v, QUOTEMACRO(REQUIRED_FREETYPE_VERSION)) < 0) { |
|
97 |
printf("Failed: too old library.\n"); |
|
98 |
} |
|
99 |
||
100 |
return 0; |
|
101 |
} |