Imported Upstream version 4.2
[platform/upstream/dosfstools.git] / aclocal.m4
1 # generated automatically by aclocal 1.16.1 -*- Autoconf -*-
2
3 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
4
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_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15 m4_ifndef([AC_AUTOCONF_VERSION],
16   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18 [m4_warning([this file was generated for autoconf 2.69.
19 You have another version of autoconf.  It may work, but is not guaranteed to.
20 If you have problems, you may need to regenerate the build system entirely.
21 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
22
23 # iconv.m4 serial 19 (gettext-0.18.2)
24 dnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc.
25 dnl This file is free software; the Free Software Foundation
26 dnl gives unlimited permission to copy and/or distribute it,
27 dnl with or without modifications, as long as this notice is preserved.
28
29 dnl From Bruno Haible.
30
31 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
32 [
33   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
34   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
35   AC_REQUIRE([AC_LIB_RPATH])
36
37   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
38   dnl accordingly.
39   AC_LIB_LINKFLAGS_BODY([iconv])
40 ])
41
42 AC_DEFUN([AM_ICONV_LINK],
43 [
44   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
45   dnl those with the standalone portable GNU libiconv installed).
46   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
47
48   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
49   dnl accordingly.
50   AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
51
52   dnl Add $INCICONV to CPPFLAGS before performing the following checks,
53   dnl because if the user has installed libiconv and not disabled its use
54   dnl via --without-libiconv-prefix, he wants to use it. The first
55   dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
56   am_save_CPPFLAGS="$CPPFLAGS"
57   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
58
59   AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
60     am_cv_func_iconv="no, consider installing GNU libiconv"
61     am_cv_lib_iconv=no
62     AC_LINK_IFELSE(
63       [AC_LANG_PROGRAM(
64          [[
65 #include <stdlib.h>
66 #include <iconv.h>
67          ]],
68          [[iconv_t cd = iconv_open("","");
69            iconv(cd,NULL,NULL,NULL,NULL);
70            iconv_close(cd);]])],
71       [am_cv_func_iconv=yes])
72     if test "$am_cv_func_iconv" != yes; then
73       am_save_LIBS="$LIBS"
74       LIBS="$LIBS $LIBICONV"
75       AC_LINK_IFELSE(
76         [AC_LANG_PROGRAM(
77            [[
78 #include <stdlib.h>
79 #include <iconv.h>
80            ]],
81            [[iconv_t cd = iconv_open("","");
82              iconv(cd,NULL,NULL,NULL,NULL);
83              iconv_close(cd);]])],
84         [am_cv_lib_iconv=yes]
85         [am_cv_func_iconv=yes])
86       LIBS="$am_save_LIBS"
87     fi
88   ])
89   if test "$am_cv_func_iconv" = yes; then
90     AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
91       dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
92       dnl Solaris 10.
93       am_save_LIBS="$LIBS"
94       if test $am_cv_lib_iconv = yes; then
95         LIBS="$LIBS $LIBICONV"
96       fi
97       am_cv_func_iconv_works=no
98       for ac_iconv_const in '' 'const'; do
99         AC_RUN_IFELSE(
100           [AC_LANG_PROGRAM(
101              [[
102 #include <iconv.h>
103 #include <string.h>
104
105 #ifndef ICONV_CONST
106 # define ICONV_CONST $ac_iconv_const
107 #endif
108              ]],
109              [[int result = 0;
110   /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
111      returns.  */
112   {
113     iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
114     if (cd_utf8_to_88591 != (iconv_t)(-1))
115       {
116         static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
117         char buf[10];
118         ICONV_CONST char *inptr = input;
119         size_t inbytesleft = strlen (input);
120         char *outptr = buf;
121         size_t outbytesleft = sizeof (buf);
122         size_t res = iconv (cd_utf8_to_88591,
123                             &inptr, &inbytesleft,
124                             &outptr, &outbytesleft);
125         if (res == 0)
126           result |= 1;
127         iconv_close (cd_utf8_to_88591);
128       }
129   }
130   /* Test against Solaris 10 bug: Failures are not distinguishable from
131      successful returns.  */
132   {
133     iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
134     if (cd_ascii_to_88591 != (iconv_t)(-1))
135       {
136         static ICONV_CONST char input[] = "\263";
137         char buf[10];
138         ICONV_CONST char *inptr = input;
139         size_t inbytesleft = strlen (input);
140         char *outptr = buf;
141         size_t outbytesleft = sizeof (buf);
142         size_t res = iconv (cd_ascii_to_88591,
143                             &inptr, &inbytesleft,
144                             &outptr, &outbytesleft);
145         if (res == 0)
146           result |= 2;
147         iconv_close (cd_ascii_to_88591);
148       }
149   }
150   /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
151   {
152     iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
153     if (cd_88591_to_utf8 != (iconv_t)(-1))
154       {
155         static ICONV_CONST char input[] = "\304";
156         static char buf[2] = { (char)0xDE, (char)0xAD };
157         ICONV_CONST char *inptr = input;
158         size_t inbytesleft = 1;
159         char *outptr = buf;
160         size_t outbytesleft = 1;
161         size_t res = iconv (cd_88591_to_utf8,
162                             &inptr, &inbytesleft,
163                             &outptr, &outbytesleft);
164         if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
165           result |= 4;
166         iconv_close (cd_88591_to_utf8);
167       }
168   }
169 #if 0 /* This bug could be worked around by the caller.  */
170   /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
171   {
172     iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
173     if (cd_88591_to_utf8 != (iconv_t)(-1))
174       {
175         static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
176         char buf[50];
177         ICONV_CONST char *inptr = input;
178         size_t inbytesleft = strlen (input);
179         char *outptr = buf;
180         size_t outbytesleft = sizeof (buf);
181         size_t res = iconv (cd_88591_to_utf8,
182                             &inptr, &inbytesleft,
183                             &outptr, &outbytesleft);
184         if ((int)res > 0)
185           result |= 8;
186         iconv_close (cd_88591_to_utf8);
187       }
188   }
189 #endif
190   /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
191      provided.  */
192   if (/* Try standardized names.  */
193       iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
194       /* Try IRIX, OSF/1 names.  */
195       && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
196       /* Try AIX names.  */
197       && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
198       /* Try HP-UX names.  */
199       && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
200     result |= 16;
201   return result;
202 ]])],
203           [am_cv_func_iconv_works=yes], ,
204           [case "$host_os" in
205              aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
206              *)            am_cv_func_iconv_works="guessing yes" ;;
207            esac])
208         test "$am_cv_func_iconv_works" = no || break
209       done
210       LIBS="$am_save_LIBS"
211     ])
212     case "$am_cv_func_iconv_works" in
213       *no) am_func_iconv=no am_cv_lib_iconv=no ;;
214       *)   am_func_iconv=yes ;;
215     esac
216   else
217     am_func_iconv=no am_cv_lib_iconv=no
218   fi
219   if test "$am_func_iconv" = yes; then
220     AC_DEFINE([HAVE_ICONV], [1],
221       [Define if you have the iconv() function and it works.])
222   fi
223   if test "$am_cv_lib_iconv" = yes; then
224     AC_MSG_CHECKING([how to link with libiconv])
225     AC_MSG_RESULT([$LIBICONV])
226   else
227     dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
228     dnl either.
229     CPPFLAGS="$am_save_CPPFLAGS"
230     LIBICONV=
231     LTLIBICONV=
232   fi
233   AC_SUBST([LIBICONV])
234   AC_SUBST([LTLIBICONV])
235 ])
236
237 dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
238 dnl avoid warnings like
239 dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
240 dnl This is tricky because of the way 'aclocal' is implemented:
241 dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
242 dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
243 dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
244 dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
245 dnl   warnings.
246 m4_define([gl_iconv_AC_DEFUN],
247   m4_version_prereq([2.64],
248     [[AC_DEFUN_ONCE(
249         [$1], [$2])]],
250     [m4_ifdef([gl_00GNULIB],
251        [[AC_DEFUN_ONCE(
252            [$1], [$2])]],
253        [[AC_DEFUN(
254            [$1], [$2])]])]))
255 gl_iconv_AC_DEFUN([AM_ICONV],
256 [
257   AM_ICONV_LINK
258   if test "$am_cv_func_iconv" = yes; then
259     AC_MSG_CHECKING([for iconv declaration])
260     AC_CACHE_VAL([am_cv_proto_iconv], [
261       AC_COMPILE_IFELSE(
262         [AC_LANG_PROGRAM(
263            [[
264 #include <stdlib.h>
265 #include <iconv.h>
266 extern
267 #ifdef __cplusplus
268 "C"
269 #endif
270 #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
271 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
272 #else
273 size_t iconv();
274 #endif
275            ]],
276            [[]])],
277         [am_cv_proto_iconv_arg1=""],
278         [am_cv_proto_iconv_arg1="const"])
279       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);"])
280     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
281     AC_MSG_RESULT([
282          $am_cv_proto_iconv])
283     AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
284       [Define as const if the declaration of iconv() needs const.])
285     dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
286     m4_ifdef([gl_ICONV_H_DEFAULTS],
287       [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
288        if test -n "$am_cv_proto_iconv_arg1"; then
289          ICONV_CONST="const"
290        fi
291       ])
292   fi
293 ])
294
295 # lib-ld.m4 serial 6
296 dnl Copyright (C) 1996-2003, 2009-2016 Free Software Foundation, Inc.
297 dnl This file is free software; the Free Software Foundation
298 dnl gives unlimited permission to copy and/or distribute it,
299 dnl with or without modifications, as long as this notice is preserved.
300
301 dnl Subroutines of libtool.m4,
302 dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
303 dnl collision with libtool.m4.
304
305 dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
306 AC_DEFUN([AC_LIB_PROG_LD_GNU],
307 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
308 [# I'd rather use --version here, but apparently some GNU lds only accept -v.
309 case `$LD -v 2>&1 </dev/null` in
310 *GNU* | *'with BFD'*)
311   acl_cv_prog_gnu_ld=yes
312   ;;
313 *)
314   acl_cv_prog_gnu_ld=no
315   ;;
316 esac])
317 with_gnu_ld=$acl_cv_prog_gnu_ld
318 ])
319
320 dnl From libtool-2.4. Sets the variable LD.
321 AC_DEFUN([AC_LIB_PROG_LD],
322 [AC_REQUIRE([AC_PROG_CC])dnl
323 AC_REQUIRE([AC_CANONICAL_HOST])dnl
324
325 AC_ARG_WITH([gnu-ld],
326     [AS_HELP_STRING([--with-gnu-ld],
327         [assume the C compiler uses GNU ld [default=no]])],
328     [test "$withval" = no || with_gnu_ld=yes],
329     [with_gnu_ld=no])dnl
330
331 # Prepare PATH_SEPARATOR.
332 # The user is always right.
333 if test "${PATH_SEPARATOR+set}" != set; then
334   # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
335   # contains only /bin. Note that ksh looks also at the FPATH variable,
336   # so we have to set that as well for the test.
337   PATH_SEPARATOR=:
338   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
339     && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
340            || PATH_SEPARATOR=';'
341        }
342 fi
343
344 ac_prog=ld
345 if test "$GCC" = yes; then
346   # Check if gcc -print-prog-name=ld gives a path.
347   AC_MSG_CHECKING([for ld used by $CC])
348   case $host in
349   *-*-mingw*)
350     # gcc leaves a trailing carriage return which upsets mingw
351     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
352   *)
353     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
354   esac
355   case $ac_prog in
356     # Accept absolute paths.
357     [[\\/]]* | ?:[[\\/]]*)
358       re_direlt='/[[^/]][[^/]]*/\.\./'
359       # Canonicalize the pathname of ld
360       ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
361       while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
362         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
363       done
364       test -z "$LD" && LD="$ac_prog"
365       ;;
366   "")
367     # If it fails, then pretend we aren't using GCC.
368     ac_prog=ld
369     ;;
370   *)
371     # If it is relative, then search for the first ld in PATH.
372     with_gnu_ld=unknown
373     ;;
374   esac
375 elif test "$with_gnu_ld" = yes; then
376   AC_MSG_CHECKING([for GNU ld])
377 else
378   AC_MSG_CHECKING([for non-GNU ld])
379 fi
380 AC_CACHE_VAL([acl_cv_path_LD],
381 [if test -z "$LD"; then
382   acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
383   for ac_dir in $PATH; do
384     IFS="$acl_save_ifs"
385     test -z "$ac_dir" && ac_dir=.
386     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
387       acl_cv_path_LD="$ac_dir/$ac_prog"
388       # Check to see if the program is GNU ld.  I'd rather use --version,
389       # but apparently some variants of GNU ld only accept -v.
390       # Break only if it was the GNU/non-GNU ld that we prefer.
391       case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
392       *GNU* | *'with BFD'*)
393         test "$with_gnu_ld" != no && break
394         ;;
395       *)
396         test "$with_gnu_ld" != yes && break
397         ;;
398       esac
399     fi
400   done
401   IFS="$acl_save_ifs"
402 else
403   acl_cv_path_LD="$LD" # Let the user override the test with a path.
404 fi])
405 LD="$acl_cv_path_LD"
406 if test -n "$LD"; then
407   AC_MSG_RESULT([$LD])
408 else
409   AC_MSG_RESULT([no])
410 fi
411 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
412 AC_LIB_PROG_LD_GNU
413 ])
414
415 # lib-link.m4 serial 26 (gettext-0.18.2)
416 dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
417 dnl This file is free software; the Free Software Foundation
418 dnl gives unlimited permission to copy and/or distribute it,
419 dnl with or without modifications, as long as this notice is preserved.
420
421 dnl From Bruno Haible.
422
423 AC_PREREQ([2.54])
424
425 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
426 dnl the libraries corresponding to explicit and implicit dependencies.
427 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
428 dnl augments the CPPFLAGS variable.
429 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
430 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
431 AC_DEFUN([AC_LIB_LINKFLAGS],
432 [
433   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
434   AC_REQUIRE([AC_LIB_RPATH])
435   pushdef([Name],[m4_translit([$1],[./+-], [____])])
436   pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
437                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
438   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
439     AC_LIB_LINKFLAGS_BODY([$1], [$2])
440     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
441     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
442     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
443     ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
444   ])
445   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
446   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
447   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
448   LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
449   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
450   AC_SUBST([LIB]NAME)
451   AC_SUBST([LTLIB]NAME)
452   AC_SUBST([LIB]NAME[_PREFIX])
453   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
454   dnl results of this search when this library appears as a dependency.
455   HAVE_LIB[]NAME=yes
456   popdef([NAME])
457   popdef([Name])
458 ])
459
460 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
461 dnl searches for libname and the libraries corresponding to explicit and
462 dnl implicit dependencies, together with the specified include files and
463 dnl the ability to compile and link the specified testcode. The missing-message
464 dnl defaults to 'no' and may contain additional hints for the user.
465 dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
466 dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
467 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
468 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
469 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
470 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
471 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
472 [
473   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
474   AC_REQUIRE([AC_LIB_RPATH])
475   pushdef([Name],[m4_translit([$1],[./+-], [____])])
476   pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
477                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
478
479   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
480   dnl accordingly.
481   AC_LIB_LINKFLAGS_BODY([$1], [$2])
482
483   dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
484   dnl because if the user has installed lib[]Name and not disabled its use
485   dnl via --without-lib[]Name-prefix, he wants to use it.
486   ac_save_CPPFLAGS="$CPPFLAGS"
487   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
488
489   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
490     ac_save_LIBS="$LIBS"
491     dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
492     dnl because these -l options might require -L options that are present in
493     dnl LIBS. -l options benefit only from the -L options listed before it.
494     dnl Otherwise, add it to the front of LIBS, because it may be a static
495     dnl library that depends on another static library that is present in LIBS.
496     dnl Static libraries benefit only from the static libraries listed after
497     dnl it.
498     case " $LIB[]NAME" in
499       *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
500       *)       LIBS="$LIB[]NAME $LIBS" ;;
501     esac
502     AC_LINK_IFELSE(
503       [AC_LANG_PROGRAM([[$3]], [[$4]])],
504       [ac_cv_lib[]Name=yes],
505       [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
506     LIBS="$ac_save_LIBS"
507   ])
508   if test "$ac_cv_lib[]Name" = yes; then
509     HAVE_LIB[]NAME=yes
510     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
511     AC_MSG_CHECKING([how to link with lib[]$1])
512     AC_MSG_RESULT([$LIB[]NAME])
513   else
514     HAVE_LIB[]NAME=no
515     dnl If $LIB[]NAME didn't lead to a usable library, we don't need
516     dnl $INC[]NAME either.
517     CPPFLAGS="$ac_save_CPPFLAGS"
518     LIB[]NAME=
519     LTLIB[]NAME=
520     LIB[]NAME[]_PREFIX=
521   fi
522   AC_SUBST([HAVE_LIB]NAME)
523   AC_SUBST([LIB]NAME)
524   AC_SUBST([LTLIB]NAME)
525   AC_SUBST([LIB]NAME[_PREFIX])
526   popdef([NAME])
527   popdef([Name])
528 ])
529
530 dnl Determine the platform dependent parameters needed to use rpath:
531 dnl   acl_libext,
532 dnl   acl_shlibext,
533 dnl   acl_libname_spec,
534 dnl   acl_library_names_spec,
535 dnl   acl_hardcode_libdir_flag_spec,
536 dnl   acl_hardcode_libdir_separator,
537 dnl   acl_hardcode_direct,
538 dnl   acl_hardcode_minus_L.
539 AC_DEFUN([AC_LIB_RPATH],
540 [
541   dnl Tell automake >= 1.10 to complain if config.rpath is missing.
542   m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
543   AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
544   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
545   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
546   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
547   AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
548     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
549     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
550     . ./conftest.sh
551     rm -f ./conftest.sh
552     acl_cv_rpath=done
553   ])
554   wl="$acl_cv_wl"
555   acl_libext="$acl_cv_libext"
556   acl_shlibext="$acl_cv_shlibext"
557   acl_libname_spec="$acl_cv_libname_spec"
558   acl_library_names_spec="$acl_cv_library_names_spec"
559   acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
560   acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
561   acl_hardcode_direct="$acl_cv_hardcode_direct"
562   acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
563   dnl Determine whether the user wants rpath handling at all.
564   AC_ARG_ENABLE([rpath],
565     [  --disable-rpath         do not hardcode runtime library paths],
566     :, enable_rpath=yes)
567 ])
568
569 dnl AC_LIB_FROMPACKAGE(name, package)
570 dnl declares that libname comes from the given package. The configure file
571 dnl will then not have a --with-libname-prefix option but a
572 dnl --with-package-prefix option. Several libraries can come from the same
573 dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
574 dnl macro call that searches for libname.
575 AC_DEFUN([AC_LIB_FROMPACKAGE],
576 [
577   pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
578                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
579   define([acl_frompackage_]NAME, [$2])
580   popdef([NAME])
581   pushdef([PACK],[$2])
582   pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
583                                      [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
584   define([acl_libsinpackage_]PACKUP,
585     m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
586   popdef([PACKUP])
587   popdef([PACK])
588 ])
589
590 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
591 dnl the libraries corresponding to explicit and implicit dependencies.
592 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
593 dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
594 dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
595 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
596 [
597   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
598   pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
599                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
600   pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
601   pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
602                                      [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
603   pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
604   dnl Autoconf >= 2.61 supports dots in --with options.
605   pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
606   dnl By default, look in $includedir and $libdir.
607   use_additional=yes
608   AC_LIB_WITH_FINAL_PREFIX([
609     eval additional_includedir=\"$includedir\"
610     eval additional_libdir=\"$libdir\"
611   ])
612   AC_ARG_WITH(P_A_C_K[-prefix],
613 [[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
614   --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
615 [
616     if test "X$withval" = "Xno"; then
617       use_additional=no
618     else
619       if test "X$withval" = "X"; then
620         AC_LIB_WITH_FINAL_PREFIX([
621           eval additional_includedir=\"$includedir\"
622           eval additional_libdir=\"$libdir\"
623         ])
624       else
625         additional_includedir="$withval/include"
626         additional_libdir="$withval/$acl_libdirstem"
627         if test "$acl_libdirstem2" != "$acl_libdirstem" \
628            && ! test -d "$withval/$acl_libdirstem"; then
629           additional_libdir="$withval/$acl_libdirstem2"
630         fi
631       fi
632     fi
633 ])
634   dnl Search the library and its dependencies in $additional_libdir and
635   dnl $LDFLAGS. Using breadth-first-seach.
636   LIB[]NAME=
637   LTLIB[]NAME=
638   INC[]NAME=
639   LIB[]NAME[]_PREFIX=
640   dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
641   dnl computed. So it has to be reset here.
642   HAVE_LIB[]NAME=
643   rpathdirs=
644   ltrpathdirs=
645   names_already_handled=
646   names_next_round='$1 $2'
647   while test -n "$names_next_round"; do
648     names_this_round="$names_next_round"
649     names_next_round=
650     for name in $names_this_round; do
651       already_handled=
652       for n in $names_already_handled; do
653         if test "$n" = "$name"; then
654           already_handled=yes
655           break
656         fi
657       done
658       if test -z "$already_handled"; then
659         names_already_handled="$names_already_handled $name"
660         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
661         dnl or AC_LIB_HAVE_LINKFLAGS call.
662         uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
663         eval value=\"\$HAVE_LIB$uppername\"
664         if test -n "$value"; then
665           if test "$value" = yes; then
666             eval value=\"\$LIB$uppername\"
667             test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
668             eval value=\"\$LTLIB$uppername\"
669             test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
670           else
671             dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
672             dnl that this library doesn't exist. So just drop it.
673             :
674           fi
675         else
676           dnl Search the library lib$name in $additional_libdir and $LDFLAGS
677           dnl and the already constructed $LIBNAME/$LTLIBNAME.
678           found_dir=
679           found_la=
680           found_so=
681           found_a=
682           eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
683           if test -n "$acl_shlibext"; then
684             shrext=".$acl_shlibext"             # typically: shrext=.so
685           else
686             shrext=
687           fi
688           if test $use_additional = yes; then
689             dir="$additional_libdir"
690             dnl The same code as in the loop below:
691             dnl First look for a shared library.
692             if test -n "$acl_shlibext"; then
693               if test -f "$dir/$libname$shrext"; then
694                 found_dir="$dir"
695                 found_so="$dir/$libname$shrext"
696               else
697                 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
698                   ver=`(cd "$dir" && \
699                         for f in "$libname$shrext".*; do echo "$f"; done \
700                         | sed -e "s,^$libname$shrext\\\\.,," \
701                         | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
702                         | sed 1q ) 2>/dev/null`
703                   if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
704                     found_dir="$dir"
705                     found_so="$dir/$libname$shrext.$ver"
706                   fi
707                 else
708                   eval library_names=\"$acl_library_names_spec\"
709                   for f in $library_names; do
710                     if test -f "$dir/$f"; then
711                       found_dir="$dir"
712                       found_so="$dir/$f"
713                       break
714                     fi
715                   done
716                 fi
717               fi
718             fi
719             dnl Then look for a static library.
720             if test "X$found_dir" = "X"; then
721               if test -f "$dir/$libname.$acl_libext"; then
722                 found_dir="$dir"
723                 found_a="$dir/$libname.$acl_libext"
724               fi
725             fi
726             if test "X$found_dir" != "X"; then
727               if test -f "$dir/$libname.la"; then
728                 found_la="$dir/$libname.la"
729               fi
730             fi
731           fi
732           if test "X$found_dir" = "X"; then
733             for x in $LDFLAGS $LTLIB[]NAME; do
734               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
735               case "$x" in
736                 -L*)
737                   dir=`echo "X$x" | sed -e 's/^X-L//'`
738                   dnl First look for a shared library.
739                   if test -n "$acl_shlibext"; then
740                     if test -f "$dir/$libname$shrext"; then
741                       found_dir="$dir"
742                       found_so="$dir/$libname$shrext"
743                     else
744                       if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
745                         ver=`(cd "$dir" && \
746                               for f in "$libname$shrext".*; do echo "$f"; done \
747                               | sed -e "s,^$libname$shrext\\\\.,," \
748                               | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
749                               | sed 1q ) 2>/dev/null`
750                         if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
751                           found_dir="$dir"
752                           found_so="$dir/$libname$shrext.$ver"
753                         fi
754                       else
755                         eval library_names=\"$acl_library_names_spec\"
756                         for f in $library_names; do
757                           if test -f "$dir/$f"; then
758                             found_dir="$dir"
759                             found_so="$dir/$f"
760                             break
761                           fi
762                         done
763                       fi
764                     fi
765                   fi
766                   dnl Then look for a static library.
767                   if test "X$found_dir" = "X"; then
768                     if test -f "$dir/$libname.$acl_libext"; then
769                       found_dir="$dir"
770                       found_a="$dir/$libname.$acl_libext"
771                     fi
772                   fi
773                   if test "X$found_dir" != "X"; then
774                     if test -f "$dir/$libname.la"; then
775                       found_la="$dir/$libname.la"
776                     fi
777                   fi
778                   ;;
779               esac
780               if test "X$found_dir" != "X"; then
781                 break
782               fi
783             done
784           fi
785           if test "X$found_dir" != "X"; then
786             dnl Found the library.
787             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
788             if test "X$found_so" != "X"; then
789               dnl Linking with a shared library. We attempt to hardcode its
790               dnl directory into the executable's runpath, unless it's the
791               dnl standard /usr/lib.
792               if test "$enable_rpath" = no \
793                  || test "X$found_dir" = "X/usr/$acl_libdirstem" \
794                  || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
795                 dnl No hardcoding is needed.
796                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
797               else
798                 dnl Use an explicit option to hardcode DIR into the resulting
799                 dnl binary.
800                 dnl Potentially add DIR to ltrpathdirs.
801                 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
802                 haveit=
803                 for x in $ltrpathdirs; do
804                   if test "X$x" = "X$found_dir"; then
805                     haveit=yes
806                     break
807                   fi
808                 done
809                 if test -z "$haveit"; then
810                   ltrpathdirs="$ltrpathdirs $found_dir"
811                 fi
812                 dnl The hardcoding into $LIBNAME is system dependent.
813                 if test "$acl_hardcode_direct" = yes; then
814                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
815                   dnl resulting binary.
816                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
817                 else
818                   if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
819                     dnl Use an explicit option to hardcode DIR into the resulting
820                     dnl binary.
821                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
822                     dnl Potentially add DIR to rpathdirs.
823                     dnl The rpathdirs will be appended to $LIBNAME at the end.
824                     haveit=
825                     for x in $rpathdirs; do
826                       if test "X$x" = "X$found_dir"; then
827                         haveit=yes
828                         break
829                       fi
830                     done
831                     if test -z "$haveit"; then
832                       rpathdirs="$rpathdirs $found_dir"
833                     fi
834                   else
835                     dnl Rely on "-L$found_dir".
836                     dnl But don't add it if it's already contained in the LDFLAGS
837                     dnl or the already constructed $LIBNAME
838                     haveit=
839                     for x in $LDFLAGS $LIB[]NAME; do
840                       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
841                       if test "X$x" = "X-L$found_dir"; then
842                         haveit=yes
843                         break
844                       fi
845                     done
846                     if test -z "$haveit"; then
847                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
848                     fi
849                     if test "$acl_hardcode_minus_L" != no; then
850                       dnl FIXME: Not sure whether we should use
851                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
852                       dnl here.
853                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
854                     else
855                       dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
856                       dnl here, because this doesn't fit in flags passed to the
857                       dnl compiler. So give up. No hardcoding. This affects only
858                       dnl very old systems.
859                       dnl FIXME: Not sure whether we should use
860                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
861                       dnl here.
862                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
863                     fi
864                   fi
865                 fi
866               fi
867             else
868               if test "X$found_a" != "X"; then
869                 dnl Linking with a static library.
870                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
871               else
872                 dnl We shouldn't come here, but anyway it's good to have a
873                 dnl fallback.
874                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
875               fi
876             fi
877             dnl Assume the include files are nearby.
878             additional_includedir=
879             case "$found_dir" in
880               */$acl_libdirstem | */$acl_libdirstem/)
881                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
882                 if test "$name" = '$1'; then
883                   LIB[]NAME[]_PREFIX="$basedir"
884                 fi
885                 additional_includedir="$basedir/include"
886                 ;;
887               */$acl_libdirstem2 | */$acl_libdirstem2/)
888                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
889                 if test "$name" = '$1'; then
890                   LIB[]NAME[]_PREFIX="$basedir"
891                 fi
892                 additional_includedir="$basedir/include"
893                 ;;
894             esac
895             if test "X$additional_includedir" != "X"; then
896               dnl Potentially add $additional_includedir to $INCNAME.
897               dnl But don't add it
898               dnl   1. if it's the standard /usr/include,
899               dnl   2. if it's /usr/local/include and we are using GCC on Linux,
900               dnl   3. if it's already present in $CPPFLAGS or the already
901               dnl      constructed $INCNAME,
902               dnl   4. if it doesn't exist as a directory.
903               if test "X$additional_includedir" != "X/usr/include"; then
904                 haveit=
905                 if test "X$additional_includedir" = "X/usr/local/include"; then
906                   if test -n "$GCC"; then
907                     case $host_os in
908                       linux* | gnu* | k*bsd*-gnu) haveit=yes;;
909                     esac
910                   fi
911                 fi
912                 if test -z "$haveit"; then
913                   for x in $CPPFLAGS $INC[]NAME; do
914                     AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
915                     if test "X$x" = "X-I$additional_includedir"; then
916                       haveit=yes
917                       break
918                     fi
919                   done
920                   if test -z "$haveit"; then
921                     if test -d "$additional_includedir"; then
922                       dnl Really add $additional_includedir to $INCNAME.
923                       INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
924                     fi
925                   fi
926                 fi
927               fi
928             fi
929             dnl Look for dependencies.
930             if test -n "$found_la"; then
931               dnl Read the .la file. It defines the variables
932               dnl dlname, library_names, old_library, dependency_libs, current,
933               dnl age, revision, installed, dlopen, dlpreopen, libdir.
934               save_libdir="$libdir"
935               case "$found_la" in
936                 */* | *\\*) . "$found_la" ;;
937                 *) . "./$found_la" ;;
938               esac
939               libdir="$save_libdir"
940               dnl We use only dependency_libs.
941               for dep in $dependency_libs; do
942                 case "$dep" in
943                   -L*)
944                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
945                     dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
946                     dnl But don't add it
947                     dnl   1. if it's the standard /usr/lib,
948                     dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
949                     dnl   3. if it's already present in $LDFLAGS or the already
950                     dnl      constructed $LIBNAME,
951                     dnl   4. if it doesn't exist as a directory.
952                     if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
953                        && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
954                       haveit=
955                       if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
956                          || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
957                         if test -n "$GCC"; then
958                           case $host_os in
959                             linux* | gnu* | k*bsd*-gnu) haveit=yes;;
960                           esac
961                         fi
962                       fi
963                       if test -z "$haveit"; then
964                         haveit=
965                         for x in $LDFLAGS $LIB[]NAME; do
966                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
967                           if test "X$x" = "X-L$additional_libdir"; then
968                             haveit=yes
969                             break
970                           fi
971                         done
972                         if test -z "$haveit"; then
973                           if test -d "$additional_libdir"; then
974                             dnl Really add $additional_libdir to $LIBNAME.
975                             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
976                           fi
977                         fi
978                         haveit=
979                         for x in $LDFLAGS $LTLIB[]NAME; do
980                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
981                           if test "X$x" = "X-L$additional_libdir"; then
982                             haveit=yes
983                             break
984                           fi
985                         done
986                         if test -z "$haveit"; then
987                           if test -d "$additional_libdir"; then
988                             dnl Really add $additional_libdir to $LTLIBNAME.
989                             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
990                           fi
991                         fi
992                       fi
993                     fi
994                     ;;
995                   -R*)
996                     dir=`echo "X$dep" | sed -e 's/^X-R//'`
997                     if test "$enable_rpath" != no; then
998                       dnl Potentially add DIR to rpathdirs.
999                       dnl The rpathdirs will be appended to $LIBNAME at the end.
1000                       haveit=
1001                       for x in $rpathdirs; do
1002                         if test "X$x" = "X$dir"; then
1003                           haveit=yes
1004                           break
1005                         fi
1006                       done
1007                       if test -z "$haveit"; then
1008                         rpathdirs="$rpathdirs $dir"
1009                       fi
1010                       dnl Potentially add DIR to ltrpathdirs.
1011                       dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1012                       haveit=
1013                       for x in $ltrpathdirs; do
1014                         if test "X$x" = "X$dir"; then
1015                           haveit=yes
1016                           break
1017                         fi
1018                       done
1019                       if test -z "$haveit"; then
1020                         ltrpathdirs="$ltrpathdirs $dir"
1021                       fi
1022                     fi
1023                     ;;
1024                   -l*)
1025                     dnl Handle this in the next round.
1026                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1027                     ;;
1028                   *.la)
1029                     dnl Handle this in the next round. Throw away the .la's
1030                     dnl directory; it is already contained in a preceding -L
1031                     dnl option.
1032                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1033                     ;;
1034                   *)
1035                     dnl Most likely an immediate library name.
1036                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1037                     LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1038                     ;;
1039                 esac
1040               done
1041             fi
1042           else
1043             dnl Didn't find the library; assume it is in the system directories
1044             dnl known to the linker and runtime loader. (All the system
1045             dnl directories known to the linker should also be known to the
1046             dnl runtime loader, otherwise the system is severely misconfigured.)
1047             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1048             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1049           fi
1050         fi
1051       fi
1052     done
1053   done
1054   if test "X$rpathdirs" != "X"; then
1055     if test -n "$acl_hardcode_libdir_separator"; then
1056       dnl Weird platform: only the last -rpath option counts, the user must
1057       dnl pass all path elements in one option. We can arrange that for a
1058       dnl single library, but not when more than one $LIBNAMEs are used.
1059       alldirs=
1060       for found_dir in $rpathdirs; do
1061         alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
1062       done
1063       dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
1064       acl_save_libdir="$libdir"
1065       libdir="$alldirs"
1066       eval flag=\"$acl_hardcode_libdir_flag_spec\"
1067       libdir="$acl_save_libdir"
1068       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1069     else
1070       dnl The -rpath options are cumulative.
1071       for found_dir in $rpathdirs; do
1072         acl_save_libdir="$libdir"
1073         libdir="$found_dir"
1074         eval flag=\"$acl_hardcode_libdir_flag_spec\"
1075         libdir="$acl_save_libdir"
1076         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1077       done
1078     fi
1079   fi
1080   if test "X$ltrpathdirs" != "X"; then
1081     dnl When using libtool, the option that works for both libraries and
1082     dnl executables is -R. The -R options are cumulative.
1083     for found_dir in $ltrpathdirs; do
1084       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1085     done
1086   fi
1087   popdef([P_A_C_K])
1088   popdef([PACKLIBS])
1089   popdef([PACKUP])
1090   popdef([PACK])
1091   popdef([NAME])
1092 ])
1093
1094 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1095 dnl unless already present in VAR.
1096 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1097 dnl contains two or three consecutive elements that belong together.
1098 AC_DEFUN([AC_LIB_APPENDTOVAR],
1099 [
1100   for element in [$2]; do
1101     haveit=
1102     for x in $[$1]; do
1103       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1104       if test "X$x" = "X$element"; then
1105         haveit=yes
1106         break
1107       fi
1108     done
1109     if test -z "$haveit"; then
1110       [$1]="${[$1]}${[$1]:+ }$element"
1111     fi
1112   done
1113 ])
1114
1115 dnl For those cases where a variable contains several -L and -l options
1116 dnl referring to unknown libraries and directories, this macro determines the
1117 dnl necessary additional linker options for the runtime path.
1118 dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
1119 dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
1120 dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
1121 dnl otherwise linking without libtool is assumed.
1122 AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
1123 [
1124   AC_REQUIRE([AC_LIB_RPATH])
1125   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1126   $1=
1127   if test "$enable_rpath" != no; then
1128     if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
1129       dnl Use an explicit option to hardcode directories into the resulting
1130       dnl binary.
1131       rpathdirs=
1132       next=
1133       for opt in $2; do
1134         if test -n "$next"; then
1135           dir="$next"
1136           dnl No need to hardcode the standard /usr/lib.
1137           if test "X$dir" != "X/usr/$acl_libdirstem" \
1138              && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1139             rpathdirs="$rpathdirs $dir"
1140           fi
1141           next=
1142         else
1143           case $opt in
1144             -L) next=yes ;;
1145             -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
1146                  dnl No need to hardcode the standard /usr/lib.
1147                  if test "X$dir" != "X/usr/$acl_libdirstem" \
1148                     && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1149                    rpathdirs="$rpathdirs $dir"
1150                  fi
1151                  next= ;;
1152             *) next= ;;
1153           esac
1154         fi
1155       done
1156       if test "X$rpathdirs" != "X"; then
1157         if test -n ""$3""; then
1158           dnl libtool is used for linking. Use -R options.
1159           for dir in $rpathdirs; do
1160             $1="${$1}${$1:+ }-R$dir"
1161           done
1162         else
1163           dnl The linker is used for linking directly.
1164           if test -n "$acl_hardcode_libdir_separator"; then
1165             dnl Weird platform: only the last -rpath option counts, the user
1166             dnl must pass all path elements in one option.
1167             alldirs=
1168             for dir in $rpathdirs; do
1169               alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
1170             done
1171             acl_save_libdir="$libdir"
1172             libdir="$alldirs"
1173             eval flag=\"$acl_hardcode_libdir_flag_spec\"
1174             libdir="$acl_save_libdir"
1175             $1="$flag"
1176           else
1177             dnl The -rpath options are cumulative.
1178             for dir in $rpathdirs; do
1179               acl_save_libdir="$libdir"
1180               libdir="$dir"
1181               eval flag=\"$acl_hardcode_libdir_flag_spec\"
1182               libdir="$acl_save_libdir"
1183               $1="${$1}${$1:+ }$flag"
1184             done
1185           fi
1186         fi
1187       fi
1188     fi
1189   fi
1190   AC_SUBST([$1])
1191 ])
1192
1193 # lib-prefix.m4 serial 7 (gettext-0.18)
1194 dnl Copyright (C) 2001-2005, 2008-2016 Free Software Foundation, Inc.
1195 dnl This file is free software; the Free Software Foundation
1196 dnl gives unlimited permission to copy and/or distribute it,
1197 dnl with or without modifications, as long as this notice is preserved.
1198
1199 dnl From Bruno Haible.
1200
1201 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
1202 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
1203 dnl require excessive bracketing.
1204 ifdef([AC_HELP_STRING],
1205 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
1206 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
1207
1208 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1209 dnl to access previously installed libraries. The basic assumption is that
1210 dnl a user will want packages to use other packages he previously installed
1211 dnl with the same --prefix option.
1212 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1213 dnl libraries, but is otherwise very convenient.
1214 AC_DEFUN([AC_LIB_PREFIX],
1215 [
1216   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1217   AC_REQUIRE([AC_PROG_CC])
1218   AC_REQUIRE([AC_CANONICAL_HOST])
1219   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1220   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1221   dnl By default, look in $includedir and $libdir.
1222   use_additional=yes
1223   AC_LIB_WITH_FINAL_PREFIX([
1224     eval additional_includedir=\"$includedir\"
1225     eval additional_libdir=\"$libdir\"
1226   ])
1227   AC_LIB_ARG_WITH([lib-prefix],
1228 [  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1229   --without-lib-prefix    don't search for libraries in includedir and libdir],
1230 [
1231     if test "X$withval" = "Xno"; then
1232       use_additional=no
1233     else
1234       if test "X$withval" = "X"; then
1235         AC_LIB_WITH_FINAL_PREFIX([
1236           eval additional_includedir=\"$includedir\"
1237           eval additional_libdir=\"$libdir\"
1238         ])
1239       else
1240         additional_includedir="$withval/include"
1241         additional_libdir="$withval/$acl_libdirstem"
1242       fi
1243     fi
1244 ])
1245   if test $use_additional = yes; then
1246     dnl Potentially add $additional_includedir to $CPPFLAGS.
1247     dnl But don't add it
1248     dnl   1. if it's the standard /usr/include,
1249     dnl   2. if it's already present in $CPPFLAGS,
1250     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1251     dnl   4. if it doesn't exist as a directory.
1252     if test "X$additional_includedir" != "X/usr/include"; then
1253       haveit=
1254       for x in $CPPFLAGS; do
1255         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1256         if test "X$x" = "X-I$additional_includedir"; then
1257           haveit=yes
1258           break
1259         fi
1260       done
1261       if test -z "$haveit"; then
1262         if test "X$additional_includedir" = "X/usr/local/include"; then
1263           if test -n "$GCC"; then
1264             case $host_os in
1265               linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1266             esac
1267           fi
1268         fi
1269         if test -z "$haveit"; then
1270           if test -d "$additional_includedir"; then
1271             dnl Really add $additional_includedir to $CPPFLAGS.
1272             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1273           fi
1274         fi
1275       fi
1276     fi
1277     dnl Potentially add $additional_libdir to $LDFLAGS.
1278     dnl But don't add it
1279     dnl   1. if it's the standard /usr/lib,
1280     dnl   2. if it's already present in $LDFLAGS,
1281     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
1282     dnl   4. if it doesn't exist as a directory.
1283     if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
1284       haveit=
1285       for x in $LDFLAGS; do
1286         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1287         if test "X$x" = "X-L$additional_libdir"; then
1288           haveit=yes
1289           break
1290         fi
1291       done
1292       if test -z "$haveit"; then
1293         if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
1294           if test -n "$GCC"; then
1295             case $host_os in
1296               linux*) haveit=yes;;
1297             esac
1298           fi
1299         fi
1300         if test -z "$haveit"; then
1301           if test -d "$additional_libdir"; then
1302             dnl Really add $additional_libdir to $LDFLAGS.
1303             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1304           fi
1305         fi
1306       fi
1307     fi
1308   fi
1309 ])
1310
1311 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1312 dnl acl_final_exec_prefix, containing the values to which $prefix and
1313 dnl $exec_prefix will expand at the end of the configure script.
1314 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
1315 [
1316   dnl Unfortunately, prefix and exec_prefix get only finally determined
1317   dnl at the end of configure.
1318   if test "X$prefix" = "XNONE"; then
1319     acl_final_prefix="$ac_default_prefix"
1320   else
1321     acl_final_prefix="$prefix"
1322   fi
1323   if test "X$exec_prefix" = "XNONE"; then
1324     acl_final_exec_prefix='${prefix}'
1325   else
1326     acl_final_exec_prefix="$exec_prefix"
1327   fi
1328   acl_save_prefix="$prefix"
1329   prefix="$acl_final_prefix"
1330   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1331   prefix="$acl_save_prefix"
1332 ])
1333
1334 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1335 dnl variables prefix and exec_prefix bound to the values they will have
1336 dnl at the end of the configure script.
1337 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1338 [
1339   acl_save_prefix="$prefix"
1340   prefix="$acl_final_prefix"
1341   acl_save_exec_prefix="$exec_prefix"
1342   exec_prefix="$acl_final_exec_prefix"
1343   $1
1344   exec_prefix="$acl_save_exec_prefix"
1345   prefix="$acl_save_prefix"
1346 ])
1347
1348 dnl AC_LIB_PREPARE_MULTILIB creates
1349 dnl - a variable acl_libdirstem, containing the basename of the libdir, either
1350 dnl   "lib" or "lib64" or "lib/64",
1351 dnl - a variable acl_libdirstem2, as a secondary possible value for
1352 dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
1353 dnl   "lib/amd64".
1354 AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
1355 [
1356   dnl There is no formal standard regarding lib and lib64.
1357   dnl On glibc systems, the current practice is that on a system supporting
1358   dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1359   dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
1360   dnl the compiler's default mode by looking at the compiler's library search
1361   dnl path. If at least one of its elements ends in /lib64 or points to a
1362   dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
1363   dnl Otherwise we use the default, namely "lib".
1364   dnl On Solaris systems, the current practice is that on a system supporting
1365   dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1366   dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
1367   dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
1368   AC_REQUIRE([AC_CANONICAL_HOST])
1369   acl_libdirstem=lib
1370   acl_libdirstem2=
1371   case "$host_os" in
1372     solaris*)
1373       dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
1374       dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
1375       dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
1376       dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
1377       dnl symlink is missing, so we set acl_libdirstem2 too.
1378       AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
1379         [AC_EGREP_CPP([sixtyfour bits], [
1380 #ifdef _LP64
1381 sixtyfour bits
1382 #endif
1383            ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
1384         ])
1385       if test $gl_cv_solaris_64bit = yes; then
1386         acl_libdirstem=lib/64
1387         case "$host_cpu" in
1388           sparc*)        acl_libdirstem2=lib/sparcv9 ;;
1389           i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
1390         esac
1391       fi
1392       ;;
1393     *)
1394       searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
1395       if test -n "$searchpath"; then
1396         acl_save_IFS="${IFS=    }"; IFS=":"
1397         for searchdir in $searchpath; do
1398           if test -d "$searchdir"; then
1399             case "$searchdir" in
1400               */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
1401               */../ | */.. )
1402                 # Better ignore directories of this form. They are misleading.
1403                 ;;
1404               *) searchdir=`cd "$searchdir" && pwd`
1405                  case "$searchdir" in
1406                    */lib64 ) acl_libdirstem=lib64 ;;
1407                  esac ;;
1408             esac
1409           fi
1410         done
1411         IFS="$acl_save_IFS"
1412       fi
1413       ;;
1414   esac
1415   test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
1416 ])
1417
1418 # Copyright (C) 2002-2018 Free Software Foundation, Inc.
1419 #
1420 # This file is free software; the Free Software Foundation
1421 # gives unlimited permission to copy and/or distribute it,
1422 # with or without modifications, as long as this notice is preserved.
1423
1424 # AM_AUTOMAKE_VERSION(VERSION)
1425 # ----------------------------
1426 # Automake X.Y traces this macro to ensure aclocal.m4 has been
1427 # generated from the m4 files accompanying Automake X.Y.
1428 # (This private macro should not be called outside this file.)
1429 AC_DEFUN([AM_AUTOMAKE_VERSION],
1430 [am__api_version='1.16'
1431 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
1432 dnl require some minimum version.  Point them to the right macro.
1433 m4_if([$1], [1.16.1], [],
1434       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
1435 ])
1436
1437 # _AM_AUTOCONF_VERSION(VERSION)
1438 # -----------------------------
1439 # aclocal traces this macro to find the Autoconf version.
1440 # This is a private macro too.  Using m4_define simplifies
1441 # the logic in aclocal, which can simply ignore this definition.
1442 m4_define([_AM_AUTOCONF_VERSION], [])
1443
1444 # AM_SET_CURRENT_AUTOMAKE_VERSION
1445 # -------------------------------
1446 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
1447 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
1448 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
1449 [AM_AUTOMAKE_VERSION([1.16.1])dnl
1450 m4_ifndef([AC_AUTOCONF_VERSION],
1451   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1452 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
1453
1454 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
1455
1456 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
1457 #
1458 # This file is free software; the Free Software Foundation
1459 # gives unlimited permission to copy and/or distribute it,
1460 # with or without modifications, as long as this notice is preserved.
1461
1462 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
1463 # $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
1464 # '$srcdir', '$srcdir/..', or '$srcdir/../..'.
1465 #
1466 # Of course, Automake must honor this variable whenever it calls a
1467 # tool from the auxiliary directory.  The problem is that $srcdir (and
1468 # therefore $ac_aux_dir as well) can be either absolute or relative,
1469 # depending on how configure is run.  This is pretty annoying, since
1470 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
1471 # source directory, any form will work fine, but in subdirectories a
1472 # relative path needs to be adjusted first.
1473 #
1474 # $ac_aux_dir/missing
1475 #    fails when called from a subdirectory if $ac_aux_dir is relative
1476 # $top_srcdir/$ac_aux_dir/missing
1477 #    fails if $ac_aux_dir is absolute,
1478 #    fails when called from a subdirectory in a VPATH build with
1479 #          a relative $ac_aux_dir
1480 #
1481 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
1482 # are both prefixed by $srcdir.  In an in-source build this is usually
1483 # harmless because $srcdir is '.', but things will broke when you
1484 # start a VPATH build or use an absolute $srcdir.
1485 #
1486 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
1487 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
1488 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
1489 # and then we would define $MISSING as
1490 #   MISSING="\${SHELL} $am_aux_dir/missing"
1491 # This will work as long as MISSING is not called from configure, because
1492 # unfortunately $(top_srcdir) has no meaning in configure.
1493 # However there are other variables, like CC, which are often used in
1494 # configure, and could therefore not use this "fixed" $ac_aux_dir.
1495 #
1496 # Another solution, used here, is to always expand $ac_aux_dir to an
1497 # absolute PATH.  The drawback is that using absolute paths prevent a
1498 # configured tree to be moved without reconfiguration.
1499
1500 AC_DEFUN([AM_AUX_DIR_EXPAND],
1501 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1502 # Expand $ac_aux_dir to an absolute path.
1503 am_aux_dir=`cd "$ac_aux_dir" && pwd`
1504 ])
1505
1506 # AM_CONDITIONAL                                            -*- Autoconf -*-
1507
1508 # Copyright (C) 1997-2018 Free Software Foundation, Inc.
1509 #
1510 # This file is free software; the Free Software Foundation
1511 # gives unlimited permission to copy and/or distribute it,
1512 # with or without modifications, as long as this notice is preserved.
1513
1514 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
1515 # -------------------------------------
1516 # Define a conditional.
1517 AC_DEFUN([AM_CONDITIONAL],
1518 [AC_PREREQ([2.52])dnl
1519  m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1520        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1521 AC_SUBST([$1_TRUE])dnl
1522 AC_SUBST([$1_FALSE])dnl
1523 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
1524 _AM_SUBST_NOTMAKE([$1_FALSE])dnl
1525 m4_define([_AM_COND_VALUE_$1], [$2])dnl
1526 if $2; then
1527   $1_TRUE=
1528   $1_FALSE='#'
1529 else
1530   $1_TRUE='#'
1531   $1_FALSE=
1532 fi
1533 AC_CONFIG_COMMANDS_PRE(
1534 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1535   AC_MSG_ERROR([[conditional "$1" was never defined.
1536 Usually this means the macro was only invoked conditionally.]])
1537 fi])])
1538
1539 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
1540 #
1541 # This file is free software; the Free Software Foundation
1542 # gives unlimited permission to copy and/or distribute it,
1543 # with or without modifications, as long as this notice is preserved.
1544
1545
1546 # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1547 # written in clear, in which case automake, when reading aclocal.m4,
1548 # will think it sees a *use*, and therefore will trigger all it's
1549 # C support machinery.  Also note that it means that autoscan, seeing
1550 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1551
1552
1553 # _AM_DEPENDENCIES(NAME)
1554 # ----------------------
1555 # See how the compiler implements dependency checking.
1556 # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1557 # We try a few techniques and use that to set a single cache variable.
1558 #
1559 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1560 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1561 # dependency, and given that the user is not expected to run this macro,
1562 # just rely on AC_PROG_CC.
1563 AC_DEFUN([_AM_DEPENDENCIES],
1564 [AC_REQUIRE([AM_SET_DEPDIR])dnl
1565 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1566 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
1567 AC_REQUIRE([AM_DEP_TRACK])dnl
1568
1569 m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1570       [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1571       [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1572       [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1573       [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1574       [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1575                     [depcc="$$1"   am_compiler_list=])
1576
1577 AC_CACHE_CHECK([dependency style of $depcc],
1578                [am_cv_$1_dependencies_compiler_type],
1579 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1580   # We make a subdir and do the tests there.  Otherwise we can end up
1581   # making bogus files that we don't know about and never remove.  For
1582   # instance it was reported that on HP-UX the gcc test will end up
1583   # making a dummy file named 'D' -- because '-MD' means "put the output
1584   # in D".
1585   rm -rf conftest.dir
1586   mkdir conftest.dir
1587   # Copy depcomp to subdir because otherwise we won't find it if we're
1588   # using a relative directory.
1589   cp "$am_depcomp" conftest.dir
1590   cd conftest.dir
1591   # We will build objects and dependencies in a subdirectory because
1592   # it helps to detect inapplicable dependency modes.  For instance
1593   # both Tru64's cc and ICC support -MD to output dependencies as a
1594   # side effect of compilation, but ICC will put the dependencies in
1595   # the current directory while Tru64 will put them in the object
1596   # directory.
1597   mkdir sub
1598
1599   am_cv_$1_dependencies_compiler_type=none
1600   if test "$am_compiler_list" = ""; then
1601      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
1602   fi
1603   am__universal=false
1604   m4_case([$1], [CC],
1605     [case " $depcc " in #(
1606      *\ -arch\ *\ -arch\ *) am__universal=true ;;
1607      esac],
1608     [CXX],
1609     [case " $depcc " in #(
1610      *\ -arch\ *\ -arch\ *) am__universal=true ;;
1611      esac])
1612
1613   for depmode in $am_compiler_list; do
1614     # Setup a source with many dependencies, because some compilers
1615     # like to wrap large dependency lists on column 80 (with \), and
1616     # we should not choose a depcomp mode which is confused by this.
1617     #
1618     # We need to recreate these files for each test, as the compiler may
1619     # overwrite some of them when testing with obscure command lines.
1620     # This happens at least with the AIX C compiler.
1621     : > sub/conftest.c
1622     for i in 1 2 3 4 5 6; do
1623       echo '#include "conftst'$i'.h"' >> sub/conftest.c
1624       # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
1625       # Solaris 10 /bin/sh.
1626       echo '/* dummy */' > sub/conftst$i.h
1627     done
1628     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
1629
1630     # We check with '-c' and '-o' for the sake of the "dashmstdout"
1631     # mode.  It turns out that the SunPro C++ compiler does not properly
1632     # handle '-M -o', and we need to detect this.  Also, some Intel
1633     # versions had trouble with output in subdirs.
1634     am__obj=sub/conftest.${OBJEXT-o}
1635     am__minus_obj="-o $am__obj"
1636     case $depmode in
1637     gcc)
1638       # This depmode causes a compiler race in universal mode.
1639       test "$am__universal" = false || continue
1640       ;;
1641     nosideeffect)
1642       # After this tag, mechanisms are not by side-effect, so they'll
1643       # only be used when explicitly requested.
1644       if test "x$enable_dependency_tracking" = xyes; then
1645         continue
1646       else
1647         break
1648       fi
1649       ;;
1650     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
1651       # This compiler won't grok '-c -o', but also, the minuso test has
1652       # not run yet.  These depmodes are late enough in the game, and
1653       # so weak that their functioning should not be impacted.
1654       am__obj=conftest.${OBJEXT-o}
1655       am__minus_obj=
1656       ;;
1657     none) break ;;
1658     esac
1659     if depmode=$depmode \
1660        source=sub/conftest.c object=$am__obj \
1661        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
1662        $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
1663          >/dev/null 2>conftest.err &&
1664        grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
1665        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
1666        grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
1667        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
1668       # icc doesn't choke on unknown options, it will just issue warnings
1669       # or remarks (even with -Werror).  So we grep stderr for any message
1670       # that says an option was ignored or not supported.
1671       # When given -MP, icc 7.0 and 7.1 complain thusly:
1672       #   icc: Command line warning: ignoring option '-M'; no argument required
1673       # The diagnosis changed in icc 8.0:
1674       #   icc: Command line remark: option '-MP' not supported
1675       if (grep 'ignoring option' conftest.err ||
1676           grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
1677         am_cv_$1_dependencies_compiler_type=$depmode
1678         break
1679       fi
1680     fi
1681   done
1682
1683   cd ..
1684   rm -rf conftest.dir
1685 else
1686   am_cv_$1_dependencies_compiler_type=none
1687 fi
1688 ])
1689 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
1690 AM_CONDITIONAL([am__fastdep$1], [
1691   test "x$enable_dependency_tracking" != xno \
1692   && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
1693 ])
1694
1695
1696 # AM_SET_DEPDIR
1697 # -------------
1698 # Choose a directory name for dependency files.
1699 # This macro is AC_REQUIREd in _AM_DEPENDENCIES.
1700 AC_DEFUN([AM_SET_DEPDIR],
1701 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
1702 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
1703 ])
1704
1705
1706 # AM_DEP_TRACK
1707 # ------------
1708 AC_DEFUN([AM_DEP_TRACK],
1709 [AC_ARG_ENABLE([dependency-tracking], [dnl
1710 AS_HELP_STRING(
1711   [--enable-dependency-tracking],
1712   [do not reject slow dependency extractors])
1713 AS_HELP_STRING(
1714   [--disable-dependency-tracking],
1715   [speeds up one-time build])])
1716 if test "x$enable_dependency_tracking" != xno; then
1717   am_depcomp="$ac_aux_dir/depcomp"
1718   AMDEPBACKSLASH='\'
1719   am__nodep='_no'
1720 fi
1721 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
1722 AC_SUBST([AMDEPBACKSLASH])dnl
1723 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
1724 AC_SUBST([am__nodep])dnl
1725 _AM_SUBST_NOTMAKE([am__nodep])dnl
1726 ])
1727
1728 # Generate code to set up dependency tracking.              -*- Autoconf -*-
1729
1730 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
1731 #
1732 # This file is free software; the Free Software Foundation
1733 # gives unlimited permission to copy and/or distribute it,
1734 # with or without modifications, as long as this notice is preserved.
1735
1736 # _AM_OUTPUT_DEPENDENCY_COMMANDS
1737 # ------------------------------
1738 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
1739 [{
1740   # Older Autoconf quotes --file arguments for eval, but not when files
1741   # are listed without --file.  Let's play safe and only enable the eval
1742   # if we detect the quoting.
1743   # TODO: see whether this extra hack can be removed once we start
1744   # requiring Autoconf 2.70 or later.
1745   AS_CASE([$CONFIG_FILES],
1746           [*\'*], [eval set x "$CONFIG_FILES"],
1747           [*], [set x $CONFIG_FILES])
1748   shift
1749   # Used to flag and report bootstrapping failures.
1750   am_rc=0
1751   for am_mf
1752   do
1753     # Strip MF so we end up with the name of the file.
1754     am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
1755     # Check whether this is an Automake generated Makefile which includes
1756     # dependency-tracking related rules and includes.
1757     # Grep'ing the whole file directly is not great: AIX grep has a line
1758     # limit of 2048, but all sed's we know have understand at least 4000.
1759     sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
1760       || continue
1761     am_dirpart=`AS_DIRNAME(["$am_mf"])`
1762     am_filepart=`AS_BASENAME(["$am_mf"])`
1763     AM_RUN_LOG([cd "$am_dirpart" \
1764       && sed -e '/# am--include-marker/d' "$am_filepart" \
1765         | $MAKE -f - am--depfiles]) || am_rc=$?
1766   done
1767   if test $am_rc -ne 0; then
1768     AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
1769     for automatic dependency tracking.  Try re-running configure with the
1770     '--disable-dependency-tracking' option to at least be able to build
1771     the package (albeit without support for automatic dependency tracking).])
1772   fi
1773   AS_UNSET([am_dirpart])
1774   AS_UNSET([am_filepart])
1775   AS_UNSET([am_mf])
1776   AS_UNSET([am_rc])
1777   rm -f conftest-deps.mk
1778 }
1779 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
1780
1781
1782 # AM_OUTPUT_DEPENDENCY_COMMANDS
1783 # -----------------------------
1784 # This macro should only be invoked once -- use via AC_REQUIRE.
1785 #
1786 # This code is only required when automatic dependency tracking is enabled.
1787 # This creates each '.Po' and '.Plo' makefile fragment that we'll need in
1788 # order to bootstrap the dependency handling code.
1789 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
1790 [AC_CONFIG_COMMANDS([depfiles],
1791      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
1792      [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
1793
1794 # Do all the work for Automake.                             -*- Autoconf -*-
1795
1796 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
1797 #
1798 # This file is free software; the Free Software Foundation
1799 # gives unlimited permission to copy and/or distribute it,
1800 # with or without modifications, as long as this notice is preserved.
1801
1802 # This macro actually does too much.  Some checks are only needed if
1803 # your package does certain things.  But this isn't really a big deal.
1804
1805 dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
1806 m4_define([AC_PROG_CC],
1807 m4_defn([AC_PROG_CC])
1808 [_AM_PROG_CC_C_O
1809 ])
1810
1811 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1812 # AM_INIT_AUTOMAKE([OPTIONS])
1813 # -----------------------------------------------
1814 # The call with PACKAGE and VERSION arguments is the old style
1815 # call (pre autoconf-2.50), which is being phased out.  PACKAGE
1816 # and VERSION should now be passed to AC_INIT and removed from
1817 # the call to AM_INIT_AUTOMAKE.
1818 # We support both call styles for the transition.  After
1819 # the next Automake release, Autoconf can make the AC_INIT
1820 # arguments mandatory, and then we can depend on a new Autoconf
1821 # release and drop the old call support.
1822 AC_DEFUN([AM_INIT_AUTOMAKE],
1823 [AC_PREREQ([2.65])dnl
1824 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
1825 dnl the ones we care about.
1826 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1827 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1828 AC_REQUIRE([AC_PROG_INSTALL])dnl
1829 if test "`cd $srcdir && pwd`" != "`pwd`"; then
1830   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
1831   # is not polluted with repeated "-I."
1832   AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
1833   # test to see if srcdir already configured
1834   if test -f $srcdir/config.status; then
1835     AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1836   fi
1837 fi
1838
1839 # test whether we have cygpath
1840 if test -z "$CYGPATH_W"; then
1841   if (cygpath --version) >/dev/null 2>/dev/null; then
1842     CYGPATH_W='cygpath -w'
1843   else
1844     CYGPATH_W=echo
1845   fi
1846 fi
1847 AC_SUBST([CYGPATH_W])
1848
1849 # Define the identity of the package.
1850 dnl Distinguish between old-style and new-style calls.
1851 m4_ifval([$2],
1852 [AC_DIAGNOSE([obsolete],
1853              [$0: two- and three-arguments forms are deprecated.])
1854 m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
1855  AC_SUBST([PACKAGE], [$1])dnl
1856  AC_SUBST([VERSION], [$2])],
1857 [_AM_SET_OPTIONS([$1])dnl
1858 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
1859 m4_if(
1860   m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
1861   [ok:ok],,
1862   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
1863  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
1864  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
1865
1866 _AM_IF_OPTION([no-define],,
1867 [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
1868  AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
1869
1870 # Some tools Automake needs.
1871 AC_REQUIRE([AM_SANITY_CHECK])dnl
1872 AC_REQUIRE([AC_ARG_PROGRAM])dnl
1873 AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
1874 AM_MISSING_PROG([AUTOCONF], [autoconf])
1875 AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
1876 AM_MISSING_PROG([AUTOHEADER], [autoheader])
1877 AM_MISSING_PROG([MAKEINFO], [makeinfo])
1878 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1879 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
1880 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
1881 # For better backward compatibility.  To be removed once Automake 1.9.x
1882 # dies out for good.  For more background, see:
1883 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
1884 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
1885 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
1886 # We need awk for the "check" target (and possibly the TAP driver).  The
1887 # system "awk" is bad on some platforms.
1888 AC_REQUIRE([AC_PROG_AWK])dnl
1889 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1890 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
1891 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
1892               [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
1893                              [_AM_PROG_TAR([v7])])])
1894 _AM_IF_OPTION([no-dependencies],,
1895 [AC_PROVIDE_IFELSE([AC_PROG_CC],
1896                   [_AM_DEPENDENCIES([CC])],
1897                   [m4_define([AC_PROG_CC],
1898                              m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
1899 AC_PROVIDE_IFELSE([AC_PROG_CXX],
1900                   [_AM_DEPENDENCIES([CXX])],
1901                   [m4_define([AC_PROG_CXX],
1902                              m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
1903 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
1904                   [_AM_DEPENDENCIES([OBJC])],
1905                   [m4_define([AC_PROG_OBJC],
1906                              m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
1907 AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
1908                   [_AM_DEPENDENCIES([OBJCXX])],
1909                   [m4_define([AC_PROG_OBJCXX],
1910                              m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
1911 ])
1912 AC_REQUIRE([AM_SILENT_RULES])dnl
1913 dnl The testsuite driver may need to know about EXEEXT, so add the
1914 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
1915 dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
1916 AC_CONFIG_COMMANDS_PRE(dnl
1917 [m4_provide_if([_AM_COMPILER_EXEEXT],
1918   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
1919
1920 # POSIX will say in a future version that running "rm -f" with no argument
1921 # is OK; and we want to be able to make that assumption in our Makefile
1922 # recipes.  So use an aggressive probe to check that the usage we want is
1923 # actually supported "in the wild" to an acceptable degree.
1924 # See automake bug#10828.
1925 # To make any issue more visible, cause the running configure to be aborted
1926 # by default if the 'rm' program in use doesn't match our expectations; the
1927 # user can still override this though.
1928 if rm -f && rm -fr && rm -rf; then : OK; else
1929   cat >&2 <<'END'
1930 Oops!
1931
1932 Your 'rm' program seems unable to run without file operands specified
1933 on the command line, even when the '-f' option is present.  This is contrary
1934 to the behaviour of most rm programs out there, and not conforming with
1935 the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
1936
1937 Please tell bug-automake@gnu.org about your system, including the value
1938 of your $PATH and any error possibly output before this message.  This
1939 can help us improve future automake versions.
1940
1941 END
1942   if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
1943     echo 'Configuration will proceed anyway, since you have set the' >&2
1944     echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
1945     echo >&2
1946   else
1947     cat >&2 <<'END'
1948 Aborting the configuration process, to ensure you take notice of the issue.
1949
1950 You can download and install GNU coreutils to get an 'rm' implementation
1951 that behaves properly: <https://www.gnu.org/software/coreutils/>.
1952
1953 If you want to complete the configuration process using your problematic
1954 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
1955 to "yes", and re-run configure.
1956
1957 END
1958     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
1959   fi
1960 fi
1961 dnl The trailing newline in this macro's definition is deliberate, for
1962 dnl backward compatibility and to allow trailing 'dnl'-style comments
1963 dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
1964 ])
1965
1966 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
1967 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
1968 dnl mangled by Autoconf and run in a shell conditional statement.
1969 m4_define([_AC_COMPILER_EXEEXT],
1970 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
1971
1972 # When config.status generates a header, we must update the stamp-h file.
1973 # This file resides in the same directory as the config header
1974 # that is generated.  The stamp files are numbered to have different names.
1975
1976 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
1977 # loop where config.status creates the headers, so we can generate
1978 # our stamp files there.
1979 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
1980 [# Compute $1's index in $config_headers.
1981 _am_arg=$1
1982 _am_stamp_count=1
1983 for _am_header in $config_headers :; do
1984   case $_am_header in
1985     $_am_arg | $_am_arg:* )
1986       break ;;
1987     * )
1988       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
1989   esac
1990 done
1991 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
1992
1993 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
1994 #
1995 # This file is free software; the Free Software Foundation
1996 # gives unlimited permission to copy and/or distribute it,
1997 # with or without modifications, as long as this notice is preserved.
1998
1999 # AM_PROG_INSTALL_SH
2000 # ------------------
2001 # Define $install_sh.
2002 AC_DEFUN([AM_PROG_INSTALL_SH],
2003 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2004 if test x"${install_sh+set}" != xset; then
2005   case $am_aux_dir in
2006   *\ * | *\     *)
2007     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2008   *)
2009     install_sh="\${SHELL} $am_aux_dir/install-sh"
2010   esac
2011 fi
2012 AC_SUBST([install_sh])])
2013
2014 # Copyright (C) 2003-2018 Free Software Foundation, Inc.
2015 #
2016 # This file is free software; the Free Software Foundation
2017 # gives unlimited permission to copy and/or distribute it,
2018 # with or without modifications, as long as this notice is preserved.
2019
2020 # Check whether the underlying file-system supports filenames
2021 # with a leading dot.  For instance MS-DOS doesn't.
2022 AC_DEFUN([AM_SET_LEADING_DOT],
2023 [rm -rf .tst 2>/dev/null
2024 mkdir .tst 2>/dev/null
2025 if test -d .tst; then
2026   am__leading_dot=.
2027 else
2028   am__leading_dot=_
2029 fi
2030 rmdir .tst 2>/dev/null
2031 AC_SUBST([am__leading_dot])])
2032
2033 # Check to see how 'make' treats includes.                  -*- Autoconf -*-
2034
2035 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
2036 #
2037 # This file is free software; the Free Software Foundation
2038 # gives unlimited permission to copy and/or distribute it,
2039 # with or without modifications, as long as this notice is preserved.
2040
2041 # AM_MAKE_INCLUDE()
2042 # -----------------
2043 # Check whether make has an 'include' directive that can support all
2044 # the idioms we need for our automatic dependency tracking code.
2045 AC_DEFUN([AM_MAKE_INCLUDE],
2046 [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
2047 cat > confinc.mk << 'END'
2048 am__doit:
2049         @echo this is the am__doit target >confinc.out
2050 .PHONY: am__doit
2051 END
2052 am__include="#"
2053 am__quote=
2054 # BSD make does it like this.
2055 echo '.include "confinc.mk" # ignored' > confmf.BSD
2056 # Other make implementations (GNU, Solaris 10, AIX) do it like this.
2057 echo 'include confinc.mk # ignored' > confmf.GNU
2058 _am_result=no
2059 for s in GNU BSD; do
2060   AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
2061   AS_CASE([$?:`cat confinc.out 2>/dev/null`],
2062       ['0:this is the am__doit target'],
2063       [AS_CASE([$s],
2064           [BSD], [am__include='.include' am__quote='"'],
2065           [am__include='include' am__quote=''])])
2066   if test "$am__include" != "#"; then
2067     _am_result="yes ($s style)"
2068     break
2069   fi
2070 done
2071 rm -f confinc.* confmf.*
2072 AC_MSG_RESULT([${_am_result}])
2073 AC_SUBST([am__include])])
2074 AC_SUBST([am__quote])])
2075
2076 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2077
2078 # Copyright (C) 1997-2018 Free Software Foundation, Inc.
2079 #
2080 # This file is free software; the Free Software Foundation
2081 # gives unlimited permission to copy and/or distribute it,
2082 # with or without modifications, as long as this notice is preserved.
2083
2084 # AM_MISSING_PROG(NAME, PROGRAM)
2085 # ------------------------------
2086 AC_DEFUN([AM_MISSING_PROG],
2087 [AC_REQUIRE([AM_MISSING_HAS_RUN])
2088 $1=${$1-"${am_missing_run}$2"}
2089 AC_SUBST($1)])
2090
2091 # AM_MISSING_HAS_RUN
2092 # ------------------
2093 # Define MISSING if not defined so far and test if it is modern enough.
2094 # If it is, set am_missing_run to use it, otherwise, to nothing.
2095 AC_DEFUN([AM_MISSING_HAS_RUN],
2096 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2097 AC_REQUIRE_AUX_FILE([missing])dnl
2098 if test x"${MISSING+set}" != xset; then
2099   case $am_aux_dir in
2100   *\ * | *\     *)
2101     MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2102   *)
2103     MISSING="\${SHELL} $am_aux_dir/missing" ;;
2104   esac
2105 fi
2106 # Use eval to expand $SHELL
2107 if eval "$MISSING --is-lightweight"; then
2108   am_missing_run="$MISSING "
2109 else
2110   am_missing_run=
2111   AC_MSG_WARN(['missing' script is too old or missing])
2112 fi
2113 ])
2114
2115 # Helper functions for option handling.                     -*- Autoconf -*-
2116
2117 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
2118 #
2119 # This file is free software; the Free Software Foundation
2120 # gives unlimited permission to copy and/or distribute it,
2121 # with or without modifications, as long as this notice is preserved.
2122
2123 # _AM_MANGLE_OPTION(NAME)
2124 # -----------------------
2125 AC_DEFUN([_AM_MANGLE_OPTION],
2126 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2127
2128 # _AM_SET_OPTION(NAME)
2129 # --------------------
2130 # Set option NAME.  Presently that only means defining a flag for this option.
2131 AC_DEFUN([_AM_SET_OPTION],
2132 [m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2133
2134 # _AM_SET_OPTIONS(OPTIONS)
2135 # ------------------------
2136 # OPTIONS is a space-separated list of Automake options.
2137 AC_DEFUN([_AM_SET_OPTIONS],
2138 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2139
2140 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2141 # -------------------------------------------
2142 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2143 AC_DEFUN([_AM_IF_OPTION],
2144 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2145
2146 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
2147 #
2148 # This file is free software; the Free Software Foundation
2149 # gives unlimited permission to copy and/or distribute it,
2150 # with or without modifications, as long as this notice is preserved.
2151
2152 # _AM_PROG_CC_C_O
2153 # ---------------
2154 # Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
2155 # to automatically call this.
2156 AC_DEFUN([_AM_PROG_CC_C_O],
2157 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2158 AC_REQUIRE_AUX_FILE([compile])dnl
2159 AC_LANG_PUSH([C])dnl
2160 AC_CACHE_CHECK(
2161   [whether $CC understands -c and -o together],
2162   [am_cv_prog_cc_c_o],
2163   [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
2164   # Make sure it works both with $CC and with simple cc.
2165   # Following AC_PROG_CC_C_O, we do the test twice because some
2166   # compilers refuse to overwrite an existing .o file with -o,
2167   # though they will create one.
2168   am_cv_prog_cc_c_o=yes
2169   for am_i in 1 2; do
2170     if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
2171          && test -f conftest2.$ac_objext; then
2172       : OK
2173     else
2174       am_cv_prog_cc_c_o=no
2175       break
2176     fi
2177   done
2178   rm -f core conftest*
2179   unset am_i])
2180 if test "$am_cv_prog_cc_c_o" != yes; then
2181    # Losing compiler, so override with the script.
2182    # FIXME: It is wrong to rewrite CC.
2183    # But if we don't then we get into trouble of one sort or another.
2184    # A longer-term fix would be to have automake use am__CC in this case,
2185    # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
2186    CC="$am_aux_dir/compile $CC"
2187 fi
2188 AC_LANG_POP([C])])
2189
2190 # For backward compatibility.
2191 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
2192
2193 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
2194 #
2195 # This file is free software; the Free Software Foundation
2196 # gives unlimited permission to copy and/or distribute it,
2197 # with or without modifications, as long as this notice is preserved.
2198
2199 # AM_RUN_LOG(COMMAND)
2200 # -------------------
2201 # Run COMMAND, save the exit status in ac_status, and log it.
2202 # (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
2203 AC_DEFUN([AM_RUN_LOG],
2204 [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
2205    ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
2206    ac_status=$?
2207    echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
2208    (exit $ac_status); }])
2209
2210 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
2211
2212 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
2213 #
2214 # This file is free software; the Free Software Foundation
2215 # gives unlimited permission to copy and/or distribute it,
2216 # with or without modifications, as long as this notice is preserved.
2217
2218 # AM_SANITY_CHECK
2219 # ---------------
2220 AC_DEFUN([AM_SANITY_CHECK],
2221 [AC_MSG_CHECKING([whether build environment is sane])
2222 # Reject unsafe characters in $srcdir or the absolute working directory
2223 # name.  Accept space and tab only in the latter.
2224 am_lf='
2225 '
2226 case `pwd` in
2227   *[[\\\"\#\$\&\'\`$am_lf]]*)
2228     AC_MSG_ERROR([unsafe absolute working directory name]);;
2229 esac
2230 case $srcdir in
2231   *[[\\\"\#\$\&\'\`$am_lf\ \    ]]*)
2232     AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
2233 esac
2234
2235 # Do 'set' in a subshell so we don't clobber the current shell's
2236 # arguments.  Must try -L first in case configure is actually a
2237 # symlink; some systems play weird games with the mod time of symlinks
2238 # (eg FreeBSD returns the mod time of the symlink's containing
2239 # directory).
2240 if (
2241    am_has_slept=no
2242    for am_try in 1 2; do
2243      echo "timestamp, slept: $am_has_slept" > conftest.file
2244      set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
2245      if test "$[*]" = "X"; then
2246         # -L didn't work.
2247         set X `ls -t "$srcdir/configure" conftest.file`
2248      fi
2249      if test "$[*]" != "X $srcdir/configure conftest.file" \
2250         && test "$[*]" != "X conftest.file $srcdir/configure"; then
2251
2252         # If neither matched, then we have a broken ls.  This can happen
2253         # if, for instance, CONFIG_SHELL is bash and it inherits a
2254         # broken ls alias from the environment.  This has actually
2255         # happened.  Such a system could not be considered "sane".
2256         AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
2257   alias in your environment])
2258      fi
2259      if test "$[2]" = conftest.file || test $am_try -eq 2; then
2260        break
2261      fi
2262      # Just in case.
2263      sleep 1
2264      am_has_slept=yes
2265    done
2266    test "$[2]" = conftest.file
2267    )
2268 then
2269    # Ok.
2270    :
2271 else
2272    AC_MSG_ERROR([newly created file is older than distributed files!
2273 Check your system clock])
2274 fi
2275 AC_MSG_RESULT([yes])
2276 # If we didn't sleep, we still need to ensure time stamps of config.status and
2277 # generated files are strictly newer.
2278 am_sleep_pid=
2279 if grep 'slept: no' conftest.file >/dev/null 2>&1; then
2280   ( sleep 1 ) &
2281   am_sleep_pid=$!
2282 fi
2283 AC_CONFIG_COMMANDS_PRE(
2284   [AC_MSG_CHECKING([that generated files are newer than configure])
2285    if test -n "$am_sleep_pid"; then
2286      # Hide warnings about reused PIDs.
2287      wait $am_sleep_pid 2>/dev/null
2288    fi
2289    AC_MSG_RESULT([done])])
2290 rm -f conftest.file
2291 ])
2292
2293 # Copyright (C) 2009-2018 Free Software Foundation, Inc.
2294 #
2295 # This file is free software; the Free Software Foundation
2296 # gives unlimited permission to copy and/or distribute it,
2297 # with or without modifications, as long as this notice is preserved.
2298
2299 # AM_SILENT_RULES([DEFAULT])
2300 # --------------------------
2301 # Enable less verbose build rules; with the default set to DEFAULT
2302 # ("yes" being less verbose, "no" or empty being verbose).
2303 AC_DEFUN([AM_SILENT_RULES],
2304 [AC_ARG_ENABLE([silent-rules], [dnl
2305 AS_HELP_STRING(
2306   [--enable-silent-rules],
2307   [less verbose build output (undo: "make V=1")])
2308 AS_HELP_STRING(
2309   [--disable-silent-rules],
2310   [verbose build output (undo: "make V=0")])dnl
2311 ])
2312 case $enable_silent_rules in @%:@ (((
2313   yes) AM_DEFAULT_VERBOSITY=0;;
2314    no) AM_DEFAULT_VERBOSITY=1;;
2315     *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
2316 esac
2317 dnl
2318 dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
2319 dnl do not support nested variable expansions.
2320 dnl See automake bug#9928 and bug#10237.
2321 am_make=${MAKE-make}
2322 AC_CACHE_CHECK([whether $am_make supports nested variables],
2323    [am_cv_make_support_nested_variables],
2324    [if AS_ECHO([['TRUE=$(BAR$(V))
2325 BAR0=false
2326 BAR1=true
2327 V=1
2328 am__doit:
2329         @$(TRUE)
2330 .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
2331   am_cv_make_support_nested_variables=yes
2332 else
2333   am_cv_make_support_nested_variables=no
2334 fi])
2335 if test $am_cv_make_support_nested_variables = yes; then
2336   dnl Using '$V' instead of '$(V)' breaks IRIX make.
2337   AM_V='$(V)'
2338   AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
2339 else
2340   AM_V=$AM_DEFAULT_VERBOSITY
2341   AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
2342 fi
2343 AC_SUBST([AM_V])dnl
2344 AM_SUBST_NOTMAKE([AM_V])dnl
2345 AC_SUBST([AM_DEFAULT_V])dnl
2346 AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
2347 AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
2348 AM_BACKSLASH='\'
2349 AC_SUBST([AM_BACKSLASH])dnl
2350 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
2351 ])
2352
2353 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
2354 #
2355 # This file is free software; the Free Software Foundation
2356 # gives unlimited permission to copy and/or distribute it,
2357 # with or without modifications, as long as this notice is preserved.
2358
2359 # AM_PROG_INSTALL_STRIP
2360 # ---------------------
2361 # One issue with vendor 'install' (even GNU) is that you can't
2362 # specify the program used to strip binaries.  This is especially
2363 # annoying in cross-compiling environments, where the build's strip
2364 # is unlikely to handle the host's binaries.
2365 # Fortunately install-sh will honor a STRIPPROG variable, so we
2366 # always use install-sh in "make install-strip", and initialize
2367 # STRIPPROG with the value of the STRIP variable (set by the user).
2368 AC_DEFUN([AM_PROG_INSTALL_STRIP],
2369 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2370 # Installed binaries are usually stripped using 'strip' when the user
2371 # run "make install-strip".  However 'strip' might not be the right
2372 # tool to use in cross-compilation environments, therefore Automake
2373 # will honor the 'STRIP' environment variable to overrule this program.
2374 dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
2375 if test "$cross_compiling" != no; then
2376   AC_CHECK_TOOL([STRIP], [strip], :)
2377 fi
2378 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
2379 AC_SUBST([INSTALL_STRIP_PROGRAM])])
2380
2381 # Copyright (C) 2006-2018 Free Software Foundation, Inc.
2382 #
2383 # This file is free software; the Free Software Foundation
2384 # gives unlimited permission to copy and/or distribute it,
2385 # with or without modifications, as long as this notice is preserved.
2386
2387 # _AM_SUBST_NOTMAKE(VARIABLE)
2388 # ---------------------------
2389 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
2390 # This macro is traced by Automake.
2391 AC_DEFUN([_AM_SUBST_NOTMAKE])
2392
2393 # AM_SUBST_NOTMAKE(VARIABLE)
2394 # --------------------------
2395 # Public sister of _AM_SUBST_NOTMAKE.
2396 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
2397
2398 # Check how to create a tarball.                            -*- Autoconf -*-
2399
2400 # Copyright (C) 2004-2018 Free Software Foundation, Inc.
2401 #
2402 # This file is free software; the Free Software Foundation
2403 # gives unlimited permission to copy and/or distribute it,
2404 # with or without modifications, as long as this notice is preserved.
2405
2406 # _AM_PROG_TAR(FORMAT)
2407 # --------------------
2408 # Check how to create a tarball in format FORMAT.
2409 # FORMAT should be one of 'v7', 'ustar', or 'pax'.
2410 #
2411 # Substitute a variable $(am__tar) that is a command
2412 # writing to stdout a FORMAT-tarball containing the directory
2413 # $tardir.
2414 #     tardir=directory && $(am__tar) > result.tar
2415 #
2416 # Substitute a variable $(am__untar) that extract such
2417 # a tarball read from stdin.
2418 #     $(am__untar) < result.tar
2419 #
2420 AC_DEFUN([_AM_PROG_TAR],
2421 [# Always define AMTAR for backward compatibility.  Yes, it's still used
2422 # in the wild :-(  We should find a proper way to deprecate it ...
2423 AC_SUBST([AMTAR], ['$${TAR-tar}'])
2424
2425 # We'll loop over all known methods to create a tar archive until one works.
2426 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
2427
2428 m4_if([$1], [v7],
2429   [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
2430
2431   [m4_case([$1],
2432     [ustar],
2433      [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
2434       # There is notably a 21 bits limit for the UID and the GID.  In fact,
2435       # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
2436       # and bug#13588).
2437       am_max_uid=2097151 # 2^21 - 1
2438       am_max_gid=$am_max_uid
2439       # The $UID and $GID variables are not portable, so we need to resort
2440       # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
2441       # below are definitely unexpected, so allow the users to see them
2442       # (that is, avoid stderr redirection).
2443       am_uid=`id -u || echo unknown`
2444       am_gid=`id -g || echo unknown`
2445       AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
2446       if test $am_uid -le $am_max_uid; then
2447          AC_MSG_RESULT([yes])
2448       else
2449          AC_MSG_RESULT([no])
2450          _am_tools=none
2451       fi
2452       AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
2453       if test $am_gid -le $am_max_gid; then
2454          AC_MSG_RESULT([yes])
2455       else
2456         AC_MSG_RESULT([no])
2457         _am_tools=none
2458       fi],
2459
2460   [pax],
2461     [],
2462
2463   [m4_fatal([Unknown tar format])])
2464
2465   AC_MSG_CHECKING([how to create a $1 tar archive])
2466
2467   # Go ahead even if we have the value already cached.  We do so because we
2468   # need to set the values for the 'am__tar' and 'am__untar' variables.
2469   _am_tools=${am_cv_prog_tar_$1-$_am_tools}
2470
2471   for _am_tool in $_am_tools; do
2472     case $_am_tool in
2473     gnutar)
2474       for _am_tar in tar gnutar gtar; do
2475         AM_RUN_LOG([$_am_tar --version]) && break
2476       done
2477       am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
2478       am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
2479       am__untar="$_am_tar -xf -"
2480       ;;
2481     plaintar)
2482       # Must skip GNU tar: if it does not support --format= it doesn't create
2483       # ustar tarball either.
2484       (tar --version) >/dev/null 2>&1 && continue
2485       am__tar='tar chf - "$$tardir"'
2486       am__tar_='tar chf - "$tardir"'
2487       am__untar='tar xf -'
2488       ;;
2489     pax)
2490       am__tar='pax -L -x $1 -w "$$tardir"'
2491       am__tar_='pax -L -x $1 -w "$tardir"'
2492       am__untar='pax -r'
2493       ;;
2494     cpio)
2495       am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
2496       am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
2497       am__untar='cpio -i -H $1 -d'
2498       ;;
2499     none)
2500       am__tar=false
2501       am__tar_=false
2502       am__untar=false
2503       ;;
2504     esac
2505
2506     # If the value was cached, stop now.  We just wanted to have am__tar
2507     # and am__untar set.
2508     test -n "${am_cv_prog_tar_$1}" && break
2509
2510     # tar/untar a dummy directory, and stop if the command works.
2511     rm -rf conftest.dir
2512     mkdir conftest.dir
2513     echo GrepMe > conftest.dir/file
2514     AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
2515     rm -rf conftest.dir
2516     if test -s conftest.tar; then
2517       AM_RUN_LOG([$am__untar <conftest.tar])
2518       AM_RUN_LOG([cat conftest.dir/file])
2519       grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
2520     fi
2521   done
2522   rm -rf conftest.dir
2523
2524   AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
2525   AC_MSG_RESULT([$am_cv_prog_tar_$1])])
2526
2527 AC_SUBST([am__tar])
2528 AC_SUBST([am__untar])
2529 ]) # _AM_PROG_TAR
2530