[glib] Add configuration option for charset.alias directory



commit 6bcc8b40349055ace526ccfb25f58b6322c82d64
Author: Daniel Macks <dmacks netspace org>
Date:   Mon Nov 20 05:48:44 2017 -0500

    Add configuration option for charset.alias directory
    
    Specifically controlling the location of this file, rather than simply
    using $libdir, allows one to avoid conflicting with the same default
    location as the gnulib localcharset module uses.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=346816

 configure.ac                   |    6 ++++++
 glib/libcharset/Makefile.am    |   11 ++++++-----
 glib/libcharset/localcharset.c |    7 ++++---
 3 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index cbdc980..16f416f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -729,6 +729,12 @@ AC_STRUCT_DIRENT_D_TYPE
 # Checks for libcharset
 AM_LANGINFO_CODESET
 gl_GLIBC21
+AC_ARG_WITH(charsetalias-dir,
+            AS_HELP_STRING([--with-charsetalias-dir=DIR], [directory for charset.alias file [LIBDIR]]),
+           [],
+           [with_charsetalias_dir='${libdir}'])
+GLIB_CHARSETALIAS_DIR=$with_charsetalias_dir
+AC_SUBST(GLIB_CHARSETALIAS_DIR)
 
 # check additional type sizes
 AC_CHECK_SIZEOF(size_t)
diff --git a/glib/libcharset/Makefile.am b/glib/libcharset/Makefile.am
index 642f75c..ea26970 100644
--- a/glib/libcharset/Makefile.am
+++ b/glib/libcharset/Makefile.am
@@ -1,8 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 include $(top_srcdir)/glib.mk
 
-AM_CPPFLAGS =                          \
-       -DLIBDIR=\"$(libdir)\"          \
+AM_CPPFLAGS =                                                  \
+       $(gmodule_INCLUDES)                                     \
+       -DGLIB_CHARSETALIAS_DIR=\"$(GLIB_CHARSETALIAS_DIR)\"    \
        $(config_h_INCLUDES)
 
 noinst_LTLIBRARIES += libcharset.la
@@ -24,10 +25,10 @@ EXTRA_DIST +=                       \
        make-patch.sh           \
        libcharset-glib.patch
 
-charset_alias = $(DESTDIR)$(libdir)/charset.alias
-charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
+charset_alias = $(DESTDIR)$(GLIB_CHARSETALIAS_DIR)/charset.alias
+charset_tmp = $(DESTDIR)$(GLIB_CHARSETALIAS_DIR)/charset.tmp
 install-exec-local: all-local
-       $(mkinstalldirs) $(DESTDIR)$(libdir)
+       $(mkinstalldirs) $(DESTDIR)$(GLIB_CHARSETALIAS_DIR)
        if test -f $(charset_alias); then \
          sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
          $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
diff --git a/glib/libcharset/localcharset.c b/glib/libcharset/localcharset.c
index 0d001f9..46c450e 100644
--- a/glib/libcharset/localcharset.c
+++ b/glib/libcharset/localcharset.c
@@ -65,9 +65,10 @@
 # define relocate(pathname) (pathname)
 #endif
 
-/* Get LIBDIR.  */
-#ifndef LIBDIR
+/* Get GLIB_CHARSETALIAS_DIR.  */
+#ifndef GLIB_CHARSETALIAS_DIR
 # include "configmake.h"
+# define GLIB_CHARSETALIAS_DIR LIBDIR
 #endif
 
 #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
@@ -121,7 +122,7 @@ _g_locale_get_charset_aliases (void)
         necessary for running the testsuite before "make install".  */
       dir = getenv ("CHARSETALIASDIR");
       if (dir == NULL || dir[0] == '\0')
-       dir = relocate (LIBDIR);
+       dir = relocate (GLIB_CHARSETALIAS_DIR);
 
       /* Concatenate dir and base into freshly allocated file_name.  */
       {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]