po.m4 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. # po.m4 serial 1 (gettext-0.12)
  2. dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
  3. dnl This file is free software, distributed under the terms of the GNU
  4. dnl General Public License. As a special exception to the GNU General
  5. dnl Public License, this file may be distributed as part of a program
  6. dnl that contains a configuration script generated by Autoconf, under
  7. dnl the same distribution terms as the rest of that program.
  8. dnl
  9. dnl This file can can be used in projects which are not available under
  10. dnl the GNU General Public License or the GNU Library General Public
  11. dnl License but which still want to provide support for the GNU gettext
  12. dnl functionality.
  13. dnl Please note that the actual code of the GNU gettext library is covered
  14. dnl by the GNU Library General Public License, and the rest of the GNU
  15. dnl gettext package package is covered by the GNU General Public License.
  16. dnl They are *not* in the public domain.
  17. dnl Authors:
  18. dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
  19. dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
  20. dnl Checks for all prerequisites of the po subdirectory.
  21. AC_DEFUN([AM_PO_SUBDIRS],
  22. [
  23. AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  24. AC_REQUIRE([AC_PROG_INSTALL])dnl
  25. AC_REQUIRE([AM_MKINSTALLDIRS])dnl
  26. AC_REQUIRE([AM_NLS])dnl
  27. dnl Perform the following tests also if --disable-nls has been given,
  28. dnl because they are needed for "make dist" to work.
  29. dnl Search for GNU msgfmt in the PATH.
  30. dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
  31. dnl The second test excludes FreeBSD msgfmt.
  32. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  33. [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
  34. (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
  35. :)
  36. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  37. dnl Search for GNU xgettext 0.12 or newer in the PATH.
  38. dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
  39. dnl The second test excludes FreeBSD xgettext.
  40. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  41. [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
  42. (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
  43. :)
  44. dnl Remove leftover from FreeBSD xgettext call.
  45. rm -f messages.po
  46. dnl Search for GNU msgmerge 0.11 or newer in the PATH.
  47. AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
  48. [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
  49. dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
  50. dnl Test whether we really found GNU msgfmt.
  51. if test "$GMSGFMT" != ":"; then
  52. dnl If it is no GNU msgfmt we define it as : so that the
  53. dnl Makefiles still can work.
  54. if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
  55. (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
  56. : ;
  57. else
  58. GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
  59. AC_MSG_RESULT(
  60. [found $GMSGFMT program is not GNU msgfmt; ignore it])
  61. GMSGFMT=":"
  62. fi
  63. fi
  64. dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
  65. dnl Test whether we really found GNU xgettext.
  66. if test "$XGETTEXT" != ":"; then
  67. dnl If it is no GNU xgettext we define it as : so that the
  68. dnl Makefiles still can work.
  69. if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
  70. (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
  71. : ;
  72. else
  73. AC_MSG_RESULT(
  74. [found xgettext program is not GNU xgettext; ignore it])
  75. XGETTEXT=":"
  76. fi
  77. dnl Remove leftover from FreeBSD xgettext call.
  78. rm -f messages.po
  79. fi
  80. AC_OUTPUT_COMMANDS([
  81. for ac_file in $CONFIG_FILES; do
  82. # Support "outfile[:infile[:infile...]]"
  83. case "$ac_file" in
  84. *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  85. esac
  86. # PO directories have a Makefile.in generated from Makefile.in.in.
  87. case "$ac_file" in */Makefile.in)
  88. # Adjust a relative srcdir.
  89. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
  90. ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
  91. ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
  92. # In autoconf-2.13 it is called $ac_given_srcdir.
  93. # In autoconf-2.50 it is called $srcdir.
  94. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
  95. case "$ac_given_srcdir" in
  96. .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
  97. /*) top_srcdir="$ac_given_srcdir" ;;
  98. *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
  99. esac
  100. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
  101. rm -f "$ac_dir/POTFILES"
  102. test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
  103. cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
  104. POMAKEFILEDEPS="POTFILES.in"
  105. # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
  106. # on $ac_dir but don't depend on user-specified configuration
  107. # parameters.
  108. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
  109. # The LINGUAS file contains the set of available languages.
  110. if test -n "$OBSOLETE_ALL_LINGUAS"; then
  111. test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.ac is obsolete" || echo "setting ALL_LINGUAS in configure.ac is obsolete"
  112. fi
  113. ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
  114. # Hide the ALL_LINGUAS assigment from automake.
  115. eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
  116. POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
  117. else
  118. # The set of available languages was given in configure.ac.
  119. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
  120. fi
  121. case "$ac_given_srcdir" in
  122. .) srcdirpre= ;;
  123. *) srcdirpre='$(srcdir)/' ;;
  124. esac
  125. POFILES=
  126. GMOFILES=
  127. UPDATEPOFILES=
  128. DUMMYPOFILES=
  129. for lang in $ALL_LINGUAS; do
  130. POFILES="$POFILES $srcdirpre$lang.po"
  131. GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
  132. UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
  133. DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
  134. done
  135. # CATALOGS depends on both $ac_dir and the user's LINGUAS
  136. # environment variable.
  137. INST_LINGUAS=
  138. if test -n "$ALL_LINGUAS"; then
  139. for presentlang in $ALL_LINGUAS; do
  140. useit=no
  141. if test "%UNSET%" != "$LINGUAS"; then
  142. desiredlanguages="$LINGUAS"
  143. else
  144. desiredlanguages="$ALL_LINGUAS"
  145. fi
  146. for desiredlang in $desiredlanguages; do
  147. # Use the presentlang catalog if desiredlang is
  148. # a. equal to presentlang, or
  149. # b. a variant of presentlang (because in this case,
  150. # presentlang can be used as a fallback for messages
  151. # which are not translated in the desiredlang catalog).
  152. case "$desiredlang" in
  153. "$presentlang"*) useit=yes;;
  154. esac
  155. done
  156. if test $useit = yes; then
  157. INST_LINGUAS="$INST_LINGUAS $presentlang"
  158. fi
  159. done
  160. fi
  161. CATALOGS=
  162. if test -n "$INST_LINGUAS"; then
  163. for lang in $INST_LINGUAS; do
  164. CATALOGS="$CATALOGS $lang.gmo"
  165. done
  166. fi
  167. test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
  168. sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
  169. for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
  170. if test -f "$f"; then
  171. case "$f" in
  172. *.orig | *.bak | *~) ;;
  173. *) cat "$f" >> "$ac_dir/Makefile" ;;
  174. esac
  175. fi
  176. done
  177. fi
  178. ;;
  179. esac
  180. done],
  181. [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
  182. # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
  183. # from automake.
  184. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
  185. # Capture the value of LINGUAS because we need it to compute CATALOGS.
  186. LINGUAS="${LINGUAS-%UNSET%}"
  187. ])
  188. ])