]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/aclocal.m4
getopt.h (getopt): Also check HAVE_DECL_* when prototyping.
[thirdparty/gcc.git] / gcc / aclocal.m4
1 dnl See whether we can include both string.h and strings.h.
2 AC_DEFUN(gcc_AC_HEADER_STRING,
3 [AC_CACHE_CHECK([whether string.h and strings.h may both be included],
4 gcc_cv_header_string,
5 [AC_TRY_COMPILE([#include <string.h>
6 #include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
7 if test $gcc_cv_header_string = yes; then
8 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
9 fi
10 ])
11
12 dnl See whether we need a declaration for a function.
13 dnl The result is highly dependent on the INCLUDES passed in, so make sure
14 dnl to use a different cache variable name in this macro if it is invoked
15 dnl in a different context somewhere else.
16 dnl gcc_AC_CHECK_DECL(SYMBOL,
17 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
18 AC_DEFUN(gcc_AC_CHECK_DECL,
19 [AC_MSG_CHECKING([whether $1 is declared])
20 AC_CACHE_VAL(gcc_cv_have_decl_$1,
21 [AC_TRY_COMPILE([$4],
22 [#ifndef $1
23 char *(*pfn) = (char *(*)) $1 ;
24 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
25 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
26 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
27 else
28 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
29 fi
30 ])dnl
31
32 dnl Check multiple functions to see whether each needs a declaration.
33 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
34 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
35 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
36 AC_DEFUN(gcc_AC_CHECK_DECLS,
37 [for ac_func in $1
38 do
39 changequote(, )dnl
40 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
41 changequote([, ])dnl
42 gcc_AC_CHECK_DECL($ac_func,
43 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
44 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
45 $4
46 )
47 done
48 dnl Automatically generate config.h entries via autoheader.
49 if test x = y ; then
50 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
51 AC_DEFINE([HAVE_DECL_\&], 1,
52 [Define to 1 if we found this declaration otherwise define to 0.]))dnl
53 fi
54 ])
55
56 dnl Check if we have vprintf and possibly _doprnt.
57 dnl Note autoconf checks for vprintf even though we care about vfprintf.
58 AC_DEFUN(gcc_AC_FUNC_VFPRINTF_DOPRNT,
59 [AC_FUNC_VPRINTF
60 vfprintf=
61 doprint=
62 if test $ac_cv_func_vprintf != yes ; then
63 vfprintf=vfprintf.o
64 if test $ac_cv_func__doprnt != yes ; then
65 doprint=doprint.o
66 fi
67 fi
68 AC_SUBST(vfprintf)
69 AC_SUBST(doprint)
70 ])
71
72 dnl See if the printf functions in libc support %p in format strings.
73 AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
74 [AC_CACHE_CHECK(whether the printf functions support %p,
75 gcc_cv_func_printf_ptr,
76 [AC_TRY_RUN([#include <stdio.h>
77
78 int main()
79 {
80 char buf[64];
81 char *p = buf, *q = NULL;
82 sprintf(buf, "%p", p);
83 sscanf(buf, "%p", &q);
84 return (p != q);
85 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
86 gcc_cv_func_printf_ptr=no)
87 rm -f core core.* *.core])
88 if test $gcc_cv_func_printf_ptr = yes ; then
89 AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
90 fi
91 ])
92
93 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
94 AC_DEFUN(gcc_AC_PROG_LN_S,
95 [AC_MSG_CHECKING(whether ln -s works)
96 AC_CACHE_VAL(gcc_cv_prog_LN_S,
97 [rm -f conftestdata_t
98 echo >conftestdata_f
99 if ln -s conftestdata_f conftestdata_t 2>/dev/null
100 then
101 gcc_cv_prog_LN_S="ln -s"
102 else
103 if ln conftestdata_f conftestdata_t 2>/dev/null
104 then
105 gcc_cv_prog_LN_S=ln
106 else
107 gcc_cv_prog_LN_S=cp
108 fi
109 fi
110 rm -f conftestdata_f conftestdata_t
111 ])dnl
112 LN_S="$gcc_cv_prog_LN_S"
113 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
114 AC_MSG_RESULT(yes)
115 else
116 if test "$gcc_cv_prog_LN_S" = "ln"; then
117 AC_MSG_RESULT([no, using ln])
118 else
119 AC_MSG_RESULT([no, and neither does ln, so using cp])
120 fi
121 fi
122 AC_SUBST(LN_S)dnl
123 ])
124
125 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
126 AC_DEFUN(gcc_AC_PROG_LN,
127 [AC_MSG_CHECKING(whether ln works)
128 AC_CACHE_VAL(gcc_cv_prog_LN,
129 [rm -f conftestdata_t
130 echo >conftestdata_f
131 if ln conftestdata_f conftestdata_t 2>/dev/null
132 then
133 gcc_cv_prog_LN="ln"
134 else
135 if ln -s conftestdata_f conftestdata_t 2>/dev/null
136 then
137 gcc_cv_prog_LN="ln -s"
138 else
139 gcc_cv_prog_LN=cp
140 fi
141 fi
142 rm -f conftestdata_f conftestdata_t
143 ])dnl
144 LN="$gcc_cv_prog_LN"
145 if test "$gcc_cv_prog_LN" = "ln"; then
146 AC_MSG_RESULT(yes)
147 else
148 if test "$gcc_cv_prog_LN" = "ln -s"; then
149 AC_MSG_RESULT([no, using ln -s])
150 else
151 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
152 fi
153 fi
154 AC_SUBST(LN)dnl
155 ])
156
157 dnl See whether the stage1 host compiler accepts the volatile keyword.
158 AC_DEFUN(gcc_AC_C_VOLATILE,
159 [AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
160 [AC_TRY_COMPILE(, [volatile int foo;],
161 gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
162 if test $gcc_cv_c_volatile = yes ; then
163 AC_DEFINE(HAVE_VOLATILE, 1, [Define if your compiler understands volatile.])
164 fi
165 ])
166
167 dnl Check whether long double is supported. This differs from the
168 dnl built-in autoconf test in that it works for cross compiles.
169 AC_DEFUN(gcc_AC_C_LONG_DOUBLE,
170 [AC_CACHE_CHECK(for long double, gcc_cv_c_long_double,
171 [if test "$GCC" = yes; then
172 gcc_cv_c_long_double=yes
173 else
174 AC_TRY_COMPILE(,
175 [/* The Stardent Vistra knows sizeof(long double), but does not support it. */
176 long double foo = 0.0;
177 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
178 switch (0) case 0: case (sizeof(long double) >= sizeof(double)):;],
179 gcc_cv_c_long_double=yes, gcc_cv_c_long_double=no)
180 fi])
181 if test $gcc_cv_c_long_double = yes; then
182 AC_DEFINE(HAVE_LONG_DOUBLE)
183 fi
184 ])
185
186 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
187 dnl of the usual 2.
188 AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
189 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
190 [AC_TRY_COMPILE([
191 #include <sys/types.h>
192 #ifdef HAVE_SYS_STAT_H
193 # include <sys/stat.h>
194 #endif
195 #ifdef HAVE_UNISTD_H
196 # include <unistd.h>
197 #endif
198 #ifdef HAVE_DIRECT_H
199 # include <direct.h>
200 #endif], [mkdir ("foo", 0);],
201 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
202 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
203 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
204 fi
205 ])
206
207 AC_DEFUN(gcc_AC_PROG_INSTALL,
208 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
209 # Find a good install program. We prefer a C program (faster),
210 # so one script is as good as another. But avoid the broken or
211 # incompatible versions:
212 # SysV /etc/install, /usr/sbin/install
213 # SunOS /usr/etc/install
214 # IRIX /sbin/install
215 # AIX /bin/install
216 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
217 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
218 # ./install, which can be erroneously created by make from ./install.sh.
219 AC_MSG_CHECKING(for a BSD compatible install)
220 if test -z "$INSTALL"; then
221 AC_CACHE_VAL(ac_cv_path_install,
222 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
223 for ac_dir in $PATH; do
224 # Account for people who put trailing slashes in PATH elements.
225 case "$ac_dir/" in
226 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
227 *)
228 # OSF1 and SCO ODT 3.0 have their own names for install.
229 for ac_prog in ginstall scoinst install; do
230 if test -f $ac_dir/$ac_prog; then
231 if test $ac_prog = install &&
232 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
233 # AIX install. It has an incompatible calling convention.
234 # OSF/1 installbsd also uses dspmsg, but is usable.
235 :
236 else
237 ac_cv_path_install="$ac_dir/$ac_prog -c"
238 break 2
239 fi
240 fi
241 done
242 ;;
243 esac
244 done
245 IFS="$ac_save_IFS"
246 ])dnl
247 if test "${ac_cv_path_install+set}" = set; then
248 INSTALL="$ac_cv_path_install"
249 else
250 # As a last resort, use the slow shell script. We don't cache a
251 # path for INSTALL within a source directory, because that will
252 # break other packages using the cache if that directory is
253 # removed, or if the path is relative.
254 INSTALL="$ac_install_sh"
255 fi
256 fi
257 dnl We do special magic for INSTALL instead of AC_SUBST, to get
258 dnl relative paths right.
259 AC_MSG_RESULT($INSTALL)
260 AC_SUBST(INSTALL)dnl
261
262 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
263 # It thinks the first close brace ends the variable substitution.
264 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
265 AC_SUBST(INSTALL_PROGRAM)dnl
266
267 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
268 AC_SUBST(INSTALL_DATA)dnl
269 ])
270
271 #serial 1
272 dnl This test replaces the one in autoconf.
273 dnl Currently this macro should have the same name as the autoconf macro
274 dnl because gettext's gettext.m4 (distributed in the automake package)
275 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
276 dnl give these diagnostics:
277 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
278 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
279
280 undefine([AC_ISC_POSIX])
281 AC_DEFUN(AC_ISC_POSIX,
282 [
283 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
284 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
285 ]
286 )
287
288 # Macro to add for using GNU gettext.
289 # Ulrich Drepper <drepper@cygnus.com>, 1995.
290 #
291 # This file can be copied and used freely without restrictions. It can
292 # be used in projects which are not available under the GNU Public License
293 # but which still want to provide support for the GNU gettext functionality.
294 # Please note that the actual code is *not* freely available.
295
296 # serial 5
297
298 AC_DEFUN(AM_WITH_NLS,
299 [AC_MSG_CHECKING([whether NLS is requested])
300 dnl Default is enabled NLS
301 AC_ARG_ENABLE(nls,
302 [ --disable-nls do not use Native Language Support],
303 USE_NLS=$enableval, USE_NLS=yes)
304 AC_MSG_RESULT($USE_NLS)
305 AC_SUBST(USE_NLS)
306
307 USE_INCLUDED_LIBINTL=no
308
309 dnl If we use NLS figure out what method
310 if test "$USE_NLS" = "yes"; then
311 AC_DEFINE(ENABLE_NLS)
312 AC_MSG_CHECKING([whether included gettext is requested])
313 AC_ARG_WITH(included-gettext,
314 [ --with-included-gettext use the GNU gettext library included here],
315 nls_cv_force_use_gnu_gettext=$withval,
316 nls_cv_force_use_gnu_gettext=no)
317 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
318
319 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
320 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
321 dnl User does not insist on using GNU NLS library. Figure out what
322 dnl to use. If gettext or catgets are available (in this order) we
323 dnl use this. Else we have to fall back to GNU NLS library.
324 dnl catgets is only used if permitted by option --with-catgets.
325 nls_cv_header_intl=
326 nls_cv_header_libgt=
327 CATOBJEXT=NONE
328
329 AC_CHECK_HEADER(libintl.h,
330 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
331 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
332 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
333
334 if test "$gt_cv_func_gettext_libc" != "yes"; then
335 AC_CHECK_LIB(intl, bindtextdomain,
336 [AC_CACHE_CHECK([for gettext in libintl],
337 gt_cv_func_gettext_libintl,
338 [AC_CHECK_LIB(intl, gettext,
339 gt_cv_func_gettext_libintl=yes,
340 gt_cv_func_gettext_libintl=no)],
341 gt_cv_func_gettext_libintl=no)])
342 fi
343
344 if test "$gt_cv_func_gettext_libc" = "yes" \
345 || test "$gt_cv_func_gettext_libintl" = "yes"; then
346 AC_DEFINE(HAVE_GETTEXT)
347 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
348 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
349 if test "$MSGFMT" != "no"; then
350 AC_CHECK_FUNCS(dcgettext)
351 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
352 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
353 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
354 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
355 return _nl_msg_cat_cntr],
356 [CATOBJEXT=.gmo
357 DATADIRNAME=share],
358 [CATOBJEXT=.mo
359 DATADIRNAME=lib])
360 INSTOBJEXT=.mo
361 fi
362 fi
363 ])
364
365 if test "$CATOBJEXT" = "NONE"; then
366 AC_MSG_CHECKING([whether catgets can be used])
367 AC_ARG_WITH(catgets,
368 [ --with-catgets use catgets functions if available],
369 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
370 AC_MSG_RESULT($nls_cv_use_catgets)
371
372 if test "$nls_cv_use_catgets" = "yes"; then
373 dnl No gettext in C library. Try catgets next.
374 AC_CHECK_LIB(i, main)
375 AC_CHECK_FUNC(catgets,
376 [AC_DEFINE(HAVE_CATGETS)
377 INTLOBJS="\$(CATOBJS)"
378 AC_PATH_PROG(GENCAT, gencat, no)dnl
379 if test "$GENCAT" != "no"; then
380 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
381 if test "$GMSGFMT" = "no"; then
382 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
383 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
384 fi
385 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
386 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
387 USE_INCLUDED_LIBINTL=yes
388 CATOBJEXT=.cat
389 INSTOBJEXT=.cat
390 DATADIRNAME=lib
391 INTLDEPS='$(top_builddir)/intl/libintl.a'
392 INTLLIBS=$INTLDEPS
393 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
394 nls_cv_header_intl=intl/libintl.h
395 nls_cv_header_libgt=intl/libgettext.h
396 fi])
397 fi
398 fi
399
400 if test "$CATOBJEXT" = "NONE"; then
401 dnl Neither gettext nor catgets in included in the C library.
402 dnl Fall back on GNU gettext library.
403 nls_cv_use_gnu_gettext=yes
404 fi
405 fi
406
407 if test "$nls_cv_use_gnu_gettext" = "yes"; then
408 dnl Mark actions used to generate GNU NLS library.
409 INTLOBJS="\$(GETTOBJS)"
410 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
411 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
412 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
413 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
414 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
415 AC_SUBST(MSGFMT)
416 USE_INCLUDED_LIBINTL=yes
417 CATOBJEXT=.gmo
418 INSTOBJEXT=.mo
419 DATADIRNAME=share
420 INTLDEPS='$(top_builddir)/intl/libintl.a'
421 INTLLIBS=$INTLDEPS
422 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
423 nls_cv_header_intl=intl/libintl.h
424 nls_cv_header_libgt=intl/libgettext.h
425 fi
426
427 dnl Test whether we really found GNU xgettext.
428 if test "$XGETTEXT" != ":"; then
429 dnl If it is no GNU xgettext we define it as : so that the
430 dnl Makefiles still can work.
431 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
432 : ;
433 else
434 AC_MSG_RESULT(
435 [found xgettext program is not GNU xgettext; ignore it])
436 XGETTEXT=":"
437 fi
438 fi
439
440 # We need to process the po/ directory.
441 POSUB=po
442 else
443 DATADIRNAME=share
444 nls_cv_header_intl=intl/libintl.h
445 nls_cv_header_libgt=intl/libgettext.h
446 fi
447 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
448 AC_OUTPUT_COMMANDS(
449 [case "$CONFIG_FILES" in *po/Makefile.in*)
450 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
451 esac])
452
453
454 # If this is used in GNU gettext we have to set USE_NLS to `yes'
455 # because some of the sources are only built for this goal.
456 if test "$PACKAGE" = gettext; then
457 USE_NLS=yes
458 USE_INCLUDED_LIBINTL=yes
459 fi
460
461 dnl These rules are solely for the distribution goal. While doing this
462 dnl we only have to keep exactly one list of the available catalogs
463 dnl in configure.in.
464 for lang in $ALL_LINGUAS; do
465 GMOFILES="$GMOFILES $lang.gmo"
466 POFILES="$POFILES $lang.po"
467 done
468
469 dnl Make all variables we use known to autoconf.
470 AC_SUBST(USE_INCLUDED_LIBINTL)
471 AC_SUBST(CATALOGS)
472 AC_SUBST(CATOBJEXT)
473 AC_SUBST(DATADIRNAME)
474 AC_SUBST(GMOFILES)
475 AC_SUBST(INSTOBJEXT)
476 AC_SUBST(INTLDEPS)
477 AC_SUBST(INTLLIBS)
478 AC_SUBST(INTLOBJS)
479 AC_SUBST(POFILES)
480 AC_SUBST(POSUB)
481 ])
482
483 AC_DEFUN(AM_GNU_GETTEXT,
484 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
485 AC_REQUIRE([AC_PROG_CC])dnl
486 AC_REQUIRE([AC_PROG_RANLIB])dnl
487 AC_REQUIRE([AC_ISC_POSIX])dnl
488 AC_REQUIRE([AC_HEADER_STDC])dnl
489 AC_REQUIRE([AC_C_CONST])dnl
490 AC_REQUIRE([AC_C_INLINE])dnl
491 AC_REQUIRE([AC_TYPE_OFF_T])dnl
492 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
493 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
494
495 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
496 unistd.h sys/param.h])
497 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
498 strdup __argz_count __argz_stringify __argz_next])
499
500 if test "${ac_cv_func_stpcpy+set}" != "set"; then
501 AC_CHECK_FUNCS(stpcpy)
502 fi
503 if test "${ac_cv_func_stpcpy}" = "yes"; then
504 AC_DEFINE(HAVE_STPCPY)
505 fi
506
507 AM_LC_MESSAGES
508 AM_WITH_NLS
509
510 if test "x$CATOBJEXT" != "x"; then
511 if test "x$ALL_LINGUAS" = "x"; then
512 LINGUAS=
513 else
514 AC_MSG_CHECKING(for catalogs to be installed)
515 NEW_LINGUAS=
516 for lang in ${LINGUAS=$ALL_LINGUAS}; do
517 case "$ALL_LINGUAS" in
518 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
519 esac
520 done
521 LINGUAS=$NEW_LINGUAS
522 AC_MSG_RESULT($LINGUAS)
523 fi
524
525 dnl Construct list of names of catalog files to be constructed.
526 if test -n "$LINGUAS"; then
527 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
528 fi
529 fi
530
531 dnl The reference to <locale.h> in the installed <libintl.h> file
532 dnl must be resolved because we cannot expect the users of this
533 dnl to define HAVE_LOCALE_H.
534 if test $ac_cv_header_locale_h = yes; then
535 INCLUDE_LOCALE_H="#include <locale.h>"
536 else
537 INCLUDE_LOCALE_H="\
538 /* The system does not provide the header <locale.h>. Take care yourself. */"
539 fi
540 AC_SUBST(INCLUDE_LOCALE_H)
541
542 dnl Determine which catalog format we have (if any is needed)
543 dnl For now we know about two different formats:
544 dnl Linux libc-5 and the normal X/Open format
545 test -d intl || mkdir intl
546 if test "$CATOBJEXT" = ".cat"; then
547 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
548
549 dnl Transform the SED scripts while copying because some dumb SEDs
550 dnl cannot handle comments.
551 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
552 fi
553 dnl po2tbl.sed is always needed.
554 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
555 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
556
557 dnl In the intl/Makefile.in we have a special dependency which makes
558 dnl only sense for gettext. We comment this out for non-gettext
559 dnl packages.
560 if test "$PACKAGE" = "gettext"; then
561 GT_NO="#NO#"
562 GT_YES=
563 else
564 GT_NO=
565 GT_YES="#YES#"
566 fi
567 AC_SUBST(GT_NO)
568 AC_SUBST(GT_YES)
569
570 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
571 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
572 dnl Try to locate is.
573 MKINSTALLDIRS=
574 if test -n "$ac_aux_dir"; then
575 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
576 fi
577 if test -z "$MKINSTALLDIRS"; then
578 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
579 fi
580 AC_SUBST(MKINSTALLDIRS)
581
582 dnl *** For now the libtool support in intl/Makefile is not for real.
583 l=
584 AC_SUBST(l)
585
586 dnl Generate list of files to be processed by xgettext which will
587 dnl be included in po/Makefile.
588 test -d po || mkdir po
589 if test "x$srcdir" != "x."; then
590 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
591 posrcprefix="$srcdir/"
592 else
593 posrcprefix="../$srcdir/"
594 fi
595 else
596 posrcprefix="../"
597 fi
598 rm -f po/POTFILES
599 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
600 < $srcdir/po/POTFILES.in > po/POTFILES
601 ])
602
603 # Check whether LC_MESSAGES is available in <locale.h>.
604 # Ulrich Drepper <drepper@cygnus.com>, 1995.
605 #
606 # This file can be copied and used freely without restrictions. It can
607 # be used in projects which are not available under the GNU Public License
608 # but which still want to provide support for the GNU gettext functionality.
609 # Please note that the actual code is *not* freely available.
610
611 # serial 1
612
613 AC_DEFUN(AM_LC_MESSAGES,
614 [if test $ac_cv_header_locale_h = yes; then
615 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
616 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
617 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
618 if test $am_cv_val_LC_MESSAGES = yes; then
619 AC_DEFINE(HAVE_LC_MESSAGES)
620 fi
621 fi])
622
623 # Search path for a program which passes the given test.
624 # Ulrich Drepper <drepper@cygnus.com>, 1996.
625 #
626 # This file can be copied and used freely without restrictions. It can
627 # be used in projects which are not available under the GNU Public License
628 # but which still want to provide support for the GNU gettext functionality.
629 # Please note that the actual code is *not* freely available.
630
631 # serial 1
632
633 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
634 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
635 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
636 [# Extract the first word of "$2", so it can be a program name with args.
637 set dummy $2; ac_word=[$]2
638 AC_MSG_CHECKING([for $ac_word])
639 AC_CACHE_VAL(ac_cv_path_$1,
640 [case "[$]$1" in
641 /*)
642 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
643 ;;
644 *)
645 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
646 for ac_dir in ifelse([$5], , $PATH, [$5]); do
647 test -z "$ac_dir" && ac_dir=.
648 if test -f $ac_dir/$ac_word; then
649 if [$3]; then
650 ac_cv_path_$1="$ac_dir/$ac_word"
651 break
652 fi
653 fi
654 done
655 IFS="$ac_save_ifs"
656 dnl If no 4th arg is given, leave the cache variable unset,
657 dnl so AC_PATH_PROGS will keep looking.
658 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
659 ])dnl
660 ;;
661 esac])dnl
662 $1="$ac_cv_path_$1"
663 if test -n "[$]$1"; then
664 AC_MSG_RESULT([$]$1)
665 else
666 AC_MSG_RESULT(no)
667 fi
668 AC_SUBST($1)dnl
669 ])
670
671 # Check whether mmap can map an arbitrary page from /dev/zero, without
672 # MAP_FIXED.
673 AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
674 [AC_CHECK_HEADERS(unistd.h)
675 AC_CHECK_FUNCS(getpagesize)
676 AC_CACHE_CHECK(for working mmap from /dev/zero, ac_cv_func_mmap_anywhere,
677 [AC_TRY_RUN([
678 /* Test by Richard Henderson and Alexandre Oliva.
679 Check whether mmap from /dev/zero works. */
680 #include <sys/types.h>
681 #include <fcntl.h>
682 #include <sys/mman.h>
683
684 /* This mess was copied from the GNU getpagesize.h. */
685 #ifndef HAVE_GETPAGESIZE
686 # ifdef HAVE_UNISTD_H
687 # include <unistd.h>
688 # endif
689
690 /* Assume that all systems that can run configure have sys/param.h. */
691 # ifndef HAVE_SYS_PARAM_H
692 # define HAVE_SYS_PARAM_H 1
693 # endif
694
695 # ifdef _SC_PAGESIZE
696 # define getpagesize() sysconf(_SC_PAGESIZE)
697 # else /* no _SC_PAGESIZE */
698 # ifdef HAVE_SYS_PARAM_H
699 # include <sys/param.h>
700 # ifdef EXEC_PAGESIZE
701 # define getpagesize() EXEC_PAGESIZE
702 # else /* no EXEC_PAGESIZE */
703 # ifdef NBPG
704 # define getpagesize() NBPG * CLSIZE
705 # ifndef CLSIZE
706 # define CLSIZE 1
707 # endif /* no CLSIZE */
708 # else /* no NBPG */
709 # ifdef NBPC
710 # define getpagesize() NBPC
711 # else /* no NBPC */
712 # ifdef PAGESIZE
713 # define getpagesize() PAGESIZE
714 # endif /* PAGESIZE */
715 # endif /* no NBPC */
716 # endif /* no NBPG */
717 # endif /* no EXEC_PAGESIZE */
718 # else /* no HAVE_SYS_PARAM_H */
719 # define getpagesize() 8192 /* punt totally */
720 # endif /* no HAVE_SYS_PARAM_H */
721 # endif /* no _SC_PAGESIZE */
722
723 #endif /* no HAVE_GETPAGESIZE */
724
725 int main()
726 {
727 char *x;
728 int fd, pg;
729
730 fd = open("/dev/zero", O_RDWR);
731 if (fd < 0)
732 exit(1);
733
734 pg = getpagesize();
735 x = (char*)mmap(0, pg, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
736 if (x == (char *) -1)
737 exit(2);
738
739 *(int *)x += 1;
740
741 if (munmap(x, pg) < 0)
742 exit(3);
743
744 exit(0);
745 }], ac_cv_func_mmap_anywhere=yes, ac_cv_func_mmap_anywhere=no,
746 ac_cv_func_mmap_anywhere=no)])
747 if test $ac_cv_func_mmap_anywhere = yes; then
748 AC_DEFINE(HAVE_MMAP_ANYWHERE, 1,
749 [Define if mmap can get us zeroed pages from /dev/zero.])
750 fi
751 ])
752
753 # Check whether mmap can map a plain file, without MAP_FIXED.
754 AC_DEFUN([AC_FUNC_MMAP_FILE],
755 [AC_REQUIRE([AC_FUNC_MMAP_ANYWHERE])dnl
756 AC_CACHE_CHECK(for working mmap of a file, ac_cv_func_mmap_file,
757 [# Create a file one thousand bytes long.
758 for i in 1 2 3 4 5 6 7 8 9 0
759 do for j in 1 2 3 4 5 6 7 8 9 0
760 do echo $i $j xxxxx
761 done
762 done > conftestdata$$
763
764 AC_TRY_RUN([
765 /* Test by Zack Weinberg. Modified from MMAP_ANYWHERE test by
766 Richard Henderson and Alexandre Oliva.
767 Check whether read-only mmap of a plain file works. */
768 #include <sys/types.h>
769 #include <sys/stat.h>
770 #include <fcntl.h>
771 #include <sys/mman.h>
772
773 int main()
774 {
775 char *x;
776 int fd;
777 struct stat st;
778
779 fd = open("conftestdata$$", O_RDONLY);
780 if (fd < 0)
781 exit(1);
782
783 if (fstat (fd, &st))
784 exit(2);
785
786 x = (char*)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
787 if (x == (char *) -1)
788 exit(3);
789
790 if (x[0] != '1' || x[1] != ' ' || x[2] != '1' || x[3] != ' ')
791 exit(4);
792
793 if (munmap(x, st.st_size) < 0)
794 exit(5);
795
796 exit(0);
797 }], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no,
798 ac_cv_func_mmap_file=no)])
799 if test $ac_cv_func_mmap_file = yes; then
800 AC_DEFINE(HAVE_MMAP_FILE, 1,
801 [Define if read-only mmap of a plain file works.])
802 fi
803 ])
804
805 dnl Locate a program and check that its version is acceptable.
806 dnl AC_PROG_CHECK_VER(var, name, version-switch,
807 dnl version-extract-regexp, version-glob)
808 AC_DEFUN(gcc_AC_CHECK_PROG_VER,
809 [AC_CHECK_PROG([$1], [$2], [$2])
810 if test -n "[$]$1"; then
811 # Found it, now check the version.
812 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
813 [changequote(<<,>>)dnl
814 ac_prog_version=`<<$>>$1 $3 2>&1 |
815 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
816 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
817 case $ac_prog_version in
818 '') gcc_cv_prog_$2_modern=no;;
819 <<$5>>)
820 gcc_cv_prog_$2_modern=yes;;
821 *) gcc_cv_prog_$2_modern=no;;
822 esac
823 changequote([,])dnl
824 ])
825 else
826 gcc_cv_prog_$2_modern=no
827 fi
828 ])