Blame intl/relocatable.h

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