1# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
2
3# Copyright (C) 1996-2017 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
14m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15m4_ifndef([AC_AUTOCONF_VERSION],
16  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18[m4_warning([this file was generated for autoconf 2.69.
19You have another version of autoconf.  It may work, but is not guaranteed to.
20If you have problems, you may need to regenerate the build system entirely.
21To do so, use the procedure documented by the package, typically 'autoreconf'.])])
22
23# Copyright (C) 1995-2002 Free Software Foundation, Inc.
24# Copyright (C) 2001-2003,2004 Red Hat, Inc.
25#
26# This file is free software, distributed under the terms of the GNU
27# General Public License.  As a special exception to the GNU General
28# Public License, this file may be distributed as part of a program
29# that contains a configuration script generated by Autoconf, under
30# the same distribution terms as the rest of that program.
31#
32# This file can be copied and used freely without restrictions.  It can
33# be used in projects which are not available under the GNU Public License
34# but which still want to provide support for the GNU gettext functionality.
35#
36# Macro to add for using GNU gettext.
37# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
38#
39# Modified to never use included libintl.
40# Owen Taylor <otaylor@redhat.com>, 12/15/1998
41#
42# Major rework to remove unused code
43# Owen Taylor <otaylor@redhat.com>, 12/11/2002
44#
45# Added better handling of ALL_LINGUAS from GNU gettext version
46# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
47#
48# Modified to require ngettext
49# Matthias Clasen <mclasen@redhat.com> 08/06/2004
50#
51# We need this here as well, since someone might use autoconf-2.5x
52# to configure GLib then an older version to configure a package
53# using AM_GLIB_GNU_GETTEXT
54AC_PREREQ(2.53)
55
56dnl
57dnl We go to great lengths to make sure that aclocal won't
58dnl try to pull in the installed version of these macros
59dnl when running aclocal in the glib directory.
60dnl
61m4_copy([AC_DEFUN],[glib_DEFUN])
62m4_copy([AC_REQUIRE],[glib_REQUIRE])
63dnl
64dnl At the end, if we're not within glib, we'll define the public
65dnl definitions in terms of our private definitions.
66dnl
67
68# GLIB_LC_MESSAGES
69#--------------------
70glib_DEFUN([GLIB_LC_MESSAGES],
71  [AC_CHECK_HEADERS([locale.h])
72    if test $ac_cv_header_locale_h = yes; then
73    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
74      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
75       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
76    if test $am_cv_val_LC_MESSAGES = yes; then
77      AC_DEFINE(HAVE_LC_MESSAGES, 1,
78        [Define if your <locale.h> file defines LC_MESSAGES.])
79    fi
80  fi])
81
82# GLIB_PATH_PROG_WITH_TEST
83#----------------------------
84dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
85dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
86glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
87[# Extract the first word of "$2", so it can be a program name with args.
88set dummy $2; ac_word=[$]2
89AC_MSG_CHECKING([for $ac_word])
90AC_CACHE_VAL(ac_cv_path_$1,
91[case "[$]$1" in
92  /*)
93  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
94  ;;
95  *)
96  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
97  for ac_dir in ifelse([$5], , $PATH, [$5]); do
98    test -z "$ac_dir" && ac_dir=.
99    if test -f $ac_dir/$ac_word; then
100      if [$3]; then
101	ac_cv_path_$1="$ac_dir/$ac_word"
102	break
103      fi
104    fi
105  done
106  IFS="$ac_save_ifs"
107dnl If no 4th arg is given, leave the cache variable unset,
108dnl so AC_PATH_PROGS will keep looking.
109ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
110])dnl
111  ;;
112esac])dnl
113$1="$ac_cv_path_$1"
114if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
115  AC_MSG_RESULT([$]$1)
116else
117  AC_MSG_RESULT(no)
118fi
119AC_SUBST($1)dnl
120])
121
122dnl Checks for special options needed on Mac OS X.
123dnl Defines INTL_MACOSX_LIBS.
124dnl
125dnl Copied from intlmacosx.m4 in gettext, GPL.
126dnl Copyright (C) 2004-2013 Free Software Foundation, Inc.
127glib_DEFUN([glib_gt_INTL_MACOSX],
128[
129  dnl Check for API introduced in Mac OS X 10.2.
130  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
131    [gt_cv_func_CFPreferencesCopyAppValue],
132    [gt_save_LIBS="$LIBS"
133     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
134     AC_LINK_IFELSE(
135       [AC_LANG_PROGRAM(
136          [[#include <CoreFoundation/CFPreferences.h>]],
137          [[CFPreferencesCopyAppValue(NULL, NULL)]])],
138       [gt_cv_func_CFPreferencesCopyAppValue=yes],
139       [gt_cv_func_CFPreferencesCopyAppValue=no])
140     LIBS="$gt_save_LIBS"])
141  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
142    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
143      [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
144  fi
145  dnl Check for API introduced in Mac OS X 10.3.
146  AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
147    [gt_save_LIBS="$LIBS"
148     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
149     AC_LINK_IFELSE(
150       [AC_LANG_PROGRAM(
151          [[#include <CoreFoundation/CFLocale.h>]],
152          [[CFLocaleCopyCurrent();]])],
153       [gt_cv_func_CFLocaleCopyCurrent=yes],
154       [gt_cv_func_CFLocaleCopyCurrent=no])
155     LIBS="$gt_save_LIBS"])
156  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
157    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
158      [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
159  fi
160  INTL_MACOSX_LIBS=
161  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
162    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
163  fi
164  AC_SUBST([INTL_MACOSX_LIBS])
165])
166
167# GLIB_WITH_NLS
168#-----------------
169glib_DEFUN([GLIB_WITH_NLS],
170  dnl NLS is obligatory
171  [USE_NLS=yes
172    AC_SUBST(USE_NLS)
173
174    gt_cv_have_gettext=no
175
176    CATOBJEXT=NONE
177    XGETTEXT=:
178    INTLLIBS=
179
180    glib_gt_INTL_MACOSX
181
182    AC_CHECK_HEADER(libintl.h,
183     [gt_cv_func_dgettext_libintl="no"
184      libintl_extra_libs=""
185
186      #
187      # First check in libc
188      #
189      AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
190        [AC_TRY_LINK([
191#include <libintl.h>
192],
193         [return !ngettext ("","", 1)],
194	  gt_cv_func_ngettext_libc=yes,
195          gt_cv_func_ngettext_libc=no)
196        ])
197
198      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
199	      AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
200        	[AC_TRY_LINK([
201#include <libintl.h>
202],
203	          [return !dgettext ("","")],
204		  gt_cv_func_dgettext_libc=yes,
205	          gt_cv_func_dgettext_libc=no)
206        	])
207      fi
208
209      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
210        AC_CHECK_FUNCS(bind_textdomain_codeset)
211      fi
212
213      #
214      # If we don't have everything we want, check in libintl
215      #
216      if test "$gt_cv_func_dgettext_libc" != "yes" \
217	 || test "$gt_cv_func_ngettext_libc" != "yes" \
218         || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
219
220        AC_CHECK_LIB(intl, bindtextdomain,
221	    [AC_CHECK_LIB(intl, ngettext,
222		    [AC_CHECK_LIB(intl, dgettext,
223			          gt_cv_func_dgettext_libintl=yes)])])
224
225	if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
226	  AC_MSG_CHECKING([if -liconv is needed to use gettext])
227	  AC_MSG_RESULT([])
228  	  AC_CHECK_LIB(intl, ngettext,
229          	[AC_CHECK_LIB(intl, dcgettext,
230		       [gt_cv_func_dgettext_libintl=yes
231			libintl_extra_libs=-liconv],
232			:,-liconv)],
233		:,-liconv)
234        fi
235
236        #
237        # If we found libintl, then check in it for bind_textdomain_codeset();
238        # we'll prefer libc if neither have bind_textdomain_codeset(),
239        # and both have dgettext and ngettext
240        #
241        if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
242          glib_save_LIBS="$LIBS"
243          LIBS="$LIBS -lintl $libintl_extra_libs"
244          unset ac_cv_func_bind_textdomain_codeset
245          AC_CHECK_FUNCS(bind_textdomain_codeset)
246          LIBS="$glib_save_LIBS"
247
248          if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
249            gt_cv_func_dgettext_libc=no
250          else
251            if test "$gt_cv_func_dgettext_libc" = "yes" \
252		&& test "$gt_cv_func_ngettext_libc" = "yes"; then
253              gt_cv_func_dgettext_libintl=no
254            fi
255          fi
256        fi
257      fi
258
259      if test "$gt_cv_func_dgettext_libc" = "yes" \
260	|| test "$gt_cv_func_dgettext_libintl" = "yes"; then
261        gt_cv_have_gettext=yes
262      fi
263
264      if test "$gt_cv_func_dgettext_libintl" = "yes"; then
265        INTLLIBS="-lintl $libintl_extra_libs $INTL_MACOSX_LIBS"
266      fi
267
268      if test "$gt_cv_have_gettext" = "yes"; then
269	AC_DEFINE(HAVE_GETTEXT,1,
270	  [Define if the GNU gettext() function is already present or preinstalled.])
271	GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
272	  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
273	if test "$MSGFMT" != "no"; then
274          glib_save_LIBS="$LIBS"
275          LIBS="$LIBS $INTLLIBS"
276	  AC_CHECK_FUNCS(dcgettext)
277	  MSGFMT_OPTS=
278	  AC_MSG_CHECKING([if msgfmt accepts -c])
279	  GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[
280msgid ""
281msgstr ""
282"Content-Type: text/plain; charset=UTF-8\n"
283"Project-Id-Version: test 1.0\n"
284"PO-Revision-Date: 2007-02-15 12:01+0100\n"
285"Last-Translator: test <foo@bar.xx>\n"
286"Language-Team: C <LL@li.org>\n"
287"MIME-Version: 1.0\n"
288"Content-Transfer-Encoding: 8bit\n"
289], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
290	  AC_SUBST(MSGFMT_OPTS)
291	  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
292	  GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
293	    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
294	  AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
295			 return _nl_msg_cat_cntr],
296	    [CATOBJEXT=.gmo
297             DATADIRNAME=share],
298	    [case $host in
299	    *-*-solaris*)
300	    dnl On Solaris, if bind_textdomain_codeset is in libc,
301	    dnl GNU format message catalog is always supported,
302            dnl since both are added to the libc all together.
303	    dnl Hence, we'd like to go with DATADIRNAME=share and
304	    dnl and CATOBJEXT=.gmo in this case.
305            AC_CHECK_FUNC(bind_textdomain_codeset,
306	      [CATOBJEXT=.gmo
307               DATADIRNAME=share],
308	      [CATOBJEXT=.mo
309               DATADIRNAME=lib])
310	    ;;
311	    *-*-openbsd*)
312	    CATOBJEXT=.mo
313            DATADIRNAME=share
314	    ;;
315	    *)
316	    CATOBJEXT=.mo
317            DATADIRNAME=lib
318	    ;;
319	    esac])
320          LIBS="$glib_save_LIBS"
321	  INSTOBJEXT=.mo
322	else
323	  gt_cv_have_gettext=no
324	fi
325      fi
326    ])
327
328    if test "$gt_cv_have_gettext" = "yes" ; then
329      AC_DEFINE(ENABLE_NLS, 1,
330        [always defined to indicate that i18n is enabled])
331    fi
332
333    dnl Test whether we really found GNU xgettext.
334    if test "$XGETTEXT" != ":"; then
335      dnl If it is not GNU xgettext we define it as : so that the
336      dnl Makefiles still can work.
337      if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
338        : ;
339      else
340        AC_MSG_RESULT(
341	  [found xgettext program is not GNU xgettext; ignore it])
342        XGETTEXT=":"
343      fi
344    fi
345
346    # We need to process the po/ directory.
347    POSUB=po
348
349    AC_OUTPUT_COMMANDS(
350      [case "$CONFIG_FILES" in *po/Makefile.in*)
351        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
352      esac])
353
354    dnl These rules are solely for the distribution goal.  While doing this
355    dnl we only have to keep exactly one list of the available catalogs
356    dnl in configure.ac.
357    for lang in $ALL_LINGUAS; do
358      GMOFILES="$GMOFILES $lang.gmo"
359      POFILES="$POFILES $lang.po"
360    done
361
362    dnl Make all variables we use known to autoconf.
363    AC_SUBST(CATALOGS)
364    AC_SUBST(CATOBJEXT)
365    AC_SUBST(DATADIRNAME)
366    AC_SUBST(GMOFILES)
367    AC_SUBST(INSTOBJEXT)
368    AC_SUBST(INTLLIBS)
369    AC_SUBST(PO_IN_DATADIR_TRUE)
370    AC_SUBST(PO_IN_DATADIR_FALSE)
371    AC_SUBST(POFILES)
372    AC_SUBST(POSUB)
373  ])
374
375# AM_GLIB_GNU_GETTEXT
376# -------------------
377# Do checks necessary for use of gettext. If a suitable implementation
378# of gettext is found in either in libintl or in the C library,
379# it will set INTLLIBS to the libraries needed for use of gettext
380# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
381# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
382# on various variables needed by the Makefile.in.in installed by
383# glib-gettextize.
384dnl
385AU_DEFUN([GLIB_GNU_GETTEXT],
386  [AC_REQUIRE([AC_PROG_CC])dnl
387
388   GLIB_LC_MESSAGES
389   GLIB_WITH_NLS
390
391   if test "$gt_cv_have_gettext" = "yes"; then
392     if test "x$ALL_LINGUAS" = "x"; then
393       LINGUAS=
394     else
395       AC_MSG_CHECKING(for catalogs to be installed)
396       NEW_LINGUAS=
397       for presentlang in $ALL_LINGUAS; do
398         useit=no
399         if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
400           desiredlanguages="$LINGUAS"
401         else
402           desiredlanguages="$ALL_LINGUAS"
403         fi
404         for desiredlang in $desiredlanguages; do
405 	   # Use the presentlang catalog if desiredlang is
406           #   a. equal to presentlang, or
407           #   b. a variant of presentlang (because in this case,
408           #      presentlang can be used as a fallback for messages
409           #      which are not translated in the desiredlang catalog).
410           case "$desiredlang" in
411             "$presentlang"*) useit=yes;;
412           esac
413         done
414         if test $useit = yes; then
415           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
416         fi
417       done
418       LINGUAS=$NEW_LINGUAS
419       AC_MSG_RESULT($LINGUAS)
420     fi
421
422     dnl Construct list of names of catalog files to be constructed.
423     if test -n "$LINGUAS"; then
424       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
425     fi
426   fi
427
428   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
429   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
430   dnl Try to locate is.
431   MKINSTALLDIRS=
432   if test -n "$ac_aux_dir"; then
433     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
434   fi
435   if test -z "$MKINSTALLDIRS"; then
436     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
437   fi
438   AC_SUBST(MKINSTALLDIRS)
439
440   dnl Generate list of files to be processed by xgettext which will
441   dnl be included in po/Makefile.
442   test -d po || mkdir po
443   if test "x$srcdir" != "x."; then
444     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
445       posrcprefix="$srcdir/"
446     else
447       posrcprefix="../$srcdir/"
448     fi
449   else
450     posrcprefix="../"
451   fi
452   rm -f po/POTFILES
453   sed -e "/^#/d" -e "/^\$/d" -e "s,.*,	$posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
454	< $srcdir/po/POTFILES.in > po/POTFILES
455  ],
456  [[$0: This macro is deprecated. You should use upstream gettext instead.]])
457
458# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
459# -------------------------------
460# Define VARIABLE to the location where catalog files will
461# be installed by po/Makefile.
462glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
463[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
464glib_save_prefix="$prefix"
465glib_save_exec_prefix="$exec_prefix"
466glib_save_datarootdir="$datarootdir"
467test "x$prefix" = xNONE && prefix=$ac_default_prefix
468test "x$exec_prefix" = xNONE && exec_prefix=$prefix
469datarootdir=`eval echo "${datarootdir}"`
470if test "x$CATOBJEXT" = "x.mo" ; then
471  localedir=`eval echo "${libdir}/locale"`
472else
473  localedir=`eval echo "${datadir}/locale"`
474fi
475prefix="$glib_save_prefix"
476exec_prefix="$glib_save_exec_prefix"
477datarootdir="$glib_save_datarootdir"
478AC_DEFINE_UNQUOTED($1, "$localedir",
479  [Define the location where the catalogs will be installed])
480])
481
482dnl
483dnl Now the definitions that aclocal will find
484dnl
485ifdef(glib_configure_ac,[],[
486AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
487AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
488])dnl
489
490# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL])
491#
492# Create a temporary file with TEST-FILE as its contents and pass the
493# file name to PROGRAM.  Perform ACTION-IF-PASS if PROGRAM exits with
494# 0 and perform ACTION-IF-FAIL for any other exit status.
495AC_DEFUN([GLIB_RUN_PROG],
496[cat >conftest.foo <<_ACEOF
497$2
498_ACEOF
499if AC_RUN_LOG([$1 conftest.foo]); then
500  m4_ifval([$3], [$3], [:])
501m4_ifvaln([$4], [else $4])dnl
502echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD
503sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
504fi])
505
506
507# iconv.m4 serial 19 (gettext-0.18.2)
508dnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc.
509dnl This file is free software; the Free Software Foundation
510dnl gives unlimited permission to copy and/or distribute it,
511dnl with or without modifications, as long as this notice is preserved.
512
513dnl From Bruno Haible.
514
515AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
516[
517  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
518  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
519  AC_REQUIRE([AC_LIB_RPATH])
520
521  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
522  dnl accordingly.
523  AC_LIB_LINKFLAGS_BODY([iconv])
524])
525
526AC_DEFUN([AM_ICONV_LINK],
527[
528  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
529  dnl those with the standalone portable GNU libiconv installed).
530  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
531
532  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
533  dnl accordingly.
534  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
535
536  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
537  dnl because if the user has installed libiconv and not disabled its use
538  dnl via --without-libiconv-prefix, he wants to use it. The first
539  dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
540  am_save_CPPFLAGS="$CPPFLAGS"
541  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
542
543  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
544    am_cv_func_iconv="no, consider installing GNU libiconv"
545    am_cv_lib_iconv=no
546    AC_LINK_IFELSE(
547      [AC_LANG_PROGRAM(
548         [[
549#include <stdlib.h>
550#include <iconv.h>
551         ]],
552         [[iconv_t cd = iconv_open("","");
553           iconv(cd,NULL,NULL,NULL,NULL);
554           iconv_close(cd);]])],
555      [am_cv_func_iconv=yes])
556    if test "$am_cv_func_iconv" != yes; then
557      am_save_LIBS="$LIBS"
558      LIBS="$LIBS $LIBICONV"
559      AC_LINK_IFELSE(
560        [AC_LANG_PROGRAM(
561           [[
562#include <stdlib.h>
563#include <iconv.h>
564           ]],
565           [[iconv_t cd = iconv_open("","");
566             iconv(cd,NULL,NULL,NULL,NULL);
567             iconv_close(cd);]])],
568        [am_cv_lib_iconv=yes]
569        [am_cv_func_iconv=yes])
570      LIBS="$am_save_LIBS"
571    fi
572  ])
573  if test "$am_cv_func_iconv" = yes; then
574    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
575      dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
576      dnl Solaris 10.
577      am_save_LIBS="$LIBS"
578      if test $am_cv_lib_iconv = yes; then
579        LIBS="$LIBS $LIBICONV"
580      fi
581      am_cv_func_iconv_works=no
582      for ac_iconv_const in '' 'const'; do
583        AC_RUN_IFELSE(
584          [AC_LANG_PROGRAM(
585             [[
586#include <iconv.h>
587#include <string.h>
588
589#ifndef ICONV_CONST
590# define ICONV_CONST $ac_iconv_const
591#endif
592             ]],
593             [[int result = 0;
594  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
595     returns.  */
596  {
597    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
598    if (cd_utf8_to_88591 != (iconv_t)(-1))
599      {
600        static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
601        char buf[10];
602        ICONV_CONST char *inptr = input;
603        size_t inbytesleft = strlen (input);
604        char *outptr = buf;
605        size_t outbytesleft = sizeof (buf);
606        size_t res = iconv (cd_utf8_to_88591,
607                            &inptr, &inbytesleft,
608                            &outptr, &outbytesleft);
609        if (res == 0)
610          result |= 1;
611        iconv_close (cd_utf8_to_88591);
612      }
613  }
614  /* Test against Solaris 10 bug: Failures are not distinguishable from
615     successful returns.  */
616  {
617    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
618    if (cd_ascii_to_88591 != (iconv_t)(-1))
619      {
620        static ICONV_CONST char input[] = "\263";
621        char buf[10];
622        ICONV_CONST char *inptr = input;
623        size_t inbytesleft = strlen (input);
624        char *outptr = buf;
625        size_t outbytesleft = sizeof (buf);
626        size_t res = iconv (cd_ascii_to_88591,
627                            &inptr, &inbytesleft,
628                            &outptr, &outbytesleft);
629        if (res == 0)
630          result |= 2;
631        iconv_close (cd_ascii_to_88591);
632      }
633  }
634  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
635  {
636    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
637    if (cd_88591_to_utf8 != (iconv_t)(-1))
638      {
639        static ICONV_CONST char input[] = "\304";
640        static char buf[2] = { (char)0xDE, (char)0xAD };
641        ICONV_CONST char *inptr = input;
642        size_t inbytesleft = 1;
643        char *outptr = buf;
644        size_t outbytesleft = 1;
645        size_t res = iconv (cd_88591_to_utf8,
646                            &inptr, &inbytesleft,
647                            &outptr, &outbytesleft);
648        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
649          result |= 4;
650        iconv_close (cd_88591_to_utf8);
651      }
652  }
653#if 0 /* This bug could be worked around by the caller.  */
654  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
655  {
656    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
657    if (cd_88591_to_utf8 != (iconv_t)(-1))
658      {
659        static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
660        char buf[50];
661        ICONV_CONST char *inptr = input;
662        size_t inbytesleft = strlen (input);
663        char *outptr = buf;
664        size_t outbytesleft = sizeof (buf);
665        size_t res = iconv (cd_88591_to_utf8,
666                            &inptr, &inbytesleft,
667                            &outptr, &outbytesleft);
668        if ((int)res > 0)
669          result |= 8;
670        iconv_close (cd_88591_to_utf8);
671      }
672  }
673#endif
674  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
675     provided.  */
676  if (/* Try standardized names.  */
677      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
678      /* Try IRIX, OSF/1 names.  */
679      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
680      /* Try AIX names.  */
681      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
682      /* Try HP-UX names.  */
683      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
684    result |= 16;
685  return result;
686]])],
687          [am_cv_func_iconv_works=yes], ,
688          [case "$host_os" in
689             aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
690             *)            am_cv_func_iconv_works="guessing yes" ;;
691           esac])
692        test "$am_cv_func_iconv_works" = no || break
693      done
694      LIBS="$am_save_LIBS"
695    ])
696    case "$am_cv_func_iconv_works" in
697      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
698      *)   am_func_iconv=yes ;;
699    esac
700  else
701    am_func_iconv=no am_cv_lib_iconv=no
702  fi
703  if test "$am_func_iconv" = yes; then
704    AC_DEFINE([HAVE_ICONV], [1],
705      [Define if you have the iconv() function and it works.])
706  fi
707  if test "$am_cv_lib_iconv" = yes; then
708    AC_MSG_CHECKING([how to link with libiconv])
709    AC_MSG_RESULT([$LIBICONV])
710  else
711    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
712    dnl either.
713    CPPFLAGS="$am_save_CPPFLAGS"
714    LIBICONV=
715    LTLIBICONV=
716  fi
717  AC_SUBST([LIBICONV])
718  AC_SUBST([LTLIBICONV])
719])
720
721dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
722dnl avoid warnings like
723dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
724dnl This is tricky because of the way 'aclocal' is implemented:
725dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
726dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
727dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
728dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
729dnl   warnings.
730m4_define([gl_iconv_AC_DEFUN],
731  m4_version_prereq([2.64],
732    [[AC_DEFUN_ONCE(
733        [$1], [$2])]],
734    [m4_ifdef([gl_00GNULIB],
735       [[AC_DEFUN_ONCE(
736           [$1], [$2])]],
737       [[AC_DEFUN(
738           [$1], [$2])]])]))
739gl_iconv_AC_DEFUN([AM_ICONV],
740[
741  AM_ICONV_LINK
742  if test "$am_cv_func_iconv" = yes; then
743    AC_MSG_CHECKING([for iconv declaration])
744    AC_CACHE_VAL([am_cv_proto_iconv], [
745      AC_COMPILE_IFELSE(
746        [AC_LANG_PROGRAM(
747           [[
748#include <stdlib.h>
749#include <iconv.h>
750extern
751#ifdef __cplusplus
752"C"
753#endif
754#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
755size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
756#else
757size_t iconv();
758#endif
759           ]],
760           [[]])],
761        [am_cv_proto_iconv_arg1=""],
762        [am_cv_proto_iconv_arg1="const"])
763      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);"])
764    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
765    AC_MSG_RESULT([
766         $am_cv_proto_iconv])
767    AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
768      [Define as const if the declaration of iconv() needs const.])
769    dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
770    m4_ifdef([gl_ICONV_H_DEFAULTS],
771      [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
772       if test -n "$am_cv_proto_iconv_arg1"; then
773         ICONV_CONST="const"
774       fi
775      ])
776  fi
777])
778
779# lib-ld.m4 serial 6
780dnl Copyright (C) 1996-2003, 2009-2016 Free Software Foundation, Inc.
781dnl This file is free software; the Free Software Foundation
782dnl gives unlimited permission to copy and/or distribute it,
783dnl with or without modifications, as long as this notice is preserved.
784
785dnl Subroutines of libtool.m4,
786dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
787dnl collision with libtool.m4.
788
789dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
790AC_DEFUN([AC_LIB_PROG_LD_GNU],
791[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
792[# I'd rather use --version here, but apparently some GNU lds only accept -v.
793case `$LD -v 2>&1 </dev/null` in
794*GNU* | *'with BFD'*)
795  acl_cv_prog_gnu_ld=yes
796  ;;
797*)
798  acl_cv_prog_gnu_ld=no
799  ;;
800esac])
801with_gnu_ld=$acl_cv_prog_gnu_ld
802])
803
804dnl From libtool-2.4. Sets the variable LD.
805AC_DEFUN([AC_LIB_PROG_LD],
806[AC_REQUIRE([AC_PROG_CC])dnl
807AC_REQUIRE([AC_CANONICAL_HOST])dnl
808
809AC_ARG_WITH([gnu-ld],
810    [AS_HELP_STRING([--with-gnu-ld],
811        [assume the C compiler uses GNU ld [default=no]])],
812    [test "$withval" = no || with_gnu_ld=yes],
813    [with_gnu_ld=no])dnl
814
815# Prepare PATH_SEPARATOR.
816# The user is always right.
817if test "${PATH_SEPARATOR+set}" != set; then
818  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
819  # contains only /bin. Note that ksh looks also at the FPATH variable,
820  # so we have to set that as well for the test.
821  PATH_SEPARATOR=:
822  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
823    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
824           || PATH_SEPARATOR=';'
825       }
826fi
827
828ac_prog=ld
829if test "$GCC" = yes; then
830  # Check if gcc -print-prog-name=ld gives a path.
831  AC_MSG_CHECKING([for ld used by $CC])
832  case $host in
833  *-*-mingw*)
834    # gcc leaves a trailing carriage return which upsets mingw
835    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
836  *)
837    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
838  esac
839  case $ac_prog in
840    # Accept absolute paths.
841    [[\\/]]* | ?:[[\\/]]*)
842      re_direlt='/[[^/]][[^/]]*/\.\./'
843      # Canonicalize the pathname of ld
844      ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
845      while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
846        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
847      done
848      test -z "$LD" && LD="$ac_prog"
849      ;;
850  "")
851    # If it fails, then pretend we aren't using GCC.
852    ac_prog=ld
853    ;;
854  *)
855    # If it is relative, then search for the first ld in PATH.
856    with_gnu_ld=unknown
857    ;;
858  esac
859elif test "$with_gnu_ld" = yes; then
860  AC_MSG_CHECKING([for GNU ld])
861else
862  AC_MSG_CHECKING([for non-GNU ld])
863fi
864AC_CACHE_VAL([acl_cv_path_LD],
865[if test -z "$LD"; then
866  acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
867  for ac_dir in $PATH; do
868    IFS="$acl_save_ifs"
869    test -z "$ac_dir" && ac_dir=.
870    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
871      acl_cv_path_LD="$ac_dir/$ac_prog"
872      # Check to see if the program is GNU ld.  I'd rather use --version,
873      # but apparently some variants of GNU ld only accept -v.
874      # Break only if it was the GNU/non-GNU ld that we prefer.
875      case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
876      *GNU* | *'with BFD'*)
877        test "$with_gnu_ld" != no && break
878        ;;
879      *)
880        test "$with_gnu_ld" != yes && break
881        ;;
882      esac
883    fi
884  done
885  IFS="$acl_save_ifs"
886else
887  acl_cv_path_LD="$LD" # Let the user override the test with a path.
888fi])
889LD="$acl_cv_path_LD"
890if test -n "$LD"; then
891  AC_MSG_RESULT([$LD])
892else
893  AC_MSG_RESULT([no])
894fi
895test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
896AC_LIB_PROG_LD_GNU
897])
898
899# lib-link.m4 serial 26 (gettext-0.18.2)
900dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
901dnl This file is free software; the Free Software Foundation
902dnl gives unlimited permission to copy and/or distribute it,
903dnl with or without modifications, as long as this notice is preserved.
904
905dnl From Bruno Haible.
906
907AC_PREREQ([2.54])
908
909dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
910dnl the libraries corresponding to explicit and implicit dependencies.
911dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
912dnl augments the CPPFLAGS variable.
913dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
914dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
915AC_DEFUN([AC_LIB_LINKFLAGS],
916[
917  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
918  AC_REQUIRE([AC_LIB_RPATH])
919  pushdef([Name],[m4_translit([$1],[./+-], [____])])
920  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
921                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
922  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
923    AC_LIB_LINKFLAGS_BODY([$1], [$2])
924    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
925    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
926    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
927    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
928  ])
929  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
930  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
931  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
932  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
933  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
934  AC_SUBST([LIB]NAME)
935  AC_SUBST([LTLIB]NAME)
936  AC_SUBST([LIB]NAME[_PREFIX])
937  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
938  dnl results of this search when this library appears as a dependency.
939  HAVE_LIB[]NAME=yes
940  popdef([NAME])
941  popdef([Name])
942])
943
944dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
945dnl searches for libname and the libraries corresponding to explicit and
946dnl implicit dependencies, together with the specified include files and
947dnl the ability to compile and link the specified testcode. The missing-message
948dnl defaults to 'no' and may contain additional hints for the user.
949dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
950dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
951dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
952dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
953dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
954dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
955AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
956[
957  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
958  AC_REQUIRE([AC_LIB_RPATH])
959  pushdef([Name],[m4_translit([$1],[./+-], [____])])
960  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
961                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
962
963  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
964  dnl accordingly.
965  AC_LIB_LINKFLAGS_BODY([$1], [$2])
966
967  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
968  dnl because if the user has installed lib[]Name and not disabled its use
969  dnl via --without-lib[]Name-prefix, he wants to use it.
970  ac_save_CPPFLAGS="$CPPFLAGS"
971  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
972
973  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
974    ac_save_LIBS="$LIBS"
975    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
976    dnl because these -l options might require -L options that are present in
977    dnl LIBS. -l options benefit only from the -L options listed before it.
978    dnl Otherwise, add it to the front of LIBS, because it may be a static
979    dnl library that depends on another static library that is present in LIBS.
980    dnl Static libraries benefit only from the static libraries listed after
981    dnl it.
982    case " $LIB[]NAME" in
983      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
984      *)       LIBS="$LIB[]NAME $LIBS" ;;
985    esac
986    AC_LINK_IFELSE(
987      [AC_LANG_PROGRAM([[$3]], [[$4]])],
988      [ac_cv_lib[]Name=yes],
989      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
990    LIBS="$ac_save_LIBS"
991  ])
992  if test "$ac_cv_lib[]Name" = yes; then
993    HAVE_LIB[]NAME=yes
994    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
995    AC_MSG_CHECKING([how to link with lib[]$1])
996    AC_MSG_RESULT([$LIB[]NAME])
997  else
998    HAVE_LIB[]NAME=no
999    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1000    dnl $INC[]NAME either.
1001    CPPFLAGS="$ac_save_CPPFLAGS"
1002    LIB[]NAME=
1003    LTLIB[]NAME=
1004    LIB[]NAME[]_PREFIX=
1005  fi
1006  AC_SUBST([HAVE_LIB]NAME)
1007  AC_SUBST([LIB]NAME)
1008  AC_SUBST([LTLIB]NAME)
1009  AC_SUBST([LIB]NAME[_PREFIX])
1010  popdef([NAME])
1011  popdef([Name])
1012])
1013
1014dnl Determine the platform dependent parameters needed to use rpath:
1015dnl   acl_libext,
1016dnl   acl_shlibext,
1017dnl   acl_libname_spec,
1018dnl   acl_library_names_spec,
1019dnl   acl_hardcode_libdir_flag_spec,
1020dnl   acl_hardcode_libdir_separator,
1021dnl   acl_hardcode_direct,
1022dnl   acl_hardcode_minus_L.
1023AC_DEFUN([AC_LIB_RPATH],
1024[
1025  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
1026  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
1027  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1028  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1029  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1030  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1031  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
1032    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1033    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1034    . ./conftest.sh
1035    rm -f ./conftest.sh
1036    acl_cv_rpath=done
1037  ])
1038  wl="$acl_cv_wl"
1039  acl_libext="$acl_cv_libext"
1040  acl_shlibext="$acl_cv_shlibext"
1041  acl_libname_spec="$acl_cv_libname_spec"
1042  acl_library_names_spec="$acl_cv_library_names_spec"
1043  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1044  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1045  acl_hardcode_direct="$acl_cv_hardcode_direct"
1046  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
1047  dnl Determine whether the user wants rpath handling at all.
1048  AC_ARG_ENABLE([rpath],
1049    [  --disable-rpath         do not hardcode runtime library paths],
1050    :, enable_rpath=yes)
1051])
1052
1053dnl AC_LIB_FROMPACKAGE(name, package)
1054dnl declares that libname comes from the given package. The configure file
1055dnl will then not have a --with-libname-prefix option but a
1056dnl --with-package-prefix option. Several libraries can come from the same
1057dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
1058dnl macro call that searches for libname.
1059AC_DEFUN([AC_LIB_FROMPACKAGE],
1060[
1061  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
1062                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
1063  define([acl_frompackage_]NAME, [$2])
1064  popdef([NAME])
1065  pushdef([PACK],[$2])
1066  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
1067                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
1068  define([acl_libsinpackage_]PACKUP,
1069    m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
1070  popdef([PACKUP])
1071  popdef([PACK])
1072])
1073
1074dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1075dnl the libraries corresponding to explicit and implicit dependencies.
1076dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1077dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
1078dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
1079AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1080[
1081  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1082  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
1083                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
1084  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
1085  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
1086                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
1087  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
1088  dnl Autoconf >= 2.61 supports dots in --with options.
1089  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
1090  dnl By default, look in $includedir and $libdir.
1091  use_additional=yes
1092  AC_LIB_WITH_FINAL_PREFIX([
1093    eval additional_includedir=\"$includedir\"
1094    eval additional_libdir=\"$libdir\"
1095  ])
1096  AC_ARG_WITH(P_A_C_K[-prefix],
1097[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
1098  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
1099[
1100    if test "X$withval" = "Xno"; then
1101      use_additional=no
1102    else
1103      if test "X$withval" = "X"; then
1104        AC_LIB_WITH_FINAL_PREFIX([
1105          eval additional_includedir=\"$includedir\"
1106          eval additional_libdir=\"$libdir\"
1107        ])
1108      else
1109        additional_includedir="$withval/include"
1110        additional_libdir="$withval/$acl_libdirstem"
1111        if test "$acl_libdirstem2" != "$acl_libdirstem" \
1112           && ! test -d "$withval/$acl_libdirstem"; then
1113          additional_libdir="$withval/$acl_libdirstem2"
1114        fi
1115      fi
1116    fi
1117])
1118  dnl Search the library and its dependencies in $additional_libdir and
1119  dnl $LDFLAGS. Using breadth-first-seach.
1120  LIB[]NAME=
1121  LTLIB[]NAME=
1122  INC[]NAME=
1123  LIB[]NAME[]_PREFIX=
1124  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
1125  dnl computed. So it has to be reset here.
1126  HAVE_LIB[]NAME=
1127  rpathdirs=
1128  ltrpathdirs=
1129  names_already_handled=
1130  names_next_round='$1 $2'
1131  while test -n "$names_next_round"; do
1132    names_this_round="$names_next_round"
1133    names_next_round=
1134    for name in $names_this_round; do
1135      already_handled=
1136      for n in $names_already_handled; do
1137        if test "$n" = "$name"; then
1138          already_handled=yes
1139          break
1140        fi
1141      done
1142      if test -z "$already_handled"; then
1143        names_already_handled="$names_already_handled $name"
1144        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1145        dnl or AC_LIB_HAVE_LINKFLAGS call.
1146        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
1147        eval value=\"\$HAVE_LIB$uppername\"
1148        if test -n "$value"; then
1149          if test "$value" = yes; then
1150            eval value=\"\$LIB$uppername\"
1151            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1152            eval value=\"\$LTLIB$uppername\"
1153            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1154          else
1155            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1156            dnl that this library doesn't exist. So just drop it.
1157            :
1158          fi
1159        else
1160          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1161          dnl and the already constructed $LIBNAME/$LTLIBNAME.
1162          found_dir=
1163          found_la=
1164          found_so=
1165          found_a=
1166          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
1167          if test -n "$acl_shlibext"; then
1168            shrext=".$acl_shlibext"             # typically: shrext=.so
1169          else
1170            shrext=
1171          fi
1172          if test $use_additional = yes; then
1173            dir="$additional_libdir"
1174            dnl The same code as in the loop below:
1175            dnl First look for a shared library.
1176            if test -n "$acl_shlibext"; then
1177              if test -f "$dir/$libname$shrext"; then
1178                found_dir="$dir"
1179                found_so="$dir/$libname$shrext"
1180              else
1181                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
1182                  ver=`(cd "$dir" && \
1183                        for f in "$libname$shrext".*; do echo "$f"; done \
1184                        | sed -e "s,^$libname$shrext\\\\.,," \
1185                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
1186                        | sed 1q ) 2>/dev/null`
1187                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
1188                    found_dir="$dir"
1189                    found_so="$dir/$libname$shrext.$ver"
1190                  fi
1191                else
1192                  eval library_names=\"$acl_library_names_spec\"
1193                  for f in $library_names; do
1194                    if test -f "$dir/$f"; then
1195                      found_dir="$dir"
1196                      found_so="$dir/$f"
1197                      break
1198                    fi
1199                  done
1200                fi
1201              fi
1202            fi
1203            dnl Then look for a static library.
1204            if test "X$found_dir" = "X"; then
1205              if test -f "$dir/$libname.$acl_libext"; then
1206                found_dir="$dir"
1207                found_a="$dir/$libname.$acl_libext"
1208              fi
1209            fi
1210            if test "X$found_dir" != "X"; then
1211              if test -f "$dir/$libname.la"; then
1212                found_la="$dir/$libname.la"
1213              fi
1214            fi
1215          fi
1216          if test "X$found_dir" = "X"; then
1217            for x in $LDFLAGS $LTLIB[]NAME; do
1218              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1219              case "$x" in
1220                -L*)
1221                  dir=`echo "X$x" | sed -e 's/^X-L//'`
1222                  dnl First look for a shared library.
1223                  if test -n "$acl_shlibext"; then
1224                    if test -f "$dir/$libname$shrext"; then
1225                      found_dir="$dir"
1226                      found_so="$dir/$libname$shrext"
1227                    else
1228                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
1229                        ver=`(cd "$dir" && \
1230                              for f in "$libname$shrext".*; do echo "$f"; done \
1231                              | sed -e "s,^$libname$shrext\\\\.,," \
1232                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
1233                              | sed 1q ) 2>/dev/null`
1234                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
1235                          found_dir="$dir"
1236                          found_so="$dir/$libname$shrext.$ver"
1237                        fi
1238                      else
1239                        eval library_names=\"$acl_library_names_spec\"
1240                        for f in $library_names; do
1241                          if test -f "$dir/$f"; then
1242                            found_dir="$dir"
1243                            found_so="$dir/$f"
1244                            break
1245                          fi
1246                        done
1247                      fi
1248                    fi
1249                  fi
1250                  dnl Then look for a static library.
1251                  if test "X$found_dir" = "X"; then
1252                    if test -f "$dir/$libname.$acl_libext"; then
1253                      found_dir="$dir"
1254                      found_a="$dir/$libname.$acl_libext"
1255                    fi
1256                  fi
1257                  if test "X$found_dir" != "X"; then
1258                    if test -f "$dir/$libname.la"; then
1259                      found_la="$dir/$libname.la"
1260                    fi
1261                  fi
1262                  ;;
1263              esac
1264              if test "X$found_dir" != "X"; then
1265                break
1266              fi
1267            done
1268          fi
1269          if test "X$found_dir" != "X"; then
1270            dnl Found the library.
1271            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1272            if test "X$found_so" != "X"; then
1273              dnl Linking with a shared library. We attempt to hardcode its
1274              dnl directory into the executable's runpath, unless it's the
1275              dnl standard /usr/lib.
1276              if test "$enable_rpath" = no \
1277                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
1278                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
1279                dnl No hardcoding is needed.
1280                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1281              else
1282                dnl Use an explicit option to hardcode DIR into the resulting
1283                dnl binary.
1284                dnl Potentially add DIR to ltrpathdirs.
1285                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1286                haveit=
1287                for x in $ltrpathdirs; do
1288                  if test "X$x" = "X$found_dir"; then
1289                    haveit=yes
1290                    break
1291                  fi
1292                done
1293                if test -z "$haveit"; then
1294                  ltrpathdirs="$ltrpathdirs $found_dir"
1295                fi
1296                dnl The hardcoding into $LIBNAME is system dependent.
1297                if test "$acl_hardcode_direct" = yes; then
1298                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1299                  dnl resulting binary.
1300                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1301                else
1302                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
1303                    dnl Use an explicit option to hardcode DIR into the resulting
1304                    dnl binary.
1305                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1306                    dnl Potentially add DIR to rpathdirs.
1307                    dnl The rpathdirs will be appended to $LIBNAME at the end.
1308                    haveit=
1309                    for x in $rpathdirs; do
1310                      if test "X$x" = "X$found_dir"; then
1311                        haveit=yes
1312                        break
1313                      fi
1314                    done
1315                    if test -z "$haveit"; then
1316                      rpathdirs="$rpathdirs $found_dir"
1317                    fi
1318                  else
1319                    dnl Rely on "-L$found_dir".
1320                    dnl But don't add it if it's already contained in the LDFLAGS
1321                    dnl or the already constructed $LIBNAME
1322                    haveit=
1323                    for x in $LDFLAGS $LIB[]NAME; do
1324                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1325                      if test "X$x" = "X-L$found_dir"; then
1326                        haveit=yes
1327                        break
1328                      fi
1329                    done
1330                    if test -z "$haveit"; then
1331                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1332                    fi
1333                    if test "$acl_hardcode_minus_L" != no; then
1334                      dnl FIXME: Not sure whether we should use
1335                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1336                      dnl here.
1337                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1338                    else
1339                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
1340                      dnl here, because this doesn't fit in flags passed to the
1341                      dnl compiler. So give up. No hardcoding. This affects only
1342                      dnl very old systems.
1343                      dnl FIXME: Not sure whether we should use
1344                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1345                      dnl here.
1346                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1347                    fi
1348                  fi
1349                fi
1350              fi
1351            else
1352              if test "X$found_a" != "X"; then
1353                dnl Linking with a static library.
1354                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1355              else
1356                dnl We shouldn't come here, but anyway it's good to have a
1357                dnl fallback.
1358                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1359              fi
1360            fi
1361            dnl Assume the include files are nearby.
1362            additional_includedir=
1363            case "$found_dir" in
1364              */$acl_libdirstem | */$acl_libdirstem/)
1365                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
1366                if test "$name" = '$1'; then
1367                  LIB[]NAME[]_PREFIX="$basedir"
1368                fi
1369                additional_includedir="$basedir/include"
1370                ;;
1371              */$acl_libdirstem2 | */$acl_libdirstem2/)
1372                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
1373                if test "$name" = '$1'; then
1374                  LIB[]NAME[]_PREFIX="$basedir"
1375                fi
1376                additional_includedir="$basedir/include"
1377                ;;
1378            esac
1379            if test "X$additional_includedir" != "X"; then
1380              dnl Potentially add $additional_includedir to $INCNAME.
1381              dnl But don't add it
1382              dnl   1. if it's the standard /usr/include,
1383              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1384              dnl   3. if it's already present in $CPPFLAGS or the already
1385              dnl      constructed $INCNAME,
1386              dnl   4. if it doesn't exist as a directory.
1387              if test "X$additional_includedir" != "X/usr/include"; then
1388                haveit=
1389                if test "X$additional_includedir" = "X/usr/local/include"; then
1390                  if test -n "$GCC"; then
1391                    case $host_os in
1392                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1393                    esac
1394                  fi
1395                fi
1396                if test -z "$haveit"; then
1397                  for x in $CPPFLAGS $INC[]NAME; do
1398                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1399                    if test "X$x" = "X-I$additional_includedir"; then
1400                      haveit=yes
1401                      break
1402                    fi
1403                  done
1404                  if test -z "$haveit"; then
1405                    if test -d "$additional_includedir"; then
1406                      dnl Really add $additional_includedir to $INCNAME.
1407                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1408                    fi
1409                  fi
1410                fi
1411              fi
1412            fi
1413            dnl Look for dependencies.
1414            if test -n "$found_la"; then
1415              dnl Read the .la file. It defines the variables
1416              dnl dlname, library_names, old_library, dependency_libs, current,
1417              dnl age, revision, installed, dlopen, dlpreopen, libdir.
1418              save_libdir="$libdir"
1419              case "$found_la" in
1420                */* | *\\*) . "$found_la" ;;
1421                *) . "./$found_la" ;;
1422              esac
1423              libdir="$save_libdir"
1424              dnl We use only dependency_libs.
1425              for dep in $dependency_libs; do
1426                case "$dep" in
1427                  -L*)
1428                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1429                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1430                    dnl But don't add it
1431                    dnl   1. if it's the standard /usr/lib,
1432                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1433                    dnl   3. if it's already present in $LDFLAGS or the already
1434                    dnl      constructed $LIBNAME,
1435                    dnl   4. if it doesn't exist as a directory.
1436                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
1437                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
1438                      haveit=
1439                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
1440                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
1441                        if test -n "$GCC"; then
1442                          case $host_os in
1443                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1444                          esac
1445                        fi
1446                      fi
1447                      if test -z "$haveit"; then
1448                        haveit=
1449                        for x in $LDFLAGS $LIB[]NAME; do
1450                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1451                          if test "X$x" = "X-L$additional_libdir"; then
1452                            haveit=yes
1453                            break
1454                          fi
1455                        done
1456                        if test -z "$haveit"; then
1457                          if test -d "$additional_libdir"; then
1458                            dnl Really add $additional_libdir to $LIBNAME.
1459                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1460                          fi
1461                        fi
1462                        haveit=
1463                        for x in $LDFLAGS $LTLIB[]NAME; do
1464                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1465                          if test "X$x" = "X-L$additional_libdir"; then
1466                            haveit=yes
1467                            break
1468                          fi
1469                        done
1470                        if test -z "$haveit"; then
1471                          if test -d "$additional_libdir"; then
1472                            dnl Really add $additional_libdir to $LTLIBNAME.
1473                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1474                          fi
1475                        fi
1476                      fi
1477                    fi
1478                    ;;
1479                  -R*)
1480                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
1481                    if test "$enable_rpath" != no; then
1482                      dnl Potentially add DIR to rpathdirs.
1483                      dnl The rpathdirs will be appended to $LIBNAME at the end.
1484                      haveit=
1485                      for x in $rpathdirs; do
1486                        if test "X$x" = "X$dir"; then
1487                          haveit=yes
1488                          break
1489                        fi
1490                      done
1491                      if test -z "$haveit"; then
1492                        rpathdirs="$rpathdirs $dir"
1493                      fi
1494                      dnl Potentially add DIR to ltrpathdirs.
1495                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1496                      haveit=
1497                      for x in $ltrpathdirs; do
1498                        if test "X$x" = "X$dir"; then
1499                          haveit=yes
1500                          break
1501                        fi
1502                      done
1503                      if test -z "$haveit"; then
1504                        ltrpathdirs="$ltrpathdirs $dir"
1505                      fi
1506                    fi
1507                    ;;
1508                  -l*)
1509                    dnl Handle this in the next round.
1510                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1511                    ;;
1512                  *.la)
1513                    dnl Handle this in the next round. Throw away the .la's
1514                    dnl directory; it is already contained in a preceding -L
1515                    dnl option.
1516                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1517                    ;;
1518                  *)
1519                    dnl Most likely an immediate library name.
1520                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1521                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1522                    ;;
1523                esac
1524              done
1525            fi
1526          else
1527            dnl Didn't find the library; assume it is in the system directories
1528            dnl known to the linker and runtime loader. (All the system
1529            dnl directories known to the linker should also be known to the
1530            dnl runtime loader, otherwise the system is severely misconfigured.)
1531            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1532            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1533          fi
1534        fi
1535      fi
1536    done
1537  done
1538  if test "X$rpathdirs" != "X"; then
1539    if test -n "$acl_hardcode_libdir_separator"; then
1540      dnl Weird platform: only the last -rpath option counts, the user must
1541      dnl pass all path elements in one option. We can arrange that for a
1542      dnl single library, but not when more than one $LIBNAMEs are used.
1543      alldirs=
1544      for found_dir in $rpathdirs; do
1545        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
1546      done
1547      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
1548      acl_save_libdir="$libdir"
1549      libdir="$alldirs"
1550      eval flag=\"$acl_hardcode_libdir_flag_spec\"
1551      libdir="$acl_save_libdir"
1552      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1553    else
1554      dnl The -rpath options are cumulative.
1555      for found_dir in $rpathdirs; do
1556        acl_save_libdir="$libdir"
1557        libdir="$found_dir"
1558        eval flag=\"$acl_hardcode_libdir_flag_spec\"
1559        libdir="$acl_save_libdir"
1560        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1561      done
1562    fi
1563  fi
1564  if test "X$ltrpathdirs" != "X"; then
1565    dnl When using libtool, the option that works for both libraries and
1566    dnl executables is -R. The -R options are cumulative.
1567    for found_dir in $ltrpathdirs; do
1568      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1569    done
1570  fi
1571  popdef([P_A_C_K])
1572  popdef([PACKLIBS])
1573  popdef([PACKUP])
1574  popdef([PACK])
1575  popdef([NAME])
1576])
1577
1578dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1579dnl unless already present in VAR.
1580dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1581dnl contains two or three consecutive elements that belong together.
1582AC_DEFUN([AC_LIB_APPENDTOVAR],
1583[
1584  for element in [$2]; do
1585    haveit=
1586    for x in $[$1]; do
1587      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1588      if test "X$x" = "X$element"; then
1589        haveit=yes
1590        break
1591      fi
1592    done
1593    if test -z "$haveit"; then
1594      [$1]="${[$1]}${[$1]:+ }$element"
1595    fi
1596  done
1597])
1598
1599dnl For those cases where a variable contains several -L and -l options
1600dnl referring to unknown libraries and directories, this macro determines the
1601dnl necessary additional linker options for the runtime path.
1602dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
1603dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
1604dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
1605dnl otherwise linking without libtool is assumed.
1606AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
1607[
1608  AC_REQUIRE([AC_LIB_RPATH])
1609  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1610  $1=
1611  if test "$enable_rpath" != no; then
1612    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
1613      dnl Use an explicit option to hardcode directories into the resulting
1614      dnl binary.
1615      rpathdirs=
1616      next=
1617      for opt in $2; do
1618        if test -n "$next"; then
1619          dir="$next"
1620          dnl No need to hardcode the standard /usr/lib.
1621          if test "X$dir" != "X/usr/$acl_libdirstem" \
1622             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1623            rpathdirs="$rpathdirs $dir"
1624          fi
1625          next=
1626        else
1627          case $opt in
1628            -L) next=yes ;;
1629            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
1630                 dnl No need to hardcode the standard /usr/lib.
1631                 if test "X$dir" != "X/usr/$acl_libdirstem" \
1632                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1633                   rpathdirs="$rpathdirs $dir"
1634                 fi
1635                 next= ;;
1636            *) next= ;;
1637          esac
1638        fi
1639      done
1640      if test "X$rpathdirs" != "X"; then
1641        if test -n ""$3""; then
1642          dnl libtool is used for linking. Use -R options.
1643          for dir in $rpathdirs; do
1644            $1="${$1}${$1:+ }-R$dir"
1645          done
1646        else
1647          dnl The linker is used for linking directly.
1648          if test -n "$acl_hardcode_libdir_separator"; then
1649            dnl Weird platform: only the last -rpath option counts, the user
1650            dnl must pass all path elements in one option.
1651            alldirs=
1652            for dir in $rpathdirs; do
1653              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
1654            done
1655            acl_save_libdir="$libdir"
1656            libdir="$alldirs"
1657            eval flag=\"$acl_hardcode_libdir_flag_spec\"
1658            libdir="$acl_save_libdir"
1659            $1="$flag"
1660          else
1661            dnl The -rpath options are cumulative.
1662            for dir in $rpathdirs; do
1663              acl_save_libdir="$libdir"
1664              libdir="$dir"
1665              eval flag=\"$acl_hardcode_libdir_flag_spec\"
1666              libdir="$acl_save_libdir"
1667              $1="${$1}${$1:+ }$flag"
1668            done
1669          fi
1670        fi
1671      fi
1672    fi
1673  fi
1674  AC_SUBST([$1])
1675])
1676
1677# lib-prefix.m4 serial 7 (gettext-0.18)
1678dnl Copyright (C) 2001-2005, 2008-2016 Free Software Foundation, Inc.
1679dnl This file is free software; the Free Software Foundation
1680dnl gives unlimited permission to copy and/or distribute it,
1681dnl with or without modifications, as long as this notice is preserved.
1682
1683dnl From Bruno Haible.
1684
1685dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
1686dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
1687dnl require excessive bracketing.
1688ifdef([AC_HELP_STRING],
1689[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
1690[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
1691
1692dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1693dnl to access previously installed libraries. The basic assumption is that
1694dnl a user will want packages to use other packages he previously installed
1695dnl with the same --prefix option.
1696dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1697dnl libraries, but is otherwise very convenient.
1698AC_DEFUN([AC_LIB_PREFIX],
1699[
1700  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1701  AC_REQUIRE([AC_PROG_CC])
1702  AC_REQUIRE([AC_CANONICAL_HOST])
1703  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1704  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1705  dnl By default, look in $includedir and $libdir.
1706  use_additional=yes
1707  AC_LIB_WITH_FINAL_PREFIX([
1708    eval additional_includedir=\"$includedir\"
1709    eval additional_libdir=\"$libdir\"
1710  ])
1711  AC_LIB_ARG_WITH([lib-prefix],
1712[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1713  --without-lib-prefix    don't search for libraries in includedir and libdir],
1714[
1715    if test "X$withval" = "Xno"; then
1716      use_additional=no
1717    else
1718      if test "X$withval" = "X"; then
1719        AC_LIB_WITH_FINAL_PREFIX([
1720          eval additional_includedir=\"$includedir\"
1721          eval additional_libdir=\"$libdir\"
1722        ])
1723      else
1724        additional_includedir="$withval/include"
1725        additional_libdir="$withval/$acl_libdirstem"
1726      fi
1727    fi
1728])
1729  if test $use_additional = yes; then
1730    dnl Potentially add $additional_includedir to $CPPFLAGS.
1731    dnl But don't add it
1732    dnl   1. if it's the standard /usr/include,
1733    dnl   2. if it's already present in $CPPFLAGS,
1734    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1735    dnl   4. if it doesn't exist as a directory.
1736    if test "X$additional_includedir" != "X/usr/include"; then
1737      haveit=
1738      for x in $CPPFLAGS; do
1739        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1740        if test "X$x" = "X-I$additional_includedir"; then
1741          haveit=yes
1742          break
1743        fi
1744      done
1745      if test -z "$haveit"; then
1746        if test "X$additional_includedir" = "X/usr/local/include"; then
1747          if test -n "$GCC"; then
1748            case $host_os in
1749              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1750            esac
1751          fi
1752        fi
1753        if test -z "$haveit"; then
1754          if test -d "$additional_includedir"; then
1755            dnl Really add $additional_includedir to $CPPFLAGS.
1756            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1757          fi
1758        fi
1759      fi
1760    fi
1761    dnl Potentially add $additional_libdir to $LDFLAGS.
1762    dnl But don't add it
1763    dnl   1. if it's the standard /usr/lib,
1764    dnl   2. if it's already present in $LDFLAGS,
1765    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
1766    dnl   4. if it doesn't exist as a directory.
1767    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
1768      haveit=
1769      for x in $LDFLAGS; do
1770        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1771        if test "X$x" = "X-L$additional_libdir"; then
1772          haveit=yes
1773          break
1774        fi
1775      done
1776      if test -z "$haveit"; then
1777        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
1778          if test -n "$GCC"; then
1779            case $host_os in
1780              linux*) haveit=yes;;
1781            esac
1782          fi
1783        fi
1784        if test -z "$haveit"; then
1785          if test -d "$additional_libdir"; then
1786            dnl Really add $additional_libdir to $LDFLAGS.
1787            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1788          fi
1789        fi
1790      fi
1791    fi
1792  fi
1793])
1794
1795dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1796dnl acl_final_exec_prefix, containing the values to which $prefix and
1797dnl $exec_prefix will expand at the end of the configure script.
1798AC_DEFUN([AC_LIB_PREPARE_PREFIX],
1799[
1800  dnl Unfortunately, prefix and exec_prefix get only finally determined
1801  dnl at the end of configure.
1802  if test "X$prefix" = "XNONE"; then
1803    acl_final_prefix="$ac_default_prefix"
1804  else
1805    acl_final_prefix="$prefix"
1806  fi
1807  if test "X$exec_prefix" = "XNONE"; then
1808    acl_final_exec_prefix='${prefix}'
1809  else
1810    acl_final_exec_prefix="$exec_prefix"
1811  fi
1812  acl_save_prefix="$prefix"
1813  prefix="$acl_final_prefix"
1814  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1815  prefix="$acl_save_prefix"
1816])
1817
1818dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1819dnl variables prefix and exec_prefix bound to the values they will have
1820dnl at the end of the configure script.
1821AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1822[
1823  acl_save_prefix="$prefix"
1824  prefix="$acl_final_prefix"
1825  acl_save_exec_prefix="$exec_prefix"
1826  exec_prefix="$acl_final_exec_prefix"
1827  $1
1828  exec_prefix="$acl_save_exec_prefix"
1829  prefix="$acl_save_prefix"
1830])
1831
1832dnl AC_LIB_PREPARE_MULTILIB creates
1833dnl - a variable acl_libdirstem, containing the basename of the libdir, either
1834dnl   "lib" or "lib64" or "lib/64",
1835dnl - a variable acl_libdirstem2, as a secondary possible value for
1836dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
1837dnl   "lib/amd64".
1838AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
1839[
1840  dnl There is no formal standard regarding lib and lib64.
1841  dnl On glibc systems, the current practice is that on a system supporting
1842  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1843  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
1844  dnl the compiler's default mode by looking at the compiler's library search
1845  dnl path. If at least one of its elements ends in /lib64 or points to a
1846  dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
1847  dnl Otherwise we use the default, namely "lib".
1848  dnl On Solaris systems, the current practice is that on a system supporting
1849  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1850  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
1851  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
1852  AC_REQUIRE([AC_CANONICAL_HOST])
1853  acl_libdirstem=lib
1854  acl_libdirstem2=
1855  case "$host_os" in
1856    solaris*)
1857      dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
1858      dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
1859      dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
1860      dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
1861      dnl symlink is missing, so we set acl_libdirstem2 too.
1862      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
1863        [AC_EGREP_CPP([sixtyfour bits], [
1864#ifdef _LP64
1865sixtyfour bits
1866#endif
1867           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
1868        ])
1869      if test $gl_cv_solaris_64bit = yes; then
1870        acl_libdirstem=lib/64
1871        case "$host_cpu" in
1872          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
1873          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
1874        esac
1875      fi
1876      ;;
1877    *)
1878      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
1879      if test -n "$searchpath"; then
1880        acl_save_IFS="${IFS= 	}"; IFS=":"
1881        for searchdir in $searchpath; do
1882          if test -d "$searchdir"; then
1883            case "$searchdir" in
1884              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
1885              */../ | */.. )
1886                # Better ignore directories of this form. They are misleading.
1887                ;;
1888              *) searchdir=`cd "$searchdir" && pwd`
1889                 case "$searchdir" in
1890                   */lib64 ) acl_libdirstem=lib64 ;;
1891                 esac ;;
1892            esac
1893          fi
1894        done
1895        IFS="$acl_save_IFS"
1896      fi
1897      ;;
1898  esac
1899  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
1900])
1901
1902# nls.m4 serial 5 (gettext-0.18)
1903dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016 Free Software
1904dnl Foundation, Inc.
1905dnl This file is free software; the Free Software Foundation
1906dnl gives unlimited permission to copy and/or distribute it,
1907dnl with or without modifications, as long as this notice is preserved.
1908dnl
1909dnl This file can be used in projects which are not available under
1910dnl the GNU General Public License or the GNU Library General Public
1911dnl License but which still want to provide support for the GNU gettext
1912dnl functionality.
1913dnl Please note that the actual code of the GNU gettext library is covered
1914dnl by the GNU Library General Public License, and the rest of the GNU
1915dnl gettext package is covered by the GNU General Public License.
1916dnl They are *not* in the public domain.
1917
1918dnl Authors:
1919dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1920dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1921
1922AC_PREREQ([2.50])
1923
1924AC_DEFUN([AM_NLS],
1925[
1926  AC_MSG_CHECKING([whether NLS is requested])
1927  dnl Default is enabled NLS
1928  AC_ARG_ENABLE([nls],
1929    [  --disable-nls           do not use Native Language Support],
1930    USE_NLS=$enableval, USE_NLS=yes)
1931  AC_MSG_RESULT([$USE_NLS])
1932  AC_SUBST([USE_NLS])
1933])
1934
1935dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1936dnl serial 11 (pkg-config-0.29)
1937dnl
1938dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1939dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1940dnl
1941dnl This program is free software; you can redistribute it and/or modify
1942dnl it under the terms of the GNU General Public License as published by
1943dnl the Free Software Foundation; either version 2 of the License, or
1944dnl (at your option) any later version.
1945dnl
1946dnl This program is distributed in the hope that it will be useful, but
1947dnl WITHOUT ANY WARRANTY; without even the implied warranty of
1948dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1949dnl General Public License for more details.
1950dnl
1951dnl You should have received a copy of the GNU General Public License
1952dnl along with this program; if not, write to the Free Software
1953dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1954dnl 02111-1307, USA.
1955dnl
1956dnl As a special exception to the GNU General Public License, if you
1957dnl distribute this file as part of a program that contains a
1958dnl configuration script generated by Autoconf, you may include it under
1959dnl the same distribution terms that you use for the rest of that
1960dnl program.
1961
1962dnl PKG_PREREQ(MIN-VERSION)
1963dnl -----------------------
1964dnl Since: 0.29
1965dnl
1966dnl Verify that the version of the pkg-config macros are at least
1967dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1968dnl installed version of pkg-config, this checks the developer's version
1969dnl of pkg.m4 when generating configure.
1970dnl
1971dnl To ensure that this macro is defined, also add:
1972dnl m4_ifndef([PKG_PREREQ],
1973dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1974dnl
1975dnl See the "Since" comment for each macro you use to see what version
1976dnl of the macros you require.
1977m4_defun([PKG_PREREQ],
1978[m4_define([PKG_MACROS_VERSION], [0.29])
1979m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1980    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1981])dnl PKG_PREREQ
1982
1983dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1984dnl ----------------------------------
1985dnl Since: 0.16
1986dnl
1987dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1988dnl first found in the path. Checks that the version of pkg-config found
1989dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1990dnl used since that's the first version where most current features of
1991dnl pkg-config existed.
1992AC_DEFUN([PKG_PROG_PKG_CONFIG],
1993[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1994m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1995m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1996AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1997AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1998AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1999
2000if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2001	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2002fi
2003if test -n "$PKG_CONFIG"; then
2004	_pkg_min_version=m4_default([$1], [0.9.0])
2005	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2006	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2007		AC_MSG_RESULT([yes])
2008	else
2009		AC_MSG_RESULT([no])
2010		PKG_CONFIG=""
2011	fi
2012fi[]dnl
2013])dnl PKG_PROG_PKG_CONFIG
2014
2015dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2016dnl -------------------------------------------------------------------
2017dnl Since: 0.18
2018dnl
2019dnl Check to see whether a particular set of modules exists. Similar to
2020dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
2021dnl
2022dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2023dnl only at the first occurence in configure.ac, so if the first place
2024dnl it's called might be skipped (such as if it is within an "if", you
2025dnl have to call PKG_CHECK_EXISTS manually
2026AC_DEFUN([PKG_CHECK_EXISTS],
2027[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2028if test -n "$PKG_CONFIG" && \
2029    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2030  m4_default([$2], [:])
2031m4_ifvaln([$3], [else
2032  $3])dnl
2033fi])
2034
2035dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2036dnl ---------------------------------------------
2037dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
2038dnl pkg_failed based on the result.
2039m4_define([_PKG_CONFIG],
2040[if test -n "$$1"; then
2041    pkg_cv_[]$1="$$1"
2042 elif test -n "$PKG_CONFIG"; then
2043    PKG_CHECK_EXISTS([$3],
2044                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
2045		      test "x$?" != "x0" && pkg_failed=yes ],
2046		     [pkg_failed=yes])
2047 else
2048    pkg_failed=untried
2049fi[]dnl
2050])dnl _PKG_CONFIG
2051
2052dnl _PKG_SHORT_ERRORS_SUPPORTED
2053dnl ---------------------------
2054dnl Internal check to see if pkg-config supports short errors.
2055AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2056[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2057if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2058        _pkg_short_errors_supported=yes
2059else
2060        _pkg_short_errors_supported=no
2061fi[]dnl
2062])dnl _PKG_SHORT_ERRORS_SUPPORTED
2063
2064
2065dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2066dnl   [ACTION-IF-NOT-FOUND])
2067dnl --------------------------------------------------------------
2068dnl Since: 0.4.0
2069dnl
2070dnl Note that if there is a possibility the first call to
2071dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
2072dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2073AC_DEFUN([PKG_CHECK_MODULES],
2074[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2075AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2076AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2077
2078pkg_failed=no
2079AC_MSG_CHECKING([for $1])
2080
2081_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2082_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2083
2084m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2085and $1[]_LIBS to avoid the need to call pkg-config.
2086See the pkg-config man page for more details.])
2087
2088if test $pkg_failed = yes; then
2089   	AC_MSG_RESULT([no])
2090        _PKG_SHORT_ERRORS_SUPPORTED
2091        if test $_pkg_short_errors_supported = yes; then
2092	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
2093        else
2094	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
2095        fi
2096	# Put the nasty error message in config.log where it belongs
2097	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2098
2099	m4_default([$4], [AC_MSG_ERROR(
2100[Package requirements ($2) were not met:
2101
2102$$1_PKG_ERRORS
2103
2104Consider adjusting the PKG_CONFIG_PATH environment variable if you
2105installed software in a non-standard prefix.
2106
2107_PKG_TEXT])[]dnl
2108        ])
2109elif test $pkg_failed = untried; then
2110     	AC_MSG_RESULT([no])
2111	m4_default([$4], [AC_MSG_FAILURE(
2112[The pkg-config script could not be found or is too old.  Make sure it
2113is in your PATH or set the PKG_CONFIG environment variable to the full
2114path to pkg-config.
2115
2116_PKG_TEXT
2117
2118To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2119        ])
2120else
2121	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2122	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2123        AC_MSG_RESULT([yes])
2124	$3
2125fi[]dnl
2126])dnl PKG_CHECK_MODULES
2127
2128
2129dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2130dnl   [ACTION-IF-NOT-FOUND])
2131dnl ---------------------------------------------------------------------
2132dnl Since: 0.29
2133dnl
2134dnl Checks for existence of MODULES and gathers its build flags with
2135dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2136dnl and VARIABLE-PREFIX_LIBS from --libs.
2137dnl
2138dnl Note that if there is a possibility the first call to
2139dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2140dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2141dnl configure.ac.
2142AC_DEFUN([PKG_CHECK_MODULES_STATIC],
2143[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2144_save_PKG_CONFIG=$PKG_CONFIG
2145PKG_CONFIG="$PKG_CONFIG --static"
2146PKG_CHECK_MODULES($@)
2147PKG_CONFIG=$_save_PKG_CONFIG[]dnl
2148])dnl PKG_CHECK_MODULES_STATIC
2149
2150
2151dnl PKG_INSTALLDIR([DIRECTORY])
2152dnl -------------------------
2153dnl Since: 0.27
2154dnl
2155dnl Substitutes the variable pkgconfigdir as the location where a module
2156dnl should install pkg-config .pc files. By default the directory is
2157dnl $libdir/pkgconfig, but the default can be changed by passing
2158dnl DIRECTORY. The user can override through the --with-pkgconfigdir
2159dnl parameter.
2160AC_DEFUN([PKG_INSTALLDIR],
2161[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2162m4_pushdef([pkg_description],
2163    [pkg-config installation directory @<:@]pkg_default[@:>@])
2164AC_ARG_WITH([pkgconfigdir],
2165    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2166    [with_pkgconfigdir=]pkg_default)
2167AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2168m4_popdef([pkg_default])
2169m4_popdef([pkg_description])
2170])dnl PKG_INSTALLDIR
2171
2172
2173dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2174dnl --------------------------------
2175dnl Since: 0.27
2176dnl
2177dnl Substitutes the variable noarch_pkgconfigdir as the location where a
2178dnl module should install arch-independent pkg-config .pc files. By
2179dnl default the directory is $datadir/pkgconfig, but the default can be
2180dnl changed by passing DIRECTORY. The user can override through the
2181dnl --with-noarch-pkgconfigdir parameter.
2182AC_DEFUN([PKG_NOARCH_INSTALLDIR],
2183[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2184m4_pushdef([pkg_description],
2185    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2186AC_ARG_WITH([noarch-pkgconfigdir],
2187    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2188    [with_noarch_pkgconfigdir=]pkg_default)
2189AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2190m4_popdef([pkg_default])
2191m4_popdef([pkg_description])
2192])dnl PKG_NOARCH_INSTALLDIR
2193
2194
2195dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2196dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2197dnl -------------------------------------------
2198dnl Since: 0.28
2199dnl
2200dnl Retrieves the value of the pkg-config variable for the given module.
2201AC_DEFUN([PKG_CHECK_VAR],
2202[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2203AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2204
2205_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2206AS_VAR_COPY([$1], [pkg_cv_][$1])
2207
2208AS_VAR_IF([$1], [""], [$5], [$4])dnl
2209])dnl PKG_CHECK_VAR
2210
2211# Copyright (C) 2002-2017 Free Software Foundation, Inc.
2212#
2213# This file is free software; the Free Software Foundation
2214# gives unlimited permission to copy and/or distribute it,
2215# with or without modifications, as long as this notice is preserved.
2216
2217# AM_AUTOMAKE_VERSION(VERSION)
2218# ----------------------------
2219# Automake X.Y traces this macro to ensure aclocal.m4 has been
2220# generated from the m4 files accompanying Automake X.Y.
2221# (This private macro should not be called outside this file.)
2222AC_DEFUN([AM_AUTOMAKE_VERSION],
2223[am__api_version='1.15'
2224dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2225dnl require some minimum version.  Point them to the right macro.
2226m4_if([$1], [1.15.1], [],
2227      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2228])
2229
2230# _AM_AUTOCONF_VERSION(VERSION)
2231# -----------------------------
2232# aclocal traces this macro to find the Autoconf version.
2233# This is a private macro too.  Using m4_define simplifies
2234# the logic in aclocal, which can simply ignore this definition.
2235m4_define([_AM_AUTOCONF_VERSION], [])
2236
2237# AM_SET_CURRENT_AUTOMAKE_VERSION
2238# -------------------------------
2239# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2240# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2241AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2242[AM_AUTOMAKE_VERSION([1.15.1])dnl
2243m4_ifndef([AC_AUTOCONF_VERSION],
2244  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2245_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2246
2247# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2248
2249# Copyright (C) 2001-2017 Free Software Foundation, Inc.
2250#
2251# This file is free software; the Free Software Foundation
2252# gives unlimited permission to copy and/or distribute it,
2253# with or without modifications, as long as this notice is preserved.
2254
2255# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2256# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
2257# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2258#
2259# Of course, Automake must honor this variable whenever it calls a
2260# tool from the auxiliary directory.  The problem is that $srcdir (and
2261# therefore $ac_aux_dir as well) can be either absolute or relative,
2262# depending on how configure is run.  This is pretty annoying, since
2263# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2264# source directory, any form will work fine, but in subdirectories a
2265# relative path needs to be adjusted first.
2266#
2267# $ac_aux_dir/missing
2268#    fails when called from a subdirectory if $ac_aux_dir is relative
2269# $top_srcdir/$ac_aux_dir/missing
2270#    fails if $ac_aux_dir is absolute,
2271#    fails when called from a subdirectory in a VPATH build with
2272#          a relative $ac_aux_dir
2273#
2274# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2275# are both prefixed by $srcdir.  In an in-source build this is usually
2276# harmless because $srcdir is '.', but things will broke when you
2277# start a VPATH build or use an absolute $srcdir.
2278#
2279# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2280# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2281#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2282# and then we would define $MISSING as
2283#   MISSING="\${SHELL} $am_aux_dir/missing"
2284# This will work as long as MISSING is not called from configure, because
2285# unfortunately $(top_srcdir) has no meaning in configure.
2286# However there are other variables, like CC, which are often used in
2287# configure, and could therefore not use this "fixed" $ac_aux_dir.
2288#
2289# Another solution, used here, is to always expand $ac_aux_dir to an
2290# absolute PATH.  The drawback is that using absolute paths prevent a
2291# configured tree to be moved without reconfiguration.
2292
2293AC_DEFUN([AM_AUX_DIR_EXPAND],
2294[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
2295# Expand $ac_aux_dir to an absolute path.
2296am_aux_dir=`cd "$ac_aux_dir" && pwd`
2297])
2298
2299# AM_CONDITIONAL                                            -*- Autoconf -*-
2300
2301# Copyright (C) 1997-2017 Free Software Foundation, Inc.
2302#
2303# This file is free software; the Free Software Foundation
2304# gives unlimited permission to copy and/or distribute it,
2305# with or without modifications, as long as this notice is preserved.
2306
2307# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2308# -------------------------------------
2309# Define a conditional.
2310AC_DEFUN([AM_CONDITIONAL],
2311[AC_PREREQ([2.52])dnl
2312 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2313       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2314AC_SUBST([$1_TRUE])dnl
2315AC_SUBST([$1_FALSE])dnl
2316_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2317_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2318m4_define([_AM_COND_VALUE_$1], [$2])dnl
2319if $2; then
2320  $1_TRUE=
2321  $1_FALSE='#'
2322else
2323  $1_TRUE='#'
2324  $1_FALSE=
2325fi
2326AC_CONFIG_COMMANDS_PRE(
2327[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2328  AC_MSG_ERROR([[conditional "$1" was never defined.
2329Usually this means the macro was only invoked conditionally.]])
2330fi])])
2331
2332# Copyright (C) 1999-2017 Free Software Foundation, Inc.
2333#
2334# This file is free software; the Free Software Foundation
2335# gives unlimited permission to copy and/or distribute it,
2336# with or without modifications, as long as this notice is preserved.
2337
2338
2339# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2340# written in clear, in which case automake, when reading aclocal.m4,
2341# will think it sees a *use*, and therefore will trigger all it's
2342# C support machinery.  Also note that it means that autoscan, seeing
2343# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2344
2345
2346# _AM_DEPENDENCIES(NAME)
2347# ----------------------
2348# See how the compiler implements dependency checking.
2349# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2350# We try a few techniques and use that to set a single cache variable.
2351#
2352# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2353# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2354# dependency, and given that the user is not expected to run this macro,
2355# just rely on AC_PROG_CC.
2356AC_DEFUN([_AM_DEPENDENCIES],
2357[AC_REQUIRE([AM_SET_DEPDIR])dnl
2358AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2359AC_REQUIRE([AM_MAKE_INCLUDE])dnl
2360AC_REQUIRE([AM_DEP_TRACK])dnl
2361
2362m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
2363      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
2364      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2365      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
2366      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
2367      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2368                    [depcc="$$1"   am_compiler_list=])
2369
2370AC_CACHE_CHECK([dependency style of $depcc],
2371               [am_cv_$1_dependencies_compiler_type],
2372[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2373  # We make a subdir and do the tests there.  Otherwise we can end up
2374  # making bogus files that we don't know about and never remove.  For
2375  # instance it was reported that on HP-UX the gcc test will end up
2376  # making a dummy file named 'D' -- because '-MD' means "put the output
2377  # in D".
2378  rm -rf conftest.dir
2379  mkdir conftest.dir
2380  # Copy depcomp to subdir because otherwise we won't find it if we're
2381  # using a relative directory.
2382  cp "$am_depcomp" conftest.dir
2383  cd conftest.dir
2384  # We will build objects and dependencies in a subdirectory because
2385  # it helps to detect inapplicable dependency modes.  For instance
2386  # both Tru64's cc and ICC support -MD to output dependencies as a
2387  # side effect of compilation, but ICC will put the dependencies in
2388  # the current directory while Tru64 will put them in the object
2389  # directory.
2390  mkdir sub
2391
2392  am_cv_$1_dependencies_compiler_type=none
2393  if test "$am_compiler_list" = ""; then
2394     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2395  fi
2396  am__universal=false
2397  m4_case([$1], [CC],
2398    [case " $depcc " in #(
2399     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2400     esac],
2401    [CXX],
2402    [case " $depcc " in #(
2403     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2404     esac])
2405
2406  for depmode in $am_compiler_list; do
2407    # Setup a source with many dependencies, because some compilers
2408    # like to wrap large dependency lists on column 80 (with \), and
2409    # we should not choose a depcomp mode which is confused by this.
2410    #
2411    # We need to recreate these files for each test, as the compiler may
2412    # overwrite some of them when testing with obscure command lines.
2413    # This happens at least with the AIX C compiler.
2414    : > sub/conftest.c
2415    for i in 1 2 3 4 5 6; do
2416      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2417      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2418      # Solaris 10 /bin/sh.
2419      echo '/* dummy */' > sub/conftst$i.h
2420    done
2421    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2422
2423    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2424    # mode.  It turns out that the SunPro C++ compiler does not properly
2425    # handle '-M -o', and we need to detect this.  Also, some Intel
2426    # versions had trouble with output in subdirs.
2427    am__obj=sub/conftest.${OBJEXT-o}
2428    am__minus_obj="-o $am__obj"
2429    case $depmode in
2430    gcc)
2431      # This depmode causes a compiler race in universal mode.
2432      test "$am__universal" = false || continue
2433      ;;
2434    nosideeffect)
2435      # After this tag, mechanisms are not by side-effect, so they'll
2436      # only be used when explicitly requested.
2437      if test "x$enable_dependency_tracking" = xyes; then
2438	continue
2439      else
2440	break
2441      fi
2442      ;;
2443    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2444      # This compiler won't grok '-c -o', but also, the minuso test has
2445      # not run yet.  These depmodes are late enough in the game, and
2446      # so weak that their functioning should not be impacted.
2447      am__obj=conftest.${OBJEXT-o}
2448      am__minus_obj=
2449      ;;
2450    none) break ;;
2451    esac
2452    if depmode=$depmode \
2453       source=sub/conftest.c object=$am__obj \
2454       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2455       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2456         >/dev/null 2>conftest.err &&
2457       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2458       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2459       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2460       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2461      # icc doesn't choke on unknown options, it will just issue warnings
2462      # or remarks (even with -Werror).  So we grep stderr for any message
2463      # that says an option was ignored or not supported.
2464      # When given -MP, icc 7.0 and 7.1 complain thusly:
2465      #   icc: Command line warning: ignoring option '-M'; no argument required
2466      # The diagnosis changed in icc 8.0:
2467      #   icc: Command line remark: option '-MP' not supported
2468      if (grep 'ignoring option' conftest.err ||
2469          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2470        am_cv_$1_dependencies_compiler_type=$depmode
2471        break
2472      fi
2473    fi
2474  done
2475
2476  cd ..
2477  rm -rf conftest.dir
2478else
2479  am_cv_$1_dependencies_compiler_type=none
2480fi
2481])
2482AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2483AM_CONDITIONAL([am__fastdep$1], [
2484  test "x$enable_dependency_tracking" != xno \
2485  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2486])
2487
2488
2489# AM_SET_DEPDIR
2490# -------------
2491# Choose a directory name for dependency files.
2492# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2493AC_DEFUN([AM_SET_DEPDIR],
2494[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2495AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2496])
2497
2498
2499# AM_DEP_TRACK
2500# ------------
2501AC_DEFUN([AM_DEP_TRACK],
2502[AC_ARG_ENABLE([dependency-tracking], [dnl
2503AS_HELP_STRING(
2504  [--enable-dependency-tracking],
2505  [do not reject slow dependency extractors])
2506AS_HELP_STRING(
2507  [--disable-dependency-tracking],
2508  [speeds up one-time build])])
2509if test "x$enable_dependency_tracking" != xno; then
2510  am_depcomp="$ac_aux_dir/depcomp"
2511  AMDEPBACKSLASH='\'
2512  am__nodep='_no'
2513fi
2514AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2515AC_SUBST([AMDEPBACKSLASH])dnl
2516_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2517AC_SUBST([am__nodep])dnl
2518_AM_SUBST_NOTMAKE([am__nodep])dnl
2519])
2520
2521# Generate code to set up dependency tracking.              -*- Autoconf -*-
2522
2523# Copyright (C) 1999-2017 Free Software Foundation, Inc.
2524#
2525# This file is free software; the Free Software Foundation
2526# gives unlimited permission to copy and/or distribute it,
2527# with or without modifications, as long as this notice is preserved.
2528
2529
2530# _AM_OUTPUT_DEPENDENCY_COMMANDS
2531# ------------------------------
2532AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2533[{
2534  # Older Autoconf quotes --file arguments for eval, but not when files
2535  # are listed without --file.  Let's play safe and only enable the eval
2536  # if we detect the quoting.
2537  case $CONFIG_FILES in
2538  *\'*) eval set x "$CONFIG_FILES" ;;
2539  *)   set x $CONFIG_FILES ;;
2540  esac
2541  shift
2542  for mf
2543  do
2544    # Strip MF so we end up with the name of the file.
2545    mf=`echo "$mf" | sed -e 's/:.*$//'`
2546    # Check whether this is an Automake generated Makefile or not.
2547    # We used to match only the files named 'Makefile.in', but
2548    # some people rename them; so instead we look at the file content.
2549    # Grep'ing the first line is not enough: some people post-process
2550    # each Makefile.in and add a new line on top of each file to say so.
2551    # Grep'ing the whole file is not good either: AIX grep has a line
2552    # limit of 2048, but all sed's we know have understand at least 4000.
2553    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
2554      dirpart=`AS_DIRNAME("$mf")`
2555    else
2556      continue
2557    fi
2558    # Extract the definition of DEPDIR, am__include, and am__quote
2559    # from the Makefile without running 'make'.
2560    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
2561    test -z "$DEPDIR" && continue
2562    am__include=`sed -n 's/^am__include = //p' < "$mf"`
2563    test -z "$am__include" && continue
2564    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
2565    # Find all dependency output files, they are included files with
2566    # $(DEPDIR) in their names.  We invoke sed twice because it is the
2567    # simplest approach to changing $(DEPDIR) to its actual value in the
2568    # expansion.
2569    for file in `sed -n "
2570      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
2571	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
2572      # Make sure the directory exists.
2573      test -f "$dirpart/$file" && continue
2574      fdir=`AS_DIRNAME(["$file"])`
2575      AS_MKDIR_P([$dirpart/$fdir])
2576      # echo "creating $dirpart/$file"
2577      echo '# dummy' > "$dirpart/$file"
2578    done
2579  done
2580}
2581])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2582
2583
2584# AM_OUTPUT_DEPENDENCY_COMMANDS
2585# -----------------------------
2586# This macro should only be invoked once -- use via AC_REQUIRE.
2587#
2588# This code is only required when automatic dependency tracking
2589# is enabled.  FIXME.  This creates each '.P' file that we will
2590# need in order to bootstrap the dependency handling code.
2591AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2592[AC_CONFIG_COMMANDS([depfiles],
2593     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2594     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2595])
2596
2597# Do all the work for Automake.                             -*- Autoconf -*-
2598
2599# Copyright (C) 1996-2017 Free Software Foundation, Inc.
2600#
2601# This file is free software; the Free Software Foundation
2602# gives unlimited permission to copy and/or distribute it,
2603# with or without modifications, as long as this notice is preserved.
2604
2605# This macro actually does too much.  Some checks are only needed if
2606# your package does certain things.  But this isn't really a big deal.
2607
2608dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
2609m4_define([AC_PROG_CC],
2610m4_defn([AC_PROG_CC])
2611[_AM_PROG_CC_C_O
2612])
2613
2614# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2615# AM_INIT_AUTOMAKE([OPTIONS])
2616# -----------------------------------------------
2617# The call with PACKAGE and VERSION arguments is the old style
2618# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2619# and VERSION should now be passed to AC_INIT and removed from
2620# the call to AM_INIT_AUTOMAKE.
2621# We support both call styles for the transition.  After
2622# the next Automake release, Autoconf can make the AC_INIT
2623# arguments mandatory, and then we can depend on a new Autoconf
2624# release and drop the old call support.
2625AC_DEFUN([AM_INIT_AUTOMAKE],
2626[AC_PREREQ([2.65])dnl
2627dnl Autoconf wants to disallow AM_ names.  We explicitly allow
2628dnl the ones we care about.
2629m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2630AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2631AC_REQUIRE([AC_PROG_INSTALL])dnl
2632if test "`cd $srcdir && pwd`" != "`pwd`"; then
2633  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2634  # is not polluted with repeated "-I."
2635  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2636  # test to see if srcdir already configured
2637  if test -f $srcdir/config.status; then
2638    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2639  fi
2640fi
2641
2642# test whether we have cygpath
2643if test -z "$CYGPATH_W"; then
2644  if (cygpath --version) >/dev/null 2>/dev/null; then
2645    CYGPATH_W='cygpath -w'
2646  else
2647    CYGPATH_W=echo
2648  fi
2649fi
2650AC_SUBST([CYGPATH_W])
2651
2652# Define the identity of the package.
2653dnl Distinguish between old-style and new-style calls.
2654m4_ifval([$2],
2655[AC_DIAGNOSE([obsolete],
2656             [$0: two- and three-arguments forms are deprecated.])
2657m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2658 AC_SUBST([PACKAGE], [$1])dnl
2659 AC_SUBST([VERSION], [$2])],
2660[_AM_SET_OPTIONS([$1])dnl
2661dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2662m4_if(
2663  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
2664  [ok:ok],,
2665  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2666 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2667 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2668
2669_AM_IF_OPTION([no-define],,
2670[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2671 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2672
2673# Some tools Automake needs.
2674AC_REQUIRE([AM_SANITY_CHECK])dnl
2675AC_REQUIRE([AC_ARG_PROGRAM])dnl
2676AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2677AM_MISSING_PROG([AUTOCONF], [autoconf])
2678AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2679AM_MISSING_PROG([AUTOHEADER], [autoheader])
2680AM_MISSING_PROG([MAKEINFO], [makeinfo])
2681AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2682AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2683AC_REQUIRE([AC_PROG_MKDIR_P])dnl
2684# For better backward compatibility.  To be removed once Automake 1.9.x
2685# dies out for good.  For more background, see:
2686# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2687# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2688AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2689# We need awk for the "check" target (and possibly the TAP driver).  The
2690# system "awk" is bad on some platforms.
2691AC_REQUIRE([AC_PROG_AWK])dnl
2692AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2693AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2694_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2695	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2696			     [_AM_PROG_TAR([v7])])])
2697_AM_IF_OPTION([no-dependencies],,
2698[AC_PROVIDE_IFELSE([AC_PROG_CC],
2699		  [_AM_DEPENDENCIES([CC])],
2700		  [m4_define([AC_PROG_CC],
2701			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2702AC_PROVIDE_IFELSE([AC_PROG_CXX],
2703		  [_AM_DEPENDENCIES([CXX])],
2704		  [m4_define([AC_PROG_CXX],
2705			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2706AC_PROVIDE_IFELSE([AC_PROG_OBJC],
2707		  [_AM_DEPENDENCIES([OBJC])],
2708		  [m4_define([AC_PROG_OBJC],
2709			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2710AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2711		  [_AM_DEPENDENCIES([OBJCXX])],
2712		  [m4_define([AC_PROG_OBJCXX],
2713			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2714])
2715AC_REQUIRE([AM_SILENT_RULES])dnl
2716dnl The testsuite driver may need to know about EXEEXT, so add the
2717dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2718dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2719AC_CONFIG_COMMANDS_PRE(dnl
2720[m4_provide_if([_AM_COMPILER_EXEEXT],
2721  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2722
2723# POSIX will say in a future version that running "rm -f" with no argument
2724# is OK; and we want to be able to make that assumption in our Makefile
2725# recipes.  So use an aggressive probe to check that the usage we want is
2726# actually supported "in the wild" to an acceptable degree.
2727# See automake bug#10828.
2728# To make any issue more visible, cause the running configure to be aborted
2729# by default if the 'rm' program in use doesn't match our expectations; the
2730# user can still override this though.
2731if rm -f && rm -fr && rm -rf; then : OK; else
2732  cat >&2 <<'END'
2733Oops!
2734
2735Your 'rm' program seems unable to run without file operands specified
2736on the command line, even when the '-f' option is present.  This is contrary
2737to the behaviour of most rm programs out there, and not conforming with
2738the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2739
2740Please tell bug-automake@gnu.org about your system, including the value
2741of your $PATH and any error possibly output before this message.  This
2742can help us improve future automake versions.
2743
2744END
2745  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2746    echo 'Configuration will proceed anyway, since you have set the' >&2
2747    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2748    echo >&2
2749  else
2750    cat >&2 <<'END'
2751Aborting the configuration process, to ensure you take notice of the issue.
2752
2753You can download and install GNU coreutils to get an 'rm' implementation
2754that behaves properly: <http://www.gnu.org/software/coreutils/>.
2755
2756If you want to complete the configuration process using your problematic
2757'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2758to "yes", and re-run configure.
2759
2760END
2761    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2762  fi
2763fi
2764dnl The trailing newline in this macro's definition is deliberate, for
2765dnl backward compatibility and to allow trailing 'dnl'-style comments
2766dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
2767])
2768
2769dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2770dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2771dnl mangled by Autoconf and run in a shell conditional statement.
2772m4_define([_AC_COMPILER_EXEEXT],
2773m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2774
2775# When config.status generates a header, we must update the stamp-h file.
2776# This file resides in the same directory as the config header
2777# that is generated.  The stamp files are numbered to have different names.
2778
2779# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2780# loop where config.status creates the headers, so we can generate
2781# our stamp files there.
2782AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2783[# Compute $1's index in $config_headers.
2784_am_arg=$1
2785_am_stamp_count=1
2786for _am_header in $config_headers :; do
2787  case $_am_header in
2788    $_am_arg | $_am_arg:* )
2789      break ;;
2790    * )
2791      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2792  esac
2793done
2794echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2795
2796# Copyright (C) 2001-2017 Free Software Foundation, Inc.
2797#
2798# This file is free software; the Free Software Foundation
2799# gives unlimited permission to copy and/or distribute it,
2800# with or without modifications, as long as this notice is preserved.
2801
2802# AM_PROG_INSTALL_SH
2803# ------------------
2804# Define $install_sh.
2805AC_DEFUN([AM_PROG_INSTALL_SH],
2806[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2807if test x"${install_sh+set}" != xset; then
2808  case $am_aux_dir in
2809  *\ * | *\	*)
2810    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2811  *)
2812    install_sh="\${SHELL} $am_aux_dir/install-sh"
2813  esac
2814fi
2815AC_SUBST([install_sh])])
2816
2817# Copyright (C) 2003-2017 Free Software Foundation, Inc.
2818#
2819# This file is free software; the Free Software Foundation
2820# gives unlimited permission to copy and/or distribute it,
2821# with or without modifications, as long as this notice is preserved.
2822
2823# Check whether the underlying file-system supports filenames
2824# with a leading dot.  For instance MS-DOS doesn't.
2825AC_DEFUN([AM_SET_LEADING_DOT],
2826[rm -rf .tst 2>/dev/null
2827mkdir .tst 2>/dev/null
2828if test -d .tst; then
2829  am__leading_dot=.
2830else
2831  am__leading_dot=_
2832fi
2833rmdir .tst 2>/dev/null
2834AC_SUBST([am__leading_dot])])
2835
2836# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
2837# From Jim Meyering
2838
2839# Copyright (C) 1996-2017 Free Software Foundation, Inc.
2840#
2841# This file is free software; the Free Software Foundation
2842# gives unlimited permission to copy and/or distribute it,
2843# with or without modifications, as long as this notice is preserved.
2844
2845# AM_MAINTAINER_MODE([DEFAULT-MODE])
2846# ----------------------------------
2847# Control maintainer-specific portions of Makefiles.
2848# Default is to disable them, unless 'enable' is passed literally.
2849# For symmetry, 'disable' may be passed as well.  Anyway, the user
2850# can override the default with the --enable/--disable switch.
2851AC_DEFUN([AM_MAINTAINER_MODE],
2852[m4_case(m4_default([$1], [disable]),
2853       [enable], [m4_define([am_maintainer_other], [disable])],
2854       [disable], [m4_define([am_maintainer_other], [enable])],
2855       [m4_define([am_maintainer_other], [enable])
2856        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
2857AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2858  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
2859  AC_ARG_ENABLE([maintainer-mode],
2860    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
2861      am_maintainer_other[ make rules and dependencies not useful
2862      (and sometimes confusing) to the casual installer])],
2863    [USE_MAINTAINER_MODE=$enableval],
2864    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
2865  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
2866  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
2867  MAINT=$MAINTAINER_MODE_TRUE
2868  AC_SUBST([MAINT])dnl
2869]
2870)
2871
2872# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2873
2874# Copyright (C) 2001-2017 Free Software Foundation, Inc.
2875#
2876# This file is free software; the Free Software Foundation
2877# gives unlimited permission to copy and/or distribute it,
2878# with or without modifications, as long as this notice is preserved.
2879
2880# AM_MAKE_INCLUDE()
2881# -----------------
2882# Check to see how make treats includes.
2883AC_DEFUN([AM_MAKE_INCLUDE],
2884[am_make=${MAKE-make}
2885cat > confinc << 'END'
2886am__doit:
2887	@echo this is the am__doit target
2888.PHONY: am__doit
2889END
2890# If we don't find an include directive, just comment out the code.
2891AC_MSG_CHECKING([for style of include used by $am_make])
2892am__include="#"
2893am__quote=
2894_am_result=none
2895# First try GNU make style include.
2896echo "include confinc" > confmf
2897# Ignore all kinds of additional output from 'make'.
2898case `$am_make -s -f confmf 2> /dev/null` in #(
2899*the\ am__doit\ target*)
2900  am__include=include
2901  am__quote=
2902  _am_result=GNU
2903  ;;
2904esac
2905# Now try BSD make style include.
2906if test "$am__include" = "#"; then
2907   echo '.include "confinc"' > confmf
2908   case `$am_make -s -f confmf 2> /dev/null` in #(
2909   *the\ am__doit\ target*)
2910     am__include=.include
2911     am__quote="\""
2912     _am_result=BSD
2913     ;;
2914   esac
2915fi
2916AC_SUBST([am__include])
2917AC_SUBST([am__quote])
2918AC_MSG_RESULT([$_am_result])
2919rm -f confinc confmf
2920])
2921
2922# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2923
2924# Copyright (C) 1997-2017 Free Software Foundation, Inc.
2925#
2926# This file is free software; the Free Software Foundation
2927# gives unlimited permission to copy and/or distribute it,
2928# with or without modifications, as long as this notice is preserved.
2929
2930# AM_MISSING_PROG(NAME, PROGRAM)
2931# ------------------------------
2932AC_DEFUN([AM_MISSING_PROG],
2933[AC_REQUIRE([AM_MISSING_HAS_RUN])
2934$1=${$1-"${am_missing_run}$2"}
2935AC_SUBST($1)])
2936
2937# AM_MISSING_HAS_RUN
2938# ------------------
2939# Define MISSING if not defined so far and test if it is modern enough.
2940# If it is, set am_missing_run to use it, otherwise, to nothing.
2941AC_DEFUN([AM_MISSING_HAS_RUN],
2942[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2943AC_REQUIRE_AUX_FILE([missing])dnl
2944if test x"${MISSING+set}" != xset; then
2945  case $am_aux_dir in
2946  *\ * | *\	*)
2947    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2948  *)
2949    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2950  esac
2951fi
2952# Use eval to expand $SHELL
2953if eval "$MISSING --is-lightweight"; then
2954  am_missing_run="$MISSING "
2955else
2956  am_missing_run=
2957  AC_MSG_WARN(['missing' script is too old or missing])
2958fi
2959])
2960
2961#  -*- Autoconf -*-
2962# Obsolete and "removed" macros, that must however still report explicit
2963# error messages when used, to smooth transition.
2964#
2965# Copyright (C) 1996-2017 Free Software Foundation, Inc.
2966#
2967# This file is free software; the Free Software Foundation
2968# gives unlimited permission to copy and/or distribute it,
2969# with or without modifications, as long as this notice is preserved.
2970
2971AC_DEFUN([AM_CONFIG_HEADER],
2972[AC_DIAGNOSE([obsolete],
2973['$0': this macro is obsolete.
2974You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
2975AC_CONFIG_HEADERS($@)])
2976
2977AC_DEFUN([AM_PROG_CC_STDC],
2978[AC_PROG_CC
2979am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
2980AC_DIAGNOSE([obsolete],
2981['$0': this macro is obsolete.
2982You should simply use the 'AC][_PROG_CC' macro instead.
2983Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
2984but upon 'ac_cv_prog_cc_stdc'.])])
2985
2986AC_DEFUN([AM_C_PROTOTYPES],
2987         [AC_FATAL([automatic de-ANSI-fication support has been removed])])
2988AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
2989
2990# Helper functions for option handling.                     -*- Autoconf -*-
2991
2992# Copyright (C) 2001-2017 Free Software Foundation, Inc.
2993#
2994# This file is free software; the Free Software Foundation
2995# gives unlimited permission to copy and/or distribute it,
2996# with or without modifications, as long as this notice is preserved.
2997
2998# _AM_MANGLE_OPTION(NAME)
2999# -----------------------
3000AC_DEFUN([_AM_MANGLE_OPTION],
3001[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
3002
3003# _AM_SET_OPTION(NAME)
3004# --------------------
3005# Set option NAME.  Presently that only means defining a flag for this option.
3006AC_DEFUN([_AM_SET_OPTION],
3007[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3008
3009# _AM_SET_OPTIONS(OPTIONS)
3010# ------------------------
3011# OPTIONS is a space-separated list of Automake options.
3012AC_DEFUN([_AM_SET_OPTIONS],
3013[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3014
3015# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
3016# -------------------------------------------
3017# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
3018AC_DEFUN([_AM_IF_OPTION],
3019[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
3020
3021# Copyright (C) 1999-2017 Free Software Foundation, Inc.
3022#
3023# This file is free software; the Free Software Foundation
3024# gives unlimited permission to copy and/or distribute it,
3025# with or without modifications, as long as this notice is preserved.
3026
3027# _AM_PROG_CC_C_O
3028# ---------------
3029# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
3030# to automatically call this.
3031AC_DEFUN([_AM_PROG_CC_C_O],
3032[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3033AC_REQUIRE_AUX_FILE([compile])dnl
3034AC_LANG_PUSH([C])dnl
3035AC_CACHE_CHECK(
3036  [whether $CC understands -c and -o together],
3037  [am_cv_prog_cc_c_o],
3038  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
3039  # Make sure it works both with $CC and with simple cc.
3040  # Following AC_PROG_CC_C_O, we do the test twice because some
3041  # compilers refuse to overwrite an existing .o file with -o,
3042  # though they will create one.
3043  am_cv_prog_cc_c_o=yes
3044  for am_i in 1 2; do
3045    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
3046         && test -f conftest2.$ac_objext; then
3047      : OK
3048    else
3049      am_cv_prog_cc_c_o=no
3050      break
3051    fi
3052  done
3053  rm -f core conftest*
3054  unset am_i])
3055if test "$am_cv_prog_cc_c_o" != yes; then
3056   # Losing compiler, so override with the script.
3057   # FIXME: It is wrong to rewrite CC.
3058   # But if we don't then we get into trouble of one sort or another.
3059   # A longer-term fix would be to have automake use am__CC in this case,
3060   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
3061   CC="$am_aux_dir/compile $CC"
3062fi
3063AC_LANG_POP([C])])
3064
3065# For backward compatibility.
3066AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
3067
3068# Copyright (C) 2001-2017 Free Software Foundation, Inc.
3069#
3070# This file is free software; the Free Software Foundation
3071# gives unlimited permission to copy and/or distribute it,
3072# with or without modifications, as long as this notice is preserved.
3073
3074# AM_RUN_LOG(COMMAND)
3075# -------------------
3076# Run COMMAND, save the exit status in ac_status, and log it.
3077# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
3078AC_DEFUN([AM_RUN_LOG],
3079[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
3080   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
3081   ac_status=$?
3082   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
3083   (exit $ac_status); }])
3084
3085# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3086
3087# Copyright (C) 1996-2017 Free Software Foundation, Inc.
3088#
3089# This file is free software; the Free Software Foundation
3090# gives unlimited permission to copy and/or distribute it,
3091# with or without modifications, as long as this notice is preserved.
3092
3093# AM_SANITY_CHECK
3094# ---------------
3095AC_DEFUN([AM_SANITY_CHECK],
3096[AC_MSG_CHECKING([whether build environment is sane])
3097# Reject unsafe characters in $srcdir or the absolute working directory
3098# name.  Accept space and tab only in the latter.
3099am_lf='
3100'
3101case `pwd` in
3102  *[[\\\"\#\$\&\'\`$am_lf]]*)
3103    AC_MSG_ERROR([unsafe absolute working directory name]);;
3104esac
3105case $srcdir in
3106  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
3107    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
3108esac
3109
3110# Do 'set' in a subshell so we don't clobber the current shell's
3111# arguments.  Must try -L first in case configure is actually a
3112# symlink; some systems play weird games with the mod time of symlinks
3113# (eg FreeBSD returns the mod time of the symlink's containing
3114# directory).
3115if (
3116   am_has_slept=no
3117   for am_try in 1 2; do
3118     echo "timestamp, slept: $am_has_slept" > conftest.file
3119     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
3120     if test "$[*]" = "X"; then
3121	# -L didn't work.
3122	set X `ls -t "$srcdir/configure" conftest.file`
3123     fi
3124     if test "$[*]" != "X $srcdir/configure conftest.file" \
3125	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3126
3127	# If neither matched, then we have a broken ls.  This can happen
3128	# if, for instance, CONFIG_SHELL is bash and it inherits a
3129	# broken ls alias from the environment.  This has actually
3130	# happened.  Such a system could not be considered "sane".
3131	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
3132  alias in your environment])
3133     fi
3134     if test "$[2]" = conftest.file || test $am_try -eq 2; then
3135       break
3136     fi
3137     # Just in case.
3138     sleep 1
3139     am_has_slept=yes
3140   done
3141   test "$[2]" = conftest.file
3142   )
3143then
3144   # Ok.
3145   :
3146else
3147   AC_MSG_ERROR([newly created file is older than distributed files!
3148Check your system clock])
3149fi
3150AC_MSG_RESULT([yes])
3151# If we didn't sleep, we still need to ensure time stamps of config.status and
3152# generated files are strictly newer.
3153am_sleep_pid=
3154if grep 'slept: no' conftest.file >/dev/null 2>&1; then
3155  ( sleep 1 ) &
3156  am_sleep_pid=$!
3157fi
3158AC_CONFIG_COMMANDS_PRE(
3159  [AC_MSG_CHECKING([that generated files are newer than configure])
3160   if test -n "$am_sleep_pid"; then
3161     # Hide warnings about reused PIDs.
3162     wait $am_sleep_pid 2>/dev/null
3163   fi
3164   AC_MSG_RESULT([done])])
3165rm -f conftest.file
3166])
3167
3168# Copyright (C) 2009-2017 Free Software Foundation, Inc.
3169#
3170# This file is free software; the Free Software Foundation
3171# gives unlimited permission to copy and/or distribute it,
3172# with or without modifications, as long as this notice is preserved.
3173
3174# AM_SILENT_RULES([DEFAULT])
3175# --------------------------
3176# Enable less verbose build rules; with the default set to DEFAULT
3177# ("yes" being less verbose, "no" or empty being verbose).
3178AC_DEFUN([AM_SILENT_RULES],
3179[AC_ARG_ENABLE([silent-rules], [dnl
3180AS_HELP_STRING(
3181  [--enable-silent-rules],
3182  [less verbose build output (undo: "make V=1")])
3183AS_HELP_STRING(
3184  [--disable-silent-rules],
3185  [verbose build output (undo: "make V=0")])dnl
3186])
3187case $enable_silent_rules in @%:@ (((
3188  yes) AM_DEFAULT_VERBOSITY=0;;
3189   no) AM_DEFAULT_VERBOSITY=1;;
3190    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
3191esac
3192dnl
3193dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
3194dnl do not support nested variable expansions.
3195dnl See automake bug#9928 and bug#10237.
3196am_make=${MAKE-make}
3197AC_CACHE_CHECK([whether $am_make supports nested variables],
3198   [am_cv_make_support_nested_variables],
3199   [if AS_ECHO([['TRUE=$(BAR$(V))
3200BAR0=false
3201BAR1=true
3202V=1
3203am__doit:
3204	@$(TRUE)
3205.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
3206  am_cv_make_support_nested_variables=yes
3207else
3208  am_cv_make_support_nested_variables=no
3209fi])
3210if test $am_cv_make_support_nested_variables = yes; then
3211  dnl Using '$V' instead of '$(V)' breaks IRIX make.
3212  AM_V='$(V)'
3213  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3214else
3215  AM_V=$AM_DEFAULT_VERBOSITY
3216  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3217fi
3218AC_SUBST([AM_V])dnl
3219AM_SUBST_NOTMAKE([AM_V])dnl
3220AC_SUBST([AM_DEFAULT_V])dnl
3221AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3222AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3223AM_BACKSLASH='\'
3224AC_SUBST([AM_BACKSLASH])dnl
3225_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3226])
3227
3228# Copyright (C) 2001-2017 Free Software Foundation, Inc.
3229#
3230# This file is free software; the Free Software Foundation
3231# gives unlimited permission to copy and/or distribute it,
3232# with or without modifications, as long as this notice is preserved.
3233
3234# AM_PROG_INSTALL_STRIP
3235# ---------------------
3236# One issue with vendor 'install' (even GNU) is that you can't
3237# specify the program used to strip binaries.  This is especially
3238# annoying in cross-compiling environments, where the build's strip
3239# is unlikely to handle the host's binaries.
3240# Fortunately install-sh will honor a STRIPPROG variable, so we
3241# always use install-sh in "make install-strip", and initialize
3242# STRIPPROG with the value of the STRIP variable (set by the user).
3243AC_DEFUN([AM_PROG_INSTALL_STRIP],
3244[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3245# Installed binaries are usually stripped using 'strip' when the user
3246# run "make install-strip".  However 'strip' might not be the right
3247# tool to use in cross-compilation environments, therefore Automake
3248# will honor the 'STRIP' environment variable to overrule this program.
3249dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3250if test "$cross_compiling" != no; then
3251  AC_CHECK_TOOL([STRIP], [strip], :)
3252fi
3253INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3254AC_SUBST([INSTALL_STRIP_PROGRAM])])
3255
3256# Copyright (C) 2006-2017 Free Software Foundation, Inc.
3257#
3258# This file is free software; the Free Software Foundation
3259# gives unlimited permission to copy and/or distribute it,
3260# with or without modifications, as long as this notice is preserved.
3261
3262# _AM_SUBST_NOTMAKE(VARIABLE)
3263# ---------------------------
3264# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3265# This macro is traced by Automake.
3266AC_DEFUN([_AM_SUBST_NOTMAKE])
3267
3268# AM_SUBST_NOTMAKE(VARIABLE)
3269# --------------------------
3270# Public sister of _AM_SUBST_NOTMAKE.
3271AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3272
3273# Check how to create a tarball.                            -*- Autoconf -*-
3274
3275# Copyright (C) 2004-2017 Free Software Foundation, Inc.
3276#
3277# This file is free software; the Free Software Foundation
3278# gives unlimited permission to copy and/or distribute it,
3279# with or without modifications, as long as this notice is preserved.
3280
3281# _AM_PROG_TAR(FORMAT)
3282# --------------------
3283# Check how to create a tarball in format FORMAT.
3284# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3285#
3286# Substitute a variable $(am__tar) that is a command
3287# writing to stdout a FORMAT-tarball containing the directory
3288# $tardir.
3289#     tardir=directory && $(am__tar) > result.tar
3290#
3291# Substitute a variable $(am__untar) that extract such
3292# a tarball read from stdin.
3293#     $(am__untar) < result.tar
3294#
3295AC_DEFUN([_AM_PROG_TAR],
3296[# Always define AMTAR for backward compatibility.  Yes, it's still used
3297# in the wild :-(  We should find a proper way to deprecate it ...
3298AC_SUBST([AMTAR], ['$${TAR-tar}'])
3299
3300# We'll loop over all known methods to create a tar archive until one works.
3301_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3302
3303m4_if([$1], [v7],
3304  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3305
3306  [m4_case([$1],
3307    [ustar],
3308     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
3309      # There is notably a 21 bits limit for the UID and the GID.  In fact,
3310      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
3311      # and bug#13588).
3312      am_max_uid=2097151 # 2^21 - 1
3313      am_max_gid=$am_max_uid
3314      # The $UID and $GID variables are not portable, so we need to resort
3315      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
3316      # below are definitely unexpected, so allow the users to see them
3317      # (that is, avoid stderr redirection).
3318      am_uid=`id -u || echo unknown`
3319      am_gid=`id -g || echo unknown`
3320      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
3321      if test $am_uid -le $am_max_uid; then
3322         AC_MSG_RESULT([yes])
3323      else
3324         AC_MSG_RESULT([no])
3325         _am_tools=none
3326      fi
3327      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
3328      if test $am_gid -le $am_max_gid; then
3329         AC_MSG_RESULT([yes])
3330      else
3331        AC_MSG_RESULT([no])
3332        _am_tools=none
3333      fi],
3334
3335  [pax],
3336    [],
3337
3338  [m4_fatal([Unknown tar format])])
3339
3340  AC_MSG_CHECKING([how to create a $1 tar archive])
3341
3342  # Go ahead even if we have the value already cached.  We do so because we
3343  # need to set the values for the 'am__tar' and 'am__untar' variables.
3344  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3345
3346  for _am_tool in $_am_tools; do
3347    case $_am_tool in
3348    gnutar)
3349      for _am_tar in tar gnutar gtar; do
3350        AM_RUN_LOG([$_am_tar --version]) && break
3351      done
3352      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3353      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3354      am__untar="$_am_tar -xf -"
3355      ;;
3356    plaintar)
3357      # Must skip GNU tar: if it does not support --format= it doesn't create
3358      # ustar tarball either.
3359      (tar --version) >/dev/null 2>&1 && continue
3360      am__tar='tar chf - "$$tardir"'
3361      am__tar_='tar chf - "$tardir"'
3362      am__untar='tar xf -'
3363      ;;
3364    pax)
3365      am__tar='pax -L -x $1 -w "$$tardir"'
3366      am__tar_='pax -L -x $1 -w "$tardir"'
3367      am__untar='pax -r'
3368      ;;
3369    cpio)
3370      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3371      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3372      am__untar='cpio -i -H $1 -d'
3373      ;;
3374    none)
3375      am__tar=false
3376      am__tar_=false
3377      am__untar=false
3378      ;;
3379    esac
3380
3381    # If the value was cached, stop now.  We just wanted to have am__tar
3382    # and am__untar set.
3383    test -n "${am_cv_prog_tar_$1}" && break
3384
3385    # tar/untar a dummy directory, and stop if the command works.
3386    rm -rf conftest.dir
3387    mkdir conftest.dir
3388    echo GrepMe > conftest.dir/file
3389    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3390    rm -rf conftest.dir
3391    if test -s conftest.tar; then
3392      AM_RUN_LOG([$am__untar <conftest.tar])
3393      AM_RUN_LOG([cat conftest.dir/file])
3394      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3395    fi
3396  done
3397  rm -rf conftest.dir
3398
3399  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3400  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3401
3402AC_SUBST([am__tar])
3403AC_SUBST([am__untar])
3404]) # _AM_PROG_TAR
3405
3406m4_include([m4/intltool.m4])
3407m4_include([m4/libtool.m4])
3408m4_include([m4/ltoptions.m4])
3409m4_include([m4/ltsugar.m4])
3410m4_include([m4/ltversion.m4])
3411m4_include([m4/lt~obsolete.m4])
3412