Make it compile with libtool 2.2.6
[sdlpango.git] / sidebyside_patch / fontconfig.patch
blob229e83c5e648b24db0142bff37207f27d4e4a48f
1 Index: src/fccfg.c
2 ===================================================================
3 --- src/fccfg.c (revision 92)
4 +++ src/fccfg.c (revision 99)
5 @@ -28,7 +28,10 @@
6 #define STRICT
7 #include <windows.h>
8 #undef STRICT
9 +#ifdef SIDEBYSIDE
10 +#define getenv(x) NULL
11 #endif
12 +#endif
14 #if defined (_WIN32) && !defined (R_OK)
15 #define R_OK 4
16 @@ -77,14 +80,14 @@
18 /* If no home, use the temp folder. */
19 FcChar8 dummy[1];
20 - int templen = GetTempPath (1, dummy);
21 + int templen = GetTempPathA (1, dummy);
22 FcChar8 *temp = malloc (templen + 1);
24 if (temp)
26 FcChar8 *cache_dir;
28 - GetTempPath (templen + 1, temp);
29 + GetTempPathA (templen + 1, temp);
30 cache_dir = FcStrPlus (temp, FC_USER_CACHE_FILE);
31 free (temp);
32 if (!FcConfigSetCache (config, cache_dir))
33 @@ -1585,6 +1588,9 @@
34 char *home = getenv ("HOME");
36 #ifdef _WIN32
37 +#ifdef SIDEBYSIDE
38 + return FONTCONFIG_PATH;
39 +#endif
40 if (home == NULL)
41 home = getenv ("USERPROFILE");
42 #endif
43 Index: src/fcxml.c
44 ===================================================================
45 --- src/fcxml.c (revision 92)
46 +++ src/fcxml.c (revision 99)
47 @@ -1704,9 +1704,17 @@
48 break;
50 #ifdef _WIN32
51 - if (strcmp (data, "WINDOWSFONTDIR") == 0)
52 + if (strcmp (data, "WINDOWSFONTDIR") == 0 || strcmp (data, "BINDIR") == 0)
54 int rc;
55 + enum dirtype_e {WINDOWSFONTDIR, BINDIR};
56 + enum dirtype_e dirtoken;
58 + if (strcmp (data, "WINDOWSFONTDIR") == 0)
59 + dirtoken = WINDOWSFONTDIR;
60 + else if (strcmp (data, "BINDIR") == 0)
61 + dirtoken = BINDIR;
63 FcStrFree (data);
64 data = malloc (1000);
65 if (!data)
66 @@ -1715,16 +1723,35 @@
67 break;
69 FcMemAlloc (FC_MEM_STRING, 1000);
70 - rc = GetWindowsDirectory (data, 800);
71 - if (rc == 0 || rc > 800)
72 + if (dirtoken == BINDIR)
74 - FcConfigMessage (parse, FcSevereError, "GetWindowsDirectory failed");
75 - FcStrFree (data);
76 - break;
77 + FcChar8 *p;
78 + rc = GetModuleFileName (NULL, data, 800);
79 + if (rc == 0 || rc > 800)
80 + {
81 + FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed");
82 + FcStrFree (data);
83 + break;
84 + }
85 + p = strrchr (data, '\\');
86 + if (p)
87 + *p = '\0';
88 + else
89 + data[0] = '\0';
91 - if (data [strlen (data) - 1] != '\\')
92 - strcat (data, "\\");
93 - strcat (data, "fonts");
94 + else /* WINDOWSFONTDIR */
95 + {
96 + rc = GetWindowsDirectory (data, 800);
97 + if (rc == 0 || rc > 800)
98 + {
99 + FcConfigMessage (parse, FcSevereError, "GetWindowsDirectory failed");
100 + FcStrFree (data);
101 + break;
103 + if (data [strlen (data) - 1] != '\\')
104 + strcat (data, "\\");
105 + strcat (data, "fonts");
108 #endif
109 if (!FcStrUsesHome (data) || FcConfigHome ())
110 Index: Makefile.am
111 ===================================================================
112 --- Makefile.am (revision 92)
113 +++ Makefile.am (revision 99)
114 @@ -40,7 +40,7 @@
115 config_DATA=fonts.conf fonts.dtd
117 install-data-local:
118 - $(mkinstalldirs) $(DESTDIR)/$(configdir)
119 + $(mkinstalldirs) $(DESTDIR)$(configdir)
120 if [ -f $(DESTDIR)$(configdir)/local.conf ]; then \
121 echo "not overwriting existing $(DESTDIR)$(configdir)/local.conf"; \
122 else if [ -f $(srcdir)/local.conf ]; then \