1 diff -Nur mutt-1.2.5.orig/acinclude.m4 mutt-1.2.5/acinclude.m4
2 --- mutt-1.2.5.orig/acinclude.m4 Thu Jan 1 01:00:00 1970
3 +++ mutt-1.2.5/acinclude.m4 Sat Mar 10 15:31:34 2001
5 +dnl ---------------------------------------------------------------------------
6 +dnl Check if a function is declared by including a set of include files.
7 +dnl Invoke the corresponding actions according to whether it is found or not.
9 +dnl Gcc (unlike other compilers) will only warn about the miscast assignment
10 +dnl in the first test, but most compilers will oblige with an error in the
13 +dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
14 +AC_DEFUN([CF_CHECK_FUNCDECL],
16 +AC_MSG_CHECKING([for $2 declaration])
17 +AC_CACHE_VAL(ac_cv_func_decl_$2,
18 +[AC_TRY_COMPILE([$1],
20 +extern int ${ac_func}();
24 +int (*p)() = ${ac_func};
26 +eval "ac_cv_func_decl_$2=yes"],[
27 +eval "ac_cv_func_decl_$2=no"])],[
28 +eval "ac_cv_func_decl_$2=yes"])])
29 +if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
31 + ifelse([$3], , :, [$3])
38 +dnl ---------------------------------------------------------------------------
39 +dnl Check if functions are declared by including a set of include files.
40 +dnl and define DECL_XXX if not.
42 +dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
43 +AC_DEFUN([CF_CHECK_FUNCDECLS],
46 +CF_CHECK_FUNCDECL([$1], $ac_func,
48 + CF_UPPER(ac_tr_func,HAVE_$ac_func)
49 + AC_DEFINE_UNQUOTED($ac_tr_func) $3],
53 +dnl CF_UPPER(ac_tr_func,DECL_$ac_func)
54 +dnl AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl
57 +dnl ---------------------------------------------------------------------------
58 +dnl Make an uppercase version of a variable
63 +$1=`echo $2 | tr '[a-z]' '[A-Z]'`
66 +dnl ---------------------------------------------------------------------------
68 +# Macro to add for using GNU gettext.
69 +# Ulrich Drepper <drepper@cygnus.com>, 1995.
72 +# Slightly modified by Thomas Roessler <roessler@guug.de>
76 +# This file can be copied and used freely without restrictions. It can
77 +# be used in projects which are not available under the GNU Public License
78 +# but which still want to provide support for the GNU gettext functionality.
79 +# Please note that the actual code is *not* freely available.
83 +AC_DEFUN(MUTT_AM_WITH_NLS,
84 + [AC_MSG_CHECKING([whether NLS is requested])
85 + dnl Default is enabled NLS
87 + [ --disable-nls do not use Native Language Support],
88 + USE_NLS=$enableval, USE_NLS=yes)
89 + AC_MSG_RESULT($USE_NLS)
92 + USE_INCLUDED_LIBINTL=no
94 + dnl If we use NLS figure out what method
95 + if test "$USE_NLS" = "yes"; then
96 + AC_DEFINE(ENABLE_NLS)
97 + AC_MSG_CHECKING([whether included gettext is requested])
98 + AC_ARG_WITH(included-gettext,
99 + [ --with-included-gettext use the GNU gettext library included here],
100 + nls_cv_force_use_gnu_gettext=$withval,
101 + nls_cv_force_use_gnu_gettext=no)
102 + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
104 + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
105 + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
106 + dnl User does not insist on using GNU NLS library. Figure out what
107 + dnl to use. If gettext or catgets are available (in this order) we
108 + dnl use this. Else we have to fall back to GNU NLS library.
109 + dnl catgets is only used if permitted by option --with-catgets.
110 + nls_cv_header_intl=
111 + nls_cv_header_libgt=
114 + AC_CHECK_HEADER(libintl.h,
115 + [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
116 + [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
117 + gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
119 + if test "$gt_cv_func_gettext_libc" != "yes"; then
120 + AC_CHECK_LIB(intl, bindtextdomain,
121 + [AC_CHECK_LIB(intl, gettext,
122 + gt_cv_func_gettext_libintl=yes,
123 + gt_cv_func_gettext_libintl=no)])
126 + if test "$gt_cv_func_gettext_libintl" = yes; then
127 + LIBS="$LIBS -lintl"
130 + if test "$gt_cv_func_gettext_libc" = "yes" \
131 + || test "$gt_cv_func_gettext_libintl" = "yes"; then
132 + AC_DEFINE(HAVE_GETTEXT)
133 + MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
134 + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
135 + if test "$MSGFMT" != "no"; then
136 + AC_CHECK_FUNCS(dcgettext)
137 + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
138 + MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
139 + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
140 + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
141 + return _nl_msg_cat_cntr],
143 + DATADIRNAME=share],
151 + if test "$CATOBJEXT" = "NONE"; then
152 + AC_MSG_CHECKING([whether catgets can be used])
153 + AC_ARG_WITH(catgets,
154 + [ --with-catgets use catgets functions if available],
155 + nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
156 + AC_MSG_RESULT($nls_cv_use_catgets)
158 + if test "$nls_cv_use_catgets" = "yes"; then
159 + dnl No gettext in C library. Try catgets next.
160 + AC_CHECK_LIB(i, main)
161 + AC_CHECK_FUNC(catgets,
162 + [AC_DEFINE(HAVE_CATGETS)
163 + INTLOBJS="\$(CATOBJS)"
164 + AC_PATH_PROG(GENCAT, gencat, no)dnl
165 + if test "$GENCAT" != "no"; then
166 + AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
167 + if test "$GMSGFMT" = "no"; then
168 + MUTT_AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
169 + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
171 + MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
172 + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
173 + USE_INCLUDED_LIBINTL=yes
177 + INTLDEPS='$(top_builddir)/intl/libintl.a'
179 + LIBS=`echo $LIBS | sed -e 's/-lintl//'`
180 + nls_cv_header_intl=intl/libintl.h
181 + nls_cv_header_libgt=intl/libgettext.h
186 + if test "$CATOBJEXT" = "NONE"; then
187 + dnl Neither gettext nor catgets in included in the C library.
188 + dnl Fall back on GNU gettext library.
189 + nls_cv_use_gnu_gettext=yes
193 + if test "$nls_cv_use_gnu_gettext" = "yes"; then
194 + dnl Mark actions used to generate GNU NLS library.
195 + INTLOBJS="\$(GETTOBJS)"
196 + MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
197 + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
198 + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
199 + MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
200 + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
202 + USE_INCLUDED_LIBINTL=yes
206 + INTLDEPS='$(top_builddir)/intl/libintl.a'
208 + LIBS=`echo $LIBS | sed -e 's/-lintl//'`
209 + nls_cv_header_intl=intl/libintl.h
210 + nls_cv_header_libgt=intl/libgettext.h
213 + dnl Test whether we really found GNU xgettext.
214 + if test "$XGETTEXT" != ":"; then
215 + dnl If it is no GNU xgettext we define it as : so that the
216 + dnl Makefiles still can work.
217 + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
221 + [found xgettext program is not GNU xgettext; ignore it])
226 + # We need to process the po/ directory.
230 + nls_cv_header_intl=intl/libintl.h
231 + nls_cv_header_libgt=intl/libgettext.h
233 + if test -z "$nsl_cv_header_intl"; then
234 + # Clean out junk possibly left behind by a previous configuration.
235 + rm -f intl/libintl.h
237 + AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
238 + AC_OUTPUT_COMMANDS(
239 + [case "$CONFIG_FILES" in *po/Makefile.in*)
240 + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
244 + # If this is used in GNU gettext we have to set USE_NLS to `yes'
245 + # because some of the sources are only built for this goal.
246 + if test "$PACKAGE" = gettext; then
248 + USE_INCLUDED_LIBINTL=yes
251 + dnl These rules are solely for the distribution goal. While doing this
252 + dnl we only have to keep exactly one list of the available catalogs
253 + dnl in configure.in.
254 + for lang in $ALL_LINGUAS; do
255 + GMOFILES="$GMOFILES $lang.gmo"
256 + POFILES="$POFILES $lang.po"
259 + dnl Make all variables we use known to autoconf.
260 + AC_SUBST(USE_INCLUDED_LIBINTL)
262 + AC_SUBST(CATOBJEXT)
263 + AC_SUBST(DATADIRNAME)
265 + AC_SUBST(INSTOBJEXT)
273 +AC_DEFUN(MUTT_AM_GNU_GETTEXT,
274 + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
275 + AC_REQUIRE([AC_PROG_CC])dnl
276 + AC_REQUIRE([AC_PROG_RANLIB])dnl
277 + AC_REQUIRE([AC_ISC_POSIX])dnl
278 + AC_REQUIRE([AC_HEADER_STDC])dnl
279 + AC_REQUIRE([AC_C_CONST])dnl
280 + AC_REQUIRE([AC_C_INLINE])dnl
281 + AC_REQUIRE([AC_TYPE_OFF_T])dnl
282 + AC_REQUIRE([AC_TYPE_SIZE_T])dnl
283 + AC_REQUIRE([AC_FUNC_ALLOCA])dnl
284 + AC_REQUIRE([AC_FUNC_MMAP])dnl
286 + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
287 +unistd.h sys/param.h])
288 + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
289 +strdup __argz_count __argz_stringify __argz_next])
291 + if test "${ac_cv_func_stpcpy+set}" != "set"; then
292 + AC_CHECK_FUNCS(stpcpy)
294 + if test "${ac_cv_func_stpcpy}" = "yes"; then
295 + AC_DEFINE(HAVE_STPCPY)
298 + MUTT_AM_LC_MESSAGES
301 + if test "x$CATOBJEXT" != "x"; then
302 + if test "x$ALL_LINGUAS" = "x"; then
305 + AC_MSG_CHECKING(for catalogs to be installed)
307 + for lang in ${LINGUAS=$ALL_LINGUAS}; do
308 + case "$ALL_LINGUAS" in
309 + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
312 + LINGUAS=$NEW_LINGUAS
313 + AC_MSG_RESULT($LINGUAS)
316 + dnl Construct list of names of catalog files to be constructed.
317 + if test -n "$LINGUAS"; then
318 + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
322 + dnl The reference to <locale.h> in the installed <libintl.h> file
323 + dnl must be resolved because we cannot expect the users of this
324 + dnl to define HAVE_LOCALE_H.
325 + if test $ac_cv_header_locale_h = yes; then
326 + INCLUDE_LOCALE_H="#include <locale.h>"
328 + INCLUDE_LOCALE_H="\
329 +/* The system does not provide the header <locale.h>. Take care yourself. */"
331 + AC_SUBST(INCLUDE_LOCALE_H)
333 + dnl Determine which catalog format we have (if any is needed)
334 + dnl For now we know about two different formats:
335 + dnl Linux libc-5 and the normal X/Open format
336 + test -d intl || mkdir intl
337 + if test "$CATOBJEXT" = ".cat"; then
338 + AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
340 + dnl Transform the SED scripts while copying because some dumb SEDs
341 + dnl cannot handle comments.
342 + sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
344 + dnl po2tbl.sed is always needed.
345 + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
346 + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
348 + dnl In the intl/Makefile.in we have a special dependency which makes
349 + dnl only sense for gettext. We comment this out for non-gettext
351 + if test "$PACKAGE" = "gettext"; then
361 + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
362 + dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
363 + dnl Try to locate is.
365 + if test -n "$ac_aux_dir"; then
366 + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
368 + if test -z "$MKINSTALLDIRS"; then
369 + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
371 + AC_SUBST(MKINSTALLDIRS)
373 + dnl *** For now the libtool support in intl/Makefile is not for real.
377 + dnl Generate list of files to be processed by xgettext which will
378 + dnl be included in po/Makefile.
379 + test -d po || mkdir po
380 + if test "x$srcdir" != "x."; then
381 + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
382 + posrcprefix="$srcdir/"
384 + posrcprefix="../$srcdir/"
390 + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
391 + < $srcdir/po/POTFILES.in > po/POTFILES
394 +# Search path for a program which passes the given test.
395 +# Ulrich Drepper <drepper@cygnus.com>, 1996.
397 +# This file can be copied and used freely without restrictions. It can
398 +# be used in projects which are not available under the GNU Public License
399 +# but which still want to provide support for the GNU gettext functionality.
400 +# Please note that the actual code is *not* freely available.
404 +dnl MUTT_AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
405 +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
406 +AC_DEFUN(MUTT_AM_PATH_PROG_WITH_TEST,
407 +[# Extract the first word of "$2", so it can be a program name with args.
408 +set dummy $2; ac_word=[$]2
409 +AC_MSG_CHECKING([for $ac_word])
410 +AC_CACHE_VAL(ac_cv_path_$1,
413 + ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
416 + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
417 + for ac_dir in ifelse([$5], , $PATH, [$5]); do
418 + test -z "$ac_dir" && ac_dir=.
419 + if test -f $ac_dir/$ac_word; then
421 + ac_cv_path_$1="$ac_dir/$ac_word"
427 +dnl If no 4th arg is given, leave the cache variable unset,
428 +dnl so AC_PATH_PROGS will keep looking.
429 +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
434 +if test -n "[$]$1"; then
435 + AC_MSG_RESULT([$]$1)
442 +# Check whether LC_MESSAGES is available in <locale.h>.
443 +# Ulrich Drepper <drepper@cygnus.com>, 1995.
445 +# This file can be copied and used freely without restrictions. It can
446 +# be used in projects which are not available under the GNU Public License
447 +# but which still want to provide support for the GNU gettext functionality.
448 +# Please note that the actual code is *not* freely available.
452 +AC_DEFUN(MUTT_AM_LC_MESSAGES,
453 + [if test $ac_cv_header_locale_h = yes; then
454 + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
455 + [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
456 + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
457 + if test $am_cv_val_LC_MESSAGES = yes; then
458 + AC_DEFINE(HAVE_LC_MESSAGES)