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
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
28 /* WARNING, BEFORE YOU MODIFY PREFIX.C:
30 * If you make changes to any of the functions in prefix.c, you MUST
31 * change the BR_NAMESPACE macro.
32 * This way you can avoid symbol table conflicts with other libraries
33 * that also happen to use BinReloc.
36 * #define BR_NAMESPACE(funcName) foobar_ ## funcName
37 * --> expands br_locate to foobar_br_locate
40 #define BR_NAMESPACE(funcName) geany_ ## funcName
43 #define br_thread_local_store BR_NAMESPACE(br_thread_local_store)
44 #define br_locate BR_NAMESPACE(br_locate)
45 #define br_locate_prefix BR_NAMESPACE(br_locate_prefix)
46 #define br_prepend_prefix BR_NAMESPACE(br_prepend_prefix)
49 /* These are convience macros that replace the ones usually used
50 in Autoconf/Automake projects */
67 #undef GEANY_LOCALEDIR
69 #define SELFPATH (br_thread_local_store (br_locate ((void *) "")))
70 #define PREFIXDIR (br_thread_local_store (br_locate_prefix ((void *) "")))
71 #define BINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/bin")))
72 #define SBINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/sbin")))
73 #define LIBEXECDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/libexec")))
74 #define ETCDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
75 #define SYSCONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
76 #define CONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
77 #define GEANY_PREFIX (br_thread_local_store (br_locate_prefix ((void *) "")))
78 #define GEANY_DATADIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share")))
79 #define GEANY_LIBDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/lib")))
80 #define GEANY_DOCDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/doc/geany")))
81 #define GEANY_LOCALEDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/locale")))
82 #endif /* BR_NO_MACROS */
85 /* The following functions are used internally by BinReloc
86 and shouldn't be used directly in applications. */
88 const char *br_thread_local_store (char *str
);
89 char *br_locate (void *symbol
);
90 char *br_locate_prefix (void *symbol
);
91 char *br_prepend_prefix (void *symbol
, char *path
);
94 #endif /* ENABLE_BINRELOC */
96 #endif /* GEANY_PREFIX_H */