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