Mercurial > pidgin
annotate src/prefix.h @ 13794:ecfd8fb02c19
[gaim-migrate @ 16206]
We don't really need to pop up an error if the sound file doesn't exist
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Tue, 30 May 2006 17:02:27 +0000 |
| parents | ca559e2b1d0a |
| children |
| rev | line source |
|---|---|
| 10245 | 1 /* |
| 2 * I made the following modifications, be sure to readd these when | |
| 3 * upgrading these files. | |
| 4 * | |
| 5 * Added this comment. | |
| 6 * Added "gaim_ ## " to the namespace | |
| 7 * Changed the lib macro to use /lib/gaim instead of just /lib | |
| 8 * (why does gaim do that in the -DLIBDIR autoconf thing anyway?) | |
| 9 * | |
| 10 */ | |
| 11 | |
| 12 /* | |
| 13 * BinReloc - a library for creating relocatable executables | |
| 14 * Written by: Mike Hearn <mike@theoretic.com> | |
| 15 * Hongli Lai <h.lai@chello.nl> | |
| 16 * http://autopackage.org/ | |
| 17 * | |
| 18 * This source code is public domain. You can relicense this code | |
| 19 * under whatever license you want. | |
| 20 * | |
| 21 * See http://autopackage.org/docs/binreloc/ for | |
| 22 * more information and how to use this. | |
| 23 * | |
| 24 * NOTE: if you're using C++ and are getting "undefined reference | |
| 25 * to br_*", try renaming prefix.c to prefix.cpp | |
| 26 */ | |
| 27 | |
| 28 #ifndef _PREFIX_H_ | |
| 29 #define _PREFIX_H_ | |
| 30 | |
| 31 #ifdef __cplusplus | |
| 32 extern "C" { | |
| 33 #endif /* __cplusplus */ | |
| 34 | |
| 35 /* WARNING, BEFORE YOU MODIFY PREFIX.C: | |
| 36 * | |
| 37 * If you make changes to any of the functions in prefix.c, you MUST | |
| 38 * change the BR_NAMESPACE macro. | |
| 39 * This way you can avoid symbol table conflicts with other libraries | |
| 40 * that also happen to use BinReloc. | |
| 41 * | |
| 42 * Example: | |
| 43 * #define BR_NAMESPACE(funcName) foobar_ ## funcName | |
| 44 * --> expands br_locate to foobar_br_locate | |
| 45 */ | |
| 46 #undef BR_NAMESPACE | |
| 47 #define BR_NAMESPACE(funcName) gaim_ ## funcName | |
| 48 | |
| 49 | |
| 50 #ifdef ENABLE_BINRELOC | |
| 51 | |
| 52 #define br_thread_local_store BR_NAMESPACE(br_thread_local_store) | |
| 53 #define br_locate BR_NAMESPACE(br_locate) | |
| 54 #define br_locate_prefix BR_NAMESPACE(br_locate_prefix) | |
| 55 #define br_prepend_prefix BR_NAMESPACE(br_prepend_prefix) | |
| 56 | |
| 57 #ifndef BR_NO_MACROS | |
|
13211
ca559e2b1d0a
[gaim-migrate @ 15575]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10262
diff
changeset
|
58 /* These are convenience macros that replace the ones usually used |
| 10245 | 59 in Autoconf/Automake projects */ |
| 60 #undef SELFPATH | |
| 61 #undef PREFIX | |
| 62 #undef PREFIXDIR | |
| 63 #undef BINDIR | |
| 64 #undef SBINDIR | |
| 65 #undef DATADIR | |
| 66 #undef LIBDIR | |
| 67 #undef LIBEXECDIR | |
| 68 #undef ETCDIR | |
| 69 #undef SYSCONFDIR | |
| 70 #undef CONFDIR | |
| 71 #undef LOCALEDIR | |
| 72 | |
| 73 #define SELFPATH (br_thread_local_store (br_locate ((void *) ""))) | |
| 74 #define PREFIX (br_thread_local_store (br_locate_prefix ((void *) ""))) | |
| 75 #define PREFIXDIR (br_thread_local_store (br_locate_prefix ((void *) ""))) | |
| 76 #define BINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/bin"))) | |
| 77 #define SBINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/sbin"))) | |
| 78 #define DATADIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share"))) | |
| 79 #define LIBDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/lib/gaim"))) | |
| 80 #define LIBEXECDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/libexec"))) | |
| 81 #define ETCDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc"))) | |
| 82 #define SYSCONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc"))) | |
| 83 #define CONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc"))) | |
| 84 #define LOCALEDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/locale"))) | |
| 85 #endif /* BR_NO_MACROS */ | |
| 86 | |
| 87 | |
| 88 /* The following functions are used internally by BinReloc | |
| 89 and shouldn't be used directly in applications. */ | |
| 90 | |
| 91 char *br_locate (void *symbol); | |
| 92 char *br_locate_prefix (void *symbol); | |
| 93 char *br_prepend_prefix (void *symbol, char *path); | |
| 94 | |
| 10262 | 95 #endif /* ENABLE_BINRELOC */ |
| 10245 | 96 |
| 10262 | 97 const char *br_thread_local_store (char *str); |
| 10245 | 98 |
| 99 | |
| 100 /* These macros and functions are not guarded by the ENABLE_BINRELOC | |
| 101 * macro because they are portable. You can use these functions. | |
| 102 */ | |
| 103 | |
| 104 #define br_strcat BR_NAMESPACE(br_strcat) | |
| 105 #define br_extract_dir BR_NAMESPACE(br_extract_dir) | |
| 106 #define br_extract_prefix BR_NAMESPACE(br_extract_prefix) | |
| 10251 | 107 #define br_set_locate_fallback_func BR_NAMESPACE(br_set_locate_fallback_func) |
| 10245 | 108 |
| 109 #ifndef BR_NO_MACROS | |
| 110 /* Convenience functions for concatenating paths */ | |
| 10262 | 111 |
| 112 /* Each time you call one, the previous result will be freed. So don't do this: | |
| 113 * | |
| 114 * some_function( BR_DATADIR("/one"), BR_DATADIR("/two") ) | |
| 115 * | |
| 116 * as the first parameter will now be bogus! | |
| 117 */ | |
| 118 | |
| 10245 | 119 #define BR_SELFPATH(suffix) (br_thread_local_store (br_strcat (SELFPATH, suffix))) |
| 120 #define BR_PREFIX(suffix) (br_thread_local_store (br_strcat (PREFIX, suffix))) | |
| 121 #define BR_PREFIXDIR(suffix) (br_thread_local_store (br_strcat (BR_PREFIX, suffix))) | |
| 122 #define BR_BINDIR(suffix) (br_thread_local_store (br_strcat (BINDIR, suffix))) | |
| 123 #define BR_SBINDIR(suffix) (br_thread_local_store (br_strcat (SBINDIR, suffix))) | |
| 124 #define BR_DATADIR(suffix) (br_thread_local_store (br_strcat (DATADIR, suffix))) | |
| 125 #define BR_LIBDIR(suffix) (br_thread_local_store (br_strcat (LIBDIR, suffix))) | |
| 126 #define BR_LIBEXECDIR(suffix) (br_thread_local_store (br_strcat (LIBEXECDIR, suffix))) | |
| 127 #define BR_ETCDIR(suffix) (br_thread_local_store (br_strcat (ETCDIR, suffix))) | |
| 128 #define BR_SYSCONFDIR(suffix) (br_thread_local_store (br_strcat (SYSCONFDIR, suffix))) | |
| 129 #define BR_CONFDIR(suffix) (br_thread_local_store (br_strcat (CONFDIR, suffix))) | |
| 130 #define BR_LOCALEDIR(suffix) (br_thread_local_store (br_strcat (LOCALEDIR, suffix))) | |
| 131 #endif | |
| 132 | |
| 133 char *br_strcat (const char *str1, const char *str2); | |
| 134 char *br_extract_dir (const char *path); | |
| 135 char *br_extract_prefix(const char *path); | |
| 10251 | 136 typedef char *(*br_locate_fallback_func) (void *symbol, void *data); |
| 137 void br_set_locate_fallback_func (br_locate_fallback_func func, void *data); | |
| 10245 | 138 |
| 139 | |
| 140 #ifdef __cplusplus | |
| 141 } | |
| 142 #endif /* __cplusplus */ | |
| 143 | |
| 144 #endif /* _PREFIX_H_ */ |
