1 /*
2  * Copyright 2011 kubtek <kubtek@mail.com>
3  *
4  * This file is part of StarDict.
5  *
6  * StarDict is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * StarDict is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with StarDict.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef CONFIG_CUSTOM_H
21 #define CONFIG_CUSTOM_H
22 
23 /* include this file at the bottom of config.h
24 the following config.h files should be affected:
25 lib/config.h
26 dict/config.h
27 dict/msvc_2008/config.h
28 tools/config.h
29 */
30 
31 #include <glib.h>
32 #include <glib/gstdio.h>
33 
34 /* g_stat function is declared differently depending on the version of glib
35 GLIB_MICRO_VERSION version number may be incorrect, adjust it if needed.
36 Use stardict_stat_t in the source code to define a structure for g_stat. */
37 #if GLIB_CHECK_VERSION(2, 25, 0)
38   #if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX)
39     // int g_stat (const gchar *filename, struct stat *buf);
40     typedef struct stat stardict_stat_t;
41   #else
42     // int g_stat (const gchar *filename, GStatBuf *buf);
43     typedef GStatBuf stardict_stat_t;
44   #endif
45 #elif GLIB_CHECK_VERSION(2, 24, 0)
46   #if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX)
47     // #define g_stat    stat
48     typedef struct stat stardict_stat_t;
49   #else /* ! G_OS_UNIX */
50     #ifdef G_OS_WIN32
51       #if defined (_MSC_VER) && !defined(_WIN64)
52         // #define _g_stat_struct _stat32
53       #else
54         // #define _g_stat_struct stat
55       #endif
56       // int g_stat      (const gchar           *filename,
57       //                   struct _g_stat_struct *buf);
58       typedef struct _g_stat_struct stardict_stat_t;
59     #else
60       // int g_stat      (const gchar *filename,
61       //                  struct stat *buf);
62       typedef struct stat stardict_stat_t;
63     #endif
64   #endif /* G_OS_UNIX */
65 #elif GLIB_CHECK_VERSION(2, 20, 0)
66   #if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX)
67     // #define g_stat    stat
68     typedef struct stat stardict_stat_t;
69   #else
70     // int g_stat      (const gchar *filename,
71     //                  struct stat *buf);
72     typedef struct stat stardict_stat_t;
73   #endif
74 #else
75   // int g_stat (const gchar *filename, struct stat *buf);
76   typedef struct stat stardict_stat_t;
77 #endif
78 
79 #endif // CONFIG_CUSTOM_H
80