]>
Commit | Line | Data |
---|---|---|
259a120e | 1 | dnl See whether we can include both string.h and strings.h. |
2 | AC_DEFUN(GCC_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) | |
9 | fi | |
10 | ]) | |
11 | ||
a8e7eda3 | 12 | dnl See whether we need a declaration for a function. |
436f5383 | 13 | dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES]) |
a8e7eda3 | 14 | AC_DEFUN(GCC_NEED_DECLARATION, |
15 | [AC_MSG_CHECKING([whether $1 must be declared]) | |
16 | AC_CACHE_VAL(gcc_cv_decl_needed_$1, | |
17 | [AC_TRY_COMPILE([ | |
18 | #include <stdio.h> | |
259a120e | 19 | #ifdef STRING_WITH_STRINGS |
20 | # include <string.h> | |
21 | # include <strings.h> | |
a8e7eda3 | 22 | #else |
259a120e | 23 | # ifdef HAVE_STRING_H |
24 | # include <string.h> | |
25 | # else | |
26 | # ifdef HAVE_STRINGS_H | |
27 | # include <strings.h> | |
28 | # endif | |
29 | # endif | |
a8e7eda3 | 30 | #endif |
31 | #ifdef HAVE_STDLIB_H | |
32 | #include <stdlib.h> | |
33 | #endif | |
34 | #ifdef HAVE_UNISTD_H | |
35 | #include <unistd.h> | |
ad87de1e | 36 | #endif |
37 | #ifndef HAVE_RINDEX | |
38 | #define rindex strrchr | |
39 | #endif | |
40 | #ifndef HAVE_INDEX | |
41 | #define index strchr | |
436f5383 | 42 | #endif |
43 | $2], | |
a8e7eda3 | 44 | [char *(*pfn) = (char *(*)) $1], |
4211624c | 45 | eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")]) |
46 | if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then | |
47 | AC_MSG_RESULT(yes) | |
a8e7eda3 | 48 | gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` |
49 | AC_DEFINE_UNQUOTED($gcc_tr_decl) | |
4211624c | 50 | else |
51 | AC_MSG_RESULT(no) | |
a8e7eda3 | 52 | fi |
53 | ])dnl | |
ea4a6c81 | 54 | |
4211624c | 55 | dnl Check multiple functions to see whether each needs a declaration. |
436f5383 | 56 | dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES]) |
4211624c | 57 | AC_DEFUN(GCC_NEED_DECLARATIONS, |
58 | [for ac_func in $1 | |
59 | do | |
436f5383 | 60 | GCC_NEED_DECLARATION($ac_func, $2) |
4211624c | 61 | done |
62 | ]) | |
63 | ||
b8a373b2 | 64 | dnl Check if we have vprintf and possibly _doprnt. |
65 | dnl Note autoconf checks for vprintf even though we care about vfprintf. | |
66 | AC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT, | |
67 | [AC_FUNC_VPRINTF | |
68 | vfprintf= | |
69 | doprint= | |
70 | if test $ac_cv_func_vprintf != yes ; then | |
71 | vfprintf=vfprintf.o | |
72 | if test $ac_cv_func__doprnt != yes ; then | |
73 | doprint=doprint.o | |
74 | fi | |
75 | fi | |
76 | AC_SUBST(vfprintf) | |
77 | AC_SUBST(doprint) | |
78 | ]) | |
79 | ||
0a0a425e | 80 | dnl See if the printf functions in libc support %p in format strings. |
81 | AC_DEFUN(GCC_FUNC_PRINTF_PTR, | |
82 | [AC_CACHE_CHECK(whether the printf functions support %p, | |
83 | gcc_cv_func_printf_ptr, | |
84 | [AC_TRY_RUN([#include <stdio.h> | |
85 | ||
86 | main() | |
87 | { | |
88 | char buf[64]; | |
89 | char *p = buf, *q = NULL; | |
90 | sprintf(buf, "%p", p); | |
91 | sscanf(buf, "%p", &q); | |
92 | exit (p != q); | |
93 | }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no, | |
94 | gcc_cv_func_printf_ptr=no) | |
95 | rm -f core core.* *.core]) | |
96 | if test $gcc_cv_func_printf_ptr = yes ; then | |
1d9adefe | 97 | AC_DEFINE(HAVE_PRINTF_PTR) |
0a0a425e | 98 | fi |
99 | ]) | |
100 | ||
ea4a6c81 | 101 | dnl See if symbolic links work and if not, try to substitute either hard links or simple copy. |
102 | AC_DEFUN(GCC_PROG_LN_S, | |
103 | [AC_MSG_CHECKING(whether ln -s works) | |
104 | AC_CACHE_VAL(gcc_cv_prog_LN_S, | |
45d37aff | 105 | [rm -f conftestdata_t |
106 | echo >conftestdata_f | |
107 | if ln -s conftestdata_f conftestdata_t 2>/dev/null | |
ea4a6c81 | 108 | then |
109 | gcc_cv_prog_LN_S="ln -s" | |
110 | else | |
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 | |
117 | fi | |
45d37aff | 118 | rm -f conftestdata_f conftestdata_t |
ea4a6c81 | 119 | ])dnl |
120 | LN_S="$gcc_cv_prog_LN_S" | |
121 | if test "$gcc_cv_prog_LN_S" = "ln -s"; then | |
122 | AC_MSG_RESULT(yes) | |
123 | else | |
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 | |
129 | fi | |
130 | AC_SUBST(LN_S)dnl | |
131 | ]) | |
132 | ||
133 | dnl See if hard links work and if not, try to substitute either symbolic links or simple copy. | |
134 | AC_DEFUN(GCC_PROG_LN, | |
135 | [AC_MSG_CHECKING(whether ln works) | |
136 | AC_CACHE_VAL(gcc_cv_prog_LN, | |
45d37aff | 137 | [rm -f conftestdata_t |
138 | echo >conftestdata_f | |
139 | if ln conftestdata_f conftestdata_t 2>/dev/null | |
ea4a6c81 | 140 | then |
141 | gcc_cv_prog_LN="ln" | |
142 | else | |
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 | |
149 | fi | |
45d37aff | 150 | rm -f conftestdata_f conftestdata_t |
ea4a6c81 | 151 | ])dnl |
152 | LN="$gcc_cv_prog_LN" | |
153 | if test "$gcc_cv_prog_LN" = "ln"; then | |
154 | AC_MSG_RESULT(yes) | |
155 | else | |
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 | |
161 | fi | |
162 | AC_SUBST(LN)dnl | |
163 | ]) | |
e59dfa37 | 164 | |
8564ad21 | 165 | dnl See whether the stage1 host compiler accepts the volatile keyword. |
166 | AC_DEFUN(GCC_C_VOLATILE, | |
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)]) | |
170 | if test $gcc_cv_c_volatile = yes ; then | |
171 | AC_DEFINE(HAVE_VOLATILE) | |
172 | fi | |
173 | ]) | |
174 | ||
e59dfa37 | 175 | AC_DEFUN(EGCS_PROG_INSTALL, |
176 | [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl | |
177 | # Find a good install program. We prefer a C program (faster), | |
178 | # so one script is as good as another. But avoid the broken or | |
179 | # incompatible versions: | |
180 | # SysV /etc/install, /usr/sbin/install | |
181 | # SunOS /usr/etc/install | |
182 | # IRIX /sbin/install | |
183 | # AIX /bin/install | |
184 | # AFS /usr/afsws/bin/install, which mishandles nonexistent args | |
185 | # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" | |
186 | # ./install, which can be erroneously created by make from ./install.sh. | |
187 | AC_MSG_CHECKING(for a BSD compatible install) | |
188 | if test -z "$INSTALL"; then | |
189 | AC_CACHE_VAL(ac_cv_path_install, | |
190 | [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" | |
191 | for ac_dir in $PATH; do | |
192 | # Account for people who put trailing slashes in PATH elements. | |
193 | case "$ac_dir/" in | |
194 | /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; | |
195 | *) | |
196 | # OSF1 and SCO ODT 3.0 have their own names for install. | |
197 | for ac_prog in ginstall scoinst install; do | |
198 | if test -f $ac_dir/$ac_prog; then | |
199 | if test $ac_prog = install && | |
200 | grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then | |
201 | # AIX install. It has an incompatible calling convention. | |
202 | # OSF/1 installbsd also uses dspmsg, but is usable. | |
203 | : | |
204 | else | |
205 | ac_cv_path_install="$ac_dir/$ac_prog -c" | |
206 | break 2 | |
207 | fi | |
208 | fi | |
209 | done | |
210 | ;; | |
211 | esac | |
212 | done | |
213 | IFS="$ac_save_IFS" | |
214 | ])dnl | |
215 | if test "${ac_cv_path_install+set}" = set; then | |
216 | INSTALL="$ac_cv_path_install" | |
217 | else | |
218 | # As a last resort, use the slow shell script. We don't cache a | |
219 | # path for INSTALL within a source directory, because that will | |
220 | # break other packages using the cache if that directory is | |
221 | # removed, or if the path is relative. | |
222 | INSTALL="$ac_install_sh" | |
223 | fi | |
224 | fi | |
225 | dnl We do special magic for INSTALL instead of AC_SUBST, to get | |
226 | dnl relative paths right. | |
227 | AC_MSG_RESULT($INSTALL) | |
68a39da2 | 228 | AC_SUBST(INSTALL)dnl |
e59dfa37 | 229 | |
230 | # Use test -z because SunOS4 sh mishandles braces in ${var-val}. | |
231 | # It thinks the first close brace ends the variable substitution. | |
232 | test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' | |
233 | AC_SUBST(INSTALL_PROGRAM)dnl | |
234 | ||
235 | test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' | |
236 | AC_SUBST(INSTALL_DATA)dnl | |
237 | ]) | |
be2828ce | 238 | |
239 | #serial 1 | |
240 | dnl This test replaces the one in autoconf. | |
241 | dnl Currently this macro should have the same name as the autoconf macro | |
242 | dnl because gettext's gettext.m4 (distributed in the automake package) | |
243 | dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader | |
244 | dnl give these diagnostics: | |
245 | dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX | |
246 | dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX | |
247 | ||
248 | undefine([AC_ISC_POSIX]) | |
249 | AC_DEFUN(AC_ISC_POSIX, | |
250 | [ | |
251 | dnl This test replaces the obsolescent AC_ISC_POSIX kludge. | |
252 | AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) | |
253 | ] | |
254 | ) | |
255 | ||
256 | # Macro to add for using GNU gettext. | |
257 | # Ulrich Drepper <drepper@cygnus.com>, 1995. | |
258 | # | |
259 | # This file can be copied and used freely without restrictions. It can | |
260 | # be used in projects which are not available under the GNU Public License | |
261 | # but which still want to provide support for the GNU gettext functionality. | |
262 | # Please note that the actual code is *not* freely available. | |
263 | ||
264 | # serial 5 | |
265 | ||
266 | AC_DEFUN(AM_WITH_NLS, | |
267 | [AC_MSG_CHECKING([whether NLS is requested]) | |
268 | dnl Default is enabled NLS | |
269 | AC_ARG_ENABLE(nls, | |
270 | [ --disable-nls do not use Native Language Support], | |
271 | USE_NLS=$enableval, USE_NLS=yes) | |
272 | AC_MSG_RESULT($USE_NLS) | |
273 | AC_SUBST(USE_NLS) | |
274 | ||
275 | USE_INCLUDED_LIBINTL=no | |
276 | ||
277 | dnl If we use NLS figure out what method | |
278 | if test "$USE_NLS" = "yes"; then | |
279 | AC_DEFINE(ENABLE_NLS) | |
280 | AC_MSG_CHECKING([whether included gettext is requested]) | |
281 | AC_ARG_WITH(included-gettext, | |
282 | [ --with-included-gettext use the GNU gettext library included here], | |
283 | nls_cv_force_use_gnu_gettext=$withval, | |
284 | nls_cv_force_use_gnu_gettext=no) | |
285 | AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) | |
286 | ||
287 | nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" | |
288 | if test "$nls_cv_force_use_gnu_gettext" != "yes"; then | |
289 | dnl User does not insist on using GNU NLS library. Figure out what | |
290 | dnl to use. If gettext or catgets are available (in this order) we | |
291 | dnl use this. Else we have to fall back to GNU NLS library. | |
292 | dnl catgets is only used if permitted by option --with-catgets. | |
293 | nls_cv_header_intl= | |
294 | nls_cv_header_libgt= | |
295 | CATOBJEXT=NONE | |
296 | ||
297 | AC_CHECK_HEADER(libintl.h, | |
298 | [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, | |
299 | [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")], | |
300 | gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) | |
301 | ||
302 | if test "$gt_cv_func_gettext_libc" != "yes"; then | |
303 | AC_CHECK_LIB(intl, bindtextdomain, | |
304 | [AC_CACHE_CHECK([for gettext in libintl], | |
305 | gt_cv_func_gettext_libintl, | |
306 | [AC_CHECK_LIB(intl, gettext, | |
307 | gt_cv_func_gettext_libintl=yes, | |
308 | gt_cv_func_gettext_libintl=no)], | |
309 | gt_cv_func_gettext_libintl=no)]) | |
310 | fi | |
311 | ||
312 | if test "$gt_cv_func_gettext_libc" = "yes" \ | |
313 | || test "$gt_cv_func_gettext_libintl" = "yes"; then | |
314 | AC_DEFINE(HAVE_GETTEXT) | |
315 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | |
316 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl | |
317 | if test "$MSGFMT" != "no"; then | |
318 | AC_CHECK_FUNCS(dcgettext) | |
319 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | |
320 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | |
321 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) | |
322 | AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; | |
323 | return _nl_msg_cat_cntr], | |
324 | [CATOBJEXT=.gmo | |
325 | DATADIRNAME=share], | |
326 | [CATOBJEXT=.mo | |
327 | DATADIRNAME=lib]) | |
328 | INSTOBJEXT=.mo | |
329 | fi | |
330 | fi | |
331 | ]) | |
332 | ||
333 | if test "$CATOBJEXT" = "NONE"; then | |
334 | AC_MSG_CHECKING([whether catgets can be used]) | |
335 | AC_ARG_WITH(catgets, | |
336 | [ --with-catgets use catgets functions if available], | |
337 | nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) | |
338 | AC_MSG_RESULT($nls_cv_use_catgets) | |
339 | ||
340 | if test "$nls_cv_use_catgets" = "yes"; then | |
341 | dnl No gettext in C library. Try catgets next. | |
342 | AC_CHECK_LIB(i, main) | |
343 | AC_CHECK_FUNC(catgets, | |
344 | [AC_DEFINE(HAVE_CATGETS) | |
345 | INTLOBJS="\$(CATOBJS)" | |
346 | AC_PATH_PROG(GENCAT, gencat, no)dnl | |
347 | if test "$GENCAT" != "no"; then | |
348 | AC_PATH_PROG(GMSGFMT, gmsgfmt, no) | |
349 | if test "$GMSGFMT" = "no"; then | |
350 | AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, | |
351 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) | |
352 | fi | |
353 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | |
354 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) | |
355 | USE_INCLUDED_LIBINTL=yes | |
356 | CATOBJEXT=.cat | |
357 | INSTOBJEXT=.cat | |
358 | DATADIRNAME=lib | |
359 | INTLDEPS='$(top_builddir)/intl/libintl.a' | |
360 | INTLLIBS=$INTLDEPS | |
361 | LIBS=`echo $LIBS | sed -e 's/-lintl//'` | |
362 | nls_cv_header_intl=intl/libintl.h | |
363 | nls_cv_header_libgt=intl/libgettext.h | |
364 | fi]) | |
365 | fi | |
366 | fi | |
367 | ||
368 | if test "$CATOBJEXT" = "NONE"; then | |
369 | dnl Neither gettext nor catgets in included in the C library. | |
370 | dnl Fall back on GNU gettext library. | |
371 | nls_cv_use_gnu_gettext=yes | |
372 | fi | |
373 | fi | |
374 | ||
375 | if test "$nls_cv_use_gnu_gettext" = "yes"; then | |
376 | dnl Mark actions used to generate GNU NLS library. | |
377 | INTLOBJS="\$(GETTOBJS)" | |
378 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | |
379 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) | |
380 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | |
381 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | |
382 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) | |
383 | AC_SUBST(MSGFMT) | |
384 | USE_INCLUDED_LIBINTL=yes | |
385 | CATOBJEXT=.gmo | |
386 | INSTOBJEXT=.mo | |
387 | DATADIRNAME=share | |
388 | INTLDEPS='$(top_builddir)/intl/libintl.a' | |
389 | INTLLIBS=$INTLDEPS | |
390 | LIBS=`echo $LIBS | sed -e 's/-lintl//'` | |
391 | nls_cv_header_intl=intl/libintl.h | |
392 | nls_cv_header_libgt=intl/libgettext.h | |
393 | fi | |
394 | ||
395 | dnl Test whether we really found GNU xgettext. | |
396 | if test "$XGETTEXT" != ":"; then | |
397 | dnl If it is no GNU xgettext we define it as : so that the | |
398 | dnl Makefiles still can work. | |
399 | if $XGETTEXT --omit-header /dev/null 2> /dev/null; then | |
400 | : ; | |
401 | else | |
402 | AC_MSG_RESULT( | |
403 | [found xgettext program is not GNU xgettext; ignore it]) | |
404 | XGETTEXT=":" | |
405 | fi | |
406 | fi | |
407 | ||
408 | # We need to process the po/ directory. | |
409 | POSUB=po | |
410 | else | |
411 | DATADIRNAME=share | |
412 | nls_cv_header_intl=intl/libintl.h | |
413 | nls_cv_header_libgt=intl/libgettext.h | |
414 | fi | |
415 | AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) | |
416 | AC_OUTPUT_COMMANDS( | |
417 | [case "$CONFIG_FILES" in *po/Makefile.in*) | |
418 | sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile | |
419 | esac]) | |
420 | ||
421 | ||
422 | # If this is used in GNU gettext we have to set USE_NLS to `yes' | |
423 | # because some of the sources are only built for this goal. | |
424 | if test "$PACKAGE" = gettext; then | |
425 | USE_NLS=yes | |
426 | USE_INCLUDED_LIBINTL=yes | |
427 | fi | |
428 | ||
429 | dnl These rules are solely for the distribution goal. While doing this | |
430 | dnl we only have to keep exactly one list of the available catalogs | |
431 | dnl in configure.in. | |
432 | for lang in $ALL_LINGUAS; do | |
433 | GMOFILES="$GMOFILES $lang.gmo" | |
434 | POFILES="$POFILES $lang.po" | |
435 | done | |
436 | ||
437 | dnl Make all variables we use known to autoconf. | |
438 | AC_SUBST(USE_INCLUDED_LIBINTL) | |
439 | AC_SUBST(CATALOGS) | |
440 | AC_SUBST(CATOBJEXT) | |
441 | AC_SUBST(DATADIRNAME) | |
442 | AC_SUBST(GMOFILES) | |
443 | AC_SUBST(INSTOBJEXT) | |
444 | AC_SUBST(INTLDEPS) | |
445 | AC_SUBST(INTLLIBS) | |
446 | AC_SUBST(INTLOBJS) | |
447 | AC_SUBST(POFILES) | |
448 | AC_SUBST(POSUB) | |
449 | ]) | |
450 | ||
451 | AC_DEFUN(AM_GNU_GETTEXT, | |
452 | [AC_REQUIRE([AC_PROG_MAKE_SET])dnl | |
453 | AC_REQUIRE([AC_PROG_CC])dnl | |
454 | AC_REQUIRE([AC_PROG_RANLIB])dnl | |
455 | AC_REQUIRE([AC_ISC_POSIX])dnl | |
456 | AC_REQUIRE([AC_HEADER_STDC])dnl | |
457 | AC_REQUIRE([AC_C_CONST])dnl | |
458 | AC_REQUIRE([AC_C_INLINE])dnl | |
459 | AC_REQUIRE([AC_TYPE_OFF_T])dnl | |
460 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | |
461 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | |
462 | AC_REQUIRE([AC_FUNC_MMAP])dnl | |
463 | ||
464 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ | |
465 | unistd.h sys/param.h]) | |
466 | AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ | |
467 | strdup __argz_count __argz_stringify __argz_next]) | |
468 | ||
469 | if test "${ac_cv_func_stpcpy+set}" != "set"; then | |
470 | AC_CHECK_FUNCS(stpcpy) | |
471 | fi | |
472 | if test "${ac_cv_func_stpcpy}" = "yes"; then | |
473 | AC_DEFINE(HAVE_STPCPY) | |
474 | fi | |
475 | ||
476 | AM_LC_MESSAGES | |
477 | AM_WITH_NLS | |
478 | ||
479 | if test "x$CATOBJEXT" != "x"; then | |
480 | if test "x$ALL_LINGUAS" = "x"; then | |
481 | LINGUAS= | |
482 | else | |
483 | AC_MSG_CHECKING(for catalogs to be installed) | |
484 | NEW_LINGUAS= | |
485 | for lang in ${LINGUAS=$ALL_LINGUAS}; do | |
486 | case "$ALL_LINGUAS" in | |
487 | *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; | |
488 | esac | |
489 | done | |
490 | LINGUAS=$NEW_LINGUAS | |
491 | AC_MSG_RESULT($LINGUAS) | |
492 | fi | |
493 | ||
494 | dnl Construct list of names of catalog files to be constructed. | |
495 | if test -n "$LINGUAS"; then | |
496 | for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done | |
497 | fi | |
498 | fi | |
499 | ||
500 | dnl The reference to <locale.h> in the installed <libintl.h> file | |
501 | dnl must be resolved because we cannot expect the users of this | |
502 | dnl to define HAVE_LOCALE_H. | |
503 | if test $ac_cv_header_locale_h = yes; then | |
504 | INCLUDE_LOCALE_H="#include <locale.h>" | |
505 | else | |
506 | INCLUDE_LOCALE_H="\ | |
507 | /* The system does not provide the header <locale.h>. Take care yourself. */" | |
508 | fi | |
509 | AC_SUBST(INCLUDE_LOCALE_H) | |
510 | ||
511 | dnl Determine which catalog format we have (if any is needed) | |
512 | dnl For now we know about two different formats: | |
513 | dnl Linux libc-5 and the normal X/Open format | |
514 | test -d intl || mkdir intl | |
515 | if test "$CATOBJEXT" = ".cat"; then | |
516 | AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) | |
517 | ||
518 | dnl Transform the SED scripts while copying because some dumb SEDs | |
519 | dnl cannot handle comments. | |
520 | sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed | |
521 | fi | |
522 | dnl po2tbl.sed is always needed. | |
523 | sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ | |
524 | $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed | |
525 | ||
526 | dnl In the intl/Makefile.in we have a special dependency which makes | |
527 | dnl only sense for gettext. We comment this out for non-gettext | |
528 | dnl packages. | |
529 | if test "$PACKAGE" = "gettext"; then | |
530 | GT_NO="#NO#" | |
531 | GT_YES= | |
532 | else | |
533 | GT_NO= | |
534 | GT_YES="#YES#" | |
535 | fi | |
536 | AC_SUBST(GT_NO) | |
537 | AC_SUBST(GT_YES) | |
538 | ||
539 | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly | |
540 | dnl find the mkinstalldirs script in another subdir but ($top_srcdir). | |
541 | dnl Try to locate is. | |
542 | MKINSTALLDIRS= | |
543 | if test -n "$ac_aux_dir"; then | |
544 | MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" | |
545 | fi | |
546 | if test -z "$MKINSTALLDIRS"; then | |
547 | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" | |
548 | fi | |
549 | AC_SUBST(MKINSTALLDIRS) | |
550 | ||
551 | dnl *** For now the libtool support in intl/Makefile is not for real. | |
552 | l= | |
553 | AC_SUBST(l) | |
554 | ||
555 | dnl Generate list of files to be processed by xgettext which will | |
556 | dnl be included in po/Makefile. | |
557 | test -d po || mkdir po | |
558 | if test "x$srcdir" != "x."; then | |
559 | if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then | |
560 | posrcprefix="$srcdir/" | |
561 | else | |
562 | posrcprefix="../$srcdir/" | |
563 | fi | |
564 | else | |
565 | posrcprefix="../" | |
566 | fi | |
567 | rm -f po/POTFILES | |
568 | sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ | |
569 | < $srcdir/po/POTFILES.in > po/POTFILES | |
570 | ]) | |
571 | ||
572 | # Check whether LC_MESSAGES is available in <locale.h>. | |
573 | # Ulrich Drepper <drepper@cygnus.com>, 1995. | |
574 | # | |
575 | # This file can be copied and used freely without restrictions. It can | |
576 | # be used in projects which are not available under the GNU Public License | |
577 | # but which still want to provide support for the GNU gettext functionality. | |
578 | # Please note that the actual code is *not* freely available. | |
579 | ||
580 | # serial 1 | |
581 | ||
582 | AC_DEFUN(AM_LC_MESSAGES, | |
583 | [if test $ac_cv_header_locale_h = yes; then | |
584 | AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, | |
585 | [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], | |
586 | am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) | |
587 | if test $am_cv_val_LC_MESSAGES = yes; then | |
588 | AC_DEFINE(HAVE_LC_MESSAGES) | |
589 | fi | |
590 | fi]) | |
591 | ||
592 | # Search path for a program which passes the given test. | |
593 | # Ulrich Drepper <drepper@cygnus.com>, 1996. | |
594 | # | |
595 | # This file can be copied and used freely without restrictions. It can | |
596 | # be used in projects which are not available under the GNU Public License | |
597 | # but which still want to provide support for the GNU gettext functionality. | |
598 | # Please note that the actual code is *not* freely available. | |
599 | ||
600 | # serial 1 | |
601 | ||
602 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, | |
603 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) | |
604 | AC_DEFUN(AM_PATH_PROG_WITH_TEST, | |
605 | [# Extract the first word of "$2", so it can be a program name with args. | |
606 | set dummy $2; ac_word=[$]2 | |
607 | AC_MSG_CHECKING([for $ac_word]) | |
608 | AC_CACHE_VAL(ac_cv_path_$1, | |
609 | [case "[$]$1" in | |
610 | /*) | |
611 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. | |
612 | ;; | |
613 | *) | |
614 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
615 | for ac_dir in ifelse([$5], , $PATH, [$5]); do | |
616 | test -z "$ac_dir" && ac_dir=. | |
617 | if test -f $ac_dir/$ac_word; then | |
618 | if [$3]; then | |
619 | ac_cv_path_$1="$ac_dir/$ac_word" | |
620 | break | |
621 | fi | |
622 | fi | |
623 | done | |
624 | IFS="$ac_save_ifs" | |
625 | dnl If no 4th arg is given, leave the cache variable unset, | |
626 | dnl so AC_PATH_PROGS will keep looking. | |
627 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" | |
628 | ])dnl | |
629 | ;; | |
630 | esac])dnl | |
631 | $1="$ac_cv_path_$1" | |
632 | if test -n "[$]$1"; then | |
633 | AC_MSG_RESULT([$]$1) | |
634 | else | |
635 | AC_MSG_RESULT(no) | |
636 | fi | |
637 | AC_SUBST($1)dnl | |
638 | ]) |