You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

238 lines
12 KiB

  1. ## intltool.m4 - Configure intltool for the target system. -*-Shell-script-*-
  2. ## Copyright (C) 2001 Eazel, Inc.
  3. ## Author: Maciej Stachowiak <mjs@noisehavoc.org>
  4. ## Kenneth Christiansen <kenneth@gnu.org>
  5. ##
  6. ## This program is free software; you can redistribute it and/or modify
  7. ## it under the terms of the GNU General Public License as published by
  8. ## the Free Software Foundation; either version 2 of the License, or
  9. ## (at your option) any later version.
  10. ##
  11. ## This program is distributed in the hope that it will be useful, but
  12. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. ## General Public License for more details.
  15. ##
  16. ## You should have received a copy of the GNU General Public License
  17. ## along with this program; if not, write to the Free Software
  18. ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. ##
  20. ## As a special exception to the GNU General Public License, if you
  21. ## distribute this file as part of a program that contains a
  22. ## configuration script generated by Autoconf, you may include it under
  23. ## the same distribution terms that you use for the rest of that program.
  24. dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml])
  25. # serial 42 IT_PROG_INTLTOOL
  26. AC_DEFUN([IT_PROG_INTLTOOL], [
  27. AC_PREREQ([2.50])dnl
  28. AC_REQUIRE([AM_NLS])dnl
  29. case "$am__api_version" in
  30. 1.[01234])
  31. AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool])
  32. ;;
  33. *)
  34. ;;
  35. esac
  36. INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
  37. INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
  38. INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
  39. if test -n "$1"; then
  40. AC_MSG_CHECKING([for intltool >= $1])
  41. AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
  42. test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
  43. AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.])
  44. fi
  45. AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update])
  46. AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge])
  47. AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract])
  48. if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then
  49. AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.])
  50. fi
  51. if test -z "$AM_DEFAULT_VERBOSITY"; then
  52. AM_DEFAULT_VERBOSITY=1
  53. fi
  54. AC_SUBST([AM_DEFAULT_VERBOSITY])
  55. INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))'
  56. INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))'
  57. INTLTOOL__v_MERGE_0='@echo " ITMRG " [$]@;'
  58. AC_SUBST(INTLTOOL_V_MERGE)
  59. AC_SUBST(INTLTOOL__v_MERGE_)
  60. AC_SUBST(INTLTOOL__v_MERGE_0)
  61. INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))'
  62. intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))'
  63. intltool__v_merge_options_0='-q'
  64. AC_SUBST(INTLTOOL_V_MERGE_OPTIONS)
  65. AC_SUBST(intltool__v_merge_options_)
  66. AC_SUBST(intltool__v_merge_options_0)
  67. INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  68. INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  69. INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  70. INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  71. INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -p $(top_srcdir)/po $< [$]@'
  72. INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  73. INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  74. INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  75. INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  76. INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  77. INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  78. if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then
  79. INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< [$]@'
  80. else
  81. INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.[$][$]RANDOM && mkdir [$][$]_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u [$][$]_it_tmp_dir $< [$]@ && rmdir [$][$]_it_tmp_dir'
  82. fi
  83. INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  84. INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  85. INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  86. INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  87. INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  88. INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  89. INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
  90. _IT_SUBST(INTLTOOL_DESKTOP_RULE)
  91. _IT_SUBST(INTLTOOL_DIRECTORY_RULE)
  92. _IT_SUBST(INTLTOOL_KEYS_RULE)
  93. _IT_SUBST(INTLTOOL_PROP_RULE)
  94. _IT_SUBST(INTLTOOL_OAF_RULE)
  95. _IT_SUBST(INTLTOOL_PONG_RULE)
  96. _IT_SUBST(INTLTOOL_SERVER_RULE)
  97. _IT_SUBST(INTLTOOL_SHEET_RULE)
  98. _IT_SUBST(INTLTOOL_SOUNDLIST_RULE)
  99. _IT_SUBST(INTLTOOL_UI_RULE)
  100. _IT_SUBST(INTLTOOL_XAM_RULE)
  101. _IT_SUBST(INTLTOOL_KBD_RULE)
  102. _IT_SUBST(INTLTOOL_XML_RULE)
  103. _IT_SUBST(INTLTOOL_XML_NOMERGE_RULE)
  104. _IT_SUBST(INTLTOOL_CAVES_RULE)
  105. _IT_SUBST(INTLTOOL_SCHEMAS_RULE)
  106. _IT_SUBST(INTLTOOL_THEME_RULE)
  107. _IT_SUBST(INTLTOOL_SERVICE_RULE)
  108. _IT_SUBST(INTLTOOL_POLICY_RULE)
  109. # Check the gettext tools to make sure they are GNU
  110. AC_PATH_PROG(XGETTEXT, xgettext)
  111. AC_PATH_PROG(MSGMERGE, msgmerge)
  112. AC_PATH_PROG(MSGFMT, msgfmt)
  113. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  114. if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then
  115. AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
  116. fi
  117. xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`"
  118. mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`"
  119. mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`"
  120. if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then
  121. AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
  122. fi
  123. AC_PATH_PROG(INTLTOOL_PERL, perl)
  124. if test -z "$INTLTOOL_PERL"; then
  125. AC_MSG_ERROR([perl not found])
  126. fi
  127. AC_MSG_CHECKING([for perl >= 5.8.1])
  128. $INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1
  129. if test $? -ne 0; then
  130. AC_MSG_ERROR([perl 5.8.1 is required for intltool])
  131. else
  132. IT_PERL_VERSION=`$INTLTOOL_PERL -e "printf '%vd', $^V"`
  133. AC_MSG_RESULT([$IT_PERL_VERSION])
  134. fi
  135. if test "x$2" != "xno-xml"; then
  136. AC_MSG_CHECKING([for XML::Parser])
  137. if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then
  138. AC_MSG_RESULT([ok])
  139. else
  140. AC_MSG_ERROR([XML::Parser perl module is required for intltool])
  141. fi
  142. fi
  143. # Substitute ALL_LINGUAS so we can use it in po/Makefile
  144. AC_SUBST(ALL_LINGUAS)
  145. # Set DATADIRNAME correctly if it is not set yet
  146. # (copied from glib-gettext.m4)
  147. if test -z "$DATADIRNAME"; then
  148. AC_LINK_IFELSE(
  149. [AC_LANG_PROGRAM([[]],
  150. [[extern int _nl_msg_cat_cntr;
  151. return _nl_msg_cat_cntr]])],
  152. [DATADIRNAME=share],
  153. [case $host in
  154. *-*-solaris*)
  155. dnl On Solaris, if bind_textdomain_codeset is in libc,
  156. dnl GNU format message catalog is always supported,
  157. dnl since both are added to the libc all together.
  158. dnl Hence, we'd like to go with DATADIRNAME=share
  159. dnl in this case.
  160. AC_CHECK_FUNC(bind_textdomain_codeset,
  161. [DATADIRNAME=share], [DATADIRNAME=lib])
  162. ;;
  163. *)
  164. [DATADIRNAME=lib]
  165. ;;
  166. esac])
  167. fi
  168. AC_SUBST(DATADIRNAME)
  169. IT_PO_SUBDIR([po])
  170. ])
  171. # IT_PO_SUBDIR(DIRNAME)
  172. # ---------------------
  173. # All po subdirs have to be declared with this macro; the subdir "po" is
  174. # declared by IT_PROG_INTLTOOL.
  175. #
  176. AC_DEFUN([IT_PO_SUBDIR],
  177. [AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS.
  178. dnl
  179. dnl The following CONFIG_COMMANDS should be executed at the very end
  180. dnl of config.status.
  181. AC_CONFIG_COMMANDS_PRE([
  182. AC_CONFIG_COMMANDS([$1/stamp-it], [
  183. if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then
  184. AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.])
  185. fi
  186. rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp"
  187. >"$1/stamp-it.tmp"
  188. [sed '/^#/d
  189. s/^[[].*] *//
  190. /^[ ]*$/d
  191. '"s|^| $ac_top_srcdir/|" \
  192. "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES"
  193. ]
  194. [sed '/^POTFILES =/,/[^\\]$/ {
  195. /^POTFILES =/!d
  196. r $1/POTFILES
  197. }
  198. ' "$1/Makefile.in" >"$1/Makefile"]
  199. rm -f "$1/Makefile.tmp"
  200. mv "$1/stamp-it.tmp" "$1/stamp-it"
  201. ])
  202. ])dnl
  203. ])
  204. # _IT_SUBST(VARIABLE)
  205. # -------------------
  206. # Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
  207. #
  208. AC_DEFUN([_IT_SUBST],
  209. [
  210. AC_SUBST([$1])
  211. m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
  212. ]
  213. )
  214. # deprecated macros
  215. AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL])
  216. # A hint is needed for aclocal from Automake <= 1.9.4:
  217. # AC_DEFUN([AC_PROG_INTLTOOL], ...)