Update from gnulib.
diff --git a/ChangeLog b/ChangeLog
index 131d71c..6f8311c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-03 Bruno Haible <bruno@clisp.org>
+
+ * lib/relocatable.c: Update from gnulib.
+
2011-09-02 Bruno Haible <bruno@clisp.org>
Fix "make check" failure when $(srcdir) != $(builddir).
diff --git a/lib/relocatable.c b/lib/relocatable.c
index a7bbd99..887b755 100644
--- a/lib/relocatable.c
+++ b/lib/relocatable.c
@@ -87,6 +87,19 @@
# define FILE_SYSTEM_PREFIX_LEN(P) 0
#endif
+/* Whether to enable the more costly support for relocatable libraries.
+ It allows libraries to be have been installed with a different original
+ prefix than the program. But it is quite costly, especially on Cygwin
+ platforms, see below. Therefore we enable it by default only on native
+ Win32 platforms. */
+#ifndef ENABLE_COSTLY_RELOCATABLE
+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+# define ENABLE_COSTLY_RELOCATABLE 1
+# else
+# define ENABLE_COSTLY_RELOCATABLE 0
+# endif
+#endif
+
/* Original installation prefix. */
static char *orig_prefix;
static size_t orig_prefix_len;
@@ -156,7 +169,7 @@
#endif
}
-#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
/* Convenience function:
Computes the current installation prefix, based on the original
@@ -286,7 +299,7 @@
#endif /* !IN_LIBRARY || PIC */
-#if defined PIC && defined INSTALLDIR
+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
/* Full pathname of shared library, or NULL. */
static char *shared_library_fullname;
@@ -332,7 +345,9 @@
#if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
/* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
function.
- Cygwin >= 1.5 has /proc/self/maps and the getline() function too. */
+ Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
+ But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
+ Cygwin 1.7. */
FILE *fp;
/* Open the current process' maps file. It describes one VMA per line. */
@@ -405,7 +420,7 @@
const char *
relocate (const char *pathname)
{
-#if defined PIC && defined INSTALLDIR
+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
static int initialized;
/* Initialization code for a shared library. */
diff --git a/libcharset/lib/ChangeLog b/libcharset/lib/ChangeLog
index c72d18a..2adaac5 100644
--- a/libcharset/lib/ChangeLog
+++ b/libcharset/lib/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-03 Bruno Haible <bruno@clisp.org>
+
+ * relocatable.c: Update from gnulib.
+
2011-08-07 Bruno Haible <bruno@clisp.org>
* relocatable.c: Update from gnulib.
diff --git a/libcharset/lib/relocatable.c b/libcharset/lib/relocatable.c
index a7bbd99..887b755 100644
--- a/libcharset/lib/relocatable.c
+++ b/libcharset/lib/relocatable.c
@@ -87,6 +87,19 @@
# define FILE_SYSTEM_PREFIX_LEN(P) 0
#endif
+/* Whether to enable the more costly support for relocatable libraries.
+ It allows libraries to be have been installed with a different original
+ prefix than the program. But it is quite costly, especially on Cygwin
+ platforms, see below. Therefore we enable it by default only on native
+ Win32 platforms. */
+#ifndef ENABLE_COSTLY_RELOCATABLE
+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+# define ENABLE_COSTLY_RELOCATABLE 1
+# else
+# define ENABLE_COSTLY_RELOCATABLE 0
+# endif
+#endif
+
/* Original installation prefix. */
static char *orig_prefix;
static size_t orig_prefix_len;
@@ -156,7 +169,7 @@
#endif
}
-#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
/* Convenience function:
Computes the current installation prefix, based on the original
@@ -286,7 +299,7 @@
#endif /* !IN_LIBRARY || PIC */
-#if defined PIC && defined INSTALLDIR
+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
/* Full pathname of shared library, or NULL. */
static char *shared_library_fullname;
@@ -332,7 +345,9 @@
#if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
/* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
function.
- Cygwin >= 1.5 has /proc/self/maps and the getline() function too. */
+ Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
+ But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
+ Cygwin 1.7. */
FILE *fp;
/* Open the current process' maps file. It describes one VMA per line. */
@@ -405,7 +420,7 @@
const char *
relocate (const char *pathname)
{
-#if defined PIC && defined INSTALLDIR
+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
static int initialized;
/* Initialization code for a shared library. */