2 Return current locale's character encoding.
5 If your package's tests make use of the locale_charset() function directly or
6 indirectly, you may need to define the CHARSETALIASDIR environment variable,
7 so that "make check" works before "make install". In Makefile.am syntax:
8 TESTS_ENVIRONMENT += @LOCALCHARSET_TESTS_ENVIRONMENT@
27 LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\""
28 AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
31 lib_SOURCES += localcharset.h localcharset.c
33 # We need the following in order to install a simple file in $(libdir)
34 # which is shared with other installed packages. We use a list of referencing
35 # packages so that "make uninstall" will remove the file if and only if it
36 # is not used by another installed package.
37 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
38 # avoid installing it.
40 all-local: charset.alias ref-add.sed ref-del.sed
42 charset_alias = $(DESTDIR)$(libdir)/charset.alias
43 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
44 install-exec-local: install-exec-localcharset
45 install-exec-localcharset: all-local
46 if test $(GLIBC21) = no; then \
47 case '$(host_os)' in \
49 need_charset_alias=true ;; \
50 darwin* | cygwin* | mingw* | pw32* | cegcc*) \
51 need_charset_alias=false ;; \
53 need_charset_alias=true ;; \
56 need_charset_alias=false ; \
58 if $$need_charset_alias; then \
59 $(mkinstalldirs) $(DESTDIR)$(libdir) ; \
61 if test -f $(charset_alias); then \
62 sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
63 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
64 rm -f $(charset_tmp) ; \
66 if $$need_charset_alias; then \
67 sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
68 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
69 rm -f $(charset_tmp) ; \
73 uninstall-local: uninstall-localcharset
74 uninstall-localcharset: all-local
75 if test -f $(charset_alias); then \
76 sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
77 if grep '^# Packages using this file: $$' $(charset_tmp) \
79 rm -f $(charset_alias); \
81 $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
83 rm -f $(charset_tmp); \
86 charset.alias: config.charset
87 $(AM_V_GEN)rm -f t-$@ $@ && \
88 $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ && \
93 $(AM_V_GEN)rm -f t-$@ $@ && \
94 sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ && \
97 CLEANFILES += charset.alias ref-add.sed ref-del.sed