Daily bump.
[official-gcc.git] / intl / relocatable.h
blob5ac0b0445fa54c3c7b80c6588ade6d727d21792e
1 /* Provide relocatable packages.
2 Copyright (C) 2003 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2003.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published
7 by the Free Software Foundation; either version 2, or (at your option)
8 any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
18 USA. */
20 #ifndef _RELOCATABLE_H
21 #define _RELOCATABLE_H
23 /* This can be enabled through the configure --enable-relocatable option. */
24 #if ENABLE_RELOCATABLE
26 /* When building a DLL, we must export some functions. Note that because
27 this is a private .h file, we don't need to use __declspec(dllimport)
28 in any case. */
29 #if defined _MSC_VER && BUILDING_DLL
30 # define RELOCATABLE_DLL_EXPORTED __declspec(dllexport)
31 #else
32 # define RELOCATABLE_DLL_EXPORTED
33 #endif
35 /* Sets the original and the current installation prefix of the package.
36 Relocation simply replaces a pathname starting with the original prefix
37 by the corresponding pathname with the current prefix instead. Both
38 prefixes should be directory names without trailing slash (i.e. use ""
39 instead of "/"). */
40 extern RELOCATABLE_DLL_EXPORTED void
41 set_relocation_prefix (const char *orig_prefix,
42 const char *curr_prefix);
44 /* Returns the pathname, relocated according to the current installation
45 directory. */
46 extern const char * relocate (const char *pathname);
48 /* Memory management: relocate() leaks memory, because it has to construct
49 a fresh pathname. If this is a problem because your program calls
50 relocate() frequently, think about caching the result. */
52 /* Convenience function:
53 Computes the current installation prefix, based on the original
54 installation prefix, the original installation directory of a particular
55 file, and the current pathname of this file. Returns NULL upon failure. */
56 extern const char * compute_curr_prefix (const char *orig_installprefix,
57 const char *orig_installdir,
58 const char *curr_pathname);
60 #else
62 /* By default, we use the hardwired pathnames. */
63 #define relocate(pathname) (pathname)
65 #endif
67 #endif /* _RELOCATABLE_H */