]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/aclocal.m4
* class.c (add_implicitly_declared_members): Put implicitly
[thirdparty/gcc.git] / gcc / aclocal.m4
CommitLineData
3e37364a 1dnl See if stdbool.h properly defines bool and true/false.
2AC_DEFUN(gcc_AC_HEADER_STDBOOL,
3[AC_CACHE_CHECK([for working stdbool.h],
4 ac_cv_header_stdbool_h,
5[AC_TRY_COMPILE([#include <stdbool.h>],
6[bool foo = false;],
7ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
8if test $ac_cv_header_stdbool_h = yes; then
9 AC_DEFINE(HAVE_STDBOOL_H, 1,
10 [Define if you have a working <stdbool.h> header file.])
11fi
12])
13
14dnl See whether we can include both string.h and strings.h.
f9708620 15AC_DEFUN(gcc_AC_HEADER_STRING,
259a120e 16[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
17 gcc_cv_header_string,
18[AC_TRY_COMPILE([#include <string.h>
19#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
20if test $gcc_cv_header_string = yes; then
c9b4be0a 21 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
259a120e 22fi
23])
24
a8e7eda3 25dnl See whether we need a declaration for a function.
3c014a93 26dnl The result is highly dependent on the INCLUDES passed in, so make sure
27dnl to use a different cache variable name in this macro if it is invoked
28dnl in a different context somewhere else.
07c927cb 29dnl gcc_AC_CHECK_DECL(SYMBOL,
30dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
31AC_DEFUN(gcc_AC_CHECK_DECL,
32[AC_MSG_CHECKING([whether $1 is declared])
33AC_CACHE_VAL(gcc_cv_have_decl_$1,
34[AC_TRY_COMPILE([$4],
3c014a93 35[#ifndef $1
36char *(*pfn) = (char *(*)) $1 ;
07c927cb 37#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
38if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
39 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
4211624c 40else
07c927cb 41 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
a8e7eda3 42fi
43])dnl
ea4a6c81 44
4211624c 45dnl Check multiple functions to see whether each needs a declaration.
07c927cb 46dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
47dnl gcc_AC_CHECK_DECLS(SYMBOLS,
48dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
49AC_DEFUN(gcc_AC_CHECK_DECLS,
4211624c 50[for ac_func in $1
51do
07c927cb 52changequote(, )dnl
53 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
3c014a93 54changequote([, ])dnl
07c927cb 55gcc_AC_CHECK_DECL($ac_func,
56 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
57 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
344c569e 58dnl It is possible that the include files passed in here are local headers
59dnl which supply a backup declaration for the relevant prototype based on
60dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
61dnl will always return success. E.g. see libiberty.h's handling of
62dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
63dnl 1 so that any local headers used do not provide their own prototype
64dnl during this test.
65#undef $ac_tr_decl
66#define $ac_tr_decl 1
07c927cb 67 $4
68)
4211624c 69done
3c014a93 70dnl Automatically generate config.h entries via autoheader.
71if test x = y ; then
72 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
2149241d 73 [AC_DEFINE([HAVE_DECL_\&], 1,
74 [Define to 1 if we found this declaration otherwise define to 0.])])dnl
3c014a93 75fi
4211624c 76])
77
0a0a425e 78dnl See if the printf functions in libc support %p in format strings.
f9708620 79AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
0a0a425e 80[AC_CACHE_CHECK(whether the printf functions support %p,
81 gcc_cv_func_printf_ptr,
82[AC_TRY_RUN([#include <stdio.h>
83
3c014a93 84int main()
0a0a425e 85{
86 char buf[64];
87 char *p = buf, *q = NULL;
88 sprintf(buf, "%p", p);
89 sscanf(buf, "%p", &q);
3c014a93 90 return (p != q);
0a0a425e 91}], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
92 gcc_cv_func_printf_ptr=no)
93rm -f core core.* *.core])
94if test $gcc_cv_func_printf_ptr = yes ; then
c9b4be0a 95 AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
0a0a425e 96fi
97])
98
ea4a6c81 99dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
f9708620 100AC_DEFUN(gcc_AC_PROG_LN_S,
ea4a6c81 101[AC_MSG_CHECKING(whether ln -s works)
102AC_CACHE_VAL(gcc_cv_prog_LN_S,
45d37aff 103[rm -f conftestdata_t
104echo >conftestdata_f
105if ln -s conftestdata_f conftestdata_t 2>/dev/null
ea4a6c81 106then
107 gcc_cv_prog_LN_S="ln -s"
108else
45d37aff 109 if ln conftestdata_f conftestdata_t 2>/dev/null
ea4a6c81 110 then
111 gcc_cv_prog_LN_S=ln
112 else
113 gcc_cv_prog_LN_S=cp
114 fi
115fi
45d37aff 116rm -f conftestdata_f conftestdata_t
ea4a6c81 117])dnl
118LN_S="$gcc_cv_prog_LN_S"
119if test "$gcc_cv_prog_LN_S" = "ln -s"; then
120 AC_MSG_RESULT(yes)
121else
122 if test "$gcc_cv_prog_LN_S" = "ln"; then
123 AC_MSG_RESULT([no, using ln])
124 else
125 AC_MSG_RESULT([no, and neither does ln, so using cp])
126 fi
127fi
128AC_SUBST(LN_S)dnl
129])
130
131dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
f9708620 132AC_DEFUN(gcc_AC_PROG_LN,
ea4a6c81 133[AC_MSG_CHECKING(whether ln works)
134AC_CACHE_VAL(gcc_cv_prog_LN,
45d37aff 135[rm -f conftestdata_t
136echo >conftestdata_f
137if ln conftestdata_f conftestdata_t 2>/dev/null
ea4a6c81 138then
139 gcc_cv_prog_LN="ln"
140else
45d37aff 141 if ln -s conftestdata_f conftestdata_t 2>/dev/null
ea4a6c81 142 then
143 gcc_cv_prog_LN="ln -s"
144 else
145 gcc_cv_prog_LN=cp
146 fi
147fi
45d37aff 148rm -f conftestdata_f conftestdata_t
ea4a6c81 149])dnl
150LN="$gcc_cv_prog_LN"
151if test "$gcc_cv_prog_LN" = "ln"; then
152 AC_MSG_RESULT(yes)
153else
154 if test "$gcc_cv_prog_LN" = "ln -s"; then
155 AC_MSG_RESULT([no, using ln -s])
156 else
157 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
158 fi
159fi
160AC_SUBST(LN)dnl
161])
e59dfa37 162
8564ad21 163dnl See whether the stage1 host compiler accepts the volatile keyword.
f9708620 164AC_DEFUN(gcc_AC_C_VOLATILE,
8564ad21 165[AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
166[AC_TRY_COMPILE(, [volatile int foo;],
167 gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
168if test $gcc_cv_c_volatile = yes ; then
c9b4be0a 169 AC_DEFINE(HAVE_VOLATILE, 1, [Define if your compiler understands volatile.])
8564ad21 170fi
171])
172
6a7488af 173dnl Check whether long double is supported. This differs from the
174dnl built-in autoconf test in that it works for cross compiles.
f9708620 175AC_DEFUN(gcc_AC_C_LONG_DOUBLE,
6a7488af 176[AC_CACHE_CHECK(for long double, gcc_cv_c_long_double,
177[if test "$GCC" = yes; then
178 gcc_cv_c_long_double=yes
179else
180AC_TRY_COMPILE(,
181[/* The Stardent Vistra knows sizeof(long double), but does not support it. */
182long double foo = 0.0;
183/* On Ultrix 4.3 cc, long double is 4 and double is 8. */
184switch (0) case 0: case (sizeof(long double) >= sizeof(double)):;],
185gcc_cv_c_long_double=yes, gcc_cv_c_long_double=no)
186fi])
187if test $gcc_cv_c_long_double = yes; then
2149241d 188 AC_DEFINE(HAVE_LONG_DOUBLE, 1,
189 [Define if your compiler supports the \`long double' type.])
6a7488af 190fi
191])
192
3e37364a 193dnl Check whether _Bool is built-in.
194AC_DEFUN(gcc_AC_C__BOOL,
195[AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
196[AC_TRY_COMPILE(,
197[_Bool foo;],
198gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
199])
200if test $gcc_cv_c__bool = yes; then
201 AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
202fi
203])
204
a729d1c3 205dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
206dnl of the usual 2.
f9708620 207AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
a729d1c3 208[AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
209[AC_TRY_COMPILE([
210#include <sys/types.h>
211#ifdef HAVE_SYS_STAT_H
212# include <sys/stat.h>
213#endif
214#ifdef HAVE_UNISTD_H
215# include <unistd.h>
216#endif
217#ifdef HAVE_DIRECT_H
218# include <direct.h>
219#endif], [mkdir ("foo", 0);],
220 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
221if test $gcc_cv_mkdir_takes_one_arg = yes ; then
c9b4be0a 222 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
a729d1c3 223fi
224])
225
f9708620 226AC_DEFUN(gcc_AC_PROG_INSTALL,
e59dfa37 227[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
228# Find a good install program. We prefer a C program (faster),
229# so one script is as good as another. But avoid the broken or
230# incompatible versions:
231# SysV /etc/install, /usr/sbin/install
232# SunOS /usr/etc/install
233# IRIX /sbin/install
234# AIX /bin/install
235# AFS /usr/afsws/bin/install, which mishandles nonexistent args
236# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
237# ./install, which can be erroneously created by make from ./install.sh.
238AC_MSG_CHECKING(for a BSD compatible install)
239if test -z "$INSTALL"; then
240AC_CACHE_VAL(ac_cv_path_install,
241[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
242 for ac_dir in $PATH; do
243 # Account for people who put trailing slashes in PATH elements.
244 case "$ac_dir/" in
245 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
246 *)
247 # OSF1 and SCO ODT 3.0 have their own names for install.
248 for ac_prog in ginstall scoinst install; do
249 if test -f $ac_dir/$ac_prog; then
250 if test $ac_prog = install &&
251 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
252 # AIX install. It has an incompatible calling convention.
253 # OSF/1 installbsd also uses dspmsg, but is usable.
254 :
255 else
256 ac_cv_path_install="$ac_dir/$ac_prog -c"
257 break 2
258 fi
259 fi
260 done
261 ;;
262 esac
263 done
264 IFS="$ac_save_IFS"
265])dnl
266 if test "${ac_cv_path_install+set}" = set; then
267 INSTALL="$ac_cv_path_install"
268 else
269 # As a last resort, use the slow shell script. We don't cache a
270 # path for INSTALL within a source directory, because that will
271 # break other packages using the cache if that directory is
272 # removed, or if the path is relative.
273 INSTALL="$ac_install_sh"
274 fi
275fi
276dnl We do special magic for INSTALL instead of AC_SUBST, to get
277dnl relative paths right.
278AC_MSG_RESULT($INSTALL)
68a39da2 279AC_SUBST(INSTALL)dnl
e59dfa37 280
281# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
282# It thinks the first close brace ends the variable substitution.
283test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
284AC_SUBST(INSTALL_PROGRAM)dnl
285
286test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
287AC_SUBST(INSTALL_DATA)dnl
288])
be2828ce 289
0af01459 290dnl Test for GNAT.
291dnl We require the gnatbind program, and a compiler driver that
292dnl understands Ada. The user may set the driver name explicitly
293dnl with ADAC; also, the user's CC setting is tried. Failing that,
294dnl we try gcc and cc, then a sampling of names known to be used for
295dnl the Ada driver on various systems.
296dnl
297dnl Sets the shell variable have_gnat to yes or no as appropriate, and
298dnl substitutes GNATBIND and ADAC.
299AC_DEFUN([gcc_AC_PROG_GNAT],
300[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
301AC_CHECK_TOOL(GNATBIND, gnatbind, no)
302AC_CACHE_CHECK([for compiler driver that understands Ada],
303 gcc_cv_prog_adac,
304[cat >conftest.adb <<EOF
305procedure conftest is begin null; end conftest;
306EOF
307gcc_cv_prog_adac=no
308# Have to do ac_tool_prefix and user overrides by hand.
309user_adac=$ADAC
310user_cc=$CC
311for cand in ${ac_tool_prefix}$user_adac $user_adac \
312 ${ac_tool_prefix}$user_cc $user_cc \
313 ${ac_tool_prefix}gcc gcc \
314 ${ac_tool_prefix}cc cc \
315 ${ac_tool_prefix}gnatgcc gnatgcc \
316 ${ac_tool_prefix}gnatcc gnatcc \
317 ${ac_tool_prefix}adagcc adagcc \
318 ${ac_tool_prefix}adacc adacc ; do
319 # There is a bug in all released versions of GCC which causes the
320 # driver to exit successfully when the appropriate language module
321 # has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
322 # Therefore we must check for the error message as well as an
323 # unsuccessful exit.
7e8ebf06 324 errors=`($cand -c conftest.adb) 2>&1 || echo failure`
0af01459 325 if test x"$errors" = x; then
326 gcc_cv_prog_adac=$cand
327 break
328 fi
329done
330rm -f conftest.*])
331ADAC=$gcc_cv_prog_adac
332AC_SUBST(ADAC)
333
334if test x$GNATBIND != xno && test x$ADAC != xno; then
335 have_gnat=yes
336else
337 have_gnat=no
338fi
339])
340
be2828ce 341#serial 1
342dnl This test replaces the one in autoconf.
343dnl Currently this macro should have the same name as the autoconf macro
344dnl because gettext's gettext.m4 (distributed in the automake package)
345dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
346dnl give these diagnostics:
347dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
348dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
349
350undefine([AC_ISC_POSIX])
351AC_DEFUN(AC_ISC_POSIX,
352 [
353 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
354 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
355 ]
356)
357
274cbad0 358
359dnl GCC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])
360dnl like AC_PATH_PROG but use other cache variables
361AC_DEFUN(GCC_PATH_PROG,
362[# Extract the first word of "$2", so it can be a program name with args.
363set dummy $2; ac_word=[$]2
364AC_MSG_CHECKING([for $ac_word])
365AC_CACHE_VAL(gcc_cv_path_$1,
366[case "[$]$1" in
367 /*)
368 gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
369 ;;
370 ?:/*)
371 gcc_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
372 ;;
373 *)
374 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
375dnl $ac_dummy forces splitting on constant user-supplied paths.
376dnl POSIX.2 word splitting is done only on the output of word expansions,
377dnl not every word. This closes a longstanding sh security hole.
378 ac_dummy="ifelse([$4], , $PATH, [$4])"
379 for ac_dir in $ac_dummy; do
380 test -z "$ac_dir" && ac_dir=.
381 if test -f $ac_dir/$ac_word; then
382 gcc_cv_path_$1="$ac_dir/$ac_word"
383 break
384 fi
385 done
386 IFS="$ac_save_ifs"
387dnl If no 3rd arg is given, leave the cache variable unset,
388dnl so GCC_PATH_PROGS will keep looking.
389ifelse([$3], , , [ test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$3"
390])dnl
391 ;;
392esac])dnl
393$1="$gcc_cv_path_$1"
394if test -n "[$]$1"; then
395 AC_MSG_RESULT([$]$1)
396else
397 AC_MSG_RESULT(no)
398fi
399AC_SUBST($1)dnl
400])
401
bc028cdf 402# Check whether mmap can map an arbitrary page from /dev/zero or with
403# MAP_ANONYMOUS, without MAP_FIXED.
8ee6d486 404AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
901dfcc7 405[AC_CHECK_FUNCS(getpagesize)
406# The test program for the next two tests is the same except for one
407# set of ifdefs.
408changequote({{{,}}})dnl
409{{{cat >ct-mmap.inc <<'EOF'
8ee6d486 410#include <sys/types.h>
8ee6d486 411#include <sys/mman.h>
901dfcc7 412#include <fcntl.h>
413#include <signal.h>
414#include <setjmp.h>
415#include <stdio.h>
8ee6d486 416
bc028cdf 417#if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
418# define MAP_ANONYMOUS MAP_ANON
419#endif
420
8ee6d486 421/* This mess was copied from the GNU getpagesize.h. */
422#ifndef HAVE_GETPAGESIZE
423# ifdef HAVE_UNISTD_H
424# include <unistd.h>
425# endif
426
427/* Assume that all systems that can run configure have sys/param.h. */
428# ifndef HAVE_SYS_PARAM_H
429# define HAVE_SYS_PARAM_H 1
430# endif
431
432# ifdef _SC_PAGESIZE
433# define getpagesize() sysconf(_SC_PAGESIZE)
434# else /* no _SC_PAGESIZE */
435# ifdef HAVE_SYS_PARAM_H
436# include <sys/param.h>
437# ifdef EXEC_PAGESIZE
438# define getpagesize() EXEC_PAGESIZE
439# else /* no EXEC_PAGESIZE */
440# ifdef NBPG
441# define getpagesize() NBPG * CLSIZE
442# ifndef CLSIZE
443# define CLSIZE 1
444# endif /* no CLSIZE */
445# else /* no NBPG */
446# ifdef NBPC
447# define getpagesize() NBPC
448# else /* no NBPC */
449# ifdef PAGESIZE
450# define getpagesize() PAGESIZE
451# endif /* PAGESIZE */
452# endif /* no NBPC */
453# endif /* no NBPG */
454# endif /* no EXEC_PAGESIZE */
455# else /* no HAVE_SYS_PARAM_H */
456# define getpagesize() 8192 /* punt totally */
457# endif /* no HAVE_SYS_PARAM_H */
458# endif /* no _SC_PAGESIZE */
459
460#endif /* no HAVE_GETPAGESIZE */
461
901dfcc7 462#ifndef MAP_FAILED
463# define MAP_FAILED -1
bc028cdf 464#endif
8ee6d486 465
901dfcc7 466#undef perror_exit
467#define perror_exit(str, val) \
468 do { perror(str); exit(val); } while (0)
469
470/* Some versions of cygwin mmap require that munmap is called with the
471 same parameters as mmap. GCC expects that this is not the case.
472 Test for various forms of this problem. Warning - icky signal games. */
473
474static sigset_t unblock_sigsegv;
475static jmp_buf r;
476static size_t pg;
477static int devzero;
478
479static char *
480anonmap (size)
481 size_t size;
482{
483#ifdef USE_MAP_ANON
484 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
485 MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
bc028cdf 486#else
901dfcc7 487 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
488 MAP_PRIVATE, devzero, 0);
bc028cdf 489#endif
901dfcc7 490}
491
492static void
493sigsegv (unused)
494 int unused;
495{
496 sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0);
497 longjmp (r, 1);
498}
499
500/* Basic functionality test. */
501void
502test_0 ()
503{
504 char *x = anonmap (pg);
505 if (x == (char *) MAP_FAILED)
506 perror_exit("test 0 mmap", 2);
8ee6d486 507
508 *(int *)x += 1;
509
510 if (munmap(x, pg) < 0)
901dfcc7 511 perror_exit("test 0 munmap", 3);
512}
513
514/* 1. If we map a 2-page region and unmap its second page, the first page
515 must remain. */
516static void
517test_1 ()
518{
519 char *x = anonmap (pg * 2);
520 if (x == (char *)MAP_FAILED)
521 perror_exit ("test 1 mmap", 4);
522
523 signal (SIGSEGV, sigsegv);
524 if (setjmp (r))
525 perror_exit ("test 1 fault", 5);
526
527 x[0] = 1;
528 x[pg] = 1;
529
530 if (munmap (x + pg, pg) < 0)
531 perror_exit ("test 1 munmap 1", 6);
532 x[0] = 2;
533
534 if (setjmp (r) == 0)
535 {
536 x[pg] = 1;
537 perror_exit ("test 1 no fault", 7);
538 }
539 if (munmap (x, pg) < 0)
540 perror_exit ("test 1 munmap 2", 8);
541}
542
543/* 2. If we map a 2-page region and unmap its first page, the second
544 page must remain. */
545static void
546test_2 ()
547{
548 char *x = anonmap (pg * 2);
549 if (x == (char *)MAP_FAILED)
550 perror_exit ("test 2 mmap", 9);
551
552 signal (SIGSEGV, sigsegv);
553 if (setjmp (r))
554 perror_exit ("test 2 fault", 10);
555
556 x[0] = 1;
557 x[pg] = 1;
558
559 if (munmap (x, pg) < 0)
560 perror_exit ("test 2 munmap 1", 11);
561
562 x[pg] = 2;
563
564 if (setjmp (r) == 0)
565 {
566 x[0] = 1;
567 perror_exit ("test 2 no fault", 12);
568 }
569
570 if (munmap (x+pg, pg) < 0)
571 perror_exit ("test 2 munmap 2", 13);
572}
573
574/* 3. If we map two adjacent 1-page regions and unmap them both with
575 one munmap, both must go away.
576
577 Getting two adjacent 1-page regions with two mmap calls is slightly
578 tricky. All OS's tested skip over already-allocated blocks; therefore
579 we have been careful to unmap all allocated regions in previous tests.
580 HP/UX allocates pages backward in memory. No OS has yet been observed
581 to be so perverse as to leave unmapped space between consecutive calls
582 to mmap. */
583
584static void
585test_3 ()
586{
587 char *x, *y, *z;
588
589 x = anonmap (pg);
590 if (x == (char *)MAP_FAILED)
591 perror_exit ("test 3 mmap 1", 14);
592 y = anonmap (pg);
593 if (y == (char *)MAP_FAILED)
594 perror_exit ("test 3 mmap 2", 15);
595
596 if (y != x + pg)
597 {
598 if (y == x - pg)
599 z = y, y = x, x = z;
600 else
601 {
602 fprintf (stderr, "test 3 nonconsecutive pages - %lx, %lx\n",
603 (unsigned long)x, (unsigned long)y);
604 exit (16);
605 }
606 }
607
608 signal (SIGSEGV, sigsegv);
609 if (setjmp (r))
610 perror_exit ("test 3 fault", 17);
611
612 x[0] = 1;
613 y[0] = 1;
614
615 if (munmap (x, pg*2) < 0)
616 perror_exit ("test 3 munmap", 18);
617
618 if (setjmp (r) == 0)
619 {
620 x[0] = 1;
621 perror_exit ("test 3 no fault 1", 19);
622 }
623
624 signal (SIGSEGV, sigsegv);
625 if (setjmp (r) == 0)
626 {
627 y[0] = 1;
628 perror_exit ("test 3 no fault 2", 20);
629 }
630}
631
632int
633main ()
634{
635 sigemptyset (&unblock_sigsegv);
636 sigaddset (&unblock_sigsegv, SIGSEGV);
637 pg = getpagesize ();
638#ifndef USE_MAP_ANON
639 devzero = open ("/dev/zero", O_RDWR);
640 if (devzero < 0)
641 perror_exit ("open /dev/zero", 1);
642#endif
643
644 test_0();
645 test_1();
646 test_2();
647 test_3();
8ee6d486 648
649 exit(0);
901dfcc7 650}
651EOF}}}
652changequote([,])dnl
653
654AC_CACHE_CHECK(for working mmap from /dev/zero,
655 ac_cv_func_mmap_dev_zero,
656[AC_TRY_RUN(
657 [#include "ct-mmap.inc"],
658 ac_cv_func_mmap_dev_zero=yes,
659 [if test $? -lt 4
660 then ac_cv_func_mmap_dev_zero=no
661 else ac_cv_func_mmap_dev_zero=buggy
662 fi],
663 # If this is not cygwin, and /dev/zero is a character device, it's probably
664 # safe to assume it works.
665 [case "$host_os" in
666 cygwin* | win32 | pe | mingw* ) ac_cv_func_mmap_dev_zero=buggy ;;
667 * ) if test -c /dev/zero
668 then ac_cv_func_mmap_dev_zero=yes
669 else ac_cv_func_mmap_dev_zero=no
670 fi ;;
671 esac])
672])
673if test $ac_cv_func_mmap_dev_zero = yes; then
674 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
675 [Define if mmap can get us zeroed pages from /dev/zero.])
676fi
677
678AC_CACHE_CHECK([for working mmap with MAP_ANON(YMOUS)],
679 ac_cv_func_mmap_anon,
680[AC_TRY_RUN(
681 [#define USE_MAP_ANON
682#include "ct-mmap.inc"],
683 ac_cv_func_mmap_anon=yes,
684 [if test $? -lt 4
685 then ac_cv_func_mmap_anon=no
686 else ac_cv_func_mmap_anon=buggy
687 fi],
688 # Unlike /dev/zero, it is not safe to assume MAP_ANON(YMOUS) works
689 # just because it's there. Some SCO Un*xen define it but don't implement it.
690 ac_cv_func_mmap_anon=no)
691])
692if test $ac_cv_func_mmap_anon = yes; then
693 AC_DEFINE(HAVE_MMAP_ANON, 1,
694 [Define if mmap can get us zeroed pages using MAP_ANON(YMOUS).])
8ee6d486 695fi
901dfcc7 696rm -f ct-mmap.inc
8ee6d486 697])
39af12e5 698
699# Check whether mmap can map a plain file, without MAP_FIXED.
700AC_DEFUN([AC_FUNC_MMAP_FILE],
901dfcc7 701[AC_CACHE_CHECK(for working mmap of a file, ac_cv_func_mmap_file,
39af12e5 702[# Create a file one thousand bytes long.
703for i in 1 2 3 4 5 6 7 8 9 0
704do for j in 1 2 3 4 5 6 7 8 9 0
705do echo $i $j xxxxx
706done
707done > conftestdata$$
708
709AC_TRY_RUN([
710/* Test by Zack Weinberg. Modified from MMAP_ANYWHERE test by
711 Richard Henderson and Alexandre Oliva.
712 Check whether read-only mmap of a plain file works. */
713#include <sys/types.h>
714#include <sys/stat.h>
715#include <fcntl.h>
716#include <sys/mman.h>
717
718int main()
719{
720 char *x;
721 int fd;
722 struct stat st;
723
724 fd = open("conftestdata$$", O_RDONLY);
725 if (fd < 0)
726 exit(1);
727
728 if (fstat (fd, &st))
729 exit(2);
730
731 x = (char*)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
732 if (x == (char *) -1)
733 exit(3);
734
735 if (x[0] != '1' || x[1] != ' ' || x[2] != '1' || x[3] != ' ')
736 exit(4);
737
738 if (munmap(x, st.st_size) < 0)
739 exit(5);
740
741 exit(0);
742}], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no,
743ac_cv_func_mmap_file=no)])
744if test $ac_cv_func_mmap_file = yes; then
745 AC_DEFINE(HAVE_MMAP_FILE, 1,
746 [Define if read-only mmap of a plain file works.])
747fi
748])
049ccec1 749
750dnl Locate a program and check that its version is acceptable.
751dnl AC_PROG_CHECK_VER(var, name, version-switch,
752dnl version-extract-regexp, version-glob)
753AC_DEFUN(gcc_AC_CHECK_PROG_VER,
754[AC_CHECK_PROG([$1], [$2], [$2])
755if test -n "[$]$1"; then
756 # Found it, now check the version.
757 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
758[changequote(<<,>>)dnl
759 ac_prog_version=`<<$>>$1 $3 2>&1 |
760 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
2149241d 761changequote([,])dnl
049ccec1 762 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
2149241d 763changequote(<<,>>)dnl
049ccec1 764 case $ac_prog_version in
765 '') gcc_cv_prog_$2_modern=no;;
766 <<$5>>)
767 gcc_cv_prog_$2_modern=yes;;
768 *) gcc_cv_prog_$2_modern=no;;
769 esac
770changequote([,])dnl
771])
772else
773 gcc_cv_prog_$2_modern=no
774fi
775])
02be28b3 776
777dnl Determine if enumerated bitfields are unsigned. ISO C says they can
778dnl be either signed or unsigned.
779dnl
780AC_DEFUN(gcc_AC_C_ENUM_BF_UNSIGNED,
781[AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
782[AC_TRY_RUN(#include <stdlib.h>
783enum t { BLAH = 128 } ;
784struct s_t { enum t member : 8; } s ;
785int main(void)
786{
787 s.member = BLAH;
788 if (s.member < 0) exit(1);
789 exit(0);
790
791}, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
792if test $gcc_cv_enum_bf_unsigned = yes; then
793 AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
794 [Define if enumerated bitfields are treated as unsigned values.])
795fi])
796
797dnl Host type sizes probe.
798dnl By Kaveh R. Ghazi. One typo fixed since.
799dnl
800AC_DEFUN([gcc_AC_COMPILE_CHECK_SIZEOF],
801[changequote(<<, >>)dnl
802dnl The name to #define.
803define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
804dnl The cache variable name.
805define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
806changequote([, ])dnl
807AC_MSG_CHECKING(size of $1)
808AC_CACHE_VAL(AC_CV_NAME,
809[for ac_size in 4 8 1 2 16 $3 ; do # List sizes in rough order of prevalence.
810 AC_TRY_COMPILE([#include "confdefs.h"
811#include <sys/types.h>
812$2
813], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
814 if test x$AC_CV_NAME != x ; then break; fi
815done
816])
817if test x$AC_CV_NAME = x ; then
818 AC_MSG_ERROR([cannot determine a size for $1])
819fi
820AC_MSG_RESULT($AC_CV_NAME)
821AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
822undefine([AC_TYPE_NAME])dnl
823undefine([AC_CV_NAME])dnl
824])
825
826dnl Probe number of bits in a byte.
827dnl Note C89 requires CHAR_BIT >= 8.
828dnl
829AC_DEFUN(gcc_AC_C_CHAR_BIT,
830[AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
831[AC_EGREP_CPP(found,
832[#ifdef HAVE_LIMITS_H
833#include <limits.h>
834#endif
835#ifdef CHAR_BIT
836found
837#endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
838])
839if test $gcc_cv_decl_char_bit = no; then
840 AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
841[i=8
842 gcc_cv_c_nbby=
843 while test $i -lt 65; do
844 AC_TRY_COMPILE(,
45449d9f 845 [switch(0) {
846 case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
847 case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
848 ; }],
849 [gcc_cv_c_nbby=$i; break])
02be28b3 850 i=`expr $i + 1`
851 done
852 test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
853])
854if test $gcc_cv_c_nbby = failed; then
855 AC_MSG_ERROR(cannot determine number of bits in a byte)
856else
857 AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
858 [Define as the number of bits in a byte, if \`limits.h' doesn't.])
859fi
860fi])
861
862dnl Checking for long long.
863dnl By Caolan McNamara <caolan@skynet.ie>
864dnl Added check for __int64, Zack Weinberg <zackw@stanford.edu>
865dnl
866AC_DEFUN([gcc_AC_C_LONG_LONG],
867[AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
868 [AC_TRY_COMPILE(,[long long int i;],
869 ac_cv_c_long_long=yes,
870 ac_cv_c_long_long=no)])
871 if test $ac_cv_c_long_long = yes; then
872 AC_DEFINE(HAVE_LONG_LONG, 1,
873 [Define if your compiler supports the \`long long' type.])
874 fi
875AC_CACHE_CHECK(for __int64, ac_cv_c___int64,
876 [AC_TRY_COMPILE(,[__int64 i;],
877 ac_cv_c___int64=yes,
878 ac_cv_c___int64=no)])
879 if test $ac_cv_c___int64 = yes; then
880 AC_DEFINE(HAVE___INT64, 1,
881 [Define if your compiler supports the \`__int64' type.])
882 fi
883])
3239b2ba 884
885dnl Host character set probe.
886dnl The EBCDIC values match the table in config/i370/i370.c;
887dnl there are other versions of EBCDIC but GCC won't work with them.
888dnl
889AC_DEFUN([gcc_AC_C_CHARSET],
890[AC_CACHE_CHECK(execution character set, ac_cv_c_charset,
891 [AC_EGREP_CPP(ASCII,
892[#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
893 && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
894ASCII
895#endif], ac_cv_c_charset=ASCII)
896 if test x${ac_cv_c_charset+set} != xset; then
897 AC_EGREP_CPP(EBCDIC,
898[#if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
899 && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
900EBCDIC
901#endif], ac_cv_c_charset=EBCDIC)
902 fi
903 if test x${ac_cv_c_charset+set} != xset; then
904 ac_cv_c_charset=unknown
905 fi])
906if test $ac_cv_c_charset = unknown; then
907 AC_MSG_ERROR([*** Cannot determine host character set.])
908elif test $ac_cv_c_charset = EBCDIC; then
909 AC_DEFINE(HOST_EBCDIC, 1,
910 [Define if the host execution character set is EBCDIC.])
911fi])
912
e7288103 913dnl Utility macro used by next two tests.
914dnl AC_EXAMINE_OBJECT(C source code,
915dnl commands examining object file,
916dnl [commands to run if compile failed]):
917dnl
918dnl Compile the source code to an object file; then convert it into a
919dnl printable representation. All unprintable characters and
920dnl asterisks (*) are replaced by dots (.). All white space is
921dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
922dnl output, but runs of newlines are compressed to a single newline.
923dnl Finally, line breaks are forcibly inserted so that no line is
924dnl longer than 80 columns and the file ends with a newline. The
925dnl result of all this processing is in the file conftest.dmp, which
926dnl may be examined by the commands in the second argument.
927dnl
928AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
929[AC_LANG_SAVE
930AC_LANG_C
931dnl Next bit cribbed from AC_TRY_COMPILE.
932cat > conftest.$ac_ext <<EOF
933[#line __oline__ "configure"
934#include "confdefs.h"
935$1
936]EOF
937if AC_TRY_EVAL(ac_compile); then
938 od -c conftest.o |
3e886684 939 sed ['s/^[0-7]*[ ]*/ /
e7288103 940 s/\*/./g
941 s/ \\n/*/g
942 s/ [0-9][0-9][0-9]/./g
943 s/ \\[^ ]/./g'] |
944 tr -d '
945 ' | tr -s '*' '
946' | fold | sed '$a\
947' > conftest.dmp
948 $2
949ifelse($3, , , else
950 $3
951)dnl
952fi
953rm -rf conftest*
954AC_LANG_RESTORE])
955
3239b2ba 956dnl Host endianness probe.
957dnl This tests byte-within-word endianness. GCC actually needs
958dnl to know word-within-larger-object endianness. They are the
959dnl same on all presently supported hosts.
960dnl Differs from AC_C_BIGENDIAN in that it does not require
961dnl running a program on the host, and it defines the macro we
962dnl want to see.
963dnl
e7288103 964AC_DEFUN([gcc_AC_C_COMPILE_ENDIAN],
965[AC_CACHE_CHECK(byte ordering, ac_cv_c_compile_endian,
966[ac_cv_c_compile_endian=unknown
967gcc_AC_EXAMINE_OBJECT([
3239b2ba 968#ifdef HAVE_LIMITS_H
e7288103 969# include <limits.h>
3239b2ba 970#endif
971/* This structure must have no internal padding. */
972 struct {
e7288103 973 char prefix[sizeof "\nendian:" - 1];
3239b2ba 974 short word;
e7288103 975 char postfix[2];
3239b2ba 976 } tester = {
e7288103 977 "\nendian:",
3239b2ba 978#if SIZEOF_SHORT == 4
979 ('A' << (CHAR_BIT * 3)) | ('B' << (CHAR_BIT * 2)) |
980#endif
e7288103 981 ('A' << CHAR_BIT) | 'B',
982 'X', '\n'
983};],
984 [if grep 'endian:AB' conftest.dmp >/dev/null 2>&1; then
985 ac_cv_c_compile_endian=big-endian
986 elif grep 'endian:BA' conftest.dmp >/dev/null 2>&1; then
987 ac_cv_c_compile_endian=little-endian
988 fi])
989])
990if test $ac_cv_c_compile_endian = unknown; then
3239b2ba 991 AC_MSG_ERROR([*** unable to determine endianness])
e7288103 992elif test $ac_cv_c_compile_endian = big-endian; then
3239b2ba 993 AC_DEFINE(HOST_WORDS_BIG_ENDIAN, 1,
994 [Define if the host machine stores words of multi-word integers in
995 big-endian order.])
996fi
997])
998
999dnl Floating point format probe.
1000dnl The basic concept is the same as the above: grep the object
1001dnl file for an interesting string. We have to watch out for
1002dnl rounding changing the values in the object, however; this is
1003dnl handled by ignoring the least significant byte of the float.
1004dnl
1005dnl Does not know about VAX G-float or C4x idiosyncratic format.
1006dnl It does know about PDP-10 idiosyncratic format, but this is
1007dnl not presently supported by GCC. S/390 "binary floating point"
1008dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1009dnl as ASCII?)
1010dnl
1011AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1012[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
e7288103 1013[gcc_AC_EXAMINE_OBJECT(
3239b2ba 1014[/* This will not work unless sizeof(double) == 8. */
1015extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1016
1017/* This structure must have no internal padding. */
1018struct possibility {
1019 char prefix[8];
1020 double candidate;
1021 char postfix[8];
1022};
1023
e7288103 1024#define C(cand) { "\nformat:", cand, ":tamrof\n" }
3239b2ba 1025struct possibility table [] =
1026{
1027 C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1028 C( 3.53802595280598432000e+18), /* D__float - VAX */
1029 C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1030 C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1031 C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
e7288103 1032};],
1033 [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1034 ac_cv_c_float_format='IEEE (big-endian)'
1035 elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
3239b2ba 1036 ac_cv_c_float_format='IEEE (big-endian)'
e7288103 1037 elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
3239b2ba 1038 ac_cv_c_float_format='IEEE (little-endian)'
e7288103 1039 elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1040 ac_cv_c_float_format='IEEE (little-endian)'
1041 elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
3239b2ba 1042 ac_cv_c_float_format='VAX D-float'
e7288103 1043 elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
3239b2ba 1044 ac_cv_c_float_format='PDP-10'
e7288103 1045 elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
3239b2ba 1046 ac_cv_c_float_format='IBM 370 hex'
1047 else
1048 AC_MSG_ERROR(Unknown floating point format)
e7288103 1049 fi],
1050 [AC_MSG_ERROR(compile failed)])
1051])
1052# IEEE is the default format. If the float endianness isn't the same
1053# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1054# (which is a tristate: yes, no, default). This is only an issue with
1055# IEEE; the other formats are only supported by a few machines each,
1056# all with the same endianness.
3239b2ba 1057format=
e7288103 1058fbigend=
3239b2ba 1059case $ac_cv_c_float_format in
1060 'IEEE (big-endian)' )
e7288103 1061 if test $ac_cv_c_compile_endian = little-endian; then
1062 fbigend=1
1063 fi
3239b2ba 1064 ;;
1065 'IEEE (little-endian)' )
e7288103 1066 if test $ac_cv_c_compile_endian = big-endian; then
1067 fbigend=0
1068 fi
3239b2ba 1069 ;;
1070 'VAX D-float' )
1071 format=VAX_FLOAT_FORMAT
1072 ;;
1073 'PDP-10' )
1074 format=PDP10_FLOAT_FORMAT
1075 ;;
1076 'IBM 370 hex' )
1077 format=IBM_FLOAT_FORMAT
1078 ;;
1079esac
1080if test -n "$format"; then
1081 AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1082 [Define to the floating point format of the host machine, if not IEEE.])
1083fi
e7288103 1084if test -n "$fbigend"; then
1085 AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
3239b2ba 1086 [Define to 1 if the host machine stores floating point numbers in
e7288103 1087 memory with the word containing the sign bit at the lowest address,
1088 or to 0 if it does it the other way around.
3239b2ba 1089
e7288103 1090 This macro should not be defined if the ordering is the same as for
3239b2ba 1091 multi-word integers.])
1092fi
1093])
7093ff41 1094
1095#serial AM2
1096
1097dnl From Bruno Haible.
1098
1099AC_DEFUN([AM_ICONV],
1100[
1101 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
1102 dnl those with the standalone portable GNU libiconv installed).
1103
a63f7018 1104 am_cv_lib_iconv_ldpath=
7093ff41 1105 AC_ARG_WITH([libiconv-prefix],
1106[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
1107 for dir in `echo "$withval" | tr : ' '`; do
1108 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
a63f7018 1109 if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
7093ff41 1110 done
1111 ])
1112
1113 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
1114 am_cv_func_iconv="no, consider installing GNU libiconv"
1115 am_cv_lib_iconv=no
1116 AC_TRY_LINK([#include <stdlib.h>
1117#include <iconv.h>],
1118 [iconv_t cd = iconv_open("","");
1119 iconv(cd,NULL,NULL,NULL,NULL);
1120 iconv_close(cd);],
1121 am_cv_func_iconv=yes)
1122 if test "$am_cv_func_iconv" != yes; then
1123 am_save_LIBS="$LIBS"
a63f7018 1124 LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
7093ff41 1125 AC_TRY_LINK([#include <stdlib.h>
1126#include <iconv.h>],
1127 [iconv_t cd = iconv_open("","");
1128 iconv(cd,NULL,NULL,NULL,NULL);
1129 iconv_close(cd);],
1130 am_cv_lib_iconv=yes
1131 am_cv_func_iconv=yes)
1132 LIBS="$am_save_LIBS"
1133 fi
1134 ])
1135 if test "$am_cv_func_iconv" = yes; then
1136 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
1137 AC_MSG_CHECKING([for iconv declaration])
1138 AC_CACHE_VAL(am_cv_proto_iconv, [
1139 AC_TRY_COMPILE([
1140#include <stdlib.h>
1141#include <iconv.h>
1142extern
1143#ifdef __cplusplus
1144"C"
1145#endif
1146#if defined(__STDC__) || defined(__cplusplus)
1147size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1148#else
1149size_t iconv();
1150#endif
1151], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
1152 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
1153 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1154 AC_MSG_RESULT([$]{ac_t:-
1155 }[$]am_cv_proto_iconv)
1156 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
1157 [Define as const if the declaration of iconv() needs const.])
1158 fi
1159 LIBICONV=
1160 if test "$am_cv_lib_iconv" = yes; then
a63f7018 1161 LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
7093ff41 1162 fi
1163 AC_SUBST(LIBICONV)
1164])
778fc1c8 1165
1166### Gettext macros begin here.
1167### Changes for GCC marked by 'dnl GCC LOCAL'.
1168### Note iconv.m4 appears above, as it's used for other reasons.
1169
1170#serial AM1
1171
1172dnl From Bruno Haible.
1173
1174AC_DEFUN([AM_LANGINFO_CODESET],
1175[
1176 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
1177 [AC_TRY_LINK([#include <langinfo.h>],
1178 [char* cs = nl_langinfo(CODESET);],
1179 am_cv_langinfo_codeset=yes,
1180 am_cv_langinfo_codeset=no)
1181 ])
1182 if test $am_cv_langinfo_codeset = yes; then
1183 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
1184 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
1185 fi
1186])
1187
1188#serial 1
1189# This test replaces the one in autoconf.
1190# Currently this macro should have the same name as the autoconf macro
1191# because gettext's gettext.m4 (distributed in the automake package)
1192# still uses it. Otherwise, the use in gettext.m4 makes autoheader
1193# give these diagnostics:
1194# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
1195# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
1196
1197undefine([AC_ISC_POSIX])
1198
1199AC_DEFUN([AC_ISC_POSIX],
1200 [
1201 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
1202 dnl GCC LOCAL: Use AC_SEARCH_LIBS.
1203 AC_SEARCH_LIBS(strerror, cposix)
1204 ]
1205)
1206
1207#serial 2
1208
1209# Test for the GNU C Library, version 2.1 or newer.
1210# From Bruno Haible.
1211
1212AC_DEFUN([jm_GLIBC21],
1213 [
1214 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
1215 ac_cv_gnu_library_2_1,
1216 [AC_EGREP_CPP([Lucky GNU user],
1217 [
1218#include <features.h>
1219#ifdef __GNU_LIBRARY__
1220 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
1221 Lucky GNU user
1222 #endif
1223#endif
1224 ],
1225 ac_cv_gnu_library_2_1=yes,
1226 ac_cv_gnu_library_2_1=no)
1227 ]
1228 )
1229 AC_SUBST(GLIBC21)
1230 GLIBC21="$ac_cv_gnu_library_2_1"
1231 ]
1232)
1233
1234# Check whether LC_MESSAGES is available in <locale.h>.
1235# Ulrich Drepper <drepper@cygnus.com>, 1995.
1236#
1237# This file can be copied and used freely without restrictions. It can
1238# be used in projects which are not available under the GNU General Public
1239# License or the GNU Library General Public License but which still want
1240# to provide support for the GNU gettext functionality.
1241# Please note that the actual code of the GNU gettext library is covered
1242# by the GNU Library General Public License, and the rest of the GNU
1243# gettext package package is covered by the GNU General Public License.
1244# They are *not* in the public domain.
1245
1246# serial 2
1247
1248AC_DEFUN([AM_LC_MESSAGES],
1249 [if test $ac_cv_header_locale_h = yes; then
1250 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1251 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1252 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1253 if test $am_cv_val_LC_MESSAGES = yes; then
1254 AC_DEFINE(HAVE_LC_MESSAGES, 1,
1255 [Define if your <locale.h> file defines LC_MESSAGES.])
1256 fi
1257 fi])
1258
1259# Search path for a program which passes the given test.
1260# Ulrich Drepper <drepper@cygnus.com>, 1996.
1261#
1262# This file can be copied and used freely without restrictions. It can
1263# be used in projects which are not available under the GNU General Public
1264# License or the GNU Library General Public License but which still want
1265# to provide support for the GNU gettext functionality.
1266# Please note that the actual code of the GNU gettext library is covered
1267# by the GNU Library General Public License, and the rest of the GNU
1268# gettext package package is covered by the GNU General Public License.
1269# They are *not* in the public domain.
1270
1271# serial 2
1272
1273dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1274dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1275AC_DEFUN([AM_PATH_PROG_WITH_TEST],
1276[# Extract the first word of "$2", so it can be a program name with args.
1277set dummy $2; ac_word=[$]2
1278AC_MSG_CHECKING([for $ac_word])
1279AC_CACHE_VAL(ac_cv_path_$1,
1280[case "[$]$1" in
1281 /*)
1282 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1283 ;;
1284 *)
1285 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1286 for ac_dir in ifelse([$5], , $PATH, [$5]); do
1287 test -z "$ac_dir" && ac_dir=.
1288 if test -f $ac_dir/$ac_word; then
1289 if [$3]; then
1290 ac_cv_path_$1="$ac_dir/$ac_word"
1291 break
1292 fi
1293 fi
1294 done
1295 IFS="$ac_save_ifs"
1296dnl If no 4th arg is given, leave the cache variable unset,
1297dnl so AC_PATH_PROGS will keep looking.
1298ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1299])dnl
1300 ;;
1301esac])dnl
1302$1="$ac_cv_path_$1"
1303if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1304 AC_MSG_RESULT([$]$1)
1305else
1306 AC_MSG_RESULT(no)
1307fi
1308AC_SUBST($1)dnl
1309])
1310
1311# Macro to add for using GNU gettext.
1312# Ulrich Drepper <drepper@cygnus.com>, 1995.
1313#
1314# This file can be copied and used freely without restrictions. It can
1315# be used in projects which are not available under the GNU General Public
1316# License or the GNU Library General Public License but which still want
1317# to provide support for the GNU gettext functionality.
1318# Please note that the actual code of the GNU gettext library is covered
1319# by the GNU Library General Public License, and the rest of the GNU
1320# gettext package package is covered by the GNU General Public License.
1321# They are *not* in the public domain.
1322
1323# serial 10
1324
1325dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
1326dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
1327dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1328dnl depending on --{enable,disable}-{shared,static} and on the presence of
1329dnl AM-DISABLE-SHARED). Otherwise, a static library
1330dnl $(top_builddir)/intl/libintl.a will be created.
1331dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1332dnl implementations (in libc or libintl) without the ngettext() function
1333dnl will be ignored.
1334dnl LIBDIR is used to find the intl libraries. If empty,
1335dnl the value `$(top_builddir)/intl/' is used.
1336dnl
1337dnl The result of the configuration is one of three cases:
1338dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1339dnl and used.
1340dnl Catalog format: GNU --> install in $(datadir)
1341dnl Catalog extension: .mo after installation, .gmo in source tree
1342dnl 2) GNU gettext has been found in the system's C library.
1343dnl Catalog format: GNU --> install in $(datadir)
1344dnl Catalog extension: .mo after installation, .gmo in source tree
1345dnl 3) No internationalization, always use English msgid.
1346dnl Catalog format: none
1347dnl Catalog extension: none
1348dnl The use of .gmo is historical (it was needed to avoid overwriting the
1349dnl GNU format catalogs when building on a platform with an X/Open gettext),
1350dnl but we keep it in order not to force irrelevant filename changes on the
1351dnl maintainers.
1352dnl
1353AC_DEFUN([AM_WITH_NLS],
1354 [AC_MSG_CHECKING([whether NLS is requested])
1355 dnl Default is enabled NLS
1356 AC_ARG_ENABLE(nls,
1357 [ --disable-nls do not use Native Language Support],
1358 USE_NLS=$enableval, USE_NLS=yes)
1359 AC_MSG_RESULT($USE_NLS)
1360 AC_SUBST(USE_NLS)
1361
1362 BUILD_INCLUDED_LIBINTL=no
1363 USE_INCLUDED_LIBINTL=no
c6c8127d 1364dnl GCC LOCAL: Separate concept of link command line from dependencies.
778fc1c8 1365 INTLLIBS=
c6c8127d 1366 INTLDEPS=
778fc1c8 1367
1368 dnl If we use NLS figure out what method
1369 if test "$USE_NLS" = "yes"; then
1370 AC_DEFINE(ENABLE_NLS, 1,
1371 [Define to 1 if translation of program messages to the user's native language
1372 is requested.])
1373 AC_MSG_CHECKING([whether included gettext is requested])
1374 AC_ARG_WITH(included-gettext,
1375 [ --with-included-gettext use the GNU gettext library included here],
1376 nls_cv_force_use_gnu_gettext=$withval,
1377 nls_cv_force_use_gnu_gettext=no)
1378 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1379
1380 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1381 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1382 dnl User does not insist on using GNU NLS library. Figure out what
1383 dnl to use. If GNU gettext is available we use this. Else we have
1384 dnl to fall back to GNU NLS library.
1385 CATOBJEXT=NONE
1386
1387 dnl Add a version number to the cache macros.
1388 define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
1389 define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
1390
eb718689 1391dnl GCC LOCAL: Expose presence of libintl.h to C code.
778fc1c8 1392 AC_CHECK_HEADER(libintl.h,
eb718689 1393 [AC_DEFINE([HAVE_LIBINTL_H], 1,
1394 [Define if you have the <libintl.h> header file.])
1395 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
778fc1c8 1396 [AC_TRY_LINK([#include <libintl.h>
1397extern int _nl_msg_cat_cntr;],
1398 [bindtextdomain ("", "");
1399return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1400 gt_cv_func_gnugettext_libc=yes,
1401 gt_cv_func_gnugettext_libc=no)])
1402
1403 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1404 AC_CACHE_CHECK([for GNU gettext in libintl],
1405 gt_cv_func_gnugettext_libintl,
1406 [gt_save_LIBS="$LIBS"
1407 LIBS="$LIBS -lintl $LIBICONV"
1408 AC_TRY_LINK([#include <libintl.h>
1409extern int _nl_msg_cat_cntr;],
1410 [bindtextdomain ("", "");
1411return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1412 gt_cv_func_gnugettext_libintl=yes,
1413 gt_cv_func_gnugettext_libintl=no)
1414 LIBS="$gt_save_LIBS"])
1415 fi
1416
1417 dnl If an already present or preinstalled GNU gettext() is found,
1418 dnl use it. But if this macro is used in GNU gettext, and GNU
1419 dnl gettext is already preinstalled in libintl, we update this
1420 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
1421 if test "$gt_cv_func_gnugettext_libc" = "yes" \
1422 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1423 && test "$PACKAGE" != gettext; }; then
1424 AC_DEFINE(HAVE_GETTEXT, 1,
1425 [Define if the GNU gettext() function is already present or preinstalled.])
1426
1427 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1428 dnl If iconv() is in a separate libiconv library, then anyone
1429 dnl linking with libintl{.a,.so} also needs to link with
1430 dnl libiconv.
1431 INTLLIBS="-lintl $LIBICONV"
1432 fi
1433
1434 gt_save_LIBS="$LIBS"
1435 LIBS="$LIBS $INTLLIBS"
1436 AC_CHECK_FUNCS(dcgettext)
1437 LIBS="$gt_save_LIBS"
1438
1439 dnl Search for GNU msgfmt in the PATH.
1440 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1441 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1442 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1443
1444 dnl Search for GNU xgettext in the PATH.
1445 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1446 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1447
1448 CATOBJEXT=.gmo
1449 fi
1450 ])
1451
1452 if test "$CATOBJEXT" = "NONE"; then
1453 dnl GNU gettext is not found in the C library.
1454 dnl Fall back on GNU gettext library.
1455 nls_cv_use_gnu_gettext=yes
1456 fi
1457 fi
1458
1459 if test "$nls_cv_use_gnu_gettext" = "yes"; then
1460 dnl Mark actions used to generate GNU NLS library.
1461 INTLOBJS="\$(GETTOBJS)"
1462 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1463 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1464 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1465 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1466 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1467 AC_SUBST(MSGFMT)
1468 BUILD_INCLUDED_LIBINTL=yes
1469 USE_INCLUDED_LIBINTL=yes
1470 CATOBJEXT=.gmo
1471 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
c6c8127d 1472 INTLDEPS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a"
778fc1c8 1473 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1474 fi
1475
1476 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1477 dnl Test whether we really found GNU msgfmt.
1478 if test "$GMSGFMT" != ":"; then
1479 dnl If it is no GNU msgfmt we define it as : so that the
1480 dnl Makefiles still can work.
1481 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
1482 : ;
1483 else
1484 AC_MSG_RESULT(
1485 [found msgfmt program is not GNU msgfmt; ignore it])
1486 GMSGFMT=":"
1487 fi
1488 fi
1489
1490 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1491 dnl Test whether we really found GNU xgettext.
1492 if test "$XGETTEXT" != ":"; then
1493 dnl If it is no GNU xgettext we define it as : so that the
1494 dnl Makefiles still can work.
1495 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
1496 : ;
1497 else
1498 AC_MSG_RESULT(
1499 [found xgettext program is not GNU xgettext; ignore it])
1500 XGETTEXT=":"
1501 fi
1502 fi
1503
1504 dnl We need to process the po/ directory.
1505 POSUB=po
1506 fi
1507 AC_OUTPUT_COMMANDS(
1508 [for ac_file in $CONFIG_FILES; do
1509 # Support "outfile[:infile[:infile...]]"
1510 case "$ac_file" in
1511 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1512 esac
1513 # PO directories have a Makefile.in generated from Makefile.in.in.
1514 case "$ac_file" in */Makefile.in)
1515 # Adjust a relative srcdir.
1516 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1517 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1518 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1519 # In autoconf-2.13 it is called $ac_given_srcdir.
1520 # In autoconf-2.50 it is called $srcdir.
1521 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1522 case "$ac_given_srcdir" in
1523 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1524 /*) top_srcdir="$ac_given_srcdir" ;;
1525 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
1526 esac
1527 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1528 rm -f "$ac_dir/POTFILES"
1529 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1530 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1531 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1532 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1533 fi
1534 ;;
1535 esac
1536 done])
1537
1538
1539 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1540 dnl to 'yes' because some of the testsuite requires it.
1541 if test "$PACKAGE" = gettext; then
1542 BUILD_INCLUDED_LIBINTL=yes
1543 fi
1544
1545 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1546 dnl because plural.y uses bison specific features. It requires at least
1547 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1548 dnl compile.
1549 dnl bison is only needed for the maintainer (who touches plural.y). But in
1550 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1551 dnl the rule in general Makefile. Now, some people carelessly touch the
1552 dnl files or have a broken "make" program, hence the plural.c rule will
1553 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1554 dnl present or too old.
1555 AC_CHECK_PROGS([INTLBISON], [bison])
1556 if test -z "$INTLBISON"; then
1557 ac_verc_fail=yes
1558 else
1559 dnl Found it, now check the version.
1560 AC_MSG_CHECKING([version of bison])
1561changequote(<<,>>)dnl
1562 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1563 case $ac_prog_version in
1564 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1565 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1566changequote([,])dnl
1567 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1568 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1569 esac
1570 AC_MSG_RESULT([$ac_prog_version])
1571 fi
1572 if test $ac_verc_fail = yes; then
1573 INTLBISON=:
1574 fi
1575
48c772de 1576 dnl GCC LOCAL: GMOFILES/POFILES removed as unnecessary.
778fc1c8 1577
1578 dnl Make all variables we use known to autoconf.
1579 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1580 AC_SUBST(USE_INCLUDED_LIBINTL)
1581 AC_SUBST(CATALOGS)
1582 AC_SUBST(CATOBJEXT)
778fc1c8 1583 AC_SUBST(INTLLIBS)
c6c8127d 1584 AC_SUBST(INTLDEPS)
778fc1c8 1585 AC_SUBST(INTLOBJS)
778fc1c8 1586 AC_SUBST(POSUB)
eb718689 1587dnl GCC LOCAL: Make USE_INCLUDED_LIBINTL visible to C code.
1588 if test $USE_INCLUDED_LIBINTL = yes; then
1589 AC_DEFINE([USE_INCLUDED_LIBINTL], 1,
1590 [Define to use the libintl included with this package instead of any
1591 version in the system libraries.])
1592 fi
778fc1c8 1593
1594 dnl For backward compatibility. Some configure.ins may be using this.
1595 nls_cv_header_intl=
1596 nls_cv_header_libgt=
1597
1598 dnl For backward compatibility. Some Makefiles may be using this.
1599 DATADIRNAME=share
1600 AC_SUBST(DATADIRNAME)
1601
1602 dnl For backward compatibility. Some Makefiles may be using this.
1603 INSTOBJEXT=.mo
1604 AC_SUBST(INSTOBJEXT)
1605
1606 dnl For backward compatibility. Some Makefiles may be using this.
1607 GENCAT=gencat
1608 AC_SUBST(GENCAT)
1609 ])
1610
1611dnl Usage: Just like AM_WITH_NLS, which see.
1612AC_DEFUN([AM_GNU_GETTEXT],
1613 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1614 AC_REQUIRE([AC_PROG_CC])dnl
1615 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1616 AC_REQUIRE([AC_PROG_RANLIB])dnl
1617 AC_REQUIRE([AC_ISC_POSIX])dnl
1618 AC_REQUIRE([AC_HEADER_STDC])dnl
1619 AC_REQUIRE([AC_C_CONST])dnl
1620 AC_REQUIRE([AC_C_INLINE])dnl
1621 AC_REQUIRE([AC_TYPE_OFF_T])dnl
1622 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1623 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1624dnl GCC LOCAL: Do not refer to AC_FUNC_MMAP, we have special needs.
1625dnl AC_REQUIRE([AC_FUNC_MMAP])dnl
1626 AC_REQUIRE([jm_GLIBC21])dnl
1627
1628 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1629stdlib.h string.h unistd.h sys/param.h])
1630 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1631getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1632strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1633
1634 AM_ICONV
1635 AM_LANGINFO_CODESET
1636 AM_LC_MESSAGES
1637 AM_WITH_NLS([$1],[$2],[$3])
1638
48c772de 1639 dnl GCC LOCAL: The LINGUAS/ALL_LINGUAS/CATALOGS mess that was here
1640 dnl has been torn out and replaced with this more sensible scheme.
1641 if test "x$CATOBJEXT" != x; then
1642 AC_MSG_CHECKING(for catalogs to be installed)
1643 # Look for .po and .gmo files in the source directory.
1644 CATALOGS=
1645 XLINGUAS=
1646 for cat in $srcdir/po/*$CATOBJEXT $srcdir/po/*.po; do
1647 # If there aren't any .gmo files the shell will give us the
1648 # literal string "../path/to/srcdir/po/*.gmo" which has to be
1649 # weeded out.
1650 case "$cat" in *\**)
1651 continue;;
1652 esac
1653 # The quadruple backslash is collapsed to a double backslash
1654 # by the backticks, then collapsed again by the double quotes,
1655 # leaving us with one backslash in the sed expression (right
1656 # before the dot that mustn't act as a wildcard). The dot to
1657 # be escaped in the second expression is hiding inside CATOBJEXT.
1658 cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!$CATOBJEXT!"`
1659 lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\$CATOBJEXT!!"`
1660 # The user is allowed to set LINGUAS to a list of languages to
1661 # install catalogs for. If it's empty that means "all of them."
1662 if test "x$LINGUAS" = x; then
1663 CATALOGS="$CATALOGS $cat"
1664 XLINGUAS="$XLINGUAS $lang"
1665 else
1666 case "$LINGUAS" in *$lang*)
1667 CATALOGS="$CATALOGS $cat"
1668 XLINGUAS="$XLINGUAS $lang"
1669 ;;
1670 esac
1671 fi
1672 done
1673 LINGUAS="$XLINGUAS"
1674 AC_MSG_RESULT($LINGUAS)
778fc1c8 1675 fi
1676
1677 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1678 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1679 dnl Try to locate is.
1680 MKINSTALLDIRS=
1681 if test -n "$ac_aux_dir"; then
1682 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1683 fi
1684 if test -z "$MKINSTALLDIRS"; then
1685 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1686 fi
1687 AC_SUBST(MKINSTALLDIRS)
1688
1689 dnl Enable libtool support if the surrounding package wishes it.
1690 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1691 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1692 ])