upload tizen2.0 source
[framework/uifw/xorg/util/xkeyboard-config.git] / aclocal.m4
1 # generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005, 2006, 2007, 2008, 2009  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 m4_ifndef([AC_AUTOCONF_VERSION],
15   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17 [m4_warning([this file was generated for autoconf 2.68.
18 You have another version of autoconf.  It may work, but is not guaranteed to.
19 If you have problems, you may need to regenerate the build system entirely.
20 To do so, use the procedure documented by the package, typically `autoreconf'.])])
21
22 # gettext.m4 serial 63 (gettext-0.18)
23 dnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
24 dnl This file is free software; the Free Software Foundation
25 dnl gives unlimited permission to copy and/or distribute it,
26 dnl with or without modifications, as long as this notice is preserved.
27 dnl
28 dnl This file can can be used in projects which are not available under
29 dnl the GNU General Public License or the GNU Library General Public
30 dnl License but which still want to provide support for the GNU gettext
31 dnl functionality.
32 dnl Please note that the actual code of the GNU gettext library is covered
33 dnl by the GNU Library General Public License, and the rest of the GNU
34 dnl gettext package package is covered by the GNU General Public License.
35 dnl They are *not* in the public domain.
36
37 dnl Authors:
38 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
39 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
40
41 dnl Macro to add for using GNU gettext.
42
43 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
44 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
45 dnl    default (if it is not specified or empty) is 'no-libtool'.
46 dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
47 dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
48 dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
49 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
50 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
51 dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
52 dnl    $(top_builddir)/intl/libintl.a will be created.
53 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
54 dnl    implementations (in libc or libintl) without the ngettext() function
55 dnl    will be ignored.  If NEEDSYMBOL is specified and is
56 dnl    'need-formatstring-macros', then GNU gettext implementations that don't
57 dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
58 dnl INTLDIR is used to find the intl libraries.  If empty,
59 dnl    the value `$(top_builddir)/intl/' is used.
60 dnl
61 dnl The result of the configuration is one of three cases:
62 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
63 dnl    and used.
64 dnl    Catalog format: GNU --> install in $(datadir)
65 dnl    Catalog extension: .mo after installation, .gmo in source tree
66 dnl 2) GNU gettext has been found in the system's C library.
67 dnl    Catalog format: GNU --> install in $(datadir)
68 dnl    Catalog extension: .mo after installation, .gmo in source tree
69 dnl 3) No internationalization, always use English msgid.
70 dnl    Catalog format: none
71 dnl    Catalog extension: none
72 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
73 dnl The use of .gmo is historical (it was needed to avoid overwriting the
74 dnl GNU format catalogs when building on a platform with an X/Open gettext),
75 dnl but we keep it in order not to force irrelevant filename changes on the
76 dnl maintainers.
77 dnl
78 AC_DEFUN([AM_GNU_GETTEXT],
79 [
80   dnl Argument checking.
81   ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
82     [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
83 ])])])])])
84   ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
85     [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])])
86   ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
87     [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
88 ])])])])
89   define([gt_included_intl],
90     ifelse([$1], [external],
91       ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
92       [yes]))
93   define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
94   gt_NEEDS_INIT
95   AM_GNU_GETTEXT_NEED([$2])
96
97   AC_REQUIRE([AM_PO_SUBDIRS])dnl
98   ifelse(gt_included_intl, yes, [
99     AC_REQUIRE([AM_INTL_SUBDIR])dnl
100   ])
101
102   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
103   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
104   AC_REQUIRE([AC_LIB_RPATH])
105
106   dnl Sometimes libintl requires libiconv, so first search for libiconv.
107   dnl Ideally we would do this search only after the
108   dnl      if test "$USE_NLS" = "yes"; then
109   dnl        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
110   dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
111   dnl the configure script would need to contain the same shell code
112   dnl again, outside any 'if'. There are two solutions:
113   dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
114   dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
115   dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
116   dnl documented, we avoid it.
117   ifelse(gt_included_intl, yes, , [
118     AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
119   ])
120
121   dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
122   gt_INTL_MACOSX
123
124   dnl Set USE_NLS.
125   AC_REQUIRE([AM_NLS])
126
127   ifelse(gt_included_intl, yes, [
128     BUILD_INCLUDED_LIBINTL=no
129     USE_INCLUDED_LIBINTL=no
130   ])
131   LIBINTL=
132   LTLIBINTL=
133   POSUB=
134
135   dnl Add a version number to the cache macros.
136   case " $gt_needs " in
137     *" need-formatstring-macros "*) gt_api_version=3 ;;
138     *" need-ngettext "*) gt_api_version=2 ;;
139     *) gt_api_version=1 ;;
140   esac
141   gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
142   gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
143
144   dnl If we use NLS figure out what method
145   if test "$USE_NLS" = "yes"; then
146     gt_use_preinstalled_gnugettext=no
147     ifelse(gt_included_intl, yes, [
148       AC_MSG_CHECKING([whether included gettext is requested])
149       AC_ARG_WITH([included-gettext],
150         [  --with-included-gettext use the GNU gettext library included here],
151         nls_cv_force_use_gnu_gettext=$withval,
152         nls_cv_force_use_gnu_gettext=no)
153       AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
154
155       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
156       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
157     ])
158         dnl User does not insist on using GNU NLS library.  Figure out what
159         dnl to use.  If GNU gettext is available we use this.  Else we have
160         dnl to fall back to GNU NLS library.
161
162         if test $gt_api_version -ge 3; then
163           gt_revision_test_code='
164 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
165 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
166 #endif
167 changequote(,)dnl
168 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
169 changequote([,])dnl
170 '
171         else
172           gt_revision_test_code=
173         fi
174         if test $gt_api_version -ge 2; then
175           gt_expression_test_code=' + * ngettext ("", "", 0)'
176         else
177           gt_expression_test_code=
178         fi
179
180         AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
181          [AC_TRY_LINK([#include <libintl.h>
182 $gt_revision_test_code
183 extern int _nl_msg_cat_cntr;
184 extern int *_nl_domain_bindings;],
185             [bindtextdomain ("", "");
186 return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
187             [eval "$gt_func_gnugettext_libc=yes"],
188             [eval "$gt_func_gnugettext_libc=no"])])
189
190         if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
191           dnl Sometimes libintl requires libiconv, so first search for libiconv.
192           ifelse(gt_included_intl, yes, , [
193             AM_ICONV_LINK
194           ])
195           dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
196           dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
197           dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
198           dnl even if libiconv doesn't exist.
199           AC_LIB_LINKFLAGS_BODY([intl])
200           AC_CACHE_CHECK([for GNU gettext in libintl],
201             [$gt_func_gnugettext_libintl],
202            [gt_save_CPPFLAGS="$CPPFLAGS"
203             CPPFLAGS="$CPPFLAGS $INCINTL"
204             gt_save_LIBS="$LIBS"
205             LIBS="$LIBS $LIBINTL"
206             dnl Now see whether libintl exists and does not depend on libiconv.
207             AC_TRY_LINK([#include <libintl.h>
208 $gt_revision_test_code
209 extern int _nl_msg_cat_cntr;
210 extern
211 #ifdef __cplusplus
212 "C"
213 #endif
214 const char *_nl_expand_alias (const char *);],
215               [bindtextdomain ("", "");
216 return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
217               [eval "$gt_func_gnugettext_libintl=yes"],
218               [eval "$gt_func_gnugettext_libintl=no"])
219             dnl Now see whether libintl exists and depends on libiconv.
220             if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
221               LIBS="$LIBS $LIBICONV"
222               AC_TRY_LINK([#include <libintl.h>
223 $gt_revision_test_code
224 extern int _nl_msg_cat_cntr;
225 extern
226 #ifdef __cplusplus
227 "C"
228 #endif
229 const char *_nl_expand_alias (const char *);],
230                 [bindtextdomain ("", "");
231 return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
232                [LIBINTL="$LIBINTL $LIBICONV"
233                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
234                 eval "$gt_func_gnugettext_libintl=yes"
235                ])
236             fi
237             CPPFLAGS="$gt_save_CPPFLAGS"
238             LIBS="$gt_save_LIBS"])
239         fi
240
241         dnl If an already present or preinstalled GNU gettext() is found,
242         dnl use it.  But if this macro is used in GNU gettext, and GNU
243         dnl gettext is already preinstalled in libintl, we update this
244         dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
245         if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
246            || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
247                 && test "$PACKAGE" != gettext-runtime \
248                 && test "$PACKAGE" != gettext-tools; }; then
249           gt_use_preinstalled_gnugettext=yes
250         else
251           dnl Reset the values set by searching for libintl.
252           LIBINTL=
253           LTLIBINTL=
254           INCINTL=
255         fi
256
257     ifelse(gt_included_intl, yes, [
258         if test "$gt_use_preinstalled_gnugettext" != "yes"; then
259           dnl GNU gettext is not found in the C library.
260           dnl Fall back on included GNU gettext library.
261           nls_cv_use_gnu_gettext=yes
262         fi
263       fi
264
265       if test "$nls_cv_use_gnu_gettext" = "yes"; then
266         dnl Mark actions used to generate GNU NLS library.
267         BUILD_INCLUDED_LIBINTL=yes
268         USE_INCLUDED_LIBINTL=yes
269         LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
270         LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
271         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
272       fi
273
274       CATOBJEXT=
275       if test "$gt_use_preinstalled_gnugettext" = "yes" \
276          || test "$nls_cv_use_gnu_gettext" = "yes"; then
277         dnl Mark actions to use GNU gettext tools.
278         CATOBJEXT=.gmo
279       fi
280     ])
281
282     if test -n "$INTL_MACOSX_LIBS"; then
283       if test "$gt_use_preinstalled_gnugettext" = "yes" \
284          || test "$nls_cv_use_gnu_gettext" = "yes"; then
285         dnl Some extra flags are needed during linking.
286         LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
287         LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
288       fi
289     fi
290
291     if test "$gt_use_preinstalled_gnugettext" = "yes" \
292        || test "$nls_cv_use_gnu_gettext" = "yes"; then
293       AC_DEFINE([ENABLE_NLS], [1],
294         [Define to 1 if translation of program messages to the user's native language
295    is requested.])
296     else
297       USE_NLS=no
298     fi
299   fi
300
301   AC_MSG_CHECKING([whether to use NLS])
302   AC_MSG_RESULT([$USE_NLS])
303   if test "$USE_NLS" = "yes"; then
304     AC_MSG_CHECKING([where the gettext function comes from])
305     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
306       if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
307         gt_source="external libintl"
308       else
309         gt_source="libc"
310       fi
311     else
312       gt_source="included intl directory"
313     fi
314     AC_MSG_RESULT([$gt_source])
315   fi
316
317   if test "$USE_NLS" = "yes"; then
318
319     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
320       if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
321         AC_MSG_CHECKING([how to link with libintl])
322         AC_MSG_RESULT([$LIBINTL])
323         AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
324       fi
325
326       dnl For backward compatibility. Some packages may be using this.
327       AC_DEFINE([HAVE_GETTEXT], [1],
328        [Define if the GNU gettext() function is already present or preinstalled.])
329       AC_DEFINE([HAVE_DCGETTEXT], [1],
330        [Define if the GNU dcgettext() function is already present or preinstalled.])
331     fi
332
333     dnl We need to process the po/ directory.
334     POSUB=po
335   fi
336
337   ifelse(gt_included_intl, yes, [
338     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
339     dnl to 'yes' because some of the testsuite requires it.
340     if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
341       BUILD_INCLUDED_LIBINTL=yes
342     fi
343
344     dnl Make all variables we use known to autoconf.
345     AC_SUBST([BUILD_INCLUDED_LIBINTL])
346     AC_SUBST([USE_INCLUDED_LIBINTL])
347     AC_SUBST([CATOBJEXT])
348
349     dnl For backward compatibility. Some configure.ins may be using this.
350     nls_cv_header_intl=
351     nls_cv_header_libgt=
352
353     dnl For backward compatibility. Some Makefiles may be using this.
354     DATADIRNAME=share
355     AC_SUBST([DATADIRNAME])
356
357     dnl For backward compatibility. Some Makefiles may be using this.
358     INSTOBJEXT=.mo
359     AC_SUBST([INSTOBJEXT])
360
361     dnl For backward compatibility. Some Makefiles may be using this.
362     GENCAT=gencat
363     AC_SUBST([GENCAT])
364
365     dnl For backward compatibility. Some Makefiles may be using this.
366     INTLOBJS=
367     if test "$USE_INCLUDED_LIBINTL" = yes; then
368       INTLOBJS="\$(GETTOBJS)"
369     fi
370     AC_SUBST([INTLOBJS])
371
372     dnl Enable libtool support if the surrounding package wishes it.
373     INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
374     AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX])
375   ])
376
377   dnl For backward compatibility. Some Makefiles may be using this.
378   INTLLIBS="$LIBINTL"
379   AC_SUBST([INTLLIBS])
380
381   dnl Make all documented variables known to autoconf.
382   AC_SUBST([LIBINTL])
383   AC_SUBST([LTLIBINTL])
384   AC_SUBST([POSUB])
385 ])
386
387
388 dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
389 m4_define([gt_NEEDS_INIT],
390 [
391   m4_divert_text([DEFAULTS], [gt_needs=])
392   m4_define([gt_NEEDS_INIT], [])
393 ])
394
395
396 dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
397 AC_DEFUN([AM_GNU_GETTEXT_NEED],
398 [
399   m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
400 ])
401
402
403 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
404 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
405
406 # iconv.m4 serial 11 (gettext-0.18.1)
407 dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
408 dnl This file is free software; the Free Software Foundation
409 dnl gives unlimited permission to copy and/or distribute it,
410 dnl with or without modifications, as long as this notice is preserved.
411
412 dnl From Bruno Haible.
413
414 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
415 [
416   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
417   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
418   AC_REQUIRE([AC_LIB_RPATH])
419
420   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
421   dnl accordingly.
422   AC_LIB_LINKFLAGS_BODY([iconv])
423 ])
424
425 AC_DEFUN([AM_ICONV_LINK],
426 [
427   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
428   dnl those with the standalone portable GNU libiconv installed).
429   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
430
431   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
432   dnl accordingly.
433   AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
434
435   dnl Add $INCICONV to CPPFLAGS before performing the following checks,
436   dnl because if the user has installed libiconv and not disabled its use
437   dnl via --without-libiconv-prefix, he wants to use it. The first
438   dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
439   am_save_CPPFLAGS="$CPPFLAGS"
440   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
441
442   AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
443     am_cv_func_iconv="no, consider installing GNU libiconv"
444     am_cv_lib_iconv=no
445     AC_TRY_LINK([#include <stdlib.h>
446 #include <iconv.h>],
447       [iconv_t cd = iconv_open("","");
448        iconv(cd,NULL,NULL,NULL,NULL);
449        iconv_close(cd);],
450       [am_cv_func_iconv=yes])
451     if test "$am_cv_func_iconv" != yes; then
452       am_save_LIBS="$LIBS"
453       LIBS="$LIBS $LIBICONV"
454       AC_TRY_LINK([#include <stdlib.h>
455 #include <iconv.h>],
456         [iconv_t cd = iconv_open("","");
457          iconv(cd,NULL,NULL,NULL,NULL);
458          iconv_close(cd);],
459         [am_cv_lib_iconv=yes]
460         [am_cv_func_iconv=yes])
461       LIBS="$am_save_LIBS"
462     fi
463   ])
464   if test "$am_cv_func_iconv" = yes; then
465     AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
466       dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
467       am_save_LIBS="$LIBS"
468       if test $am_cv_lib_iconv = yes; then
469         LIBS="$LIBS $LIBICONV"
470       fi
471       AC_TRY_RUN([
472 #include <iconv.h>
473 #include <string.h>
474 int main ()
475 {
476   /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
477      returns.  */
478   {
479     iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
480     if (cd_utf8_to_88591 != (iconv_t)(-1))
481       {
482         static const char input[] = "\342\202\254"; /* EURO SIGN */
483         char buf[10];
484         const char *inptr = input;
485         size_t inbytesleft = strlen (input);
486         char *outptr = buf;
487         size_t outbytesleft = sizeof (buf);
488         size_t res = iconv (cd_utf8_to_88591,
489                             (char **) &inptr, &inbytesleft,
490                             &outptr, &outbytesleft);
491         if (res == 0)
492           return 1;
493       }
494   }
495   /* Test against Solaris 10 bug: Failures are not distinguishable from
496      successful returns.  */
497   {
498     iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
499     if (cd_ascii_to_88591 != (iconv_t)(-1))
500       {
501         static const char input[] = "\263";
502         char buf[10];
503         const char *inptr = input;
504         size_t inbytesleft = strlen (input);
505         char *outptr = buf;
506         size_t outbytesleft = sizeof (buf);
507         size_t res = iconv (cd_ascii_to_88591,
508                             (char **) &inptr, &inbytesleft,
509                             &outptr, &outbytesleft);
510         if (res == 0)
511           return 1;
512       }
513   }
514 #if 0 /* This bug could be worked around by the caller.  */
515   /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
516   {
517     iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
518     if (cd_88591_to_utf8 != (iconv_t)(-1))
519       {
520         static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
521         char buf[50];
522         const char *inptr = input;
523         size_t inbytesleft = strlen (input);
524         char *outptr = buf;
525         size_t outbytesleft = sizeof (buf);
526         size_t res = iconv (cd_88591_to_utf8,
527                             (char **) &inptr, &inbytesleft,
528                             &outptr, &outbytesleft);
529         if ((int)res > 0)
530           return 1;
531       }
532   }
533 #endif
534   /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
535      provided.  */
536   if (/* Try standardized names.  */
537       iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
538       /* Try IRIX, OSF/1 names.  */
539       && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
540       /* Try AIX names.  */
541       && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
542       /* Try HP-UX names.  */
543       && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
544     return 1;
545   return 0;
546 }], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
547         [case "$host_os" in
548            aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
549            *)            am_cv_func_iconv_works="guessing yes" ;;
550          esac])
551       LIBS="$am_save_LIBS"
552     ])
553     case "$am_cv_func_iconv_works" in
554       *no) am_func_iconv=no am_cv_lib_iconv=no ;;
555       *)   am_func_iconv=yes ;;
556     esac
557   else
558     am_func_iconv=no am_cv_lib_iconv=no
559   fi
560   if test "$am_func_iconv" = yes; then
561     AC_DEFINE([HAVE_ICONV], [1],
562       [Define if you have the iconv() function and it works.])
563   fi
564   if test "$am_cv_lib_iconv" = yes; then
565     AC_MSG_CHECKING([how to link with libiconv])
566     AC_MSG_RESULT([$LIBICONV])
567   else
568     dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
569     dnl either.
570     CPPFLAGS="$am_save_CPPFLAGS"
571     LIBICONV=
572     LTLIBICONV=
573   fi
574   AC_SUBST([LIBICONV])
575   AC_SUBST([LTLIBICONV])
576 ])
577
578 dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
579 dnl avoid warnings like
580 dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
581 dnl This is tricky because of the way 'aclocal' is implemented:
582 dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
583 dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
584 dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
585 dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
586 dnl   warnings.
587 m4_define([gl_iconv_AC_DEFUN],
588   m4_version_prereq([2.64],
589     [[AC_DEFUN_ONCE(
590         [$1], [$2])]],
591     [[AC_DEFUN(
592         [$1], [$2])]]))
593 gl_iconv_AC_DEFUN([AM_ICONV],
594 [
595   AM_ICONV_LINK
596   if test "$am_cv_func_iconv" = yes; then
597     AC_MSG_CHECKING([for iconv declaration])
598     AC_CACHE_VAL([am_cv_proto_iconv], [
599       AC_TRY_COMPILE([
600 #include <stdlib.h>
601 #include <iconv.h>
602 extern
603 #ifdef __cplusplus
604 "C"
605 #endif
606 #if defined(__STDC__) || defined(__cplusplus)
607 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
608 #else
609 size_t iconv();
610 #endif
611 ], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
612       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);"])
613     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
614     AC_MSG_RESULT([
615          $am_cv_proto_iconv])
616     AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
617       [Define as const if the declaration of iconv() needs const.])
618   fi
619 ])
620
621 # intlmacosx.m4 serial 3 (gettext-0.18)
622 dnl Copyright (C) 2004-2010 Free Software Foundation, Inc.
623 dnl This file is free software; the Free Software Foundation
624 dnl gives unlimited permission to copy and/or distribute it,
625 dnl with or without modifications, as long as this notice is preserved.
626 dnl
627 dnl This file can can be used in projects which are not available under
628 dnl the GNU General Public License or the GNU Library General Public
629 dnl License but which still want to provide support for the GNU gettext
630 dnl functionality.
631 dnl Please note that the actual code of the GNU gettext library is covered
632 dnl by the GNU Library General Public License, and the rest of the GNU
633 dnl gettext package package is covered by the GNU General Public License.
634 dnl They are *not* in the public domain.
635
636 dnl Checks for special options needed on MacOS X.
637 dnl Defines INTL_MACOSX_LIBS.
638 AC_DEFUN([gt_INTL_MACOSX],
639 [
640   dnl Check for API introduced in MacOS X 10.2.
641   AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
642     [gt_cv_func_CFPreferencesCopyAppValue],
643     [gt_save_LIBS="$LIBS"
644      LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
645      AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
646        [CFPreferencesCopyAppValue(NULL, NULL)],
647        [gt_cv_func_CFPreferencesCopyAppValue=yes],
648        [gt_cv_func_CFPreferencesCopyAppValue=no])
649      LIBS="$gt_save_LIBS"])
650   if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
651     AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
652       [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
653   fi
654   dnl Check for API introduced in MacOS X 10.3.
655   AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
656     [gt_save_LIBS="$LIBS"
657      LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
658      AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
659        [gt_cv_func_CFLocaleCopyCurrent=yes],
660        [gt_cv_func_CFLocaleCopyCurrent=no])
661      LIBS="$gt_save_LIBS"])
662   if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
663     AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
664       [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
665   fi
666   INTL_MACOSX_LIBS=
667   if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
668     INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
669   fi
670   AC_SUBST([INTL_MACOSX_LIBS])
671 ])
672
673
674 dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml])
675 # serial 40 IT_PROG_INTLTOOL
676 AC_DEFUN([IT_PROG_INTLTOOL], [
677 AC_PREREQ([2.50])dnl
678 AC_REQUIRE([AM_NLS])dnl
679
680 case "$am__api_version" in
681     1.[01234])
682         AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool])
683     ;;
684     *)
685     ;;
686 esac
687
688 if test -n "$1"; then
689     AC_MSG_CHECKING([for intltool >= $1])
690
691     INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
692     INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
693     [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
694     ]
695     AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
696     test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
697         AC_MSG_ERROR([Your intltool is too old.  You need intltool $1 or later.])
698 fi
699
700 AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update])
701 AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge])
702 AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract])
703 if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then
704     AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.])
705 fi
706
707   INTLTOOL_DESKTOP_RULE='%.desktop:   %.desktop.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
708 INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
709      INTLTOOL_KEYS_RULE='%.keys:      %.keys.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
710      INTLTOOL_PROP_RULE='%.prop:      %.prop.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
711       INTLTOOL_OAF_RULE='%.oaf:       %.oaf.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< [$]@'
712      INTLTOOL_PONG_RULE='%.pong:      %.pong.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
713    INTLTOOL_SERVER_RULE='%.server:    %.server.in    $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
714     INTLTOOL_SHEET_RULE='%.sheet:     %.sheet.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
715 INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
716        INTLTOOL_UI_RULE='%.ui:        %.ui.in        $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
717       INTLTOOL_XML_RULE='%.xml:       %.xml.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
718       INTLTOOL_XML_NOMERGE_RULE='%.xml:       %.xml.in       $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< [$]@' 
719       INTLTOOL_XAM_RULE='%.xam:       %.xml.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
720       INTLTOOL_KBD_RULE='%.kbd:       %.kbd.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
721     INTLTOOL_CAVES_RULE='%.caves:     %.caves.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
722   INTLTOOL_SCHEMAS_RULE='%.schemas:   %.schemas.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
723     INTLTOOL_THEME_RULE='%.theme:     %.theme.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
724     INTLTOOL_SERVICE_RULE='%.service: %.service.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
725    INTLTOOL_POLICY_RULE='%.policy:    %.policy.in    $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
726
727 _IT_SUBST(INTLTOOL_DESKTOP_RULE)
728 _IT_SUBST(INTLTOOL_DIRECTORY_RULE)
729 _IT_SUBST(INTLTOOL_KEYS_RULE)
730 _IT_SUBST(INTLTOOL_PROP_RULE)
731 _IT_SUBST(INTLTOOL_OAF_RULE)
732 _IT_SUBST(INTLTOOL_PONG_RULE)
733 _IT_SUBST(INTLTOOL_SERVER_RULE)
734 _IT_SUBST(INTLTOOL_SHEET_RULE)
735 _IT_SUBST(INTLTOOL_SOUNDLIST_RULE)
736 _IT_SUBST(INTLTOOL_UI_RULE)
737 _IT_SUBST(INTLTOOL_XAM_RULE)
738 _IT_SUBST(INTLTOOL_KBD_RULE)
739 _IT_SUBST(INTLTOOL_XML_RULE)
740 _IT_SUBST(INTLTOOL_XML_NOMERGE_RULE)
741 _IT_SUBST(INTLTOOL_CAVES_RULE)
742 _IT_SUBST(INTLTOOL_SCHEMAS_RULE)
743 _IT_SUBST(INTLTOOL_THEME_RULE)
744 _IT_SUBST(INTLTOOL_SERVICE_RULE)
745 _IT_SUBST(INTLTOOL_POLICY_RULE)
746
747 # Check the gettext tools to make sure they are GNU
748 AC_PATH_PROG(XGETTEXT, xgettext)
749 AC_PATH_PROG(MSGMERGE, msgmerge)
750 AC_PATH_PROG(MSGFMT, msgfmt)
751 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
752 if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then
753     AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
754 fi
755 xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`"
756 mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`"
757 mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`"
758 if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then
759     AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
760 fi
761
762 AC_PATH_PROG(INTLTOOL_PERL, perl)
763 if test -z "$INTLTOOL_PERL"; then
764    AC_MSG_ERROR([perl not found])
765 fi
766 AC_MSG_CHECKING([for perl >= 5.8.1])
767 $INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1
768 if test $? -ne 0; then
769    AC_MSG_ERROR([perl 5.8.1 is required for intltool])
770 else
771    IT_PERL_VERSION="`$INTLTOOL_PERL -e \"printf '%vd', $^V\"`"
772    AC_MSG_RESULT([$IT_PERL_VERSION])
773 fi
774 if test "x$2" != "xno-xml"; then
775    AC_MSG_CHECKING([for XML::Parser])
776    if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then
777        AC_MSG_RESULT([ok])
778    else
779        AC_MSG_ERROR([XML::Parser perl module is required for intltool])
780    fi
781 fi
782
783 # Substitute ALL_LINGUAS so we can use it in po/Makefile
784 AC_SUBST(ALL_LINGUAS)
785
786 # Set DATADIRNAME correctly if it is not set yet
787 # (copied from glib-gettext.m4)
788 if test -z "$DATADIRNAME"; then
789   AC_LINK_IFELSE(
790     [AC_LANG_PROGRAM([[]],
791                      [[extern int _nl_msg_cat_cntr;
792                        return _nl_msg_cat_cntr]])],
793     [DATADIRNAME=share],
794     [case $host in
795     *-*-solaris*)
796     dnl On Solaris, if bind_textdomain_codeset is in libc,
797     dnl GNU format message catalog is always supported,
798     dnl since both are added to the libc all together.
799     dnl Hence, we'd like to go with DATADIRNAME=share
800     dnl in this case.
801     AC_CHECK_FUNC(bind_textdomain_codeset,
802       [DATADIRNAME=share], [DATADIRNAME=lib])
803     ;;
804     *)
805     [DATADIRNAME=lib]
806     ;;
807     esac])
808 fi
809 AC_SUBST(DATADIRNAME)
810
811 IT_PO_SUBDIR([po])
812
813 ])
814
815
816 # IT_PO_SUBDIR(DIRNAME)
817 # ---------------------
818 # All po subdirs have to be declared with this macro; the subdir "po" is
819 # declared by IT_PROG_INTLTOOL.
820 #
821 AC_DEFUN([IT_PO_SUBDIR],
822 [AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS.
823 dnl
824 dnl The following CONFIG_COMMANDS should be executed at the very end
825 dnl of config.status.
826 AC_CONFIG_COMMANDS_PRE([
827   AC_CONFIG_COMMANDS([$1/stamp-it], [
828     if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then
829        AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.])
830     fi
831     rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp"
832     >"$1/stamp-it.tmp"
833     [sed '/^#/d
834          s/^[[].*] *//
835          /^[    ]*$/d
836         '"s|^|  $ac_top_srcdir/|" \
837       "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES"
838     ]
839     [sed '/^POTFILES =/,/[^\\]$/ {
840                 /^POTFILES =/!d
841                 r $1/POTFILES
842           }
843          ' "$1/Makefile.in" >"$1/Makefile"]
844     rm -f "$1/Makefile.tmp"
845     mv "$1/stamp-it.tmp" "$1/stamp-it"
846   ])
847 ])dnl
848 ])
849
850 # _IT_SUBST(VARIABLE)
851 # -------------------
852 # Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
853 #
854 AC_DEFUN([_IT_SUBST],
855 [
856 AC_SUBST([$1])
857 m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
858 ]
859 )
860
861 # deprecated macros
862 AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL])
863 # A hint is needed for aclocal from Automake <= 1.9.4:
864 # AC_DEFUN([AC_PROG_INTLTOOL], ...)
865
866
867 # lib-ld.m4 serial 4 (gettext-0.18)
868 dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
869 dnl This file is free software; the Free Software Foundation
870 dnl gives unlimited permission to copy and/or distribute it,
871 dnl with or without modifications, as long as this notice is preserved.
872
873 dnl Subroutines of libtool.m4,
874 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
875 dnl with libtool.m4.
876
877 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
878 AC_DEFUN([AC_LIB_PROG_LD_GNU],
879 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
880 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
881 case `$LD -v 2>&1 </dev/null` in
882 *GNU* | *'with BFD'*)
883   acl_cv_prog_gnu_ld=yes ;;
884 *)
885   acl_cv_prog_gnu_ld=no ;;
886 esac])
887 with_gnu_ld=$acl_cv_prog_gnu_ld
888 ])
889
890 dnl From libtool-1.4. Sets the variable LD.
891 AC_DEFUN([AC_LIB_PROG_LD],
892 [AC_ARG_WITH([gnu-ld],
893 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
894 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
895 AC_REQUIRE([AC_PROG_CC])dnl
896 AC_REQUIRE([AC_CANONICAL_HOST])dnl
897 # Prepare PATH_SEPARATOR.
898 # The user is always right.
899 if test "${PATH_SEPARATOR+set}" != set; then
900   echo "#! /bin/sh" >conf$$.sh
901   echo  "exit 0"   >>conf$$.sh
902   chmod +x conf$$.sh
903   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
904     PATH_SEPARATOR=';'
905   else
906     PATH_SEPARATOR=:
907   fi
908   rm -f conf$$.sh
909 fi
910 ac_prog=ld
911 if test "$GCC" = yes; then
912   # Check if gcc -print-prog-name=ld gives a path.
913   AC_MSG_CHECKING([for ld used by GCC])
914   case $host in
915   *-*-mingw*)
916     # gcc leaves a trailing carriage return which upsets mingw
917     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
918   *)
919     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
920   esac
921   case $ac_prog in
922     # Accept absolute paths.
923     [[\\/]* | [A-Za-z]:[\\/]*)]
924       [re_direlt='/[^/][^/]*/\.\./']
925       # Canonicalize the path of ld
926       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
927       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
928         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
929       done
930       test -z "$LD" && LD="$ac_prog"
931       ;;
932   "")
933     # If it fails, then pretend we aren't using GCC.
934     ac_prog=ld
935     ;;
936   *)
937     # If it is relative, then search for the first ld in PATH.
938     with_gnu_ld=unknown
939     ;;
940   esac
941 elif test "$with_gnu_ld" = yes; then
942   AC_MSG_CHECKING([for GNU ld])
943 else
944   AC_MSG_CHECKING([for non-GNU ld])
945 fi
946 AC_CACHE_VAL([acl_cv_path_LD],
947 [if test -z "$LD"; then
948   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
949   for ac_dir in $PATH; do
950     test -z "$ac_dir" && ac_dir=.
951     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
952       acl_cv_path_LD="$ac_dir/$ac_prog"
953       # Check to see if the program is GNU ld.  I'd rather use --version,
954       # but apparently some GNU ld's only accept -v.
955       # Break only if it was the GNU/non-GNU ld that we prefer.
956       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
957       *GNU* | *'with BFD'*)
958         test "$with_gnu_ld" != no && break ;;
959       *)
960         test "$with_gnu_ld" != yes && break ;;
961       esac
962     fi
963   done
964   IFS="$ac_save_ifs"
965 else
966   acl_cv_path_LD="$LD" # Let the user override the test with a path.
967 fi])
968 LD="$acl_cv_path_LD"
969 if test -n "$LD"; then
970   AC_MSG_RESULT([$LD])
971 else
972   AC_MSG_RESULT([no])
973 fi
974 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
975 AC_LIB_PROG_LD_GNU
976 ])
977
978 # lib-link.m4 serial 21 (gettext-0.18)
979 dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
980 dnl This file is free software; the Free Software Foundation
981 dnl gives unlimited permission to copy and/or distribute it,
982 dnl with or without modifications, as long as this notice is preserved.
983
984 dnl From Bruno Haible.
985
986 AC_PREREQ([2.54])
987
988 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
989 dnl the libraries corresponding to explicit and implicit dependencies.
990 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
991 dnl augments the CPPFLAGS variable.
992 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
993 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
994 AC_DEFUN([AC_LIB_LINKFLAGS],
995 [
996   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
997   AC_REQUIRE([AC_LIB_RPATH])
998   pushdef([Name],[translit([$1],[./-], [___])])
999   pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1000                                 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1001   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1002     AC_LIB_LINKFLAGS_BODY([$1], [$2])
1003     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1004     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1005     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1006     ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
1007   ])
1008   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1009   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1010   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1011   LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
1012   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1013   AC_SUBST([LIB]NAME)
1014   AC_SUBST([LTLIB]NAME)
1015   AC_SUBST([LIB]NAME[_PREFIX])
1016   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1017   dnl results of this search when this library appears as a dependency.
1018   HAVE_LIB[]NAME=yes
1019   popdef([NAME])
1020   popdef([Name])
1021 ])
1022
1023 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
1024 dnl searches for libname and the libraries corresponding to explicit and
1025 dnl implicit dependencies, together with the specified include files and
1026 dnl the ability to compile and link the specified testcode. The missing-message
1027 dnl defaults to 'no' and may contain additional hints for the user.
1028 dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
1029 dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1030 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1031 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1032 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
1033 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
1034 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1035 [
1036   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1037   AC_REQUIRE([AC_LIB_RPATH])
1038   pushdef([Name],[translit([$1],[./-], [___])])
1039   pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1040                                 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1041
1042   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1043   dnl accordingly.
1044   AC_LIB_LINKFLAGS_BODY([$1], [$2])
1045
1046   dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1047   dnl because if the user has installed lib[]Name and not disabled its use
1048   dnl via --without-lib[]Name-prefix, he wants to use it.
1049   ac_save_CPPFLAGS="$CPPFLAGS"
1050   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1051
1052   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1053     ac_save_LIBS="$LIBS"
1054     dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
1055     dnl because these -l options might require -L options that are present in
1056     dnl LIBS. -l options benefit only from the -L options listed before it.
1057     dnl Otherwise, add it to the front of LIBS, because it may be a static
1058     dnl library that depends on another static library that is present in LIBS.
1059     dnl Static libraries benefit only from the static libraries listed after
1060     dnl it.
1061     case " $LIB[]NAME" in
1062       *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
1063       *)       LIBS="$LIB[]NAME $LIBS" ;;
1064     esac
1065     AC_TRY_LINK([$3], [$4],
1066       [ac_cv_lib[]Name=yes],
1067       [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
1068     LIBS="$ac_save_LIBS"
1069   ])
1070   if test "$ac_cv_lib[]Name" = yes; then
1071     HAVE_LIB[]NAME=yes
1072     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
1073     AC_MSG_CHECKING([how to link with lib[]$1])
1074     AC_MSG_RESULT([$LIB[]NAME])
1075   else
1076     HAVE_LIB[]NAME=no
1077     dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1078     dnl $INC[]NAME either.
1079     CPPFLAGS="$ac_save_CPPFLAGS"
1080     LIB[]NAME=
1081     LTLIB[]NAME=
1082     LIB[]NAME[]_PREFIX=
1083   fi
1084   AC_SUBST([HAVE_LIB]NAME)
1085   AC_SUBST([LIB]NAME)
1086   AC_SUBST([LTLIB]NAME)
1087   AC_SUBST([LIB]NAME[_PREFIX])
1088   popdef([NAME])
1089   popdef([Name])
1090 ])
1091
1092 dnl Determine the platform dependent parameters needed to use rpath:
1093 dnl   acl_libext,
1094 dnl   acl_shlibext,
1095 dnl   acl_hardcode_libdir_flag_spec,
1096 dnl   acl_hardcode_libdir_separator,
1097 dnl   acl_hardcode_direct,
1098 dnl   acl_hardcode_minus_L.
1099 AC_DEFUN([AC_LIB_RPATH],
1100 [
1101   dnl Tell automake >= 1.10 to complain if config.rpath is missing.
1102   m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
1103   AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1104   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1105   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1106   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1107   AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
1108     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1109     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1110     . ./conftest.sh
1111     rm -f ./conftest.sh
1112     acl_cv_rpath=done
1113   ])
1114   wl="$acl_cv_wl"
1115   acl_libext="$acl_cv_libext"
1116   acl_shlibext="$acl_cv_shlibext"
1117   acl_libname_spec="$acl_cv_libname_spec"
1118   acl_library_names_spec="$acl_cv_library_names_spec"
1119   acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1120   acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1121   acl_hardcode_direct="$acl_cv_hardcode_direct"
1122   acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
1123   dnl Determine whether the user wants rpath handling at all.
1124   AC_ARG_ENABLE([rpath],
1125     [  --disable-rpath         do not hardcode runtime library paths],
1126     :, enable_rpath=yes)
1127 ])
1128
1129 dnl AC_LIB_FROMPACKAGE(name, package)
1130 dnl declares that libname comes from the given package. The configure file
1131 dnl will then not have a --with-libname-prefix option but a
1132 dnl --with-package-prefix option. Several libraries can come from the same
1133 dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
1134 dnl macro call that searches for libname.
1135 AC_DEFUN([AC_LIB_FROMPACKAGE],
1136 [
1137   pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1138                                 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1139   define([acl_frompackage_]NAME, [$2])
1140   popdef([NAME])
1141   pushdef([PACK],[$2])
1142   pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
1143                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1144   define([acl_libsinpackage_]PACKUP,
1145     m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
1146   popdef([PACKUP])
1147   popdef([PACK])
1148 ])
1149
1150 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1151 dnl the libraries corresponding to explicit and implicit dependencies.
1152 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1153 dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
1154 dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
1155 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1156 [
1157   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1158   pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1159                                 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1160   pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
1161   pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
1162                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1163   pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
1164   dnl Autoconf >= 2.61 supports dots in --with options.
1165   pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
1166   dnl By default, look in $includedir and $libdir.
1167   use_additional=yes
1168   AC_LIB_WITH_FINAL_PREFIX([
1169     eval additional_includedir=\"$includedir\"
1170     eval additional_libdir=\"$libdir\"
1171   ])
1172   AC_ARG_WITH(P_A_C_K[-prefix],
1173 [[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
1174   --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
1175 [
1176     if test "X$withval" = "Xno"; then
1177       use_additional=no
1178     else
1179       if test "X$withval" = "X"; then
1180         AC_LIB_WITH_FINAL_PREFIX([
1181           eval additional_includedir=\"$includedir\"
1182           eval additional_libdir=\"$libdir\"
1183         ])
1184       else
1185         additional_includedir="$withval/include"
1186         additional_libdir="$withval/$acl_libdirstem"
1187         if test "$acl_libdirstem2" != "$acl_libdirstem" \
1188            && ! test -d "$withval/$acl_libdirstem"; then
1189           additional_libdir="$withval/$acl_libdirstem2"
1190         fi
1191       fi
1192     fi
1193 ])
1194   dnl Search the library and its dependencies in $additional_libdir and
1195   dnl $LDFLAGS. Using breadth-first-seach.
1196   LIB[]NAME=
1197   LTLIB[]NAME=
1198   INC[]NAME=
1199   LIB[]NAME[]_PREFIX=
1200   dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
1201   dnl computed. So it has to be reset here.
1202   HAVE_LIB[]NAME=
1203   rpathdirs=
1204   ltrpathdirs=
1205   names_already_handled=
1206   names_next_round='$1 $2'
1207   while test -n "$names_next_round"; do
1208     names_this_round="$names_next_round"
1209     names_next_round=
1210     for name in $names_this_round; do
1211       already_handled=
1212       for n in $names_already_handled; do
1213         if test "$n" = "$name"; then
1214           already_handled=yes
1215           break
1216         fi
1217       done
1218       if test -z "$already_handled"; then
1219         names_already_handled="$names_already_handled $name"
1220         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1221         dnl or AC_LIB_HAVE_LINKFLAGS call.
1222         uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1223         eval value=\"\$HAVE_LIB$uppername\"
1224         if test -n "$value"; then
1225           if test "$value" = yes; then
1226             eval value=\"\$LIB$uppername\"
1227             test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1228             eval value=\"\$LTLIB$uppername\"
1229             test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1230           else
1231             dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1232             dnl that this library doesn't exist. So just drop it.
1233             :
1234           fi
1235         else
1236           dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1237           dnl and the already constructed $LIBNAME/$LTLIBNAME.
1238           found_dir=
1239           found_la=
1240           found_so=
1241           found_a=
1242           eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
1243           if test -n "$acl_shlibext"; then
1244             shrext=".$acl_shlibext"             # typically: shrext=.so
1245           else
1246             shrext=
1247           fi
1248           if test $use_additional = yes; then
1249             dir="$additional_libdir"
1250             dnl The same code as in the loop below:
1251             dnl First look for a shared library.
1252             if test -n "$acl_shlibext"; then
1253               if test -f "$dir/$libname$shrext"; then
1254                 found_dir="$dir"
1255                 found_so="$dir/$libname$shrext"
1256               else
1257                 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
1258                   ver=`(cd "$dir" && \
1259                         for f in "$libname$shrext".*; do echo "$f"; done \
1260                         | sed -e "s,^$libname$shrext\\\\.,," \
1261                         | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
1262                         | sed 1q ) 2>/dev/null`
1263                   if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
1264                     found_dir="$dir"
1265                     found_so="$dir/$libname$shrext.$ver"
1266                   fi
1267                 else
1268                   eval library_names=\"$acl_library_names_spec\"
1269                   for f in $library_names; do
1270                     if test -f "$dir/$f"; then
1271                       found_dir="$dir"
1272                       found_so="$dir/$f"
1273                       break
1274                     fi
1275                   done
1276                 fi
1277               fi
1278             fi
1279             dnl Then look for a static library.
1280             if test "X$found_dir" = "X"; then
1281               if test -f "$dir/$libname.$acl_libext"; then
1282                 found_dir="$dir"
1283                 found_a="$dir/$libname.$acl_libext"
1284               fi
1285             fi
1286             if test "X$found_dir" != "X"; then
1287               if test -f "$dir/$libname.la"; then
1288                 found_la="$dir/$libname.la"
1289               fi
1290             fi
1291           fi
1292           if test "X$found_dir" = "X"; then
1293             for x in $LDFLAGS $LTLIB[]NAME; do
1294               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1295               case "$x" in
1296                 -L*)
1297                   dir=`echo "X$x" | sed -e 's/^X-L//'`
1298                   dnl First look for a shared library.
1299                   if test -n "$acl_shlibext"; then
1300                     if test -f "$dir/$libname$shrext"; then
1301                       found_dir="$dir"
1302                       found_so="$dir/$libname$shrext"
1303                     else
1304                       if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
1305                         ver=`(cd "$dir" && \
1306                               for f in "$libname$shrext".*; do echo "$f"; done \
1307                               | sed -e "s,^$libname$shrext\\\\.,," \
1308                               | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
1309                               | sed 1q ) 2>/dev/null`
1310                         if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
1311                           found_dir="$dir"
1312                           found_so="$dir/$libname$shrext.$ver"
1313                         fi
1314                       else
1315                         eval library_names=\"$acl_library_names_spec\"
1316                         for f in $library_names; do
1317                           if test -f "$dir/$f"; then
1318                             found_dir="$dir"
1319                             found_so="$dir/$f"
1320                             break
1321                           fi
1322                         done
1323                       fi
1324                     fi
1325                   fi
1326                   dnl Then look for a static library.
1327                   if test "X$found_dir" = "X"; then
1328                     if test -f "$dir/$libname.$acl_libext"; then
1329                       found_dir="$dir"
1330                       found_a="$dir/$libname.$acl_libext"
1331                     fi
1332                   fi
1333                   if test "X$found_dir" != "X"; then
1334                     if test -f "$dir/$libname.la"; then
1335                       found_la="$dir/$libname.la"
1336                     fi
1337                   fi
1338                   ;;
1339               esac
1340               if test "X$found_dir" != "X"; then
1341                 break
1342               fi
1343             done
1344           fi
1345           if test "X$found_dir" != "X"; then
1346             dnl Found the library.
1347             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1348             if test "X$found_so" != "X"; then
1349               dnl Linking with a shared library. We attempt to hardcode its
1350               dnl directory into the executable's runpath, unless it's the
1351               dnl standard /usr/lib.
1352               if test "$enable_rpath" = no \
1353                  || test "X$found_dir" = "X/usr/$acl_libdirstem" \
1354                  || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
1355                 dnl No hardcoding is needed.
1356                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1357               else
1358                 dnl Use an explicit option to hardcode DIR into the resulting
1359                 dnl binary.
1360                 dnl Potentially add DIR to ltrpathdirs.
1361                 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1362                 haveit=
1363                 for x in $ltrpathdirs; do
1364                   if test "X$x" = "X$found_dir"; then
1365                     haveit=yes
1366                     break
1367                   fi
1368                 done
1369                 if test -z "$haveit"; then
1370                   ltrpathdirs="$ltrpathdirs $found_dir"
1371                 fi
1372                 dnl The hardcoding into $LIBNAME is system dependent.
1373                 if test "$acl_hardcode_direct" = yes; then
1374                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1375                   dnl resulting binary.
1376                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1377                 else
1378                   if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
1379                     dnl Use an explicit option to hardcode DIR into the resulting
1380                     dnl binary.
1381                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1382                     dnl Potentially add DIR to rpathdirs.
1383                     dnl The rpathdirs will be appended to $LIBNAME at the end.
1384                     haveit=
1385                     for x in $rpathdirs; do
1386                       if test "X$x" = "X$found_dir"; then
1387                         haveit=yes
1388                         break
1389                       fi
1390                     done
1391                     if test -z "$haveit"; then
1392                       rpathdirs="$rpathdirs $found_dir"
1393                     fi
1394                   else
1395                     dnl Rely on "-L$found_dir".
1396                     dnl But don't add it if it's already contained in the LDFLAGS
1397                     dnl or the already constructed $LIBNAME
1398                     haveit=
1399                     for x in $LDFLAGS $LIB[]NAME; do
1400                       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1401                       if test "X$x" = "X-L$found_dir"; then
1402                         haveit=yes
1403                         break
1404                       fi
1405                     done
1406                     if test -z "$haveit"; then
1407                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1408                     fi
1409                     if test "$acl_hardcode_minus_L" != no; then
1410                       dnl FIXME: Not sure whether we should use
1411                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1412                       dnl here.
1413                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1414                     else
1415                       dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
1416                       dnl here, because this doesn't fit in flags passed to the
1417                       dnl compiler. So give up. No hardcoding. This affects only
1418                       dnl very old systems.
1419                       dnl FIXME: Not sure whether we should use
1420                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1421                       dnl here.
1422                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1423                     fi
1424                   fi
1425                 fi
1426               fi
1427             else
1428               if test "X$found_a" != "X"; then
1429                 dnl Linking with a static library.
1430                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1431               else
1432                 dnl We shouldn't come here, but anyway it's good to have a
1433                 dnl fallback.
1434                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1435               fi
1436             fi
1437             dnl Assume the include files are nearby.
1438             additional_includedir=
1439             case "$found_dir" in
1440               */$acl_libdirstem | */$acl_libdirstem/)
1441                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
1442                 if test "$name" = '$1'; then
1443                   LIB[]NAME[]_PREFIX="$basedir"
1444                 fi
1445                 additional_includedir="$basedir/include"
1446                 ;;
1447               */$acl_libdirstem2 | */$acl_libdirstem2/)
1448                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
1449                 if test "$name" = '$1'; then
1450                   LIB[]NAME[]_PREFIX="$basedir"
1451                 fi
1452                 additional_includedir="$basedir/include"
1453                 ;;
1454             esac
1455             if test "X$additional_includedir" != "X"; then
1456               dnl Potentially add $additional_includedir to $INCNAME.
1457               dnl But don't add it
1458               dnl   1. if it's the standard /usr/include,
1459               dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1460               dnl   3. if it's already present in $CPPFLAGS or the already
1461               dnl      constructed $INCNAME,
1462               dnl   4. if it doesn't exist as a directory.
1463               if test "X$additional_includedir" != "X/usr/include"; then
1464                 haveit=
1465                 if test "X$additional_includedir" = "X/usr/local/include"; then
1466                   if test -n "$GCC"; then
1467                     case $host_os in
1468                       linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1469                     esac
1470                   fi
1471                 fi
1472                 if test -z "$haveit"; then
1473                   for x in $CPPFLAGS $INC[]NAME; do
1474                     AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1475                     if test "X$x" = "X-I$additional_includedir"; then
1476                       haveit=yes
1477                       break
1478                     fi
1479                   done
1480                   if test -z "$haveit"; then
1481                     if test -d "$additional_includedir"; then
1482                       dnl Really add $additional_includedir to $INCNAME.
1483                       INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1484                     fi
1485                   fi
1486                 fi
1487               fi
1488             fi
1489             dnl Look for dependencies.
1490             if test -n "$found_la"; then
1491               dnl Read the .la file. It defines the variables
1492               dnl dlname, library_names, old_library, dependency_libs, current,
1493               dnl age, revision, installed, dlopen, dlpreopen, libdir.
1494               save_libdir="$libdir"
1495               case "$found_la" in
1496                 */* | *\\*) . "$found_la" ;;
1497                 *) . "./$found_la" ;;
1498               esac
1499               libdir="$save_libdir"
1500               dnl We use only dependency_libs.
1501               for dep in $dependency_libs; do
1502                 case "$dep" in
1503                   -L*)
1504                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1505                     dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1506                     dnl But don't add it
1507                     dnl   1. if it's the standard /usr/lib,
1508                     dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1509                     dnl   3. if it's already present in $LDFLAGS or the already
1510                     dnl      constructed $LIBNAME,
1511                     dnl   4. if it doesn't exist as a directory.
1512                     if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
1513                        && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
1514                       haveit=
1515                       if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
1516                          || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
1517                         if test -n "$GCC"; then
1518                           case $host_os in
1519                             linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1520                           esac
1521                         fi
1522                       fi
1523                       if test -z "$haveit"; then
1524                         haveit=
1525                         for x in $LDFLAGS $LIB[]NAME; do
1526                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1527                           if test "X$x" = "X-L$additional_libdir"; then
1528                             haveit=yes
1529                             break
1530                           fi
1531                         done
1532                         if test -z "$haveit"; then
1533                           if test -d "$additional_libdir"; then
1534                             dnl Really add $additional_libdir to $LIBNAME.
1535                             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1536                           fi
1537                         fi
1538                         haveit=
1539                         for x in $LDFLAGS $LTLIB[]NAME; do
1540                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1541                           if test "X$x" = "X-L$additional_libdir"; then
1542                             haveit=yes
1543                             break
1544                           fi
1545                         done
1546                         if test -z "$haveit"; then
1547                           if test -d "$additional_libdir"; then
1548                             dnl Really add $additional_libdir to $LTLIBNAME.
1549                             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1550                           fi
1551                         fi
1552                       fi
1553                     fi
1554                     ;;
1555                   -R*)
1556                     dir=`echo "X$dep" | sed -e 's/^X-R//'`
1557                     if test "$enable_rpath" != no; then
1558                       dnl Potentially add DIR to rpathdirs.
1559                       dnl The rpathdirs will be appended to $LIBNAME at the end.
1560                       haveit=
1561                       for x in $rpathdirs; do
1562                         if test "X$x" = "X$dir"; then
1563                           haveit=yes
1564                           break
1565                         fi
1566                       done
1567                       if test -z "$haveit"; then
1568                         rpathdirs="$rpathdirs $dir"
1569                       fi
1570                       dnl Potentially add DIR to ltrpathdirs.
1571                       dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1572                       haveit=
1573                       for x in $ltrpathdirs; do
1574                         if test "X$x" = "X$dir"; then
1575                           haveit=yes
1576                           break
1577                         fi
1578                       done
1579                       if test -z "$haveit"; then
1580                         ltrpathdirs="$ltrpathdirs $dir"
1581                       fi
1582                     fi
1583                     ;;
1584                   -l*)
1585                     dnl Handle this in the next round.
1586                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1587                     ;;
1588                   *.la)
1589                     dnl Handle this in the next round. Throw away the .la's
1590                     dnl directory; it is already contained in a preceding -L
1591                     dnl option.
1592                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1593                     ;;
1594                   *)
1595                     dnl Most likely an immediate library name.
1596                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1597                     LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1598                     ;;
1599                 esac
1600               done
1601             fi
1602           else
1603             dnl Didn't find the library; assume it is in the system directories
1604             dnl known to the linker and runtime loader. (All the system
1605             dnl directories known to the linker should also be known to the
1606             dnl runtime loader, otherwise the system is severely misconfigured.)
1607             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1608             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1609           fi
1610         fi
1611       fi
1612     done
1613   done
1614   if test "X$rpathdirs" != "X"; then
1615     if test -n "$acl_hardcode_libdir_separator"; then
1616       dnl Weird platform: only the last -rpath option counts, the user must
1617       dnl pass all path elements in one option. We can arrange that for a
1618       dnl single library, but not when more than one $LIBNAMEs are used.
1619       alldirs=
1620       for found_dir in $rpathdirs; do
1621         alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
1622       done
1623       dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
1624       acl_save_libdir="$libdir"
1625       libdir="$alldirs"
1626       eval flag=\"$acl_hardcode_libdir_flag_spec\"
1627       libdir="$acl_save_libdir"
1628       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1629     else
1630       dnl The -rpath options are cumulative.
1631       for found_dir in $rpathdirs; do
1632         acl_save_libdir="$libdir"
1633         libdir="$found_dir"
1634         eval flag=\"$acl_hardcode_libdir_flag_spec\"
1635         libdir="$acl_save_libdir"
1636         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1637       done
1638     fi
1639   fi
1640   if test "X$ltrpathdirs" != "X"; then
1641     dnl When using libtool, the option that works for both libraries and
1642     dnl executables is -R. The -R options are cumulative.
1643     for found_dir in $ltrpathdirs; do
1644       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1645     done
1646   fi
1647   popdef([P_A_C_K])
1648   popdef([PACKLIBS])
1649   popdef([PACKUP])
1650   popdef([PACK])
1651   popdef([NAME])
1652 ])
1653
1654 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1655 dnl unless already present in VAR.
1656 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1657 dnl contains two or three consecutive elements that belong together.
1658 AC_DEFUN([AC_LIB_APPENDTOVAR],
1659 [
1660   for element in [$2]; do
1661     haveit=
1662     for x in $[$1]; do
1663       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1664       if test "X$x" = "X$element"; then
1665         haveit=yes
1666         break
1667       fi
1668     done
1669     if test -z "$haveit"; then
1670       [$1]="${[$1]}${[$1]:+ }$element"
1671     fi
1672   done
1673 ])
1674
1675 dnl For those cases where a variable contains several -L and -l options
1676 dnl referring to unknown libraries and directories, this macro determines the
1677 dnl necessary additional linker options for the runtime path.
1678 dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
1679 dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
1680 dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
1681 dnl otherwise linking without libtool is assumed.
1682 AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
1683 [
1684   AC_REQUIRE([AC_LIB_RPATH])
1685   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1686   $1=
1687   if test "$enable_rpath" != no; then
1688     if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
1689       dnl Use an explicit option to hardcode directories into the resulting
1690       dnl binary.
1691       rpathdirs=
1692       next=
1693       for opt in $2; do
1694         if test -n "$next"; then
1695           dir="$next"
1696           dnl No need to hardcode the standard /usr/lib.
1697           if test "X$dir" != "X/usr/$acl_libdirstem" \
1698              && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1699             rpathdirs="$rpathdirs $dir"
1700           fi
1701           next=
1702         else
1703           case $opt in
1704             -L) next=yes ;;
1705             -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
1706                  dnl No need to hardcode the standard /usr/lib.
1707                  if test "X$dir" != "X/usr/$acl_libdirstem" \
1708                     && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1709                    rpathdirs="$rpathdirs $dir"
1710                  fi
1711                  next= ;;
1712             *) next= ;;
1713           esac
1714         fi
1715       done
1716       if test "X$rpathdirs" != "X"; then
1717         if test -n ""$3""; then
1718           dnl libtool is used for linking. Use -R options.
1719           for dir in $rpathdirs; do
1720             $1="${$1}${$1:+ }-R$dir"
1721           done
1722         else
1723           dnl The linker is used for linking directly.
1724           if test -n "$acl_hardcode_libdir_separator"; then
1725             dnl Weird platform: only the last -rpath option counts, the user
1726             dnl must pass all path elements in one option.
1727             alldirs=
1728             for dir in $rpathdirs; do
1729               alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
1730             done
1731             acl_save_libdir="$libdir"
1732             libdir="$alldirs"
1733             eval flag=\"$acl_hardcode_libdir_flag_spec\"
1734             libdir="$acl_save_libdir"
1735             $1="$flag"
1736           else
1737             dnl The -rpath options are cumulative.
1738             for dir in $rpathdirs; do
1739               acl_save_libdir="$libdir"
1740               libdir="$dir"
1741               eval flag=\"$acl_hardcode_libdir_flag_spec\"
1742               libdir="$acl_save_libdir"
1743               $1="${$1}${$1:+ }$flag"
1744             done
1745           fi
1746         fi
1747       fi
1748     fi
1749   fi
1750   AC_SUBST([$1])
1751 ])
1752
1753 # lib-prefix.m4 serial 7 (gettext-0.18)
1754 dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc.
1755 dnl This file is free software; the Free Software Foundation
1756 dnl gives unlimited permission to copy and/or distribute it,
1757 dnl with or without modifications, as long as this notice is preserved.
1758
1759 dnl From Bruno Haible.
1760
1761 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
1762 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
1763 dnl require excessive bracketing.
1764 ifdef([AC_HELP_STRING],
1765 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
1766 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
1767
1768 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1769 dnl to access previously installed libraries. The basic assumption is that
1770 dnl a user will want packages to use other packages he previously installed
1771 dnl with the same --prefix option.
1772 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1773 dnl libraries, but is otherwise very convenient.
1774 AC_DEFUN([AC_LIB_PREFIX],
1775 [
1776   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1777   AC_REQUIRE([AC_PROG_CC])
1778   AC_REQUIRE([AC_CANONICAL_HOST])
1779   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1780   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1781   dnl By default, look in $includedir and $libdir.
1782   use_additional=yes
1783   AC_LIB_WITH_FINAL_PREFIX([
1784     eval additional_includedir=\"$includedir\"
1785     eval additional_libdir=\"$libdir\"
1786   ])
1787   AC_LIB_ARG_WITH([lib-prefix],
1788 [  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1789   --without-lib-prefix    don't search for libraries in includedir and libdir],
1790 [
1791     if test "X$withval" = "Xno"; then
1792       use_additional=no
1793     else
1794       if test "X$withval" = "X"; then
1795         AC_LIB_WITH_FINAL_PREFIX([
1796           eval additional_includedir=\"$includedir\"
1797           eval additional_libdir=\"$libdir\"
1798         ])
1799       else
1800         additional_includedir="$withval/include"
1801         additional_libdir="$withval/$acl_libdirstem"
1802       fi
1803     fi
1804 ])
1805   if test $use_additional = yes; then
1806     dnl Potentially add $additional_includedir to $CPPFLAGS.
1807     dnl But don't add it
1808     dnl   1. if it's the standard /usr/include,
1809     dnl   2. if it's already present in $CPPFLAGS,
1810     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1811     dnl   4. if it doesn't exist as a directory.
1812     if test "X$additional_includedir" != "X/usr/include"; then
1813       haveit=
1814       for x in $CPPFLAGS; do
1815         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1816         if test "X$x" = "X-I$additional_includedir"; then
1817           haveit=yes
1818           break
1819         fi
1820       done
1821       if test -z "$haveit"; then
1822         if test "X$additional_includedir" = "X/usr/local/include"; then
1823           if test -n "$GCC"; then
1824             case $host_os in
1825               linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1826             esac
1827           fi
1828         fi
1829         if test -z "$haveit"; then
1830           if test -d "$additional_includedir"; then
1831             dnl Really add $additional_includedir to $CPPFLAGS.
1832             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1833           fi
1834         fi
1835       fi
1836     fi
1837     dnl Potentially add $additional_libdir to $LDFLAGS.
1838     dnl But don't add it
1839     dnl   1. if it's the standard /usr/lib,
1840     dnl   2. if it's already present in $LDFLAGS,
1841     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
1842     dnl   4. if it doesn't exist as a directory.
1843     if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
1844       haveit=
1845       for x in $LDFLAGS; do
1846         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1847         if test "X$x" = "X-L$additional_libdir"; then
1848           haveit=yes
1849           break
1850         fi
1851       done
1852       if test -z "$haveit"; then
1853         if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
1854           if test -n "$GCC"; then
1855             case $host_os in
1856               linux*) haveit=yes;;
1857             esac
1858           fi
1859         fi
1860         if test -z "$haveit"; then
1861           if test -d "$additional_libdir"; then
1862             dnl Really add $additional_libdir to $LDFLAGS.
1863             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1864           fi
1865         fi
1866       fi
1867     fi
1868   fi
1869 ])
1870
1871 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1872 dnl acl_final_exec_prefix, containing the values to which $prefix and
1873 dnl $exec_prefix will expand at the end of the configure script.
1874 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
1875 [
1876   dnl Unfortunately, prefix and exec_prefix get only finally determined
1877   dnl at the end of configure.
1878   if test "X$prefix" = "XNONE"; then
1879     acl_final_prefix="$ac_default_prefix"
1880   else
1881     acl_final_prefix="$prefix"
1882   fi
1883   if test "X$exec_prefix" = "XNONE"; then
1884     acl_final_exec_prefix='${prefix}'
1885   else
1886     acl_final_exec_prefix="$exec_prefix"
1887   fi
1888   acl_save_prefix="$prefix"
1889   prefix="$acl_final_prefix"
1890   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1891   prefix="$acl_save_prefix"
1892 ])
1893
1894 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1895 dnl variables prefix and exec_prefix bound to the values they will have
1896 dnl at the end of the configure script.
1897 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1898 [
1899   acl_save_prefix="$prefix"
1900   prefix="$acl_final_prefix"
1901   acl_save_exec_prefix="$exec_prefix"
1902   exec_prefix="$acl_final_exec_prefix"
1903   $1
1904   exec_prefix="$acl_save_exec_prefix"
1905   prefix="$acl_save_prefix"
1906 ])
1907
1908 dnl AC_LIB_PREPARE_MULTILIB creates
1909 dnl - a variable acl_libdirstem, containing the basename of the libdir, either
1910 dnl   "lib" or "lib64" or "lib/64",
1911 dnl - a variable acl_libdirstem2, as a secondary possible value for
1912 dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
1913 dnl   "lib/amd64".
1914 AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
1915 [
1916   dnl There is no formal standard regarding lib and lib64.
1917   dnl On glibc systems, the current practice is that on a system supporting
1918   dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1919   dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
1920   dnl the compiler's default mode by looking at the compiler's library search
1921   dnl path. If at least one of its elements ends in /lib64 or points to a
1922   dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
1923   dnl Otherwise we use the default, namely "lib".
1924   dnl On Solaris systems, the current practice is that on a system supporting
1925   dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1926   dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
1927   dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
1928   AC_REQUIRE([AC_CANONICAL_HOST])
1929   acl_libdirstem=lib
1930   acl_libdirstem2=
1931   case "$host_os" in
1932     solaris*)
1933       dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
1934       dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
1935       dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
1936       dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
1937       dnl symlink is missing, so we set acl_libdirstem2 too.
1938       AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
1939         [AC_EGREP_CPP([sixtyfour bits], [
1940 #ifdef _LP64
1941 sixtyfour bits
1942 #endif
1943            ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
1944         ])
1945       if test $gl_cv_solaris_64bit = yes; then
1946         acl_libdirstem=lib/64
1947         case "$host_cpu" in
1948           sparc*)        acl_libdirstem2=lib/sparcv9 ;;
1949           i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
1950         esac
1951       fi
1952       ;;
1953     *)
1954       searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
1955       if test -n "$searchpath"; then
1956         acl_save_IFS="${IFS=    }"; IFS=":"
1957         for searchdir in $searchpath; do
1958           if test -d "$searchdir"; then
1959             case "$searchdir" in
1960               */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
1961               */../ | */.. )
1962                 # Better ignore directories of this form. They are misleading.
1963                 ;;
1964               *) searchdir=`cd "$searchdir" && pwd`
1965                  case "$searchdir" in
1966                    */lib64 ) acl_libdirstem=lib64 ;;
1967                  esac ;;
1968             esac
1969           fi
1970         done
1971         IFS="$acl_save_IFS"
1972       fi
1973       ;;
1974   esac
1975   test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
1976 ])
1977
1978 # nls.m4 serial 5 (gettext-0.18)
1979 dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation,
1980 dnl Inc.
1981 dnl This file is free software; the Free Software Foundation
1982 dnl gives unlimited permission to copy and/or distribute it,
1983 dnl with or without modifications, as long as this notice is preserved.
1984 dnl
1985 dnl This file can can be used in projects which are not available under
1986 dnl the GNU General Public License or the GNU Library General Public
1987 dnl License but which still want to provide support for the GNU gettext
1988 dnl functionality.
1989 dnl Please note that the actual code of the GNU gettext library is covered
1990 dnl by the GNU Library General Public License, and the rest of the GNU
1991 dnl gettext package package is covered by the GNU General Public License.
1992 dnl They are *not* in the public domain.
1993
1994 dnl Authors:
1995 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1996 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1997
1998 AC_PREREQ([2.50])
1999
2000 AC_DEFUN([AM_NLS],
2001 [
2002   AC_MSG_CHECKING([whether NLS is requested])
2003   dnl Default is enabled NLS
2004   AC_ARG_ENABLE([nls],
2005     [  --disable-nls           do not use Native Language Support],
2006     USE_NLS=$enableval, USE_NLS=yes)
2007   AC_MSG_RESULT([$USE_NLS])
2008   AC_SUBST([USE_NLS])
2009 ])
2010
2011 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2012 # serial 1 (pkg-config-0.24)
2013
2014 # Copyright Â© 2004 Scott James Remnant <scott@netsplit.com>.
2015 #
2016 # This program is free software; you can redistribute it and/or modify
2017 # it under the terms of the GNU General Public License as published by
2018 # the Free Software Foundation; either version 2 of the License, or
2019 # (at your option) any later version.
2020 #
2021 # This program is distributed in the hope that it will be useful, but
2022 # WITHOUT ANY WARRANTY; without even the implied warranty of
2023 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2024 # General Public License for more details.
2025 #
2026 # You should have received a copy of the GNU General Public License
2027 # along with this program; if not, write to the Free Software
2028 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2029 #
2030 # As a special exception to the GNU General Public License, if you
2031 # distribute this file as part of a program that contains a
2032 # configuration script generated by Autoconf, you may include it under
2033 # the same distribution terms that you use for the rest of that program.
2034
2035 # PKG_PROG_PKG_CONFIG([MIN-VERSION])
2036 # ----------------------------------
2037 AC_DEFUN([PKG_PROG_PKG_CONFIG],
2038 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2039 m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2040 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
2041 AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
2042 AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
2043
2044 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2045         AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2046 fi
2047 if test -n "$PKG_CONFIG"; then
2048         _pkg_min_version=m4_default([$1], [0.9.0])
2049         AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2050         if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2051                 AC_MSG_RESULT([yes])
2052         else
2053                 AC_MSG_RESULT([no])
2054                 PKG_CONFIG=""
2055         fi
2056 fi[]dnl
2057 ])# PKG_PROG_PKG_CONFIG
2058
2059 # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2060 #
2061 # Check to see whether a particular set of modules exists.  Similar
2062 # to PKG_CHECK_MODULES(), but does not set variables or print errors.
2063 #
2064 # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2065 # only at the first occurence in configure.ac, so if the first place
2066 # it's called might be skipped (such as if it is within an "if", you
2067 # have to call PKG_CHECK_EXISTS manually
2068 # --------------------------------------------------------------
2069 AC_DEFUN([PKG_CHECK_EXISTS],
2070 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2071 if test -n "$PKG_CONFIG" && \
2072     AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2073   m4_default([$2], [:])
2074 m4_ifvaln([$3], [else
2075   $3])dnl
2076 fi])
2077
2078 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2079 # ---------------------------------------------
2080 m4_define([_PKG_CONFIG],
2081 [if test -n "$$1"; then
2082     pkg_cv_[]$1="$$1"
2083  elif test -n "$PKG_CONFIG"; then
2084     PKG_CHECK_EXISTS([$3],
2085                      [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2086                      [pkg_failed=yes])
2087  else
2088     pkg_failed=untried
2089 fi[]dnl
2090 ])# _PKG_CONFIG
2091
2092 # _PKG_SHORT_ERRORS_SUPPORTED
2093 # -----------------------------
2094 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2095 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2096 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2097         _pkg_short_errors_supported=yes
2098 else
2099         _pkg_short_errors_supported=no
2100 fi[]dnl
2101 ])# _PKG_SHORT_ERRORS_SUPPORTED
2102
2103
2104 # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2105 # [ACTION-IF-NOT-FOUND])
2106 #
2107 #
2108 # Note that if there is a possibility the first call to
2109 # PKG_CHECK_MODULES might not happen, you should be sure to include an
2110 # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2111 #
2112 #
2113 # --------------------------------------------------------------
2114 AC_DEFUN([PKG_CHECK_MODULES],
2115 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2116 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2117 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2118
2119 pkg_failed=no
2120 AC_MSG_CHECKING([for $1])
2121
2122 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2123 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
2124
2125 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2126 and $1[]_LIBS to avoid the need to call pkg-config.
2127 See the pkg-config man page for more details.])
2128
2129 if test $pkg_failed = yes; then
2130         AC_MSG_RESULT([no])
2131         _PKG_SHORT_ERRORS_SUPPORTED
2132         if test $_pkg_short_errors_supported = yes; then
2133                 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2134         else 
2135                 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2136         fi
2137         # Put the nasty error message in config.log where it belongs
2138         echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2139
2140         m4_default([$4], [AC_MSG_ERROR(
2141 [Package requirements ($2) were not met:
2142
2143 $$1_PKG_ERRORS
2144
2145 Consider adjusting the PKG_CONFIG_PATH environment variable if you
2146 installed software in a non-standard prefix.
2147
2148 _PKG_TEXT])
2149         ])
2150 elif test $pkg_failed = untried; then
2151         AC_MSG_RESULT([no])
2152         m4_default([$4], [AC_MSG_FAILURE(
2153 [The pkg-config script could not be found or is too old.  Make sure it
2154 is in your PATH or set the PKG_CONFIG environment variable to the full
2155 path to pkg-config.
2156
2157 _PKG_TEXT
2158
2159 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
2160         ])
2161 else
2162         $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2163         $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2164         AC_MSG_RESULT([yes])
2165         $3
2166 fi[]dnl
2167 ])# PKG_CHECK_MODULES
2168
2169 # po.m4 serial 17 (gettext-0.18)
2170 dnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
2171 dnl This file is free software; the Free Software Foundation
2172 dnl gives unlimited permission to copy and/or distribute it,
2173 dnl with or without modifications, as long as this notice is preserved.
2174 dnl
2175 dnl This file can can be used in projects which are not available under
2176 dnl the GNU General Public License or the GNU Library General Public
2177 dnl License but which still want to provide support for the GNU gettext
2178 dnl functionality.
2179 dnl Please note that the actual code of the GNU gettext library is covered
2180 dnl by the GNU Library General Public License, and the rest of the GNU
2181 dnl gettext package package is covered by the GNU General Public License.
2182 dnl They are *not* in the public domain.
2183
2184 dnl Authors:
2185 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
2186 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
2187
2188 AC_PREREQ([2.50])
2189
2190 dnl Checks for all prerequisites of the po subdirectory.
2191 AC_DEFUN([AM_PO_SUBDIRS],
2192 [
2193   AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2194   AC_REQUIRE([AC_PROG_INSTALL])dnl
2195   AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
2196   AC_REQUIRE([AM_NLS])dnl
2197
2198   dnl Release version of the gettext macros. This is used to ensure that
2199   dnl the gettext macros and po/Makefile.in.in are in sync.
2200   AC_SUBST([GETTEXT_MACRO_VERSION], [0.18])
2201
2202   dnl Perform the following tests also if --disable-nls has been given,
2203   dnl because they are needed for "make dist" to work.
2204
2205   dnl Search for GNU msgfmt in the PATH.
2206   dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
2207   dnl The second test excludes FreeBSD msgfmt.
2208   AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2209     [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
2210      (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
2211     :)
2212   AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
2213
2214   dnl Test whether it is GNU msgfmt >= 0.15.
2215 changequote(,)dnl
2216   case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
2217     '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
2218     *) MSGFMT_015=$MSGFMT ;;
2219   esac
2220 changequote([,])dnl
2221   AC_SUBST([MSGFMT_015])
2222 changequote(,)dnl
2223   case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
2224     '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
2225     *) GMSGFMT_015=$GMSGFMT ;;
2226   esac
2227 changequote([,])dnl
2228   AC_SUBST([GMSGFMT_015])
2229
2230   dnl Search for GNU xgettext 0.12 or newer in the PATH.
2231   dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
2232   dnl The second test excludes FreeBSD xgettext.
2233   AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2234     [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
2235      (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
2236     :)
2237   dnl Remove leftover from FreeBSD xgettext call.
2238   rm -f messages.po
2239
2240   dnl Test whether it is GNU xgettext >= 0.15.
2241 changequote(,)dnl
2242   case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
2243     '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
2244     *) XGETTEXT_015=$XGETTEXT ;;
2245   esac
2246 changequote([,])dnl
2247   AC_SUBST([XGETTEXT_015])
2248
2249   dnl Search for GNU msgmerge 0.11 or newer in the PATH.
2250   AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
2251     [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
2252
2253   dnl Installation directories.
2254   dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we
2255   dnl have to define it here, so that it can be used in po/Makefile.
2256   test -n "$localedir" || localedir='${datadir}/locale'
2257   AC_SUBST([localedir])
2258
2259   dnl Support for AM_XGETTEXT_OPTION.
2260   test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
2261   AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
2262
2263   AC_CONFIG_COMMANDS([po-directories], [[
2264     for ac_file in $CONFIG_FILES; do
2265       # Support "outfile[:infile[:infile...]]"
2266       case "$ac_file" in
2267         *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
2268       esac
2269       # PO directories have a Makefile.in generated from Makefile.in.in.
2270       case "$ac_file" in */Makefile.in)
2271         # Adjust a relative srcdir.
2272         ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2273         ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2274         ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2275         # In autoconf-2.13 it is called $ac_given_srcdir.
2276         # In autoconf-2.50 it is called $srcdir.
2277         test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
2278         case "$ac_given_srcdir" in
2279           .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2280           /*) top_srcdir="$ac_given_srcdir" ;;
2281           *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
2282         esac
2283         # Treat a directory as a PO directory if and only if it has a
2284         # POTFILES.in file. This allows packages to have multiple PO
2285         # directories under different names or in different locations.
2286         if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
2287           rm -f "$ac_dir/POTFILES"
2288           test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
2289           cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[   ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
2290           POMAKEFILEDEPS="POTFILES.in"
2291           # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
2292           # on $ac_dir but don't depend on user-specified configuration
2293           # parameters.
2294           if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2295             # The LINGUAS file contains the set of available languages.
2296             if test -n "$OBSOLETE_ALL_LINGUAS"; then
2297               test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2298             fi
2299             ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2300             # Hide the ALL_LINGUAS assigment from automake < 1.5.
2301             eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2302             POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2303           else
2304             # The set of available languages was given in configure.in.
2305             # Hide the ALL_LINGUAS assigment from automake < 1.5.
2306             eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
2307           fi
2308           # Compute POFILES
2309           # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2310           # Compute UPDATEPOFILES
2311           # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2312           # Compute DUMMYPOFILES
2313           # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2314           # Compute GMOFILES
2315           # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2316           case "$ac_given_srcdir" in
2317             .) srcdirpre= ;;
2318             *) srcdirpre='$(srcdir)/' ;;
2319           esac
2320           POFILES=
2321           UPDATEPOFILES=
2322           DUMMYPOFILES=
2323           GMOFILES=
2324           for lang in $ALL_LINGUAS; do
2325             POFILES="$POFILES $srcdirpre$lang.po"
2326             UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2327             DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2328             GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2329           done
2330           # CATALOGS depends on both $ac_dir and the user's LINGUAS
2331           # environment variable.
2332           INST_LINGUAS=
2333           if test -n "$ALL_LINGUAS"; then
2334             for presentlang in $ALL_LINGUAS; do
2335               useit=no
2336               if test "%UNSET%" != "$LINGUAS"; then
2337                 desiredlanguages="$LINGUAS"
2338               else
2339                 desiredlanguages="$ALL_LINGUAS"
2340               fi
2341               for desiredlang in $desiredlanguages; do
2342                 # Use the presentlang catalog if desiredlang is
2343                 #   a. equal to presentlang, or
2344                 #   b. a variant of presentlang (because in this case,
2345                 #      presentlang can be used as a fallback for messages
2346                 #      which are not translated in the desiredlang catalog).
2347                 case "$desiredlang" in
2348                   "$presentlang"*) useit=yes;;
2349                 esac
2350               done
2351               if test $useit = yes; then
2352                 INST_LINGUAS="$INST_LINGUAS $presentlang"
2353               fi
2354             done
2355           fi
2356           CATALOGS=
2357           if test -n "$INST_LINGUAS"; then
2358             for lang in $INST_LINGUAS; do
2359               CATALOGS="$CATALOGS $lang.gmo"
2360             done
2361           fi
2362           test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
2363           sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
2364           for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
2365             if test -f "$f"; then
2366               case "$f" in
2367                 *.orig | *.bak | *~) ;;
2368                 *) cat "$f" >> "$ac_dir/Makefile" ;;
2369               esac
2370             fi
2371           done
2372         fi
2373         ;;
2374       esac
2375     done]],
2376    [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
2377     # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
2378     # from automake < 1.5.
2379     eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
2380     # Capture the value of LINGUAS because we need it to compute CATALOGS.
2381     LINGUAS="${LINGUAS-%UNSET%}"
2382    ])
2383 ])
2384
2385 dnl Postprocesses a Makefile in a directory containing PO files.
2386 AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
2387 [
2388   # When this code is run, in config.status, two variables have already been
2389   # set:
2390   # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
2391   # - LINGUAS is the value of the environment variable LINGUAS at configure
2392   #   time.
2393
2394 changequote(,)dnl
2395   # Adjust a relative srcdir.
2396   ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2397   ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2398   ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2399   # In autoconf-2.13 it is called $ac_given_srcdir.
2400   # In autoconf-2.50 it is called $srcdir.
2401   test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
2402   case "$ac_given_srcdir" in
2403     .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2404     /*) top_srcdir="$ac_given_srcdir" ;;
2405     *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
2406   esac
2407
2408   # Find a way to echo strings without interpreting backslash.
2409   if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
2410     gt_echo='echo'
2411   else
2412     if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
2413       gt_echo='printf %s\n'
2414     else
2415       echo_func () {
2416         cat <<EOT
2417 $*
2418 EOT
2419       }
2420       gt_echo='echo_func'
2421     fi
2422   fi
2423
2424   # A sed script that extracts the value of VARIABLE from a Makefile.
2425   sed_x_variable='
2426 # Test if the hold space is empty.
2427 x
2428 s/P/P/
2429 x
2430 ta
2431 # Yes it was empty. Look if we have the expected variable definition.
2432 /^[      ]*VARIABLE[     ]*=/{
2433   # Seen the first line of the variable definition.
2434   s/^[   ]*VARIABLE[     ]*=//
2435   ba
2436 }
2437 bd
2438 :a
2439 # Here we are processing a line from the variable definition.
2440 # Remove comment, more precisely replace it with a space.
2441 s/#.*$/ /
2442 # See if the line ends in a backslash.
2443 tb
2444 :b
2445 s/\\$//
2446 # Print the line, without the trailing backslash.
2447 p
2448 tc
2449 # There was no trailing backslash. The end of the variable definition is
2450 # reached. Clear the hold space.
2451 s/^.*$//
2452 x
2453 bd
2454 :c
2455 # A trailing backslash means that the variable definition continues in the
2456 # next line. Put a nonempty string into the hold space to indicate this.
2457 s/^.*$/P/
2458 x
2459 :d
2460 '
2461 changequote([,])dnl
2462
2463   # Set POTFILES to the value of the Makefile variable POTFILES.
2464   sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
2465   POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
2466   # Compute POTFILES_DEPS as
2467   #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
2468   POTFILES_DEPS=
2469   for file in $POTFILES; do
2470     POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
2471   done
2472   POMAKEFILEDEPS=""
2473
2474   if test -n "$OBSOLETE_ALL_LINGUAS"; then
2475     test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2476   fi
2477   if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2478     # The LINGUAS file contains the set of available languages.
2479     ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2480     POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2481   else
2482     # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
2483     sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
2484     ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
2485   fi
2486   # Hide the ALL_LINGUAS assigment from automake < 1.5.
2487   eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2488   # Compute POFILES
2489   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2490   # Compute UPDATEPOFILES
2491   # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2492   # Compute DUMMYPOFILES
2493   # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2494   # Compute GMOFILES
2495   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2496   # Compute PROPERTIESFILES
2497   # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
2498   # Compute CLASSFILES
2499   # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
2500   # Compute QMFILES
2501   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
2502   # Compute MSGFILES
2503   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
2504   # Compute RESOURCESDLLFILES
2505   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
2506   case "$ac_given_srcdir" in
2507     .) srcdirpre= ;;
2508     *) srcdirpre='$(srcdir)/' ;;
2509   esac
2510   POFILES=
2511   UPDATEPOFILES=
2512   DUMMYPOFILES=
2513   GMOFILES=
2514   PROPERTIESFILES=
2515   CLASSFILES=
2516   QMFILES=
2517   MSGFILES=
2518   RESOURCESDLLFILES=
2519   for lang in $ALL_LINGUAS; do
2520     POFILES="$POFILES $srcdirpre$lang.po"
2521     UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2522     DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2523     GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2524     PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
2525     CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
2526     QMFILES="$QMFILES $srcdirpre$lang.qm"
2527     frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2528     MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
2529     frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
2530     RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
2531   done
2532   # CATALOGS depends on both $ac_dir and the user's LINGUAS
2533   # environment variable.
2534   INST_LINGUAS=
2535   if test -n "$ALL_LINGUAS"; then
2536     for presentlang in $ALL_LINGUAS; do
2537       useit=no
2538       if test "%UNSET%" != "$LINGUAS"; then
2539         desiredlanguages="$LINGUAS"
2540       else
2541         desiredlanguages="$ALL_LINGUAS"
2542       fi
2543       for desiredlang in $desiredlanguages; do
2544         # Use the presentlang catalog if desiredlang is
2545         #   a. equal to presentlang, or
2546         #   b. a variant of presentlang (because in this case,
2547         #      presentlang can be used as a fallback for messages
2548         #      which are not translated in the desiredlang catalog).
2549         case "$desiredlang" in
2550           "$presentlang"*) useit=yes;;
2551         esac
2552       done
2553       if test $useit = yes; then
2554         INST_LINGUAS="$INST_LINGUAS $presentlang"
2555       fi
2556     done
2557   fi
2558   CATALOGS=
2559   JAVACATALOGS=
2560   QTCATALOGS=
2561   TCLCATALOGS=
2562   CSHARPCATALOGS=
2563   if test -n "$INST_LINGUAS"; then
2564     for lang in $INST_LINGUAS; do
2565       CATALOGS="$CATALOGS $lang.gmo"
2566       JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
2567       QTCATALOGS="$QTCATALOGS $lang.qm"
2568       frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2569       TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
2570       frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
2571       CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
2572     done
2573   fi
2574
2575   sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
2576   if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
2577     # Add dependencies that cannot be formulated as a simple suffix rule.
2578     for lang in $ALL_LINGUAS; do
2579       frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2580       cat >> "$ac_file.tmp" <<EOF
2581 $frobbedlang.msg: $lang.po
2582         @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
2583         \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2584 EOF
2585     done
2586   fi
2587   if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
2588     # Add dependencies that cannot be formulated as a simple suffix rule.
2589     for lang in $ALL_LINGUAS; do
2590       frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
2591       cat >> "$ac_file.tmp" <<EOF
2592 $frobbedlang/\$(DOMAIN).resources.dll: $lang.po
2593         @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
2594         \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2595 EOF
2596     done
2597   fi
2598   if test -n "$POMAKEFILEDEPS"; then
2599     cat >> "$ac_file.tmp" <<EOF
2600 Makefile: $POMAKEFILEDEPS
2601 EOF
2602   fi
2603   mv "$ac_file.tmp" "$ac_file"
2604 ])
2605
2606 dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
2607 AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
2608 [
2609   XGETTEXT_EXTRA_OPTIONS=
2610 ])
2611
2612 dnl Registers an option to be passed to xgettext in the po subdirectory.
2613 AC_DEFUN([AM_XGETTEXT_OPTION],
2614 [
2615   AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
2616   XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
2617 ])
2618
2619 # progtest.m4 serial 6 (gettext-0.18)
2620 dnl Copyright (C) 1996-2003, 2005, 2008-2010 Free Software Foundation, Inc.
2621 dnl This file is free software; the Free Software Foundation
2622 dnl gives unlimited permission to copy and/or distribute it,
2623 dnl with or without modifications, as long as this notice is preserved.
2624 dnl
2625 dnl This file can can be used in projects which are not available under
2626 dnl the GNU General Public License or the GNU Library General Public
2627 dnl License but which still want to provide support for the GNU gettext
2628 dnl functionality.
2629 dnl Please note that the actual code of the GNU gettext library is covered
2630 dnl by the GNU Library General Public License, and the rest of the GNU
2631 dnl gettext package package is covered by the GNU General Public License.
2632 dnl They are *not* in the public domain.
2633
2634 dnl Authors:
2635 dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
2636
2637 AC_PREREQ([2.50])
2638
2639 # Search path for a program which passes the given test.
2640
2641 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2642 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2643 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2644 [
2645 # Prepare PATH_SEPARATOR.
2646 # The user is always right.
2647 if test "${PATH_SEPARATOR+set}" != set; then
2648   echo "#! /bin/sh" >conf$$.sh
2649   echo  "exit 0"   >>conf$$.sh
2650   chmod +x conf$$.sh
2651   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2652     PATH_SEPARATOR=';'
2653   else
2654     PATH_SEPARATOR=:
2655   fi
2656   rm -f conf$$.sh
2657 fi
2658
2659 # Find out how to test for executable files. Don't use a zero-byte file,
2660 # as systems may use methods other than mode bits to determine executability.
2661 cat >conf$$.file <<_ASEOF
2662 #! /bin/sh
2663 exit 0
2664 _ASEOF
2665 chmod +x conf$$.file
2666 if test -x conf$$.file >/dev/null 2>&1; then
2667   ac_executable_p="test -x"
2668 else
2669   ac_executable_p="test -f"
2670 fi
2671 rm -f conf$$.file
2672
2673 # Extract the first word of "$2", so it can be a program name with args.
2674 set dummy $2; ac_word=[$]2
2675 AC_MSG_CHECKING([for $ac_word])
2676 AC_CACHE_VAL([ac_cv_path_$1],
2677 [case "[$]$1" in
2678   [[\\/]]* | ?:[[\\/]]*)
2679     ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2680     ;;
2681   *)
2682     ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
2683     for ac_dir in ifelse([$5], , $PATH, [$5]); do
2684       IFS="$ac_save_IFS"
2685       test -z "$ac_dir" && ac_dir=.
2686       for ac_exec_ext in '' $ac_executable_extensions; do
2687         if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
2688           echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
2689           if [$3]; then
2690             ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
2691             break 2
2692           fi
2693         fi
2694       done
2695     done
2696     IFS="$ac_save_IFS"
2697 dnl If no 4th arg is given, leave the cache variable unset,
2698 dnl so AC_PATH_PROGS will keep looking.
2699 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2700 ])dnl
2701     ;;
2702 esac])dnl
2703 $1="$ac_cv_path_$1"
2704 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
2705   AC_MSG_RESULT([$][$1])
2706 else
2707   AC_MSG_RESULT([no])
2708 fi
2709 AC_SUBST([$1])dnl
2710 ])
2711
2712 dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
2713 dnl
2714 dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
2715 dnl 
2716 dnl Permission is hereby granted, free of charge, to any person obtaining a
2717 dnl copy of this software and associated documentation files (the "Software"),
2718 dnl to deal in the Software without restriction, including without limitation
2719 dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
2720 dnl and/or sell copies of the Software, and to permit persons to whom the
2721 dnl Software is furnished to do so, subject to the following conditions:
2722 dnl
2723 dnl The above copyright notice and this permission notice (including the next
2724 dnl paragraph) shall be included in all copies or substantial portions of the
2725 dnl Software.
2726 dnl
2727 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2728 dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2729 dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2730 dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2731 dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2732 dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2733 dnl DEALINGS IN THE SOFTWARE.
2734
2735 # XORG_MACROS_VERSION(required-version)
2736 # -------------------------------------
2737 # Minimum version: 1.1.0
2738 #
2739 # If you're using a macro added in Version 1.1 or newer, include this in
2740 # your configure.ac with the minimum required version, such as:
2741 # XORG_MACROS_VERSION(1.1)
2742 #
2743 # To ensure that this macro is defined, also add:
2744 # m4_ifndef([XORG_MACROS_VERSION],
2745 #     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
2746 #
2747 #
2748 # See the "minimum version" comment for each macro you use to see what 
2749 # version you require.
2750 m4_defun([XORG_MACROS_VERSION],[
2751 m4_define([vers_have], [1.15.0])
2752 m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
2753 m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
2754 m4_if(m4_cmp(maj_have, maj_needed), 0,,
2755     [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
2756 m4_if(m4_version_compare(vers_have, [$1]), -1,
2757     [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
2758 m4_undefine([vers_have])
2759 m4_undefine([maj_have])
2760 m4_undefine([maj_needed])
2761 ]) # XORG_MACROS_VERSION
2762
2763 # XORG_PROG_RAWCPP()
2764 # ------------------
2765 # Minimum version: 1.0.0
2766 #
2767 # Find cpp program and necessary flags for use in pre-processing text files
2768 # such as man pages and config files
2769 AC_DEFUN([XORG_PROG_RAWCPP],[
2770 AC_REQUIRE([AC_PROG_CPP])
2771 AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
2772    [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
2773
2774 # Check for flag to avoid builtin definitions - assumes unix is predefined,
2775 # which is not the best choice for supporting other OS'es, but covers most
2776 # of the ones we need for now.
2777 AC_MSG_CHECKING([if $RAWCPP requires -undef])
2778 AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
2779 if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2780         AC_MSG_RESULT([no])
2781 else
2782         if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2783                 RAWCPPFLAGS=-undef
2784                 AC_MSG_RESULT([yes])
2785         # under Cygwin unix is still defined even with -undef
2786         elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2787                 RAWCPPFLAGS="-undef -ansi"
2788                 AC_MSG_RESULT([yes, with -ansi])
2789         else
2790                 AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
2791         fi
2792 fi
2793 rm -f conftest.$ac_ext
2794
2795 AC_MSG_CHECKING([if $RAWCPP requires -traditional])
2796 AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
2797 if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
2798         AC_MSG_RESULT([no])
2799 else
2800         if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
2801                 RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
2802                 AC_MSG_RESULT([yes])
2803         else
2804                 AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
2805         fi
2806 fi
2807 rm -f conftest.$ac_ext
2808 AC_SUBST(RAWCPPFLAGS)
2809 ]) # XORG_PROG_RAWCPP
2810
2811 # XORG_MANPAGE_SECTIONS()
2812 # -----------------------
2813 # Minimum version: 1.0.0
2814 #
2815 # Determine which sections man pages go in for the different man page types
2816 # on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
2817 # Not sure if there's any better way than just hardcoding by OS name.
2818 # Override default settings by setting environment variables
2819 # Added MAN_SUBSTS in version 1.8
2820 # Added AC_PROG_SED in version 1.8
2821
2822 AC_DEFUN([XORG_MANPAGE_SECTIONS],[
2823 AC_REQUIRE([AC_CANONICAL_HOST])
2824 AC_REQUIRE([AC_PROG_SED])
2825
2826 if test x$APP_MAN_SUFFIX = x    ; then
2827     APP_MAN_SUFFIX=1
2828 fi
2829 if test x$APP_MAN_DIR = x    ; then
2830     APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
2831 fi
2832
2833 if test x$LIB_MAN_SUFFIX = x    ; then
2834     LIB_MAN_SUFFIX=3
2835 fi
2836 if test x$LIB_MAN_DIR = x    ; then
2837     LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
2838 fi
2839
2840 if test x$FILE_MAN_SUFFIX = x    ; then
2841     case $host_os in
2842         solaris*)       FILE_MAN_SUFFIX=4  ;;
2843         *)              FILE_MAN_SUFFIX=5  ;;
2844     esac
2845 fi
2846 if test x$FILE_MAN_DIR = x    ; then
2847     FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
2848 fi
2849
2850 if test x$MISC_MAN_SUFFIX = x    ; then
2851     case $host_os in
2852         solaris*)       MISC_MAN_SUFFIX=5  ;;
2853         *)              MISC_MAN_SUFFIX=7  ;;
2854     esac
2855 fi
2856 if test x$MISC_MAN_DIR = x    ; then
2857     MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
2858 fi
2859
2860 if test x$DRIVER_MAN_SUFFIX = x    ; then
2861     case $host_os in
2862         solaris*)       DRIVER_MAN_SUFFIX=7  ;;
2863         *)              DRIVER_MAN_SUFFIX=4  ;;
2864     esac
2865 fi
2866 if test x$DRIVER_MAN_DIR = x    ; then
2867     DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
2868 fi
2869
2870 if test x$ADMIN_MAN_SUFFIX = x    ; then
2871     case $host_os in
2872         solaris*)       ADMIN_MAN_SUFFIX=1m ;;
2873         *)              ADMIN_MAN_SUFFIX=8  ;;
2874     esac
2875 fi
2876 if test x$ADMIN_MAN_DIR = x    ; then
2877     ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
2878 fi
2879
2880
2881 AC_SUBST([APP_MAN_SUFFIX])
2882 AC_SUBST([LIB_MAN_SUFFIX])
2883 AC_SUBST([FILE_MAN_SUFFIX])
2884 AC_SUBST([MISC_MAN_SUFFIX])
2885 AC_SUBST([DRIVER_MAN_SUFFIX])
2886 AC_SUBST([ADMIN_MAN_SUFFIX])
2887 AC_SUBST([APP_MAN_DIR])
2888 AC_SUBST([LIB_MAN_DIR])
2889 AC_SUBST([FILE_MAN_DIR])
2890 AC_SUBST([MISC_MAN_DIR])
2891 AC_SUBST([DRIVER_MAN_DIR])
2892 AC_SUBST([ADMIN_MAN_DIR])
2893
2894 XORG_MAN_PAGE="X Version 11"
2895 AC_SUBST([XORG_MAN_PAGE])
2896 MAN_SUBSTS="\
2897         -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2898         -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2899         -e 's|__xservername__|Xorg|g' \
2900         -e 's|__xconfigfile__|xorg.conf|g' \
2901         -e 's|__projectroot__|\$(prefix)|g' \
2902         -e 's|__apploaddir__|\$(appdefaultdir)|g' \
2903         -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
2904         -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
2905         -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
2906         -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
2907         -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
2908         -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
2909 AC_SUBST([MAN_SUBSTS])
2910
2911 ]) # XORG_MANPAGE_SECTIONS
2912
2913 # XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
2914 # ------------------------
2915 # Minimum version: 1.7.0
2916 #
2917 # Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
2918 # provided by xorg-sgml-doctools, if installed.
2919 AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
2920 AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
2921 XORG_SGML_PATH=
2922 PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
2923     [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
2924     [m4_ifval([$1],[:],
2925         [if test x"$cross_compiling" != x"yes" ; then
2926             AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
2927                           [XORG_SGML_PATH=$prefix/share/sgml])
2928          fi])
2929     ])
2930
2931 # Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
2932 # the path and the name of the doc stylesheet
2933 if test "x$XORG_SGML_PATH" != "x" ; then
2934    AC_MSG_RESULT([$XORG_SGML_PATH])
2935    STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
2936    XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
2937 else
2938    AC_MSG_RESULT([no])
2939 fi
2940
2941 AC_SUBST(XORG_SGML_PATH)
2942 AC_SUBST(STYLESHEET_SRCDIR)
2943 AC_SUBST(XSL_STYLESHEET)
2944 AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
2945 ]) # XORG_CHECK_SGML_DOCTOOLS
2946
2947 # XORG_CHECK_LINUXDOC
2948 # -------------------
2949 # Minimum version: 1.0.0
2950 #
2951 # Defines the variable MAKE_TEXT if the necessary tools and
2952 # files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
2953 # Whether or not the necessary tools and files are found can be checked
2954 # with the AM_CONDITIONAL "BUILD_LINUXDOC"
2955 AC_DEFUN([XORG_CHECK_LINUXDOC],[
2956 AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
2957 AC_REQUIRE([XORG_WITH_PS2PDF])
2958
2959 AC_PATH_PROG(LINUXDOC, linuxdoc)
2960
2961 AC_MSG_CHECKING([whether to build documentation])
2962
2963 if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
2964    BUILDDOC=yes
2965 else
2966    BUILDDOC=no
2967 fi
2968
2969 AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
2970
2971 AC_MSG_RESULT([$BUILDDOC])
2972
2973 AC_MSG_CHECKING([whether to build pdf documentation])
2974
2975 if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
2976    BUILDPDFDOC=yes
2977 else
2978    BUILDPDFDOC=no
2979 fi
2980
2981 AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2982
2983 AC_MSG_RESULT([$BUILDPDFDOC])
2984
2985 MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
2986 MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
2987 MAKE_PDF="$PS2PDF"
2988 MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
2989
2990 AC_SUBST(MAKE_TEXT)
2991 AC_SUBST(MAKE_PS)
2992 AC_SUBST(MAKE_PDF)
2993 AC_SUBST(MAKE_HTML)
2994 ]) # XORG_CHECK_LINUXDOC
2995
2996 # XORG_CHECK_DOCBOOK
2997 # -------------------
2998 # Minimum version: 1.0.0
2999 #
3000 # Checks for the ability to build output formats from SGML DocBook source.
3001 # For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
3002 # indicates whether the necessary tools and files are found and, if set,
3003 # $(MAKE_XXX) blah.sgml will produce blah.xxx.
3004 AC_DEFUN([XORG_CHECK_DOCBOOK],[
3005 AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
3006
3007 BUILDTXTDOC=no
3008 BUILDPDFDOC=no
3009 BUILDPSDOC=no
3010 BUILDHTMLDOC=no
3011
3012 AC_PATH_PROG(DOCBOOKPS, docbook2ps)
3013 AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
3014 AC_PATH_PROG(DOCBOOKHTML, docbook2html)
3015 AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
3016
3017 AC_MSG_CHECKING([whether to build text documentation])
3018 if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
3019    test x$BUILD_TXTDOC != xno; then
3020         BUILDTXTDOC=yes
3021 fi
3022 AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
3023 AC_MSG_RESULT([$BUILDTXTDOC])
3024
3025 AC_MSG_CHECKING([whether to build PDF documentation])
3026 if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
3027    test x$BUILD_PDFDOC != xno; then
3028         BUILDPDFDOC=yes
3029 fi
3030 AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
3031 AC_MSG_RESULT([$BUILDPDFDOC])
3032
3033 AC_MSG_CHECKING([whether to build PostScript documentation])
3034 if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
3035    test x$BUILD_PSDOC != xno; then
3036         BUILDPSDOC=yes
3037 fi
3038 AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
3039 AC_MSG_RESULT([$BUILDPSDOC])
3040
3041 AC_MSG_CHECKING([whether to build HTML documentation])
3042 if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
3043    test x$BUILD_HTMLDOC != xno; then
3044         BUILDHTMLDOC=yes
3045 fi
3046 AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
3047 AC_MSG_RESULT([$BUILDHTMLDOC])
3048
3049 MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
3050 MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
3051 MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
3052 MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
3053
3054 AC_SUBST(MAKE_TEXT)
3055 AC_SUBST(MAKE_PS)
3056 AC_SUBST(MAKE_PDF)
3057 AC_SUBST(MAKE_HTML)
3058 ]) # XORG_CHECK_DOCBOOK
3059
3060 # XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
3061 # ----------------
3062 # Minimum version: 1.5.0
3063 # Minimum version for optional DEFAULT argument: 1.11.0
3064 #
3065 # Documentation tools are not always available on all platforms and sometimes
3066 # not at the appropriate level. This macro enables a module to test for the
3067 # presence of the tool and obtain it's path in separate variables. Coupled with
3068 # the --with-xmlto option, it allows maximum flexibilty in making decisions
3069 # as whether or not to use the xmlto package. When DEFAULT is not specified,
3070 # --with-xmlto assumes 'auto'.
3071 #
3072 # Interface to module:
3073 # HAVE_XMLTO:   used in makefiles to conditionally generate documentation
3074 # XMLTO:        returns the path of the xmlto program found
3075 #               returns the path set by the user in the environment
3076 # --with-xmlto: 'yes' user instructs the module to use xmlto
3077 #               'no' user instructs the module not to use xmlto
3078 #
3079 # Added in version 1.10.0
3080 # HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
3081 #                  xmlto for text output requires either lynx, links, or w3m browsers
3082 #
3083 # If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
3084 #
3085 AC_DEFUN([XORG_WITH_XMLTO],[
3086 AC_ARG_VAR([XMLTO], [Path to xmlto command])
3087 m4_define([_defopt], m4_default([$2], [auto]))
3088 AC_ARG_WITH(xmlto,
3089         AS_HELP_STRING([--with-xmlto],
3090            [Use xmlto to regenerate documentation (default: ]_defopt[)]),
3091            [use_xmlto=$withval], [use_xmlto=]_defopt)
3092 m4_undefine([_defopt])
3093
3094 if test "x$use_xmlto" = x"auto"; then
3095    AC_PATH_PROG([XMLTO], [xmlto])
3096    if test "x$XMLTO" = "x"; then
3097         AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
3098         have_xmlto=no
3099    else
3100         have_xmlto=yes
3101    fi
3102 elif test "x$use_xmlto" = x"yes" ; then
3103    AC_PATH_PROG([XMLTO], [xmlto])
3104    if test "x$XMLTO" = "x"; then
3105         AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
3106    fi
3107    have_xmlto=yes
3108 elif test "x$use_xmlto" = x"no" ; then
3109    if test "x$XMLTO" != "x"; then
3110       AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
3111    fi
3112    have_xmlto=no
3113 else
3114    AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
3115 fi
3116
3117 # Test for a minimum version of xmlto, if provided.
3118 m4_ifval([$1],
3119 [if test "$have_xmlto" = yes; then
3120     # scrape the xmlto version
3121     AC_MSG_CHECKING([the xmlto version])
3122     xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
3123     AC_MSG_RESULT([$xmlto_version])
3124     AS_VERSION_COMPARE([$xmlto_version], [$1],
3125         [if test "x$use_xmlto" = xauto; then
3126             AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
3127             have_xmlto=no
3128         else
3129             AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
3130         fi])
3131 fi])
3132
3133 # Test for the ability of xmlto to generate a text target
3134 have_xmlto_text=no
3135 cat > conftest.xml << "EOF"
3136 EOF
3137 AS_IF([test "$have_xmlto" = yes],
3138       [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
3139              [have_xmlto_text=yes],
3140              [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
3141 rm -f conftest.xml
3142 AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
3143 AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
3144 ]) # XORG_WITH_XMLTO
3145
3146 # XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
3147 # --------------------------------------------
3148 # Minimum version: 1.12.0
3149 # Minimum version for optional DEFAULT argument: 1.12.0
3150 #
3151 # XSLT (Extensible Stylesheet Language Transformations) is a declarative,
3152 # XML-based language used for the transformation of XML documents.
3153 # The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
3154 # It is used under the cover by xmlto to generate html files from DocBook/XML.
3155 # The XSLT processor is often used as a standalone tool for transformations.
3156 # It should not be assumed that this tool is used only to work with documnetation.
3157 # When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
3158 #
3159 # Interface to module:
3160 # HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
3161 # XSLTPROC:      returns the path of the xsltproc program found
3162 #                returns the path set by the user in the environment
3163 # --with-xsltproc: 'yes' user instructs the module to use xsltproc
3164 #                 'no' user instructs the module not to use xsltproc
3165 # have_xsltproc: returns yes if xsltproc found in PATH or no
3166 #
3167 # If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
3168 #
3169 AC_DEFUN([XORG_WITH_XSLTPROC],[
3170 AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
3171 # Preserves the interface, should it be implemented later
3172 m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
3173 m4_define([_defopt], m4_default([$2], [auto]))
3174 AC_ARG_WITH(xsltproc,
3175         AS_HELP_STRING([--with-xsltproc],
3176            [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
3177            [use_xsltproc=$withval], [use_xsltproc=]_defopt)
3178 m4_undefine([_defopt])
3179
3180 if test "x$use_xsltproc" = x"auto"; then
3181    AC_PATH_PROG([XSLTPROC], [xsltproc])
3182    if test "x$XSLTPROC" = "x"; then
3183         AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
3184         have_xsltproc=no
3185    else
3186         have_xsltproc=yes
3187    fi
3188 elif test "x$use_xsltproc" = x"yes" ; then
3189    AC_PATH_PROG([XSLTPROC], [xsltproc])
3190    if test "x$XSLTPROC" = "x"; then
3191         AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
3192    fi
3193    have_xsltproc=yes
3194 elif test "x$use_xsltproc" = x"no" ; then
3195    if test "x$XSLTPROC" != "x"; then
3196       AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
3197    fi
3198    have_xsltproc=no
3199 else
3200    AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
3201 fi
3202
3203 AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
3204 ]) # XORG_WITH_XSLTPROC
3205
3206 # XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
3207 # ----------------------------------------
3208 # Minimum version: 1.15.0
3209 #
3210 # PERL (Practical Extraction and Report Language) is a language optimized for
3211 # scanning arbitrary text files, extracting information from those text files,
3212 # and printing reports based on that information.
3213 #
3214 # When DEFAULT is not specified, --with-perl assumes 'auto'.
3215 #
3216 # Interface to module:
3217 # HAVE_PERL: used in makefiles to conditionally scan text files
3218 # PERL:      returns the path of the perl program found
3219 #            returns the path set by the user in the environment
3220 # --with-perl: 'yes' user instructs the module to use perl
3221 #              'no' user instructs the module not to use perl
3222 # have_perl: returns yes if perl found in PATH or no
3223 #
3224 # If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
3225 #
3226 AC_DEFUN([XORG_WITH_PERL],[
3227 AC_ARG_VAR([PERL], [Path to perl command])
3228 # Preserves the interface, should it be implemented later
3229 m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
3230 m4_define([_defopt], m4_default([$2], [auto]))
3231 AC_ARG_WITH(perl,
3232         AS_HELP_STRING([--with-perl],
3233            [Use perl for extracting information from files (default: ]_defopt[)]),
3234            [use_perl=$withval], [use_perl=]_defopt)
3235 m4_undefine([_defopt])
3236
3237 if test "x$use_perl" = x"auto"; then
3238    AC_PATH_PROG([PERL], [perl])
3239    if test "x$PERL" = "x"; then
3240         AC_MSG_WARN([perl not found - cannot extract information and report])
3241         have_perl=no
3242    else
3243         have_perl=yes
3244    fi
3245 elif test "x$use_perl" = x"yes" ; then
3246    AC_PATH_PROG([PERL], [perl])
3247    if test "x$PERL" = "x"; then
3248         AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
3249    fi
3250    have_perl=yes
3251 elif test "x$use_perl" = x"no" ; then
3252    if test "x$PERL" != "x"; then
3253       AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
3254    fi
3255    have_perl=no
3256 else
3257    AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
3258 fi
3259
3260 AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
3261 ]) # XORG_WITH_PERL
3262
3263 # XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
3264 # ----------------
3265 # Minimum version: 1.5.0
3266 # Minimum version for optional DEFAULT argument: 1.11.0
3267 #
3268 # Documentation tools are not always available on all platforms and sometimes
3269 # not at the appropriate level. This macro enables a module to test for the
3270 # presence of the tool and obtain it's path in separate variables. Coupled with
3271 # the --with-asciidoc option, it allows maximum flexibilty in making decisions
3272 # as whether or not to use the asciidoc package. When DEFAULT is not specified,
3273 # --with-asciidoc assumes 'auto'.
3274 #
3275 # Interface to module:
3276 # HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
3277 # ASCIIDOC:      returns the path of the asciidoc program found
3278 #                returns the path set by the user in the environment
3279 # --with-asciidoc: 'yes' user instructs the module to use asciidoc
3280 #                 'no' user instructs the module not to use asciidoc
3281 #
3282 # If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
3283 #
3284 AC_DEFUN([XORG_WITH_ASCIIDOC],[
3285 AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
3286 m4_define([_defopt], m4_default([$2], [auto]))
3287 AC_ARG_WITH(asciidoc,
3288         AS_HELP_STRING([--with-asciidoc],
3289            [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
3290            [use_asciidoc=$withval], [use_asciidoc=]_defopt)
3291 m4_undefine([_defopt])
3292
3293 if test "x$use_asciidoc" = x"auto"; then
3294    AC_PATH_PROG([ASCIIDOC], [asciidoc])
3295    if test "x$ASCIIDOC" = "x"; then
3296         AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
3297         have_asciidoc=no
3298    else
3299         have_asciidoc=yes
3300    fi
3301 elif test "x$use_asciidoc" = x"yes" ; then
3302    AC_PATH_PROG([ASCIIDOC], [asciidoc])
3303    if test "x$ASCIIDOC" = "x"; then
3304         AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
3305    fi
3306    have_asciidoc=yes
3307 elif test "x$use_asciidoc" = x"no" ; then
3308    if test "x$ASCIIDOC" != "x"; then
3309       AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
3310    fi
3311    have_asciidoc=no
3312 else
3313    AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
3314 fi
3315 m4_ifval([$1],
3316 [if test "$have_asciidoc" = yes; then
3317     # scrape the asciidoc version
3318     AC_MSG_CHECKING([the asciidoc version])
3319     asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
3320     AC_MSG_RESULT([$asciidoc_version])
3321     AS_VERSION_COMPARE([$asciidoc_version], [$1],
3322         [if test "x$use_asciidoc" = xauto; then
3323             AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
3324             have_asciidoc=no
3325         else
3326             AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
3327         fi])
3328 fi])
3329 AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
3330 ]) # XORG_WITH_ASCIIDOC
3331
3332 # XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
3333 # --------------------------------
3334 # Minimum version: 1.5.0
3335 # Minimum version for optional DEFAULT argument: 1.11.0
3336 #
3337 # Documentation tools are not always available on all platforms and sometimes
3338 # not at the appropriate level. This macro enables a module to test for the
3339 # presence of the tool and obtain it's path in separate variables. Coupled with
3340 # the --with-doxygen option, it allows maximum flexibilty in making decisions
3341 # as whether or not to use the doxygen package. When DEFAULT is not specified,
3342 # --with-doxygen assumes 'auto'.
3343 #
3344 # Interface to module:
3345 # HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
3346 # DOXYGEN:       returns the path of the doxygen program found
3347 #                returns the path set by the user in the environment
3348 # --with-doxygen: 'yes' user instructs the module to use doxygen
3349 #                 'no' user instructs the module not to use doxygen
3350 #
3351 # If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
3352 #
3353 AC_DEFUN([XORG_WITH_DOXYGEN],[
3354 AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
3355 m4_define([_defopt], m4_default([$2], [auto]))
3356 AC_ARG_WITH(doxygen,
3357         AS_HELP_STRING([--with-doxygen],
3358            [Use doxygen to regenerate documentation (default: ]_defopt[)]),
3359            [use_doxygen=$withval], [use_doxygen=]_defopt)
3360 m4_undefine([_defopt])
3361
3362 if test "x$use_doxygen" = x"auto"; then
3363    AC_PATH_PROG([DOXYGEN], [doxygen])
3364    if test "x$DOXYGEN" = "x"; then
3365         AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
3366         have_doxygen=no
3367    else
3368         have_doxygen=yes
3369    fi
3370 elif test "x$use_doxygen" = x"yes" ; then
3371    AC_PATH_PROG([DOXYGEN], [doxygen])
3372    if test "x$DOXYGEN" = "x"; then
3373         AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
3374    fi
3375    have_doxygen=yes
3376 elif test "x$use_doxygen" = x"no" ; then
3377    if test "x$DOXYGEN" != "x"; then
3378       AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
3379    fi
3380    have_doxygen=no
3381 else
3382    AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
3383 fi
3384 m4_ifval([$1],
3385 [if test "$have_doxygen" = yes; then
3386     # scrape the doxygen version
3387     AC_MSG_CHECKING([the doxygen version])
3388     doxygen_version=`$DOXYGEN --version 2>/dev/null`
3389     AC_MSG_RESULT([$doxygen_version])
3390     AS_VERSION_COMPARE([$doxygen_version], [$1],
3391         [if test "x$use_doxygen" = xauto; then
3392             AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
3393             have_doxygen=no
3394         else
3395             AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
3396         fi])
3397 fi])
3398 AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
3399 ]) # XORG_WITH_DOXYGEN
3400
3401 # XORG_WITH_GROFF([DEFAULT])
3402 # ----------------
3403 # Minimum version: 1.6.0
3404 # Minimum version for optional DEFAULT argument: 1.11.0
3405 #
3406 # Documentation tools are not always available on all platforms and sometimes
3407 # not at the appropriate level. This macro enables a module to test for the
3408 # presence of the tool and obtain it's path in separate variables. Coupled with
3409 # the --with-groff option, it allows maximum flexibilty in making decisions
3410 # as whether or not to use the groff package. When DEFAULT is not specified,
3411 # --with-groff assumes 'auto'.
3412 #
3413 # Interface to module:
3414 # HAVE_GROFF:    used in makefiles to conditionally generate documentation
3415 # HAVE_GROFF_MM: the memorandum macros (-mm) package
3416 # HAVE_GROFF_MS: the -ms macros package
3417 # GROFF:         returns the path of the groff program found
3418 #                returns the path set by the user in the environment
3419 # --with-groff:  'yes' user instructs the module to use groff
3420 #                'no' user instructs the module not to use groff
3421 #
3422 # Added in version 1.9.0:
3423 # HAVE_GROFF_HTML: groff has dependencies to output HTML format:
3424 #                  pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
3425 #                  psselect from the psutils package.
3426 #                  the ghostcript package. Refer to the grohtml man pages
3427 #
3428 # If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
3429 #
3430 # OS and distros often splits groff in a basic and full package, the former
3431 # having the groff program and the later having devices, fonts and macros
3432 # Checking for the groff executable is not enough.
3433 #
3434 # If macros are missing, we cannot assume that groff is useless, so we don't
3435 # unset HAVE_GROFF or GROFF env variables.
3436 # HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
3437 #
3438 AC_DEFUN([XORG_WITH_GROFF],[
3439 AC_ARG_VAR([GROFF], [Path to groff command])
3440 m4_define([_defopt], m4_default([$1], [auto]))
3441 AC_ARG_WITH(groff,
3442         AS_HELP_STRING([--with-groff],
3443            [Use groff to regenerate documentation (default: ]_defopt[)]),
3444            [use_groff=$withval], [use_groff=]_defopt)
3445 m4_undefine([_defopt])
3446
3447 if test "x$use_groff" = x"auto"; then
3448    AC_PATH_PROG([GROFF], [groff])
3449    if test "x$GROFF" = "x"; then
3450         AC_MSG_WARN([groff not found - documentation targets will be skipped])
3451         have_groff=no
3452    else
3453         have_groff=yes
3454    fi
3455 elif test "x$use_groff" = x"yes" ; then
3456    AC_PATH_PROG([GROFF], [groff])
3457    if test "x$GROFF" = "x"; then
3458         AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
3459    fi
3460    have_groff=yes
3461 elif test "x$use_groff" = x"no" ; then
3462    if test "x$GROFF" != "x"; then
3463       AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
3464    fi
3465    have_groff=no
3466 else
3467    AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
3468 fi
3469
3470 # We have groff, test for the presence of the macro packages
3471 if test "x$have_groff" = x"yes"; then
3472     AC_MSG_CHECKING([for ${GROFF} -ms macros])
3473     if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
3474         groff_ms_works=yes
3475     else
3476         groff_ms_works=no
3477     fi
3478     AC_MSG_RESULT([$groff_ms_works])
3479     AC_MSG_CHECKING([for ${GROFF} -mm macros])
3480     if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
3481         groff_mm_works=yes
3482     else
3483         groff_mm_works=no
3484     fi
3485     AC_MSG_RESULT([$groff_mm_works])
3486 fi
3487
3488 # We have groff, test for HTML dependencies, one command per package
3489 if test "x$have_groff" = x"yes"; then
3490    AC_PATH_PROGS(GS_PATH, [gs gswin32c])
3491    AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
3492    AC_PATH_PROG(PSSELECT_PATH, [psselect])
3493    if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
3494       have_groff_html=yes
3495    else
3496       have_groff_html=no
3497       AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
3498    fi
3499 fi
3500
3501 # Set Automake conditionals for Makefiles
3502 AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
3503 AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
3504 AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
3505 AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
3506 ]) # XORG_WITH_GROFF
3507
3508 # XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
3509 # ---------------------------------------
3510 # Minimum version: 1.6.0
3511 # Minimum version for optional DEFAULT argument: 1.11.0
3512 # Minimum version for optional MIN-VERSION argument: 1.15.0
3513 #
3514 # Documentation tools are not always available on all platforms and sometimes
3515 # not at the appropriate level. This macro enables a module to test for the
3516 # presence of the tool and obtain it's path in separate variables. Coupled with
3517 # the --with-fop option, it allows maximum flexibilty in making decisions
3518 # as whether or not to use the fop package. When DEFAULT is not specified,
3519 # --with-fop assumes 'auto'.
3520 #
3521 # Interface to module:
3522 # HAVE_FOP:     used in makefiles to conditionally generate documentation
3523 # FOP:          returns the path of the fop program found
3524 #               returns the path set by the user in the environment
3525 # --with-fop:   'yes' user instructs the module to use fop
3526 #               'no' user instructs the module not to use fop
3527 #
3528 # If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
3529 #
3530 AC_DEFUN([XORG_WITH_FOP],[
3531 AC_ARG_VAR([FOP], [Path to fop command])
3532 m4_define([_defopt], m4_default([$2], [auto]))
3533 AC_ARG_WITH(fop,
3534         AS_HELP_STRING([--with-fop],
3535            [Use fop to regenerate documentation (default: ]_defopt[)]),
3536            [use_fop=$withval], [use_fop=]_defopt)
3537 m4_undefine([_defopt])
3538
3539 if test "x$use_fop" = x"auto"; then
3540    AC_PATH_PROG([FOP], [fop])
3541    if test "x$FOP" = "x"; then
3542         AC_MSG_WARN([fop not found - documentation targets will be skipped])
3543         have_fop=no
3544    else
3545         have_fop=yes
3546    fi
3547 elif test "x$use_fop" = x"yes" ; then
3548    AC_PATH_PROG([FOP], [fop])
3549    if test "x$FOP" = "x"; then
3550         AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
3551    fi
3552    have_fop=yes
3553 elif test "x$use_fop" = x"no" ; then
3554    if test "x$FOP" != "x"; then
3555       AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
3556    fi
3557    have_fop=no
3558 else
3559    AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
3560 fi
3561
3562 # Test for a minimum version of fop, if provided.
3563 m4_ifval([$1],
3564 [if test "$have_fop" = yes; then
3565     # scrape the fop version
3566     AC_MSG_CHECKING([for fop minimum version])
3567     fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
3568     AC_MSG_RESULT([$fop_version])
3569     AS_VERSION_COMPARE([$fop_version], [$1],
3570         [if test "x$use_fop" = xauto; then
3571             AC_MSG_WARN([fop version $fop_version found, but $1 needed])
3572             have_fop=no
3573         else
3574             AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
3575         fi])
3576 fi])
3577 AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
3578 ]) # XORG_WITH_FOP
3579
3580 # XORG_WITH_PS2PDF([DEFAULT])
3581 # ----------------
3582 # Minimum version: 1.6.0
3583 # Minimum version for optional DEFAULT argument: 1.11.0
3584 #
3585 # Documentation tools are not always available on all platforms and sometimes
3586 # not at the appropriate level. This macro enables a module to test for the
3587 # presence of the tool and obtain it's path in separate variables. Coupled with
3588 # the --with-ps2pdf option, it allows maximum flexibilty in making decisions
3589 # as whether or not to use the ps2pdf package. When DEFAULT is not specified,
3590 # --with-ps2pdf assumes 'auto'.
3591 #
3592 # Interface to module:
3593 # HAVE_PS2PDF:  used in makefiles to conditionally generate documentation
3594 # PS2PDF:       returns the path of the ps2pdf program found
3595 #               returns the path set by the user in the environment
3596 # --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
3597 #                'no' user instructs the module not to use ps2pdf
3598 #
3599 # If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
3600 #
3601 AC_DEFUN([XORG_WITH_PS2PDF],[
3602 AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
3603 m4_define([_defopt], m4_default([$1], [auto]))
3604 AC_ARG_WITH(ps2pdf,
3605         AS_HELP_STRING([--with-ps2pdf],
3606            [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
3607            [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
3608 m4_undefine([_defopt])
3609
3610 if test "x$use_ps2pdf" = x"auto"; then
3611    AC_PATH_PROG([PS2PDF], [ps2pdf])
3612    if test "x$PS2PDF" = "x"; then
3613         AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
3614         have_ps2pdf=no
3615    else
3616         have_ps2pdf=yes
3617    fi
3618 elif test "x$use_ps2pdf" = x"yes" ; then
3619    AC_PATH_PROG([PS2PDF], [ps2pdf])
3620    if test "x$PS2PDF" = "x"; then
3621         AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
3622    fi
3623    have_ps2pdf=yes
3624 elif test "x$use_ps2pdf" = x"no" ; then
3625    if test "x$PS2PDF" != "x"; then
3626       AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
3627    fi
3628    have_ps2pdf=no
3629 else
3630    AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
3631 fi
3632 AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
3633 ]) # XORG_WITH_PS2PDF
3634
3635 # XORG_ENABLE_DOCS (enable_docs=yes)
3636 # ----------------
3637 # Minimum version: 1.6.0
3638 #
3639 # Documentation tools are not always available on all platforms and sometimes
3640 # not at the appropriate level. This macro enables a builder to skip all
3641 # documentation targets except traditional man pages.
3642 # Combined with the specific tool checking macros XORG_WITH_*, it provides
3643 # maximum flexibilty in controlling documentation building.
3644 # Refer to:
3645 # XORG_WITH_XMLTO         --with-xmlto
3646 # XORG_WITH_ASCIIDOC      --with-asciidoc
3647 # XORG_WITH_DOXYGEN       --with-doxygen
3648 # XORG_WITH_FOP           --with-fop
3649 # XORG_WITH_GROFF         --with-groff
3650 # XORG_WITH_PS2PDF        --with-ps2pdf
3651 #
3652 # Interface to module:
3653 # ENABLE_DOCS:    used in makefiles to conditionally generate documentation
3654 # --enable-docs: 'yes' user instructs the module to generate docs
3655 #                'no' user instructs the module not to generate docs
3656 # parm1:        specify the default value, yes or no.
3657 #
3658 AC_DEFUN([XORG_ENABLE_DOCS],[
3659 m4_define([docs_default], m4_default([$1], [yes]))
3660 AC_ARG_ENABLE(docs,
3661         AS_HELP_STRING([--enable-docs],
3662            [Enable building the documentation (default: ]docs_default[)]),
3663            [build_docs=$enableval], [build_docs=]docs_default)
3664 m4_undefine([docs_default])
3665 AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
3666 AC_MSG_CHECKING([whether to build documentation])
3667 AC_MSG_RESULT([$build_docs])
3668 ]) # XORG_ENABLE_DOCS
3669
3670 # XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
3671 # ----------------
3672 # Minimum version: 1.6.0
3673 #
3674 # This macro enables a builder to skip all developer documentation.
3675 # Combined with the specific tool checking macros XORG_WITH_*, it provides
3676 # maximum flexibilty in controlling documentation building.
3677 # Refer to:
3678 # XORG_WITH_XMLTO         --with-xmlto
3679 # XORG_WITH_ASCIIDOC      --with-asciidoc
3680 # XORG_WITH_DOXYGEN       --with-doxygen
3681 # XORG_WITH_FOP           --with-fop
3682 # XORG_WITH_GROFF         --with-groff
3683 # XORG_WITH_PS2PDF        --with-ps2pdf
3684 #
3685 # Interface to module:
3686 # ENABLE_DEVEL_DOCS:    used in makefiles to conditionally generate developer docs
3687 # --enable-devel-docs:  'yes' user instructs the module to generate developer docs
3688 #                       'no' user instructs the module not to generate developer docs
3689 # parm1:                specify the default value, yes or no.
3690 #
3691 AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
3692 m4_define([devel_default], m4_default([$1], [yes]))
3693 AC_ARG_ENABLE(devel-docs,
3694         AS_HELP_STRING([--enable-devel-docs],
3695            [Enable building the developer documentation (default: ]devel_default[)]),
3696            [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
3697 m4_undefine([devel_default])
3698 AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
3699 AC_MSG_CHECKING([whether to build developer documentation])
3700 AC_MSG_RESULT([$build_devel_docs])
3701 ]) # XORG_ENABLE_DEVEL_DOCS
3702
3703 # XORG_ENABLE_SPECS (enable_specs=yes)
3704 # ----------------
3705 # Minimum version: 1.6.0
3706 #
3707 # This macro enables a builder to skip all functional specification targets.
3708 # Combined with the specific tool checking macros XORG_WITH_*, it provides
3709 # maximum flexibilty in controlling documentation building.
3710 # Refer to:
3711 # XORG_WITH_XMLTO         --with-xmlto
3712 # XORG_WITH_ASCIIDOC      --with-asciidoc
3713 # XORG_WITH_DOXYGEN       --with-doxygen
3714 # XORG_WITH_FOP           --with-fop
3715 # XORG_WITH_GROFF         --with-groff
3716 # XORG_WITH_PS2PDF        --with-ps2pdf
3717 #
3718 # Interface to module:
3719 # ENABLE_SPECS:         used in makefiles to conditionally generate specs
3720 # --enable-specs:       'yes' user instructs the module to generate specs
3721 #                       'no' user instructs the module not to generate specs
3722 # parm1:                specify the default value, yes or no.
3723 #
3724 AC_DEFUN([XORG_ENABLE_SPECS],[
3725 m4_define([spec_default], m4_default([$1], [yes]))
3726 AC_ARG_ENABLE(specs,
3727         AS_HELP_STRING([--enable-specs],
3728            [Enable building the specs (default: ]spec_default[)]),
3729            [build_specs=$enableval], [build_specs=]spec_default)
3730 m4_undefine([spec_default])
3731 AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
3732 AC_MSG_CHECKING([whether to build functional specifications])
3733 AC_MSG_RESULT([$build_specs])
3734 ]) # XORG_ENABLE_SPECS
3735
3736 # XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
3737 # ----------------------------------------------
3738 # Minimum version: 1.13.0
3739 #
3740 # This macro enables a builder to enable/disable unit testing
3741 # It makes no assumption about the test cases implementation
3742 # Test cases may or may not use Automake "Support for test suites"
3743 # They may or may not use the software utility library GLib
3744 #
3745 # When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
3746 # ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
3747 # The variable enable_unit_tests is used by other macros in this file.
3748 #
3749 # Interface to module:
3750 # ENABLE_UNIT_TESTS:    used in makefiles to conditionally build tests
3751 # enable_unit_tests:    used in configure.ac for additional configuration
3752 # --enable-unit-tests:  'yes' user instructs the module to build tests
3753 #                       'no' user instructs the module not to build tests
3754 # parm1:                specify the default value, yes or no.
3755 #
3756 AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
3757 AC_BEFORE([$0], [XORG_WITH_GLIB])
3758 AC_BEFORE([$0], [XORG_LD_WRAP])
3759 m4_define([_defopt], m4_default([$1], [auto]))
3760 AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
3761         [Enable building unit test cases (default: ]_defopt[)]),
3762         [enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
3763 m4_undefine([_defopt])
3764 AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
3765 AC_MSG_CHECKING([whether to build unit test cases])
3766 AC_MSG_RESULT([$enable_unit_tests])
3767 ]) # XORG_ENABLE_UNIT_TESTS
3768
3769 # XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
3770 # ----------------------------------------
3771 # Minimum version: 1.13.0
3772 #
3773 # GLib is a library which provides advanced data structures and functions.
3774 # This macro enables a module to test for the presence of Glib.
3775 #
3776 # When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
3777 # Otherwise the value of $enable_unit_tests is blank.
3778 #
3779 # Interface to module:
3780 # HAVE_GLIB: used in makefiles to conditionally build targets
3781 # with_glib: used in configure.ac to know if GLib has been found
3782 # --with-glib:  'yes' user instructs the module to use glib
3783 #               'no' user instructs the module not to use glib
3784 #
3785 AC_DEFUN([XORG_WITH_GLIB],[
3786 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3787 m4_define([_defopt], m4_default([$2], [auto]))
3788 AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
3789         [Use GLib library for unit testing (default: ]_defopt[)]),
3790         [with_glib=$withval], [with_glib=]_defopt)
3791 m4_undefine([_defopt])
3792
3793 have_glib=no
3794 # Do not probe GLib if user explicitly disabled unit testing
3795 if test "x$enable_unit_tests" != x"no"; then
3796   # Do not probe GLib if user explicitly disabled it
3797   if test "x$with_glib" != x"no"; then
3798     m4_ifval(
3799       [$1],
3800       [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
3801       [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
3802     )
3803   fi
3804 fi
3805
3806 # Not having GLib when unit testing has been explicitly requested is an error
3807 if test "x$enable_unit_tests" = x"yes"; then
3808   if test "x$have_glib" = x"no"; then
3809     AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
3810   fi
3811 fi
3812
3813 # Having unit testing disabled when GLib has been explicitly requested is an error
3814 if test "x$enable_unit_tests" = x"no"; then
3815   if test "x$with_glib" = x"yes"; then
3816     AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
3817   fi
3818 fi
3819
3820 # Not having GLib when it has been explicitly requested is an error
3821 if test "x$with_glib" = x"yes"; then
3822   if test "x$have_glib" = x"no"; then
3823     AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
3824   fi
3825 fi
3826
3827 AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
3828 ]) # XORG_WITH_GLIB
3829
3830 # XORG_LD_WRAP
3831 # ------------
3832 # Minimum version: 1.13.0
3833 #
3834 # Check if linker supports -wrap, passed via compiler flags
3835 #
3836 # When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
3837 # Otherwise the value of $enable_unit_tests is blank.
3838 #
3839 AC_DEFUN([XORG_LD_WRAP],[
3840 XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no])
3841 # Not having ld wrap when unit testing has been explicitly requested is an error
3842 if test "x$enable_unit_tests" = x"yes"; then
3843   if test "x$have_ld_wrap" = x"no"; then
3844     AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
3845   fi
3846 fi
3847 AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
3848 #
3849 ]) # XORG_LD_WRAP
3850
3851 # XORG_CHECK_LINKER_FLAGS
3852 # -----------------------
3853 # SYNOPSIS
3854 #
3855 #   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
3856 #
3857 # DESCRIPTION
3858 #
3859 #   Check whether the given linker FLAGS work with the current language's
3860 #   linker, or whether they give an error.
3861 #
3862 #   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
3863 #   success/failure.
3864 #
3865 #   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
3866 #
3867 # LICENSE
3868 #
3869 #   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
3870 #   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
3871 #   Copyright (c) 2009 Matteo Frigo
3872 #
3873 #   This program is free software: you can redistribute it and/or modify it
3874 #   under the terms of the GNU General Public License as published by the
3875 #   Free Software Foundation, either version 3 of the License, or (at your
3876 #   option) any later version.
3877 #
3878 #   This program is distributed in the hope that it will be useful, but
3879 #   WITHOUT ANY WARRANTY; without even the implied warranty of
3880 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
3881 #   Public License for more details.
3882 #
3883 #   You should have received a copy of the GNU General Public License along
3884 #   with this program. If not, see <http://www.gnu.org/licenses/>.
3885 #
3886 #   As a special exception, the respective Autoconf Macro's copyright owner
3887 #   gives unlimited permission to copy, distribute and modify the configure
3888 #   scripts that are the output of Autoconf when processing the Macro. You
3889 #   need not follow the terms of the GNU General Public License when using
3890 #   or distributing such scripts, even though portions of the text of the
3891 #   Macro appear in them. The GNU General Public License (GPL) does govern
3892 #   all other use of the material that constitutes the Autoconf Macro.
3893 #
3894 #   This special exception to the GPL applies to versions of the Autoconf
3895 #   Macro released by the Autoconf Archive. When you make and distribute a
3896 #   modified version of the Autoconf Macro, you may extend this special
3897 #   exception to the GPL to apply to your modified version as well.#
3898 AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
3899 [AC_MSG_CHECKING([whether the linker accepts $1])
3900 dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
3901 AS_LITERAL_IF([$1],
3902   [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
3903       ax_save_FLAGS=$LDFLAGS
3904       LDFLAGS="$1"
3905       AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3906         AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3907         AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3908       LDFLAGS=$ax_save_FLAGS])],
3909   [ax_save_FLAGS=$LDFLAGS
3910    LDFLAGS="$1"
3911    AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3912      eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3913      eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3914    LDFLAGS=$ax_save_FLAGS])
3915 eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
3916 AC_MSG_RESULT($xorg_check_linker_flags)
3917 if test "x$xorg_check_linker_flags" = xyes; then
3918         m4_default([$2], :)
3919 else
3920         m4_default([$3], :)
3921 fi
3922 ]) # XORG_CHECK_LINKER_FLAGS
3923
3924 # XORG_CHECK_MALLOC_ZERO
3925 # ----------------------
3926 # Minimum version: 1.0.0
3927 #
3928 # Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
3929 # malloc(0) returns NULL.  Packages should add one of these cflags to
3930 # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
3931 AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
3932 AC_ARG_ENABLE(malloc0returnsnull,
3933         AS_HELP_STRING([--enable-malloc0returnsnull],
3934                        [malloc(0) returns NULL (default: auto)]),
3935         [MALLOC_ZERO_RETURNS_NULL=$enableval],
3936         [MALLOC_ZERO_RETURNS_NULL=auto])
3937
3938 AC_MSG_CHECKING([whether malloc(0) returns NULL])
3939 if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
3940         AC_RUN_IFELSE([AC_LANG_PROGRAM([
3941 #include <stdlib.h>
3942 ],[
3943     char *m0, *r0, *c0, *p;
3944     m0 = malloc(0);
3945     p = malloc(10);
3946     r0 = realloc(p,0);
3947     c0 = calloc(0,10);
3948     exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
3949 ])],
3950                 [MALLOC_ZERO_RETURNS_NULL=yes],
3951                 [MALLOC_ZERO_RETURNS_NULL=no],
3952                 [MALLOC_ZERO_RETURNS_NULL=yes])
3953 fi
3954 AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
3955
3956 if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
3957         MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
3958         XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
3959         XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
3960 else
3961         MALLOC_ZERO_CFLAGS=""
3962         XMALLOC_ZERO_CFLAGS=""
3963         XTMALLOC_ZERO_CFLAGS=""
3964 fi
3965
3966 AC_SUBST([MALLOC_ZERO_CFLAGS])
3967 AC_SUBST([XMALLOC_ZERO_CFLAGS])
3968 AC_SUBST([XTMALLOC_ZERO_CFLAGS])
3969 ]) # XORG_CHECK_MALLOC_ZERO
3970
3971 # XORG_WITH_LINT()
3972 # ----------------
3973 # Minimum version: 1.1.0
3974 #
3975 # This macro enables the use of a tool that flags some suspicious and
3976 # non-portable constructs (likely to be bugs) in C language source code.
3977 # It will attempt to locate the tool and use appropriate options.
3978 # There are various lint type tools on different platforms.
3979 #
3980 # Interface to module:
3981 # LINT:         returns the path to the tool found on the platform
3982 #               or the value set to LINT on the configure cmd line
3983 #               also an Automake conditional
3984 # LINT_FLAGS:   an Automake variable with appropriate flags
3985 #
3986 # --with-lint:  'yes' user instructs the module to use lint
3987 #               'no' user instructs the module not to use lint (default)
3988 #
3989 # If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3990 # If the user sets the value of LINT_FLAGS, they are used verbatim.
3991 #
3992 AC_DEFUN([XORG_WITH_LINT],[
3993
3994 AC_ARG_VAR([LINT], [Path to a lint-style command])
3995 AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3996 AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3997                 [Use a lint-style source code checker (default: disabled)])],
3998                 [use_lint=$withval], [use_lint=no])
3999
4000 # Obtain platform specific info like program name and options
4001 # The lint program on FreeBSD and NetBSD is different from the one on Solaris
4002 case $host_os in
4003   *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
4004         lint_name=splint
4005         lint_options="-badflag"
4006         ;;
4007   *freebsd* | *netbsd*)
4008         lint_name=lint
4009         lint_options="-u -b"
4010         ;;
4011   *solaris*)
4012         lint_name=lint
4013         lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
4014         ;;
4015 esac
4016
4017 # Test for the presence of the program (either guessed by the code or spelled out by the user)
4018 if test "x$use_lint" = x"yes" ; then
4019    AC_PATH_PROG([LINT], [$lint_name])
4020    if test "x$LINT" = "x"; then
4021         AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
4022    fi
4023 elif test "x$use_lint" = x"no" ; then
4024    if test "x$LINT" != "x"; then
4025       AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
4026    fi
4027 else
4028    AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
4029 fi
4030
4031 # User supplied flags override default flags
4032 if test "x$LINT_FLAGS" != "x"; then
4033    lint_options=$LINT_FLAGS
4034 fi
4035
4036 AC_SUBST([LINT_FLAGS],[$lint_options])
4037 AM_CONDITIONAL(LINT, [test "x$LINT" != x])
4038
4039 ]) # XORG_WITH_LINT
4040
4041 # XORG_LINT_LIBRARY(LIBNAME)
4042 # --------------------------
4043 # Minimum version: 1.1.0
4044 #
4045 # Sets up flags for building lint libraries for checking programs that call
4046 # functions in the library.
4047 #
4048 # Interface to module:
4049 # LINTLIB               - Automake variable with the name of lint library file to make
4050 # MAKE_LINT_LIB         - Automake conditional
4051 #
4052 # --enable-lint-library:  - 'yes' user instructs the module to created a lint library
4053 #                         - 'no' user instructs the module not to create a lint library (default)
4054
4055 AC_DEFUN([XORG_LINT_LIBRARY],[
4056 AC_REQUIRE([XORG_WITH_LINT])
4057 AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
4058         [Create lint library (default: disabled)])],
4059         [make_lint_lib=$enableval], [make_lint_lib=no])
4060
4061 if test "x$make_lint_lib" = x"yes" ; then
4062    LINTLIB=llib-l$1.ln
4063    if test "x$LINT" = "x"; then
4064         AC_MSG_ERROR([Cannot make lint library without --with-lint])
4065    fi
4066 elif test "x$make_lint_lib" != x"no" ; then
4067    AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
4068 fi
4069
4070 AC_SUBST(LINTLIB)
4071 AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
4072
4073 ]) # XORG_LINT_LIBRARY
4074
4075 # XORG_COMPILER_BRAND
4076 # -------------------
4077 # Minimum version: 1.14.0
4078 #
4079 # Checks for various brands of compilers and sets flags as appropriate:
4080 #   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
4081 #   clang compiler - sets CLANGCC to "yes"
4082 #   Intel compiler - sets INTELCC to "yes"
4083 #   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
4084 #
4085 AC_DEFUN([XORG_COMPILER_BRAND], [
4086 AC_REQUIRE([AC_PROG_CC_C99])
4087 AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
4088 AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
4089 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
4090 ]) # XORG_COMPILER_BRAND
4091
4092 # XORG_CWARNFLAGS
4093 # ---------------
4094 # Minimum version: 1.2.0
4095 #
4096 # Defines CWARNFLAGS to enable C compiler warnings.
4097 #
4098 AC_DEFUN([XORG_CWARNFLAGS], [
4099 AC_REQUIRE([AC_PROG_CC_C99])
4100 AC_REQUIRE([XORG_COMPILER_BRAND])
4101 if  test "x$GCC" = xyes ; then
4102     CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
4103 -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
4104 -Wbad-function-cast -Wformat=2"
4105     case `$CC -dumpversion` in
4106     3.4.* | 4.*)
4107         CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
4108         ;;
4109     esac
4110 else
4111     if test "x$SUNCC" = "xyes"; then
4112         CWARNFLAGS="-v"
4113     fi
4114 fi
4115 AC_SUBST(CWARNFLAGS)
4116 ]) # XORG_CWARNFLAGS
4117
4118 # XORG_STRICT_OPTION
4119 # -----------------------
4120 # Minimum version: 1.3.0
4121 #
4122 # Add configure option to enable strict compilation flags, such as treating
4123 # warnings as fatal errors.
4124 # If --enable-strict-compilation is passed to configure, adds strict flags to
4125 # $CWARNFLAGS.
4126 #
4127 # Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
4128 # when strict compilation is unconditionally desired.
4129 AC_DEFUN([XORG_STRICT_OPTION], [
4130 # If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
4131 AC_REQUIRE([AC_PROG_CC_C99])
4132 AC_REQUIRE([XORG_COMPILER_BRAND])
4133 AC_REQUIRE([XORG_CWARNFLAGS])
4134
4135 AC_ARG_ENABLE(strict-compilation,
4136                           AS_HELP_STRING([--enable-strict-compilation],
4137                           [Enable all warnings from compiler and make them errors (default: disabled)]),
4138                           [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
4139 if test "x$GCC" = xyes ; then
4140     STRICT_CFLAGS="-pedantic -Werror"
4141     # Add -Werror=attributes if supported (gcc 4.2 & later)
4142     AC_MSG_CHECKING([if $CC supports -Werror=attributes])
4143     save_CFLAGS="$CFLAGS"
4144     CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes"
4145     AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
4146                       [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes"
4147                        AC_MSG_RESULT([yes])],
4148                       [AC_MSG_RESULT([no])])
4149     CFLAGS="$save_CFLAGS"
4150 elif test "x$SUNCC" = "xyes"; then
4151     STRICT_CFLAGS="-errwarn"
4152 elif test "x$INTELCC" = "xyes"; then
4153     STRICT_CFLAGS="-Werror"
4154 fi
4155 if test "x$STRICT_COMPILE" = "xyes"; then
4156     CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
4157 fi
4158 AC_SUBST([STRICT_CFLAGS])
4159 AC_SUBST([CWARNFLAGS])
4160 ]) # XORG_STRICT_OPTION
4161
4162 # XORG_DEFAULT_OPTIONS
4163 # --------------------
4164 # Minimum version: 1.3.0
4165 #
4166 # Defines default options for X.Org modules.
4167 #
4168 AC_DEFUN([XORG_DEFAULT_OPTIONS], [
4169 AC_REQUIRE([AC_PROG_INSTALL])
4170 XORG_CWARNFLAGS
4171 XORG_STRICT_OPTION
4172 XORG_RELEASE_VERSION
4173 XORG_CHANGELOG
4174 XORG_INSTALL
4175 XORG_MANPAGE_SECTIONS
4176 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
4177     [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
4178 ]) # XORG_DEFAULT_OPTIONS
4179
4180 # XORG_INSTALL()
4181 # ----------------
4182 # Minimum version: 1.4.0
4183 #
4184 # Defines the variable INSTALL_CMD as the command to copy
4185 # INSTALL from $prefix/share/util-macros.
4186 #
4187 AC_DEFUN([XORG_INSTALL], [
4188 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
4189 macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
4190 INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
4191 mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
4192 || (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
4193 echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
4194 AC_SUBST([INSTALL_CMD])
4195 ]) # XORG_INSTALL
4196 dnl Copyright 2005 Red Hat, Inc
4197 dnl
4198 dnl Permission to use, copy, modify, distribute, and sell this software and its
4199 dnl documentation for any purpose is hereby granted without fee, provided that
4200 dnl the above copyright notice appear in all copies and that both that
4201 dnl copyright notice and this permission notice appear in supporting
4202 dnl documentation.
4203 dnl
4204 dnl The above copyright notice and this permission notice shall be included
4205 dnl in all copies or substantial portions of the Software.
4206 dnl
4207 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4208 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4209 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
4210 dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
4211 dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
4212 dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4213 dnl OTHER DEALINGS IN THE SOFTWARE.
4214 dnl
4215 dnl Except as contained in this notice, the name of the copyright holders shall
4216 dnl not be used in advertising or otherwise to promote the sale, use or
4217 dnl other dealings in this Software without prior written authorization
4218 dnl from the copyright holders.
4219 dnl
4220
4221 # XORG_RELEASE_VERSION
4222 # --------------------
4223 # Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
4224  
4225 AC_DEFUN([XORG_RELEASE_VERSION],[
4226         AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
4227                 [`echo $PACKAGE_VERSION | cut -d . -f 1`],
4228                 [Major version of this package])
4229         PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
4230         if test "x$PVM" = "x"; then
4231                 PVM="0"
4232         fi
4233         AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
4234                 [$PVM],
4235                 [Minor version of this package])
4236         PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
4237         if test "x$PVP" = "x"; then
4238                 PVP="0"
4239         fi
4240         AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
4241                 [$PVP],
4242                 [Patch version of this package])
4243 ])
4244
4245 # XORG_CHANGELOG()
4246 # ----------------
4247 # Minimum version: 1.2.0
4248 #
4249 # Defines the variable CHANGELOG_CMD as the command to generate
4250 # ChangeLog from git.
4251 #
4252 #
4253 AC_DEFUN([XORG_CHANGELOG], [
4254 CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
4255 mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
4256 || (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
4257 echo 'git directory not found: installing possibly empty changelog.' >&2)"
4258 AC_SUBST([CHANGELOG_CMD])
4259 ]) # XORG_CHANGELOG
4260
4261 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
4262 #
4263 # This file is free software; the Free Software Foundation
4264 # gives unlimited permission to copy and/or distribute it,
4265 # with or without modifications, as long as this notice is preserved.
4266
4267 # AM_AUTOMAKE_VERSION(VERSION)
4268 # ----------------------------
4269 # Automake X.Y traces this macro to ensure aclocal.m4 has been
4270 # generated from the m4 files accompanying Automake X.Y.
4271 # (This private macro should not be called outside this file.)
4272 AC_DEFUN([AM_AUTOMAKE_VERSION],
4273 [am__api_version='1.11'
4274 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
4275 dnl require some minimum version.  Point them to the right macro.
4276 m4_if([$1], [1.11.1], [],
4277       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4278 ])
4279
4280 # _AM_AUTOCONF_VERSION(VERSION)
4281 # -----------------------------
4282 # aclocal traces this macro to find the Autoconf version.
4283 # This is a private macro too.  Using m4_define simplifies
4284 # the logic in aclocal, which can simply ignore this definition.
4285 m4_define([_AM_AUTOCONF_VERSION], [])
4286
4287 # AM_SET_CURRENT_AUTOMAKE_VERSION
4288 # -------------------------------
4289 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
4290 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
4291 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
4292 [AM_AUTOMAKE_VERSION([1.11.1])dnl
4293 m4_ifndef([AC_AUTOCONF_VERSION],
4294   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
4295 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
4296
4297 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
4298
4299 # Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
4300 #
4301 # This file is free software; the Free Software Foundation
4302 # gives unlimited permission to copy and/or distribute it,
4303 # with or without modifications, as long as this notice is preserved.
4304
4305 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
4306 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
4307 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
4308 #
4309 # Of course, Automake must honor this variable whenever it calls a
4310 # tool from the auxiliary directory.  The problem is that $srcdir (and
4311 # therefore $ac_aux_dir as well) can be either absolute or relative,
4312 # depending on how configure is run.  This is pretty annoying, since
4313 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
4314 # source directory, any form will work fine, but in subdirectories a
4315 # relative path needs to be adjusted first.
4316 #
4317 # $ac_aux_dir/missing
4318 #    fails when called from a subdirectory if $ac_aux_dir is relative
4319 # $top_srcdir/$ac_aux_dir/missing
4320 #    fails if $ac_aux_dir is absolute,
4321 #    fails when called from a subdirectory in a VPATH build with
4322 #          a relative $ac_aux_dir
4323 #
4324 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
4325 # are both prefixed by $srcdir.  In an in-source build this is usually
4326 # harmless because $srcdir is `.', but things will broke when you
4327 # start a VPATH build or use an absolute $srcdir.
4328 #
4329 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
4330 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
4331 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
4332 # and then we would define $MISSING as
4333 #   MISSING="\${SHELL} $am_aux_dir/missing"
4334 # This will work as long as MISSING is not called from configure, because
4335 # unfortunately $(top_srcdir) has no meaning in configure.
4336 # However there are other variables, like CC, which are often used in
4337 # configure, and could therefore not use this "fixed" $ac_aux_dir.
4338 #
4339 # Another solution, used here, is to always expand $ac_aux_dir to an
4340 # absolute PATH.  The drawback is that using absolute paths prevent a
4341 # configured tree to be moved without reconfiguration.
4342
4343 AC_DEFUN([AM_AUX_DIR_EXPAND],
4344 [dnl Rely on autoconf to set up CDPATH properly.
4345 AC_PREREQ([2.50])dnl
4346 # expand $ac_aux_dir to an absolute path
4347 am_aux_dir=`cd $ac_aux_dir && pwd`
4348 ])
4349
4350 # AM_CONDITIONAL                                            -*- Autoconf -*-
4351
4352 # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
4353 # Free Software Foundation, Inc.
4354 #
4355 # This file is free software; the Free Software Foundation
4356 # gives unlimited permission to copy and/or distribute it,
4357 # with or without modifications, as long as this notice is preserved.
4358
4359 # serial 9
4360
4361 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
4362 # -------------------------------------
4363 # Define a conditional.
4364 AC_DEFUN([AM_CONDITIONAL],
4365 [AC_PREREQ(2.52)dnl
4366  ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
4367         [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
4368 AC_SUBST([$1_TRUE])dnl
4369 AC_SUBST([$1_FALSE])dnl
4370 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
4371 _AM_SUBST_NOTMAKE([$1_FALSE])dnl
4372 m4_define([_AM_COND_VALUE_$1], [$2])dnl
4373 if $2; then
4374   $1_TRUE=
4375   $1_FALSE='#'
4376 else
4377   $1_TRUE='#'
4378   $1_FALSE=
4379 fi
4380 AC_CONFIG_COMMANDS_PRE(
4381 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
4382   AC_MSG_ERROR([[conditional "$1" was never defined.
4383 Usually this means the macro was only invoked conditionally.]])
4384 fi])])
4385
4386 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
4387 # Free Software Foundation, Inc.
4388 #
4389 # This file is free software; the Free Software Foundation
4390 # gives unlimited permission to copy and/or distribute it,
4391 # with or without modifications, as long as this notice is preserved.
4392
4393 # serial 10
4394
4395 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
4396 # written in clear, in which case automake, when reading aclocal.m4,
4397 # will think it sees a *use*, and therefore will trigger all it's
4398 # C support machinery.  Also note that it means that autoscan, seeing
4399 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
4400
4401
4402 # _AM_DEPENDENCIES(NAME)
4403 # ----------------------
4404 # See how the compiler implements dependency checking.
4405 # NAME is "CC", "CXX", "GCJ", or "OBJC".
4406 # We try a few techniques and use that to set a single cache variable.
4407 #
4408 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
4409 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
4410 # dependency, and given that the user is not expected to run this macro,
4411 # just rely on AC_PROG_CC.
4412 AC_DEFUN([_AM_DEPENDENCIES],
4413 [AC_REQUIRE([AM_SET_DEPDIR])dnl
4414 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
4415 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
4416 AC_REQUIRE([AM_DEP_TRACK])dnl
4417
4418 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
4419        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
4420        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
4421        [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
4422        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
4423                    [depcc="$$1"   am_compiler_list=])
4424
4425 AC_CACHE_CHECK([dependency style of $depcc],
4426                [am_cv_$1_dependencies_compiler_type],
4427 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
4428   # We make a subdir and do the tests there.  Otherwise we can end up
4429   # making bogus files that we don't know about and never remove.  For
4430   # instance it was reported that on HP-UX the gcc test will end up
4431   # making a dummy file named `D' -- because `-MD' means `put the output
4432   # in D'.
4433   mkdir conftest.dir
4434   # Copy depcomp to subdir because otherwise we won't find it if we're
4435   # using a relative directory.
4436   cp "$am_depcomp" conftest.dir
4437   cd conftest.dir
4438   # We will build objects and dependencies in a subdirectory because
4439   # it helps to detect inapplicable dependency modes.  For instance
4440   # both Tru64's cc and ICC support -MD to output dependencies as a
4441   # side effect of compilation, but ICC will put the dependencies in
4442   # the current directory while Tru64 will put them in the object
4443   # directory.
4444   mkdir sub
4445
4446   am_cv_$1_dependencies_compiler_type=none
4447   if test "$am_compiler_list" = ""; then
4448      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
4449   fi
4450   am__universal=false
4451   m4_case([$1], [CC],
4452     [case " $depcc " in #(
4453      *\ -arch\ *\ -arch\ *) am__universal=true ;;
4454      esac],
4455     [CXX],
4456     [case " $depcc " in #(
4457      *\ -arch\ *\ -arch\ *) am__universal=true ;;
4458      esac])
4459
4460   for depmode in $am_compiler_list; do
4461     # Setup a source with many dependencies, because some compilers
4462     # like to wrap large dependency lists on column 80 (with \), and
4463     # we should not choose a depcomp mode which is confused by this.
4464     #
4465     # We need to recreate these files for each test, as the compiler may
4466     # overwrite some of them when testing with obscure command lines.
4467     # This happens at least with the AIX C compiler.
4468     : > sub/conftest.c
4469     for i in 1 2 3 4 5 6; do
4470       echo '#include "conftst'$i'.h"' >> sub/conftest.c
4471       # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
4472       # Solaris 8's {/usr,}/bin/sh.
4473       touch sub/conftst$i.h
4474     done
4475     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
4476
4477     # We check with `-c' and `-o' for the sake of the "dashmstdout"
4478     # mode.  It turns out that the SunPro C++ compiler does not properly
4479     # handle `-M -o', and we need to detect this.  Also, some Intel
4480     # versions had trouble with output in subdirs
4481     am__obj=sub/conftest.${OBJEXT-o}
4482     am__minus_obj="-o $am__obj"
4483     case $depmode in
4484     gcc)
4485       # This depmode causes a compiler race in universal mode.
4486       test "$am__universal" = false || continue
4487       ;;
4488     nosideeffect)
4489       # after this tag, mechanisms are not by side-effect, so they'll
4490       # only be used when explicitly requested
4491       if test "x$enable_dependency_tracking" = xyes; then
4492         continue
4493       else
4494         break
4495       fi
4496       ;;
4497     msvisualcpp | msvcmsys)
4498       # This compiler won't grok `-c -o', but also, the minuso test has
4499       # not run yet.  These depmodes are late enough in the game, and
4500       # so weak that their functioning should not be impacted.
4501       am__obj=conftest.${OBJEXT-o}
4502       am__minus_obj=
4503       ;;
4504     none) break ;;
4505     esac
4506     if depmode=$depmode \
4507        source=sub/conftest.c object=$am__obj \
4508        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
4509        $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
4510          >/dev/null 2>conftest.err &&
4511        grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
4512        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
4513        grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
4514        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
4515       # icc doesn't choke on unknown options, it will just issue warnings
4516       # or remarks (even with -Werror).  So we grep stderr for any message
4517       # that says an option was ignored or not supported.
4518       # When given -MP, icc 7.0 and 7.1 complain thusly:
4519       #   icc: Command line warning: ignoring option '-M'; no argument required
4520       # The diagnosis changed in icc 8.0:
4521       #   icc: Command line remark: option '-MP' not supported
4522       if (grep 'ignoring option' conftest.err ||
4523           grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
4524         am_cv_$1_dependencies_compiler_type=$depmode
4525         break
4526       fi
4527     fi
4528   done
4529
4530   cd ..
4531   rm -rf conftest.dir
4532 else
4533   am_cv_$1_dependencies_compiler_type=none
4534 fi
4535 ])
4536 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
4537 AM_CONDITIONAL([am__fastdep$1], [
4538   test "x$enable_dependency_tracking" != xno \
4539   && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
4540 ])
4541
4542
4543 # AM_SET_DEPDIR
4544 # -------------
4545 # Choose a directory name for dependency files.
4546 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
4547 AC_DEFUN([AM_SET_DEPDIR],
4548 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
4549 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
4550 ])
4551
4552
4553 # AM_DEP_TRACK
4554 # ------------
4555 AC_DEFUN([AM_DEP_TRACK],
4556 [AC_ARG_ENABLE(dependency-tracking,
4557 [  --disable-dependency-tracking  speeds up one-time build
4558   --enable-dependency-tracking   do not reject slow dependency extractors])
4559 if test "x$enable_dependency_tracking" != xno; then
4560   am_depcomp="$ac_aux_dir/depcomp"
4561   AMDEPBACKSLASH='\'
4562 fi
4563 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
4564 AC_SUBST([AMDEPBACKSLASH])dnl
4565 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
4566 ])
4567
4568 # Generate code to set up dependency tracking.              -*- Autoconf -*-
4569
4570 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
4571 # Free Software Foundation, Inc.
4572 #
4573 # This file is free software; the Free Software Foundation
4574 # gives unlimited permission to copy and/or distribute it,
4575 # with or without modifications, as long as this notice is preserved.
4576
4577 #serial 5
4578
4579 # _AM_OUTPUT_DEPENDENCY_COMMANDS
4580 # ------------------------------
4581 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
4582 [{
4583   # Autoconf 2.62 quotes --file arguments for eval, but not when files
4584   # are listed without --file.  Let's play safe and only enable the eval
4585   # if we detect the quoting.
4586   case $CONFIG_FILES in
4587   *\'*) eval set x "$CONFIG_FILES" ;;
4588   *)   set x $CONFIG_FILES ;;
4589   esac
4590   shift
4591   for mf
4592   do
4593     # Strip MF so we end up with the name of the file.
4594     mf=`echo "$mf" | sed -e 's/:.*$//'`
4595     # Check whether this is an Automake generated Makefile or not.
4596     # We used to match only the files named `Makefile.in', but
4597     # some people rename them; so instead we look at the file content.
4598     # Grep'ing the first line is not enough: some people post-process
4599     # each Makefile.in and add a new line on top of each file to say so.
4600     # Grep'ing the whole file is not good either: AIX grep has a line
4601     # limit of 2048, but all sed's we know have understand at least 4000.
4602     if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
4603       dirpart=`AS_DIRNAME("$mf")`
4604     else
4605       continue
4606     fi
4607     # Extract the definition of DEPDIR, am__include, and am__quote
4608     # from the Makefile without running `make'.
4609     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
4610     test -z "$DEPDIR" && continue
4611     am__include=`sed -n 's/^am__include = //p' < "$mf"`
4612     test -z "am__include" && continue
4613     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
4614     # When using ansi2knr, U may be empty or an underscore; expand it
4615     U=`sed -n 's/^U = //p' < "$mf"`
4616     # Find all dependency output files, they are included files with
4617     # $(DEPDIR) in their names.  We invoke sed twice because it is the
4618     # simplest approach to changing $(DEPDIR) to its actual value in the
4619     # expansion.
4620     for file in `sed -n "
4621       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
4622          sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
4623       # Make sure the directory exists.
4624       test -f "$dirpart/$file" && continue
4625       fdir=`AS_DIRNAME(["$file"])`
4626       AS_MKDIR_P([$dirpart/$fdir])
4627       # echo "creating $dirpart/$file"
4628       echo '# dummy' > "$dirpart/$file"
4629     done
4630   done
4631 }
4632 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
4633
4634
4635 # AM_OUTPUT_DEPENDENCY_COMMANDS
4636 # -----------------------------
4637 # This macro should only be invoked once -- use via AC_REQUIRE.
4638 #
4639 # This code is only required when automatic dependency tracking
4640 # is enabled.  FIXME.  This creates each `.P' file that we will
4641 # need in order to bootstrap the dependency handling code.
4642 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4643 [AC_CONFIG_COMMANDS([depfiles],
4644      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4645      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4646 ])
4647
4648 # Do all the work for Automake.                             -*- Autoconf -*-
4649
4650 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4651 # 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
4652 #
4653 # This file is free software; the Free Software Foundation
4654 # gives unlimited permission to copy and/or distribute it,
4655 # with or without modifications, as long as this notice is preserved.
4656
4657 # serial 16
4658
4659 # This macro actually does too much.  Some checks are only needed if
4660 # your package does certain things.  But this isn't really a big deal.
4661
4662 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4663 # AM_INIT_AUTOMAKE([OPTIONS])
4664 # -----------------------------------------------
4665 # The call with PACKAGE and VERSION arguments is the old style
4666 # call (pre autoconf-2.50), which is being phased out.  PACKAGE
4667 # and VERSION should now be passed to AC_INIT and removed from
4668 # the call to AM_INIT_AUTOMAKE.
4669 # We support both call styles for the transition.  After
4670 # the next Automake release, Autoconf can make the AC_INIT
4671 # arguments mandatory, and then we can depend on a new Autoconf
4672 # release and drop the old call support.
4673 AC_DEFUN([AM_INIT_AUTOMAKE],
4674 [AC_PREREQ([2.62])dnl
4675 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
4676 dnl the ones we care about.
4677 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4678 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4679 AC_REQUIRE([AC_PROG_INSTALL])dnl
4680 if test "`cd $srcdir && pwd`" != "`pwd`"; then
4681   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4682   # is not polluted with repeated "-I."
4683   AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4684   # test to see if srcdir already configured
4685   if test -f $srcdir/config.status; then
4686     AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4687   fi
4688 fi
4689
4690 # test whether we have cygpath
4691 if test -z "$CYGPATH_W"; then
4692   if (cygpath --version) >/dev/null 2>/dev/null; then
4693     CYGPATH_W='cygpath -w'
4694   else
4695     CYGPATH_W=echo
4696   fi
4697 fi
4698 AC_SUBST([CYGPATH_W])
4699
4700 # Define the identity of the package.
4701 dnl Distinguish between old-style and new-style calls.
4702 m4_ifval([$2],
4703 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4704  AC_SUBST([PACKAGE], [$1])dnl
4705  AC_SUBST([VERSION], [$2])],
4706 [_AM_SET_OPTIONS([$1])dnl
4707 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4708 m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4709   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4710  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4711  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4712
4713 _AM_IF_OPTION([no-define],,
4714 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4715  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4716
4717 # Some tools Automake needs.
4718 AC_REQUIRE([AM_SANITY_CHECK])dnl
4719 AC_REQUIRE([AC_ARG_PROGRAM])dnl
4720 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4721 AM_MISSING_PROG(AUTOCONF, autoconf)
4722 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4723 AM_MISSING_PROG(AUTOHEADER, autoheader)
4724 AM_MISSING_PROG(MAKEINFO, makeinfo)
4725 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4726 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4727 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
4728 # We need awk for the "check" target.  The system "awk" is bad on
4729 # some platforms.
4730 AC_REQUIRE([AC_PROG_AWK])dnl
4731 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
4732 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
4733 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4734               [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
4735                              [_AM_PROG_TAR([v7])])])
4736 _AM_IF_OPTION([no-dependencies],,
4737 [AC_PROVIDE_IFELSE([AC_PROG_CC],
4738                   [_AM_DEPENDENCIES(CC)],
4739                   [define([AC_PROG_CC],
4740                           defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
4741 AC_PROVIDE_IFELSE([AC_PROG_CXX],
4742                   [_AM_DEPENDENCIES(CXX)],
4743                   [define([AC_PROG_CXX],
4744                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
4745 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
4746                   [_AM_DEPENDENCIES(OBJC)],
4747                   [define([AC_PROG_OBJC],
4748                           defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
4749 ])
4750 _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
4751 dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
4752 dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
4753 dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
4754 AC_CONFIG_COMMANDS_PRE(dnl
4755 [m4_provide_if([_AM_COMPILER_EXEEXT],
4756   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
4757 ])
4758
4759 dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
4760 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
4761 dnl mangled by Autoconf and run in a shell conditional statement.
4762 m4_define([_AC_COMPILER_EXEEXT],
4763 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
4764
4765
4766 # When config.status generates a header, we must update the stamp-h file.
4767 # This file resides in the same directory as the config header
4768 # that is generated.  The stamp files are numbered to have different names.
4769
4770 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
4771 # loop where config.status creates the headers, so we can generate
4772 # our stamp files there.
4773 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
4774 [# Compute $1's index in $config_headers.
4775 _am_arg=$1
4776 _am_stamp_count=1
4777 for _am_header in $config_headers :; do
4778   case $_am_header in
4779     $_am_arg | $_am_arg:* )
4780       break ;;
4781     * )
4782       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
4783   esac
4784 done
4785 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
4786
4787 # Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
4788 #
4789 # This file is free software; the Free Software Foundation
4790 # gives unlimited permission to copy and/or distribute it,
4791 # with or without modifications, as long as this notice is preserved.
4792
4793 # AM_PROG_INSTALL_SH
4794 # ------------------
4795 # Define $install_sh.
4796 AC_DEFUN([AM_PROG_INSTALL_SH],
4797 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4798 if test x"${install_sh}" != xset; then
4799   case $am_aux_dir in
4800   *\ * | *\     *)
4801     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
4802   *)
4803     install_sh="\${SHELL} $am_aux_dir/install-sh"
4804   esac
4805 fi
4806 AC_SUBST(install_sh)])
4807
4808 # Copyright (C) 2003, 2005  Free Software Foundation, Inc.
4809 #
4810 # This file is free software; the Free Software Foundation
4811 # gives unlimited permission to copy and/or distribute it,
4812 # with or without modifications, as long as this notice is preserved.
4813
4814 # serial 2
4815
4816 # Check whether the underlying file-system supports filenames
4817 # with a leading dot.  For instance MS-DOS doesn't.
4818 AC_DEFUN([AM_SET_LEADING_DOT],
4819 [rm -rf .tst 2>/dev/null
4820 mkdir .tst 2>/dev/null
4821 if test -d .tst; then
4822   am__leading_dot=.
4823 else
4824   am__leading_dot=_
4825 fi
4826 rmdir .tst 2>/dev/null
4827 AC_SUBST([am__leading_dot])])
4828
4829 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
4830 # From Jim Meyering
4831
4832 # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
4833 # Free Software Foundation, Inc.
4834 #
4835 # This file is free software; the Free Software Foundation
4836 # gives unlimited permission to copy and/or distribute it,
4837 # with or without modifications, as long as this notice is preserved.
4838
4839 # serial 5
4840
4841 # AM_MAINTAINER_MODE([DEFAULT-MODE])
4842 # ----------------------------------
4843 # Control maintainer-specific portions of Makefiles.
4844 # Default is to disable them, unless `enable' is passed literally.
4845 # For symmetry, `disable' may be passed as well.  Anyway, the user
4846 # can override the default with the --enable/--disable switch.
4847 AC_DEFUN([AM_MAINTAINER_MODE],
4848 [m4_case(m4_default([$1], [disable]),
4849        [enable], [m4_define([am_maintainer_other], [disable])],
4850        [disable], [m4_define([am_maintainer_other], [enable])],
4851        [m4_define([am_maintainer_other], [enable])
4852         m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
4853 AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
4854   dnl maintainer-mode's default is 'disable' unless 'enable' is passed
4855   AC_ARG_ENABLE([maintainer-mode],
4856 [  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
4857                           (and sometimes confusing) to the casual installer],
4858       [USE_MAINTAINER_MODE=$enableval],
4859       [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
4860   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
4861   AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
4862   MAINT=$MAINTAINER_MODE_TRUE
4863   AC_SUBST([MAINT])dnl
4864 ]
4865 )
4866
4867 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
4868
4869 # Check to see how 'make' treats includes.                  -*- Autoconf -*-
4870
4871 # Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
4872 #
4873 # This file is free software; the Free Software Foundation
4874 # gives unlimited permission to copy and/or distribute it,
4875 # with or without modifications, as long as this notice is preserved.
4876
4877 # serial 4
4878
4879 # AM_MAKE_INCLUDE()
4880 # -----------------
4881 # Check to see how make treats includes.
4882 AC_DEFUN([AM_MAKE_INCLUDE],
4883 [am_make=${MAKE-make}
4884 cat > confinc << 'END'
4885 am__doit:
4886         @echo this is the am__doit target
4887 .PHONY: am__doit
4888 END
4889 # If we don't find an include directive, just comment out the code.
4890 AC_MSG_CHECKING([for style of include used by $am_make])
4891 am__include="#"
4892 am__quote=
4893 _am_result=none
4894 # First try GNU make style include.
4895 echo "include confinc" > confmf
4896 # Ignore all kinds of additional output from `make'.
4897 case `$am_make -s -f confmf 2> /dev/null` in #(
4898 *the\ am__doit\ target*)
4899   am__include=include
4900   am__quote=
4901   _am_result=GNU
4902   ;;
4903 esac
4904 # Now try BSD make style include.
4905 if test "$am__include" = "#"; then
4906    echo '.include "confinc"' > confmf
4907    case `$am_make -s -f confmf 2> /dev/null` in #(
4908    *the\ am__doit\ target*)
4909      am__include=.include
4910      am__quote="\""
4911      _am_result=BSD
4912      ;;
4913    esac
4914 fi
4915 AC_SUBST([am__include])
4916 AC_SUBST([am__quote])
4917 AC_MSG_RESULT([$_am_result])
4918 rm -f confinc confmf
4919 ])
4920
4921 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
4922
4923 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
4924 # Free Software Foundation, Inc.
4925 #
4926 # This file is free software; the Free Software Foundation
4927 # gives unlimited permission to copy and/or distribute it,
4928 # with or without modifications, as long as this notice is preserved.
4929
4930 # serial 6
4931
4932 # AM_MISSING_PROG(NAME, PROGRAM)
4933 # ------------------------------
4934 AC_DEFUN([AM_MISSING_PROG],
4935 [AC_REQUIRE([AM_MISSING_HAS_RUN])
4936 $1=${$1-"${am_missing_run}$2"}
4937 AC_SUBST($1)])
4938
4939
4940 # AM_MISSING_HAS_RUN
4941 # ------------------
4942 # Define MISSING if not defined so far and test if it supports --run.
4943 # If it does, set am_missing_run to use it, otherwise, to nothing.
4944 AC_DEFUN([AM_MISSING_HAS_RUN],
4945 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4946 AC_REQUIRE_AUX_FILE([missing])dnl
4947 if test x"${MISSING+set}" != xset; then
4948   case $am_aux_dir in
4949   *\ * | *\     *)
4950     MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
4951   *)
4952     MISSING="\${SHELL} $am_aux_dir/missing" ;;
4953   esac
4954 fi
4955 # Use eval to expand $SHELL
4956 if eval "$MISSING --run true"; then
4957   am_missing_run="$MISSING --run "
4958 else
4959   am_missing_run=
4960   AC_MSG_WARN([`missing' script is too old or missing])
4961 fi
4962 ])
4963
4964 # Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
4965 #
4966 # This file is free software; the Free Software Foundation
4967 # gives unlimited permission to copy and/or distribute it,
4968 # with or without modifications, as long as this notice is preserved.
4969
4970 # AM_PROG_MKDIR_P
4971 # ---------------
4972 # Check for `mkdir -p'.
4973 AC_DEFUN([AM_PROG_MKDIR_P],
4974 [AC_PREREQ([2.60])dnl
4975 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
4976 dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
4977 dnl while keeping a definition of mkdir_p for backward compatibility.
4978 dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
4979 dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
4980 dnl Makefile.ins that do not define MKDIR_P, so we do our own
4981 dnl adjustment using top_builddir (which is defined more often than
4982 dnl MKDIR_P).
4983 AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
4984 case $mkdir_p in
4985   [[\\/$]]* | ?:[[\\/]]*) ;;
4986   */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
4987 esac
4988 ])
4989
4990 # Helper functions for option handling.                     -*- Autoconf -*-
4991
4992 # Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
4993 #
4994 # This file is free software; the Free Software Foundation
4995 # gives unlimited permission to copy and/or distribute it,
4996 # with or without modifications, as long as this notice is preserved.
4997
4998 # serial 4
4999
5000 # _AM_MANGLE_OPTION(NAME)
5001 # -----------------------
5002 AC_DEFUN([_AM_MANGLE_OPTION],
5003 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
5004
5005 # _AM_SET_OPTION(NAME)
5006 # ------------------------------
5007 # Set option NAME.  Presently that only means defining a flag for this option.
5008 AC_DEFUN([_AM_SET_OPTION],
5009 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
5010
5011 # _AM_SET_OPTIONS(OPTIONS)
5012 # ----------------------------------
5013 # OPTIONS is a space-separated list of Automake options.
5014 AC_DEFUN([_AM_SET_OPTIONS],
5015 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
5016
5017 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
5018 # -------------------------------------------
5019 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
5020 AC_DEFUN([_AM_IF_OPTION],
5021 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
5022
5023 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
5024
5025 # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
5026 # Free Software Foundation, Inc.
5027 #
5028 # This file is free software; the Free Software Foundation
5029 # gives unlimited permission to copy and/or distribute it,
5030 # with or without modifications, as long as this notice is preserved.
5031
5032 # serial 5
5033
5034 # AM_SANITY_CHECK
5035 # ---------------
5036 AC_DEFUN([AM_SANITY_CHECK],
5037 [AC_MSG_CHECKING([whether build environment is sane])
5038 # Just in case
5039 sleep 1
5040 echo timestamp > conftest.file
5041 # Reject unsafe characters in $srcdir or the absolute working directory
5042 # name.  Accept space and tab only in the latter.
5043 am_lf='
5044 '
5045 case `pwd` in
5046   *[[\\\"\#\$\&\'\`$am_lf]]*)
5047     AC_MSG_ERROR([unsafe absolute working directory name]);;
5048 esac
5049 case $srcdir in
5050   *[[\\\"\#\$\&\'\`$am_lf\ \    ]]*)
5051     AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
5052 esac
5053
5054 # Do `set' in a subshell so we don't clobber the current shell's
5055 # arguments.  Must try -L first in case configure is actually a
5056 # symlink; some systems play weird games with the mod time of symlinks
5057 # (eg FreeBSD returns the mod time of the symlink's containing
5058 # directory).
5059 if (
5060    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
5061    if test "$[*]" = "X"; then
5062       # -L didn't work.
5063       set X `ls -t "$srcdir/configure" conftest.file`
5064    fi
5065    rm -f conftest.file
5066    if test "$[*]" != "X $srcdir/configure conftest.file" \
5067       && test "$[*]" != "X conftest.file $srcdir/configure"; then
5068
5069       # If neither matched, then we have a broken ls.  This can happen
5070       # if, for instance, CONFIG_SHELL is bash and it inherits a
5071       # broken ls alias from the environment.  This has actually
5072       # happened.  Such a system could not be considered "sane".
5073       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
5074 alias in your environment])
5075    fi
5076
5077    test "$[2]" = conftest.file
5078    )
5079 then
5080    # Ok.
5081    :
5082 else
5083    AC_MSG_ERROR([newly created file is older than distributed files!
5084 Check your system clock])
5085 fi
5086 AC_MSG_RESULT(yes)])
5087
5088 # Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
5089 #
5090 # This file is free software; the Free Software Foundation
5091 # gives unlimited permission to copy and/or distribute it,
5092 # with or without modifications, as long as this notice is preserved.
5093
5094 # AM_PROG_INSTALL_STRIP
5095 # ---------------------
5096 # One issue with vendor `install' (even GNU) is that you can't
5097 # specify the program used to strip binaries.  This is especially
5098 # annoying in cross-compiling environments, where the build's strip
5099 # is unlikely to handle the host's binaries.
5100 # Fortunately install-sh will honor a STRIPPROG variable, so we
5101 # always use install-sh in `make install-strip', and initialize
5102 # STRIPPROG with the value of the STRIP variable (set by the user).
5103 AC_DEFUN([AM_PROG_INSTALL_STRIP],
5104 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
5105 # Installed binaries are usually stripped using `strip' when the user
5106 # run `make install-strip'.  However `strip' might not be the right
5107 # tool to use in cross-compilation environments, therefore Automake
5108 # will honor the `STRIP' environment variable to overrule this program.
5109 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
5110 if test "$cross_compiling" != no; then
5111   AC_CHECK_TOOL([STRIP], [strip], :)
5112 fi
5113 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
5114 AC_SUBST([INSTALL_STRIP_PROGRAM])])
5115
5116 # Copyright (C) 2006, 2008  Free Software Foundation, Inc.
5117 #
5118 # This file is free software; the Free Software Foundation
5119 # gives unlimited permission to copy and/or distribute it,
5120 # with or without modifications, as long as this notice is preserved.
5121
5122 # serial 2
5123
5124 # _AM_SUBST_NOTMAKE(VARIABLE)
5125 # ---------------------------
5126 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
5127 # This macro is traced by Automake.
5128 AC_DEFUN([_AM_SUBST_NOTMAKE])
5129
5130 # AM_SUBST_NOTMAKE(VARIABLE)
5131 # ---------------------------
5132 # Public sister of _AM_SUBST_NOTMAKE.
5133 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
5134
5135 # Check how to create a tarball.                            -*- Autoconf -*-
5136
5137 # Copyright (C) 2004, 2005  Free Software Foundation, Inc.
5138 #
5139 # This file is free software; the Free Software Foundation
5140 # gives unlimited permission to copy and/or distribute it,
5141 # with or without modifications, as long as this notice is preserved.
5142
5143 # serial 2
5144
5145 # _AM_PROG_TAR(FORMAT)
5146 # --------------------
5147 # Check how to create a tarball in format FORMAT.
5148 # FORMAT should be one of `v7', `ustar', or `pax'.
5149 #
5150 # Substitute a variable $(am__tar) that is a command
5151 # writing to stdout a FORMAT-tarball containing the directory
5152 # $tardir.
5153 #     tardir=directory && $(am__tar) > result.tar
5154 #
5155 # Substitute a variable $(am__untar) that extract such
5156 # a tarball read from stdin.
5157 #     $(am__untar) < result.tar
5158 AC_DEFUN([_AM_PROG_TAR],
5159 [# Always define AMTAR for backward compatibility.
5160 AM_MISSING_PROG([AMTAR], [tar])
5161 m4_if([$1], [v7],
5162      [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
5163      [m4_case([$1], [ustar],, [pax],,
5164               [m4_fatal([Unknown tar format])])
5165 AC_MSG_CHECKING([how to create a $1 tar archive])
5166 # Loop over all known methods to create a tar archive until one works.
5167 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
5168 _am_tools=${am_cv_prog_tar_$1-$_am_tools}
5169 # Do not fold the above two line into one, because Tru64 sh and
5170 # Solaris sh will not grok spaces in the rhs of `-'.
5171 for _am_tool in $_am_tools
5172 do
5173   case $_am_tool in
5174   gnutar)
5175     for _am_tar in tar gnutar gtar;
5176     do
5177       AM_RUN_LOG([$_am_tar --version]) && break
5178     done
5179     am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
5180     am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
5181     am__untar="$_am_tar -xf -"
5182     ;;
5183   plaintar)
5184     # Must skip GNU tar: if it does not support --format= it doesn't create
5185     # ustar tarball either.
5186     (tar --version) >/dev/null 2>&1 && continue
5187     am__tar='tar chf - "$$tardir"'
5188     am__tar_='tar chf - "$tardir"'
5189     am__untar='tar xf -'
5190     ;;
5191   pax)
5192     am__tar='pax -L -x $1 -w "$$tardir"'
5193     am__tar_='pax -L -x $1 -w "$tardir"'
5194     am__untar='pax -r'
5195     ;;
5196   cpio)
5197     am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
5198     am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
5199     am__untar='cpio -i -H $1 -d'
5200     ;;
5201   none)
5202     am__tar=false
5203     am__tar_=false
5204     am__untar=false
5205     ;;
5206   esac
5207
5208   # If the value was cached, stop now.  We just wanted to have am__tar
5209   # and am__untar set.
5210   test -n "${am_cv_prog_tar_$1}" && break
5211
5212   # tar/untar a dummy directory, and stop if the command works
5213   rm -rf conftest.dir
5214   mkdir conftest.dir
5215   echo GrepMe > conftest.dir/file
5216   AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
5217   rm -rf conftest.dir
5218   if test -s conftest.tar; then
5219     AM_RUN_LOG([$am__untar <conftest.tar])
5220     grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
5221   fi
5222 done
5223 rm -rf conftest.dir
5224
5225 AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
5226 AC_MSG_RESULT([$am_cv_prog_tar_$1])])
5227 AC_SUBST([am__tar])
5228 AC_SUBST([am__untar])
5229 ]) # _AM_PROG_TAR
5230