Bump API version for new plugin entry points (oops)
[geany-mirror.git] / src / prefix.h
blob21ea8f9f2b20815756d8b496e679dc9deab3314b
1 /*
2 * BinReloc - a library for creating relocatable executables
3 * Written by: Mike Hearn <mike@theoretic.com>
4 * Hongli Lai <h.lai@chello.nl>
5 * http://autopackage.org/
7 * This source code is public domain. You can relicense this code
8 * under whatever license you want.
10 * See http://autopackage.org/docs/binreloc/ for
11 * more information and how to use this.
13 * NOTE: if you're using C++ and are getting "undefined reference
14 * to br_*", try renaming prefix.c to prefix.cpp
17 #ifndef GEANY_PREFIX_H
18 #define GEANY_PREFIX_H 1
22 * enrico - all the code below is only compiled and used if ENABLE_BINRELOC is set in config.h,
23 * this only happens if configure option --enable-binreloc was used
25 #ifdef ENABLE_BINRELOC
27 #include <glib.h>
29 G_BEGIN_DECLS
32 /* WARNING, BEFORE YOU MODIFY PREFIX.C:
34 * If you make changes to any of the functions in prefix.c, you MUST
35 * change the BR_NAMESPACE macro.
36 * This way you can avoid symbol table conflicts with other libraries
37 * that also happen to use BinReloc.
39 * Example:
40 * #define BR_NAMESPACE(funcName) foobar_ ## funcName
41 * --> expands br_locate to foobar_br_locate
43 #undef BR_NAMESPACE
44 #define BR_NAMESPACE(funcName) geany_ ## funcName
47 #define br_thread_local_store BR_NAMESPACE(br_thread_local_store)
48 #define br_locate BR_NAMESPACE(br_locate)
49 #define br_locate_prefix BR_NAMESPACE(br_locate_prefix)
50 #define br_prepend_prefix BR_NAMESPACE(br_prepend_prefix)
52 #ifndef BR_NO_MACROS
53 /* These are convience macros that replace the ones usually used
54 in Autoconf/Automake projects */
55 #undef SELFPATH
56 #undef PREFIX
57 #undef PREFIXDIR
58 #undef BINDIR
59 #undef SBINDIR
60 #undef DATADIR
61 #undef LIBDIR
62 #undef LIBEXECDIR
63 #undef ETCDIR
64 #undef SYSCONFDIR
65 #undef CONFDIR
66 #undef LOCALEDIR
67 #undef GEANY_PREFIX
68 #undef GEANY_DATADIR
69 #undef GEANY_LIBDIR
70 #undef GEANY_DOCDIR
71 #undef GEANY_LOCALEDIR
73 #define SELFPATH (br_thread_local_store (br_locate ((void *) "")))
74 #define PREFIXDIR (br_thread_local_store (br_locate_prefix ((void *) "")))
75 #define BINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/bin")))
76 #define SBINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/sbin")))
77 #define LIBEXECDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/libexec")))
78 #define ETCDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
79 #define SYSCONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
80 #define CONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
81 #define GEANY_PREFIX (br_thread_local_store (br_locate_prefix ((void *) "")))
82 #define GEANY_DATADIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share")))
83 #define GEANY_LIBDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/lib")))
84 #define GEANY_DOCDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/doc/geany")))
85 #define GEANY_LOCALEDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/locale")))
86 #endif /* BR_NO_MACROS */
89 /* The following functions are used internally by BinReloc
90 and shouldn't be used directly in applications. */
92 const char *br_thread_local_store (char *str);
93 char *br_locate (void *symbol);
94 char *br_locate_prefix (void *symbol);
95 char *br_prepend_prefix (void *symbol, char *path);
97 G_END_DECLS
99 #endif /* ENABLE_BINRELOC */
101 #endif /* GEANY_PREFIX_H */