1Integration of this library into your package:
2
3* Copy the lib/ sourcefiles (localcharset.c, config.charset, ref-add.sin,
4  ref-del.sin) and the include file (include/localcharset.h) into your
5  package.
6
7* Add the m4/ files (codeset.m4, glibc21.m4) to your aclocal.m4 file or, if
8  you are using automake, to your m4/ directory.
9
10* Add the following lines to your configure.ac file:
11
12    AC_CANONICAL_HOST
13    AM_LANGINFO_CODESET
14    jm_GLIBC21
15    AC_CHECK_HEADERS(stddef.h stdlib.h string.h)
16    AC_CHECK_FUNCS(setlocale)
17
18  and make sure that it sets and AC_SUBSTs the PACKAGE variable.
19
20* If you are not using automake, add rules to your Makefile.in:
21
22  - Augment target "all" by
23      localcharset.o charset.alias ref-add.sed ref-del.sed
24    with special rules for the last three:
25
26    charset.alias: $(srcdir)/config.charset
27	$(SHELL) $(srcdir)/config.charset '@host@' > t-$@
28	mv t-$@ $@
29
30    ref-add.sed : $(srcdir)/ref-add.sin
31	sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-add.sin > t-$@
32	mv t-$@ $@
33
34    ref-del.sed : $(srcdir)/ref-del.sin
35	sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-del.sin > t-$@
36	mv t-$@ $@
37
38  - Augment target "install" by
39
40	test @GLIBC21@ != no || $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
41	if test -f $(DESTDIR)$(libdir)/charset.alias; then \
42	  sed -f ref-add.sed $(DESTDIR)$(libdir)/charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \
43	  $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \
44	  rm -f $(DESTDIR)$(libdir)/t-charset.alias; \
45	else \
46	  if test @GLIBC21@ = no; then \
47	    sed -f ref-add.sed charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \
48	    $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \
49	    rm -f $(DESTDIR)$(libdir)/t-charset.alias; \
50	  fi; \
51	fi
52
53  - Augment target "installdirs" by
54
55	test @GLIBC21@ != no || $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
56
57  - Augment target "uninstall" by
58
59	if test -f $(DESTDIR)$(libdir)/charset.alias; then \
60	  sed -f ref-del.sed $(DESTDIR)$(libdir)/charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \
61	  if grep '^# Packages using this file: $$' $(DESTDIR)$(libdir)/t-charset.alias > /dev/null; then \
62	    rm -f $(DESTDIR)$(libdir)/charset.alias; \
63	  else \
64	    $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \
65	  fi; \
66	  rm -f $(DESTDIR)$(libdir)/t-charset.alias; \
67	fi
68
69    - Augment target "clean" by
70
71	rm -f charset.alias ref-add.sed ref-del.sed
72
73* If you are using automake, add rules to your Makefile.am:
74
75  - Augment the main *_SOURCES variable by
76
77        localcharset.h localcharset.c
78
79  - Augment EXTRA_DIST by
80
81        config.charset ref-add.sin ref-del.sin
82
83  - Augment target "all-local" by
84
85        charset.alias ref-add.sed ref-del.sed
86
87  - Add the lines:
88
89charset_alias = $(DESTDIR)$(libdir)/charset.alias
90charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
91install-exec-local: all-local
92	test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
93	if test -f $(charset_alias); then \
94	  sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
95	  $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
96	  rm -f $(charset_tmp) ; \
97	else \
98	  if test @GLIBC21@ = no; then \
99	    sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
100	    $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
101	    rm -f $(charset_tmp) ; \
102	  fi ; \
103	fi
104
105uninstall-local: all-local
106	if test -f $(charset_alias); then \
107	  sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
108	  if grep '^# Packages using this file: $$' $(charset_tmp) \
109	      > /dev/null; then \
110	    rm -f $(charset_alias); \
111	  else \
112	    $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
113	  fi; \
114	  rm -f $(charset_tmp); \
115	fi
116
117charset.alias: config.charset
118	$(SHELL) $(srcdir)/config.charset '@host@' > t-$@
119	mv t-$@ $@
120
121SUFFIXES = .sed .sin
122.sin.sed:
123	sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@
124	mv t-$@ $@
125
126CLEANFILES = charset.alias ref-add.sed ref-del.sed
127