OSDN Git Service

Fix matmul PR18857 and supply testcase
[pf3gnuchains/gcc-fork.git] / libcpp / aclocal.m4
1 # generated automatically by aclocal 1.7.9 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 # Autoconf include file defining macros related to compile-time warnings.
15
16 # Copyright 2004, 2005 Free Software Foundation, Inc.
17
18 #This file is part of GCC.
19
20 #GCC is free software; you can redistribute it and/or modify it under
21 #the terms of the GNU General Public License as published by the Free
22 #Software Foundation; either version 2, or (at your option) any later
23 #version.
24
25 #GCC is distributed in the hope that it will be useful, but WITHOUT
26 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
27 #FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
28 #for more details.
29
30 #You should have received a copy of the GNU General Public License
31 #along with GCC; see the file COPYING.  If not, write to the Free
32 #Software Foundation, 59 Temple Place - Suite 330, Boston, MA
33 #02111-1307, USA.
34
35 # ACX_PROG_CC_WARNING_OPTS([-Wfoo -Wbar -Wbaz])
36 #   Sets @WARN_CFLAGS@ to the subset of the given options which the
37 #   compiler accepts.
38 AC_DEFUN([ACX_PROG_CC_WARNING_OPTS],
39 [AC_REQUIRE([AC_PROG_CC])dnl
40 AC_SUBST([WARN_CFLAGS])dnl
41 WARN_CFLAGS=
42 save_CFLAGS="$CFLAGS"
43 for option in $1; do
44   AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
45   AC_CACHE_CHECK([whether $CC supports $option], acx_Woption,
46     [CFLAGS="$option"
47     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
48       [AS_VAR_SET(acx_Woption, yes)],
49       [AS_VAR_SET(acx_Woption, no)])
50   ])
51   AS_IF([test AS_VAR_GET(acx_Woption) = yes],
52         [WARN_CFLAGS="$WARN_CFLAGS${WARN_CFLAGS:+ }$option"])
53   AS_VAR_POPDEF([acx_Woption])dnl
54 done
55 CFLAGS="$save_CFLAGS"
56 ])# ACX_PROG_CC_WARNING_OPTS
57
58 # ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long ...])
59 #   Sets WARN_PEDANTIC to "-pedantic" + the argument, if the compiler is GCC
60 #   and accepts all of those options simultaneously, otherwise to nothing.
61 AC_DEFUN([ACX_PROG_CC_WARNING_ALMOST_PEDANTIC],
62 [AC_REQUIRE([AC_PROG_CC])dnl
63 AC_SUBST([WARN_PEDANTIC])dnl
64 AS_VAR_PUSHDEF([acx_Pedantic], [acx_cv_prog_cc_pedantic_$1])dnl
65 WARN_PEDANTIC=
66 AS_IF([test $GCC = yes],
67 [AC_CACHE_CHECK([whether $CC supports -pedantic $1], acx_Pedantic,
68 [save_CFLAGS="$CFLAGS"
69 CFLAGS="-pedantic $1"
70 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
71    [AS_VAR_SET(acx_Pedantic, yes)],
72    [AS_VAR_SET(acx_Pedantic, no)])
73 CFLAGS="$save_CFLAGS"])
74 AS_IF([test AS_VAR_GET(acx_Pedantic) = yes],
75       [WARN_PEDANTIC="-pedantic $1"])
76 ])
77 AS_VAR_POPDEF([acx_Pedantic])dnl
78 ])# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC
79
80 # ACX_PROG_CC_WARNINGS_ARE_ERRORS([x.y.z])
81 #   sets WERROR to "-Werror" if the compiler is GCC >=x.y.z, or if
82 #   --enable-werror-always was given on the command line, otherwise
83 #   to nothing.
84 #   If the argument is the word "manual" instead of a version number,
85 #   then WERROR will be set to -Werror only if --enable-werror-always
86 #   appeared on the configure command line.
87 AC_DEFUN([ACX_PROG_CC_WARNINGS_ARE_ERRORS],
88 [AC_REQUIRE([AC_PROG_CC])dnl
89 AC_SUBST([WERROR])dnl
90 WERROR=
91 AC_ARG_ENABLE(werror-always, 
92     AS_HELP_STRING([--enable-werror-always],
93                    [enable -Werror despite compiler version]),
94 [], [enable_werror_always=no])
95 AS_IF([test $enable_werror_always = yes],
96       [WERROR=-Werror],
97  m4_if($1, [manual],,
98  [AS_VAR_PUSHDEF([acx_GCCvers], [acx_cv_prog_cc_gcc_$1_or_newer])dnl
99   AC_CACHE_CHECK([whether $CC is GCC >=$1], acx_GCCvers,
100     [set fnord `echo $1 | tr '.' ' '`
101      shift
102      AC_PREPROC_IFELSE(
103 [#if __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ \
104   < [$]1 * 10000 + [$]2 * 100 + [$]3
105 #error insufficient
106 #endif],
107    [AS_VAR_SET(acx_GCCvers, yes)],
108    [AS_VAR_SET(acx_GCCvers, no)])])
109  AS_IF([test AS_VAR_GET(acx_GCCvers) = yes],
110        [WERROR=-WerrorB])
111   AS_VAR_POPDEF([acx_GCCvers])]))
112 ])# ACX_PROG_CC_WARNINGS_ARE_ERRORS
113
114 # Autoconf M4 include file defining utility macros for complex Canadian
115 # cross builds.
116
117 dnl ####
118 dnl # _GCC_TOPLEV_NONCANONICAL_BUILD
119 dnl # $build_alias or canonical $build if blank.
120 dnl # Used when we would use $build_alias, but empty is not OK.
121 AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_BUILD],
122 [AC_REQUIRE([AC_CANONICAL_BUILD]) []dnl
123 case ${build_alias} in
124   "") build_noncanonical=${build} ;;
125   *) build_noncanonical=${build_alias} ;;
126 esac
127 ]) []dnl # _GCC_TOPLEV_NONCANONICAL_BUILD
128
129 dnl ####
130 dnl # _GCC_TOPLEV_NONCANONICAL_HOST
131 dnl # $host_alias, or $build_noncanonical if blank.
132 dnl # Used when we would use $host_alias, but empty is not OK.
133 AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_HOST],
134 [AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
135 case ${host_alias} in
136   "") host_noncanonical=${build_noncanonical} ;;
137   *) host_noncanonical=${host_alias} ;;
138 esac
139 ]) []dnl # _GCC_TOPLEV_NONCANONICAL_HOST
140
141 dnl ####
142 dnl # _GCC_TOPLEV_NONCANONICAL_TARGET
143 dnl # $target_alias or $host_noncanonical if blank.
144 dnl # Used when we would use $target_alias, but empty is not OK.
145 AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_TARGET],
146 [AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl
147 case ${target_alias} in
148   "") target_noncanonical=${host_noncanonical} ;;
149   *) target_noncanonical=${target_alias} ;;
150 esac
151 ]) []dnl # _GCC_TOPLEV_NONCANONICAL_TARGET
152
153 dnl ####
154 dnl # ACX_NONCANONICAL_BUILD
155 dnl # Like underscored version, but AC_SUBST's.
156 AC_DEFUN([ACX_NONCANONICAL_BUILD],
157 [AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
158 AC_SUBST(build_noncanonical)
159 ]) []dnl # ACX_NONCANONICAL_BUILD
160
161 dnl ####
162 dnl # ACX_NONCANONICAL_HOST
163 dnl # Like underscored version, but AC_SUBST's.
164 AC_DEFUN([ACX_NONCANONICAL_HOST],
165 [AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl
166 AC_SUBST(host_noncanonical)
167 ]) []dnl # ACX_NONCANONICAL_HOST
168
169 dnl ####
170 dnl # ACX_NONCANONICAL_TARGET
171 dnl # Like underscored version, but AC_SUBST's.
172 AC_DEFUN([ACX_NONCANONICAL_TARGET],
173 [AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl
174 AC_SUBST(target_noncanonical)
175 ]) []dnl # ACX_NONCANONICAL_TARGET
176
177 dnl ####
178 dnl # GCC_TOPLEV_SUBDIRS
179 dnl # GCC & friends build 'build', 'host', and 'target' tools.  These must
180 dnl # be separated into three well-known subdirectories of the build directory:
181 dnl # build_subdir, host_subdir, and target_subdir.  The values are determined
182 dnl # here so that they can (theoretically) be changed in the future.  They
183 dnl # were previously reproduced across many different files.
184 dnl #
185 dnl # This logic really amounts to very little with autoconf 2.13; it will
186 dnl # amount to a lot more with autoconf 2.5x.
187 AC_DEFUN([GCC_TOPLEV_SUBDIRS],
188 [AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl
189 AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
190 # Prefix 'build-' so this never conflicts with target_subdir.
191 build_subdir="build-${build_noncanonical}"
192 # --srcdir=. covers the toplevel, while "test -d" covers the subdirectories
193 if ( test $srcdir = . && test -d gcc ) \
194    || test -d $srcdir/../host-${host_noncanonical}; then
195   host_subdir="host-${host_noncanonical}"
196 else
197   host_subdir=.
198 fi
199 # No prefix.
200 target_subdir=${target_noncanonical}
201 AC_SUBST([build_subdir]) []dnl
202 AC_SUBST([host_subdir]) []dnl
203 AC_SUBST([target_subdir]) []dnl
204 ]) []dnl # GCC_TOPLEV_SUBDIRS
205
206
207 # _NCN_TOOL_PREFIXES:  Some stuff that oughtta be done in AC_CANONICAL_SYSTEM 
208 # or AC_INIT.
209 # These demand that AC_CANONICAL_SYSTEM be called beforehand.
210 AC_DEFUN([_NCN_TOOL_PREFIXES],
211 [ncn_tool_prefix=
212 test -n "$host_alias" && ncn_tool_prefix=$host_alias-
213 ncn_target_tool_prefix=
214 test -n "$target_alias" && ncn_target_tool_prefix=$target_alias-
215 ]) []dnl # _NCN_TOOL_PREFIXES
216
217 # NCN_CHECK_TARGET_TOOL(variable, prog-to-check-for,[value-if-not-found],[path])
218 # Like AC_CHECK_TOOL, but tries a prefix of the target, not the host.
219 # Code is pretty much lifted from autoconf2.53.
220
221 AC_DEFUN([NCN_CHECK_TARGET_TOOL],
222 [AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
223 if test -n "$ncn_target_tool_prefix"; then
224   AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}$2], 
225                 [${ncn_target_tool_prefix}$2], , [$4])
226 fi
227 if test -z "$ac_cv_prog_$1" ; then
228   ncn_cv_$1=$$1
229   AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [$3], [$4])
230   $1=$ncn_cv_$1
231 else
232   $1="$ac_cv_prog_$1"
233 fi
234 ]) []dnl # NCN_CHECK_TARGET_TOOL
235
236
237 # NCN_STRICT_CHECK_TOOL(variable, prog-to-check-for,[value-if-not-found],[path])
238 # Like AC_CHECK_TOOL, but requires the prefix if build!=host.
239
240 AC_DEFUN([NCN_STRICT_CHECK_TOOL],
241 [AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
242 if test -n "$ncn_tool_prefix"; then
243   AC_CHECK_PROG([$1], [${ncn_tool_prefix}$2], 
244                 [${ncn_tool_prefix}$2], , [$4])
245 fi
246 if test -z "$ac_cv_prog_$1" ; then
247   if test $build = $host ; then
248     ncn_cv_$1=$$1
249     AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [ifelse([$3],[],[$2],[$3])], [$4]) 
250     $1=$ncn_cv_$1
251   else
252     $1="ifelse([$3],[],[${ncn_tool_prefix}$2],[$3])"
253   fi
254 else
255   $1="$ac_cv_prog_$1"
256 fi
257 ]) []dnl # NCN_STRICT_CHECK_TOOL
258
259
260 # NCN_STRICT_CHECK_TARGET_TOOL(variable, prog-to-check-for,[value-if-not-found],[path])
261 # Like NCN_CHECK_TARGET_TOOL, but requires the prefix if build!=target.
262
263 AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOL],
264 [AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
265 if test -n "$ncn_target_tool_prefix"; then
266   AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}$2], 
267                 [${ncn_target_tool_prefix}$2], , [$4])
268 fi
269 if test -z "$ac_cv_prog_$1" ; then
270   if test $build = $target ; then
271     ncn_cv_$1=$$1
272     AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [ifelse([$3],[],[$2],[$3])], [$4]) 
273     $1=$ncn_cv_$1
274   else
275     $1="ifelse([$3],[],[${ncn_target_tool_prefix}$2],[$3])"
276   fi
277 else
278   $1="$ac_cv_prog_$1"
279 fi
280 ]) []dnl # NCN_STRICT_CHECK_TARGET_TOOL
281
282 # AC_PROG_CPP_WERROR
283 # Used for autoconf 2.5x to force AC_PREPROC_IFELSE to reject code which
284 # triggers warnings from the preprocessor.  Will be in autoconf 2.58.
285 # For now, using this also overrides header checks to use only the
286 # preprocessor (matches 2.13 behavior; matching 2.58's behavior is a
287 # bit harder from here).
288 # Eventually autoconf will default to checking headers with the compiler
289 # instead, and we'll have to do this differently.
290
291 AC_DEFUN([AC_PROG_CPP_WERROR],
292 [AC_REQUIRE([AC_PROG_CPP])dnl
293 m4_define([AC_CHECK_HEADER],m4_defn([_AC_CHECK_HEADER_OLD]))
294 ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR
295
296 # Test for GNAT.
297 # We require the gnatbind program, and a compiler driver that
298 # understands Ada.  We use the user's CC setting, already found.
299 #
300 # Sets the shell variable have_gnat to yes or no as appropriate, and
301 # substitutes GNATBIND.
302 AC_DEFUN([ACX_PROG_GNAT],
303 [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
304 AC_REQUIRE([AC_PROG_CC])
305 AC_CHECK_TOOL(GNATBIND, gnatbind, no)
306 AC_CACHE_CHECK([whether compiler driver understands Ada],
307                  acx_cv_cc_gcc_supports_ada,
308 [cat >conftest.adb <<EOF
309 procedure conftest is begin null; end conftest;
310 EOF
311 acx_cv_cc_gcc_supports_ada=no
312 # There is a bug in old released versions of GCC which causes the
313 # driver to exit successfully when the appropriate language module
314 # has not been installed.  This is fixed in 2.95.4, 3.0.2, and 3.1.
315 # Therefore we must check for the error message as well as an
316 # unsuccessful exit.
317 # Other compilers, like HP Tru64 UNIX cc, exit successfully when
318 # given a .adb file, but produce no object file.  So we must check
319 # if an object file was really produced to guard against this.
320 errors=`(${CC} -c conftest.adb) 2>&1 || echo failure`
321 if test x"$errors" = x && test -f conftest.$ac_objext; then
322   acx_cv_cc_gcc_supports_ada=yes
323 fi
324 rm -f conftest.*])
325
326 if test x$GNATBIND != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then
327   have_gnat=yes
328 else
329   have_gnat=no
330 fi
331 ])
332
333 dnl 'make compare' can be significantly faster, if cmp itself can
334 dnl skip bytes instead of using tail.  The test being performed is
335 dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
336 dnl but we need to sink errors and handle broken shells.  We also test
337 dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
338 dnl accepted by cmp on some systems.
339 AC_DEFUN([ACX_PROG_CMP_IGNORE_INITIAL],
340 [AC_CACHE_CHECK([how to compare bootstrapped objects], gcc_cv_prog_cmp_skip,
341 [ echo abfoo >t1
342   echo cdfoo >t2
343   gcc_cv_prog_cmp_skip='tail +16c $$f1 > tmp-foo1; tail +16c $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2'
344   if cmp t1 t2 2 2 > /dev/null 2>&1; then
345     if cmp t1 t2 1 1 > /dev/null 2>&1; then
346       :
347     else
348       gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16'
349     fi
350   fi
351   if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
352     if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
353       :
354     else
355       gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2'
356     fi
357   fi
358   rm t1 t2
359 ])
360 do_compare="$gcc_cv_prog_cmp_skip"
361 AC_SUBST(do_compare)
362 ])
363
364 dnl See whether we can include both string.h and strings.h.
365 AC_DEFUN([ACX_HEADER_STRING],
366 [AC_CACHE_CHECK([whether string.h and strings.h may both be included],
367   gcc_cv_header_string,
368 [AC_TRY_COMPILE([#include <string.h>
369 #include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
370 if test $gcc_cv_header_string = yes; then
371   AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
372 fi
373 ])
374
375 dnl See if stdbool.h properly defines bool and true/false.
376 dnl Check whether _Bool is built-in.
377 AC_DEFUN([ACX_HEADER_STDBOOL],
378 [AC_CACHE_CHECK([for working stdbool.h],
379   ac_cv_header_stdbool_h,
380 [AC_TRY_COMPILE([#include <stdbool.h>],
381 [bool foo = false;],
382 ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
383 if test $ac_cv_header_stdbool_h = yes; then
384   AC_DEFINE(HAVE_STDBOOL_H, 1,
385   [Define if you have a working <stdbool.h> header file.])
386 fi
387 AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
388 [AC_TRY_COMPILE(,
389 [_Bool foo;],
390 gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
391 ])
392 if test $gcc_cv_c__bool = yes; then
393   AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
394 fi
395 ])
396
397 dnl See if hard links work and if not, try to substitute $1 or simple copy.
398 AC_DEFUN([ACX_PROG_LN],
399 [AC_MSG_CHECKING(whether ln works)
400 AC_CACHE_VAL(acx_cv_prog_LN,
401 [rm -f conftestdata_t
402 echo >conftestdata_f
403 if ln conftestdata_f conftestdata_t 2>/dev/null
404 then
405   acx_cv_prog_LN=ln
406 else
407   acx_cv_prog_LN=no
408 fi
409 rm -f conftestdata_f conftestdata_t
410 ])dnl
411 if test $acx_cv_prog_LN = no; then
412   LN="ifelse([$1],,cp,[$1])"
413   AC_MSG_RESULT([no, using $LN])
414 else
415   LN="$acx_cv_prog_LN"
416   AC_MSG_RESULT(yes)
417 fi
418 AC_SUBST(LN)dnl
419 ])
420
421
422 # codeset.m4 serial AM1 (gettext-0.10.40)
423 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
424 dnl This file is free software, distributed under the terms of the GNU
425 dnl General Public License.  As a special exception to the GNU General
426 dnl Public License, this file may be distributed as part of a program
427 dnl that contains a configuration script generated by Autoconf, under
428 dnl the same distribution terms as the rest of that program.
429
430 dnl From Bruno Haible.
431
432 AC_DEFUN([AM_LANGINFO_CODESET],
433 [
434   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
435     [AC_TRY_LINK([#include <langinfo.h>],
436       [char* cs = nl_langinfo(CODESET);],
437       am_cv_langinfo_codeset=yes,
438       am_cv_langinfo_codeset=no)
439     ])
440   if test $am_cv_langinfo_codeset = yes; then
441     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
442       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
443   fi
444 ])
445
446 # intl sister-directory configuration rules.
447 #
448
449 # The idea behind this macro is that there's no need to repeat all the
450 # autoconf probes done by the intl directory - it's already done them
451 # for us.  In fact, there's no need even to look at the cache for the
452 # answers.  All we need to do is nab a few pieces of information.
453 # The intl directory is set up to make this easy, by generating a
454 # small file which can be sourced as a shell script; then we produce
455 # the necessary substitutions and definitions for this directory.
456
457 AC_DEFUN([ZW_GNU_GETTEXT_SISTER_DIR],
458 [# If we haven't got the data from the intl directory,
459 # assume NLS is disabled.
460 USE_NLS=no      AC_SUBST(USE_NLS)
461 LIBINTL=        AC_SUBST(LIBINTL)
462 LIBINTL_DEP=    AC_SUBST(LIBINTL_DEP)
463 INCINTL=        AC_SUBST(INCINTL)
464 XGETTEXT=       AC_SUBST(XGETTEXT)
465 GMSGFMT=        AC_SUBST(GMSGFMT)
466 POSUB=          AC_SUBST(POSUB)
467 if test -f ../intl/config.intl; then
468   . ../intl/config.intl
469 fi
470 AC_MSG_CHECKING([whether NLS is requested])
471 if test x"$USE_NLS" != xyes; then
472   AC_MSG_RESULT(no)
473 else
474   AC_MSG_RESULT(yes)
475   AC_DEFINE(ENABLE_NLS, 1, 
476  [Define to 1 if translation of program messages to the 
477   user's native language is requested.])
478
479   AC_MSG_CHECKING(for catalogs to be installed)
480   # Look for .po and .gmo files in the source directory.
481   CATALOGS=  AC_SUBST(CATALOGS)
482   XLINGUAS=
483   for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do
484     # If there aren't any .gmo files the shell will give us the
485     # literal string "../path/to/srcdir/po/*.gmo" which has to be
486     # weeded out.
487     case "$cat" in *\**)
488       continue;;
489     esac
490     # The quadruple backslash is collapsed to a double backslash
491     # by the backticks, then collapsed again by the double quotes,
492     # leaving us with one backslash in the sed expression (right
493     # before the dot that mustn't act as a wildcard).
494     cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!.gmo!"`
495     lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\.gmo!!"`
496     # The user is allowed to set LINGUAS to a list of languages to
497     # install catalogs for.  If it's empty that means "all of them."
498     if test "x$LINGUAS" = x; then
499       CATALOGS="$CATALOGS $cat"
500       XLINGUAS="$XLINGUAS $lang"
501     else
502       case "$LINGUAS" in *$lang*)
503         CATALOGS="$CATALOGS $cat"
504         XLINGUAS="$XLINGUAS $lang"
505         ;;
506       esac
507     fi
508   done
509   LINGUAS="$XLINGUAS"
510   AC_MSG_RESULT($LINGUAS)
511 fi])
512
513 # iconv.m4 serial AM4 (gettext-0.11.3)
514 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
515 dnl This file is free software, distributed under the terms of the GNU
516 dnl General Public License.  As a special exception to the GNU General
517 dnl Public License, this file may be distributed as part of a program
518 dnl that contains a configuration script generated by Autoconf, under
519 dnl the same distribution terms as the rest of that program.
520
521 dnl From Bruno Haible.
522
523 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
524 [
525   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
526   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
527   AC_REQUIRE([AC_LIB_RPATH])
528
529   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
530   dnl accordingly.
531   AC_LIB_LINKFLAGS_BODY([iconv])
532 ])
533
534 AC_DEFUN([AM_ICONV_LINK],
535 [
536   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
537   dnl those with the standalone portable GNU libiconv installed).
538
539   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
540   dnl accordingly.
541   AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
542
543   dnl Add $INCICONV to CPPFLAGS before performing the following checks,
544   dnl because if the user has installed libiconv and not disabled its use
545   dnl via --without-libiconv-prefix, he wants to use it. The first
546   dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
547   am_save_CPPFLAGS="$CPPFLAGS"
548   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
549
550   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
551     am_cv_func_iconv="no, consider installing GNU libiconv"
552     am_cv_lib_iconv=no
553     AC_TRY_LINK([#include <stdlib.h>
554 #include <iconv.h>],
555       [iconv_t cd = iconv_open("","");
556        iconv(cd,NULL,NULL,NULL,NULL);
557        iconv_close(cd);],
558       am_cv_func_iconv=yes)
559     if test "$am_cv_func_iconv" != yes; then
560       am_save_LIBS="$LIBS"
561       LIBS="$LIBS $LIBICONV"
562       AC_TRY_LINK([#include <stdlib.h>
563 #include <iconv.h>],
564         [iconv_t cd = iconv_open("","");
565          iconv(cd,NULL,NULL,NULL,NULL);
566          iconv_close(cd);],
567         am_cv_lib_iconv=yes
568         am_cv_func_iconv=yes)
569       LIBS="$am_save_LIBS"
570     fi
571   ])
572   if test "$am_cv_func_iconv" = yes; then
573     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
574   fi
575   if test "$am_cv_lib_iconv" = yes; then
576     AC_MSG_CHECKING([how to link with libiconv])
577     AC_MSG_RESULT([$LIBICONV])
578   else
579     dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
580     dnl either.
581     CPPFLAGS="$am_save_CPPFLAGS"
582     LIBICONV=
583     LTLIBICONV=
584   fi
585   AC_SUBST(LIBICONV)
586   AC_SUBST(LTLIBICONV)
587 ])
588
589 AC_DEFUN([AM_ICONV],
590 [
591   AM_ICONV_LINK
592   if test "$am_cv_func_iconv" = yes; then
593     AC_MSG_CHECKING([for iconv declaration])
594     AC_CACHE_VAL(am_cv_proto_iconv, [
595       AC_TRY_COMPILE([
596 #include <stdlib.h>
597 #include <iconv.h>
598 extern
599 #ifdef __cplusplus
600 "C"
601 #endif
602 #if defined(__STDC__) || defined(__cplusplus)
603 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
604 #else
605 size_t iconv();
606 #endif
607 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
608       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);"])
609     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
610     AC_MSG_RESULT([$]{ac_t:-
611          }[$]am_cv_proto_iconv)
612     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
613       [Define as const if the declaration of iconv() needs const.])
614   fi
615 ])
616
617 # lib-prefix.m4 serial 2 (gettext-0.12)
618 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
619 dnl This file is free software, distributed under the terms of the GNU
620 dnl General Public License.  As a special exception to the GNU General
621 dnl Public License, this file may be distributed as part of a program
622 dnl that contains a configuration script generated by Autoconf, under
623 dnl the same distribution terms as the rest of that program.
624
625 dnl From Bruno Haible.
626
627 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
628 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
629 dnl require excessive bracketing.
630 ifdef([AC_HELP_STRING],
631 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
632 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
633
634 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
635 dnl to access previously installed libraries. The basic assumption is that
636 dnl a user will want packages to use other packages he previously installed
637 dnl with the same --prefix option.
638 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
639 dnl libraries, but is otherwise very convenient.
640 AC_DEFUN([AC_LIB_PREFIX],
641 [
642   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
643   AC_REQUIRE([AC_PROG_CC])
644   AC_REQUIRE([AC_CANONICAL_HOST])
645   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
646   dnl By default, look in $includedir and $libdir.
647   use_additional=yes
648   AC_LIB_WITH_FINAL_PREFIX([
649     eval additional_includedir=\"$includedir\"
650     eval additional_libdir=\"$libdir\"
651   ])
652   AC_LIB_ARG_WITH([lib-prefix],
653 [  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
654   --without-lib-prefix    don't search for libraries in includedir and libdir],
655 [
656     if test "X$withval" = "Xno"; then
657       use_additional=no
658     else
659       if test "X$withval" = "X"; then
660         AC_LIB_WITH_FINAL_PREFIX([
661           eval additional_includedir=\"$includedir\"
662           eval additional_libdir=\"$libdir\"
663         ])
664       else
665         additional_includedir="$withval/include"
666         additional_libdir="$withval/lib"
667       fi
668     fi
669 ])
670   if test $use_additional = yes; then
671     dnl Potentially add $additional_includedir to $CPPFLAGS.
672     dnl But don't add it
673     dnl   1. if it's the standard /usr/include,
674     dnl   2. if it's already present in $CPPFLAGS,
675     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
676     dnl   4. if it doesn't exist as a directory.
677     if test "X$additional_includedir" != "X/usr/include"; then
678       haveit=
679       for x in $CPPFLAGS; do
680         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
681         if test "X$x" = "X-I$additional_includedir"; then
682           haveit=yes
683           break
684         fi
685       done
686       if test -z "$haveit"; then
687         if test "X$additional_includedir" = "X/usr/local/include"; then
688           if test -n "$GCC"; then
689             case $host_os in
690               linux*) haveit=yes;;
691             esac
692           fi
693         fi
694         if test -z "$haveit"; then
695           if test -d "$additional_includedir"; then
696             dnl Really add $additional_includedir to $CPPFLAGS.
697             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
698           fi
699         fi
700       fi
701     fi
702     dnl Potentially add $additional_libdir to $LDFLAGS.
703     dnl But don't add it
704     dnl   1. if it's the standard /usr/lib,
705     dnl   2. if it's already present in $LDFLAGS,
706     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
707     dnl   4. if it doesn't exist as a directory.
708     if test "X$additional_libdir" != "X/usr/lib"; then
709       haveit=
710       for x in $LDFLAGS; do
711         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
712         if test "X$x" = "X-L$additional_libdir"; then
713           haveit=yes
714           break
715         fi
716       done
717       if test -z "$haveit"; then
718         if test "X$additional_libdir" = "X/usr/local/lib"; then
719           if test -n "$GCC"; then
720             case $host_os in
721               linux*) haveit=yes;;
722             esac
723           fi
724         fi
725         if test -z "$haveit"; then
726           if test -d "$additional_libdir"; then
727             dnl Really add $additional_libdir to $LDFLAGS.
728             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
729           fi
730         fi
731       fi
732     fi
733   fi
734 ])
735
736 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
737 dnl acl_final_exec_prefix, containing the values to which $prefix and
738 dnl $exec_prefix will expand at the end of the configure script.
739 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
740 [
741   dnl Unfortunately, prefix and exec_prefix get only finally determined
742   dnl at the end of configure.
743   if test "X$prefix" = "XNONE"; then
744     acl_final_prefix="$ac_default_prefix"
745   else
746     acl_final_prefix="$prefix"
747   fi
748   if test "X$exec_prefix" = "XNONE"; then
749     acl_final_exec_prefix='${prefix}'
750   else
751     acl_final_exec_prefix="$exec_prefix"
752   fi
753   acl_save_prefix="$prefix"
754   prefix="$acl_final_prefix"
755   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
756   prefix="$acl_save_prefix"
757 ])
758
759 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
760 dnl variables prefix and exec_prefix bound to the values they will have
761 dnl at the end of the configure script.
762 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
763 [
764   acl_save_prefix="$prefix"
765   prefix="$acl_final_prefix"
766   acl_save_exec_prefix="$exec_prefix"
767   exec_prefix="$acl_final_exec_prefix"
768   $1
769   exec_prefix="$acl_save_exec_prefix"
770   prefix="$acl_save_prefix"
771 ])
772
773 # lib-link.m4 serial 4 (gettext-0.12)
774 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
775 dnl This file is free software, distributed under the terms of the GNU
776 dnl General Public License.  As a special exception to the GNU General
777 dnl Public License, this file may be distributed as part of a program
778 dnl that contains a configuration script generated by Autoconf, under
779 dnl the same distribution terms as the rest of that program.
780
781 dnl From Bruno Haible.
782
783 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
784 dnl the libraries corresponding to explicit and implicit dependencies.
785 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
786 dnl augments the CPPFLAGS variable.
787 AC_DEFUN([AC_LIB_LINKFLAGS],
788 [
789   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
790   AC_REQUIRE([AC_LIB_RPATH])
791   define([Name],[translit([$1],[./-], [___])])
792   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
793                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
794   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
795     AC_LIB_LINKFLAGS_BODY([$1], [$2])
796     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
797     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
798     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
799   ])
800   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
801   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
802   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
803   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
804   AC_SUBST([LIB]NAME)
805   AC_SUBST([LTLIB]NAME)
806   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
807   dnl results of this search when this library appears as a dependency.
808   HAVE_LIB[]NAME=yes
809   undefine([Name])
810   undefine([NAME])
811 ])
812
813 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
814 dnl searches for libname and the libraries corresponding to explicit and
815 dnl implicit dependencies, together with the specified include files and
816 dnl the ability to compile and link the specified testcode. If found, it
817 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
818 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
819 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
820 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
821 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
822 [
823   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
824   AC_REQUIRE([AC_LIB_RPATH])
825   define([Name],[translit([$1],[./-], [___])])
826   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
827                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
828
829   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
830   dnl accordingly.
831   AC_LIB_LINKFLAGS_BODY([$1], [$2])
832
833   dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
834   dnl because if the user has installed lib[]Name and not disabled its use
835   dnl via --without-lib[]Name-prefix, he wants to use it.
836   ac_save_CPPFLAGS="$CPPFLAGS"
837   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
838
839   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
840     ac_save_LIBS="$LIBS"
841     LIBS="$LIBS $LIB[]NAME"
842     AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
843     LIBS="$ac_save_LIBS"
844   ])
845   if test "$ac_cv_lib[]Name" = yes; then
846     HAVE_LIB[]NAME=yes
847     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
848     AC_MSG_CHECKING([how to link with lib[]$1])
849     AC_MSG_RESULT([$LIB[]NAME])
850   else
851     HAVE_LIB[]NAME=no
852     dnl If $LIB[]NAME didn't lead to a usable library, we don't need
853     dnl $INC[]NAME either.
854     CPPFLAGS="$ac_save_CPPFLAGS"
855     LIB[]NAME=
856     LTLIB[]NAME=
857   fi
858   AC_SUBST([HAVE_LIB]NAME)
859   AC_SUBST([LIB]NAME)
860   AC_SUBST([LTLIB]NAME)
861   undefine([Name])
862   undefine([NAME])
863 ])
864
865 dnl Determine the platform dependent parameters needed to use rpath:
866 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
867 dnl hardcode_direct, hardcode_minus_L.
868 AC_DEFUN([AC_LIB_RPATH],
869 [
870   AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
871   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
872   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
873   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
874   AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
875     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
876     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
877     . ./conftest.sh
878     rm -f ./conftest.sh
879     acl_cv_rpath=done
880   ])
881   wl="$acl_cv_wl"
882   libext="$acl_cv_libext"
883   shlibext="$acl_cv_shlibext"
884   hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
885   hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
886   hardcode_direct="$acl_cv_hardcode_direct"
887   hardcode_minus_L="$acl_cv_hardcode_minus_L"
888   dnl Determine whether the user wants rpath handling at all.
889   AC_ARG_ENABLE(rpath,
890     [  --disable-rpath         do not hardcode runtime library paths],
891     :, enable_rpath=yes)
892 ])
893
894 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
895 dnl the libraries corresponding to explicit and implicit dependencies.
896 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
897 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
898 [
899   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
900                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
901   dnl By default, look in $includedir and $libdir.
902   use_additional=yes
903   AC_LIB_WITH_FINAL_PREFIX([
904     eval additional_includedir=\"$includedir\"
905     eval additional_libdir=\"$libdir\"
906   ])
907   AC_LIB_ARG_WITH([lib$1-prefix],
908 [  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
909   --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
910 [
911     if test "X$withval" = "Xno"; then
912       use_additional=no
913     else
914       if test "X$withval" = "X"; then
915         AC_LIB_WITH_FINAL_PREFIX([
916           eval additional_includedir=\"$includedir\"
917           eval additional_libdir=\"$libdir\"
918         ])
919       else
920         additional_includedir="$withval/include"
921         additional_libdir="$withval/lib"
922       fi
923     fi
924 ])
925   dnl Search the library and its dependencies in $additional_libdir and
926   dnl $LDFLAGS. Using breadth-first-seach.
927   LIB[]NAME=
928   LTLIB[]NAME=
929   INC[]NAME=
930   rpathdirs=
931   ltrpathdirs=
932   names_already_handled=
933   names_next_round='$1 $2'
934   while test -n "$names_next_round"; do
935     names_this_round="$names_next_round"
936     names_next_round=
937     for name in $names_this_round; do
938       already_handled=
939       for n in $names_already_handled; do
940         if test "$n" = "$name"; then
941           already_handled=yes
942           break
943         fi
944       done
945       if test -z "$already_handled"; then
946         names_already_handled="$names_already_handled $name"
947         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
948         dnl or AC_LIB_HAVE_LINKFLAGS call.
949         uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
950         eval value=\"\$HAVE_LIB$uppername\"
951         if test -n "$value"; then
952           if test "$value" = yes; then
953             eval value=\"\$LIB$uppername\"
954             test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
955             eval value=\"\$LTLIB$uppername\"
956             test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
957           else
958             dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
959             dnl that this library doesn't exist. So just drop it.
960             :
961           fi
962         else
963           dnl Search the library lib$name in $additional_libdir and $LDFLAGS
964           dnl and the already constructed $LIBNAME/$LTLIBNAME.
965           found_dir=
966           found_la=
967           found_so=
968           found_a=
969           if test $use_additional = yes; then
970             if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
971               found_dir="$additional_libdir"
972               found_so="$additional_libdir/lib$name.$shlibext"
973               if test -f "$additional_libdir/lib$name.la"; then
974                 found_la="$additional_libdir/lib$name.la"
975               fi
976             else
977               if test -f "$additional_libdir/lib$name.$libext"; then
978                 found_dir="$additional_libdir"
979                 found_a="$additional_libdir/lib$name.$libext"
980                 if test -f "$additional_libdir/lib$name.la"; then
981                   found_la="$additional_libdir/lib$name.la"
982                 fi
983               fi
984             fi
985           fi
986           if test "X$found_dir" = "X"; then
987             for x in $LDFLAGS $LTLIB[]NAME; do
988               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
989               case "$x" in
990                 -L*)
991                   dir=`echo "X$x" | sed -e 's/^X-L//'`
992                   if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
993                     found_dir="$dir"
994                     found_so="$dir/lib$name.$shlibext"
995                     if test -f "$dir/lib$name.la"; then
996                       found_la="$dir/lib$name.la"
997                     fi
998                   else
999                     if test -f "$dir/lib$name.$libext"; then
1000                       found_dir="$dir"
1001                       found_a="$dir/lib$name.$libext"
1002                       if test -f "$dir/lib$name.la"; then
1003                         found_la="$dir/lib$name.la"
1004                       fi
1005                     fi
1006                   fi
1007                   ;;
1008               esac
1009               if test "X$found_dir" != "X"; then
1010                 break
1011               fi
1012             done
1013           fi
1014           if test "X$found_dir" != "X"; then
1015             dnl Found the library.
1016             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1017             if test "X$found_so" != "X"; then
1018               dnl Linking with a shared library. We attempt to hardcode its
1019               dnl directory into the executable's runpath, unless it's the
1020               dnl standard /usr/lib.
1021               if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
1022                 dnl No hardcoding is needed.
1023                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1024               else
1025                 dnl Use an explicit option to hardcode DIR into the resulting
1026                 dnl binary.
1027                 dnl Potentially add DIR to ltrpathdirs.
1028                 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1029                 haveit=
1030                 for x in $ltrpathdirs; do
1031                   if test "X$x" = "X$found_dir"; then
1032                     haveit=yes
1033                     break
1034                   fi
1035                 done
1036                 if test -z "$haveit"; then
1037                   ltrpathdirs="$ltrpathdirs $found_dir"
1038                 fi
1039                 dnl The hardcoding into $LIBNAME is system dependent.
1040                 if test "$hardcode_direct" = yes; then
1041                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1042                   dnl resulting binary.
1043                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1044                 else
1045                   if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1046                     dnl Use an explicit option to hardcode DIR into the resulting
1047                     dnl binary.
1048                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1049                     dnl Potentially add DIR to rpathdirs.
1050                     dnl The rpathdirs will be appended to $LIBNAME at the end.
1051                     haveit=
1052                     for x in $rpathdirs; do
1053                       if test "X$x" = "X$found_dir"; then
1054                         haveit=yes
1055                         break
1056                       fi
1057                     done
1058                     if test -z "$haveit"; then
1059                       rpathdirs="$rpathdirs $found_dir"
1060                     fi
1061                   else
1062                     dnl Rely on "-L$found_dir".
1063                     dnl But don't add it if it's already contained in the LDFLAGS
1064                     dnl or the already constructed $LIBNAME
1065                     haveit=
1066                     for x in $LDFLAGS $LIB[]NAME; do
1067                       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1068                       if test "X$x" = "X-L$found_dir"; then
1069                         haveit=yes
1070                         break
1071                       fi
1072                     done
1073                     if test -z "$haveit"; then
1074                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1075                     fi
1076                     if test "$hardcode_minus_L" != no; then
1077                       dnl FIXME: Not sure whether we should use
1078                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1079                       dnl here.
1080                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1081                     else
1082                       dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
1083                       dnl here, because this doesn't fit in flags passed to the
1084                       dnl compiler. So give up. No hardcoding. This affects only
1085                       dnl very old systems.
1086                       dnl FIXME: Not sure whether we should use
1087                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1088                       dnl here.
1089                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1090                     fi
1091                   fi
1092                 fi
1093               fi
1094             else
1095               if test "X$found_a" != "X"; then
1096                 dnl Linking with a static library.
1097                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1098               else
1099                 dnl We shouldn't come here, but anyway it's good to have a
1100                 dnl fallback.
1101                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1102               fi
1103             fi
1104             dnl Assume the include files are nearby.
1105             additional_includedir=
1106             case "$found_dir" in
1107               */lib | */lib/)
1108                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
1109                 additional_includedir="$basedir/include"
1110                 ;;
1111             esac
1112             if test "X$additional_includedir" != "X"; then
1113               dnl Potentially add $additional_includedir to $INCNAME.
1114               dnl But don't add it
1115               dnl   1. if it's the standard /usr/include,
1116               dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1117               dnl   3. if it's already present in $CPPFLAGS or the already
1118               dnl      constructed $INCNAME,
1119               dnl   4. if it doesn't exist as a directory.
1120               if test "X$additional_includedir" != "X/usr/include"; then
1121                 haveit=
1122                 if test "X$additional_includedir" = "X/usr/local/include"; then
1123                   if test -n "$GCC"; then
1124                     case $host_os in
1125                       linux*) haveit=yes;;
1126                     esac
1127                   fi
1128                 fi
1129                 if test -z "$haveit"; then
1130                   for x in $CPPFLAGS $INC[]NAME; do
1131                     AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1132                     if test "X$x" = "X-I$additional_includedir"; then
1133                       haveit=yes
1134                       break
1135                     fi
1136                   done
1137                   if test -z "$haveit"; then
1138                     if test -d "$additional_includedir"; then
1139                       dnl Really add $additional_includedir to $INCNAME.
1140                       INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1141                     fi
1142                   fi
1143                 fi
1144               fi
1145             fi
1146             dnl Look for dependencies.
1147             if test -n "$found_la"; then
1148               dnl Read the .la file. It defines the variables
1149               dnl dlname, library_names, old_library, dependency_libs, current,
1150               dnl age, revision, installed, dlopen, dlpreopen, libdir.
1151               save_libdir="$libdir"
1152               case "$found_la" in
1153                 */* | *\\*) . "$found_la" ;;
1154                 *) . "./$found_la" ;;
1155               esac
1156               libdir="$save_libdir"
1157               dnl We use only dependency_libs.
1158               for dep in $dependency_libs; do
1159                 case "$dep" in
1160                   -L*)
1161                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1162                     dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1163                     dnl But don't add it
1164                     dnl   1. if it's the standard /usr/lib,
1165                     dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1166                     dnl   3. if it's already present in $LDFLAGS or the already
1167                     dnl      constructed $LIBNAME,
1168                     dnl   4. if it doesn't exist as a directory.
1169                     if test "X$additional_libdir" != "X/usr/lib"; then
1170                       haveit=
1171                       if test "X$additional_libdir" = "X/usr/local/lib"; then
1172                         if test -n "$GCC"; then
1173                           case $host_os in
1174                             linux*) haveit=yes;;
1175                           esac
1176                         fi
1177                       fi
1178                       if test -z "$haveit"; then
1179                         haveit=
1180                         for x in $LDFLAGS $LIB[]NAME; do
1181                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1182                           if test "X$x" = "X-L$additional_libdir"; then
1183                             haveit=yes
1184                             break
1185                           fi
1186                         done
1187                         if test -z "$haveit"; then
1188                           if test -d "$additional_libdir"; then
1189                             dnl Really add $additional_libdir to $LIBNAME.
1190                             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1191                           fi
1192                         fi
1193                         haveit=
1194                         for x in $LDFLAGS $LTLIB[]NAME; do
1195                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1196                           if test "X$x" = "X-L$additional_libdir"; then
1197                             haveit=yes
1198                             break
1199                           fi
1200                         done
1201                         if test -z "$haveit"; then
1202                           if test -d "$additional_libdir"; then
1203                             dnl Really add $additional_libdir to $LTLIBNAME.
1204                             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1205                           fi
1206                         fi
1207                       fi
1208                     fi
1209                     ;;
1210                   -R*)
1211                     dir=`echo "X$dep" | sed -e 's/^X-R//'`
1212                     if test "$enable_rpath" != no; then
1213                       dnl Potentially add DIR to rpathdirs.
1214                       dnl The rpathdirs will be appended to $LIBNAME at the end.
1215                       haveit=
1216                       for x in $rpathdirs; do
1217                         if test "X$x" = "X$dir"; then
1218                           haveit=yes
1219                           break
1220                         fi
1221                       done
1222                       if test -z "$haveit"; then
1223                         rpathdirs="$rpathdirs $dir"
1224                       fi
1225                       dnl Potentially add DIR to ltrpathdirs.
1226                       dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1227                       haveit=
1228                       for x in $ltrpathdirs; do
1229                         if test "X$x" = "X$dir"; then
1230                           haveit=yes
1231                           break
1232                         fi
1233                       done
1234                       if test -z "$haveit"; then
1235                         ltrpathdirs="$ltrpathdirs $dir"
1236                       fi
1237                     fi
1238                     ;;
1239                   -l*)
1240                     dnl Handle this in the next round.
1241                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1242                     ;;
1243                   *.la)
1244                     dnl Handle this in the next round. Throw away the .la's
1245                     dnl directory; it is already contained in a preceding -L
1246                     dnl option.
1247                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1248                     ;;
1249                   *)
1250                     dnl Most likely an immediate library name.
1251                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1252                     LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1253                     ;;
1254                 esac
1255               done
1256             fi
1257           else
1258             dnl Didn't find the library; assume it is in the system directories
1259             dnl known to the linker and runtime loader. (All the system
1260             dnl directories known to the linker should also be known to the
1261             dnl runtime loader, otherwise the system is severely misconfigured.)
1262             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1263             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1264           fi
1265         fi
1266       fi
1267     done
1268   done
1269   if test "X$rpathdirs" != "X"; then
1270     if test -n "$hardcode_libdir_separator"; then
1271       dnl Weird platform: only the last -rpath option counts, the user must
1272       dnl pass all path elements in one option. We can arrange that for a
1273       dnl single library, but not when more than one $LIBNAMEs are used.
1274       alldirs=
1275       for found_dir in $rpathdirs; do
1276         alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
1277       done
1278       dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
1279       acl_save_libdir="$libdir"
1280       libdir="$alldirs"
1281       eval flag=\"$hardcode_libdir_flag_spec\"
1282       libdir="$acl_save_libdir"
1283       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1284     else
1285       dnl The -rpath options are cumulative.
1286       for found_dir in $rpathdirs; do
1287         acl_save_libdir="$libdir"
1288         libdir="$found_dir"
1289         eval flag=\"$hardcode_libdir_flag_spec\"
1290         libdir="$acl_save_libdir"
1291         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1292       done
1293     fi
1294   fi
1295   if test "X$ltrpathdirs" != "X"; then
1296     dnl When using libtool, the option that works for both libraries and
1297     dnl executables is -R. The -R options are cumulative.
1298     for found_dir in $ltrpathdirs; do
1299       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1300     done
1301   fi
1302 ])
1303
1304 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1305 dnl unless already present in VAR.
1306 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1307 dnl contains two or three consecutive elements that belong together.
1308 AC_DEFUN([AC_LIB_APPENDTOVAR],
1309 [
1310   for element in [$2]; do
1311     haveit=
1312     for x in $[$1]; do
1313       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1314       if test "X$x" = "X$element"; then
1315         haveit=yes
1316         break
1317       fi
1318     done
1319     if test -z "$haveit"; then
1320       [$1]="${[$1]}${[$1]:+ }$element"
1321     fi
1322   done
1323 ])
1324
1325 # lib-ld.m4 serial 2 (gettext-0.12)
1326 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
1327 dnl This file is free software, distributed under the terms of the GNU
1328 dnl General Public License.  As a special exception to the GNU General
1329 dnl Public License, this file may be distributed as part of a program
1330 dnl that contains a configuration script generated by Autoconf, under
1331 dnl the same distribution terms as the rest of that program.
1332
1333 dnl Subroutines of libtool.m4,
1334 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
1335 dnl with libtool.m4.
1336
1337 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
1338 AC_DEFUN([AC_LIB_PROG_LD_GNU],
1339 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
1340 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1341 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
1342   acl_cv_prog_gnu_ld=yes
1343 else
1344   acl_cv_prog_gnu_ld=no
1345 fi])
1346 with_gnu_ld=$acl_cv_prog_gnu_ld
1347 ])
1348
1349 dnl From libtool-1.4. Sets the variable LD.
1350 AC_DEFUN([AC_LIB_PROG_LD],
1351 [AC_ARG_WITH(gnu-ld,
1352 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1353 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1354 AC_REQUIRE([AC_PROG_CC])dnl
1355 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1356 # Prepare PATH_SEPARATOR.
1357 # The user is always right.
1358 if test "${PATH_SEPARATOR+set}" != set; then
1359   echo "#! /bin/sh" >conf$$.sh
1360   echo  "exit 0"   >>conf$$.sh
1361   chmod +x conf$$.sh
1362   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
1363     PATH_SEPARATOR=';'
1364   else
1365     PATH_SEPARATOR=:
1366   fi
1367   rm -f conf$$.sh
1368 fi
1369 ac_prog=ld
1370 if test "$GCC" = yes; then
1371   # Check if gcc -print-prog-name=ld gives a path.
1372   AC_MSG_CHECKING([for ld used by GCC])
1373   case $host in
1374   *-*-mingw*)
1375     # gcc leaves a trailing carriage return which upsets mingw
1376     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1377   *)
1378     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1379   esac
1380   case $ac_prog in
1381     # Accept absolute paths.
1382     [[\\/]* | [A-Za-z]:[\\/]*)]
1383       [re_direlt='/[^/][^/]*/\.\./']
1384       # Canonicalize the path of ld
1385       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1386       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1387         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1388       done
1389       test -z "$LD" && LD="$ac_prog"
1390       ;;
1391   "")
1392     # If it fails, then pretend we aren't using GCC.
1393     ac_prog=ld
1394     ;;
1395   *)
1396     # If it is relative, then search for the first ld in PATH.
1397     with_gnu_ld=unknown
1398     ;;
1399   esac
1400 elif test "$with_gnu_ld" = yes; then
1401   AC_MSG_CHECKING([for GNU ld])
1402 else
1403   AC_MSG_CHECKING([for non-GNU ld])
1404 fi
1405 AC_CACHE_VAL(acl_cv_path_LD,
1406 [if test -z "$LD"; then
1407   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1408   for ac_dir in $PATH; do
1409     test -z "$ac_dir" && ac_dir=.
1410     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1411       acl_cv_path_LD="$ac_dir/$ac_prog"
1412       # Check to see if the program is GNU ld.  I'd rather use --version,
1413       # but apparently some GNU ld's only accept -v.
1414       # Break only if it was the GNU/non-GNU ld that we prefer.
1415       if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
1416         test "$with_gnu_ld" != no && break
1417       else
1418         test "$with_gnu_ld" != yes && break
1419       fi
1420     fi
1421   done
1422   IFS="$ac_save_ifs"
1423 else
1424   acl_cv_path_LD="$LD" # Let the user override the test with a path.
1425 fi])
1426 LD="$acl_cv_path_LD"
1427 if test -n "$LD"; then
1428   AC_MSG_RESULT($LD)
1429 else
1430   AC_MSG_RESULT(no)
1431 fi
1432 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1433 AC_LIB_PROG_LD_GNU
1434 ])
1435