]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-gettext.patch
- updated (and improved) for 5.1
[packages/gdb.git] / gdb-gettext.patch
CommitLineData
1013231d
AM
1diff -urN gdb-5.0.org/gdb/acinclude.m4 gdb-5.0/gdb/acinclude.m4
2--- gdb-5.0.org/gdb/acinclude.m4 Tue Sep 5 16:45:26 2000
3+++ gdb-5.0/gdb/acinclude.m4 Tue Sep 5 17:32:45 2000
4@@ -859,3 +859,266 @@
5 AC_SUBST(TIX_BUILD_LIB_SPEC)
6 dnl AC_SUBST(TIX_LIB_SPEC)
7 ])
8+
9+AC_DEFUN(CY_WITH_NLS,
10+ [AC_MSG_CHECKING([whether NLS is requested])
11+ dnl Default is enabled NLS
12+ AC_ARG_ENABLE(nls,
13+ [ --disable-nls do not use Native Language Support],
14+ USE_NLS=$enableval, USE_NLS=yes)
15+ AC_MSG_RESULT($USE_NLS)
16+ AC_SUBST(USE_NLS)
17+
18+ USE_INCLUDED_LIBINTL=no
19+
20+ dnl If we use NLS figure out what method
21+ if test "$USE_NLS" = "yes"; then
22+ AC_DEFINE(ENABLE_NLS)
23+ AC_MSG_CHECKING([whether included gettext is requested])
24+ AC_ARG_WITH(included-gettext,
25+ [ --with-included-gettext use the GNU gettext library included here],
26+ nls_cv_force_use_gnu_gettext=$withval,
27+ nls_cv_force_use_gnu_gettext=no)
28+ AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
29+
30+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
31+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
32+ dnl User does not insist on using GNU NLS library. Figure out what
33+ dnl to use. If gettext or catgets are available (in this order) we
34+ dnl use this. Else we have to fall back to GNU NLS library.
35+ dnl catgets is only used if permitted by option --with-catgets.
36+ nls_cv_header_intl=
37+ nls_cv_header_libgt=
38+ CATOBJEXT=NONE
39+
40+ AC_CHECK_HEADER(libintl.h,
41+ [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
42+ [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
43+ gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
44+
45+ if test "$gt_cv_func_gettext_libc" != "yes"; then
46+ AC_CHECK_LIB(intl, bindtextdomain,
47+ [AC_CACHE_CHECK([for gettext in libintl],
48+ gt_cv_func_gettext_libintl,
49+ [AC_TRY_LINK([], [return (int) gettext ("")],
50+ gt_cv_func_gettext_libintl=yes,
51+ gt_cv_func_gettext_libintl=no)])])
52+ fi
53+
54+ if test "$gt_cv_func_gettext_libc" = "yes" \
55+ || test "$gt_cv_func_gettext_libintl" = "yes"; then
56+ AC_DEFINE(HAVE_GETTEXT)
57+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
58+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
59+ if test "$MSGFMT" != "no"; then
60+ AC_CHECK_FUNCS(dcgettext)
61+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
62+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
63+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
64+ AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
65+ return _nl_msg_cat_cntr],
66+ [CATOBJEXT=.gmo
67+ DATADIRNAME=share],
68+ [CATOBJEXT=.mo
69+ DATADIRNAME=lib])
70+ INSTOBJEXT=.mo
71+ fi
72+ fi
73+ ])
74+
75+ dnl In the standard gettext, we would now check for catgets.
76+ dnl However, we never want to use catgets for our releases.
77+
78+ if test "$CATOBJEXT" = "NONE"; then
79+ dnl Neither gettext nor catgets in included in the C library.
80+ dnl Fall back on GNU gettext library.
81+ nls_cv_use_gnu_gettext=yes
82+ fi
83+ fi
84+
85+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
86+ dnl Mark actions used to generate GNU NLS library.
87+ INTLOBJS="\$(GETTOBJS)"
88+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
89+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
90+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
91+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
92+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
93+ AC_SUBST(MSGFMT)
94+ USE_INCLUDED_LIBINTL=yes
95+ CATOBJEXT=.gmo
96+ INSTOBJEXT=.mo
97+ DATADIRNAME=share
98+ INTLDEPS='$(top_builddir)/../intl/libintl.a'
99+ INTLLIBS=$INTLDEPS
100+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
101+ nls_cv_header_intl=libintl.h
102+ nls_cv_header_libgt=libgettext.h
103+ fi
104+
105+ dnl Test whether we really found GNU xgettext.
106+ if test "$XGETTEXT" != ":"; then
107+ dnl If it is no GNU xgettext we define it as : so that the
108+ dnl Makefiles still can work.
109+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
110+ : ;
111+ else
112+ AC_MSG_RESULT(
113+ [found xgettext programs is not GNU xgettext; ignore it])
114+ XGETTEXT=":"
115+ fi
116+ fi
117+
118+ # We need to process the po/ directory.
119+ POSUB=po
120+ else
121+ DATADIRNAME=share
122+ nls_cv_header_intl=libintl.h
123+ nls_cv_header_libgt=libgettext.h
124+ fi
125+
126+ # If this is used in GNU gettext we have to set USE_NLS to `yes'
127+ # because some of the sources are only built for this goal.
128+ if test "$PACKAGE" = gettext; then
129+ USE_NLS=yes
130+ USE_INCLUDED_LIBINTL=yes
131+ fi
132+
133+ dnl These rules are solely for the distribution goal. While doing this
134+ dnl we only have to keep exactly one list of the available catalogs
135+ dnl in configure.in.
136+ for lang in $ALL_LINGUAS; do
137+ GMOFILES="$GMOFILES $lang.gmo"
138+ POFILES="$POFILES $lang.po"
139+ done
140+
141+ dnl Make all variables we use known to autoconf.
142+ AC_SUBST(USE_INCLUDED_LIBINTL)
143+ AC_SUBST(CATALOGS)
144+ AC_SUBST(CATOBJEXT)
145+ AC_SUBST(DATADIRNAME)
146+ AC_SUBST(GMOFILES)
147+ AC_SUBST(INSTOBJEXT)
148+ AC_SUBST(INTLDEPS)
149+ AC_SUBST(INTLLIBS)
150+ AC_SUBST(INTLOBJS)
151+ AC_SUBST(POFILES)
152+ AC_SUBST(POSUB)
153+ ])
154+
155+AC_DEFUN(CY_GNU_GETTEXT,
156+ [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
157+ AC_REQUIRE([AC_PROG_CC])dnl
158+ AC_REQUIRE([AC_PROG_RANLIB])dnl
159+ AC_REQUIRE([AC_ISC_POSIX])dnl
160+ AC_REQUIRE([AC_HEADER_STDC])dnl
161+ AC_REQUIRE([AC_C_CONST])dnl
162+ AC_REQUIRE([AC_C_INLINE])dnl
163+ AC_REQUIRE([AC_TYPE_OFF_T])dnl
164+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
165+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
166+ AC_REQUIRE([AC_FUNC_MMAP])dnl
167+
168+ AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
169+unistd.h values.h sys/param.h])
170+ AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
171+__argz_count __argz_stringify __argz_next])
172+
173+ if test "${ac_cv_func_stpcpy+set}" != "set"; then
174+ AC_CHECK_FUNCS(stpcpy)
175+ fi
176+ if test "${ac_cv_func_stpcpy}" = "yes"; then
177+ AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
178+ fi
179+
180+ AM_LC_MESSAGES
181+ CY_WITH_NLS
182+
183+ if test "x$CATOBJEXT" != "x"; then
184+ if test "x$ALL_LINGUAS" = "x"; then
185+ LINGUAS=
186+ else
187+ AC_MSG_CHECKING(for catalogs to be installed)
188+ NEW_LINGUAS=
189+ for lang in ${LINGUAS=$ALL_LINGUAS}; do
190+ case "$ALL_LINGUAS" in
191+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
192+ esac
193+ done
194+ LINGUAS=$NEW_LINGUAS
195+ AC_MSG_RESULT($LINGUAS)
196+ fi
197+
198+ dnl Construct list of names of catalog files to be constructed.
199+ if test -n "$LINGUAS"; then
200+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
201+ fi
202+ fi
203+
204+ dnl The reference to <locale.h> in the installed <libintl.h> file
205+ dnl must be resolved because we cannot expect the users of this
206+ dnl to define HAVE_LOCALE_H.
207+ if test $ac_cv_header_locale_h = yes; then
208+ INCLUDE_LOCALE_H="#include <locale.h>"
209+ else
210+ INCLUDE_LOCALE_H="\
211+/* The system does not provide the header <locale.h>. Take care yourself. */"
212+ fi
213+ AC_SUBST(INCLUDE_LOCALE_H)
214+
215+ dnl Determine which catalog format we have (if any is needed)
216+ dnl For now we know about two different formats:
217+ dnl Linux libc-5 and the normal X/Open format
218+ if test -f $srcdir/po2tbl.sed.in; then
219+ if test "$CATOBJEXT" = ".cat"; then
220+ AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
221+
222+ dnl Transform the SED scripts while copying because some dumb SEDs
223+ dnl cannot handle comments.
224+ sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
225+ fi
226+ dnl po2tbl.sed is always needed.
227+ sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
228+ $srcdir/po2tbl.sed.in > po2tbl.sed
229+ fi
230+
231+ dnl In the intl/Makefile.in we have a special dependency which makes
232+ dnl only sense for gettext. We comment this out for non-gettext
233+ dnl packages.
234+ if test "$PACKAGE" = "gettext"; then
235+ GT_NO="#NO#"
236+ GT_YES=
237+ else
238+ GT_NO=
239+ GT_YES="#YES#"
240+ fi
241+ AC_SUBST(GT_NO)
242+ AC_SUBST(GT_YES)
243+
244+ MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
245+ AC_SUBST(MKINSTALLDIRS)
246+
247+ dnl *** For now the libtool support in intl/Makefile is not for real.
248+ l=
249+ AC_SUBST(l)
250+
251+ dnl Generate list of files to be processed by xgettext which will
252+ dnl be included in po/Makefile. But only do this if the po directory
253+ dnl exists in srcdir.
254+ if test -d $srcdir/po; then
255+ test -d po || mkdir po
256+ if test "x$srcdir" != "x."; then
257+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
258+ posrcprefix="$srcdir/"
259+ else
260+ posrcprefix="../$srcdir/"
261+ fi
262+ else
263+ posrcprefix="../"
264+ fi
265+ rm -f po/POTFILES
266+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
267+ < $srcdir/po/POTFILES.in > po/POTFILES
268+ fi
269+ ])
270+
This page took 0.101491 seconds and 4 git commands to generate.