aclocal.m4 revision 688b3aec
1688b3aecSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
25dd5f640Smrg
3688b3aecSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4e9554658Smrg
5e9554658Smrg# This file is free software; the Free Software Foundation
6e9554658Smrg# gives unlimited permission to copy and/or distribute it,
7e9554658Smrg# with or without modifications, as long as this notice is preserved.
8e9554658Smrg
9e9554658Smrg# This program is distributed in the hope that it will be useful,
10e9554658Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11e9554658Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12e9554658Smrg# PARTICULAR PURPOSE.
13e9554658Smrg
145dd5f640Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15c2b339b4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16c2b339b4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17688b3aecSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18688b3aecSmrg[m4_warning([this file was generated for autoconf 2.69.
19c2b339b4SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20c2b339b4SmrgIf you have problems, you may need to regenerate the build system entirely.
215dd5f640SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22e9554658Smrg
23688b3aecSmrg# iconv.m4 serial 19 (gettext-0.18.2)
24688b3aecSmrgdnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc.
25688b3aecSmrgdnl This file is free software; the Free Software Foundation
26688b3aecSmrgdnl gives unlimited permission to copy and/or distribute it,
27688b3aecSmrgdnl with or without modifications, as long as this notice is preserved.
28e9554658Smrg
29688b3aecSmrgdnl From Bruno Haible.
30e9554658Smrg
31688b3aecSmrgAC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
32688b3aecSmrg[
33688b3aecSmrg  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
34688b3aecSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
35688b3aecSmrg  AC_REQUIRE([AC_LIB_RPATH])
36e9554658Smrg
37688b3aecSmrg  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
38688b3aecSmrg  dnl accordingly.
39688b3aecSmrg  AC_LIB_LINKFLAGS_BODY([iconv])
40688b3aecSmrg])
41e9554658Smrg
42688b3aecSmrgAC_DEFUN([AM_ICONV_LINK],
43688b3aecSmrg[
44688b3aecSmrg  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
45688b3aecSmrg  dnl those with the standalone portable GNU libiconv installed).
46688b3aecSmrg  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
47e9554658Smrg
48688b3aecSmrg  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
49688b3aecSmrg  dnl accordingly.
50688b3aecSmrg  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
51e9554658Smrg
52688b3aecSmrg  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
53688b3aecSmrg  dnl because if the user has installed libiconv and not disabled its use
54688b3aecSmrg  dnl via --without-libiconv-prefix, he wants to use it. The first
55688b3aecSmrg  dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
56688b3aecSmrg  am_save_CPPFLAGS="$CPPFLAGS"
57688b3aecSmrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
58e9554658Smrg
59688b3aecSmrg  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
60688b3aecSmrg    am_cv_func_iconv="no, consider installing GNU libiconv"
61688b3aecSmrg    am_cv_lib_iconv=no
62688b3aecSmrg    AC_LINK_IFELSE(
63688b3aecSmrg      [AC_LANG_PROGRAM(
64688b3aecSmrg         [[
65688b3aecSmrg#include <stdlib.h>
66688b3aecSmrg#include <iconv.h>
67688b3aecSmrg         ]],
68688b3aecSmrg         [[iconv_t cd = iconv_open("","");
69688b3aecSmrg           iconv(cd,NULL,NULL,NULL,NULL);
70688b3aecSmrg           iconv_close(cd);]])],
71688b3aecSmrg      [am_cv_func_iconv=yes])
72688b3aecSmrg    if test "$am_cv_func_iconv" != yes; then
73688b3aecSmrg      am_save_LIBS="$LIBS"
74688b3aecSmrg      LIBS="$LIBS $LIBICONV"
75688b3aecSmrg      AC_LINK_IFELSE(
76688b3aecSmrg        [AC_LANG_PROGRAM(
77688b3aecSmrg           [[
78688b3aecSmrg#include <stdlib.h>
79688b3aecSmrg#include <iconv.h>
80688b3aecSmrg           ]],
81688b3aecSmrg           [[iconv_t cd = iconv_open("","");
82688b3aecSmrg             iconv(cd,NULL,NULL,NULL,NULL);
83688b3aecSmrg             iconv_close(cd);]])],
84688b3aecSmrg        [am_cv_lib_iconv=yes]
85688b3aecSmrg        [am_cv_func_iconv=yes])
86688b3aecSmrg      LIBS="$am_save_LIBS"
87688b3aecSmrg    fi
88688b3aecSmrg  ])
89688b3aecSmrg  if test "$am_cv_func_iconv" = yes; then
90688b3aecSmrg    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
91688b3aecSmrg      dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
92688b3aecSmrg      dnl Solaris 10.
93688b3aecSmrg      am_save_LIBS="$LIBS"
94688b3aecSmrg      if test $am_cv_lib_iconv = yes; then
95688b3aecSmrg        LIBS="$LIBS $LIBICONV"
96688b3aecSmrg      fi
97688b3aecSmrg      am_cv_func_iconv_works=no
98688b3aecSmrg      for ac_iconv_const in '' 'const'; do
99688b3aecSmrg        AC_RUN_IFELSE(
100688b3aecSmrg          [AC_LANG_PROGRAM(
101688b3aecSmrg             [[
102688b3aecSmrg#include <iconv.h>
103688b3aecSmrg#include <string.h>
104e9554658Smrg
105688b3aecSmrg#ifndef ICONV_CONST
106688b3aecSmrg# define ICONV_CONST $ac_iconv_const
107688b3aecSmrg#endif
108688b3aecSmrg             ]],
109688b3aecSmrg             [[int result = 0;
110688b3aecSmrg  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
111688b3aecSmrg     returns.  */
112688b3aecSmrg  {
113688b3aecSmrg    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
114688b3aecSmrg    if (cd_utf8_to_88591 != (iconv_t)(-1))
115688b3aecSmrg      {
116688b3aecSmrg        static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
117688b3aecSmrg        char buf[10];
118688b3aecSmrg        ICONV_CONST char *inptr = input;
119688b3aecSmrg        size_t inbytesleft = strlen (input);
120688b3aecSmrg        char *outptr = buf;
121688b3aecSmrg        size_t outbytesleft = sizeof (buf);
122688b3aecSmrg        size_t res = iconv (cd_utf8_to_88591,
123688b3aecSmrg                            &inptr, &inbytesleft,
124688b3aecSmrg                            &outptr, &outbytesleft);
125688b3aecSmrg        if (res == 0)
126688b3aecSmrg          result |= 1;
127688b3aecSmrg        iconv_close (cd_utf8_to_88591);
128688b3aecSmrg      }
129688b3aecSmrg  }
130688b3aecSmrg  /* Test against Solaris 10 bug: Failures are not distinguishable from
131688b3aecSmrg     successful returns.  */
132688b3aecSmrg  {
133688b3aecSmrg    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
134688b3aecSmrg    if (cd_ascii_to_88591 != (iconv_t)(-1))
135688b3aecSmrg      {
136688b3aecSmrg        static ICONV_CONST char input[] = "\263";
137688b3aecSmrg        char buf[10];
138688b3aecSmrg        ICONV_CONST char *inptr = input;
139688b3aecSmrg        size_t inbytesleft = strlen (input);
140688b3aecSmrg        char *outptr = buf;
141688b3aecSmrg        size_t outbytesleft = sizeof (buf);
142688b3aecSmrg        size_t res = iconv (cd_ascii_to_88591,
143688b3aecSmrg                            &inptr, &inbytesleft,
144688b3aecSmrg                            &outptr, &outbytesleft);
145688b3aecSmrg        if (res == 0)
146688b3aecSmrg          result |= 2;
147688b3aecSmrg        iconv_close (cd_ascii_to_88591);
148688b3aecSmrg      }
149688b3aecSmrg  }
150688b3aecSmrg  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
151688b3aecSmrg  {
152688b3aecSmrg    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
153688b3aecSmrg    if (cd_88591_to_utf8 != (iconv_t)(-1))
154688b3aecSmrg      {
155688b3aecSmrg        static ICONV_CONST char input[] = "\304";
156688b3aecSmrg        static char buf[2] = { (char)0xDE, (char)0xAD };
157688b3aecSmrg        ICONV_CONST char *inptr = input;
158688b3aecSmrg        size_t inbytesleft = 1;
159688b3aecSmrg        char *outptr = buf;
160688b3aecSmrg        size_t outbytesleft = 1;
161688b3aecSmrg        size_t res = iconv (cd_88591_to_utf8,
162688b3aecSmrg                            &inptr, &inbytesleft,
163688b3aecSmrg                            &outptr, &outbytesleft);
164688b3aecSmrg        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
165688b3aecSmrg          result |= 4;
166688b3aecSmrg        iconv_close (cd_88591_to_utf8);
167688b3aecSmrg      }
168688b3aecSmrg  }
169688b3aecSmrg#if 0 /* This bug could be worked around by the caller.  */
170688b3aecSmrg  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
171688b3aecSmrg  {
172688b3aecSmrg    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
173688b3aecSmrg    if (cd_88591_to_utf8 != (iconv_t)(-1))
174688b3aecSmrg      {
175688b3aecSmrg        static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
176688b3aecSmrg        char buf[50];
177688b3aecSmrg        ICONV_CONST char *inptr = input;
178688b3aecSmrg        size_t inbytesleft = strlen (input);
179688b3aecSmrg        char *outptr = buf;
180688b3aecSmrg        size_t outbytesleft = sizeof (buf);
181688b3aecSmrg        size_t res = iconv (cd_88591_to_utf8,
182688b3aecSmrg                            &inptr, &inbytesleft,
183688b3aecSmrg                            &outptr, &outbytesleft);
184688b3aecSmrg        if ((int)res > 0)
185688b3aecSmrg          result |= 8;
186688b3aecSmrg        iconv_close (cd_88591_to_utf8);
187688b3aecSmrg      }
188688b3aecSmrg  }
189688b3aecSmrg#endif
190688b3aecSmrg  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
191688b3aecSmrg     provided.  */
192688b3aecSmrg  if (/* Try standardized names.  */
193688b3aecSmrg      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
194688b3aecSmrg      /* Try IRIX, OSF/1 names.  */
195688b3aecSmrg      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
196688b3aecSmrg      /* Try AIX names.  */
197688b3aecSmrg      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
198688b3aecSmrg      /* Try HP-UX names.  */
199688b3aecSmrg      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
200688b3aecSmrg    result |= 16;
201688b3aecSmrg  return result;
202688b3aecSmrg]])],
203688b3aecSmrg          [am_cv_func_iconv_works=yes], ,
204688b3aecSmrg          [case "$host_os" in
205688b3aecSmrg             aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
206688b3aecSmrg             *)            am_cv_func_iconv_works="guessing yes" ;;
207688b3aecSmrg           esac])
208688b3aecSmrg        test "$am_cv_func_iconv_works" = no || break
209688b3aecSmrg      done
210688b3aecSmrg      LIBS="$am_save_LIBS"
211688b3aecSmrg    ])
212688b3aecSmrg    case "$am_cv_func_iconv_works" in
213688b3aecSmrg      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
214688b3aecSmrg      *)   am_func_iconv=yes ;;
215688b3aecSmrg    esac
216688b3aecSmrg  else
217688b3aecSmrg    am_func_iconv=no am_cv_lib_iconv=no
218688b3aecSmrg  fi
219688b3aecSmrg  if test "$am_func_iconv" = yes; then
220688b3aecSmrg    AC_DEFINE([HAVE_ICONV], [1],
221688b3aecSmrg      [Define if you have the iconv() function and it works.])
222688b3aecSmrg  fi
223688b3aecSmrg  if test "$am_cv_lib_iconv" = yes; then
224688b3aecSmrg    AC_MSG_CHECKING([how to link with libiconv])
225688b3aecSmrg    AC_MSG_RESULT([$LIBICONV])
226688b3aecSmrg  else
227688b3aecSmrg    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
228688b3aecSmrg    dnl either.
229688b3aecSmrg    CPPFLAGS="$am_save_CPPFLAGS"
230688b3aecSmrg    LIBICONV=
231688b3aecSmrg    LTLIBICONV=
232688b3aecSmrg  fi
233688b3aecSmrg  AC_SUBST([LIBICONV])
234688b3aecSmrg  AC_SUBST([LTLIBICONV])
235688b3aecSmrg])
236e9554658Smrg
237688b3aecSmrgdnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
238688b3aecSmrgdnl avoid warnings like
239688b3aecSmrgdnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
240688b3aecSmrgdnl This is tricky because of the way 'aclocal' is implemented:
241688b3aecSmrgdnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
242688b3aecSmrgdnl   Otherwise aclocal's initial scan pass would miss the macro definition.
243688b3aecSmrgdnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
244688b3aecSmrgdnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
245688b3aecSmrgdnl   warnings.
246688b3aecSmrgm4_define([gl_iconv_AC_DEFUN],
247688b3aecSmrg  m4_version_prereq([2.64],
248688b3aecSmrg    [[AC_DEFUN_ONCE(
249688b3aecSmrg        [$1], [$2])]],
250688b3aecSmrg    [m4_ifdef([gl_00GNULIB],
251688b3aecSmrg       [[AC_DEFUN_ONCE(
252688b3aecSmrg           [$1], [$2])]],
253688b3aecSmrg       [[AC_DEFUN(
254688b3aecSmrg           [$1], [$2])]])]))
255688b3aecSmrggl_iconv_AC_DEFUN([AM_ICONV],
256688b3aecSmrg[
257688b3aecSmrg  AM_ICONV_LINK
258688b3aecSmrg  if test "$am_cv_func_iconv" = yes; then
259688b3aecSmrg    AC_MSG_CHECKING([for iconv declaration])
260688b3aecSmrg    AC_CACHE_VAL([am_cv_proto_iconv], [
261688b3aecSmrg      AC_COMPILE_IFELSE(
262688b3aecSmrg        [AC_LANG_PROGRAM(
263688b3aecSmrg           [[
264688b3aecSmrg#include <stdlib.h>
265688b3aecSmrg#include <iconv.h>
266688b3aecSmrgextern
267688b3aecSmrg#ifdef __cplusplus
268688b3aecSmrg"C"
269688b3aecSmrg#endif
270688b3aecSmrg#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
271688b3aecSmrgsize_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
272688b3aecSmrg#else
273688b3aecSmrgsize_t iconv();
274688b3aecSmrg#endif
275688b3aecSmrg           ]],
276688b3aecSmrg           [[]])],
277688b3aecSmrg        [am_cv_proto_iconv_arg1=""],
278688b3aecSmrg        [am_cv_proto_iconv_arg1="const"])
279688b3aecSmrg      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);"])
280688b3aecSmrg    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
281688b3aecSmrg    AC_MSG_RESULT([
282688b3aecSmrg         $am_cv_proto_iconv])
283688b3aecSmrg    AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
284688b3aecSmrg      [Define as const if the declaration of iconv() needs const.])
285688b3aecSmrg    dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
286688b3aecSmrg    m4_ifdef([gl_ICONV_H_DEFAULTS],
287688b3aecSmrg      [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
288688b3aecSmrg       if test -n "$am_cv_proto_iconv_arg1"; then
289688b3aecSmrg         ICONV_CONST="const"
290688b3aecSmrg       fi
291688b3aecSmrg      ])
292688b3aecSmrg  fi
293688b3aecSmrg])
294e9554658Smrg
295688b3aecSmrg# lib-ld.m4 serial 6
296688b3aecSmrgdnl Copyright (C) 1996-2003, 2009-2016 Free Software Foundation, Inc.
297688b3aecSmrgdnl This file is free software; the Free Software Foundation
298688b3aecSmrgdnl gives unlimited permission to copy and/or distribute it,
299688b3aecSmrgdnl with or without modifications, as long as this notice is preserved.
300e9554658Smrg
301688b3aecSmrgdnl Subroutines of libtool.m4,
302688b3aecSmrgdnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
303688b3aecSmrgdnl collision with libtool.m4.
304e9554658Smrg
305688b3aecSmrgdnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
306688b3aecSmrgAC_DEFUN([AC_LIB_PROG_LD_GNU],
307688b3aecSmrg[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
308688b3aecSmrg[# I'd rather use --version here, but apparently some GNU lds only accept -v.
309688b3aecSmrgcase `$LD -v 2>&1 </dev/null` in
310688b3aecSmrg*GNU* | *'with BFD'*)
311688b3aecSmrg  acl_cv_prog_gnu_ld=yes
312688b3aecSmrg  ;;
313688b3aecSmrg*)
314688b3aecSmrg  acl_cv_prog_gnu_ld=no
315688b3aecSmrg  ;;
316688b3aecSmrgesac])
317688b3aecSmrgwith_gnu_ld=$acl_cv_prog_gnu_ld
318688b3aecSmrg])
319e9554658Smrg
320688b3aecSmrgdnl From libtool-2.4. Sets the variable LD.
321688b3aecSmrgAC_DEFUN([AC_LIB_PROG_LD],
322688b3aecSmrg[AC_REQUIRE([AC_PROG_CC])dnl
323688b3aecSmrgAC_REQUIRE([AC_CANONICAL_HOST])dnl
324e9554658Smrg
325688b3aecSmrgAC_ARG_WITH([gnu-ld],
326688b3aecSmrg    [AS_HELP_STRING([--with-gnu-ld],
327688b3aecSmrg        [assume the C compiler uses GNU ld [default=no]])],
328688b3aecSmrg    [test "$withval" = no || with_gnu_ld=yes],
329688b3aecSmrg    [with_gnu_ld=no])dnl
330e9554658Smrg
331688b3aecSmrg# Prepare PATH_SEPARATOR.
332688b3aecSmrg# The user is always right.
333688b3aecSmrgif test "${PATH_SEPARATOR+set}" != set; then
334688b3aecSmrg  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
335688b3aecSmrg  # contains only /bin. Note that ksh looks also at the FPATH variable,
336688b3aecSmrg  # so we have to set that as well for the test.
337688b3aecSmrg  PATH_SEPARATOR=:
338688b3aecSmrg  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
339688b3aecSmrg    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
340688b3aecSmrg           || PATH_SEPARATOR=';'
341688b3aecSmrg       }
342688b3aecSmrgfi
343e9554658Smrg
344688b3aecSmrgac_prog=ld
345688b3aecSmrgif test "$GCC" = yes; then
346688b3aecSmrg  # Check if gcc -print-prog-name=ld gives a path.
347688b3aecSmrg  AC_MSG_CHECKING([for ld used by $CC])
348688b3aecSmrg  case $host in
349688b3aecSmrg  *-*-mingw*)
350688b3aecSmrg    # gcc leaves a trailing carriage return which upsets mingw
351688b3aecSmrg    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
352688b3aecSmrg  *)
353688b3aecSmrg    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
354688b3aecSmrg  esac
355688b3aecSmrg  case $ac_prog in
356688b3aecSmrg    # Accept absolute paths.
357688b3aecSmrg    [[\\/]]* | ?:[[\\/]]*)
358688b3aecSmrg      re_direlt='/[[^/]][[^/]]*/\.\./'
359688b3aecSmrg      # Canonicalize the pathname of ld
360688b3aecSmrg      ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
361688b3aecSmrg      while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
362688b3aecSmrg        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
363688b3aecSmrg      done
364688b3aecSmrg      test -z "$LD" && LD="$ac_prog"
365c2b339b4Smrg      ;;
366688b3aecSmrg  "")
367688b3aecSmrg    # If it fails, then pretend we aren't using GCC.
368688b3aecSmrg    ac_prog=ld
369688b3aecSmrg    ;;
370688b3aecSmrg  *)
371688b3aecSmrg    # If it is relative, then search for the first ld in PATH.
372688b3aecSmrg    with_gnu_ld=unknown
373688b3aecSmrg    ;;
374688b3aecSmrg  esac
375688b3aecSmrgelif test "$with_gnu_ld" = yes; then
376688b3aecSmrg  AC_MSG_CHECKING([for GNU ld])
377688b3aecSmrgelse
378688b3aecSmrg  AC_MSG_CHECKING([for non-GNU ld])
379688b3aecSmrgfi
380688b3aecSmrgAC_CACHE_VAL([acl_cv_path_LD],
381688b3aecSmrg[if test -z "$LD"; then
382688b3aecSmrg  acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
383688b3aecSmrg  for ac_dir in $PATH; do
384688b3aecSmrg    IFS="$acl_save_ifs"
385688b3aecSmrg    test -z "$ac_dir" && ac_dir=.
386688b3aecSmrg    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
387688b3aecSmrg      acl_cv_path_LD="$ac_dir/$ac_prog"
388688b3aecSmrg      # Check to see if the program is GNU ld.  I'd rather use --version,
389688b3aecSmrg      # but apparently some variants of GNU ld only accept -v.
390688b3aecSmrg      # Break only if it was the GNU/non-GNU ld that we prefer.
391688b3aecSmrg      case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
392688b3aecSmrg      *GNU* | *'with BFD'*)
393688b3aecSmrg        test "$with_gnu_ld" != no && break
394688b3aecSmrg        ;;
395688b3aecSmrg      *)
396688b3aecSmrg        test "$with_gnu_ld" != yes && break
397688b3aecSmrg        ;;
398688b3aecSmrg      esac
399e9554658Smrg    fi
400e9554658Smrg  done
401688b3aecSmrg  IFS="$acl_save_ifs"
402e9554658Smrgelse
403688b3aecSmrg  acl_cv_path_LD="$LD" # Let the user override the test with a path.
404688b3aecSmrgfi])
405688b3aecSmrgLD="$acl_cv_path_LD"
406688b3aecSmrgif test -n "$LD"; then
407688b3aecSmrg  AC_MSG_RESULT([$LD])
408688b3aecSmrgelse
409688b3aecSmrg  AC_MSG_RESULT([no])
410e9554658Smrgfi
411688b3aecSmrgtest -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
412688b3aecSmrgAC_LIB_PROG_LD_GNU
413e9554658Smrg])
414e9554658Smrg
415688b3aecSmrg# lib-link.m4 serial 26 (gettext-0.18.2)
416688b3aecSmrgdnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
417688b3aecSmrgdnl This file is free software; the Free Software Foundation
418688b3aecSmrgdnl gives unlimited permission to copy and/or distribute it,
419688b3aecSmrgdnl with or without modifications, as long as this notice is preserved.
420e9554658Smrg
421688b3aecSmrgdnl From Bruno Haible.
422e9554658Smrg
423688b3aecSmrgAC_PREREQ([2.54])
424e9554658Smrg
425688b3aecSmrgdnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
426688b3aecSmrgdnl the libraries corresponding to explicit and implicit dependencies.
427688b3aecSmrgdnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
428688b3aecSmrgdnl augments the CPPFLAGS variable.
429688b3aecSmrgdnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
430688b3aecSmrgdnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
431688b3aecSmrgAC_DEFUN([AC_LIB_LINKFLAGS],
432688b3aecSmrg[
433688b3aecSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
434688b3aecSmrg  AC_REQUIRE([AC_LIB_RPATH])
435688b3aecSmrg  pushdef([Name],[m4_translit([$1],[./+-], [____])])
436688b3aecSmrg  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
437688b3aecSmrg                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
438688b3aecSmrg  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
439688b3aecSmrg    AC_LIB_LINKFLAGS_BODY([$1], [$2])
440688b3aecSmrg    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
441688b3aecSmrg    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
442688b3aecSmrg    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
443688b3aecSmrg    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
444688b3aecSmrg  ])
445688b3aecSmrg  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
446688b3aecSmrg  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
447688b3aecSmrg  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
448688b3aecSmrg  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
449688b3aecSmrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
450688b3aecSmrg  AC_SUBST([LIB]NAME)
451688b3aecSmrg  AC_SUBST([LTLIB]NAME)
452688b3aecSmrg  AC_SUBST([LIB]NAME[_PREFIX])
453688b3aecSmrg  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
454688b3aecSmrg  dnl results of this search when this library appears as a dependency.
455688b3aecSmrg  HAVE_LIB[]NAME=yes
456688b3aecSmrg  popdef([NAME])
457688b3aecSmrg  popdef([Name])
458e9554658Smrg])
459e9554658Smrg
460688b3aecSmrgdnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
461688b3aecSmrgdnl searches for libname and the libraries corresponding to explicit and
462688b3aecSmrgdnl implicit dependencies, together with the specified include files and
463688b3aecSmrgdnl the ability to compile and link the specified testcode. The missing-message
464688b3aecSmrgdnl defaults to 'no' and may contain additional hints for the user.
465688b3aecSmrgdnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
466688b3aecSmrgdnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
467688b3aecSmrgdnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
468688b3aecSmrgdnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
469688b3aecSmrgdnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
470688b3aecSmrgdnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
471688b3aecSmrgAC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
472688b3aecSmrg[
473688b3aecSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
474688b3aecSmrg  AC_REQUIRE([AC_LIB_RPATH])
475688b3aecSmrg  pushdef([Name],[m4_translit([$1],[./+-], [____])])
476688b3aecSmrg  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
477688b3aecSmrg                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
478e9554658Smrg
479688b3aecSmrg  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
480688b3aecSmrg  dnl accordingly.
481688b3aecSmrg  AC_LIB_LINKFLAGS_BODY([$1], [$2])
482e9554658Smrg
483688b3aecSmrg  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
484688b3aecSmrg  dnl because if the user has installed lib[]Name and not disabled its use
485688b3aecSmrg  dnl via --without-lib[]Name-prefix, he wants to use it.
486688b3aecSmrg  ac_save_CPPFLAGS="$CPPFLAGS"
487688b3aecSmrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
488e9554658Smrg
489688b3aecSmrg  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
490688b3aecSmrg    ac_save_LIBS="$LIBS"
491688b3aecSmrg    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
492688b3aecSmrg    dnl because these -l options might require -L options that are present in
493688b3aecSmrg    dnl LIBS. -l options benefit only from the -L options listed before it.
494688b3aecSmrg    dnl Otherwise, add it to the front of LIBS, because it may be a static
495688b3aecSmrg    dnl library that depends on another static library that is present in LIBS.
496688b3aecSmrg    dnl Static libraries benefit only from the static libraries listed after
497688b3aecSmrg    dnl it.
498688b3aecSmrg    case " $LIB[]NAME" in
499688b3aecSmrg      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
500688b3aecSmrg      *)       LIBS="$LIB[]NAME $LIBS" ;;
501688b3aecSmrg    esac
502688b3aecSmrg    AC_LINK_IFELSE(
503688b3aecSmrg      [AC_LANG_PROGRAM([[$3]], [[$4]])],
504688b3aecSmrg      [ac_cv_lib[]Name=yes],
505688b3aecSmrg      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
506688b3aecSmrg    LIBS="$ac_save_LIBS"
507688b3aecSmrg  ])
508688b3aecSmrg  if test "$ac_cv_lib[]Name" = yes; then
509688b3aecSmrg    HAVE_LIB[]NAME=yes
510688b3aecSmrg    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
511688b3aecSmrg    AC_MSG_CHECKING([how to link with lib[]$1])
512688b3aecSmrg    AC_MSG_RESULT([$LIB[]NAME])
513e9554658Smrg  else
514688b3aecSmrg    HAVE_LIB[]NAME=no
515688b3aecSmrg    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
516688b3aecSmrg    dnl $INC[]NAME either.
517688b3aecSmrg    CPPFLAGS="$ac_save_CPPFLAGS"
518688b3aecSmrg    LIB[]NAME=
519688b3aecSmrg    LTLIB[]NAME=
520688b3aecSmrg    LIB[]NAME[]_PREFIX=
521e9554658Smrg  fi
522688b3aecSmrg  AC_SUBST([HAVE_LIB]NAME)
523688b3aecSmrg  AC_SUBST([LIB]NAME)
524688b3aecSmrg  AC_SUBST([LTLIB]NAME)
525688b3aecSmrg  AC_SUBST([LIB]NAME[_PREFIX])
526688b3aecSmrg  popdef([NAME])
527688b3aecSmrg  popdef([Name])
528e9554658Smrg])
529e9554658Smrg
530688b3aecSmrgdnl Determine the platform dependent parameters needed to use rpath:
531688b3aecSmrgdnl   acl_libext,
532688b3aecSmrgdnl   acl_shlibext,
533688b3aecSmrgdnl   acl_libname_spec,
534688b3aecSmrgdnl   acl_library_names_spec,
535688b3aecSmrgdnl   acl_hardcode_libdir_flag_spec,
536688b3aecSmrgdnl   acl_hardcode_libdir_separator,
537688b3aecSmrgdnl   acl_hardcode_direct,
538688b3aecSmrgdnl   acl_hardcode_minus_L.
539688b3aecSmrgAC_DEFUN([AC_LIB_RPATH],
540688b3aecSmrg[
541688b3aecSmrg  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
542688b3aecSmrg  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
543688b3aecSmrg  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
544688b3aecSmrg  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
545688b3aecSmrg  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
546688b3aecSmrg  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
547688b3aecSmrg  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
548688b3aecSmrg    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
549688b3aecSmrg    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
550688b3aecSmrg    . ./conftest.sh
551688b3aecSmrg    rm -f ./conftest.sh
552688b3aecSmrg    acl_cv_rpath=done
553688b3aecSmrg  ])
554688b3aecSmrg  wl="$acl_cv_wl"
555688b3aecSmrg  acl_libext="$acl_cv_libext"
556688b3aecSmrg  acl_shlibext="$acl_cv_shlibext"
557688b3aecSmrg  acl_libname_spec="$acl_cv_libname_spec"
558688b3aecSmrg  acl_library_names_spec="$acl_cv_library_names_spec"
559688b3aecSmrg  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
560688b3aecSmrg  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
561688b3aecSmrg  acl_hardcode_direct="$acl_cv_hardcode_direct"
562688b3aecSmrg  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
563688b3aecSmrg  dnl Determine whether the user wants rpath handling at all.
564688b3aecSmrg  AC_ARG_ENABLE([rpath],
565688b3aecSmrg    [  --disable-rpath         do not hardcode runtime library paths],
566688b3aecSmrg    :, enable_rpath=yes)
567688b3aecSmrg])
568e9554658Smrg
569688b3aecSmrgdnl AC_LIB_FROMPACKAGE(name, package)
570688b3aecSmrgdnl declares that libname comes from the given package. The configure file
571688b3aecSmrgdnl will then not have a --with-libname-prefix option but a
572688b3aecSmrgdnl --with-package-prefix option. Several libraries can come from the same
573688b3aecSmrgdnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
574688b3aecSmrgdnl macro call that searches for libname.
575688b3aecSmrgAC_DEFUN([AC_LIB_FROMPACKAGE],
576688b3aecSmrg[
577688b3aecSmrg  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
578688b3aecSmrg                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
579688b3aecSmrg  define([acl_frompackage_]NAME, [$2])
580688b3aecSmrg  popdef([NAME])
581688b3aecSmrg  pushdef([PACK],[$2])
582688b3aecSmrg  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
583688b3aecSmrg                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
584688b3aecSmrg  define([acl_libsinpackage_]PACKUP,
585688b3aecSmrg    m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
586688b3aecSmrg  popdef([PACKUP])
587688b3aecSmrg  popdef([PACK])
588688b3aecSmrg])
589e9554658Smrg
590688b3aecSmrgdnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
591688b3aecSmrgdnl the libraries corresponding to explicit and implicit dependencies.
592688b3aecSmrgdnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
593688b3aecSmrgdnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
594688b3aecSmrgdnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
595688b3aecSmrgAC_DEFUN([AC_LIB_LINKFLAGS_BODY],
596688b3aecSmrg[
597688b3aecSmrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
598688b3aecSmrg  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
599688b3aecSmrg                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
600688b3aecSmrg  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
601688b3aecSmrg  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
602688b3aecSmrg                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
603688b3aecSmrg  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
604688b3aecSmrg  dnl Autoconf >= 2.61 supports dots in --with options.
605688b3aecSmrg  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
606688b3aecSmrg  dnl By default, look in $includedir and $libdir.
607688b3aecSmrg  use_additional=yes
608688b3aecSmrg  AC_LIB_WITH_FINAL_PREFIX([
609688b3aecSmrg    eval additional_includedir=\"$includedir\"
610688b3aecSmrg    eval additional_libdir=\"$libdir\"
611688b3aecSmrg  ])
612688b3aecSmrg  AC_ARG_WITH(P_A_C_K[-prefix],
613688b3aecSmrg[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
614688b3aecSmrg  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
615688b3aecSmrg[
616688b3aecSmrg    if test "X$withval" = "Xno"; then
617688b3aecSmrg      use_additional=no
6185dd5f640Smrg    else
619688b3aecSmrg      if test "X$withval" = "X"; then
620688b3aecSmrg        AC_LIB_WITH_FINAL_PREFIX([
621688b3aecSmrg          eval additional_includedir=\"$includedir\"
622688b3aecSmrg          eval additional_libdir=\"$libdir\"
623688b3aecSmrg        ])
624688b3aecSmrg      else
625688b3aecSmrg        additional_includedir="$withval/include"
626688b3aecSmrg        additional_libdir="$withval/$acl_libdirstem"
627688b3aecSmrg        if test "$acl_libdirstem2" != "$acl_libdirstem" \
628688b3aecSmrg           && ! test -d "$withval/$acl_libdirstem"; then
629688b3aecSmrg          additional_libdir="$withval/$acl_libdirstem2"
630688b3aecSmrg        fi
631688b3aecSmrg      fi
6325dd5f640Smrg    fi
633c2b339b4Smrg])
634688b3aecSmrg  dnl Search the library and its dependencies in $additional_libdir and
635688b3aecSmrg  dnl $LDFLAGS. Using breadth-first-seach.
636688b3aecSmrg  LIB[]NAME=
637688b3aecSmrg  LTLIB[]NAME=
638688b3aecSmrg  INC[]NAME=
639688b3aecSmrg  LIB[]NAME[]_PREFIX=
640688b3aecSmrg  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
641688b3aecSmrg  dnl computed. So it has to be reset here.
642688b3aecSmrg  HAVE_LIB[]NAME=
643688b3aecSmrg  rpathdirs=
644688b3aecSmrg  ltrpathdirs=
645688b3aecSmrg  names_already_handled=
646688b3aecSmrg  names_next_round='$1 $2'
647688b3aecSmrg  while test -n "$names_next_round"; do
648688b3aecSmrg    names_this_round="$names_next_round"
649688b3aecSmrg    names_next_round=
650688b3aecSmrg    for name in $names_this_round; do
651688b3aecSmrg      already_handled=
652688b3aecSmrg      for n in $names_already_handled; do
653688b3aecSmrg        if test "$n" = "$name"; then
654688b3aecSmrg          already_handled=yes
655688b3aecSmrg          break
656688b3aecSmrg        fi
657309c398aSmrg      done
658309c398aSmrg      if test -z "$already_handled"; then
659309c398aSmrg        names_already_handled="$names_already_handled $name"
660309c398aSmrg        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
661309c398aSmrg        dnl or AC_LIB_HAVE_LINKFLAGS call.
662688b3aecSmrg        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
663309c398aSmrg        eval value=\"\$HAVE_LIB$uppername\"
664309c398aSmrg        if test -n "$value"; then
665309c398aSmrg          if test "$value" = yes; then
666309c398aSmrg            eval value=\"\$LIB$uppername\"
667309c398aSmrg            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
668309c398aSmrg            eval value=\"\$LTLIB$uppername\"
669309c398aSmrg            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
670309c398aSmrg          else
671309c398aSmrg            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
672309c398aSmrg            dnl that this library doesn't exist. So just drop it.
673309c398aSmrg            :
674309c398aSmrg          fi
675309c398aSmrg        else
676309c398aSmrg          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
677309c398aSmrg          dnl and the already constructed $LIBNAME/$LTLIBNAME.
678309c398aSmrg          found_dir=
679309c398aSmrg          found_la=
680309c398aSmrg          found_so=
681309c398aSmrg          found_a=
682688b3aecSmrg          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
683688b3aecSmrg          if test -n "$acl_shlibext"; then
684688b3aecSmrg            shrext=".$acl_shlibext"             # typically: shrext=.so
685688b3aecSmrg          else
686688b3aecSmrg            shrext=
687688b3aecSmrg          fi
688309c398aSmrg          if test $use_additional = yes; then
689688b3aecSmrg            dir="$additional_libdir"
690688b3aecSmrg            dnl The same code as in the loop below:
691688b3aecSmrg            dnl First look for a shared library.
692688b3aecSmrg            if test -n "$acl_shlibext"; then
693688b3aecSmrg              if test -f "$dir/$libname$shrext"; then
694688b3aecSmrg                found_dir="$dir"
695688b3aecSmrg                found_so="$dir/$libname$shrext"
696309c398aSmrg              else
697688b3aecSmrg                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
698688b3aecSmrg                  ver=`(cd "$dir" && \
699688b3aecSmrg                        for f in "$libname$shrext".*; do echo "$f"; done \
700688b3aecSmrg                        | sed -e "s,^$libname$shrext\\\\.,," \
701688b3aecSmrg                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
702688b3aecSmrg                        | sed 1q ) 2>/dev/null`
703688b3aecSmrg                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
704688b3aecSmrg                    found_dir="$dir"
705688b3aecSmrg                    found_so="$dir/$libname$shrext.$ver"
706688b3aecSmrg                  fi
707688b3aecSmrg                else
708688b3aecSmrg                  eval library_names=\"$acl_library_names_spec\"
709688b3aecSmrg                  for f in $library_names; do
710688b3aecSmrg                    if test -f "$dir/$f"; then
711688b3aecSmrg                      found_dir="$dir"
712688b3aecSmrg                      found_so="$dir/$f"
713688b3aecSmrg                      break
714688b3aecSmrg                    fi
715688b3aecSmrg                  done
716688b3aecSmrg                fi
717309c398aSmrg              fi
718688b3aecSmrg            fi
719688b3aecSmrg            dnl Then look for a static library.
720688b3aecSmrg            if test "X$found_dir" = "X"; then
721688b3aecSmrg              if test -f "$dir/$libname.$acl_libext"; then
722688b3aecSmrg                found_dir="$dir"
723688b3aecSmrg                found_a="$dir/$libname.$acl_libext"
724309c398aSmrg              fi
725688b3aecSmrg            fi
726688b3aecSmrg            if test "X$found_dir" != "X"; then
727688b3aecSmrg              if test -f "$dir/$libname.la"; then
728688b3aecSmrg                found_la="$dir/$libname.la"
729309c398aSmrg              fi
730309c398aSmrg            fi
731309c398aSmrg          fi
732309c398aSmrg          if test "X$found_dir" = "X"; then
733309c398aSmrg            for x in $LDFLAGS $LTLIB[]NAME; do
734309c398aSmrg              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
735309c398aSmrg              case "$x" in
736309c398aSmrg                -L*)
737309c398aSmrg                  dir=`echo "X$x" | sed -e 's/^X-L//'`
738688b3aecSmrg                  dnl First look for a shared library.
739688b3aecSmrg                  if test -n "$acl_shlibext"; then
740688b3aecSmrg                    if test -f "$dir/$libname$shrext"; then
741688b3aecSmrg                      found_dir="$dir"
742688b3aecSmrg                      found_so="$dir/$libname$shrext"
743309c398aSmrg                    else
744688b3aecSmrg                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
745688b3aecSmrg                        ver=`(cd "$dir" && \
746688b3aecSmrg                              for f in "$libname$shrext".*; do echo "$f"; done \
747688b3aecSmrg                              | sed -e "s,^$libname$shrext\\\\.,," \
748688b3aecSmrg                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
749688b3aecSmrg                              | sed 1q ) 2>/dev/null`
750688b3aecSmrg                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
751688b3aecSmrg                          found_dir="$dir"
752688b3aecSmrg                          found_so="$dir/$libname$shrext.$ver"
753688b3aecSmrg                        fi
754688b3aecSmrg                      else
755688b3aecSmrg                        eval library_names=\"$acl_library_names_spec\"
756688b3aecSmrg                        for f in $library_names; do
757688b3aecSmrg                          if test -f "$dir/$f"; then
758688b3aecSmrg                            found_dir="$dir"
759688b3aecSmrg                            found_so="$dir/$f"
760688b3aecSmrg                            break
761688b3aecSmrg                          fi
762688b3aecSmrg                        done
763688b3aecSmrg                      fi
764309c398aSmrg                    fi
765688b3aecSmrg                  fi
766688b3aecSmrg                  dnl Then look for a static library.
767688b3aecSmrg                  if test "X$found_dir" = "X"; then
768688b3aecSmrg                    if test -f "$dir/$libname.$acl_libext"; then
769309c398aSmrg                      found_dir="$dir"
770688b3aecSmrg                      found_a="$dir/$libname.$acl_libext"
771688b3aecSmrg                    fi
772688b3aecSmrg                  fi
773688b3aecSmrg                  if test "X$found_dir" != "X"; then
774688b3aecSmrg                    if test -f "$dir/$libname.la"; then
775688b3aecSmrg                      found_la="$dir/$libname.la"
776309c398aSmrg                    fi
777309c398aSmrg                  fi
778309c398aSmrg                  ;;
779309c398aSmrg              esac
780309c398aSmrg              if test "X$found_dir" != "X"; then
781309c398aSmrg                break
782309c398aSmrg              fi
783309c398aSmrg            done
784309c398aSmrg          fi
785309c398aSmrg          if test "X$found_dir" != "X"; then
786309c398aSmrg            dnl Found the library.
787309c398aSmrg            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
788309c398aSmrg            if test "X$found_so" != "X"; then
789309c398aSmrg              dnl Linking with a shared library. We attempt to hardcode its
790309c398aSmrg              dnl directory into the executable's runpath, unless it's the
791309c398aSmrg              dnl standard /usr/lib.
792688b3aecSmrg              if test "$enable_rpath" = no \
793688b3aecSmrg                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
794688b3aecSmrg                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
795309c398aSmrg                dnl No hardcoding is needed.
796309c398aSmrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
797309c398aSmrg              else
798309c398aSmrg                dnl Use an explicit option to hardcode DIR into the resulting
799309c398aSmrg                dnl binary.
800309c398aSmrg                dnl Potentially add DIR to ltrpathdirs.
801309c398aSmrg                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
802309c398aSmrg                haveit=
803309c398aSmrg                for x in $ltrpathdirs; do
804309c398aSmrg                  if test "X$x" = "X$found_dir"; then
805309c398aSmrg                    haveit=yes
806309c398aSmrg                    break
807309c398aSmrg                  fi
808309c398aSmrg                done
809309c398aSmrg                if test -z "$haveit"; then
810309c398aSmrg                  ltrpathdirs="$ltrpathdirs $found_dir"
811309c398aSmrg                fi
812309c398aSmrg                dnl The hardcoding into $LIBNAME is system dependent.
813688b3aecSmrg                if test "$acl_hardcode_direct" = yes; then
814309c398aSmrg                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
815309c398aSmrg                  dnl resulting binary.
816309c398aSmrg                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
817309c398aSmrg                else
818688b3aecSmrg                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
819309c398aSmrg                    dnl Use an explicit option to hardcode DIR into the resulting
820309c398aSmrg                    dnl binary.
821309c398aSmrg                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
822309c398aSmrg                    dnl Potentially add DIR to rpathdirs.
823309c398aSmrg                    dnl The rpathdirs will be appended to $LIBNAME at the end.
824309c398aSmrg                    haveit=
825309c398aSmrg                    for x in $rpathdirs; do
826309c398aSmrg                      if test "X$x" = "X$found_dir"; then
827309c398aSmrg                        haveit=yes
828309c398aSmrg                        break
829309c398aSmrg                      fi
830309c398aSmrg                    done
831309c398aSmrg                    if test -z "$haveit"; then
832309c398aSmrg                      rpathdirs="$rpathdirs $found_dir"
833309c398aSmrg                    fi
834309c398aSmrg                  else
835309c398aSmrg                    dnl Rely on "-L$found_dir".
836309c398aSmrg                    dnl But don't add it if it's already contained in the LDFLAGS
837309c398aSmrg                    dnl or the already constructed $LIBNAME
838309c398aSmrg                    haveit=
839309c398aSmrg                    for x in $LDFLAGS $LIB[]NAME; do
840309c398aSmrg                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
841309c398aSmrg                      if test "X$x" = "X-L$found_dir"; then
842309c398aSmrg                        haveit=yes
843309c398aSmrg                        break
844309c398aSmrg                      fi
845309c398aSmrg                    done
846309c398aSmrg                    if test -z "$haveit"; then
847309c398aSmrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
848309c398aSmrg                    fi
849688b3aecSmrg                    if test "$acl_hardcode_minus_L" != no; then
850309c398aSmrg                      dnl FIXME: Not sure whether we should use
851309c398aSmrg                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
852309c398aSmrg                      dnl here.
853309c398aSmrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
854309c398aSmrg                    else
855688b3aecSmrg                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
856309c398aSmrg                      dnl here, because this doesn't fit in flags passed to the
857309c398aSmrg                      dnl compiler. So give up. No hardcoding. This affects only
858309c398aSmrg                      dnl very old systems.
859309c398aSmrg                      dnl FIXME: Not sure whether we should use
860309c398aSmrg                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
861309c398aSmrg                      dnl here.
862309c398aSmrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
863309c398aSmrg                    fi
864309c398aSmrg                  fi
865309c398aSmrg                fi
866309c398aSmrg              fi
867309c398aSmrg            else
868309c398aSmrg              if test "X$found_a" != "X"; then
869309c398aSmrg                dnl Linking with a static library.
870309c398aSmrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
871309c398aSmrg              else
872309c398aSmrg                dnl We shouldn't come here, but anyway it's good to have a
873309c398aSmrg                dnl fallback.
874309c398aSmrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
875309c398aSmrg              fi
876309c398aSmrg            fi
877309c398aSmrg            dnl Assume the include files are nearby.
878309c398aSmrg            additional_includedir=
879309c398aSmrg            case "$found_dir" in
880309c398aSmrg              */$acl_libdirstem | */$acl_libdirstem/)
881309c398aSmrg                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
882688b3aecSmrg                if test "$name" = '$1'; then
883688b3aecSmrg                  LIB[]NAME[]_PREFIX="$basedir"
884688b3aecSmrg                fi
885688b3aecSmrg                additional_includedir="$basedir/include"
886688b3aecSmrg                ;;
887688b3aecSmrg              */$acl_libdirstem2 | */$acl_libdirstem2/)
888688b3aecSmrg                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
889688b3aecSmrg                if test "$name" = '$1'; then
890688b3aecSmrg                  LIB[]NAME[]_PREFIX="$basedir"
891688b3aecSmrg                fi
892309c398aSmrg                additional_includedir="$basedir/include"
893309c398aSmrg                ;;
894309c398aSmrg            esac
895309c398aSmrg            if test "X$additional_includedir" != "X"; then
896309c398aSmrg              dnl Potentially add $additional_includedir to $INCNAME.
897309c398aSmrg              dnl But don't add it
898309c398aSmrg              dnl   1. if it's the standard /usr/include,
899309c398aSmrg              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
900309c398aSmrg              dnl   3. if it's already present in $CPPFLAGS or the already
901309c398aSmrg              dnl      constructed $INCNAME,
902309c398aSmrg              dnl   4. if it doesn't exist as a directory.
903309c398aSmrg              if test "X$additional_includedir" != "X/usr/include"; then
904309c398aSmrg                haveit=
905309c398aSmrg                if test "X$additional_includedir" = "X/usr/local/include"; then
906309c398aSmrg                  if test -n "$GCC"; then
907309c398aSmrg                    case $host_os in
908309c398aSmrg                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
909309c398aSmrg                    esac
910309c398aSmrg                  fi
911309c398aSmrg                fi
912309c398aSmrg                if test -z "$haveit"; then
913309c398aSmrg                  for x in $CPPFLAGS $INC[]NAME; do
914309c398aSmrg                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
915309c398aSmrg                    if test "X$x" = "X-I$additional_includedir"; then
916309c398aSmrg                      haveit=yes
917309c398aSmrg                      break
918309c398aSmrg                    fi
919309c398aSmrg                  done
920309c398aSmrg                  if test -z "$haveit"; then
921309c398aSmrg                    if test -d "$additional_includedir"; then
922309c398aSmrg                      dnl Really add $additional_includedir to $INCNAME.
923309c398aSmrg                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
924309c398aSmrg                    fi
925309c398aSmrg                  fi
926309c398aSmrg                fi
927309c398aSmrg              fi
928309c398aSmrg            fi
929309c398aSmrg            dnl Look for dependencies.
930309c398aSmrg            if test -n "$found_la"; then
931309c398aSmrg              dnl Read the .la file. It defines the variables
932309c398aSmrg              dnl dlname, library_names, old_library, dependency_libs, current,
933309c398aSmrg              dnl age, revision, installed, dlopen, dlpreopen, libdir.
934309c398aSmrg              save_libdir="$libdir"
935309c398aSmrg              case "$found_la" in
936309c398aSmrg                */* | *\\*) . "$found_la" ;;
937309c398aSmrg                *) . "./$found_la" ;;
938309c398aSmrg              esac
939309c398aSmrg              libdir="$save_libdir"
940309c398aSmrg              dnl We use only dependency_libs.
941309c398aSmrg              for dep in $dependency_libs; do
942309c398aSmrg                case "$dep" in
943309c398aSmrg                  -L*)
944309c398aSmrg                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
945309c398aSmrg                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
946309c398aSmrg                    dnl But don't add it
947309c398aSmrg                    dnl   1. if it's the standard /usr/lib,
948309c398aSmrg                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
949309c398aSmrg                    dnl   3. if it's already present in $LDFLAGS or the already
950309c398aSmrg                    dnl      constructed $LIBNAME,
951309c398aSmrg                    dnl   4. if it doesn't exist as a directory.
952688b3aecSmrg                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
953688b3aecSmrg                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
954309c398aSmrg                      haveit=
955688b3aecSmrg                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
956688b3aecSmrg                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
957309c398aSmrg                        if test -n "$GCC"; then
958309c398aSmrg                          case $host_os in
959309c398aSmrg                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
960309c398aSmrg                          esac
961309c398aSmrg                        fi
962309c398aSmrg                      fi
963309c398aSmrg                      if test -z "$haveit"; then
964309c398aSmrg                        haveit=
965309c398aSmrg                        for x in $LDFLAGS $LIB[]NAME; do
966309c398aSmrg                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
967309c398aSmrg                          if test "X$x" = "X-L$additional_libdir"; then
968309c398aSmrg                            haveit=yes
969309c398aSmrg                            break
970309c398aSmrg                          fi
971309c398aSmrg                        done
972309c398aSmrg                        if test -z "$haveit"; then
973309c398aSmrg                          if test -d "$additional_libdir"; then
974309c398aSmrg                            dnl Really add $additional_libdir to $LIBNAME.
975309c398aSmrg                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
976309c398aSmrg                          fi
977309c398aSmrg                        fi
978309c398aSmrg                        haveit=
979309c398aSmrg                        for x in $LDFLAGS $LTLIB[]NAME; do
980309c398aSmrg                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
981309c398aSmrg                          if test "X$x" = "X-L$additional_libdir"; then
982309c398aSmrg                            haveit=yes
983309c398aSmrg                            break
984309c398aSmrg                          fi
985309c398aSmrg                        done
986309c398aSmrg                        if test -z "$haveit"; then
987309c398aSmrg                          if test -d "$additional_libdir"; then
988309c398aSmrg                            dnl Really add $additional_libdir to $LTLIBNAME.
989309c398aSmrg                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
990309c398aSmrg                          fi
991309c398aSmrg                        fi
992309c398aSmrg                      fi
993309c398aSmrg                    fi
994309c398aSmrg                    ;;
995309c398aSmrg                  -R*)
996309c398aSmrg                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
997309c398aSmrg                    if test "$enable_rpath" != no; then
998309c398aSmrg                      dnl Potentially add DIR to rpathdirs.
999309c398aSmrg                      dnl The rpathdirs will be appended to $LIBNAME at the end.
1000309c398aSmrg                      haveit=
1001309c398aSmrg                      for x in $rpathdirs; do
1002309c398aSmrg                        if test "X$x" = "X$dir"; then
1003309c398aSmrg                          haveit=yes
1004309c398aSmrg                          break
1005309c398aSmrg                        fi
1006309c398aSmrg                      done
1007309c398aSmrg                      if test -z "$haveit"; then
1008309c398aSmrg                        rpathdirs="$rpathdirs $dir"
1009309c398aSmrg                      fi
1010309c398aSmrg                      dnl Potentially add DIR to ltrpathdirs.
1011309c398aSmrg                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1012309c398aSmrg                      haveit=
1013309c398aSmrg                      for x in $ltrpathdirs; do
1014309c398aSmrg                        if test "X$x" = "X$dir"; then
1015309c398aSmrg                          haveit=yes
1016309c398aSmrg                          break
1017309c398aSmrg                        fi
1018309c398aSmrg                      done
1019309c398aSmrg                      if test -z "$haveit"; then
1020309c398aSmrg                        ltrpathdirs="$ltrpathdirs $dir"
1021309c398aSmrg                      fi
1022309c398aSmrg                    fi
1023309c398aSmrg                    ;;
1024309c398aSmrg                  -l*)
1025309c398aSmrg                    dnl Handle this in the next round.
1026309c398aSmrg                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1027309c398aSmrg                    ;;
1028309c398aSmrg                  *.la)
1029309c398aSmrg                    dnl Handle this in the next round. Throw away the .la's
1030309c398aSmrg                    dnl directory; it is already contained in a preceding -L
1031309c398aSmrg                    dnl option.
1032309c398aSmrg                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1033309c398aSmrg                    ;;
1034309c398aSmrg                  *)
1035309c398aSmrg                    dnl Most likely an immediate library name.
1036309c398aSmrg                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1037309c398aSmrg                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1038309c398aSmrg                    ;;
1039309c398aSmrg                esac
1040309c398aSmrg              done
1041309c398aSmrg            fi
1042309c398aSmrg          else
1043309c398aSmrg            dnl Didn't find the library; assume it is in the system directories
1044309c398aSmrg            dnl known to the linker and runtime loader. (All the system
1045309c398aSmrg            dnl directories known to the linker should also be known to the
1046309c398aSmrg            dnl runtime loader, otherwise the system is severely misconfigured.)
1047309c398aSmrg            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1048309c398aSmrg            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1049309c398aSmrg          fi
1050309c398aSmrg        fi
1051309c398aSmrg      fi
1052309c398aSmrg    done
1053309c398aSmrg  done
1054309c398aSmrg  if test "X$rpathdirs" != "X"; then
1055688b3aecSmrg    if test -n "$acl_hardcode_libdir_separator"; then
1056309c398aSmrg      dnl Weird platform: only the last -rpath option counts, the user must
1057309c398aSmrg      dnl pass all path elements in one option. We can arrange that for a
1058309c398aSmrg      dnl single library, but not when more than one $LIBNAMEs are used.
1059309c398aSmrg      alldirs=
1060309c398aSmrg      for found_dir in $rpathdirs; do
1061688b3aecSmrg        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
1062309c398aSmrg      done
1063688b3aecSmrg      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
1064309c398aSmrg      acl_save_libdir="$libdir"
1065309c398aSmrg      libdir="$alldirs"
1066688b3aecSmrg      eval flag=\"$acl_hardcode_libdir_flag_spec\"
1067309c398aSmrg      libdir="$acl_save_libdir"
1068309c398aSmrg      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1069309c398aSmrg    else
1070688b3aecSmrg      dnl The -rpath options are cumulative.
1071688b3aecSmrg      for found_dir in $rpathdirs; do
1072688b3aecSmrg        acl_save_libdir="$libdir"
1073688b3aecSmrg        libdir="$found_dir"
1074688b3aecSmrg        eval flag=\"$acl_hardcode_libdir_flag_spec\"
1075688b3aecSmrg        libdir="$acl_save_libdir"
1076688b3aecSmrg        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1077688b3aecSmrg      done
1078688b3aecSmrg    fi
1079688b3aecSmrg  fi
1080688b3aecSmrg  if test "X$ltrpathdirs" != "X"; then
1081688b3aecSmrg    dnl When using libtool, the option that works for both libraries and
1082688b3aecSmrg    dnl executables is -R. The -R options are cumulative.
1083688b3aecSmrg    for found_dir in $ltrpathdirs; do
1084688b3aecSmrg      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1085688b3aecSmrg    done
1086688b3aecSmrg  fi
1087688b3aecSmrg  popdef([P_A_C_K])
1088688b3aecSmrg  popdef([PACKLIBS])
1089688b3aecSmrg  popdef([PACKUP])
1090688b3aecSmrg  popdef([PACK])
1091688b3aecSmrg  popdef([NAME])
1092688b3aecSmrg])
1093688b3aecSmrg
1094688b3aecSmrgdnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1095688b3aecSmrgdnl unless already present in VAR.
1096688b3aecSmrgdnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1097688b3aecSmrgdnl contains two or three consecutive elements that belong together.
1098688b3aecSmrgAC_DEFUN([AC_LIB_APPENDTOVAR],
1099688b3aecSmrg[
1100688b3aecSmrg  for element in [$2]; do
1101688b3aecSmrg    haveit=
1102688b3aecSmrg    for x in $[$1]; do
1103688b3aecSmrg      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1104688b3aecSmrg      if test "X$x" = "X$element"; then
1105688b3aecSmrg        haveit=yes
1106688b3aecSmrg        break
1107688b3aecSmrg      fi
1108688b3aecSmrg    done
1109688b3aecSmrg    if test -z "$haveit"; then
1110688b3aecSmrg      [$1]="${[$1]}${[$1]:+ }$element"
1111688b3aecSmrg    fi
1112688b3aecSmrg  done
1113688b3aecSmrg])
1114688b3aecSmrg
1115688b3aecSmrgdnl For those cases where a variable contains several -L and -l options
1116688b3aecSmrgdnl referring to unknown libraries and directories, this macro determines the
1117688b3aecSmrgdnl necessary additional linker options for the runtime path.
1118688b3aecSmrgdnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
1119688b3aecSmrgdnl sets LDADDVAR to linker options needed together with LIBSVALUE.
1120688b3aecSmrgdnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
1121688b3aecSmrgdnl otherwise linking without libtool is assumed.
1122688b3aecSmrgAC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
1123688b3aecSmrg[
1124688b3aecSmrg  AC_REQUIRE([AC_LIB_RPATH])
1125688b3aecSmrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1126688b3aecSmrg  $1=
1127688b3aecSmrg  if test "$enable_rpath" != no; then
1128688b3aecSmrg    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
1129688b3aecSmrg      dnl Use an explicit option to hardcode directories into the resulting
1130688b3aecSmrg      dnl binary.
1131688b3aecSmrg      rpathdirs=
1132688b3aecSmrg      next=
1133688b3aecSmrg      for opt in $2; do
1134688b3aecSmrg        if test -n "$next"; then
1135688b3aecSmrg          dir="$next"
1136688b3aecSmrg          dnl No need to hardcode the standard /usr/lib.
1137688b3aecSmrg          if test "X$dir" != "X/usr/$acl_libdirstem" \
1138688b3aecSmrg             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1139688b3aecSmrg            rpathdirs="$rpathdirs $dir"
1140688b3aecSmrg          fi
1141688b3aecSmrg          next=
1142688b3aecSmrg        else
1143688b3aecSmrg          case $opt in
1144688b3aecSmrg            -L) next=yes ;;
1145688b3aecSmrg            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
1146688b3aecSmrg                 dnl No need to hardcode the standard /usr/lib.
1147688b3aecSmrg                 if test "X$dir" != "X/usr/$acl_libdirstem" \
1148688b3aecSmrg                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1149688b3aecSmrg                   rpathdirs="$rpathdirs $dir"
1150688b3aecSmrg                 fi
1151688b3aecSmrg                 next= ;;
1152688b3aecSmrg            *) next= ;;
1153688b3aecSmrg          esac
1154688b3aecSmrg        fi
1155688b3aecSmrg      done
1156688b3aecSmrg      if test "X$rpathdirs" != "X"; then
1157688b3aecSmrg        if test -n ""$3""; then
1158688b3aecSmrg          dnl libtool is used for linking. Use -R options.
1159688b3aecSmrg          for dir in $rpathdirs; do
1160688b3aecSmrg            $1="${$1}${$1:+ }-R$dir"
1161688b3aecSmrg          done
1162688b3aecSmrg        else
1163688b3aecSmrg          dnl The linker is used for linking directly.
1164688b3aecSmrg          if test -n "$acl_hardcode_libdir_separator"; then
1165688b3aecSmrg            dnl Weird platform: only the last -rpath option counts, the user
1166688b3aecSmrg            dnl must pass all path elements in one option.
1167688b3aecSmrg            alldirs=
1168688b3aecSmrg            for dir in $rpathdirs; do
1169688b3aecSmrg              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
1170688b3aecSmrg            done
1171688b3aecSmrg            acl_save_libdir="$libdir"
1172688b3aecSmrg            libdir="$alldirs"
1173688b3aecSmrg            eval flag=\"$acl_hardcode_libdir_flag_spec\"
1174688b3aecSmrg            libdir="$acl_save_libdir"
1175688b3aecSmrg            $1="$flag"
1176688b3aecSmrg          else
1177688b3aecSmrg            dnl The -rpath options are cumulative.
1178688b3aecSmrg            for dir in $rpathdirs; do
1179688b3aecSmrg              acl_save_libdir="$libdir"
1180688b3aecSmrg              libdir="$dir"
1181688b3aecSmrg              eval flag=\"$acl_hardcode_libdir_flag_spec\"
1182688b3aecSmrg              libdir="$acl_save_libdir"
1183688b3aecSmrg              $1="${$1}${$1:+ }$flag"
1184688b3aecSmrg            done
1185688b3aecSmrg          fi
1186688b3aecSmrg        fi
1187688b3aecSmrg      fi
1188688b3aecSmrg    fi
1189688b3aecSmrg  fi
1190688b3aecSmrg  AC_SUBST([$1])
1191688b3aecSmrg])
1192688b3aecSmrg
1193688b3aecSmrg# lib-prefix.m4 serial 7 (gettext-0.18)
1194688b3aecSmrgdnl Copyright (C) 2001-2005, 2008-2016 Free Software Foundation, Inc.
1195688b3aecSmrgdnl This file is free software; the Free Software Foundation
1196688b3aecSmrgdnl gives unlimited permission to copy and/or distribute it,
1197688b3aecSmrgdnl with or without modifications, as long as this notice is preserved.
1198688b3aecSmrg
1199688b3aecSmrgdnl From Bruno Haible.
1200688b3aecSmrg
1201688b3aecSmrgdnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
1202688b3aecSmrgdnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
1203688b3aecSmrgdnl require excessive bracketing.
1204688b3aecSmrgifdef([AC_HELP_STRING],
1205688b3aecSmrg[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
1206688b3aecSmrg[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
1207688b3aecSmrg
1208688b3aecSmrgdnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1209688b3aecSmrgdnl to access previously installed libraries. The basic assumption is that
1210688b3aecSmrgdnl a user will want packages to use other packages he previously installed
1211688b3aecSmrgdnl with the same --prefix option.
1212688b3aecSmrgdnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1213688b3aecSmrgdnl libraries, but is otherwise very convenient.
1214688b3aecSmrgAC_DEFUN([AC_LIB_PREFIX],
1215688b3aecSmrg[
1216688b3aecSmrg  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1217688b3aecSmrg  AC_REQUIRE([AC_PROG_CC])
1218688b3aecSmrg  AC_REQUIRE([AC_CANONICAL_HOST])
1219688b3aecSmrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1220688b3aecSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1221688b3aecSmrg  dnl By default, look in $includedir and $libdir.
1222688b3aecSmrg  use_additional=yes
1223688b3aecSmrg  AC_LIB_WITH_FINAL_PREFIX([
1224688b3aecSmrg    eval additional_includedir=\"$includedir\"
1225688b3aecSmrg    eval additional_libdir=\"$libdir\"
1226688b3aecSmrg  ])
1227688b3aecSmrg  AC_LIB_ARG_WITH([lib-prefix],
1228688b3aecSmrg[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1229688b3aecSmrg  --without-lib-prefix    don't search for libraries in includedir and libdir],
1230688b3aecSmrg[
1231688b3aecSmrg    if test "X$withval" = "Xno"; then
1232688b3aecSmrg      use_additional=no
1233688b3aecSmrg    else
1234688b3aecSmrg      if test "X$withval" = "X"; then
1235688b3aecSmrg        AC_LIB_WITH_FINAL_PREFIX([
1236688b3aecSmrg          eval additional_includedir=\"$includedir\"
1237688b3aecSmrg          eval additional_libdir=\"$libdir\"
1238688b3aecSmrg        ])
1239688b3aecSmrg      else
1240688b3aecSmrg        additional_includedir="$withval/include"
1241688b3aecSmrg        additional_libdir="$withval/$acl_libdirstem"
1242688b3aecSmrg      fi
1243688b3aecSmrg    fi
1244688b3aecSmrg])
1245688b3aecSmrg  if test $use_additional = yes; then
1246688b3aecSmrg    dnl Potentially add $additional_includedir to $CPPFLAGS.
1247688b3aecSmrg    dnl But don't add it
1248688b3aecSmrg    dnl   1. if it's the standard /usr/include,
1249688b3aecSmrg    dnl   2. if it's already present in $CPPFLAGS,
1250688b3aecSmrg    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1251688b3aecSmrg    dnl   4. if it doesn't exist as a directory.
1252688b3aecSmrg    if test "X$additional_includedir" != "X/usr/include"; then
1253688b3aecSmrg      haveit=
1254688b3aecSmrg      for x in $CPPFLAGS; do
1255688b3aecSmrg        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1256688b3aecSmrg        if test "X$x" = "X-I$additional_includedir"; then
1257688b3aecSmrg          haveit=yes
1258688b3aecSmrg          break
1259688b3aecSmrg        fi
1260688b3aecSmrg      done
1261688b3aecSmrg      if test -z "$haveit"; then
1262688b3aecSmrg        if test "X$additional_includedir" = "X/usr/local/include"; then
1263688b3aecSmrg          if test -n "$GCC"; then
1264688b3aecSmrg            case $host_os in
1265688b3aecSmrg              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1266688b3aecSmrg            esac
1267688b3aecSmrg          fi
1268688b3aecSmrg        fi
1269688b3aecSmrg        if test -z "$haveit"; then
1270688b3aecSmrg          if test -d "$additional_includedir"; then
1271688b3aecSmrg            dnl Really add $additional_includedir to $CPPFLAGS.
1272688b3aecSmrg            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1273688b3aecSmrg          fi
1274688b3aecSmrg        fi
1275688b3aecSmrg      fi
1276688b3aecSmrg    fi
1277688b3aecSmrg    dnl Potentially add $additional_libdir to $LDFLAGS.
1278688b3aecSmrg    dnl But don't add it
1279688b3aecSmrg    dnl   1. if it's the standard /usr/lib,
1280688b3aecSmrg    dnl   2. if it's already present in $LDFLAGS,
1281688b3aecSmrg    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
1282688b3aecSmrg    dnl   4. if it doesn't exist as a directory.
1283688b3aecSmrg    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
1284688b3aecSmrg      haveit=
1285688b3aecSmrg      for x in $LDFLAGS; do
1286688b3aecSmrg        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1287688b3aecSmrg        if test "X$x" = "X-L$additional_libdir"; then
1288688b3aecSmrg          haveit=yes
1289688b3aecSmrg          break
1290688b3aecSmrg        fi
1291688b3aecSmrg      done
1292688b3aecSmrg      if test -z "$haveit"; then
1293688b3aecSmrg        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
1294688b3aecSmrg          if test -n "$GCC"; then
1295688b3aecSmrg            case $host_os in
1296688b3aecSmrg              linux*) haveit=yes;;
1297688b3aecSmrg            esac
1298688b3aecSmrg          fi
1299688b3aecSmrg        fi
1300688b3aecSmrg        if test -z "$haveit"; then
1301688b3aecSmrg          if test -d "$additional_libdir"; then
1302688b3aecSmrg            dnl Really add $additional_libdir to $LDFLAGS.
1303688b3aecSmrg            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1304688b3aecSmrg          fi
1305688b3aecSmrg        fi
1306688b3aecSmrg      fi
1307688b3aecSmrg    fi
1308688b3aecSmrg  fi
1309688b3aecSmrg])
1310688b3aecSmrg
1311688b3aecSmrgdnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1312688b3aecSmrgdnl acl_final_exec_prefix, containing the values to which $prefix and
1313688b3aecSmrgdnl $exec_prefix will expand at the end of the configure script.
1314688b3aecSmrgAC_DEFUN([AC_LIB_PREPARE_PREFIX],
1315688b3aecSmrg[
1316688b3aecSmrg  dnl Unfortunately, prefix and exec_prefix get only finally determined
1317688b3aecSmrg  dnl at the end of configure.
1318688b3aecSmrg  if test "X$prefix" = "XNONE"; then
1319688b3aecSmrg    acl_final_prefix="$ac_default_prefix"
1320688b3aecSmrg  else
1321688b3aecSmrg    acl_final_prefix="$prefix"
1322688b3aecSmrg  fi
1323688b3aecSmrg  if test "X$exec_prefix" = "XNONE"; then
1324688b3aecSmrg    acl_final_exec_prefix='${prefix}'
1325688b3aecSmrg  else
1326688b3aecSmrg    acl_final_exec_prefix="$exec_prefix"
1327688b3aecSmrg  fi
1328688b3aecSmrg  acl_save_prefix="$prefix"
1329688b3aecSmrg  prefix="$acl_final_prefix"
1330688b3aecSmrg  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1331688b3aecSmrg  prefix="$acl_save_prefix"
1332688b3aecSmrg])
1333688b3aecSmrg
1334688b3aecSmrgdnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1335688b3aecSmrgdnl variables prefix and exec_prefix bound to the values they will have
1336688b3aecSmrgdnl at the end of the configure script.
1337688b3aecSmrgAC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1338688b3aecSmrg[
1339688b3aecSmrg  acl_save_prefix="$prefix"
1340688b3aecSmrg  prefix="$acl_final_prefix"
1341688b3aecSmrg  acl_save_exec_prefix="$exec_prefix"
1342688b3aecSmrg  exec_prefix="$acl_final_exec_prefix"
1343688b3aecSmrg  $1
1344688b3aecSmrg  exec_prefix="$acl_save_exec_prefix"
1345688b3aecSmrg  prefix="$acl_save_prefix"
1346688b3aecSmrg])
1347688b3aecSmrg
1348688b3aecSmrgdnl AC_LIB_PREPARE_MULTILIB creates
1349688b3aecSmrgdnl - a variable acl_libdirstem, containing the basename of the libdir, either
1350688b3aecSmrgdnl   "lib" or "lib64" or "lib/64",
1351688b3aecSmrgdnl - a variable acl_libdirstem2, as a secondary possible value for
1352688b3aecSmrgdnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
1353688b3aecSmrgdnl   "lib/amd64".
1354688b3aecSmrgAC_DEFUN([AC_LIB_PREPARE_MULTILIB],
1355688b3aecSmrg[
1356688b3aecSmrg  dnl There is no formal standard regarding lib and lib64.
1357688b3aecSmrg  dnl On glibc systems, the current practice is that on a system supporting
1358688b3aecSmrg  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1359688b3aecSmrg  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
1360688b3aecSmrg  dnl the compiler's default mode by looking at the compiler's library search
1361688b3aecSmrg  dnl path. If at least one of its elements ends in /lib64 or points to a
1362688b3aecSmrg  dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
1363688b3aecSmrg  dnl Otherwise we use the default, namely "lib".
1364688b3aecSmrg  dnl On Solaris systems, the current practice is that on a system supporting
1365688b3aecSmrg  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1366688b3aecSmrg  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
1367688b3aecSmrg  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
1368688b3aecSmrg  AC_REQUIRE([AC_CANONICAL_HOST])
1369688b3aecSmrg  acl_libdirstem=lib
1370688b3aecSmrg  acl_libdirstem2=
1371688b3aecSmrg  case "$host_os" in
1372688b3aecSmrg    solaris*)
1373688b3aecSmrg      dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
1374688b3aecSmrg      dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
1375688b3aecSmrg      dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
1376688b3aecSmrg      dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
1377688b3aecSmrg      dnl symlink is missing, so we set acl_libdirstem2 too.
1378688b3aecSmrg      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
1379688b3aecSmrg        [AC_EGREP_CPP([sixtyfour bits], [
1380688b3aecSmrg#ifdef _LP64
1381688b3aecSmrgsixtyfour bits
1382688b3aecSmrg#endif
1383688b3aecSmrg           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
1384688b3aecSmrg        ])
1385688b3aecSmrg      if test $gl_cv_solaris_64bit = yes; then
1386688b3aecSmrg        acl_libdirstem=lib/64
1387688b3aecSmrg        case "$host_cpu" in
1388688b3aecSmrg          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
1389688b3aecSmrg          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
1390688b3aecSmrg        esac
1391688b3aecSmrg      fi
1392688b3aecSmrg      ;;
1393688b3aecSmrg    *)
1394688b3aecSmrg      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
1395688b3aecSmrg      if test -n "$searchpath"; then
1396688b3aecSmrg        acl_save_IFS="${IFS= 	}"; IFS=":"
1397688b3aecSmrg        for searchdir in $searchpath; do
1398688b3aecSmrg          if test -d "$searchdir"; then
1399688b3aecSmrg            case "$searchdir" in
1400688b3aecSmrg              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
1401688b3aecSmrg              */../ | */.. )
1402688b3aecSmrg                # Better ignore directories of this form. They are misleading.
1403688b3aecSmrg                ;;
1404688b3aecSmrg              *) searchdir=`cd "$searchdir" && pwd`
1405688b3aecSmrg                 case "$searchdir" in
1406688b3aecSmrg                   */lib64 ) acl_libdirstem=lib64 ;;
1407688b3aecSmrg                 esac ;;
1408688b3aecSmrg            esac
1409688b3aecSmrg          fi
1410688b3aecSmrg        done
1411688b3aecSmrg        IFS="$acl_save_IFS"
1412688b3aecSmrg      fi
1413688b3aecSmrg      ;;
1414688b3aecSmrg  esac
1415688b3aecSmrg  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
1416688b3aecSmrg])
1417688b3aecSmrg
1418688b3aecSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1419688b3aecSmrgdnl serial 11 (pkg-config-0.29)
1420688b3aecSmrgdnl
1421688b3aecSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1422688b3aecSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1423688b3aecSmrgdnl
1424688b3aecSmrgdnl This program is free software; you can redistribute it and/or modify
1425688b3aecSmrgdnl it under the terms of the GNU General Public License as published by
1426688b3aecSmrgdnl the Free Software Foundation; either version 2 of the License, or
1427688b3aecSmrgdnl (at your option) any later version.
1428688b3aecSmrgdnl
1429688b3aecSmrgdnl This program is distributed in the hope that it will be useful, but
1430688b3aecSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1431688b3aecSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1432688b3aecSmrgdnl General Public License for more details.
1433688b3aecSmrgdnl
1434688b3aecSmrgdnl You should have received a copy of the GNU General Public License
1435688b3aecSmrgdnl along with this program; if not, write to the Free Software
1436688b3aecSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1437688b3aecSmrgdnl 02111-1307, USA.
1438688b3aecSmrgdnl
1439688b3aecSmrgdnl As a special exception to the GNU General Public License, if you
1440688b3aecSmrgdnl distribute this file as part of a program that contains a
1441688b3aecSmrgdnl configuration script generated by Autoconf, you may include it under
1442688b3aecSmrgdnl the same distribution terms that you use for the rest of that
1443688b3aecSmrgdnl program.
1444688b3aecSmrg
1445688b3aecSmrgdnl PKG_PREREQ(MIN-VERSION)
1446688b3aecSmrgdnl -----------------------
1447688b3aecSmrgdnl Since: 0.29
1448688b3aecSmrgdnl
1449688b3aecSmrgdnl Verify that the version of the pkg-config macros are at least
1450688b3aecSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1451688b3aecSmrgdnl installed version of pkg-config, this checks the developer's version
1452688b3aecSmrgdnl of pkg.m4 when generating configure.
1453688b3aecSmrgdnl
1454688b3aecSmrgdnl To ensure that this macro is defined, also add:
1455688b3aecSmrgdnl m4_ifndef([PKG_PREREQ],
1456688b3aecSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1457688b3aecSmrgdnl
1458688b3aecSmrgdnl See the "Since" comment for each macro you use to see what version
1459688b3aecSmrgdnl of the macros you require.
1460688b3aecSmrgm4_defun([PKG_PREREQ],
1461688b3aecSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1462688b3aecSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1463688b3aecSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1464688b3aecSmrg])dnl PKG_PREREQ
1465688b3aecSmrg
1466688b3aecSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1467688b3aecSmrgdnl ----------------------------------
1468688b3aecSmrgdnl Since: 0.16
1469688b3aecSmrgdnl
1470688b3aecSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1471688b3aecSmrgdnl first found in the path. Checks that the version of pkg-config found
1472688b3aecSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1473688b3aecSmrgdnl used since that's the first version where most current features of
1474688b3aecSmrgdnl pkg-config existed.
1475688b3aecSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1476688b3aecSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1477688b3aecSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1478688b3aecSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1479688b3aecSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1480688b3aecSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1481688b3aecSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1482688b3aecSmrg
1483688b3aecSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1484688b3aecSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1485688b3aecSmrgfi
1486688b3aecSmrgif test -n "$PKG_CONFIG"; then
1487688b3aecSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1488688b3aecSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1489688b3aecSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1490688b3aecSmrg		AC_MSG_RESULT([yes])
1491688b3aecSmrg	else
1492688b3aecSmrg		AC_MSG_RESULT([no])
1493688b3aecSmrg		PKG_CONFIG=""
1494688b3aecSmrg	fi
1495688b3aecSmrgfi[]dnl
1496688b3aecSmrg])dnl PKG_PROG_PKG_CONFIG
1497688b3aecSmrg
1498688b3aecSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1499688b3aecSmrgdnl -------------------------------------------------------------------
1500688b3aecSmrgdnl Since: 0.18
1501688b3aecSmrgdnl
1502688b3aecSmrgdnl Check to see whether a particular set of modules exists. Similar to
1503688b3aecSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1504688b3aecSmrgdnl
1505688b3aecSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1506688b3aecSmrgdnl only at the first occurence in configure.ac, so if the first place
1507688b3aecSmrgdnl it's called might be skipped (such as if it is within an "if", you
1508688b3aecSmrgdnl have to call PKG_CHECK_EXISTS manually
1509688b3aecSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1510688b3aecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1511688b3aecSmrgif test -n "$PKG_CONFIG" && \
1512688b3aecSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1513688b3aecSmrg  m4_default([$2], [:])
1514688b3aecSmrgm4_ifvaln([$3], [else
1515688b3aecSmrg  $3])dnl
1516688b3aecSmrgfi])
1517688b3aecSmrg
1518688b3aecSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1519688b3aecSmrgdnl ---------------------------------------------
1520688b3aecSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1521688b3aecSmrgdnl pkg_failed based on the result.
1522688b3aecSmrgm4_define([_PKG_CONFIG],
1523688b3aecSmrg[if test -n "$$1"; then
1524688b3aecSmrg    pkg_cv_[]$1="$$1"
1525688b3aecSmrg elif test -n "$PKG_CONFIG"; then
1526688b3aecSmrg    PKG_CHECK_EXISTS([$3],
1527688b3aecSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1528688b3aecSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1529688b3aecSmrg		     [pkg_failed=yes])
1530688b3aecSmrg else
1531688b3aecSmrg    pkg_failed=untried
1532688b3aecSmrgfi[]dnl
1533688b3aecSmrg])dnl _PKG_CONFIG
1534688b3aecSmrg
1535688b3aecSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1536688b3aecSmrgdnl ---------------------------
1537688b3aecSmrgdnl Internal check to see if pkg-config supports short errors.
1538688b3aecSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1539688b3aecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1540688b3aecSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1541688b3aecSmrg        _pkg_short_errors_supported=yes
1542688b3aecSmrgelse
1543688b3aecSmrg        _pkg_short_errors_supported=no
1544688b3aecSmrgfi[]dnl
1545688b3aecSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1546688b3aecSmrg
1547688b3aecSmrg
1548688b3aecSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1549688b3aecSmrgdnl   [ACTION-IF-NOT-FOUND])
1550688b3aecSmrgdnl --------------------------------------------------------------
1551688b3aecSmrgdnl Since: 0.4.0
1552688b3aecSmrgdnl
1553688b3aecSmrgdnl Note that if there is a possibility the first call to
1554688b3aecSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1555688b3aecSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1556688b3aecSmrgAC_DEFUN([PKG_CHECK_MODULES],
1557688b3aecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1558688b3aecSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1559688b3aecSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1560688b3aecSmrg
1561688b3aecSmrgpkg_failed=no
1562688b3aecSmrgAC_MSG_CHECKING([for $1])
1563688b3aecSmrg
1564688b3aecSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1565688b3aecSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1566688b3aecSmrg
1567688b3aecSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1568688b3aecSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1569688b3aecSmrgSee the pkg-config man page for more details.])
1570688b3aecSmrg
1571688b3aecSmrgif test $pkg_failed = yes; then
1572688b3aecSmrg   	AC_MSG_RESULT([no])
1573688b3aecSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1574688b3aecSmrg        if test $_pkg_short_errors_supported = yes; then
1575688b3aecSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1576688b3aecSmrg        else 
1577688b3aecSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1578688b3aecSmrg        fi
1579688b3aecSmrg	# Put the nasty error message in config.log where it belongs
1580688b3aecSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1581688b3aecSmrg
1582688b3aecSmrg	m4_default([$4], [AC_MSG_ERROR(
1583688b3aecSmrg[Package requirements ($2) were not met:
1584688b3aecSmrg
1585688b3aecSmrg$$1_PKG_ERRORS
1586688b3aecSmrg
1587688b3aecSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1588688b3aecSmrginstalled software in a non-standard prefix.
1589688b3aecSmrg
1590688b3aecSmrg_PKG_TEXT])[]dnl
1591688b3aecSmrg        ])
1592688b3aecSmrgelif test $pkg_failed = untried; then
1593688b3aecSmrg     	AC_MSG_RESULT([no])
1594688b3aecSmrg	m4_default([$4], [AC_MSG_FAILURE(
1595688b3aecSmrg[The pkg-config script could not be found or is too old.  Make sure it
1596688b3aecSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1597688b3aecSmrgpath to pkg-config.
1598688b3aecSmrg
1599688b3aecSmrg_PKG_TEXT
1600688b3aecSmrg
1601688b3aecSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1602688b3aecSmrg        ])
1603688b3aecSmrgelse
1604688b3aecSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1605688b3aecSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1606688b3aecSmrg        AC_MSG_RESULT([yes])
1607688b3aecSmrg	$3
1608688b3aecSmrgfi[]dnl
1609688b3aecSmrg])dnl PKG_CHECK_MODULES
1610688b3aecSmrg
1611688b3aecSmrg
1612688b3aecSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1613688b3aecSmrgdnl   [ACTION-IF-NOT-FOUND])
1614688b3aecSmrgdnl ---------------------------------------------------------------------
1615688b3aecSmrgdnl Since: 0.29
1616688b3aecSmrgdnl
1617688b3aecSmrgdnl Checks for existence of MODULES and gathers its build flags with
1618688b3aecSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1619688b3aecSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1620688b3aecSmrgdnl
1621688b3aecSmrgdnl Note that if there is a possibility the first call to
1622688b3aecSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1623688b3aecSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1624688b3aecSmrgdnl configure.ac.
1625688b3aecSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1626688b3aecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1627688b3aecSmrg_save_PKG_CONFIG=$PKG_CONFIG
1628688b3aecSmrgPKG_CONFIG="$PKG_CONFIG --static"
1629688b3aecSmrgPKG_CHECK_MODULES($@)
1630688b3aecSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1631688b3aecSmrg])dnl PKG_CHECK_MODULES_STATIC
1632688b3aecSmrg
1633688b3aecSmrg
1634688b3aecSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1635688b3aecSmrgdnl -------------------------
1636688b3aecSmrgdnl Since: 0.27
1637688b3aecSmrgdnl
1638688b3aecSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1639688b3aecSmrgdnl should install pkg-config .pc files. By default the directory is
1640688b3aecSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1641688b3aecSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1642688b3aecSmrgdnl parameter.
1643688b3aecSmrgAC_DEFUN([PKG_INSTALLDIR],
1644688b3aecSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1645688b3aecSmrgm4_pushdef([pkg_description],
1646688b3aecSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1647688b3aecSmrgAC_ARG_WITH([pkgconfigdir],
1648688b3aecSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1649688b3aecSmrg    [with_pkgconfigdir=]pkg_default)
1650688b3aecSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1651688b3aecSmrgm4_popdef([pkg_default])
1652688b3aecSmrgm4_popdef([pkg_description])
1653688b3aecSmrg])dnl PKG_INSTALLDIR
1654688b3aecSmrg
1655688b3aecSmrg
1656688b3aecSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1657688b3aecSmrgdnl --------------------------------
1658688b3aecSmrgdnl Since: 0.27
1659688b3aecSmrgdnl
1660688b3aecSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1661688b3aecSmrgdnl module should install arch-independent pkg-config .pc files. By
1662688b3aecSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1663688b3aecSmrgdnl changed by passing DIRECTORY. The user can override through the
1664688b3aecSmrgdnl --with-noarch-pkgconfigdir parameter.
1665688b3aecSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1666688b3aecSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1667688b3aecSmrgm4_pushdef([pkg_description],
1668688b3aecSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1669688b3aecSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1670688b3aecSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1671688b3aecSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1672688b3aecSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1673688b3aecSmrgm4_popdef([pkg_default])
1674688b3aecSmrgm4_popdef([pkg_description])
1675688b3aecSmrg])dnl PKG_NOARCH_INSTALLDIR
1676688b3aecSmrg
1677688b3aecSmrg
1678688b3aecSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1679688b3aecSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1680688b3aecSmrgdnl -------------------------------------------
1681688b3aecSmrgdnl Since: 0.28
1682688b3aecSmrgdnl
1683688b3aecSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1684688b3aecSmrgAC_DEFUN([PKG_CHECK_VAR],
1685688b3aecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1686688b3aecSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1687688b3aecSmrg
1688688b3aecSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1689688b3aecSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1690688b3aecSmrg
1691688b3aecSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1692688b3aecSmrg])dnl PKG_CHECK_VAR
1693688b3aecSmrg
1694688b3aecSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1695688b3aecSmrgdnl
1696688b3aecSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
1697688b3aecSmrgdnl
1698688b3aecSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1699688b3aecSmrgdnl copy of this software and associated documentation files (the "Software"),
1700688b3aecSmrgdnl to deal in the Software without restriction, including without limitation
1701688b3aecSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1702688b3aecSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1703688b3aecSmrgdnl Software is furnished to do so, subject to the following conditions:
1704688b3aecSmrgdnl
1705688b3aecSmrgdnl The above copyright notice and this permission notice (including the next
1706688b3aecSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1707688b3aecSmrgdnl Software.
1708688b3aecSmrgdnl
1709688b3aecSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1710688b3aecSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1711688b3aecSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1712688b3aecSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1713688b3aecSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1714688b3aecSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1715688b3aecSmrgdnl DEALINGS IN THE SOFTWARE.
1716688b3aecSmrg
1717688b3aecSmrg# XORG_MACROS_VERSION(required-version)
1718688b3aecSmrg# -------------------------------------
1719688b3aecSmrg# Minimum version: 1.1.0
1720688b3aecSmrg#
1721688b3aecSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1722688b3aecSmrg# your configure.ac with the minimum required version, such as:
1723688b3aecSmrg# XORG_MACROS_VERSION(1.1)
1724688b3aecSmrg#
1725688b3aecSmrg# To ensure that this macro is defined, also add:
1726688b3aecSmrg# m4_ifndef([XORG_MACROS_VERSION],
1727688b3aecSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1728688b3aecSmrg#
1729688b3aecSmrg#
1730688b3aecSmrg# See the "minimum version" comment for each macro you use to see what
1731688b3aecSmrg# version you require.
1732688b3aecSmrgm4_defun([XORG_MACROS_VERSION],[
1733688b3aecSmrgm4_define([vers_have], [1.19.0])
1734688b3aecSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1735688b3aecSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1736688b3aecSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1737688b3aecSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1738688b3aecSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1739688b3aecSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1740688b3aecSmrgm4_undefine([vers_have])
1741688b3aecSmrgm4_undefine([maj_have])
1742688b3aecSmrgm4_undefine([maj_needed])
1743688b3aecSmrg]) # XORG_MACROS_VERSION
1744688b3aecSmrg
1745688b3aecSmrg# XORG_PROG_RAWCPP()
1746688b3aecSmrg# ------------------
1747688b3aecSmrg# Minimum version: 1.0.0
1748688b3aecSmrg#
1749688b3aecSmrg# Find cpp program and necessary flags for use in pre-processing text files
1750688b3aecSmrg# such as man pages and config files
1751688b3aecSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1752688b3aecSmrgAC_REQUIRE([AC_PROG_CPP])
1753688b3aecSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1754688b3aecSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1755688b3aecSmrg
1756688b3aecSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1757688b3aecSmrg# which is not the best choice for supporting other OS'es, but covers most
1758688b3aecSmrg# of the ones we need for now.
1759688b3aecSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1760688b3aecSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1761688b3aecSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1762688b3aecSmrg	AC_MSG_RESULT([no])
1763688b3aecSmrgelse
1764688b3aecSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1765688b3aecSmrg		RAWCPPFLAGS=-undef
1766688b3aecSmrg		AC_MSG_RESULT([yes])
1767688b3aecSmrg	# under Cygwin unix is still defined even with -undef
1768688b3aecSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1769688b3aecSmrg		RAWCPPFLAGS="-undef -ansi"
1770688b3aecSmrg		AC_MSG_RESULT([yes, with -ansi])
1771688b3aecSmrg	else
1772688b3aecSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1773688b3aecSmrg	fi
1774688b3aecSmrgfi
1775688b3aecSmrgrm -f conftest.$ac_ext
1776688b3aecSmrg
1777688b3aecSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1778688b3aecSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1779688b3aecSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1780688b3aecSmrg	AC_MSG_RESULT([no])
1781688b3aecSmrgelse
1782688b3aecSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1783688b3aecSmrg		TRADITIONALCPPFLAGS="-traditional"
1784688b3aecSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1785688b3aecSmrg		AC_MSG_RESULT([yes])
1786688b3aecSmrg	else
1787688b3aecSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1788688b3aecSmrg	fi
1789688b3aecSmrgfi
1790688b3aecSmrgrm -f conftest.$ac_ext
1791688b3aecSmrgAC_SUBST(RAWCPPFLAGS)
1792688b3aecSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1793688b3aecSmrg]) # XORG_PROG_RAWCPP
1794688b3aecSmrg
1795688b3aecSmrg# XORG_MANPAGE_SECTIONS()
1796688b3aecSmrg# -----------------------
1797688b3aecSmrg# Minimum version: 1.0.0
1798688b3aecSmrg#
1799688b3aecSmrg# Determine which sections man pages go in for the different man page types
1800688b3aecSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1801688b3aecSmrg# Not sure if there's any better way than just hardcoding by OS name.
1802688b3aecSmrg# Override default settings by setting environment variables
1803688b3aecSmrg# Added MAN_SUBSTS in version 1.8
1804688b3aecSmrg# Added AC_PROG_SED in version 1.8
1805688b3aecSmrg
1806688b3aecSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1807688b3aecSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1808688b3aecSmrgAC_REQUIRE([AC_PROG_SED])
1809688b3aecSmrg
1810688b3aecSmrgif test x$APP_MAN_SUFFIX = x    ; then
1811688b3aecSmrg    APP_MAN_SUFFIX=1
1812688b3aecSmrgfi
1813688b3aecSmrgif test x$APP_MAN_DIR = x    ; then
1814688b3aecSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1815688b3aecSmrgfi
1816688b3aecSmrg
1817688b3aecSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1818688b3aecSmrg    LIB_MAN_SUFFIX=3
1819688b3aecSmrgfi
1820688b3aecSmrgif test x$LIB_MAN_DIR = x    ; then
1821688b3aecSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1822688b3aecSmrgfi
1823688b3aecSmrg
1824688b3aecSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1825688b3aecSmrg    case $host_os in
1826688b3aecSmrg	# Solaris 2.0 - 11 use SysV man page sections
1827688b3aecSmrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
1828688b3aecSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1829688b3aecSmrg    esac
1830688b3aecSmrgfi
1831688b3aecSmrgif test x$FILE_MAN_DIR = x    ; then
1832688b3aecSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1833688b3aecSmrgfi
1834688b3aecSmrg
1835688b3aecSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1836688b3aecSmrg    case $host_os in
1837688b3aecSmrg	# Solaris 2.0 - 11 use SysV man page sections
1838688b3aecSmrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
1839688b3aecSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1840688b3aecSmrg    esac
1841688b3aecSmrgfi
1842688b3aecSmrgif test x$MISC_MAN_DIR = x    ; then
1843688b3aecSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1844688b3aecSmrgfi
1845688b3aecSmrg
1846688b3aecSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1847688b3aecSmrg    case $host_os in
1848688b3aecSmrg	# Solaris 2.0 - 11 use SysV man page sections
1849688b3aecSmrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
1850688b3aecSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1851688b3aecSmrg    esac
1852688b3aecSmrgfi
1853688b3aecSmrgif test x$DRIVER_MAN_DIR = x    ; then
1854688b3aecSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1855688b3aecSmrgfi
1856688b3aecSmrg
1857688b3aecSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1858688b3aecSmrg    case $host_os in
1859688b3aecSmrg	# Solaris 2.0 - 11 use SysV man page sections
1860688b3aecSmrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
1861688b3aecSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1862688b3aecSmrg    esac
1863688b3aecSmrgfi
1864688b3aecSmrgif test x$ADMIN_MAN_DIR = x    ; then
1865688b3aecSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1866688b3aecSmrgfi
1867688b3aecSmrg
1868688b3aecSmrg
1869688b3aecSmrgAC_SUBST([APP_MAN_SUFFIX])
1870688b3aecSmrgAC_SUBST([LIB_MAN_SUFFIX])
1871688b3aecSmrgAC_SUBST([FILE_MAN_SUFFIX])
1872688b3aecSmrgAC_SUBST([MISC_MAN_SUFFIX])
1873688b3aecSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1874688b3aecSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1875688b3aecSmrgAC_SUBST([APP_MAN_DIR])
1876688b3aecSmrgAC_SUBST([LIB_MAN_DIR])
1877688b3aecSmrgAC_SUBST([FILE_MAN_DIR])
1878688b3aecSmrgAC_SUBST([MISC_MAN_DIR])
1879688b3aecSmrgAC_SUBST([DRIVER_MAN_DIR])
1880688b3aecSmrgAC_SUBST([ADMIN_MAN_DIR])
1881688b3aecSmrg
1882688b3aecSmrgXORG_MAN_PAGE="X Version 11"
1883688b3aecSmrgAC_SUBST([XORG_MAN_PAGE])
1884688b3aecSmrgMAN_SUBSTS="\
1885688b3aecSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1886688b3aecSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1887688b3aecSmrg	-e 's|__xservername__|Xorg|g' \
1888688b3aecSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1889688b3aecSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1890688b3aecSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1891688b3aecSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1892688b3aecSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1893688b3aecSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1894688b3aecSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1895688b3aecSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1896688b3aecSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1897688b3aecSmrgAC_SUBST([MAN_SUBSTS])
1898688b3aecSmrg
1899688b3aecSmrg]) # XORG_MANPAGE_SECTIONS
1900688b3aecSmrg
1901688b3aecSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1902688b3aecSmrg# ------------------------
1903688b3aecSmrg# Minimum version: 1.7.0
1904688b3aecSmrg#
1905688b3aecSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1906688b3aecSmrg# provided by xorg-sgml-doctools, if installed.
1907688b3aecSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1908688b3aecSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1909688b3aecSmrgXORG_SGML_PATH=
1910688b3aecSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1911688b3aecSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1912688b3aecSmrg    [m4_ifval([$1],[:],
1913688b3aecSmrg        [if test x"$cross_compiling" != x"yes" ; then
1914688b3aecSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1915688b3aecSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1916688b3aecSmrg         fi])
1917688b3aecSmrg    ])
1918688b3aecSmrg
1919688b3aecSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1920688b3aecSmrg# the path and the name of the doc stylesheet
1921688b3aecSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1922688b3aecSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1923688b3aecSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1924688b3aecSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1925688b3aecSmrgelse
1926688b3aecSmrg   AC_MSG_RESULT([no])
1927688b3aecSmrgfi
1928688b3aecSmrg
1929688b3aecSmrgAC_SUBST(XORG_SGML_PATH)
1930688b3aecSmrgAC_SUBST(STYLESHEET_SRCDIR)
1931688b3aecSmrgAC_SUBST(XSL_STYLESHEET)
1932688b3aecSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1933688b3aecSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1934688b3aecSmrg
1935688b3aecSmrg# XORG_CHECK_LINUXDOC
1936688b3aecSmrg# -------------------
1937688b3aecSmrg# Minimum version: 1.0.0
1938688b3aecSmrg#
1939688b3aecSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1940688b3aecSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1941688b3aecSmrg# Whether or not the necessary tools and files are found can be checked
1942688b3aecSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1943688b3aecSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1944688b3aecSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1945688b3aecSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1946688b3aecSmrg
1947688b3aecSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1948688b3aecSmrg
1949688b3aecSmrgAC_MSG_CHECKING([whether to build documentation])
1950688b3aecSmrg
1951688b3aecSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1952688b3aecSmrg   BUILDDOC=yes
1953688b3aecSmrgelse
1954688b3aecSmrg   BUILDDOC=no
1955688b3aecSmrgfi
1956688b3aecSmrg
1957688b3aecSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1958688b3aecSmrg
1959688b3aecSmrgAC_MSG_RESULT([$BUILDDOC])
1960688b3aecSmrg
1961688b3aecSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1962688b3aecSmrg
1963688b3aecSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1964688b3aecSmrg   BUILDPDFDOC=yes
1965688b3aecSmrgelse
1966688b3aecSmrg   BUILDPDFDOC=no
1967688b3aecSmrgfi
1968688b3aecSmrg
1969688b3aecSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1970688b3aecSmrg
1971688b3aecSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1972688b3aecSmrg
1973688b3aecSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1974688b3aecSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1975688b3aecSmrgMAKE_PDF="$PS2PDF"
1976688b3aecSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1977688b3aecSmrg
1978688b3aecSmrgAC_SUBST(MAKE_TEXT)
1979688b3aecSmrgAC_SUBST(MAKE_PS)
1980688b3aecSmrgAC_SUBST(MAKE_PDF)
1981688b3aecSmrgAC_SUBST(MAKE_HTML)
1982688b3aecSmrg]) # XORG_CHECK_LINUXDOC
1983688b3aecSmrg
1984688b3aecSmrg# XORG_CHECK_DOCBOOK
1985688b3aecSmrg# -------------------
1986688b3aecSmrg# Minimum version: 1.0.0
1987688b3aecSmrg#
1988688b3aecSmrg# Checks for the ability to build output formats from SGML DocBook source.
1989688b3aecSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1990688b3aecSmrg# indicates whether the necessary tools and files are found and, if set,
1991688b3aecSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1992688b3aecSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1993688b3aecSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1994688b3aecSmrg
1995688b3aecSmrgBUILDTXTDOC=no
1996688b3aecSmrgBUILDPDFDOC=no
1997688b3aecSmrgBUILDPSDOC=no
1998688b3aecSmrgBUILDHTMLDOC=no
1999688b3aecSmrg
2000688b3aecSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
2001688b3aecSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
2002688b3aecSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
2003688b3aecSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
2004688b3aecSmrg
2005688b3aecSmrgAC_MSG_CHECKING([whether to build text documentation])
2006688b3aecSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
2007688b3aecSmrg   test x$BUILD_TXTDOC != xno; then
2008688b3aecSmrg	BUILDTXTDOC=yes
2009688b3aecSmrgfi
2010688b3aecSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
2011688b3aecSmrgAC_MSG_RESULT([$BUILDTXTDOC])
2012688b3aecSmrg
2013688b3aecSmrgAC_MSG_CHECKING([whether to build PDF documentation])
2014688b3aecSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
2015688b3aecSmrg   test x$BUILD_PDFDOC != xno; then
2016688b3aecSmrg	BUILDPDFDOC=yes
2017688b3aecSmrgfi
2018688b3aecSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2019688b3aecSmrgAC_MSG_RESULT([$BUILDPDFDOC])
2020688b3aecSmrg
2021688b3aecSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
2022688b3aecSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
2023688b3aecSmrg   test x$BUILD_PSDOC != xno; then
2024688b3aecSmrg	BUILDPSDOC=yes
2025688b3aecSmrgfi
2026688b3aecSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
2027688b3aecSmrgAC_MSG_RESULT([$BUILDPSDOC])
2028688b3aecSmrg
2029688b3aecSmrgAC_MSG_CHECKING([whether to build HTML documentation])
2030688b3aecSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
2031688b3aecSmrg   test x$BUILD_HTMLDOC != xno; then
2032688b3aecSmrg	BUILDHTMLDOC=yes
2033688b3aecSmrgfi
2034688b3aecSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
2035688b3aecSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
2036688b3aecSmrg
2037688b3aecSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
2038688b3aecSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
2039688b3aecSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
2040688b3aecSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
2041688b3aecSmrg
2042688b3aecSmrgAC_SUBST(MAKE_TEXT)
2043688b3aecSmrgAC_SUBST(MAKE_PS)
2044688b3aecSmrgAC_SUBST(MAKE_PDF)
2045688b3aecSmrgAC_SUBST(MAKE_HTML)
2046688b3aecSmrg]) # XORG_CHECK_DOCBOOK
2047688b3aecSmrg
2048688b3aecSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
2049688b3aecSmrg# ----------------
2050688b3aecSmrg# Minimum version: 1.5.0
2051688b3aecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2052688b3aecSmrg#
2053688b3aecSmrg# Documentation tools are not always available on all platforms and sometimes
2054688b3aecSmrg# not at the appropriate level. This macro enables a module to test for the
2055688b3aecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2056688b3aecSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
2057688b3aecSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
2058688b3aecSmrg# --with-xmlto assumes 'auto'.
2059688b3aecSmrg#
2060688b3aecSmrg# Interface to module:
2061688b3aecSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
2062688b3aecSmrg# XMLTO:	returns the path of the xmlto program found
2063688b3aecSmrg#		returns the path set by the user in the environment
2064688b3aecSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
2065688b3aecSmrg#		'no' user instructs the module not to use xmlto
2066688b3aecSmrg#
2067688b3aecSmrg# Added in version 1.10.0
2068688b3aecSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
2069688b3aecSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
2070688b3aecSmrg#
2071688b3aecSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
2072688b3aecSmrg#
2073688b3aecSmrgAC_DEFUN([XORG_WITH_XMLTO],[
2074688b3aecSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
2075688b3aecSmrgm4_define([_defopt], m4_default([$2], [auto]))
2076688b3aecSmrgAC_ARG_WITH(xmlto,
2077688b3aecSmrg	AS_HELP_STRING([--with-xmlto],
2078688b3aecSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
2079688b3aecSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
2080688b3aecSmrgm4_undefine([_defopt])
2081688b3aecSmrg
2082688b3aecSmrgif test "x$use_xmlto" = x"auto"; then
2083688b3aecSmrg   AC_PATH_PROG([XMLTO], [xmlto])
2084688b3aecSmrg   if test "x$XMLTO" = "x"; then
2085688b3aecSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
2086688b3aecSmrg	have_xmlto=no
2087688b3aecSmrg   else
2088688b3aecSmrg        have_xmlto=yes
2089688b3aecSmrg   fi
2090688b3aecSmrgelif test "x$use_xmlto" = x"yes" ; then
2091688b3aecSmrg   AC_PATH_PROG([XMLTO], [xmlto])
2092688b3aecSmrg   if test "x$XMLTO" = "x"; then
2093688b3aecSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
2094688b3aecSmrg   fi
2095688b3aecSmrg   have_xmlto=yes
2096688b3aecSmrgelif test "x$use_xmlto" = x"no" ; then
2097688b3aecSmrg   if test "x$XMLTO" != "x"; then
2098688b3aecSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
2099688b3aecSmrg   fi
2100688b3aecSmrg   have_xmlto=no
2101688b3aecSmrgelse
2102688b3aecSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2103688b3aecSmrgfi
2104688b3aecSmrg
2105688b3aecSmrg# Test for a minimum version of xmlto, if provided.
2106688b3aecSmrgm4_ifval([$1],
2107688b3aecSmrg[if test "$have_xmlto" = yes; then
2108688b3aecSmrg    # scrape the xmlto version
2109688b3aecSmrg    AC_MSG_CHECKING([the xmlto version])
2110688b3aecSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2111688b3aecSmrg    AC_MSG_RESULT([$xmlto_version])
2112688b3aecSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2113688b3aecSmrg        [if test "x$use_xmlto" = xauto; then
2114688b3aecSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2115688b3aecSmrg            have_xmlto=no
2116688b3aecSmrg        else
2117688b3aecSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2118688b3aecSmrg        fi])
2119688b3aecSmrgfi])
2120688b3aecSmrg
2121688b3aecSmrg# Test for the ability of xmlto to generate a text target
2122688b3aecSmrg#
2123688b3aecSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2124688b3aecSmrg# following test for empty XML docbook files.
2125688b3aecSmrg# For compatibility reasons use the following empty XML docbook file and if
2126688b3aecSmrg# it fails try it again with a non-empty XML file.
2127688b3aecSmrghave_xmlto_text=no
2128688b3aecSmrgcat > conftest.xml << "EOF"
2129688b3aecSmrgEOF
2130688b3aecSmrgAS_IF([test "$have_xmlto" = yes],
2131688b3aecSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2132688b3aecSmrg             [have_xmlto_text=yes],
2133688b3aecSmrg             [# Try it again with a non-empty XML file.
2134688b3aecSmrg              cat > conftest.xml << "EOF"
2135688b3aecSmrg<x></x>
2136688b3aecSmrgEOF
2137688b3aecSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2138688b3aecSmrg                    [have_xmlto_text=yes],
2139688b3aecSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2140688b3aecSmrgrm -f conftest.xml
2141688b3aecSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2142688b3aecSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2143688b3aecSmrg]) # XORG_WITH_XMLTO
2144688b3aecSmrg
2145688b3aecSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2146688b3aecSmrg# --------------------------------------------
2147688b3aecSmrg# Minimum version: 1.12.0
2148688b3aecSmrg# Minimum version for optional DEFAULT argument: 1.12.0
2149688b3aecSmrg#
2150688b3aecSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2151688b3aecSmrg# XML-based language used for the transformation of XML documents.
2152688b3aecSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2153688b3aecSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2154688b3aecSmrg# The XSLT processor is often used as a standalone tool for transformations.
2155688b3aecSmrg# It should not be assumed that this tool is used only to work with documnetation.
2156688b3aecSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2157688b3aecSmrg#
2158688b3aecSmrg# Interface to module:
2159688b3aecSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2160688b3aecSmrg# XSLTPROC:	 returns the path of the xsltproc program found
2161688b3aecSmrg#		 returns the path set by the user in the environment
2162688b3aecSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2163688b3aecSmrg#		  'no' user instructs the module not to use xsltproc
2164688b3aecSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2165688b3aecSmrg#
2166688b3aecSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2167688b3aecSmrg#
2168688b3aecSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2169688b3aecSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2170688b3aecSmrg# Preserves the interface, should it be implemented later
2171688b3aecSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2172688b3aecSmrgm4_define([_defopt], m4_default([$2], [auto]))
2173688b3aecSmrgAC_ARG_WITH(xsltproc,
2174688b3aecSmrg	AS_HELP_STRING([--with-xsltproc],
2175688b3aecSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2176688b3aecSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2177688b3aecSmrgm4_undefine([_defopt])
2178688b3aecSmrg
2179688b3aecSmrgif test "x$use_xsltproc" = x"auto"; then
2180688b3aecSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2181688b3aecSmrg   if test "x$XSLTPROC" = "x"; then
2182688b3aecSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2183688b3aecSmrg	have_xsltproc=no
2184688b3aecSmrg   else
2185688b3aecSmrg        have_xsltproc=yes
2186688b3aecSmrg   fi
2187688b3aecSmrgelif test "x$use_xsltproc" = x"yes" ; then
2188688b3aecSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2189688b3aecSmrg   if test "x$XSLTPROC" = "x"; then
2190688b3aecSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2191688b3aecSmrg   fi
2192688b3aecSmrg   have_xsltproc=yes
2193688b3aecSmrgelif test "x$use_xsltproc" = x"no" ; then
2194688b3aecSmrg   if test "x$XSLTPROC" != "x"; then
2195688b3aecSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2196688b3aecSmrg   fi
2197688b3aecSmrg   have_xsltproc=no
2198688b3aecSmrgelse
2199688b3aecSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2200688b3aecSmrgfi
2201688b3aecSmrg
2202688b3aecSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2203688b3aecSmrg]) # XORG_WITH_XSLTPROC
2204688b3aecSmrg
2205688b3aecSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2206688b3aecSmrg# ----------------------------------------
2207688b3aecSmrg# Minimum version: 1.15.0
2208688b3aecSmrg#
2209688b3aecSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
2210688b3aecSmrg# scanning arbitrary text files, extracting information from those text files,
2211688b3aecSmrg# and printing reports based on that information.
2212688b3aecSmrg#
2213688b3aecSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2214688b3aecSmrg#
2215688b3aecSmrg# Interface to module:
2216688b3aecSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
2217688b3aecSmrg# PERL:	     returns the path of the perl program found
2218688b3aecSmrg#	     returns the path set by the user in the environment
2219688b3aecSmrg# --with-perl: 'yes' user instructs the module to use perl
2220688b3aecSmrg#	       'no' user instructs the module not to use perl
2221688b3aecSmrg# have_perl: returns yes if perl found in PATH or no
2222688b3aecSmrg#
2223688b3aecSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2224688b3aecSmrg#
2225688b3aecSmrgAC_DEFUN([XORG_WITH_PERL],[
2226688b3aecSmrgAC_ARG_VAR([PERL], [Path to perl command])
2227688b3aecSmrg# Preserves the interface, should it be implemented later
2228688b3aecSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2229688b3aecSmrgm4_define([_defopt], m4_default([$2], [auto]))
2230688b3aecSmrgAC_ARG_WITH(perl,
2231688b3aecSmrg	AS_HELP_STRING([--with-perl],
2232688b3aecSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2233688b3aecSmrg	   [use_perl=$withval], [use_perl=]_defopt)
2234688b3aecSmrgm4_undefine([_defopt])
2235688b3aecSmrg
2236688b3aecSmrgif test "x$use_perl" = x"auto"; then
2237688b3aecSmrg   AC_PATH_PROG([PERL], [perl])
2238688b3aecSmrg   if test "x$PERL" = "x"; then
2239688b3aecSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2240688b3aecSmrg	have_perl=no
2241688b3aecSmrg   else
2242688b3aecSmrg        have_perl=yes
2243688b3aecSmrg   fi
2244688b3aecSmrgelif test "x$use_perl" = x"yes" ; then
2245688b3aecSmrg   AC_PATH_PROG([PERL], [perl])
2246688b3aecSmrg   if test "x$PERL" = "x"; then
2247688b3aecSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2248688b3aecSmrg   fi
2249688b3aecSmrg   have_perl=yes
2250688b3aecSmrgelif test "x$use_perl" = x"no" ; then
2251688b3aecSmrg   if test "x$PERL" != "x"; then
2252688b3aecSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2253688b3aecSmrg   fi
2254688b3aecSmrg   have_perl=no
2255688b3aecSmrgelse
2256688b3aecSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2257688b3aecSmrgfi
2258688b3aecSmrg
2259688b3aecSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2260688b3aecSmrg]) # XORG_WITH_PERL
2261688b3aecSmrg
2262688b3aecSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2263688b3aecSmrg# ----------------
2264688b3aecSmrg# Minimum version: 1.5.0
2265688b3aecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2266688b3aecSmrg#
2267688b3aecSmrg# Documentation tools are not always available on all platforms and sometimes
2268688b3aecSmrg# not at the appropriate level. This macro enables a module to test for the
2269688b3aecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2270688b3aecSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
2271688b3aecSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2272688b3aecSmrg# --with-asciidoc assumes 'auto'.
2273688b3aecSmrg#
2274688b3aecSmrg# Interface to module:
2275688b3aecSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2276688b3aecSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2277688b3aecSmrg#		 returns the path set by the user in the environment
2278688b3aecSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2279688b3aecSmrg#		  'no' user instructs the module not to use asciidoc
2280688b3aecSmrg#
2281688b3aecSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2282688b3aecSmrg#
2283688b3aecSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2284688b3aecSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2285688b3aecSmrgm4_define([_defopt], m4_default([$2], [auto]))
2286688b3aecSmrgAC_ARG_WITH(asciidoc,
2287688b3aecSmrg	AS_HELP_STRING([--with-asciidoc],
2288688b3aecSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2289688b3aecSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2290688b3aecSmrgm4_undefine([_defopt])
2291688b3aecSmrg
2292688b3aecSmrgif test "x$use_asciidoc" = x"auto"; then
2293688b3aecSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2294688b3aecSmrg   if test "x$ASCIIDOC" = "x"; then
2295688b3aecSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2296688b3aecSmrg	have_asciidoc=no
2297688b3aecSmrg   else
2298688b3aecSmrg        have_asciidoc=yes
2299688b3aecSmrg   fi
2300688b3aecSmrgelif test "x$use_asciidoc" = x"yes" ; then
2301688b3aecSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2302688b3aecSmrg   if test "x$ASCIIDOC" = "x"; then
2303688b3aecSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2304688b3aecSmrg   fi
2305688b3aecSmrg   have_asciidoc=yes
2306688b3aecSmrgelif test "x$use_asciidoc" = x"no" ; then
2307688b3aecSmrg   if test "x$ASCIIDOC" != "x"; then
2308688b3aecSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2309688b3aecSmrg   fi
2310688b3aecSmrg   have_asciidoc=no
2311688b3aecSmrgelse
2312688b3aecSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2313688b3aecSmrgfi
2314688b3aecSmrgm4_ifval([$1],
2315688b3aecSmrg[if test "$have_asciidoc" = yes; then
2316688b3aecSmrg    # scrape the asciidoc version
2317688b3aecSmrg    AC_MSG_CHECKING([the asciidoc version])
2318688b3aecSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2319688b3aecSmrg    AC_MSG_RESULT([$asciidoc_version])
2320688b3aecSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2321688b3aecSmrg        [if test "x$use_asciidoc" = xauto; then
2322688b3aecSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2323688b3aecSmrg            have_asciidoc=no
2324688b3aecSmrg        else
2325688b3aecSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2326688b3aecSmrg        fi])
2327688b3aecSmrgfi])
2328688b3aecSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2329688b3aecSmrg]) # XORG_WITH_ASCIIDOC
2330688b3aecSmrg
2331688b3aecSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2332688b3aecSmrg# -------------------------------------------
2333688b3aecSmrg# Minimum version: 1.5.0
2334688b3aecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2335688b3aecSmrg# Minimum version for optional DOT checking: 1.18.0
2336688b3aecSmrg#
2337688b3aecSmrg# Documentation tools are not always available on all platforms and sometimes
2338688b3aecSmrg# not at the appropriate level. This macro enables a module to test for the
2339688b3aecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2340688b3aecSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
2341688b3aecSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2342688b3aecSmrg# --with-doxygen assumes 'auto'.
2343688b3aecSmrg#
2344688b3aecSmrg# Interface to module:
2345688b3aecSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2346688b3aecSmrg# DOXYGEN:	 returns the path of the doxygen program found
2347688b3aecSmrg#		 returns the path set by the user in the environment
2348688b3aecSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2349688b3aecSmrg#		  'no' user instructs the module not to use doxygen
2350688b3aecSmrg#
2351688b3aecSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2352688b3aecSmrg#
2353688b3aecSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2354688b3aecSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2355688b3aecSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2356688b3aecSmrgm4_define([_defopt], m4_default([$2], [auto]))
2357688b3aecSmrgAC_ARG_WITH(doxygen,
2358688b3aecSmrg	AS_HELP_STRING([--with-doxygen],
2359688b3aecSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2360688b3aecSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2361688b3aecSmrgm4_undefine([_defopt])
2362688b3aecSmrg
2363688b3aecSmrgif test "x$use_doxygen" = x"auto"; then
2364688b3aecSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2365688b3aecSmrg   if test "x$DOXYGEN" = "x"; then
2366688b3aecSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2367688b3aecSmrg	have_doxygen=no
2368688b3aecSmrg   else
2369688b3aecSmrg        have_doxygen=yes
2370688b3aecSmrg   fi
2371688b3aecSmrgelif test "x$use_doxygen" = x"yes" ; then
2372688b3aecSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2373688b3aecSmrg   if test "x$DOXYGEN" = "x"; then
2374688b3aecSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2375688b3aecSmrg   fi
2376688b3aecSmrg   have_doxygen=yes
2377688b3aecSmrgelif test "x$use_doxygen" = x"no" ; then
2378688b3aecSmrg   if test "x$DOXYGEN" != "x"; then
2379688b3aecSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2380688b3aecSmrg   fi
2381688b3aecSmrg   have_doxygen=no
2382688b3aecSmrgelse
2383688b3aecSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2384688b3aecSmrgfi
2385688b3aecSmrgm4_ifval([$1],
2386688b3aecSmrg[if test "$have_doxygen" = yes; then
2387688b3aecSmrg    # scrape the doxygen version
2388688b3aecSmrg    AC_MSG_CHECKING([the doxygen version])
2389688b3aecSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2390688b3aecSmrg    AC_MSG_RESULT([$doxygen_version])
2391688b3aecSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2392688b3aecSmrg        [if test "x$use_doxygen" = xauto; then
2393688b3aecSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2394688b3aecSmrg            have_doxygen=no
2395688b3aecSmrg        else
2396688b3aecSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2397688b3aecSmrg        fi])
2398688b3aecSmrgfi])
2399688b3aecSmrg
2400688b3aecSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2401688b3aecSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2402688b3aecSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2403688b3aecSmrgHAVE_DOT=no
2404688b3aecSmrgif test "x$have_doxygen" = "xyes"; then
2405688b3aecSmrg  AC_PATH_PROG([DOT], [dot])
2406688b3aecSmrg    if test "x$DOT" != "x"; then
2407688b3aecSmrg      HAVE_DOT=yes
2408688b3aecSmrg    fi
2409688b3aecSmrgfi
2410688b3aecSmrg
2411688b3aecSmrgAC_SUBST([HAVE_DOT])
2412688b3aecSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2413688b3aecSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2414688b3aecSmrg]) # XORG_WITH_DOXYGEN
2415688b3aecSmrg
2416688b3aecSmrg# XORG_WITH_GROFF([DEFAULT])
2417688b3aecSmrg# ----------------
2418688b3aecSmrg# Minimum version: 1.6.0
2419688b3aecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2420688b3aecSmrg#
2421688b3aecSmrg# Documentation tools are not always available on all platforms and sometimes
2422688b3aecSmrg# not at the appropriate level. This macro enables a module to test for the
2423688b3aecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2424688b3aecSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2425688b3aecSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2426688b3aecSmrg# --with-groff assumes 'auto'.
2427688b3aecSmrg#
2428688b3aecSmrg# Interface to module:
2429688b3aecSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2430688b3aecSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2431688b3aecSmrg# HAVE_GROFF_MS: the -ms macros package
2432688b3aecSmrg# GROFF:	 returns the path of the groff program found
2433688b3aecSmrg#		 returns the path set by the user in the environment
2434688b3aecSmrg# --with-groff:	 'yes' user instructs the module to use groff
2435688b3aecSmrg#		 'no' user instructs the module not to use groff
2436688b3aecSmrg#
2437688b3aecSmrg# Added in version 1.9.0:
2438688b3aecSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2439688b3aecSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2440688b3aecSmrg#		   psselect from the psutils package.
2441688b3aecSmrg#		   the ghostcript package. Refer to the grohtml man pages
2442688b3aecSmrg#
2443688b3aecSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2444688b3aecSmrg#
2445688b3aecSmrg# OS and distros often splits groff in a basic and full package, the former
2446688b3aecSmrg# having the groff program and the later having devices, fonts and macros
2447688b3aecSmrg# Checking for the groff executable is not enough.
2448688b3aecSmrg#
2449688b3aecSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2450688b3aecSmrg# unset HAVE_GROFF or GROFF env variables.
2451688b3aecSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2452688b3aecSmrg#
2453688b3aecSmrgAC_DEFUN([XORG_WITH_GROFF],[
2454688b3aecSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2455688b3aecSmrgm4_define([_defopt], m4_default([$1], [auto]))
2456688b3aecSmrgAC_ARG_WITH(groff,
2457688b3aecSmrg	AS_HELP_STRING([--with-groff],
2458688b3aecSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2459688b3aecSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2460688b3aecSmrgm4_undefine([_defopt])
2461688b3aecSmrg
2462688b3aecSmrgif test "x$use_groff" = x"auto"; then
2463688b3aecSmrg   AC_PATH_PROG([GROFF], [groff])
2464688b3aecSmrg   if test "x$GROFF" = "x"; then
2465688b3aecSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2466688b3aecSmrg	have_groff=no
2467688b3aecSmrg   else
2468688b3aecSmrg        have_groff=yes
2469688b3aecSmrg   fi
2470688b3aecSmrgelif test "x$use_groff" = x"yes" ; then
2471688b3aecSmrg   AC_PATH_PROG([GROFF], [groff])
2472688b3aecSmrg   if test "x$GROFF" = "x"; then
2473688b3aecSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2474688b3aecSmrg   fi
2475688b3aecSmrg   have_groff=yes
2476688b3aecSmrgelif test "x$use_groff" = x"no" ; then
2477688b3aecSmrg   if test "x$GROFF" != "x"; then
2478688b3aecSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2479688b3aecSmrg   fi
2480688b3aecSmrg   have_groff=no
2481688b3aecSmrgelse
2482688b3aecSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2483688b3aecSmrgfi
2484688b3aecSmrg
2485688b3aecSmrg# We have groff, test for the presence of the macro packages
2486688b3aecSmrgif test "x$have_groff" = x"yes"; then
2487688b3aecSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2488688b3aecSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2489688b3aecSmrg        groff_ms_works=yes
2490688b3aecSmrg    else
2491688b3aecSmrg        groff_ms_works=no
2492309c398aSmrg    fi
2493688b3aecSmrg    AC_MSG_RESULT([$groff_ms_works])
2494688b3aecSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2495688b3aecSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2496688b3aecSmrg        groff_mm_works=yes
2497688b3aecSmrg    else
2498688b3aecSmrg        groff_mm_works=no
2499688b3aecSmrg    fi
2500688b3aecSmrg    AC_MSG_RESULT([$groff_mm_works])
2501688b3aecSmrgfi
2502688b3aecSmrg
2503688b3aecSmrg# We have groff, test for HTML dependencies, one command per package
2504688b3aecSmrgif test "x$have_groff" = x"yes"; then
2505688b3aecSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2506688b3aecSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2507688b3aecSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2508688b3aecSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2509688b3aecSmrg      have_groff_html=yes
2510688b3aecSmrg   else
2511688b3aecSmrg      have_groff_html=no
2512688b3aecSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2513688b3aecSmrg   fi
2514688b3aecSmrgfi
2515688b3aecSmrg
2516688b3aecSmrg# Set Automake conditionals for Makefiles
2517688b3aecSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2518688b3aecSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2519688b3aecSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2520688b3aecSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2521688b3aecSmrg]) # XORG_WITH_GROFF
2522688b3aecSmrg
2523688b3aecSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2524688b3aecSmrg# ---------------------------------------
2525688b3aecSmrg# Minimum version: 1.6.0
2526688b3aecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2527688b3aecSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2528688b3aecSmrg#
2529688b3aecSmrg# Documentation tools are not always available on all platforms and sometimes
2530688b3aecSmrg# not at the appropriate level. This macro enables a module to test for the
2531688b3aecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2532688b3aecSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2533688b3aecSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2534688b3aecSmrg# --with-fop assumes 'auto'.
2535688b3aecSmrg#
2536688b3aecSmrg# Interface to module:
2537688b3aecSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2538688b3aecSmrg# FOP:	 	returns the path of the fop program found
2539688b3aecSmrg#		returns the path set by the user in the environment
2540688b3aecSmrg# --with-fop: 	'yes' user instructs the module to use fop
2541688b3aecSmrg#		'no' user instructs the module not to use fop
2542688b3aecSmrg#
2543688b3aecSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2544688b3aecSmrg#
2545688b3aecSmrgAC_DEFUN([XORG_WITH_FOP],[
2546688b3aecSmrgAC_ARG_VAR([FOP], [Path to fop command])
2547688b3aecSmrgm4_define([_defopt], m4_default([$2], [auto]))
2548688b3aecSmrgAC_ARG_WITH(fop,
2549688b3aecSmrg	AS_HELP_STRING([--with-fop],
2550688b3aecSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2551688b3aecSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2552688b3aecSmrgm4_undefine([_defopt])
2553688b3aecSmrg
2554688b3aecSmrgif test "x$use_fop" = x"auto"; then
2555688b3aecSmrg   AC_PATH_PROG([FOP], [fop])
2556688b3aecSmrg   if test "x$FOP" = "x"; then
2557688b3aecSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2558688b3aecSmrg	have_fop=no
2559688b3aecSmrg   else
2560688b3aecSmrg        have_fop=yes
2561688b3aecSmrg   fi
2562688b3aecSmrgelif test "x$use_fop" = x"yes" ; then
2563688b3aecSmrg   AC_PATH_PROG([FOP], [fop])
2564688b3aecSmrg   if test "x$FOP" = "x"; then
2565688b3aecSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2566688b3aecSmrg   fi
2567688b3aecSmrg   have_fop=yes
2568688b3aecSmrgelif test "x$use_fop" = x"no" ; then
2569688b3aecSmrg   if test "x$FOP" != "x"; then
2570688b3aecSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2571688b3aecSmrg   fi
2572688b3aecSmrg   have_fop=no
2573688b3aecSmrgelse
2574688b3aecSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2575688b3aecSmrgfi
2576688b3aecSmrg
2577688b3aecSmrg# Test for a minimum version of fop, if provided.
2578688b3aecSmrgm4_ifval([$1],
2579688b3aecSmrg[if test "$have_fop" = yes; then
2580688b3aecSmrg    # scrape the fop version
2581688b3aecSmrg    AC_MSG_CHECKING([for fop minimum version])
2582688b3aecSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2583688b3aecSmrg    AC_MSG_RESULT([$fop_version])
2584688b3aecSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2585688b3aecSmrg        [if test "x$use_fop" = xauto; then
2586688b3aecSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2587688b3aecSmrg            have_fop=no
2588688b3aecSmrg        else
2589688b3aecSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2590688b3aecSmrg        fi])
2591688b3aecSmrgfi])
2592688b3aecSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2593688b3aecSmrg]) # XORG_WITH_FOP
2594688b3aecSmrg
2595688b3aecSmrg# XORG_WITH_M4([MIN-VERSION])
2596688b3aecSmrg# ---------------------------
2597688b3aecSmrg# Minimum version: 1.19.0
2598688b3aecSmrg#
2599688b3aecSmrg# This macro attempts to locate an m4 macro processor which supports
2600688b3aecSmrg# -I option and is only useful for modules relying on M4 in order to
2601688b3aecSmrg# expand macros in source code files.
2602688b3aecSmrg#
2603688b3aecSmrg# Interface to module:
2604688b3aecSmrg# M4:	 	returns the path of the m4 program found
2605688b3aecSmrg#		returns the path set by the user in the environment
2606688b3aecSmrg#
2607688b3aecSmrgAC_DEFUN([XORG_WITH_M4], [
2608688b3aecSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2609688b3aecSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2610688b3aecSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2611688b3aecSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2612688b3aecSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2613688b3aecSmrg   [$PATH:/usr/gnu/bin])])
2614688b3aecSmrg
2615688b3aecSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2616688b3aecSmrg]) # XORG_WITH_M4
2617688b3aecSmrg
2618688b3aecSmrg# XORG_WITH_PS2PDF([DEFAULT])
2619688b3aecSmrg# ----------------
2620688b3aecSmrg# Minimum version: 1.6.0
2621688b3aecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2622688b3aecSmrg#
2623688b3aecSmrg# Documentation tools are not always available on all platforms and sometimes
2624688b3aecSmrg# not at the appropriate level. This macro enables a module to test for the
2625688b3aecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2626688b3aecSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2627688b3aecSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2628688b3aecSmrg# --with-ps2pdf assumes 'auto'.
2629688b3aecSmrg#
2630688b3aecSmrg# Interface to module:
2631688b3aecSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2632688b3aecSmrg# PS2PDF:	returns the path of the ps2pdf program found
2633688b3aecSmrg#		returns the path set by the user in the environment
2634688b3aecSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2635688b3aecSmrg#		 'no' user instructs the module not to use ps2pdf
2636688b3aecSmrg#
2637688b3aecSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2638688b3aecSmrg#
2639688b3aecSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2640688b3aecSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2641688b3aecSmrgm4_define([_defopt], m4_default([$1], [auto]))
2642688b3aecSmrgAC_ARG_WITH(ps2pdf,
2643688b3aecSmrg	AS_HELP_STRING([--with-ps2pdf],
2644688b3aecSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2645688b3aecSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2646688b3aecSmrgm4_undefine([_defopt])
26478903d43aSmrg
2648688b3aecSmrgif test "x$use_ps2pdf" = x"auto"; then
2649688b3aecSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2650688b3aecSmrg   if test "x$PS2PDF" = "x"; then
2651688b3aecSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2652688b3aecSmrg	have_ps2pdf=no
2653688b3aecSmrg   else
2654688b3aecSmrg        have_ps2pdf=yes
2655688b3aecSmrg   fi
2656688b3aecSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2657688b3aecSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2658688b3aecSmrg   if test "x$PS2PDF" = "x"; then
2659688b3aecSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2660688b3aecSmrg   fi
2661688b3aecSmrg   have_ps2pdf=yes
2662688b3aecSmrgelif test "x$use_ps2pdf" = x"no" ; then
2663688b3aecSmrg   if test "x$PS2PDF" != "x"; then
2664688b3aecSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2665688b3aecSmrg   fi
2666688b3aecSmrg   have_ps2pdf=no
2667688b3aecSmrgelse
2668688b3aecSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2669688b3aecSmrgfi
2670688b3aecSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2671688b3aecSmrg]) # XORG_WITH_PS2PDF
26728903d43aSmrg
2673688b3aecSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2674688b3aecSmrg# ----------------
2675688b3aecSmrg# Minimum version: 1.6.0
2676688b3aecSmrg#
2677688b3aecSmrg# Documentation tools are not always available on all platforms and sometimes
2678688b3aecSmrg# not at the appropriate level. This macro enables a builder to skip all
2679688b3aecSmrg# documentation targets except traditional man pages.
2680688b3aecSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2681688b3aecSmrg# maximum flexibilty in controlling documentation building.
2682688b3aecSmrg# Refer to:
2683688b3aecSmrg# XORG_WITH_XMLTO         --with-xmlto
2684688b3aecSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2685688b3aecSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2686688b3aecSmrg# XORG_WITH_FOP           --with-fop
2687688b3aecSmrg# XORG_WITH_GROFF         --with-groff
2688688b3aecSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2689688b3aecSmrg#
2690688b3aecSmrg# Interface to module:
2691688b3aecSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2692688b3aecSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2693688b3aecSmrg#		 'no' user instructs the module not to generate docs
2694688b3aecSmrg# parm1:	specify the default value, yes or no.
2695688b3aecSmrg#
2696688b3aecSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2697688b3aecSmrgm4_define([docs_default], m4_default([$1], [yes]))
2698688b3aecSmrgAC_ARG_ENABLE(docs,
2699688b3aecSmrg	AS_HELP_STRING([--enable-docs],
2700688b3aecSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2701688b3aecSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2702688b3aecSmrgm4_undefine([docs_default])
2703688b3aecSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2704688b3aecSmrgAC_MSG_CHECKING([whether to build documentation])
2705688b3aecSmrgAC_MSG_RESULT([$build_docs])
2706688b3aecSmrg]) # XORG_ENABLE_DOCS
2707e9554658Smrg
2708688b3aecSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2709688b3aecSmrg# ----------------
2710688b3aecSmrg# Minimum version: 1.6.0
2711688b3aecSmrg#
2712688b3aecSmrg# This macro enables a builder to skip all developer documentation.
2713688b3aecSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2714688b3aecSmrg# maximum flexibilty in controlling documentation building.
2715688b3aecSmrg# Refer to:
2716688b3aecSmrg# XORG_WITH_XMLTO         --with-xmlto
2717688b3aecSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2718688b3aecSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2719688b3aecSmrg# XORG_WITH_FOP           --with-fop
2720688b3aecSmrg# XORG_WITH_GROFF         --with-groff
2721688b3aecSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2722688b3aecSmrg#
2723688b3aecSmrg# Interface to module:
2724688b3aecSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2725688b3aecSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2726688b3aecSmrg#			'no' user instructs the module not to generate developer docs
2727688b3aecSmrg# parm1:		specify the default value, yes or no.
2728688b3aecSmrg#
2729688b3aecSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2730688b3aecSmrgm4_define([devel_default], m4_default([$1], [yes]))
2731688b3aecSmrgAC_ARG_ENABLE(devel-docs,
2732688b3aecSmrg	AS_HELP_STRING([--enable-devel-docs],
2733688b3aecSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2734688b3aecSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2735688b3aecSmrgm4_undefine([devel_default])
2736688b3aecSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2737688b3aecSmrgAC_MSG_CHECKING([whether to build developer documentation])
2738688b3aecSmrgAC_MSG_RESULT([$build_devel_docs])
2739688b3aecSmrg]) # XORG_ENABLE_DEVEL_DOCS
2740688b3aecSmrg
2741688b3aecSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2742688b3aecSmrg# ----------------
2743688b3aecSmrg# Minimum version: 1.6.0
2744688b3aecSmrg#
2745688b3aecSmrg# This macro enables a builder to skip all functional specification targets.
2746688b3aecSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2747688b3aecSmrg# maximum flexibilty in controlling documentation building.
2748688b3aecSmrg# Refer to:
2749688b3aecSmrg# XORG_WITH_XMLTO         --with-xmlto
2750688b3aecSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2751688b3aecSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2752688b3aecSmrg# XORG_WITH_FOP           --with-fop
2753688b3aecSmrg# XORG_WITH_GROFF         --with-groff
2754688b3aecSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2755688b3aecSmrg#
2756688b3aecSmrg# Interface to module:
2757688b3aecSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2758688b3aecSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2759688b3aecSmrg#			'no' user instructs the module not to generate specs
2760688b3aecSmrg# parm1:		specify the default value, yes or no.
2761688b3aecSmrg#
2762688b3aecSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2763688b3aecSmrgm4_define([spec_default], m4_default([$1], [yes]))
2764688b3aecSmrgAC_ARG_ENABLE(specs,
2765688b3aecSmrg	AS_HELP_STRING([--enable-specs],
2766688b3aecSmrg	   [Enable building the specs (default: ]spec_default[)]),
2767688b3aecSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2768688b3aecSmrgm4_undefine([spec_default])
2769688b3aecSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2770688b3aecSmrgAC_MSG_CHECKING([whether to build functional specifications])
2771688b3aecSmrgAC_MSG_RESULT([$build_specs])
2772688b3aecSmrg]) # XORG_ENABLE_SPECS
2773688b3aecSmrg
2774688b3aecSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2775688b3aecSmrg# ----------------------------------------------
2776688b3aecSmrg# Minimum version: 1.13.0
2777688b3aecSmrg#
2778688b3aecSmrg# This macro enables a builder to enable/disable unit testing
2779688b3aecSmrg# It makes no assumption about the test cases implementation
2780688b3aecSmrg# Test cases may or may not use Automake "Support for test suites"
2781688b3aecSmrg# They may or may not use the software utility library GLib
2782688b3aecSmrg#
2783688b3aecSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2784688b3aecSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2785688b3aecSmrg# The variable enable_unit_tests is used by other macros in this file.
2786688b3aecSmrg#
2787688b3aecSmrg# Interface to module:
2788688b3aecSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2789688b3aecSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2790688b3aecSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2791688b3aecSmrg#			'no' user instructs the module not to build tests
2792688b3aecSmrg# parm1:		specify the default value, yes or no.
2793688b3aecSmrg#
2794688b3aecSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2795688b3aecSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2796688b3aecSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2797688b3aecSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2798688b3aecSmrgm4_define([_defopt], m4_default([$1], [auto]))
2799688b3aecSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2800688b3aecSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2801688b3aecSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2802688b3aecSmrgm4_undefine([_defopt])
2803688b3aecSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2804688b3aecSmrgAC_MSG_CHECKING([whether to build unit test cases])
2805688b3aecSmrgAC_MSG_RESULT([$enable_unit_tests])
2806688b3aecSmrg]) # XORG_ENABLE_UNIT_TESTS
2807309c398aSmrg
2808688b3aecSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2809688b3aecSmrg# ------------------------------------------------------
2810688b3aecSmrg# Minimum version: 1.17.0
2811688b3aecSmrg#
2812688b3aecSmrg# This macro enables a builder to enable/disable integration testing
2813688b3aecSmrg# It makes no assumption about the test cases' implementation
2814688b3aecSmrg# Test cases may or may not use Automake "Support for test suites"
2815688b3aecSmrg#
2816688b3aecSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2817688b3aecSmrg# usually requires less dependencies and may be built and run under less
2818688b3aecSmrg# stringent environments than integration tests.
2819688b3aecSmrg#
2820688b3aecSmrg# Interface to module:
2821688b3aecSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2822688b3aecSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2823688b3aecSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2824688b3aecSmrg#                             'no' user instructs the module not to build tests
2825688b3aecSmrg# parm1:                      specify the default value, yes or no.
2826688b3aecSmrg#
2827688b3aecSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2828688b3aecSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2829688b3aecSmrgm4_define([_defopt], m4_default([$1], [auto]))
2830688b3aecSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2831688b3aecSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2832688b3aecSmrg	[enable_integration_tests=$enableval],
2833688b3aecSmrg	[enable_integration_tests=]_defopt)
2834688b3aecSmrgm4_undefine([_defopt])
2835688b3aecSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2836688b3aecSmrg	[test "x$enable_integration_tests" != xno])
2837688b3aecSmrgAC_MSG_CHECKING([whether to build unit test cases])
2838688b3aecSmrgAC_MSG_RESULT([$enable_integration_tests])
2839688b3aecSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2840309c398aSmrg
2841688b3aecSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2842688b3aecSmrg# ----------------------------------------
2843688b3aecSmrg# Minimum version: 1.13.0
2844688b3aecSmrg#
2845688b3aecSmrg# GLib is a library which provides advanced data structures and functions.
2846688b3aecSmrg# This macro enables a module to test for the presence of Glib.
2847688b3aecSmrg#
2848688b3aecSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2849688b3aecSmrg# Otherwise the value of $enable_unit_tests is blank.
2850688b3aecSmrg#
2851688b3aecSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2852688b3aecSmrg# test support usually requires less dependencies and may be built and run under
2853688b3aecSmrg# less stringent environments than integration tests.
2854688b3aecSmrg#
2855688b3aecSmrg# Interface to module:
2856688b3aecSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2857688b3aecSmrg# with_glib: used in configure.ac to know if GLib has been found
2858688b3aecSmrg# --with-glib:	'yes' user instructs the module to use glib
2859688b3aecSmrg#		'no' user instructs the module not to use glib
2860688b3aecSmrg#
2861688b3aecSmrgAC_DEFUN([XORG_WITH_GLIB],[
2862688b3aecSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2863688b3aecSmrgm4_define([_defopt], m4_default([$2], [auto]))
2864688b3aecSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2865688b3aecSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2866688b3aecSmrg	[with_glib=$withval], [with_glib=]_defopt)
2867688b3aecSmrgm4_undefine([_defopt])
2868309c398aSmrg
2869688b3aecSmrghave_glib=no
2870688b3aecSmrg# Do not probe GLib if user explicitly disabled unit testing
2871688b3aecSmrgif test "x$enable_unit_tests" != x"no"; then
2872688b3aecSmrg  # Do not probe GLib if user explicitly disabled it
2873688b3aecSmrg  if test "x$with_glib" != x"no"; then
2874688b3aecSmrg    m4_ifval(
2875688b3aecSmrg      [$1],
2876688b3aecSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2877688b3aecSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2878688b3aecSmrg    )
2879309c398aSmrg  fi
2880688b3aecSmrgfi
2881309c398aSmrg
2882688b3aecSmrg# Not having GLib when unit testing has been explicitly requested is an error
2883688b3aecSmrgif test "x$enable_unit_tests" = x"yes"; then
2884688b3aecSmrg  if test "x$have_glib" = x"no"; then
2885688b3aecSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2886309c398aSmrg  fi
2887688b3aecSmrgfi
2888309c398aSmrg
2889688b3aecSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2890688b3aecSmrgif test "x$enable_unit_tests" = x"no"; then
2891688b3aecSmrg  if test "x$with_glib" = x"yes"; then
2892688b3aecSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2893688b3aecSmrg  fi
2894688b3aecSmrgfi
2895309c398aSmrg
2896688b3aecSmrg# Not having GLib when it has been explicitly requested is an error
2897688b3aecSmrgif test "x$with_glib" = x"yes"; then
2898688b3aecSmrg  if test "x$have_glib" = x"no"; then
2899688b3aecSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2900309c398aSmrg  fi
2901688b3aecSmrgfi
2902688b3aecSmrg
2903688b3aecSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2904688b3aecSmrg]) # XORG_WITH_GLIB
2905309c398aSmrg
2906688b3aecSmrg# XORG_LD_WRAP([required|optional])
2907688b3aecSmrg# ---------------------------------
2908688b3aecSmrg# Minimum version: 1.13.0
2909309c398aSmrg#
2910688b3aecSmrg# Check if linker supports -wrap, passed via compiler flags
2911309c398aSmrg#
2912688b3aecSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2913688b3aecSmrg# Otherwise the value of $enable_unit_tests is blank.
2914309c398aSmrg#
2915688b3aecSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2916688b3aecSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2917688b3aecSmrg# available, an argument of "optional" allows use when some unit tests require
2918688b3aecSmrg# ld -wrap and others do not.
2919309c398aSmrg#
2920688b3aecSmrgAC_DEFUN([XORG_LD_WRAP],[
2921688b3aecSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2922688b3aecSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2923688b3aecSmrg                      void __wrap_exit(int status) { return; }],
2924688b3aecSmrg                     [exit(0);])])
2925688b3aecSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2926688b3aecSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2927688b3aecSmrg  if test "x$have_ld_wrap" = x"no"; then
2928688b3aecSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2929688b3aecSmrg  fi
2930309c398aSmrgfi
2931688b3aecSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2932688b3aecSmrg#
2933688b3aecSmrg]) # XORG_LD_WRAP
2934309c398aSmrg
2935688b3aecSmrg# XORG_CHECK_LINKER_FLAGS
2936688b3aecSmrg# -----------------------
2937688b3aecSmrg# SYNOPSIS
2938309c398aSmrg#
2939688b3aecSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2940309c398aSmrg#
2941688b3aecSmrg# DESCRIPTION
2942309c398aSmrg#
2943688b3aecSmrg#   Check whether the given linker FLAGS work with the current language's
2944688b3aecSmrg#   linker, or whether they give an error.
2945309c398aSmrg#
2946688b3aecSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2947688b3aecSmrg#   success/failure.
2948309c398aSmrg#
2949688b3aecSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2950309c398aSmrg#
2951688b3aecSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2952309c398aSmrg#
2953688b3aecSmrg# LICENSE
2954309c398aSmrg#
2955688b3aecSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2956688b3aecSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2957688b3aecSmrg#   Copyright (c) 2009 Matteo Frigo
2958309c398aSmrg#
2959688b3aecSmrg#   This program is free software: you can redistribute it and/or modify it
2960688b3aecSmrg#   under the terms of the GNU General Public License as published by the
2961688b3aecSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2962688b3aecSmrg#   option) any later version.
2963309c398aSmrg#
2964688b3aecSmrg#   This program is distributed in the hope that it will be useful, but
2965688b3aecSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2966688b3aecSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2967688b3aecSmrg#   Public License for more details.
2968309c398aSmrg#
2969688b3aecSmrg#   You should have received a copy of the GNU General Public License along
2970688b3aecSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2971309c398aSmrg#
2972688b3aecSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2973688b3aecSmrg#   gives unlimited permission to copy, distribute and modify the configure
2974688b3aecSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2975688b3aecSmrg#   need not follow the terms of the GNU General Public License when using
2976688b3aecSmrg#   or distributing such scripts, even though portions of the text of the
2977688b3aecSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2978688b3aecSmrg#   all other use of the material that constitutes the Autoconf Macro.
2979688b3aecSmrg#
2980688b3aecSmrg#   This special exception to the GPL applies to versions of the Autoconf
2981688b3aecSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2982688b3aecSmrg#   modified version of the Autoconf Macro, you may extend this special
2983688b3aecSmrg#   exception to the GPL to apply to your modified version as well.#
2984688b3aecSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2985688b3aecSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2986688b3aecSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2987688b3aecSmrgAS_LITERAL_IF([$1],
2988688b3aecSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2989688b3aecSmrg      ax_save_FLAGS=$LDFLAGS
2990688b3aecSmrg      LDFLAGS="$1"
2991688b3aecSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2992688b3aecSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2993688b3aecSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2994688b3aecSmrg      LDFLAGS=$ax_save_FLAGS])],
2995688b3aecSmrg  [ax_save_FLAGS=$LDFLAGS
2996688b3aecSmrg   LDFLAGS="$1"
2997688b3aecSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2998688b3aecSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2999688b3aecSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3000688b3aecSmrg   LDFLAGS=$ax_save_FLAGS])
3001688b3aecSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
3002688b3aecSmrgAC_MSG_RESULT($xorg_check_linker_flags)
3003688b3aecSmrgif test "x$xorg_check_linker_flags" = xyes; then
3004688b3aecSmrg	m4_default([$2], :)
3005688b3aecSmrgelse
3006688b3aecSmrg	m4_default([$3], :)
3007309c398aSmrgfi
3008688b3aecSmrg]) # XORG_CHECK_LINKER_FLAGS
3009309c398aSmrg
3010688b3aecSmrg# XORG_MEMORY_CHECK_FLAGS
3011309c398aSmrg# -----------------------
3012688b3aecSmrg# Minimum version: 1.16.0
3013309c398aSmrg#
3014688b3aecSmrg# This macro attempts to find appropriate memory checking functionality
3015688b3aecSmrg# for various platforms which unit testing code may use to catch various
3016688b3aecSmrg# forms of memory allocation and access errors in testing.
3017688b3aecSmrg#
3018688b3aecSmrg# Interface to module:
3019688b3aecSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
3020688b3aecSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
3021688b3aecSmrg#
3022688b3aecSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
3023688b3aecSmrg#
3024688b3aecSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
3025309c398aSmrg
3026309c398aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
3027688b3aecSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
3028688b3aecSmrg           [Environment variables to enable memory checking in tests])
3029309c398aSmrg
3030688b3aecSmrg# Check for different types of support on different platforms
3031688b3aecSmrgcase $host_os in
3032688b3aecSmrg    solaris*)
3033688b3aecSmrg        AC_CHECK_LIB([umem], [umem_alloc],
3034688b3aecSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
3035688b3aecSmrg        ;;
3036688b3aecSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
3037688b3aecSmrg        # both directly and inverted, so should not be 0 or 255.
3038688b3aecSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
3039688b3aecSmrg        ;;
3040688b3aecSmrg    darwin*)
3041688b3aecSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
3042688b3aecSmrg        ;;
3043688b3aecSmrg    *bsd*)
3044688b3aecSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
3045688b3aecSmrg        ;;
3046688b3aecSmrgesac
3047309c398aSmrg
3048688b3aecSmrg# User supplied flags override default flags
3049688b3aecSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
3050688b3aecSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
3051309c398aSmrgfi
3052309c398aSmrg
3053688b3aecSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
3054688b3aecSmrg]) # XORG_WITH_LINT
3055309c398aSmrg
3056688b3aecSmrg# XORG_CHECK_MALLOC_ZERO
3057688b3aecSmrg# ----------------------
3058688b3aecSmrg# Minimum version: 1.0.0
3059688b3aecSmrg#
3060688b3aecSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
3061688b3aecSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
3062688b3aecSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
3063688b3aecSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
3064688b3aecSmrgAC_ARG_ENABLE(malloc0returnsnull,
3065688b3aecSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
3066688b3aecSmrg		       [malloc(0) returns NULL (default: auto)]),
3067688b3aecSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
3068688b3aecSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
3069309c398aSmrg
3070688b3aecSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
3071688b3aecSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
3072688b3aecSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
3073688b3aecSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
3074688b3aecSmrg#include <stdlib.h>
3075688b3aecSmrg],[
3076688b3aecSmrg    char *m0, *r0, *c0, *p;
3077688b3aecSmrg    m0 = malloc(0);
3078688b3aecSmrg    p = malloc(10);
3079688b3aecSmrg    r0 = realloc(p,0);
3080688b3aecSmrg    c0 = calloc(0,10);
3081688b3aecSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
3082688b3aecSmrg])],
3083688b3aecSmrg		[xorg_cv_malloc0_returns_null=yes],
3084688b3aecSmrg		[xorg_cv_malloc0_returns_null=no])])
3085688b3aecSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
3086309c398aSmrgfi
3087688b3aecSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
3088309c398aSmrg
3089688b3aecSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
3090688b3aecSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
3091688b3aecSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
3092688b3aecSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
30938903d43aSmrgelse
3094688b3aecSmrg	MALLOC_ZERO_CFLAGS=""
3095688b3aecSmrg	XMALLOC_ZERO_CFLAGS=""
3096688b3aecSmrg	XTMALLOC_ZERO_CFLAGS=""
30978903d43aSmrgfi
30988903d43aSmrg
3099688b3aecSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
3100688b3aecSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
3101688b3aecSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
3102688b3aecSmrg]) # XORG_CHECK_MALLOC_ZERO
31038903d43aSmrg
3104688b3aecSmrg# XORG_WITH_LINT()
3105688b3aecSmrg# ----------------
3106688b3aecSmrg# Minimum version: 1.1.0
3107e9554658Smrg#
3108688b3aecSmrg# This macro enables the use of a tool that flags some suspicious and
3109688b3aecSmrg# non-portable constructs (likely to be bugs) in C language source code.
3110688b3aecSmrg# It will attempt to locate the tool and use appropriate options.
3111688b3aecSmrg# There are various lint type tools on different platforms.
3112688b3aecSmrg#
3113688b3aecSmrg# Interface to module:
3114688b3aecSmrg# LINT:		returns the path to the tool found on the platform
3115688b3aecSmrg#		or the value set to LINT on the configure cmd line
3116688b3aecSmrg#		also an Automake conditional
3117688b3aecSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
3118688b3aecSmrg#
3119688b3aecSmrg# --with-lint:	'yes' user instructs the module to use lint
3120688b3aecSmrg#		'no' user instructs the module not to use lint (default)
3121688b3aecSmrg#
3122688b3aecSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3123688b3aecSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3124688b3aecSmrg#
3125688b3aecSmrgAC_DEFUN([XORG_WITH_LINT],[
3126e9554658Smrg
3127688b3aecSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3128688b3aecSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3129688b3aecSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3130688b3aecSmrg		[Use a lint-style source code checker (default: disabled)])],
3131688b3aecSmrg		[use_lint=$withval], [use_lint=no])
3132e9554658Smrg
3133688b3aecSmrg# Obtain platform specific info like program name and options
3134688b3aecSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3135688b3aecSmrgcase $host_os in
3136688b3aecSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3137688b3aecSmrg	lint_name=splint
3138688b3aecSmrg	lint_options="-badflag"
3139688b3aecSmrg	;;
3140688b3aecSmrg  *freebsd* | *netbsd*)
3141688b3aecSmrg	lint_name=lint
3142688b3aecSmrg	lint_options="-u -b"
3143688b3aecSmrg	;;
3144688b3aecSmrg  *solaris*)
3145688b3aecSmrg	lint_name=lint
3146688b3aecSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3147688b3aecSmrg	;;
3148688b3aecSmrgesac
3149e9554658Smrg
3150688b3aecSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3151688b3aecSmrgif test "x$use_lint" = x"yes" ; then
3152688b3aecSmrg   AC_PATH_PROG([LINT], [$lint_name])
3153688b3aecSmrg   if test "x$LINT" = "x"; then
3154688b3aecSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3155688b3aecSmrg   fi
3156688b3aecSmrgelif test "x$use_lint" = x"no" ; then
3157688b3aecSmrg   if test "x$LINT" != "x"; then
3158688b3aecSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3159688b3aecSmrg   fi
3160e9554658Smrgelse
3161688b3aecSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3162e9554658Smrgfi
3163e9554658Smrg
3164688b3aecSmrg# User supplied flags override default flags
3165688b3aecSmrgif test "x$LINT_FLAGS" != "x"; then
3166688b3aecSmrg   lint_options=$LINT_FLAGS
3167688b3aecSmrgfi
3168e9554658Smrg
3169688b3aecSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3170688b3aecSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3171e9554658Smrg
3172688b3aecSmrg]) # XORG_WITH_LINT
3173e9554658Smrg
3174688b3aecSmrg# XORG_LINT_LIBRARY(LIBNAME)
3175688b3aecSmrg# --------------------------
3176688b3aecSmrg# Minimum version: 1.1.0
3177688b3aecSmrg#
3178688b3aecSmrg# Sets up flags for building lint libraries for checking programs that call
3179688b3aecSmrg# functions in the library.
3180688b3aecSmrg#
3181688b3aecSmrg# Interface to module:
3182688b3aecSmrg# LINTLIB		- Automake variable with the name of lint library file to make
3183688b3aecSmrg# MAKE_LINT_LIB		- Automake conditional
3184688b3aecSmrg#
3185688b3aecSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3186688b3aecSmrg#			  - 'no' user instructs the module not to create a lint library (default)
3187e9554658Smrg
3188688b3aecSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3189688b3aecSmrgAC_REQUIRE([XORG_WITH_LINT])
3190688b3aecSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3191688b3aecSmrg	[Create lint library (default: disabled)])],
3192688b3aecSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3193e9554658Smrg
3194688b3aecSmrgif test "x$make_lint_lib" = x"yes" ; then
3195688b3aecSmrg   LINTLIB=llib-l$1.ln
3196688b3aecSmrg   if test "x$LINT" = "x"; then
3197688b3aecSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3198688b3aecSmrg   fi
3199688b3aecSmrgelif test "x$make_lint_lib" != x"no" ; then
3200688b3aecSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3201688b3aecSmrgfi
3202e9554658Smrg
3203688b3aecSmrgAC_SUBST(LINTLIB)
3204688b3aecSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3205e9554658Smrg
3206688b3aecSmrg]) # XORG_LINT_LIBRARY
3207e9554658Smrg
3208688b3aecSmrg# XORG_COMPILER_BRAND
3209e9554658Smrg# -------------------
3210688b3aecSmrg# Minimum version: 1.14.0
3211e9554658Smrg#
3212688b3aecSmrg# Checks for various brands of compilers and sets flags as appropriate:
3213688b3aecSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3214688b3aecSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3215688b3aecSmrg#   clang compiler - sets CLANGCC to "yes"
3216688b3aecSmrg#   Intel compiler - sets INTELCC to "yes"
3217688b3aecSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3218688b3aecSmrg#
3219688b3aecSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3220688b3aecSmrgAC_LANG_CASE(
3221688b3aecSmrg	[C], [
3222688b3aecSmrg		AC_REQUIRE([AC_PROG_CC_C99])
3223688b3aecSmrg	],
3224688b3aecSmrg	[C++], [
3225688b3aecSmrg		AC_REQUIRE([AC_PROG_CXX])
3226688b3aecSmrg	]
3227688b3aecSmrg)
3228688b3aecSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3229688b3aecSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3230688b3aecSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3231688b3aecSmrg]) # XORG_COMPILER_BRAND
32328903d43aSmrg
3233688b3aecSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3234688b3aecSmrg# ---------------
3235688b3aecSmrg# Minimum version: 1.16.0
3236688b3aecSmrg#
3237688b3aecSmrg# Test if the compiler works when passed the given flag as a command line argument.
3238688b3aecSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
3239688b3aecSmrg# next flag in the list until there are no more options.
3240688b3aecSmrg#
3241688b3aecSmrg# Note that this does not guarantee that the compiler supports the flag as some
3242688b3aecSmrg# compilers will simply ignore arguments that they do not understand, but we do
3243688b3aecSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3244688b3aecSmrg# -Werror=unused-command-line-argument
3245688b3aecSmrg#
3246688b3aecSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3247688b3aecSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3248688b3aecSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3249e9554658Smrg
3250688b3aecSmrgAC_LANG_COMPILER_REQUIRE
3251e9554658Smrg
3252688b3aecSmrgAC_LANG_CASE(
3253688b3aecSmrg	[C], [
3254688b3aecSmrg		AC_REQUIRE([AC_PROG_CC_C99])
3255688b3aecSmrg		define([PREFIX], [C])
3256688b3aecSmrg		define([CACHE_PREFIX], [cc])
3257688b3aecSmrg		define([COMPILER], [$CC])
3258688b3aecSmrg	],
3259688b3aecSmrg	[C++], [
3260688b3aecSmrg		define([PREFIX], [CXX])
3261688b3aecSmrg		define([CACHE_PREFIX], [cxx])
3262688b3aecSmrg		define([COMPILER], [$CXX])
3263688b3aecSmrg	]
3264688b3aecSmrg)
3265e9554658Smrg
3266688b3aecSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3267e9554658Smrg
3268688b3aecSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3269688b3aecSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3270688b3aecSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3271688b3aecSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3272688b3aecSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3273688b3aecSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3274688b3aecSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3275688b3aecSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3276688b3aecSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3277e9554658Smrgfi
3278e9554658Smrg
3279688b3aecSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3280688b3aecSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3281688b3aecSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3282688b3aecSmrg	fi
3283688b3aecSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3284688b3aecSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3285688b3aecSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3286688b3aecSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3287688b3aecSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3288688b3aecSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3289688b3aecSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3290688b3aecSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3291e9554658Smrgfi
3292e9554658Smrg
3293688b3aecSmrgfound="no"
3294688b3aecSmrgm4_foreach([flag], m4_cdr($@), [
3295688b3aecSmrg	if test $found = "no" ; then
3296688b3aecSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3297688b3aecSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3298688b3aecSmrg		fi
3299e9554658Smrg
3300688b3aecSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3301688b3aecSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3302688b3aecSmrg		fi
3303e9554658Smrg
3304688b3aecSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3305688b3aecSmrg
3306688b3aecSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3307688b3aecSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3308688b3aecSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3309688b3aecSmrg		AC_CACHE_VAL($cacheid,
3310688b3aecSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3311688b3aecSmrg					     [eval $cacheid=yes],
3312688b3aecSmrg					     [eval $cacheid=no])])
3313688b3aecSmrg
3314688b3aecSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3315688b3aecSmrg
3316688b3aecSmrg		eval supported=\$$cacheid
3317688b3aecSmrg		AC_MSG_RESULT([$supported])
3318688b3aecSmrg		if test "$supported" = "yes" ; then
3319688b3aecSmrg			$1="$$1 ]flag["
3320688b3aecSmrg			found="yes"
3321688b3aecSmrg		fi
3322688b3aecSmrg	fi
3323688b3aecSmrg])
3324688b3aecSmrg]) # XORG_TESTSET_CFLAG
3325688b3aecSmrg
3326688b3aecSmrg# XORG_COMPILER_FLAGS
3327688b3aecSmrg# ---------------
3328688b3aecSmrg# Minimum version: 1.16.0
33298903d43aSmrg#
3330688b3aecSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3331688b3aecSmrg# arguments supported by the selected compiler which do NOT alter the generated
3332688b3aecSmrg# code.  These arguments will cause the compiler to print various warnings
3333688b3aecSmrg# during compilation AND turn a conservative set of warnings into errors.
33348903d43aSmrg#
3335688b3aecSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3336688b3aecSmrg# future versions of util-macros as options are added to new compilers.
33378903d43aSmrg#
3338688b3aecSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3339688b3aecSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
33408903d43aSmrg
3341688b3aecSmrgAC_ARG_ENABLE(selective-werror,
3342688b3aecSmrg              AS_HELP_STRING([--disable-selective-werror],
3343688b3aecSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3344688b3aecSmrg              [SELECTIVE_WERROR=$enableval],
3345688b3aecSmrg              [SELECTIVE_WERROR=yes])
3346688b3aecSmrg
3347688b3aecSmrgAC_LANG_CASE(
3348688b3aecSmrg        [C], [
3349688b3aecSmrg                define([PREFIX], [C])
3350688b3aecSmrg        ],
3351688b3aecSmrg        [C++], [
3352688b3aecSmrg                define([PREFIX], [CXX])
3353688b3aecSmrg        ]
3354688b3aecSmrg)
3355688b3aecSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3356688b3aecSmrgif test "x$SUNCC" = "xyes"; then
3357688b3aecSmrg    [BASE_]PREFIX[FLAGS]="-v"
33588903d43aSmrgelse
3359688b3aecSmrg    [BASE_]PREFIX[FLAGS]=""
33608903d43aSmrgfi
33618903d43aSmrg
3362688b3aecSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3363688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3364688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3365688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3366688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
33678903d43aSmrg
3368688b3aecSmrgAC_LANG_CASE(
3369688b3aecSmrg	[C], [
3370688b3aecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3371688b3aecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3372688b3aecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3373688b3aecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3374688b3aecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3375688b3aecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3376688b3aecSmrg	]
3377688b3aecSmrg)
33788903d43aSmrg
3379688b3aecSmrg# This chunk adds additional warnings that could catch undesired effects.
3380688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3381688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3382688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3383688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3384688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3385688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3386688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3387309c398aSmrg
3388688b3aecSmrg# These are currently disabled because they are noisy.  They will be enabled
3389688b3aecSmrg# in the future once the codebase is sufficiently modernized to silence
3390688b3aecSmrg# them.  For now, I don't want them to drown out the other warnings.
3391688b3aecSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3392688b3aecSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3393688b3aecSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3394688b3aecSmrg
3395688b3aecSmrg# Turn some warnings into errors, so we don't accidently get successful builds
3396688b3aecSmrg# when there are problems that should be fixed.
3397688b3aecSmrg
3398688b3aecSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3399688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3400688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3401688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3402688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3403688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3404688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3405688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3406688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3407688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3408688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3409688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3410688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3411688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3412309c398aSmrgelse
3413688b3aecSmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
3414688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3415688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3416688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3417688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3418688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3419688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3420688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3421688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3422688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3423688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3424688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3425688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3426688b3aecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3427309c398aSmrgfi
3428309c398aSmrg
3429688b3aecSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3430688b3aecSmrg]) # XORG_COMPILER_FLAGS
3431309c398aSmrg
3432688b3aecSmrg# XORG_CWARNFLAGS
3433688b3aecSmrg# ---------------
3434688b3aecSmrg# Minimum version: 1.2.0
3435688b3aecSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3436309c398aSmrg#
3437688b3aecSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3438309c398aSmrg#
3439688b3aecSmrg# This function is deprecated because it defines -fno-strict-aliasing
3440688b3aecSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3441688b3aecSmrg# is needed, then it should be added explicitly in the module when
3442688b3aecSmrg# it is updated to use BASE_CFLAGS.
3443309c398aSmrg#
3444688b3aecSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3445688b3aecSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3446688b3aecSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3447688b3aecSmrgAC_LANG_CASE(
3448688b3aecSmrg	[C], [
3449688b3aecSmrg		CWARNFLAGS="$BASE_CFLAGS"
3450688b3aecSmrg		if  test "x$GCC" = xyes ; then
3451688b3aecSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3452688b3aecSmrg		fi
3453688b3aecSmrg		AC_SUBST(CWARNFLAGS)
3454688b3aecSmrg	]
3455688b3aecSmrg)
3456688b3aecSmrg]) # XORG_CWARNFLAGS
3457688b3aecSmrg
3458688b3aecSmrg# XORG_STRICT_OPTION
3459688b3aecSmrg# -----------------------
3460688b3aecSmrg# Minimum version: 1.3.0
3461309c398aSmrg#
3462688b3aecSmrg# Add configure option to enable strict compilation flags, such as treating
3463688b3aecSmrg# warnings as fatal errors.
3464688b3aecSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3465688b3aecSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3466309c398aSmrg#
3467688b3aecSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3468688b3aecSmrg# when strict compilation is unconditionally desired.
3469688b3aecSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3470688b3aecSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3471688b3aecSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3472688b3aecSmrg
3473688b3aecSmrgAC_ARG_ENABLE(strict-compilation,
3474688b3aecSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3475688b3aecSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3476688b3aecSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3477688b3aecSmrg
3478688b3aecSmrgAC_LANG_CASE(
3479688b3aecSmrg        [C], [
3480688b3aecSmrg                define([PREFIX], [C])
3481688b3aecSmrg        ],
3482688b3aecSmrg        [C++], [
3483688b3aecSmrg                define([PREFIX], [CXX])
3484688b3aecSmrg        ]
3485688b3aecSmrg)
3486688b3aecSmrg
3487688b3aecSmrg[STRICT_]PREFIX[FLAGS]=""
3488688b3aecSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3489688b3aecSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3490309c398aSmrg
3491688b3aecSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3492688b3aecSmrg# activate it with -Werror, so we add it here explicitly.
3493688b3aecSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3494309c398aSmrg
3495688b3aecSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3496688b3aecSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3497688b3aecSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3498688b3aecSmrgfi
3499688b3aecSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3500688b3aecSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3501688b3aecSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3502688b3aecSmrg]) # XORG_STRICT_OPTION
3503309c398aSmrg
3504688b3aecSmrg# XORG_DEFAULT_OPTIONS
3505688b3aecSmrg# --------------------
3506688b3aecSmrg# Minimum version: 1.3.0
35078903d43aSmrg#
3508688b3aecSmrg# Defines default options for X.Org modules.
35098903d43aSmrg#
3510688b3aecSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3511688b3aecSmrgAC_REQUIRE([AC_PROG_INSTALL])
3512688b3aecSmrgXORG_COMPILER_FLAGS
3513688b3aecSmrgXORG_CWARNFLAGS
3514688b3aecSmrgXORG_STRICT_OPTION
3515688b3aecSmrgXORG_RELEASE_VERSION
3516688b3aecSmrgXORG_CHANGELOG
3517688b3aecSmrgXORG_INSTALL
3518688b3aecSmrgXORG_MANPAGE_SECTIONS
3519688b3aecSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3520688b3aecSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3521688b3aecSmrg]) # XORG_DEFAULT_OPTIONS
3522688b3aecSmrg
3523688b3aecSmrg# XORG_INSTALL()
3524688b3aecSmrg# ----------------
3525688b3aecSmrg# Minimum version: 1.4.0
35268903d43aSmrg#
3527688b3aecSmrg# Defines the variable INSTALL_CMD as the command to copy
3528688b3aecSmrg# INSTALL from $prefix/share/util-macros.
35298903d43aSmrg#
3530688b3aecSmrgAC_DEFUN([XORG_INSTALL], [
3531688b3aecSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3532688b3aecSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3533688b3aecSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3534688b3aecSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3535688b3aecSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3536688b3aecSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3537688b3aecSmrgAC_SUBST([INSTALL_CMD])
3538688b3aecSmrg]) # XORG_INSTALL
3539688b3aecSmrgdnl Copyright 2005 Red Hat, Inc
3540688b3aecSmrgdnl
3541688b3aecSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3542688b3aecSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3543688b3aecSmrgdnl the above copyright notice appear in all copies and that both that
3544688b3aecSmrgdnl copyright notice and this permission notice appear in supporting
3545688b3aecSmrgdnl documentation.
3546688b3aecSmrgdnl
3547688b3aecSmrgdnl The above copyright notice and this permission notice shall be included
3548688b3aecSmrgdnl in all copies or substantial portions of the Software.
3549688b3aecSmrgdnl
3550688b3aecSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3551688b3aecSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3552688b3aecSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3553688b3aecSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3554688b3aecSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3555688b3aecSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3556688b3aecSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3557688b3aecSmrgdnl
3558688b3aecSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3559688b3aecSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3560688b3aecSmrgdnl other dealings in this Software without prior written authorization
3561688b3aecSmrgdnl from the copyright holders.
3562688b3aecSmrgdnl
35638903d43aSmrg
3564688b3aecSmrg# XORG_RELEASE_VERSION
3565688b3aecSmrg# --------------------
3566688b3aecSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
35678903d43aSmrg
3568688b3aecSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3569688b3aecSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3570688b3aecSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3571688b3aecSmrg		[Major version of this package])
3572688b3aecSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3573688b3aecSmrg	if test "x$PVM" = "x"; then
3574688b3aecSmrg		PVM="0"
3575688b3aecSmrg	fi
3576688b3aecSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3577688b3aecSmrg		[$PVM],
3578688b3aecSmrg		[Minor version of this package])
3579688b3aecSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3580688b3aecSmrg	if test "x$PVP" = "x"; then
3581688b3aecSmrg		PVP="0"
3582688b3aecSmrg	fi
3583688b3aecSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3584688b3aecSmrg		[$PVP],
3585688b3aecSmrg		[Patch version of this package])
3586688b3aecSmrg])
3587688b3aecSmrg
3588688b3aecSmrg# XORG_CHANGELOG()
3589688b3aecSmrg# ----------------
3590688b3aecSmrg# Minimum version: 1.2.0
35918903d43aSmrg#
3592688b3aecSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3593688b3aecSmrg# ChangeLog from git.
35948903d43aSmrg#
35958903d43aSmrg#
3596688b3aecSmrgAC_DEFUN([XORG_CHANGELOG], [
3597688b3aecSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3598688b3aecSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3599688b3aecSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3600688b3aecSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3601688b3aecSmrgAC_SUBST([CHANGELOG_CMD])
3602688b3aecSmrg]) # XORG_CHANGELOG
36038903d43aSmrg
3604688b3aecSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
3605688b3aecSmrg#
3606688b3aecSmrg# This file is free software; the Free Software Foundation
3607688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
3608688b3aecSmrg# with or without modifications, as long as this notice is preserved.
36098903d43aSmrg
3610688b3aecSmrg# AM_AUTOMAKE_VERSION(VERSION)
3611688b3aecSmrg# ----------------------------
3612688b3aecSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3613688b3aecSmrg# generated from the m4 files accompanying Automake X.Y.
3614688b3aecSmrg# (This private macro should not be called outside this file.)
3615688b3aecSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3616688b3aecSmrg[am__api_version='1.15'
3617688b3aecSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3618688b3aecSmrgdnl require some minimum version.  Point them to the right macro.
3619688b3aecSmrgm4_if([$1], [1.15], [],
3620688b3aecSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3621688b3aecSmrg])
3622688b3aecSmrg
3623688b3aecSmrg# _AM_AUTOCONF_VERSION(VERSION)
3624688b3aecSmrg# -----------------------------
3625688b3aecSmrg# aclocal traces this macro to find the Autoconf version.
3626688b3aecSmrg# This is a private macro too.  Using m4_define simplifies
3627688b3aecSmrg# the logic in aclocal, which can simply ignore this definition.
3628688b3aecSmrgm4_define([_AM_AUTOCONF_VERSION], [])
3629688b3aecSmrg
3630688b3aecSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
3631688b3aecSmrg# -------------------------------
3632688b3aecSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
3633688b3aecSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
3634688b3aecSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
3635688b3aecSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
3636688b3aecSmrgm4_ifndef([AC_AUTOCONF_VERSION],
3637688b3aecSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
3638688b3aecSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
3639688b3aecSmrg
3640688b3aecSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
3641688b3aecSmrg
3642688b3aecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
36438903d43aSmrg#
3644688b3aecSmrg# This file is free software; the Free Software Foundation
3645688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
3646688b3aecSmrg# with or without modifications, as long as this notice is preserved.
3647688b3aecSmrg
3648688b3aecSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
3649688b3aecSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
3650688b3aecSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
36518903d43aSmrg#
3652688b3aecSmrg# Of course, Automake must honor this variable whenever it calls a
3653688b3aecSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
3654688b3aecSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
3655688b3aecSmrg# depending on how configure is run.  This is pretty annoying, since
3656688b3aecSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
3657688b3aecSmrg# source directory, any form will work fine, but in subdirectories a
3658688b3aecSmrg# relative path needs to be adjusted first.
36598903d43aSmrg#
3660688b3aecSmrg# $ac_aux_dir/missing
3661688b3aecSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
3662688b3aecSmrg# $top_srcdir/$ac_aux_dir/missing
3663688b3aecSmrg#    fails if $ac_aux_dir is absolute,
3664688b3aecSmrg#    fails when called from a subdirectory in a VPATH build with
3665688b3aecSmrg#          a relative $ac_aux_dir
36668903d43aSmrg#
3667688b3aecSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
3668688b3aecSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
3669688b3aecSmrg# harmless because $srcdir is '.', but things will broke when you
3670688b3aecSmrg# start a VPATH build or use an absolute $srcdir.
36718903d43aSmrg#
3672688b3aecSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
3673688b3aecSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
3674688b3aecSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
3675688b3aecSmrg# and then we would define $MISSING as
3676688b3aecSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
3677688b3aecSmrg# This will work as long as MISSING is not called from configure, because
3678688b3aecSmrg# unfortunately $(top_srcdir) has no meaning in configure.
3679688b3aecSmrg# However there are other variables, like CC, which are often used in
3680688b3aecSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
36818903d43aSmrg#
3682688b3aecSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
3683688b3aecSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
3684688b3aecSmrg# configured tree to be moved without reconfiguration.
3685688b3aecSmrg
3686688b3aecSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
3687688b3aecSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
3688688b3aecSmrg# Expand $ac_aux_dir to an absolute path.
3689688b3aecSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
3690688b3aecSmrg])
3691688b3aecSmrg
3692688b3aecSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
3693688b3aecSmrg
3694688b3aecSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
36958903d43aSmrg#
3696688b3aecSmrg# This file is free software; the Free Software Foundation
3697688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
3698688b3aecSmrg# with or without modifications, as long as this notice is preserved.
36998903d43aSmrg
3700688b3aecSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
3701688b3aecSmrg# -------------------------------------
3702688b3aecSmrg# Define a conditional.
3703688b3aecSmrgAC_DEFUN([AM_CONDITIONAL],
3704688b3aecSmrg[AC_PREREQ([2.52])dnl
3705688b3aecSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
3706688b3aecSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
3707688b3aecSmrgAC_SUBST([$1_TRUE])dnl
3708688b3aecSmrgAC_SUBST([$1_FALSE])dnl
3709688b3aecSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
3710688b3aecSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
3711688b3aecSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
3712688b3aecSmrgif $2; then
3713688b3aecSmrg  $1_TRUE=
3714688b3aecSmrg  $1_FALSE='#'
37158903d43aSmrgelse
3716688b3aecSmrg  $1_TRUE='#'
3717688b3aecSmrg  $1_FALSE=
37188903d43aSmrgfi
3719688b3aecSmrgAC_CONFIG_COMMANDS_PRE(
3720688b3aecSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
3721688b3aecSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
3722688b3aecSmrgUsually this means the macro was only invoked conditionally.]])
3723688b3aecSmrgfi])])
37248903d43aSmrg
3725688b3aecSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
3726688b3aecSmrg#
3727688b3aecSmrg# This file is free software; the Free Software Foundation
3728688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
3729688b3aecSmrg# with or without modifications, as long as this notice is preserved.
37308903d43aSmrg
37318903d43aSmrg
3732688b3aecSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
3733688b3aecSmrg# written in clear, in which case automake, when reading aclocal.m4,
3734688b3aecSmrg# will think it sees a *use*, and therefore will trigger all it's
3735688b3aecSmrg# C support machinery.  Also note that it means that autoscan, seeing
3736688b3aecSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
3737688b3aecSmrg
3738688b3aecSmrg
3739688b3aecSmrg# _AM_DEPENDENCIES(NAME)
3740688b3aecSmrg# ----------------------
3741688b3aecSmrg# See how the compiler implements dependency checking.
3742688b3aecSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
3743688b3aecSmrg# We try a few techniques and use that to set a single cache variable.
3744688b3aecSmrg#
3745688b3aecSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
3746688b3aecSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
3747688b3aecSmrg# dependency, and given that the user is not expected to run this macro,
3748688b3aecSmrg# just rely on AC_PROG_CC.
3749688b3aecSmrgAC_DEFUN([_AM_DEPENDENCIES],
3750688b3aecSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
3751688b3aecSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
3752688b3aecSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
3753688b3aecSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
3754688b3aecSmrg
3755688b3aecSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
3756688b3aecSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
3757688b3aecSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
3758688b3aecSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
3759688b3aecSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
3760688b3aecSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
3761688b3aecSmrg                    [depcc="$$1"   am_compiler_list=])
3762688b3aecSmrg
3763688b3aecSmrgAC_CACHE_CHECK([dependency style of $depcc],
3764688b3aecSmrg               [am_cv_$1_dependencies_compiler_type],
3765688b3aecSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
3766688b3aecSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
3767688b3aecSmrg  # making bogus files that we don't know about and never remove.  For
3768688b3aecSmrg  # instance it was reported that on HP-UX the gcc test will end up
3769688b3aecSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
3770688b3aecSmrg  # in D".
3771688b3aecSmrg  rm -rf conftest.dir
3772688b3aecSmrg  mkdir conftest.dir
3773688b3aecSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
3774688b3aecSmrg  # using a relative directory.
3775688b3aecSmrg  cp "$am_depcomp" conftest.dir
3776688b3aecSmrg  cd conftest.dir
3777688b3aecSmrg  # We will build objects and dependencies in a subdirectory because
3778688b3aecSmrg  # it helps to detect inapplicable dependency modes.  For instance
3779688b3aecSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
3780688b3aecSmrg  # side effect of compilation, but ICC will put the dependencies in
3781688b3aecSmrg  # the current directory while Tru64 will put them in the object
3782688b3aecSmrg  # directory.
3783688b3aecSmrg  mkdir sub
3784688b3aecSmrg
3785688b3aecSmrg  am_cv_$1_dependencies_compiler_type=none
3786688b3aecSmrg  if test "$am_compiler_list" = ""; then
3787688b3aecSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
3788688b3aecSmrg  fi
3789688b3aecSmrg  am__universal=false
3790688b3aecSmrg  m4_case([$1], [CC],
3791688b3aecSmrg    [case " $depcc " in #(
3792688b3aecSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
3793688b3aecSmrg     esac],
3794688b3aecSmrg    [CXX],
3795688b3aecSmrg    [case " $depcc " in #(
3796688b3aecSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
3797688b3aecSmrg     esac])
3798688b3aecSmrg
3799688b3aecSmrg  for depmode in $am_compiler_list; do
3800688b3aecSmrg    # Setup a source with many dependencies, because some compilers
3801688b3aecSmrg    # like to wrap large dependency lists on column 80 (with \), and
3802688b3aecSmrg    # we should not choose a depcomp mode which is confused by this.
3803688b3aecSmrg    #
3804688b3aecSmrg    # We need to recreate these files for each test, as the compiler may
3805688b3aecSmrg    # overwrite some of them when testing with obscure command lines.
3806688b3aecSmrg    # This happens at least with the AIX C compiler.
3807688b3aecSmrg    : > sub/conftest.c
3808688b3aecSmrg    for i in 1 2 3 4 5 6; do
3809688b3aecSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
3810688b3aecSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
3811688b3aecSmrg      # Solaris 10 /bin/sh.
3812688b3aecSmrg      echo '/* dummy */' > sub/conftst$i.h
3813688b3aecSmrg    done
3814688b3aecSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
38158903d43aSmrg
3816688b3aecSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
3817688b3aecSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
3818688b3aecSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
3819688b3aecSmrg    # versions had trouble with output in subdirs.
3820688b3aecSmrg    am__obj=sub/conftest.${OBJEXT-o}
3821688b3aecSmrg    am__minus_obj="-o $am__obj"
3822688b3aecSmrg    case $depmode in
3823688b3aecSmrg    gcc)
3824688b3aecSmrg      # This depmode causes a compiler race in universal mode.
3825688b3aecSmrg      test "$am__universal" = false || continue
3826688b3aecSmrg      ;;
3827688b3aecSmrg    nosideeffect)
3828688b3aecSmrg      # After this tag, mechanisms are not by side-effect, so they'll
3829688b3aecSmrg      # only be used when explicitly requested.
3830688b3aecSmrg      if test "x$enable_dependency_tracking" = xyes; then
3831688b3aecSmrg	continue
3832688b3aecSmrg      else
3833688b3aecSmrg	break
3834688b3aecSmrg      fi
3835688b3aecSmrg      ;;
3836688b3aecSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
3837688b3aecSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
3838688b3aecSmrg      # not run yet.  These depmodes are late enough in the game, and
3839688b3aecSmrg      # so weak that their functioning should not be impacted.
3840688b3aecSmrg      am__obj=conftest.${OBJEXT-o}
3841688b3aecSmrg      am__minus_obj=
3842688b3aecSmrg      ;;
3843688b3aecSmrg    none) break ;;
3844688b3aecSmrg    esac
3845688b3aecSmrg    if depmode=$depmode \
3846688b3aecSmrg       source=sub/conftest.c object=$am__obj \
3847688b3aecSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
3848688b3aecSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
3849688b3aecSmrg         >/dev/null 2>conftest.err &&
3850688b3aecSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
3851688b3aecSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
3852688b3aecSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
3853688b3aecSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
3854688b3aecSmrg      # icc doesn't choke on unknown options, it will just issue warnings
3855688b3aecSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
3856688b3aecSmrg      # that says an option was ignored or not supported.
3857688b3aecSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
3858688b3aecSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
3859688b3aecSmrg      # The diagnosis changed in icc 8.0:
3860688b3aecSmrg      #   icc: Command line remark: option '-MP' not supported
3861688b3aecSmrg      if (grep 'ignoring option' conftest.err ||
3862688b3aecSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
3863688b3aecSmrg        am_cv_$1_dependencies_compiler_type=$depmode
3864688b3aecSmrg        break
3865688b3aecSmrg      fi
3866688b3aecSmrg    fi
3867688b3aecSmrg  done
38688903d43aSmrg
3869688b3aecSmrg  cd ..
3870688b3aecSmrg  rm -rf conftest.dir
38718903d43aSmrgelse
3872688b3aecSmrg  am_cv_$1_dependencies_compiler_type=none
38738903d43aSmrgfi
3874688b3aecSmrg])
3875688b3aecSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
3876688b3aecSmrgAM_CONDITIONAL([am__fastdep$1], [
3877688b3aecSmrg  test "x$enable_dependency_tracking" != xno \
3878688b3aecSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3879688b3aecSmrg])
3880309c398aSmrg
38818903d43aSmrg
3882688b3aecSmrg# AM_SET_DEPDIR
3883688b3aecSmrg# -------------
3884688b3aecSmrg# Choose a directory name for dependency files.
3885688b3aecSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3886688b3aecSmrgAC_DEFUN([AM_SET_DEPDIR],
3887688b3aecSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3888688b3aecSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3889688b3aecSmrg])
38908903d43aSmrg
38918903d43aSmrg
3892688b3aecSmrg# AM_DEP_TRACK
3893688b3aecSmrg# ------------
3894688b3aecSmrgAC_DEFUN([AM_DEP_TRACK],
3895688b3aecSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3896688b3aecSmrgAS_HELP_STRING(
3897688b3aecSmrg  [--enable-dependency-tracking],
3898688b3aecSmrg  [do not reject slow dependency extractors])
3899688b3aecSmrgAS_HELP_STRING(
3900688b3aecSmrg  [--disable-dependency-tracking],
3901688b3aecSmrg  [speeds up one-time build])])
3902688b3aecSmrgif test "x$enable_dependency_tracking" != xno; then
3903688b3aecSmrg  am_depcomp="$ac_aux_dir/depcomp"
3904688b3aecSmrg  AMDEPBACKSLASH='\'
3905688b3aecSmrg  am__nodep='_no'
3906688b3aecSmrgfi
3907688b3aecSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3908688b3aecSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3909688b3aecSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3910688b3aecSmrgAC_SUBST([am__nodep])dnl
3911688b3aecSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3912688b3aecSmrg])
39138903d43aSmrg
3914688b3aecSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
39158903d43aSmrg
3916688b3aecSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
39178903d43aSmrg#
3918688b3aecSmrg# This file is free software; the Free Software Foundation
3919688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
3920688b3aecSmrg# with or without modifications, as long as this notice is preserved.
39218903d43aSmrg
3922309c398aSmrg
3923688b3aecSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3924688b3aecSmrg# ------------------------------
3925688b3aecSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3926688b3aecSmrg[{
3927688b3aecSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
3928688b3aecSmrg  # are listed without --file.  Let's play safe and only enable the eval
3929688b3aecSmrg  # if we detect the quoting.
3930688b3aecSmrg  case $CONFIG_FILES in
3931688b3aecSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3932688b3aecSmrg  *)   set x $CONFIG_FILES ;;
3933688b3aecSmrg  esac
3934688b3aecSmrg  shift
3935688b3aecSmrg  for mf
3936688b3aecSmrg  do
3937688b3aecSmrg    # Strip MF so we end up with the name of the file.
3938688b3aecSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3939688b3aecSmrg    # Check whether this is an Automake generated Makefile or not.
3940688b3aecSmrg    # We used to match only the files named 'Makefile.in', but
3941688b3aecSmrg    # some people rename them; so instead we look at the file content.
3942688b3aecSmrg    # Grep'ing the first line is not enough: some people post-process
3943688b3aecSmrg    # each Makefile.in and add a new line on top of each file to say so.
3944688b3aecSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3945688b3aecSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3946688b3aecSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3947688b3aecSmrg      dirpart=`AS_DIRNAME("$mf")`
3948688b3aecSmrg    else
3949688b3aecSmrg      continue
3950688b3aecSmrg    fi
3951688b3aecSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3952688b3aecSmrg    # from the Makefile without running 'make'.
3953688b3aecSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3954688b3aecSmrg    test -z "$DEPDIR" && continue
3955688b3aecSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3956688b3aecSmrg    test -z "$am__include" && continue
3957688b3aecSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3958688b3aecSmrg    # Find all dependency output files, they are included files with
3959688b3aecSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3960688b3aecSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3961688b3aecSmrg    # expansion.
3962688b3aecSmrg    for file in `sed -n "
3963688b3aecSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3964688b3aecSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3965688b3aecSmrg      # Make sure the directory exists.
3966688b3aecSmrg      test -f "$dirpart/$file" && continue
3967688b3aecSmrg      fdir=`AS_DIRNAME(["$file"])`
3968688b3aecSmrg      AS_MKDIR_P([$dirpart/$fdir])
3969688b3aecSmrg      # echo "creating $dirpart/$file"
3970688b3aecSmrg      echo '# dummy' > "$dirpart/$file"
3971688b3aecSmrg    done
3972688b3aecSmrg  done
3973688b3aecSmrg}
3974688b3aecSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39755dd5f640Smrg
3976688b3aecSmrg
3977688b3aecSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3978688b3aecSmrg# -----------------------------
3979688b3aecSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3980309c398aSmrg#
3981688b3aecSmrg# This code is only required when automatic dependency tracking
3982688b3aecSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
3983688b3aecSmrg# need in order to bootstrap the dependency handling code.
3984688b3aecSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3985688b3aecSmrg[AC_CONFIG_COMMANDS([depfiles],
3986688b3aecSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3987688b3aecSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
3988688b3aecSmrg])
3989309c398aSmrg
3990688b3aecSmrg# Do all the work for Automake.                             -*- Autoconf -*-
3991309c398aSmrg
3992688b3aecSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
3993688b3aecSmrg#
3994688b3aecSmrg# This file is free software; the Free Software Foundation
3995688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
3996688b3aecSmrg# with or without modifications, as long as this notice is preserved.
3997688b3aecSmrg
3998688b3aecSmrg# This macro actually does too much.  Some checks are only needed if
3999688b3aecSmrg# your package does certain things.  But this isn't really a big deal.
4000309c398aSmrg
4001688b3aecSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4002688b3aecSmrgm4_define([AC_PROG_CC],
4003688b3aecSmrgm4_defn([AC_PROG_CC])
4004688b3aecSmrg[_AM_PROG_CC_C_O
4005688b3aecSmrg])
4006309c398aSmrg
4007688b3aecSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4008688b3aecSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4009688b3aecSmrg# -----------------------------------------------
4010688b3aecSmrg# The call with PACKAGE and VERSION arguments is the old style
4011688b3aecSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4012688b3aecSmrg# and VERSION should now be passed to AC_INIT and removed from
4013688b3aecSmrg# the call to AM_INIT_AUTOMAKE.
4014688b3aecSmrg# We support both call styles for the transition.  After
4015688b3aecSmrg# the next Automake release, Autoconf can make the AC_INIT
4016688b3aecSmrg# arguments mandatory, and then we can depend on a new Autoconf
4017688b3aecSmrg# release and drop the old call support.
4018688b3aecSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4019688b3aecSmrg[AC_PREREQ([2.65])dnl
4020688b3aecSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4021688b3aecSmrgdnl the ones we care about.
4022688b3aecSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4023688b3aecSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4024688b3aecSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4025688b3aecSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4026688b3aecSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4027688b3aecSmrg  # is not polluted with repeated "-I."
4028688b3aecSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4029688b3aecSmrg  # test to see if srcdir already configured
4030688b3aecSmrg  if test -f $srcdir/config.status; then
4031688b3aecSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4032309c398aSmrg  fi
4033309c398aSmrgfi
4034309c398aSmrg
4035688b3aecSmrg# test whether we have cygpath
4036688b3aecSmrgif test -z "$CYGPATH_W"; then
4037688b3aecSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4038688b3aecSmrg    CYGPATH_W='cygpath -w'
4039688b3aecSmrg  else
4040688b3aecSmrg    CYGPATH_W=echo
4041309c398aSmrg  fi
4042309c398aSmrgfi
4043688b3aecSmrgAC_SUBST([CYGPATH_W])
4044309c398aSmrg
4045688b3aecSmrg# Define the identity of the package.
4046688b3aecSmrgdnl Distinguish between old-style and new-style calls.
4047688b3aecSmrgm4_ifval([$2],
4048688b3aecSmrg[AC_DIAGNOSE([obsolete],
4049688b3aecSmrg             [$0: two- and three-arguments forms are deprecated.])
4050688b3aecSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4051688b3aecSmrg AC_SUBST([PACKAGE], [$1])dnl
4052688b3aecSmrg AC_SUBST([VERSION], [$2])],
4053688b3aecSmrg[_AM_SET_OPTIONS([$1])dnl
4054688b3aecSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4055688b3aecSmrgm4_if(
4056688b3aecSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4057688b3aecSmrg  [ok:ok],,
4058688b3aecSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4059688b3aecSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4060688b3aecSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4061309c398aSmrg
4062688b3aecSmrg_AM_IF_OPTION([no-define],,
4063688b3aecSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4064688b3aecSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4065309c398aSmrg
4066688b3aecSmrg# Some tools Automake needs.
4067688b3aecSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4068688b3aecSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4069688b3aecSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4070688b3aecSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4071688b3aecSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4072688b3aecSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4073688b3aecSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4074688b3aecSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4075688b3aecSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4076688b3aecSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4077688b3aecSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
4078688b3aecSmrg# dies out for good.  For more background, see:
4079688b3aecSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4080688b3aecSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4081688b3aecSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4082688b3aecSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
4083688b3aecSmrg# system "awk" is bad on some platforms.
4084688b3aecSmrgAC_REQUIRE([AC_PROG_AWK])dnl
4085688b3aecSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
4086688b3aecSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
4087688b3aecSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4088688b3aecSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
4089688b3aecSmrg			     [_AM_PROG_TAR([v7])])])
4090688b3aecSmrg_AM_IF_OPTION([no-dependencies],,
4091688b3aecSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
4092688b3aecSmrg		  [_AM_DEPENDENCIES([CC])],
4093688b3aecSmrg		  [m4_define([AC_PROG_CC],
4094688b3aecSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
4095688b3aecSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
4096688b3aecSmrg		  [_AM_DEPENDENCIES([CXX])],
4097688b3aecSmrg		  [m4_define([AC_PROG_CXX],
4098688b3aecSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
4099688b3aecSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
4100688b3aecSmrg		  [_AM_DEPENDENCIES([OBJC])],
4101688b3aecSmrg		  [m4_define([AC_PROG_OBJC],
4102688b3aecSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
4103688b3aecSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
4104688b3aecSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
4105688b3aecSmrg		  [m4_define([AC_PROG_OBJCXX],
4106688b3aecSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
4107688b3aecSmrg])
4108688b3aecSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
4109688b3aecSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
4110688b3aecSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
4111688b3aecSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
4112688b3aecSmrgAC_CONFIG_COMMANDS_PRE(dnl
4113688b3aecSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
4114688b3aecSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
4115309c398aSmrg
4116688b3aecSmrg# POSIX will say in a future version that running "rm -f" with no argument
4117688b3aecSmrg# is OK; and we want to be able to make that assumption in our Makefile
4118688b3aecSmrg# recipes.  So use an aggressive probe to check that the usage we want is
4119688b3aecSmrg# actually supported "in the wild" to an acceptable degree.
4120688b3aecSmrg# See automake bug#10828.
4121688b3aecSmrg# To make any issue more visible, cause the running configure to be aborted
4122688b3aecSmrg# by default if the 'rm' program in use doesn't match our expectations; the
4123688b3aecSmrg# user can still override this though.
4124688b3aecSmrgif rm -f && rm -fr && rm -rf; then : OK; else
4125688b3aecSmrg  cat >&2 <<'END'
4126688b3aecSmrgOops!
4127309c398aSmrg
4128688b3aecSmrgYour 'rm' program seems unable to run without file operands specified
4129688b3aecSmrgon the command line, even when the '-f' option is present.  This is contrary
4130688b3aecSmrgto the behaviour of most rm programs out there, and not conforming with
4131688b3aecSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
4132309c398aSmrg
4133688b3aecSmrgPlease tell bug-automake@gnu.org about your system, including the value
4134688b3aecSmrgof your $PATH and any error possibly output before this message.  This
4135688b3aecSmrgcan help us improve future automake versions.
4136309c398aSmrg
4137688b3aecSmrgEND
4138688b3aecSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
4139688b3aecSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
4140688b3aecSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
4141688b3aecSmrg    echo >&2
4142688b3aecSmrg  else
4143688b3aecSmrg    cat >&2 <<'END'
4144688b3aecSmrgAborting the configuration process, to ensure you take notice of the issue.
4145e9554658Smrg
4146688b3aecSmrgYou can download and install GNU coreutils to get an 'rm' implementation
4147688b3aecSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
4148e9554658Smrg
4149688b3aecSmrgIf you want to complete the configuration process using your problematic
4150688b3aecSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
4151688b3aecSmrgto "yes", and re-run configure.
4152688b3aecSmrg
4153688b3aecSmrgEND
4154688b3aecSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
4155688b3aecSmrg  fi
4156e9554658Smrgfi
4157688b3aecSmrgdnl The trailing newline in this macro's definition is deliberate, for
4158688b3aecSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
4159688b3aecSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
4160688b3aecSmrg])
4161e9554658Smrg
4162688b3aecSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
4163688b3aecSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
4164688b3aecSmrgdnl mangled by Autoconf and run in a shell conditional statement.
4165688b3aecSmrgm4_define([_AC_COMPILER_EXEEXT],
4166688b3aecSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
4167e9554658Smrg
4168688b3aecSmrg# When config.status generates a header, we must update the stamp-h file.
4169688b3aecSmrg# This file resides in the same directory as the config header
4170688b3aecSmrg# that is generated.  The stamp files are numbered to have different names.
4171e9554658Smrg
4172688b3aecSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
4173688b3aecSmrg# loop where config.status creates the headers, so we can generate
4174688b3aecSmrg# our stamp files there.
4175688b3aecSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
4176688b3aecSmrg[# Compute $1's index in $config_headers.
4177688b3aecSmrg_am_arg=$1
4178688b3aecSmrg_am_stamp_count=1
4179688b3aecSmrgfor _am_header in $config_headers :; do
4180688b3aecSmrg  case $_am_header in
4181688b3aecSmrg    $_am_arg | $_am_arg:* )
4182688b3aecSmrg      break ;;
4183688b3aecSmrg    * )
4184688b3aecSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
4185688b3aecSmrg  esac
4186688b3aecSmrgdone
4187688b3aecSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
41888903d43aSmrg
4189688b3aecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
4190688b3aecSmrg#
4191688b3aecSmrg# This file is free software; the Free Software Foundation
4192688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4193688b3aecSmrg# with or without modifications, as long as this notice is preserved.
41948903d43aSmrg
4195688b3aecSmrg# AM_PROG_INSTALL_SH
4196688b3aecSmrg# ------------------
4197688b3aecSmrg# Define $install_sh.
4198688b3aecSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
4199688b3aecSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4200688b3aecSmrgif test x"${install_sh+set}" != xset; then
4201688b3aecSmrg  case $am_aux_dir in
4202688b3aecSmrg  *\ * | *\	*)
4203688b3aecSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
4204688b3aecSmrg  *)
4205688b3aecSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
4206688b3aecSmrg  esac
4207e9554658Smrgfi
4208688b3aecSmrgAC_SUBST([install_sh])])
42098903d43aSmrg
4210688b3aecSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
4211688b3aecSmrg#
4212688b3aecSmrg# This file is free software; the Free Software Foundation
4213688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4214688b3aecSmrg# with or without modifications, as long as this notice is preserved.
4215e9554658Smrg
4216688b3aecSmrg# Check whether the underlying file-system supports filenames
4217688b3aecSmrg# with a leading dot.  For instance MS-DOS doesn't.
4218688b3aecSmrgAC_DEFUN([AM_SET_LEADING_DOT],
4219688b3aecSmrg[rm -rf .tst 2>/dev/null
4220688b3aecSmrgmkdir .tst 2>/dev/null
4221688b3aecSmrgif test -d .tst; then
4222688b3aecSmrg  am__leading_dot=.
4223688b3aecSmrgelse
4224688b3aecSmrg  am__leading_dot=_
4225688b3aecSmrgfi
4226688b3aecSmrgrmdir .tst 2>/dev/null
4227688b3aecSmrgAC_SUBST([am__leading_dot])])
4228e9554658Smrg
4229688b3aecSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
4230e9554658Smrg
4231688b3aecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
42328903d43aSmrg#
4233688b3aecSmrg# This file is free software; the Free Software Foundation
4234688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4235688b3aecSmrg# with or without modifications, as long as this notice is preserved.
42368903d43aSmrg
4237688b3aecSmrg# AM_MAKE_INCLUDE()
4238688b3aecSmrg# -----------------
4239688b3aecSmrg# Check to see how make treats includes.
4240688b3aecSmrgAC_DEFUN([AM_MAKE_INCLUDE],
4241688b3aecSmrg[am_make=${MAKE-make}
4242688b3aecSmrgcat > confinc << 'END'
4243688b3aecSmrgam__doit:
4244688b3aecSmrg	@echo this is the am__doit target
4245688b3aecSmrg.PHONY: am__doit
4246688b3aecSmrgEND
4247688b3aecSmrg# If we don't find an include directive, just comment out the code.
4248688b3aecSmrgAC_MSG_CHECKING([for style of include used by $am_make])
4249688b3aecSmrgam__include="#"
4250688b3aecSmrgam__quote=
4251688b3aecSmrg_am_result=none
4252688b3aecSmrg# First try GNU make style include.
4253688b3aecSmrgecho "include confinc" > confmf
4254688b3aecSmrg# Ignore all kinds of additional output from 'make'.
4255688b3aecSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
4256688b3aecSmrg*the\ am__doit\ target*)
4257688b3aecSmrg  am__include=include
4258688b3aecSmrg  am__quote=
4259688b3aecSmrg  _am_result=GNU
4260688b3aecSmrg  ;;
4261688b3aecSmrgesac
4262688b3aecSmrg# Now try BSD make style include.
4263688b3aecSmrgif test "$am__include" = "#"; then
4264688b3aecSmrg   echo '.include "confinc"' > confmf
4265688b3aecSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
4266688b3aecSmrg   *the\ am__doit\ target*)
4267688b3aecSmrg     am__include=.include
4268688b3aecSmrg     am__quote="\""
4269688b3aecSmrg     _am_result=BSD
4270688b3aecSmrg     ;;
4271688b3aecSmrg   esac
4272e9554658Smrgfi
4273688b3aecSmrgAC_SUBST([am__include])
4274688b3aecSmrgAC_SUBST([am__quote])
4275688b3aecSmrgAC_MSG_RESULT([$_am_result])
4276688b3aecSmrgrm -f confinc confmf
4277688b3aecSmrg])
42788903d43aSmrg
4279688b3aecSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
4280309c398aSmrg
4281688b3aecSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
4282309c398aSmrg#
4283688b3aecSmrg# This file is free software; the Free Software Foundation
4284688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4285688b3aecSmrg# with or without modifications, as long as this notice is preserved.
42865dd5f640Smrg
4287688b3aecSmrg# AM_MISSING_PROG(NAME, PROGRAM)
4288688b3aecSmrg# ------------------------------
4289688b3aecSmrgAC_DEFUN([AM_MISSING_PROG],
4290688b3aecSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
4291688b3aecSmrg$1=${$1-"${am_missing_run}$2"}
4292688b3aecSmrgAC_SUBST($1)])
4293309c398aSmrg
4294688b3aecSmrg# AM_MISSING_HAS_RUN
4295688b3aecSmrg# ------------------
4296688b3aecSmrg# Define MISSING if not defined so far and test if it is modern enough.
4297688b3aecSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
4298688b3aecSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
4299688b3aecSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4300688b3aecSmrgAC_REQUIRE_AUX_FILE([missing])dnl
4301688b3aecSmrgif test x"${MISSING+set}" != xset; then
4302688b3aecSmrg  case $am_aux_dir in
4303688b3aecSmrg  *\ * | *\	*)
4304688b3aecSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
4305688b3aecSmrg  *)
4306688b3aecSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
4307688b3aecSmrg  esac
4308309c398aSmrgfi
4309688b3aecSmrg# Use eval to expand $SHELL
4310688b3aecSmrgif eval "$MISSING --is-lightweight"; then
4311688b3aecSmrg  am_missing_run="$MISSING "
4312688b3aecSmrgelse
4313688b3aecSmrg  am_missing_run=
4314688b3aecSmrg  AC_MSG_WARN(['missing' script is too old or missing])
4315309c398aSmrgfi
4316688b3aecSmrg])
4317309c398aSmrg
4318688b3aecSmrg# Helper functions for option handling.                     -*- Autoconf -*-
4319309c398aSmrg
4320688b3aecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
4321688b3aecSmrg#
4322688b3aecSmrg# This file is free software; the Free Software Foundation
4323688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4324688b3aecSmrg# with or without modifications, as long as this notice is preserved.
4325309c398aSmrg
4326688b3aecSmrg# _AM_MANGLE_OPTION(NAME)
4327688b3aecSmrg# -----------------------
4328688b3aecSmrgAC_DEFUN([_AM_MANGLE_OPTION],
4329688b3aecSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
4330309c398aSmrg
4331688b3aecSmrg# _AM_SET_OPTION(NAME)
4332688b3aecSmrg# --------------------
4333688b3aecSmrg# Set option NAME.  Presently that only means defining a flag for this option.
4334688b3aecSmrgAC_DEFUN([_AM_SET_OPTION],
4335688b3aecSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
4336309c398aSmrg
4337688b3aecSmrg# _AM_SET_OPTIONS(OPTIONS)
4338688b3aecSmrg# ------------------------
4339688b3aecSmrg# OPTIONS is a space-separated list of Automake options.
4340688b3aecSmrgAC_DEFUN([_AM_SET_OPTIONS],
4341688b3aecSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
4342309c398aSmrg
4343688b3aecSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
4344688b3aecSmrg# -------------------------------------------
4345688b3aecSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
4346688b3aecSmrgAC_DEFUN([_AM_IF_OPTION],
4347688b3aecSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
4348309c398aSmrg
4349688b3aecSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
4350309c398aSmrg#
4351688b3aecSmrg# This file is free software; the Free Software Foundation
4352688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4353688b3aecSmrg# with or without modifications, as long as this notice is preserved.
4354309c398aSmrg
4355688b3aecSmrg# _AM_PROG_CC_C_O
4356688b3aecSmrg# ---------------
4357688b3aecSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
4358688b3aecSmrg# to automatically call this.
4359688b3aecSmrgAC_DEFUN([_AM_PROG_CC_C_O],
4360688b3aecSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4361688b3aecSmrgAC_REQUIRE_AUX_FILE([compile])dnl
4362688b3aecSmrgAC_LANG_PUSH([C])dnl
4363688b3aecSmrgAC_CACHE_CHECK(
4364688b3aecSmrg  [whether $CC understands -c and -o together],
4365688b3aecSmrg  [am_cv_prog_cc_c_o],
4366688b3aecSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
4367688b3aecSmrg  # Make sure it works both with $CC and with simple cc.
4368688b3aecSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
4369688b3aecSmrg  # compilers refuse to overwrite an existing .o file with -o,
4370688b3aecSmrg  # though they will create one.
4371688b3aecSmrg  am_cv_prog_cc_c_o=yes
4372688b3aecSmrg  for am_i in 1 2; do
4373688b3aecSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
4374688b3aecSmrg         && test -f conftest2.$ac_objext; then
4375688b3aecSmrg      : OK
4376688b3aecSmrg    else
4377688b3aecSmrg      am_cv_prog_cc_c_o=no
4378688b3aecSmrg      break
4379688b3aecSmrg    fi
4380688b3aecSmrg  done
4381688b3aecSmrg  rm -f core conftest*
4382688b3aecSmrg  unset am_i])
4383688b3aecSmrgif test "$am_cv_prog_cc_c_o" != yes; then
4384688b3aecSmrg   # Losing compiler, so override with the script.
4385688b3aecSmrg   # FIXME: It is wrong to rewrite CC.
4386688b3aecSmrg   # But if we don't then we get into trouble of one sort or another.
4387688b3aecSmrg   # A longer-term fix would be to have automake use am__CC in this case,
4388688b3aecSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
4389688b3aecSmrg   CC="$am_aux_dir/compile $CC"
4390309c398aSmrgfi
4391688b3aecSmrgAC_LANG_POP([C])])
4392309c398aSmrg
4393688b3aecSmrg# For backward compatibility.
4394688b3aecSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
4395688b3aecSmrg
4396688b3aecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
4397688b3aecSmrg#
4398688b3aecSmrg# This file is free software; the Free Software Foundation
4399688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4400688b3aecSmrg# with or without modifications, as long as this notice is preserved.
44015dd5f640Smrg
4402688b3aecSmrg# AM_RUN_LOG(COMMAND)
4403688b3aecSmrg# -------------------
4404688b3aecSmrg# Run COMMAND, save the exit status in ac_status, and log it.
4405688b3aecSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
4406688b3aecSmrgAC_DEFUN([AM_RUN_LOG],
4407688b3aecSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
4408688b3aecSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
4409688b3aecSmrg   ac_status=$?
4410688b3aecSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
4411688b3aecSmrg   (exit $ac_status); }])
4412309c398aSmrg
4413688b3aecSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
4414309c398aSmrg
4415688b3aecSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4416688b3aecSmrg#
4417688b3aecSmrg# This file is free software; the Free Software Foundation
4418688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4419688b3aecSmrg# with or without modifications, as long as this notice is preserved.
4420309c398aSmrg
4421688b3aecSmrg# AM_SANITY_CHECK
4422688b3aecSmrg# ---------------
4423688b3aecSmrgAC_DEFUN([AM_SANITY_CHECK],
4424688b3aecSmrg[AC_MSG_CHECKING([whether build environment is sane])
4425688b3aecSmrg# Reject unsafe characters in $srcdir or the absolute working directory
4426688b3aecSmrg# name.  Accept space and tab only in the latter.
4427688b3aecSmrgam_lf='
4428688b3aecSmrg'
4429688b3aecSmrgcase `pwd` in
4430688b3aecSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
4431688b3aecSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
4432688b3aecSmrgesac
4433688b3aecSmrgcase $srcdir in
4434688b3aecSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
4435688b3aecSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
4436688b3aecSmrgesac
4437309c398aSmrg
4438688b3aecSmrg# Do 'set' in a subshell so we don't clobber the current shell's
4439688b3aecSmrg# arguments.  Must try -L first in case configure is actually a
4440688b3aecSmrg# symlink; some systems play weird games with the mod time of symlinks
4441688b3aecSmrg# (eg FreeBSD returns the mod time of the symlink's containing
4442688b3aecSmrg# directory).
4443688b3aecSmrgif (
4444688b3aecSmrg   am_has_slept=no
4445688b3aecSmrg   for am_try in 1 2; do
4446688b3aecSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
4447688b3aecSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
4448688b3aecSmrg     if test "$[*]" = "X"; then
4449688b3aecSmrg	# -L didn't work.
4450688b3aecSmrg	set X `ls -t "$srcdir/configure" conftest.file`
4451688b3aecSmrg     fi
4452688b3aecSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
4453688b3aecSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
4454688b3aecSmrg
4455688b3aecSmrg	# If neither matched, then we have a broken ls.  This can happen
4456688b3aecSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
4457688b3aecSmrg	# broken ls alias from the environment.  This has actually
4458688b3aecSmrg	# happened.  Such a system could not be considered "sane".
4459688b3aecSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
4460688b3aecSmrg  alias in your environment])
4461688b3aecSmrg     fi
4462688b3aecSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
4463688b3aecSmrg       break
4464688b3aecSmrg     fi
4465688b3aecSmrg     # Just in case.
4466688b3aecSmrg     sleep 1
4467688b3aecSmrg     am_has_slept=yes
4468688b3aecSmrg   done
4469688b3aecSmrg   test "$[2]" = conftest.file
4470688b3aecSmrg   )
4471688b3aecSmrgthen
4472688b3aecSmrg   # Ok.
4473688b3aecSmrg   :
4474309c398aSmrgelse
4475688b3aecSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
4476688b3aecSmrgCheck your system clock])
44775dd5f640Smrgfi
4478688b3aecSmrgAC_MSG_RESULT([yes])
4479688b3aecSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
4480688b3aecSmrg# generated files are strictly newer.
4481688b3aecSmrgam_sleep_pid=
4482688b3aecSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
4483688b3aecSmrg  ( sleep 1 ) &
4484688b3aecSmrg  am_sleep_pid=$!
4485688b3aecSmrgfi
4486688b3aecSmrgAC_CONFIG_COMMANDS_PRE(
4487688b3aecSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
4488688b3aecSmrg   if test -n "$am_sleep_pid"; then
4489688b3aecSmrg     # Hide warnings about reused PIDs.
4490688b3aecSmrg     wait $am_sleep_pid 2>/dev/null
4491688b3aecSmrg   fi
4492688b3aecSmrg   AC_MSG_RESULT([done])])
4493688b3aecSmrgrm -f conftest.file
4494688b3aecSmrg])
44955dd5f640Smrg
4496688b3aecSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
4497c2b339b4Smrg#
4498688b3aecSmrg# This file is free software; the Free Software Foundation
4499688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4500688b3aecSmrg# with or without modifications, as long as this notice is preserved.
4501c2b339b4Smrg
4502688b3aecSmrg# AM_SILENT_RULES([DEFAULT])
4503688b3aecSmrg# --------------------------
4504688b3aecSmrg# Enable less verbose build rules; with the default set to DEFAULT
4505688b3aecSmrg# ("yes" being less verbose, "no" or empty being verbose).
4506688b3aecSmrgAC_DEFUN([AM_SILENT_RULES],
4507688b3aecSmrg[AC_ARG_ENABLE([silent-rules], [dnl
4508688b3aecSmrgAS_HELP_STRING(
4509688b3aecSmrg  [--enable-silent-rules],
4510688b3aecSmrg  [less verbose build output (undo: "make V=1")])
4511688b3aecSmrgAS_HELP_STRING(
4512688b3aecSmrg  [--disable-silent-rules],
4513688b3aecSmrg  [verbose build output (undo: "make V=0")])dnl
4514688b3aecSmrg])
4515688b3aecSmrgcase $enable_silent_rules in @%:@ (((
4516688b3aecSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
4517688b3aecSmrg   no) AM_DEFAULT_VERBOSITY=1;;
4518688b3aecSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
4519688b3aecSmrgesac
4520688b3aecSmrgdnl
4521688b3aecSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
4522688b3aecSmrgdnl do not support nested variable expansions.
4523688b3aecSmrgdnl See automake bug#9928 and bug#10237.
4524688b3aecSmrgam_make=${MAKE-make}
4525688b3aecSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
4526688b3aecSmrg   [am_cv_make_support_nested_variables],
4527688b3aecSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
4528688b3aecSmrgBAR0=false
4529688b3aecSmrgBAR1=true
4530688b3aecSmrgV=1
4531688b3aecSmrgam__doit:
4532688b3aecSmrg	@$(TRUE)
4533688b3aecSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
4534688b3aecSmrg  am_cv_make_support_nested_variables=yes
4535688b3aecSmrgelse
4536688b3aecSmrg  am_cv_make_support_nested_variables=no
4537688b3aecSmrgfi])
4538688b3aecSmrgif test $am_cv_make_support_nested_variables = yes; then
4539688b3aecSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
4540688b3aecSmrg  AM_V='$(V)'
4541688b3aecSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
4542688b3aecSmrgelse
4543688b3aecSmrg  AM_V=$AM_DEFAULT_VERBOSITY
4544688b3aecSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
4545688b3aecSmrgfi
4546688b3aecSmrgAC_SUBST([AM_V])dnl
4547688b3aecSmrgAM_SUBST_NOTMAKE([AM_V])dnl
4548688b3aecSmrgAC_SUBST([AM_DEFAULT_V])dnl
4549688b3aecSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
4550688b3aecSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
4551688b3aecSmrgAM_BACKSLASH='\'
4552688b3aecSmrgAC_SUBST([AM_BACKSLASH])dnl
4553688b3aecSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
4554688b3aecSmrg])
4555688b3aecSmrg
4556688b3aecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
4557309c398aSmrg#
4558688b3aecSmrg# This file is free software; the Free Software Foundation
4559688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4560688b3aecSmrg# with or without modifications, as long as this notice is preserved.
4561688b3aecSmrg
4562688b3aecSmrg# AM_PROG_INSTALL_STRIP
4563688b3aecSmrg# ---------------------
4564688b3aecSmrg# One issue with vendor 'install' (even GNU) is that you can't
4565688b3aecSmrg# specify the program used to strip binaries.  This is especially
4566688b3aecSmrg# annoying in cross-compiling environments, where the build's strip
4567688b3aecSmrg# is unlikely to handle the host's binaries.
4568688b3aecSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
4569688b3aecSmrg# always use install-sh in "make install-strip", and initialize
4570688b3aecSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
4571688b3aecSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
4572688b3aecSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4573688b3aecSmrg# Installed binaries are usually stripped using 'strip' when the user
4574688b3aecSmrg# run "make install-strip".  However 'strip' might not be the right
4575688b3aecSmrg# tool to use in cross-compilation environments, therefore Automake
4576688b3aecSmrg# will honor the 'STRIP' environment variable to overrule this program.
4577688b3aecSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
4578688b3aecSmrgif test "$cross_compiling" != no; then
4579688b3aecSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
4580688b3aecSmrgfi
4581688b3aecSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
4582688b3aecSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
4583c2b339b4Smrg
4584688b3aecSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
4585688b3aecSmrg#
4586688b3aecSmrg# This file is free software; the Free Software Foundation
4587688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4588688b3aecSmrg# with or without modifications, as long as this notice is preserved.
4589309c398aSmrg
4590688b3aecSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
4591688b3aecSmrg# ---------------------------
4592688b3aecSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
4593688b3aecSmrg# This macro is traced by Automake.
4594688b3aecSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
45955dd5f640Smrg
4596688b3aecSmrg# AM_SUBST_NOTMAKE(VARIABLE)
4597688b3aecSmrg# --------------------------
4598688b3aecSmrg# Public sister of _AM_SUBST_NOTMAKE.
4599688b3aecSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
4600309c398aSmrg
4601688b3aecSmrg# Check how to create a tarball.                            -*- Autoconf -*-
4602309c398aSmrg
4603688b3aecSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
4604688b3aecSmrg#
4605688b3aecSmrg# This file is free software; the Free Software Foundation
4606688b3aecSmrg# gives unlimited permission to copy and/or distribute it,
4607688b3aecSmrg# with or without modifications, as long as this notice is preserved.
4608c2b339b4Smrg
4609688b3aecSmrg# _AM_PROG_TAR(FORMAT)
4610c2b339b4Smrg# --------------------
4611688b3aecSmrg# Check how to create a tarball in format FORMAT.
4612688b3aecSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
4613c2b339b4Smrg#
4614688b3aecSmrg# Substitute a variable $(am__tar) that is a command
4615688b3aecSmrg# writing to stdout a FORMAT-tarball containing the directory
4616688b3aecSmrg# $tardir.
4617688b3aecSmrg#     tardir=directory && $(am__tar) > result.tar
46188903d43aSmrg#
4619688b3aecSmrg# Substitute a variable $(am__untar) that extract such
4620688b3aecSmrg# a tarball read from stdin.
4621688b3aecSmrg#     $(am__untar) < result.tar
46228903d43aSmrg#
4623688b3aecSmrgAC_DEFUN([_AM_PROG_TAR],
4624688b3aecSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
4625688b3aecSmrg# in the wild :-(  We should find a proper way to deprecate it ...
4626688b3aecSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
4627e9554658Smrg
4628688b3aecSmrg# We'll loop over all known methods to create a tar archive until one works.
4629688b3aecSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
46305dd5f640Smrg
4631688b3aecSmrgm4_if([$1], [v7],
4632688b3aecSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
4633e9554658Smrg
4634688b3aecSmrg  [m4_case([$1],
4635688b3aecSmrg    [ustar],
4636688b3aecSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
4637688b3aecSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
4638688b3aecSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
4639688b3aecSmrg      # and bug#13588).
4640688b3aecSmrg      am_max_uid=2097151 # 2^21 - 1
4641688b3aecSmrg      am_max_gid=$am_max_uid
4642688b3aecSmrg      # The $UID and $GID variables are not portable, so we need to resort
4643688b3aecSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
4644688b3aecSmrg      # below are definitely unexpected, so allow the users to see them
4645688b3aecSmrg      # (that is, avoid stderr redirection).
4646688b3aecSmrg      am_uid=`id -u || echo unknown`
4647688b3aecSmrg      am_gid=`id -g || echo unknown`
4648688b3aecSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
4649688b3aecSmrg      if test $am_uid -le $am_max_uid; then
4650688b3aecSmrg         AC_MSG_RESULT([yes])
4651688b3aecSmrg      else
4652688b3aecSmrg         AC_MSG_RESULT([no])
4653688b3aecSmrg         _am_tools=none
4654688b3aecSmrg      fi
4655688b3aecSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
4656688b3aecSmrg      if test $am_gid -le $am_max_gid; then
4657688b3aecSmrg         AC_MSG_RESULT([yes])
4658688b3aecSmrg      else
4659688b3aecSmrg        AC_MSG_RESULT([no])
4660688b3aecSmrg        _am_tools=none
4661688b3aecSmrg      fi],
4662688b3aecSmrg
4663688b3aecSmrg  [pax],
4664688b3aecSmrg    [],
4665688b3aecSmrg
4666688b3aecSmrg  [m4_fatal([Unknown tar format])])
4667688b3aecSmrg
4668688b3aecSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
4669688b3aecSmrg
4670688b3aecSmrg  # Go ahead even if we have the value already cached.  We do so because we
4671688b3aecSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
4672688b3aecSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
4673688b3aecSmrg
4674688b3aecSmrg  for _am_tool in $_am_tools; do
4675688b3aecSmrg    case $_am_tool in
4676688b3aecSmrg    gnutar)
4677688b3aecSmrg      for _am_tar in tar gnutar gtar; do
4678688b3aecSmrg        AM_RUN_LOG([$_am_tar --version]) && break
4679688b3aecSmrg      done
4680688b3aecSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
4681688b3aecSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
4682688b3aecSmrg      am__untar="$_am_tar -xf -"
4683688b3aecSmrg      ;;
4684688b3aecSmrg    plaintar)
4685688b3aecSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
4686688b3aecSmrg      # ustar tarball either.
4687688b3aecSmrg      (tar --version) >/dev/null 2>&1 && continue
4688688b3aecSmrg      am__tar='tar chf - "$$tardir"'
4689688b3aecSmrg      am__tar_='tar chf - "$tardir"'
4690688b3aecSmrg      am__untar='tar xf -'
4691688b3aecSmrg      ;;
4692688b3aecSmrg    pax)
4693688b3aecSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
4694688b3aecSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
4695688b3aecSmrg      am__untar='pax -r'
4696688b3aecSmrg      ;;
4697688b3aecSmrg    cpio)
4698688b3aecSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
4699688b3aecSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
4700688b3aecSmrg      am__untar='cpio -i -H $1 -d'
4701688b3aecSmrg      ;;
4702688b3aecSmrg    none)
4703688b3aecSmrg      am__tar=false
4704688b3aecSmrg      am__tar_=false
4705688b3aecSmrg      am__untar=false
4706688b3aecSmrg      ;;
4707688b3aecSmrg    esac
4708688b3aecSmrg
4709688b3aecSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
4710688b3aecSmrg    # and am__untar set.
4711688b3aecSmrg    test -n "${am_cv_prog_tar_$1}" && break
4712688b3aecSmrg
4713688b3aecSmrg    # tar/untar a dummy directory, and stop if the command works.
4714688b3aecSmrg    rm -rf conftest.dir
4715688b3aecSmrg    mkdir conftest.dir
4716688b3aecSmrg    echo GrepMe > conftest.dir/file
4717688b3aecSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
4718688b3aecSmrg    rm -rf conftest.dir
4719688b3aecSmrg    if test -s conftest.tar; then
4720688b3aecSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
4721688b3aecSmrg      AM_RUN_LOG([cat conftest.dir/file])
4722688b3aecSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
4723688b3aecSmrg    fi
4724688b3aecSmrg  done
4725688b3aecSmrg  rm -rf conftest.dir
4726688b3aecSmrg
4727688b3aecSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
4728688b3aecSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
4729688b3aecSmrg
4730688b3aecSmrgAC_SUBST([am__tar])
4731688b3aecSmrgAC_SUBST([am__untar])
4732688b3aecSmrg]) # _AM_PROG_TAR
4733c2b339b4Smrg
4734