1 ## ----------------------------------------- ##
2 ## Find how to suppress newlines with echo. ##
3 ## ----------------------------------------- ##
5 # Once this macro is called, you may output with no echo in a Makefile or
6 # script using: echo @ECHO_N@ "STRING_TO_OUTPUT@ECHO_C@".
9 [AC_MSG_CHECKING(how to suppress newlines using echo)
10 AC_CACHE_VAL(fp_cv_prog_echo_nonl,
11 [if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
12 if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
13 fp_cv_prog_echo_nonl=no
15 fp_cv_prog_echo_nonl=option
18 fp_cv_prog_echo_nonl=escape
21 AC_MSG_RESULT($fp_cv_prog_echo_nonl)
22 case $fp_cv_prog_echo_nonl in
23 no) ECHO_N= ECHO_C= ;;
24 option) ECHO_N=-n ECHO_C= ;;
25 escape) ECHO_N= ECHO_C='\c' ;;
31 ## ------------------------------------------- ##
32 ## Check if --with-included-malloc was given. ##
33 ## From Franc,ois Pinard ##
34 ## ------------------------------------------- ##
36 # In 1992, Michael Bushnell (now Thomas Bushnell <thomas@gnu.ai.mit.edu>)
37 # devised a test for avoiding HP/UX malloc and using GNU malloc instead.
38 # Bruno Haible <haible@ma2s2.mathematik.uni-karlsruhe.de> recycled this
39 # test for CLISP Common LISP and extended it to cover broken mallocs from
40 # Sun and SGI. I (<pinard@iro.umontreal.ca>) reworked it a little so
41 # it is independent of config.guess, and overridable by the installer.
43 # On IRIX 5.2, libc malloc is broken, but the -lmalloc one was usable.
44 # So in my packages, I once unconditionally used -lmalloc if it existed.
45 # This does not do anymore, because the -lmalloc malloc is broken on
46 # Solaris 2.4 to 2.5.1 (alignment is 4 bytes instead of 8 bytes, as
47 # reported by John Wells <john@bitsmart.com>).
49 # Bruno also notes: "HP-UX has two different malloc() implementations.
50 # Both are broken. When used with CLISP, the one in the default libc.a
51 # leads to a SIGSEGV, the one in libmalloc.a leads to a SIGBUS. The SunOS
52 # 4.1.1 malloc() breaks when used by CLISP's generational GC. The IRIX
53 # 5.2 malloc() breaks when used by CLISP's generational GC."
55 # If the installer does not give a preference, we use the included GNU
56 # malloc if we have the slightest doubt that malloc could be broken, this
57 # includes cross compilation, and *all* HP/UX, SunOS or IRIX systems.
58 # It is crude indeed, but I just do not have enough information for truly
59 # benchmarking malloc in all cases, but want safe packages nevertheless.
61 AC_DEFUN(fp_WITH_INCLUDED_MALLOC,
62 [AC_MSG_CHECKING(if included GNU malloc is wanted)
63 AC_ARG_WITH(included-malloc,
64 [ --with-included-malloc use the GNU malloc which is included here], ,
65 [if test $cross_compiling = yes; then
68 case `uname -s 2> /dev/null` in
69 HP-UX | SunOS | IRIX* ) withval=yes ;;
73 test "$withval" = yes && LIBOBJS="$LIBOBJS gmalloc.o"
74 AC_MSG_RESULT($withval)
77 ## -------------------- ##
78 ## Macros from Ulrich. ##
79 ## -------------------- ##
81 # Search path for a program which passes the given test.
82 # Ulrich Drepper <drepper@cygnus.com>, 1996.
86 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
87 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
88 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
89 [# Extract the first word of "$2", so it can be a program name with args.
90 set dummy $2; ac_word=[$]2
91 AC_MSG_CHECKING([for $ac_word])
92 AC_CACHE_VAL(ac_cv_path_$1,
95 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
98 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
99 for ac_dir in ifelse([$5], , $PATH, [$5]); do
100 test -z "$ac_dir" && ac_dir=.
101 if test -f $ac_dir/$ac_word; then
103 ac_cv_path_$1="$ac_dir/$ac_word"
109 dnl If no 4th arg is given, leave the cache variable unset,
110 dnl so AC_PATH_PROGS will keep looking.
111 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
116 if test -n "[$]$1"; then
124 # Check whether LC_MESSAGES is available in <locale.h>.
125 # Ulrich Drepper <drepper@cygnus.com>, 1995.
129 AC_DEFUN(AM_LC_MESSAGES,
130 [if test $ac_cv_header_locale_h = yes; then
131 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
132 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
133 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
134 if test $am_cv_val_LC_MESSAGES = yes; then
135 AC_DEFINE(HAVE_LC_MESSAGES)
139 # Macro to add for using GNU gettext.
140 # Ulrich Drepper <drepper@cygnus.com>, 1995.
144 AC_DEFUN(AM_WITH_NLS,
145 [AC_MSG_CHECKING([whether NLS is requested])
146 dnl Default is enabled NLS
148 [ --disable-nls do not use Native Language Support],
149 USE_NLS=$enableval, USE_NLS=yes)
150 AC_MSG_RESULT($USE_NLS)
153 USE_INCLUDED_LIBINTL=no
155 dnl If we use NLS figure out what method
156 if test "$USE_NLS" = "yes"; then
157 AC_DEFINE(ENABLE_NLS)
158 AC_MSG_CHECKING([whether included gettext is requested])
159 AC_ARG_WITH(included-gettext,
160 [ --with-included-gettext use the GNU gettext library included here],
161 nls_cv_force_use_gnu_gettext=$withval,
162 nls_cv_force_use_gnu_gettext=no)
163 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
165 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
166 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
167 dnl User does not insist on using GNU NLS library. Figure out what
168 dnl to use. If gettext or catgets are available (in this order) we
169 dnl use this. Else we have to fall back to GNU NLS library.
170 dnl catgets is only used if permitted by option --with-catgets.
175 AC_CHECK_HEADER(libintl.h,
176 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
177 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
178 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
180 if test "$gt_cv_func_gettext_libc" != "yes"; then
181 AC_CHECK_LIB(intl, bindtextdomain,
182 [AC_CACHE_CHECK([for gettext in libintl],
183 gt_cv_func_gettext_libintl,
184 [AC_TRY_LINK([], [return (int) gettext ("")],
185 gt_cv_func_gettext_libintl=yes,
186 gt_cv_func_gettext_libintl=no)])])
189 if test "$gt_cv_func_gettext_libc" = "yes" \
190 || test "$gt_cv_func_gettext_libintl" = "yes"; then
191 AC_DEFINE(HAVE_GETTEXT)
192 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
193 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
194 if test "$MSGFMT" != "no"; then
195 AC_CHECK_FUNCS(dcgettext)
196 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
197 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
198 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
199 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
200 return _nl_msg_cat_cntr],
210 if test "$CATOBJEXT" = "NONE"; then
211 AC_MSG_CHECKING([whether catgets can be used])
213 [ --with-catgets use catgets functions if available],
214 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
215 AC_MSG_RESULT($nls_cv_use_catgets)
217 if test "$nls_cv_use_catgets" = "yes"; then
218 dnl No gettext in C library. Try catgets next.
219 AC_CHECK_LIB(i, main)
220 AC_CHECK_FUNC(catgets,
221 [AC_DEFINE(HAVE_CATGETS)
222 INTLOBJS="\$(CATOBJS)"
223 AC_PATH_PROG(GENCAT, gencat, no)dnl
224 if test "$GENCAT" != "no"; then
225 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
226 if test "$GMSGFMT" = "no"; then
227 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
228 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
230 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
231 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
232 USE_INCLUDED_LIBINTL=yes
236 INTLDEPS="../intl/libintl.a"
238 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
239 nls_cv_header_intl=intl/libintl.h
240 nls_cv_header_libgt=intl/libgettext.h
245 if test "$CATOBJEXT" = "NONE"; then
246 dnl Neither gettext nor catgets in included in the C library.
247 dnl Fall back on GNU gettext library.
248 nls_cv_use_gnu_gettext=yes
252 if test "$nls_cv_use_gnu_gettext" = "yes"; then
253 dnl Mark actions used to generate GNU NLS library.
254 INTLOBJS="\$(GETTOBJS)"
255 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
256 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
257 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
258 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
259 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
261 USE_INCLUDED_LIBINTL=yes
265 INTLDEPS="../intl/libintl.a"
267 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
268 nls_cv_header_intl=intl/libintl.h
269 nls_cv_header_libgt=intl/libgettext.h
272 dnl Test whether we really found GNU xgettext.
273 if test "$XGETTEXT" != ":"; then
274 dnl If it is no GNU xgettext we define it as : so that the
275 dnl Makefiles still can work.
276 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
280 [found xgettext programs is not GNU xgettext; ignore it])
285 # We need to process the po/ directory.
289 nls_cv_header_intl=intl/libintl.h
290 nls_cv_header_libgt=intl/libgettext.h
293 # If this is used in GNU gettext we have to set USE_NLS to `yes'
294 # because some of the sources are only built for this goal.
295 if test "$PACKAGE" = gettext; then
297 USE_INCLUDED_LIBINTL=yes
300 dnl These rules are solely for the distribution goal. While doing this
301 dnl we only have to keep exactly one list of the available catalogs
303 for lang in $ALL_LINGUAS; do
304 GMOFILES="$GMOFILES $lang.gmo"
305 POFILES="$POFILES $lang.po"
308 dnl Make all variables we use known to autoconf.
309 AC_SUBST(USE_INCLUDED_LIBINTL)
312 AC_SUBST(DATADIRNAME)
322 AC_DEFUN(AM_GNU_GETTEXT,
323 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
324 AC_REQUIRE([AC_PROG_CC])dnl
325 AC_REQUIRE([AC_ISC_POSIX])dnl
326 AC_REQUIRE([AC_PROG_RANLIB])dnl
327 AC_REQUIRE([AC_HEADER_STDC])dnl
328 AC_REQUIRE([AC_C_CONST])dnl
329 AC_REQUIRE([AC_C_INLINE])dnl
330 AC_REQUIRE([AC_TYPE_OFF_T])dnl
331 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
332 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
333 AC_REQUIRE([AC_FUNC_MMAP])dnl
335 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
337 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
338 __argz_count __argz_stringify __argz_next])
340 if test "${ac_cv_func_stpcpy+set}" != "set"; then
341 AC_CHECK_FUNCS(stpcpy)
343 if test "${ac_cv_func_stpcpy}" = "yes"; then
344 AC_DEFINE(HAVE_STPCPY)
350 if test "x$CATOBJEXT" != "x"; then
351 if test "x$ALL_LINGUAS" = "x"; then
354 AC_MSG_CHECKING(for catalogs to be installed)
356 for lang in ${LINGUAS=$ALL_LINGUAS}; do
357 case "$ALL_LINGUAS" in
358 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
362 AC_MSG_RESULT($LINGUAS)
365 dnl Construct list of names of catalog files to be constructed.
366 if test -n "$LINGUAS"; then
367 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
371 dnl Determine which catalog format we have (if any is needed)
372 dnl For now we know about two different formats:
373 dnl Linux libc-5 and the normal X/Open format
374 test -d intl || mkdir intl
375 if test "$CATOBJEXT" = ".cat"; then
376 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
378 dnl Transform the SED scripts while copying because some dumb SEDs
379 dnl cannot handle comments.
380 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
382 dnl po2tbl.sed is always needed.
383 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
384 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
386 dnl In the intl/Makefile.in we have a special dependency which makes
387 dnl only sense for gettext. We comment this out for non-gettext
389 if test "$PACKAGE" = "gettext"; then
399 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
400 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
401 dnl Try to locate is.
403 if test $ac_aux_dir; then
404 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
406 if test -z $MKINSTALLDIRS; then
407 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
409 AC_SUBST(MKINSTALLDIRS)
411 dnl Generate list of files to be processed by xgettext which will
412 dnl be included in po/Makefile.
413 test -d po || mkdir po
414 if test "x$srcdir" != "x."; then
415 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
416 posrcprefix="$srcdir/"
418 posrcprefix="../$srcdir/"
423 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
424 < $srcdir/po/POTFILES.in > po/POTFILES