1 /* 2 * Copyright (c) 2007, 2010, 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 /* Test program for freetype sanity check. 27 Prints "Failed" messages to STDOUT if check fails. */ 28 29 #include <stdio.h> 30 #include <string.h> 31 32 #include "ft2build.h" 33 #include FT_FREETYPE_H 34 35 #ifdef _MSC_VER 36 #if _MSC_VER > 1400 && _MSC_VER < 1600 37 38 /* 39 * When building for Microsoft Windows, your program has a dependency 40 * on msvcr??.dll. 41 * 42 * When using Visual Studio 2005 or later, that must be recorded in 43 * the <program>.exe.manifest file. 44 * 45 * Reference: 46 * C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h 47 */ 48 #include <crtassem.h> 49 #ifdef _M_IX86 50 51 #pragma comment(linker,"/manifestdependency:\"type='win32' " \ 52 "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \ 53 "version='" _CRT_ASSEMBLY_VERSION "' " \ 54 "processorArchitecture='x86' " \ 55 "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") 56 57 #endif /* _M_IX86 */ 58 59 //This may not be necessary yet for the Windows 64-bit build, but it 60 //will be when that build environment is updated. Need to test to see 61 //if it is harmless: 62 #ifdef _M_AMD64 63 64 #pragma comment(linker,"/manifestdependency:\"type='win32' " \ 65 "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \ 66 "version='" _CRT_ASSEMBLY_VERSION "' " \ 67 "processorArchitecture='amd64' " \ 68 "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") 69 70 #endif /* _M_AMD64 */ 71 #endif /* _MSC_VER > 1400 && _MSC_VER < 1600 */ 72 #endif /* _MSC_VER */ 73 74 #define QUOTEMACRO(x) QUOTEME(x) 75 #define QUOTEME(x) #x 76 77 int main(int argc, char** argv) { 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 }