1 /* relocatable.h - Provide relocatable packages. */
3 /* Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc.
4 Written by Bruno Haible <bruno@clisp.org>, 2003.
6 This file is part of GNU Bash.
8 Bash is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 Bash is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Bash. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef _RELOCATABLE_H
23 #define _RELOCATABLE_H
25 /* This can be enabled through the configure --enable-relocatable option. */
26 #if ENABLE_RELOCATABLE
28 /* When building a DLL, we must export some functions. Note that because
29 this is a private .h file, we don't need to use __declspec(dllimport)
31 #if defined _MSC_VER && BUILDING_DLL
32 # define RELOCATABLE_DLL_EXPORTED __declspec(dllexport)
34 # define RELOCATABLE_DLL_EXPORTED
37 /* Sets the original and the current installation prefix of the package.
38 Relocation simply replaces a pathname starting with the original prefix
39 by the corresponding pathname with the current prefix instead. Both
40 prefixes should be directory names without trailing slash (i.e. use ""
42 extern RELOCATABLE_DLL_EXPORTED void
43 set_relocation_prefix (const char *orig_prefix,
44 const char *curr_prefix);
46 /* Returns the pathname, relocated according to the current installation
48 extern const char * relocate (const char *pathname);
50 /* Memory management: relocate() leaks memory, because it has to construct
51 a fresh pathname. If this is a problem because your program calls
52 relocate() frequently, think about caching the result. */
54 /* Convenience function:
55 Computes the current installation prefix, based on the original
56 installation prefix, the original installation directory of a particular
57 file, and the current pathname of this file. Returns NULL upon failure. */
58 extern const char * compute_curr_prefix (const char *orig_installprefix,
59 const char *orig_installdir,
60 const char *curr_pathname);
64 /* By default, we use the hardwired pathnames. */
65 #define relocate(pathname) (pathname)
69 #endif /* _RELOCATABLE_H */