1 # autoconf 2.13 / 2.50 compatibility macro
3 # GLIB_AC_DIVERT_BEFORE_HELP(STUFF)
4 # ---------------------------------
5 # Put STUFF early enough so that they are available for $ac_help expansion.
6 # Handle both classic (<= v2.13) and modern autoconf
7 AC_DEFUN([GLIB_AC_DIVERT_BEFORE_HELP],
8 [ifdef([m4_divert_text], [m4_divert_text([NOTICE],[$1])],
9 [ifdef([AC_DIVERT], [AC_DIVERT([NOTICE],[$1])],
10 [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
15 # Macro to add for using GNU gettext.
16 # Ulrich Drepper <drepper@cygnus.com>, 1995.
18 # Modified to never use included libintl.
19 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
22 # This file can be copied and used freely without restrictions. It can
23 # be used in projects which are not available under the GNU Public License
24 # but which still want to provide support for the GNU gettext functionality.
25 # Please note that the actual code is *not* freely available.
29 AC_DEFUN(AM_GTK_WITH_NLS,
30 [AC_MSG_CHECKING([whether NLS is requested])
31 dnl Default is enabled NLS
33 [ --disable-nls do not use Native Language Support],
34 USE_NLS=$enableval, USE_NLS=yes)
35 AC_MSG_RESULT($USE_NLS)
38 USE_INCLUDED_LIBINTL=no
40 dnl If we use NLS figure out what method
41 if test "$USE_NLS" = "yes"; then
42 # AC_DEFINE(ENABLE_NLS)
43 # AC_MSG_CHECKING([whether included gettext is requested])
44 # AC_ARG_WITH(included-gettext,
45 # [ --with-included-gettext use the GNU gettext library included here],
46 # nls_cv_force_use_gnu_gettext=$withval,
47 # nls_cv_force_use_gnu_gettext=no)
48 # AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
49 nls_cv_force_use_gnu_gettext="no"
51 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
52 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
53 dnl User does not insist on using GNU NLS library. Figure out what
54 dnl to use. If gettext or catgets are available (in this order) we
55 dnl use this. Else we have to fall back to GNU NLS library.
56 dnl catgets is only used if permitted by option --with-catgets.
61 AC_CHECK_HEADER(libintl.h,
62 [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
63 [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
64 gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
66 if test "$gt_cv_func_dgettext_libc" != "yes"; then
67 AC_CHECK_LIB(intl, bindtextdomain,
68 [AC_CACHE_CHECK([for dgettext in libintl],
69 gt_cv_func_dgettext_libintl,
70 [AC_CHECK_LIB(intl, dgettext,
71 gt_cv_func_dgettext_libintl=yes,
72 gt_cv_func_dgettext_libintl=no)],
73 gt_cv_func_dgettext_libintl=no)])
76 if test "$gt_cv_func_dgettext_libintl" = "yes"; then
80 if test "$gt_cv_func_dgettext_libc" = "yes" \
81 || test "$gt_cv_func_dgettext_libintl" = "yes"; then
82 AC_DEFINE(HAVE_GETTEXT)
83 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
84 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
85 if test "$MSGFMT" != "no"; then
86 AC_CHECK_FUNCS(dcgettext)
87 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
88 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
89 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
90 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
91 return _nl_msg_cat_cntr],
100 # Added by Martin Baulig 12/15/98 for libc5 systems
101 if test "$gt_cv_func_dgettext_libc" != "yes" \
102 && test "$gt_cv_func_dgettext_libintl" = "yes"; then
104 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
108 if test "$CATOBJEXT" = "NONE"; then
109 AC_MSG_CHECKING([whether catgets can be used])
111 [ --with-catgets use catgets functions if available],
112 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
113 AC_MSG_RESULT($nls_cv_use_catgets)
115 if test "$nls_cv_use_catgets" = "yes"; then
116 dnl No gettext in C library. Try catgets next.
117 AC_CHECK_LIB(i, main)
118 AC_CHECK_FUNC(catgets,
119 [AC_DEFINE(HAVE_CATGETS)
120 INTLOBJS="\$(CATOBJS)"
121 AC_PATH_PROG(GENCAT, gencat, no)dnl
122 # if test "$GENCAT" != "no"; then
123 # AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
124 # if test "$GMSGFMT" = "no"; then
125 # AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
126 # [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
128 # AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
129 # [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
130 # USE_INCLUDED_LIBINTL=yes
134 # INTLDEPS='$(top_builddir)/intl/libintl.a'
136 # LIBS=`echo $LIBS | sed -e 's/-lintl//'`
137 # nls_cv_header_intl=intl/libintl.h
138 # nls_cv_header_libgt=intl/libgettext.h
144 if test "$CATOBJEXT" = "NONE"; then
145 dnl Neither gettext nor catgets in included in the C library.
146 dnl Fall back on GNU gettext library.
147 nls_cv_use_gnu_gettext=yes
151 if test "$nls_cv_use_gnu_gettext" != "yes"; then
152 AC_DEFINE(ENABLE_NLS)
154 # Unset this variable since we use the non-zero value as a flag.
156 # dnl Mark actions used to generate GNU NLS library.
157 # INTLOBJS="\$(GETTOBJS)"
158 # AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
159 # [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
160 # AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
161 # AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
162 # [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
164 # USE_INCLUDED_LIBINTL=yes
168 # INTLDEPS='$(top_builddir)/intl/libintl.a'
170 # LIBS=`echo $LIBS | sed -e 's/-lintl//'`
171 # nls_cv_header_intl=intl/libintl.h
172 # nls_cv_header_libgt=intl/libgettext.h
175 dnl Test whether we really found GNU xgettext.
176 if test "$XGETTEXT" != ":"; then
177 dnl If it is no GNU xgettext we define it as : so that the
178 dnl Makefiles still can work.
179 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
183 [found xgettext program is not GNU xgettext; ignore it])
188 # We need to process the po/ directory.
192 nls_cv_header_intl=intl/libintl.h
193 nls_cv_header_libgt=intl/libgettext.h
195 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
197 [case "$CONFIG_FILES" in *po/Makefile.in*)
198 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
202 # # If this is used in GNU gettext we have to set USE_NLS to `yes'
203 # # because some of the sources are only built for this goal.
204 # if test "$PACKAGE" = gettext; then
206 # USE_INCLUDED_LIBINTL=yes
209 dnl These rules are solely for the distribution goal. While doing this
210 dnl we only have to keep exactly one list of the available catalogs
212 for lang in $ALL_LINGUAS; do
213 GMOFILES="$GMOFILES $lang.gmo"
214 POFILES="$POFILES $lang.po"
217 dnl Make all variables we use known to autoconf.
218 AC_SUBST(USE_INCLUDED_LIBINTL)
221 AC_SUBST(DATADIRNAME)
231 AC_DEFUN(AM_GTK_GNU_GETTEXT,
232 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
233 AC_REQUIRE([AC_PROG_CC])dnl
234 AC_REQUIRE([AC_PROG_RANLIB])dnl
235 AC_REQUIRE([AC_ISC_POSIX])dnl
236 AC_REQUIRE([AC_HEADER_STDC])dnl
237 AC_REQUIRE([AC_C_CONST])dnl
238 AC_REQUIRE([AC_C_INLINE])dnl
239 AC_REQUIRE([AC_TYPE_OFF_T])dnl
240 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
241 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
242 AC_REQUIRE([AC_FUNC_MMAP])dnl
244 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
245 unistd.h sys/param.h])
246 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
247 strdup __argz_count __argz_stringify __argz_next])
249 if test "${ac_cv_func_stpcpy+set}" != "set"; then
250 AC_CHECK_FUNCS(stpcpy)
252 if test "${ac_cv_func_stpcpy}" = "yes"; then
253 AC_DEFINE(HAVE_STPCPY)
259 if test "x$CATOBJEXT" != "x"; then
260 if test "x$ALL_LINGUAS" = "x"; then
263 AC_MSG_CHECKING(for catalogs to be installed)
265 for lang in ${LINGUAS=$ALL_LINGUAS}; do
266 case "$ALL_LINGUAS" in
267 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
271 AC_MSG_RESULT($LINGUAS)
274 dnl Construct list of names of catalog files to be constructed.
275 if test -n "$LINGUAS"; then
276 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
280 dnl The reference to <locale.h> in the installed <libintl.h> file
281 dnl must be resolved because we cannot expect the users of this
282 dnl to define HAVE_LOCALE_H.
283 if test $ac_cv_header_locale_h = yes; then
284 INCLUDE_LOCALE_H="#include <locale.h>"
287 /* The system does not provide the header <locale.h>. Take care yourself. */"
289 AC_SUBST(INCLUDE_LOCALE_H)
291 dnl Determine which catalog format we have (if any is needed)
292 dnl For now we know about two different formats:
293 dnl Linux libc-5 and the normal X/Open format
294 test -d intl || mkdir intl
295 if test "$CATOBJEXT" = ".cat"; then
296 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
298 dnl Transform the SED scripts while copying because some dumb SEDs
299 dnl cannot handle comments.
300 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
302 dnl po2tbl.sed is always needed.
303 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
304 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
306 dnl In the intl/Makefile.in we have a special dependency which makes
307 dnl only sense for gettext. We comment this out for non-gettext
309 if test "$PACKAGE" = "gettext"; then
319 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
320 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
321 dnl Try to locate is.
323 if test -n "$ac_aux_dir"; then
324 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
326 if test -z "$MKINSTALLDIRS"; then
327 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
329 AC_SUBST(MKINSTALLDIRS)
331 dnl *** For now the libtool support in intl/Makefile is not for real.
335 dnl Generate list of files to be processed by xgettext which will
336 dnl be included in po/Makefile.
337 test -d po || mkdir po
338 if test "x$srcdir" != "x."; then
339 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
340 posrcprefix="$srcdir/"
342 posrcprefix="../$srcdir/"
348 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
349 < $srcdir/po/POTFILES.in > po/POTFILES