00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef WIN32
00017
00018 #ifndef _PREFIX_H_
00019 #define _PREFIX_H_
00020
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #undef BR_NAMESPACE
00037 #define BR_NAMESPACE(funcName) funcName
00038
00039
00040 #ifdef ENABLE_BINRELOC
00041
00042 #define br_thread_local_store BR_NAMESPACE(br_thread_local_store)
00043 #define br_locate BR_NAMESPACE(br_locate)
00044 #define br_locate_prefix BR_NAMESPACE(br_locate_prefix)
00045 #define br_prepend_prefix BR_NAMESPACE(br_prepend_prefix)
00046
00047 #ifndef BR_NO_MACROS
00048
00049
00050 #undef SELFPATH
00051 #undef PREFIX
00052 #undef PREFIXDIR
00053 #undef BINDIR
00054 #undef SBINDIR
00055 #undef DATADIR
00056 #undef LIBDIR
00057 #undef LIBEXECDIR
00058 #undef ETCDIR
00059 #undef SYSCONFDIR
00060 #undef CONFDIR
00061 #undef LOCALEDIR
00062
00063 #define SELFPATH (br_thread_local_store (br_locate ((void *) "")))
00064 #define PREFIX (br_thread_local_store (br_locate_prefix ((void *) "")))
00065 #define PREFIXDIR (br_thread_local_store (br_locate_prefix ((void *) "")))
00066 #define BINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/bin")))
00067 #define SBINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/sbin")))
00068 #define DATADIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share")))
00069 #define LIBDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/lib")))
00070 #define LIBEXECDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/libexec")))
00071 #define ETCDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
00072 #define SYSCONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
00073 #define CONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
00074 #define LOCALEDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/locale")))
00075 #endif
00076
00077
00078
00079
00080
00081 char *br_locate (void *symbol);
00082 char *br_locate_prefix (void *symbol);
00083 char *br_prepend_prefix (void *symbol, char *path);
00084
00085 #endif
00086
00087 const char *br_thread_local_store (char *str);
00088
00089
00090
00091
00092
00093
00094 #define br_strcat BR_NAMESPACE(br_strcat)
00095 #define br_extract_dir BR_NAMESPACE(br_extract_dir)
00096 #define br_extract_prefix BR_NAMESPACE(br_extract_prefix)
00097 #define br_set_locate_fallback_func BR_NAMESPACE(br_set_locate_fallback_func)
00098
00099 #ifndef BR_NO_MACROS
00100 #ifndef ENABLE_BINRELOC
00101 #define BR_SELFPATH(suffix) SELFPATH suffix
00102 #define BR_PREFIX(suffix) PREFIX suffix
00103 #define BR_PREFIXDIR(suffix) BR_PREFIX suffix
00104 #define BR_BINDIR(suffix) BINDIR suffix
00105 #define BR_SBINDIR(suffix) SBINDIR suffix
00106 #define BR_DATADIR(suffix) DATADIR suffix
00107 #define BR_LIBDIR(suffix) LIBDIR suffix
00108 #define BR_LIBEXECDIR(suffix) LIBEXECDIR suffix
00109 #define BR_ETCDIR(suffix) ETCDIR suffix
00110 #define BR_SYSCONFDIR(suffix) SYSCONFDIR suffix
00111 #define BR_CONFDIR(suffix) CONFDIR suffix
00112 #define BR_LOCALEDIR(suffix) LOCALEDIR suffix
00113 #else
00114 #define BR_SELFPATH(suffix) (br_thread_local_store (br_strcat (SELFPATH, suffix)))
00115 #define BR_PREFIX(suffix) (br_thread_local_store (br_strcat (PREFIX, suffix)))
00116 #define BR_PREFIXDIR(suffix) (br_thread_local_store (br_strcat (BR_PREFIX, suffix)))
00117 #define BR_BINDIR(suffix) (br_thread_local_store (br_strcat (BINDIR, suffix)))
00118 #define BR_SBINDIR(suffix) (br_thread_local_store (br_strcat (SBINDIR, suffix)))
00119 #define BR_DATADIR(suffix) (br_thread_local_store (br_strcat (DATADIR, suffix)))
00120 #define BR_LIBDIR(suffix) (br_thread_local_store (br_strcat (LIBDIR, suffix)))
00121 #define BR_LIBEXECDIR(suffix) (br_thread_local_store (br_strcat (LIBEXECDIR, suffix)))
00122 #define BR_ETCDIR(suffix) (br_thread_local_store (br_strcat (ETCDIR, suffix)))
00123 #define BR_SYSCONFDIR(suffix) (br_thread_local_store (br_strcat (SYSCONFDIR, suffix)))
00124 #define BR_CONFDIR(suffix) (br_thread_local_store (br_strcat (CONFDIR, suffix)))
00125 #define BR_LOCALEDIR(suffix) (br_thread_local_store (br_strcat (LOCALEDIR, suffix)))
00126 #endif
00127 #endif
00128
00129 char *br_strcat (const char *str1, const char *str2);
00130 char *br_extract_dir (const char *path);
00131 char *br_extract_prefix(const char *path);
00132 typedef char *(*br_locate_fallback_func) (void *symbol, void *data);
00133 void br_set_locate_fallback_func (br_locate_fallback_func func, void *data);
00134
00135
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139
00140 #endif
00141
00142 #endif