Use automake *-local hooks without commands, for extensibility.
[gnulib.git] / modules / localcharset
1 Description:
2 Return current locale's character encoding.
3
4 Notice:
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@
9
10 Files:
11 lib/localcharset.h
12 lib/localcharset.c
13 lib/config.charset
14 lib/ref-add.sin
15 lib/ref-del.sin
16 m4/codeset.m4
17 m4/glibc21.m4
18 m4/localcharset.m4
19
20 Depends-on:
21 configmake
22
23 configure.ac:
24 gl_LOCALCHARSET
25 LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\""
26 AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
27
28 Makefile.am:
29 lib_SOURCES += localcharset.h localcharset.c
30
31 # We need the following in order to install a simple file in $(libdir)
32 # which is shared with other installed packages. We use a list of referencing
33 # packages so that "make uninstall" will remove the file if and only if it
34 # is not used by another installed package.
35 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
36 # avoid installing it.
37
38 all-local: charset.alias ref-add.sed ref-del.sed
39
40 charset_alias = $(DESTDIR)$(libdir)/charset.alias
41 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
42 install-exec-local: install-exec-localcharset
43 install-exec-localcharset: all-local
44         if test $(GLIBC21) = no; then \
45           case '$(host_os)' in \
46             darwin[56]*) \
47               need_charset_alias=true ;; \
48             darwin* | cygwin* | mingw* | pw32* | cegcc*) \
49               need_charset_alias=false ;; \
50             *) \
51               need_charset_alias=true ;; \
52           esac ; \
53         else \
54           need_charset_alias=false ; \
55         fi ; \
56         if $$need_charset_alias; then \
57           $(mkinstalldirs) $(DESTDIR)$(libdir) ; \
58         fi ; \
59         if test -f $(charset_alias); then \
60           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
61           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
62           rm -f $(charset_tmp) ; \
63         else \
64           if $$need_charset_alias; then \
65             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
66             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
67             rm -f $(charset_tmp) ; \
68           fi ; \
69         fi
70
71 uninstall-local: uninstall-localcharset
72 uninstall-localcharset: all-local
73         if test -f $(charset_alias); then \
74           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
75           if grep '^# Packages using this file: $$' $(charset_tmp) \
76               > /dev/null; then \
77             rm -f $(charset_alias); \
78           else \
79             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
80           fi; \
81           rm -f $(charset_tmp); \
82         fi
83
84 charset.alias: config.charset
85         rm -f t-$@ $@
86         $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
87         mv t-$@ $@
88
89 SUFFIXES += .sed .sin
90 .sin.sed:
91         rm -f t-$@ $@
92         sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
93         mv t-$@ $@
94
95 CLEANFILES += charset.alias ref-add.sed ref-del.sed
96
97 Include:
98 "localcharset.h"
99
100 License:
101 LGPLv2+
102
103 Maintainer:
104 Bruno Haible