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