Blame intl/relocatable.h

Packit 8a864e
/* Provide relocatable packages.
Packit 8a864e
   Copyright (C) 2003 Free Software Foundation, Inc.
Packit 8a864e
   Written by Bruno Haible <bruno@clisp.org>, 2003.
Packit 8a864e
Packit 8a864e
   This program is free software; you can redistribute it and/or modify it
Packit 8a864e
   under the terms of the GNU Library General Public License as published
Packit 8a864e
   by the Free Software Foundation; either version 2, or (at your option)
Packit 8a864e
   any later version.
Packit 8a864e
Packit 8a864e
   This program is distributed in the hope that it will be useful,
Packit 8a864e
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8a864e
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 8a864e
   Library General Public License for more details.
Packit 8a864e
Packit 8a864e
   You should have received a copy of the GNU Library General Public
Packit 8a864e
   License along with this program; if not, write to the Free Software
Packit 8a864e
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
Packit 8a864e
   USA.  */
Packit 8a864e
Packit 8a864e
#ifndef _RELOCATABLE_H
Packit 8a864e
#define _RELOCATABLE_H
Packit 8a864e
Packit 8a864e
#ifdef __cplusplus
Packit 8a864e
extern "C" {
Packit 8a864e
#endif
Packit 8a864e
Packit 8a864e
Packit 8a864e
/* This can be enabled through the configure --enable-relocatable option.  */
Packit 8a864e
#if ENABLE_RELOCATABLE
Packit 8a864e
Packit 8a864e
/* When building a DLL, we must export some functions.  Note that because
Packit 8a864e
   this is a private .h file, we don't need to use __declspec(dllimport)
Packit 8a864e
   in any case.  */
Packit 8a864e
#if defined _MSC_VER && BUILDING_DLL
Packit 8a864e
# define RELOCATABLE_DLL_EXPORTED __declspec(dllexport)
Packit 8a864e
#else
Packit 8a864e
# define RELOCATABLE_DLL_EXPORTED
Packit 8a864e
#endif
Packit 8a864e
Packit 8a864e
/* Sets the original and the current installation prefix of the package.
Packit 8a864e
   Relocation simply replaces a pathname starting with the original prefix
Packit 8a864e
   by the corresponding pathname with the current prefix instead.  Both
Packit 8a864e
   prefixes should be directory names without trailing slash (i.e. use ""
Packit 8a864e
   instead of "/").  */
Packit 8a864e
extern RELOCATABLE_DLL_EXPORTED void
Packit 8a864e
       set_relocation_prefix (const char *orig_prefix,
Packit 8a864e
			      const char *curr_prefix);
Packit 8a864e
Packit 8a864e
/* Returns the pathname, relocated according to the current installation
Packit 8a864e
   directory.  */
Packit 8a864e
extern const char * relocate (const char *pathname);
Packit 8a864e
Packit 8a864e
/* Memory management: relocate() leaks memory, because it has to construct
Packit 8a864e
   a fresh pathname.  If this is a problem because your program calls
Packit 8a864e
   relocate() frequently, think about caching the result.  */
Packit 8a864e
Packit 8a864e
/* Convenience function:
Packit 8a864e
   Computes the current installation prefix, based on the original
Packit 8a864e
   installation prefix, the original installation directory of a particular
Packit 8a864e
   file, and the current pathname of this file.  Returns NULL upon failure.  */
Packit 8a864e
extern const char * compute_curr_prefix (const char *orig_installprefix,
Packit 8a864e
					 const char *orig_installdir,
Packit 8a864e
					 const char *curr_pathname);
Packit 8a864e
Packit 8a864e
#else
Packit 8a864e
Packit 8a864e
/* By default, we use the hardwired pathnames.  */
Packit 8a864e
#define relocate(pathname) (pathname)
Packit 8a864e
Packit 8a864e
#endif
Packit 8a864e
Packit 8a864e
Packit 8a864e
#ifdef __cplusplus
Packit 8a864e
}
Packit 8a864e
#endif
Packit 8a864e
Packit 8a864e
#endif /* _RELOCATABLE_H */