~ubuntu-branches/ubuntu/raring/geany/raring-proposed

« back to all changes in this revision

Viewing changes to src/prefix.h

  • Committer: Bazaar Package Importer
  • Author(s): Damián Viano
  • Date: 2008-05-02 11:37:45 UTC
  • mto: (3.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20080502113745-7q62rqhl2ku02ptu
Import upstream version 0.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/
 
6
 *
 
7
 * This source code is public domain. You can relicense this code
 
8
 * under whatever license you want.
 
9
 *
 
10
 * See http://autopackage.org/docs/binreloc/ for
 
11
 * more information and how to use this.
 
12
 *
 
13
 * NOTE: if you're using C++ and are getting "undefined reference
 
14
 * to br_*", try renaming prefix.c to prefix.cpp
 
15
 */
 
16
 
 
17
#ifndef _PREFIX_H_
 
18
#define _PREFIX_H_
 
19
 
 
20
 
 
21
/*
 
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
 
24
 */
 
25
#ifdef ENABLE_BINRELOC
 
26
 
 
27
 
 
28
/* WARNING, BEFORE YOU MODIFY PREFIX.C:
 
29
 *
 
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.
 
34
 *
 
35
 * Example:
 
36
 * #define BR_NAMESPACE(funcName) foobar_ ## funcName
 
37
 * --> expands br_locate to foobar_br_locate
 
38
 */
 
39
#undef BR_NAMESPACE
 
40
#define BR_NAMESPACE(funcName) geany_ ## funcName
 
41
 
 
42
 
 
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)
 
47
 
 
48
#ifndef BR_NO_MACROS
 
49
        /* These are convience macros that replace the ones usually used
 
50
           in Autoconf/Automake projects */
 
51
        #undef SELFPATH
 
52
        #undef PREFIX
 
53
        #undef PREFIXDIR
 
54
        #undef BINDIR
 
55
        #undef SBINDIR
 
56
        #undef DATADIR
 
57
        #undef LIBDIR
 
58
        #undef LIBEXECDIR
 
59
        #undef ETCDIR
 
60
        #undef SYSCONFDIR
 
61
        #undef CONFDIR
 
62
        #undef LOCALEDIR
 
63
        #undef GEANY_PREFIX
 
64
        #undef GEANY_DATADIR
 
65
        #undef GEANY_LIBDIR
 
66
        #undef GEANY_DOCDIR
 
67
        #undef GEANY_LOCALEDIR
 
68
 
 
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 */
 
83
 
 
84
 
 
85
/* The following functions are used internally by BinReloc
 
86
   and shouldn't be used directly in applications. */
 
87
 
 
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);
 
92
 
 
93
 
 
94
#endif /* ENABLE_BINRELOC */
 
95
 
 
96
#endif /* _PREFIX_H_ */