gettext.m4 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. dnl aclocal.m4 generated automatically by aclocal 1.2f
  2. dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
  3. dnl This Makefile.in is free software; the Free Software Foundation
  4. dnl gives unlimited permission to copy and/or distribute it,
  5. dnl with or without modifications, as long as this notice is preserved.
  6. dnl This program is distributed in the hope that it will be useful,
  7. dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  8. dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  9. dnl PARTICULAR PURPOSE.
  10. # progtest.m4 from gettext 0.32
  11. # Search path for a program which passes the given test.
  12. # Ulrich Drepper <drepper@cygnus.com>, 1996.
  13. #
  14. # This file file be copied and used freely without restrictions. It can
  15. # be used in projects which are not available under the GNU Public License
  16. # but which still want to provide support for the GNU gettext functionality.
  17. # Please note that the actual code is *not* freely available.
  18. # serial 1
  19. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
  20. dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  21. AC_DEFUN(AM_PATH_PROG_WITH_TEST,
  22. [# Extract the first word of "$2", so it can be a program name with args.
  23. set dummy $2; ac_word=[$]2
  24. AC_MSG_CHECKING([for $ac_word])
  25. AC_CACHE_VAL(ac_cv_path_$1,
  26. [case "[$]$1" in
  27. /*)
  28. ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  29. ;;
  30. *)
  31. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  32. for ac_dir in ifelse([$5], , $PATH, [$5]); do
  33. test -z "$ac_dir" && ac_dir=.
  34. if test -f $ac_dir/$ac_word; then
  35. if [$3]; then
  36. ac_cv_path_$1="$ac_dir/$ac_word"
  37. break
  38. fi
  39. fi
  40. done
  41. IFS="$ac_save_ifs"
  42. dnl If no 4th arg is given, leave the cache variable unset,
  43. dnl so AC_PATH_PROGS will keep looking.
  44. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  45. ])dnl
  46. ;;
  47. esac])dnl
  48. $1="$ac_cv_path_$1"
  49. if test -n "[$]$1"; then
  50. AC_MSG_RESULT([$]$1)
  51. else
  52. AC_MSG_RESULT(no)
  53. fi
  54. AC_SUBST($1)dnl
  55. ])
  56. # lcmessage.m4 from gettext 0.32
  57. # Check whether LC_MESSAGES is available in <locale.h>.
  58. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  59. #
  60. # This file file be copied and used freely without restrictions. It can
  61. # be used in projects which are not available under the GNU Public License
  62. # but which still want to provide support for the GNU gettext functionality.
  63. # Please note that the actual code is *not* freely available.
  64. # serial 1
  65. AC_DEFUN(AM_LC_MESSAGES,
  66. [if test $ac_cv_header_locale_h = yes; then
  67. AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  68. [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  69. am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  70. if test $am_cv_val_LC_MESSAGES = yes; then
  71. AC_DEFINE(HAVE_LC_MESSAGES)
  72. fi
  73. fi])
  74. # gettext.m4 from gettext 0.32
  75. # Macro to add for using GNU gettext.
  76. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  77. #
  78. # This file file be copied and used freely without restrictions. It can
  79. # be used in projects which are not available under the GNU Public License
  80. # but which still want to provide support for the GNU gettext functionality.
  81. # Please note that the actual code is *not* freely available.
  82. # serial 3
  83. AC_DEFUN(AM_WITH_NLS,
  84. [AC_MSG_CHECKING([whether NLS is requested])
  85. dnl Default is enabled NLS
  86. AC_ARG_ENABLE(nls,
  87. [ --disable-nls do not use Native Language Support],
  88. USE_NLS=$enableval, USE_NLS=yes)
  89. AC_MSG_RESULT($USE_NLS)
  90. AC_SUBST(USE_NLS)
  91. USE_INCLUDED_LIBINTL=no
  92. dnl If we use NLS figure out what method
  93. if test "$USE_NLS" = "yes"; then
  94. AC_DEFINE(ENABLE_NLS)
  95. AC_MSG_CHECKING([whether included gettext is requested])
  96. AC_ARG_WITH(included-gettext,
  97. [ --with-included-gettext use the GNU gettext library included here],
  98. nls_cv_force_use_gnu_gettext=$withval,
  99. nls_cv_force_use_gnu_gettext=no)
  100. AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
  101. nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
  102. if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
  103. dnl User does not insist on using GNU NLS library. Figure out what
  104. dnl to use. If gettext or catgets are available (in this order) we
  105. dnl use this. Else we have to fall back to GNU NLS library.
  106. dnl catgets is only used if permitted by option --with-catgets.
  107. nls_cv_header_intl=
  108. nls_cv_header_libgt=
  109. CATOBJEXT=NONE
  110. AC_CHECK_HEADER(libintl.h,
  111. [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
  112. [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
  113. gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
  114. if test "$gt_cv_func_gettext_libc" != "yes"; then
  115. AC_CHECK_LIB(intl, bindtextdomain,
  116. [AC_CACHE_CHECK([for gettext in libintl],
  117. gt_cv_func_gettext_libintl,
  118. [AC_TRY_LINK([], [return (int) gettext ("")],
  119. gt_cv_func_gettext_libintl=yes,
  120. gt_cv_func_gettext_libintl=no)])])
  121. fi
  122. if test "$gt_cv_func_gettext_libc" = "yes" \
  123. || test "$gt_cv_func_gettext_libintl" = "yes"; then
  124. AC_DEFINE(HAVE_GETTEXT)
  125. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  126. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
  127. if test "$MSGFMT" != "no"; then
  128. AC_CHECK_FUNCS(dcgettext)
  129. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  130. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  131. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  132. AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
  133. return _nl_msg_cat_cntr],
  134. [CATOBJEXT=.gmo
  135. DATADIRNAME=share],
  136. [CATOBJEXT=.mo
  137. DATADIRNAME=lib])
  138. INSTOBJEXT=.mo
  139. fi
  140. fi
  141. ])
  142. if test "$CATOBJEXT" = "NONE"; then
  143. AC_MSG_CHECKING([whether catgets can be used])
  144. AC_ARG_WITH(catgets,
  145. [ --with-catgets use catgets functions if available],
  146. nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
  147. AC_MSG_RESULT($nls_cv_use_catgets)
  148. if test "$nls_cv_use_catgets" = "yes"; then
  149. dnl No gettext in C library. Try catgets next.
  150. AC_CHECK_LIB(i, main)
  151. AC_CHECK_FUNC(catgets,
  152. [AC_DEFINE(HAVE_CATGETS)
  153. INTLOBJS="\$(CATOBJS)"
  154. AC_PATH_PROG(GENCAT, gencat, no)dnl
  155. if test "$GENCAT" != "no"; then
  156. AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
  157. if test "$GMSGFMT" = "no"; then
  158. AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
  159. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
  160. fi
  161. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  162. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  163. USE_INCLUDED_LIBINTL=yes
  164. CATOBJEXT=.cat
  165. INSTOBJEXT=.cat
  166. DATADIRNAME=lib
  167. INTLDEPS='$(top_builddir)/intl/libintl.a'
  168. INTLLIBS=$INTLDEPS
  169. LIBS=`echo $LIBS | sed -e 's/-lintl//'`
  170. nls_cv_header_intl=intl/libintl.h
  171. nls_cv_header_libgt=intl/libgettext.h
  172. fi])
  173. fi
  174. fi
  175. if test "$CATOBJEXT" = "NONE"; then
  176. dnl Neither gettext nor catgets in included in the C library.
  177. dnl Fall back on GNU gettext library.
  178. nls_cv_use_gnu_gettext=yes
  179. fi
  180. fi
  181. if test "$nls_cv_use_gnu_gettext" = "yes"; then
  182. dnl Mark actions used to generate GNU NLS library.
  183. INTLOBJS="\$(GETTOBJS)"
  184. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  185. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
  186. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  187. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  188. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  189. AC_SUBST(MSGFMT)
  190. USE_INCLUDED_LIBINTL=yes
  191. CATOBJEXT=.gmo
  192. INSTOBJEXT=.mo
  193. DATADIRNAME=share
  194. INTLDEPS='$(top_builddir)/intl/libintl.a'
  195. INTLLIBS=$INTLDEPS
  196. LIBS=`echo $LIBS | sed -e 's/-lintl//'`
  197. nls_cv_header_intl=intl/libintl.h
  198. nls_cv_header_libgt=intl/libgettext.h
  199. fi
  200. dnl Test whether we really found GNU xgettext.
  201. if test "$XGETTEXT" != ":"; then
  202. dnl If it is no GNU xgettext we define it as : so that the
  203. dnl Makefiles still can work.
  204. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  205. : ;
  206. else
  207. AC_MSG_RESULT(
  208. [found xgettext programs is not GNU xgettext; ignore it])
  209. XGETTEXT=":"
  210. fi
  211. fi
  212. # We need to process the po/ directory.
  213. POSUB=po
  214. else
  215. DATADIRNAME=share
  216. nls_cv_header_intl=intl/libintl.h
  217. nls_cv_header_libgt=intl/libgettext.h
  218. fi
  219. # If this is used in GNU gettext we have to set USE_NLS to `yes'
  220. # because some of the sources are only built for this goal.
  221. if test "$PACKAGE" = gettext; then
  222. USE_NLS=yes
  223. USE_INCLUDED_LIBINTL=yes
  224. fi
  225. dnl These rules are solely for the distribution goal. While doing this
  226. dnl we only have to keep exactly one list of the available catalogs
  227. dnl in configure.in.
  228. for lang in $ALL_LINGUAS; do
  229. GMOFILES="$GMOFILES $lang.gmo"
  230. POFILES="$POFILES $lang.po"
  231. done
  232. dnl Make all variables we use known to autoconf.
  233. AC_SUBST(USE_INCLUDED_LIBINTL)
  234. AC_SUBST(CATALOGS)
  235. AC_SUBST(CATOBJEXT)
  236. AC_SUBST(DATADIRNAME)
  237. AC_SUBST(GMOFILES)
  238. AC_SUBST(INSTOBJEXT)
  239. AC_SUBST(INTLDEPS)
  240. AC_SUBST(INTLLIBS)
  241. AC_SUBST(INTLOBJS)
  242. AC_SUBST(POFILES)
  243. AC_SUBST(POSUB)
  244. ])
  245. AC_DEFUN(AM_GNU_GETTEXT,
  246. [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  247. AC_REQUIRE([AC_PROG_CC])dnl
  248. AC_REQUIRE([AC_PROG_RANLIB])dnl
  249. AC_REQUIRE([AC_ISC_POSIX])dnl
  250. AC_REQUIRE([AC_HEADER_STDC])dnl
  251. AC_REQUIRE([AC_C_CONST])dnl
  252. AC_REQUIRE([AC_C_INLINE])dnl
  253. AC_REQUIRE([AC_TYPE_OFF_T])dnl
  254. AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  255. AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  256. AC_REQUIRE([AC_FUNC_MMAP])dnl
  257. AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
  258. unistd.h values.h sys/param.h])
  259. AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
  260. __argz_count __argz_stringify __argz_next])
  261. if test "${ac_cv_func_stpcpy+set}" != "set"; then
  262. AC_CHECK_FUNCS(stpcpy)
  263. fi
  264. if test "${ac_cv_func_stpcpy}" = "yes"; then
  265. AC_DEFINE(HAVE_STPCPY)
  266. fi
  267. AM_LC_MESSAGES
  268. AM_WITH_NLS
  269. if test "x$CATOBJEXT" != "x"; then
  270. if test "x$ALL_LINGUAS" = "x"; then
  271. LINGUAS=
  272. else
  273. AC_MSG_CHECKING(for catalogs to be installed)
  274. NEW_LINGUAS=
  275. for lang in ${LINGUAS=$ALL_LINGUAS}; do
  276. case "$ALL_LINGUAS" in
  277. *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  278. esac
  279. done
  280. LINGUAS=$NEW_LINGUAS
  281. AC_MSG_RESULT($LINGUAS)
  282. fi
  283. dnl Construct list of names of catalog files to be constructed.
  284. if test -n "$LINGUAS"; then
  285. for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  286. fi
  287. fi
  288. dnl The reference to <locale.h> in the installed <libintl.h> file
  289. dnl must be resolved because we cannot expect the users of this
  290. dnl to define HAVE_LOCALE_H.
  291. if test $ac_cv_header_locale_h = yes; then
  292. INCLUDE_LOCALE_H="#include <locale.h>"
  293. else
  294. INCLUDE_LOCALE_H="\
  295. /* The system does not provide the header <locale.h>. Take care yourself. */"
  296. fi
  297. AC_SUBST(INCLUDE_LOCALE_H)
  298. dnl Determine which catalog format we have (if any is needed)
  299. dnl For now we know about two different formats:
  300. dnl Linux libc-5 and the normal X/Open format
  301. test -d intl || mkdir intl
  302. if test "$CATOBJEXT" = ".cat"; then
  303. AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
  304. dnl Transform the SED scripts while copying because some dumb SEDs
  305. dnl cannot handle comments.
  306. sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
  307. fi
  308. dnl po2tbl.sed is always needed.
  309. sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
  310. $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
  311. dnl In the intl/Makefile.in we have a special dependency which makes
  312. dnl only sense for gettext. We comment this out for non-gettext
  313. dnl packages.
  314. if test "$PACKAGE" = "gettext"; then
  315. GT_NO="#NO#"
  316. GT_YES=
  317. else
  318. GT_NO=
  319. GT_YES="#YES#"
  320. fi
  321. AC_SUBST(GT_NO)
  322. AC_SUBST(GT_YES)
  323. dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
  324. dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
  325. dnl Try to locate is.
  326. MKINSTALLDIRS=
  327. if test -n "$ac_aux_dir"; then
  328. MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
  329. fi
  330. if test -z "$MKINSTALLDIRS"; then
  331. MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
  332. fi
  333. AC_SUBST(MKINSTALLDIRS)
  334. dnl *** For now the libtool support in intl/Makefile is not for real.
  335. l=
  336. AC_SUBST(l)
  337. dnl Generate list of files to be processed by xgettext which will
  338. dnl be included in po/Makefile.
  339. test -d po || mkdir po
  340. if test "x$srcdir" != "x."; then
  341. if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
  342. posrcprefix="$srcdir/"
  343. else
  344. posrcprefix="../$srcdir/"
  345. fi
  346. else
  347. posrcprefix="../"
  348. fi
  349. rm -f po/POTFILES
  350. sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
  351. < $srcdir/po/POTFILES.in > po/POTFILES
  352. ])