aclocal.m4 revision 5dd5f640
15dd5f640Smrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
25dd5f640Smrg
35dd5f640Smrg# Copyright (C) 1996-2013 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
178903d43aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
188903d43aSmrg[m4_warning([this file was generated for autoconf 2.68.
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
235dd5f640Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
24e9554658Smrg#
25e9554658Smrg# This file is free software; the Free Software Foundation
26e9554658Smrg# gives unlimited permission to copy and/or distribute it,
27e9554658Smrg# with or without modifications, as long as this notice is preserved.
28e9554658Smrg
29e9554658Smrg# AM_AUTOMAKE_VERSION(VERSION)
30e9554658Smrg# ----------------------------
31e9554658Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32e9554658Smrg# generated from the m4 files accompanying Automake X.Y.
33e9554658Smrg# (This private macro should not be called outside this file.)
34e9554658SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
355dd5f640Smrg[am__api_version='1.14'
36e9554658Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37e9554658Smrgdnl require some minimum version.  Point them to the right macro.
385dd5f640Smrgm4_if([$1], [1.14], [],
39e9554658Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40e9554658Smrg])
41e9554658Smrg
42e9554658Smrg# _AM_AUTOCONF_VERSION(VERSION)
43e9554658Smrg# -----------------------------
44e9554658Smrg# aclocal traces this macro to find the Autoconf version.
45e9554658Smrg# This is a private macro too.  Using m4_define simplifies
46e9554658Smrg# the logic in aclocal, which can simply ignore this definition.
47e9554658Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48e9554658Smrg
49e9554658Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50e9554658Smrg# -------------------------------
51e9554658Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52c2b339b4Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53e9554658SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
545dd5f640Smrg[AM_AUTOMAKE_VERSION([1.14])dnl
55c2b339b4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56c2b339b4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57c2b339b4Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58e9554658Smrg
59e9554658Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60e9554658Smrg
615dd5f640Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
62e9554658Smrg#
63e9554658Smrg# This file is free software; the Free Software Foundation
64e9554658Smrg# gives unlimited permission to copy and/or distribute it,
65e9554658Smrg# with or without modifications, as long as this notice is preserved.
66e9554658Smrg
67e9554658Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
685dd5f640Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
695dd5f640Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70e9554658Smrg#
71e9554658Smrg# Of course, Automake must honor this variable whenever it calls a
72e9554658Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73e9554658Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74e9554658Smrg# depending on how configure is run.  This is pretty annoying, since
75e9554658Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76e9554658Smrg# source directory, any form will work fine, but in subdirectories a
77e9554658Smrg# relative path needs to be adjusted first.
78e9554658Smrg#
79e9554658Smrg# $ac_aux_dir/missing
80e9554658Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81e9554658Smrg# $top_srcdir/$ac_aux_dir/missing
82e9554658Smrg#    fails if $ac_aux_dir is absolute,
83e9554658Smrg#    fails when called from a subdirectory in a VPATH build with
84e9554658Smrg#          a relative $ac_aux_dir
85e9554658Smrg#
86e9554658Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87e9554658Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
885dd5f640Smrg# harmless because $srcdir is '.', but things will broke when you
89e9554658Smrg# start a VPATH build or use an absolute $srcdir.
90e9554658Smrg#
91e9554658Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92e9554658Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93e9554658Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94e9554658Smrg# and then we would define $MISSING as
95e9554658Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96e9554658Smrg# This will work as long as MISSING is not called from configure, because
97e9554658Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98e9554658Smrg# However there are other variables, like CC, which are often used in
99e9554658Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100e9554658Smrg#
101e9554658Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102e9554658Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103e9554658Smrg# configured tree to be moved without reconfiguration.
104e9554658Smrg
105e9554658SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106e9554658Smrg[dnl Rely on autoconf to set up CDPATH properly.
107e9554658SmrgAC_PREREQ([2.50])dnl
108e9554658Smrg# expand $ac_aux_dir to an absolute path
109e9554658Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
110e9554658Smrg])
111e9554658Smrg
112e9554658Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113e9554658Smrg
1145dd5f640Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
115e9554658Smrg#
116e9554658Smrg# This file is free software; the Free Software Foundation
117e9554658Smrg# gives unlimited permission to copy and/or distribute it,
118e9554658Smrg# with or without modifications, as long as this notice is preserved.
119e9554658Smrg
120e9554658Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
121e9554658Smrg# -------------------------------------
122e9554658Smrg# Define a conditional.
123e9554658SmrgAC_DEFUN([AM_CONDITIONAL],
1245dd5f640Smrg[AC_PREREQ([2.52])dnl
1255dd5f640Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1265dd5f640Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
127e9554658SmrgAC_SUBST([$1_TRUE])dnl
128e9554658SmrgAC_SUBST([$1_FALSE])dnl
129e9554658Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
130e9554658Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
131c2b339b4Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
132e9554658Smrgif $2; then
133e9554658Smrg  $1_TRUE=
134e9554658Smrg  $1_FALSE='#'
135e9554658Smrgelse
136e9554658Smrg  $1_TRUE='#'
137e9554658Smrg  $1_FALSE=
138e9554658Smrgfi
139e9554658SmrgAC_CONFIG_COMMANDS_PRE(
140e9554658Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
141e9554658Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
142e9554658SmrgUsually this means the macro was only invoked conditionally.]])
143e9554658Smrgfi])])
144e9554658Smrg
1455dd5f640Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
146e9554658Smrg#
147e9554658Smrg# This file is free software; the Free Software Foundation
148e9554658Smrg# gives unlimited permission to copy and/or distribute it,
149e9554658Smrg# with or without modifications, as long as this notice is preserved.
150e9554658Smrg
151e9554658Smrg
1525dd5f640Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
153e9554658Smrg# written in clear, in which case automake, when reading aclocal.m4,
154e9554658Smrg# will think it sees a *use*, and therefore will trigger all it's
155e9554658Smrg# C support machinery.  Also note that it means that autoscan, seeing
156e9554658Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157e9554658Smrg
158e9554658Smrg
159e9554658Smrg# _AM_DEPENDENCIES(NAME)
160e9554658Smrg# ----------------------
161e9554658Smrg# See how the compiler implements dependency checking.
1625dd5f640Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
163e9554658Smrg# We try a few techniques and use that to set a single cache variable.
164e9554658Smrg#
165e9554658Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
166e9554658Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
167e9554658Smrg# dependency, and given that the user is not expected to run this macro,
168e9554658Smrg# just rely on AC_PROG_CC.
169e9554658SmrgAC_DEFUN([_AM_DEPENDENCIES],
170e9554658Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
171e9554658SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
172e9554658SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
173e9554658SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174e9554658Smrg
1755dd5f640Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1765dd5f640Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1775dd5f640Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1785dd5f640Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1795dd5f640Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1805dd5f640Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1815dd5f640Smrg                    [depcc="$$1"   am_compiler_list=])
182e9554658Smrg
183e9554658SmrgAC_CACHE_CHECK([dependency style of $depcc],
184e9554658Smrg               [am_cv_$1_dependencies_compiler_type],
185e9554658Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
186e9554658Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
187e9554658Smrg  # making bogus files that we don't know about and never remove.  For
188e9554658Smrg  # instance it was reported that on HP-UX the gcc test will end up
1895dd5f640Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1905dd5f640Smrg  # in D".
1915dd5f640Smrg  rm -rf conftest.dir
192e9554658Smrg  mkdir conftest.dir
193e9554658Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
194e9554658Smrg  # using a relative directory.
195e9554658Smrg  cp "$am_depcomp" conftest.dir
196e9554658Smrg  cd conftest.dir
197e9554658Smrg  # We will build objects and dependencies in a subdirectory because
198e9554658Smrg  # it helps to detect inapplicable dependency modes.  For instance
199e9554658Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
200e9554658Smrg  # side effect of compilation, but ICC will put the dependencies in
201e9554658Smrg  # the current directory while Tru64 will put them in the object
202e9554658Smrg  # directory.
203e9554658Smrg  mkdir sub
204e9554658Smrg
205e9554658Smrg  am_cv_$1_dependencies_compiler_type=none
206e9554658Smrg  if test "$am_compiler_list" = ""; then
207e9554658Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
208e9554658Smrg  fi
209c2b339b4Smrg  am__universal=false
210c2b339b4Smrg  m4_case([$1], [CC],
211c2b339b4Smrg    [case " $depcc " in #(
212c2b339b4Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
213c2b339b4Smrg     esac],
214c2b339b4Smrg    [CXX],
215c2b339b4Smrg    [case " $depcc " in #(
216c2b339b4Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
217c2b339b4Smrg     esac])
218c2b339b4Smrg
219e9554658Smrg  for depmode in $am_compiler_list; do
220e9554658Smrg    # Setup a source with many dependencies, because some compilers
221e9554658Smrg    # like to wrap large dependency lists on column 80 (with \), and
222e9554658Smrg    # we should not choose a depcomp mode which is confused by this.
223e9554658Smrg    #
224e9554658Smrg    # We need to recreate these files for each test, as the compiler may
225e9554658Smrg    # overwrite some of them when testing with obscure command lines.
226e9554658Smrg    # This happens at least with the AIX C compiler.
227e9554658Smrg    : > sub/conftest.c
228e9554658Smrg    for i in 1 2 3 4 5 6; do
229e9554658Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2305dd5f640Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2315dd5f640Smrg      # Solaris 10 /bin/sh.
2325dd5f640Smrg      echo '/* dummy */' > sub/conftst$i.h
233e9554658Smrg    done
234e9554658Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235e9554658Smrg
2365dd5f640Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
237c2b339b4Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2385dd5f640Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2395dd5f640Smrg    # versions had trouble with output in subdirs.
240c2b339b4Smrg    am__obj=sub/conftest.${OBJEXT-o}
241c2b339b4Smrg    am__minus_obj="-o $am__obj"
242e9554658Smrg    case $depmode in
243c2b339b4Smrg    gcc)
244c2b339b4Smrg      # This depmode causes a compiler race in universal mode.
245c2b339b4Smrg      test "$am__universal" = false || continue
246c2b339b4Smrg      ;;
247e9554658Smrg    nosideeffect)
2485dd5f640Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2495dd5f640Smrg      # only be used when explicitly requested.
250e9554658Smrg      if test "x$enable_dependency_tracking" = xyes; then
251e9554658Smrg	continue
252e9554658Smrg      else
253e9554658Smrg	break
254e9554658Smrg      fi
255e9554658Smrg      ;;
2565dd5f640Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2575dd5f640Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
258c2b339b4Smrg      # not run yet.  These depmodes are late enough in the game, and
259c2b339b4Smrg      # so weak that their functioning should not be impacted.
260c2b339b4Smrg      am__obj=conftest.${OBJEXT-o}
261c2b339b4Smrg      am__minus_obj=
262c2b339b4Smrg      ;;
263e9554658Smrg    none) break ;;
264e9554658Smrg    esac
265e9554658Smrg    if depmode=$depmode \
266c2b339b4Smrg       source=sub/conftest.c object=$am__obj \
267e9554658Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
268c2b339b4Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
269e9554658Smrg         >/dev/null 2>conftest.err &&
270e9554658Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
271e9554658Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
272c2b339b4Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
273e9554658Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
274e9554658Smrg      # icc doesn't choke on unknown options, it will just issue warnings
275e9554658Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
276e9554658Smrg      # that says an option was ignored or not supported.
277e9554658Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
278e9554658Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
279e9554658Smrg      # The diagnosis changed in icc 8.0:
280e9554658Smrg      #   icc: Command line remark: option '-MP' not supported
281e9554658Smrg      if (grep 'ignoring option' conftest.err ||
282e9554658Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
283e9554658Smrg        am_cv_$1_dependencies_compiler_type=$depmode
284e9554658Smrg        break
285e9554658Smrg      fi
286e9554658Smrg    fi
287e9554658Smrg  done
288e9554658Smrg
289e9554658Smrg  cd ..
290e9554658Smrg  rm -rf conftest.dir
291e9554658Smrgelse
292e9554658Smrg  am_cv_$1_dependencies_compiler_type=none
293e9554658Smrgfi
294e9554658Smrg])
295e9554658SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
296e9554658SmrgAM_CONDITIONAL([am__fastdep$1], [
297e9554658Smrg  test "x$enable_dependency_tracking" != xno \
298e9554658Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
299e9554658Smrg])
300e9554658Smrg
301e9554658Smrg
302e9554658Smrg# AM_SET_DEPDIR
303e9554658Smrg# -------------
304e9554658Smrg# Choose a directory name for dependency files.
3055dd5f640Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
306e9554658SmrgAC_DEFUN([AM_SET_DEPDIR],
307e9554658Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
308e9554658SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
309e9554658Smrg])
310e9554658Smrg
311e9554658Smrg
312e9554658Smrg# AM_DEP_TRACK
313e9554658Smrg# ------------
314e9554658SmrgAC_DEFUN([AM_DEP_TRACK],
3155dd5f640Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3165dd5f640SmrgAS_HELP_STRING(
3175dd5f640Smrg  [--enable-dependency-tracking],
3185dd5f640Smrg  [do not reject slow dependency extractors])
3195dd5f640SmrgAS_HELP_STRING(
3205dd5f640Smrg  [--disable-dependency-tracking],
3215dd5f640Smrg  [speeds up one-time build])])
322e9554658Smrgif test "x$enable_dependency_tracking" != xno; then
323e9554658Smrg  am_depcomp="$ac_aux_dir/depcomp"
324e9554658Smrg  AMDEPBACKSLASH='\'
3255dd5f640Smrg  am__nodep='_no'
326e9554658Smrgfi
327e9554658SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
328e9554658SmrgAC_SUBST([AMDEPBACKSLASH])dnl
329e9554658Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3305dd5f640SmrgAC_SUBST([am__nodep])dnl
3315dd5f640Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
332e9554658Smrg])
333e9554658Smrg
334e9554658Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
335e9554658Smrg
3365dd5f640Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
337e9554658Smrg#
338e9554658Smrg# This file is free software; the Free Software Foundation
339e9554658Smrg# gives unlimited permission to copy and/or distribute it,
340e9554658Smrg# with or without modifications, as long as this notice is preserved.
341e9554658Smrg
342e9554658Smrg
343e9554658Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
344e9554658Smrg# ------------------------------
345e9554658SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
346c2b339b4Smrg[{
3475dd5f640Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
348c2b339b4Smrg  # are listed without --file.  Let's play safe and only enable the eval
349c2b339b4Smrg  # if we detect the quoting.
350c2b339b4Smrg  case $CONFIG_FILES in
351c2b339b4Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
352c2b339b4Smrg  *)   set x $CONFIG_FILES ;;
353c2b339b4Smrg  esac
354c2b339b4Smrg  shift
355c2b339b4Smrg  for mf
356c2b339b4Smrg  do
357c2b339b4Smrg    # Strip MF so we end up with the name of the file.
358c2b339b4Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
359c2b339b4Smrg    # Check whether this is an Automake generated Makefile or not.
3605dd5f640Smrg    # We used to match only the files named 'Makefile.in', but
361c2b339b4Smrg    # some people rename them; so instead we look at the file content.
362c2b339b4Smrg    # Grep'ing the first line is not enough: some people post-process
363c2b339b4Smrg    # each Makefile.in and add a new line on top of each file to say so.
364c2b339b4Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
365c2b339b4Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
366c2b339b4Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
367c2b339b4Smrg      dirpart=`AS_DIRNAME("$mf")`
368c2b339b4Smrg    else
369c2b339b4Smrg      continue
370c2b339b4Smrg    fi
371c2b339b4Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
3725dd5f640Smrg    # from the Makefile without running 'make'.
373c2b339b4Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
374c2b339b4Smrg    test -z "$DEPDIR" && continue
375c2b339b4Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3765dd5f640Smrg    test -z "$am__include" && continue
377c2b339b4Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
378c2b339b4Smrg    # Find all dependency output files, they are included files with
379c2b339b4Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
380c2b339b4Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
381c2b339b4Smrg    # expansion.
382c2b339b4Smrg    for file in `sed -n "
383c2b339b4Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3845dd5f640Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
385c2b339b4Smrg      # Make sure the directory exists.
386c2b339b4Smrg      test -f "$dirpart/$file" && continue
387c2b339b4Smrg      fdir=`AS_DIRNAME(["$file"])`
388c2b339b4Smrg      AS_MKDIR_P([$dirpart/$fdir])
389c2b339b4Smrg      # echo "creating $dirpart/$file"
390c2b339b4Smrg      echo '# dummy' > "$dirpart/$file"
391c2b339b4Smrg    done
392e9554658Smrg  done
393c2b339b4Smrg}
394e9554658Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395e9554658Smrg
396e9554658Smrg
397e9554658Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
398e9554658Smrg# -----------------------------
399e9554658Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
400e9554658Smrg#
401e9554658Smrg# This code is only required when automatic dependency tracking
4025dd5f640Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
403e9554658Smrg# need in order to bootstrap the dependency handling code.
404e9554658SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
405e9554658Smrg[AC_CONFIG_COMMANDS([depfiles],
406e9554658Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
407e9554658Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
408e9554658Smrg])
409e9554658Smrg
410e9554658Smrg# Do all the work for Automake.                             -*- Autoconf -*-
411e9554658Smrg
4125dd5f640Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
413e9554658Smrg#
414e9554658Smrg# This file is free software; the Free Software Foundation
415e9554658Smrg# gives unlimited permission to copy and/or distribute it,
416e9554658Smrg# with or without modifications, as long as this notice is preserved.
417e9554658Smrg
418e9554658Smrg# This macro actually does too much.  Some checks are only needed if
419e9554658Smrg# your package does certain things.  But this isn't really a big deal.
420e9554658Smrg
4215dd5f640Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4225dd5f640Smrgm4_define([AC_PROG_CC],
4235dd5f640Smrgm4_defn([AC_PROG_CC])
4245dd5f640Smrg[_AM_PROG_CC_C_O
4255dd5f640Smrg])
4265dd5f640Smrg
427e9554658Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
428e9554658Smrg# AM_INIT_AUTOMAKE([OPTIONS])
429e9554658Smrg# -----------------------------------------------
430e9554658Smrg# The call with PACKAGE and VERSION arguments is the old style
431e9554658Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
432e9554658Smrg# and VERSION should now be passed to AC_INIT and removed from
433e9554658Smrg# the call to AM_INIT_AUTOMAKE.
434e9554658Smrg# We support both call styles for the transition.  After
435e9554658Smrg# the next Automake release, Autoconf can make the AC_INIT
436e9554658Smrg# arguments mandatory, and then we can depend on a new Autoconf
437e9554658Smrg# release and drop the old call support.
438e9554658SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4395dd5f640Smrg[AC_PREREQ([2.65])dnl
440e9554658Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
441e9554658Smrgdnl the ones we care about.
442e9554658Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
443e9554658SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
444e9554658SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
445e9554658Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
446e9554658Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
447e9554658Smrg  # is not polluted with repeated "-I."
448e9554658Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
449e9554658Smrg  # test to see if srcdir already configured
450e9554658Smrg  if test -f $srcdir/config.status; then
451e9554658Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
452e9554658Smrg  fi
453e9554658Smrgfi
454e9554658Smrg
455e9554658Smrg# test whether we have cygpath
456e9554658Smrgif test -z "$CYGPATH_W"; then
457e9554658Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
458e9554658Smrg    CYGPATH_W='cygpath -w'
459e9554658Smrg  else
460e9554658Smrg    CYGPATH_W=echo
461e9554658Smrg  fi
462e9554658Smrgfi
463e9554658SmrgAC_SUBST([CYGPATH_W])
464e9554658Smrg
465e9554658Smrg# Define the identity of the package.
466e9554658Smrgdnl Distinguish between old-style and new-style calls.
467e9554658Smrgm4_ifval([$2],
4685dd5f640Smrg[AC_DIAGNOSE([obsolete],
4695dd5f640Smrg             [$0: two- and three-arguments forms are deprecated.])
4705dd5f640Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
471e9554658Smrg AC_SUBST([PACKAGE], [$1])dnl
472e9554658Smrg AC_SUBST([VERSION], [$2])],
473e9554658Smrg[_AM_SET_OPTIONS([$1])dnl
474e9554658Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4755dd5f640Smrgm4_if(
4765dd5f640Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4775dd5f640Smrg  [ok:ok],,
478e9554658Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
479e9554658Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
480e9554658Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
481e9554658Smrg
482e9554658Smrg_AM_IF_OPTION([no-define],,
4835dd5f640Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4845dd5f640Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
485e9554658Smrg
486e9554658Smrg# Some tools Automake needs.
487e9554658SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
488e9554658SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4895dd5f640SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4905dd5f640SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4915dd5f640SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4925dd5f640SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4935dd5f640SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
494c2b339b4SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
495c2b339b4SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4965dd5f640SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4975dd5f640Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4985dd5f640Smrg# dies out for good.  For more background, see:
4995dd5f640Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
5005dd5f640Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5015dd5f640SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
502e9554658Smrg# We need awk for the "check" target.  The system "awk" is bad on
503e9554658Smrg# some platforms.
504e9554658SmrgAC_REQUIRE([AC_PROG_AWK])dnl
505e9554658SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
506e9554658SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
507e9554658Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
508c2b339b4Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
509c2b339b4Smrg			     [_AM_PROG_TAR([v7])])])
510e9554658Smrg_AM_IF_OPTION([no-dependencies],,
511e9554658Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5125dd5f640Smrg		  [_AM_DEPENDENCIES([CC])],
5135dd5f640Smrg		  [m4_define([AC_PROG_CC],
5145dd5f640Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
515e9554658SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5165dd5f640Smrg		  [_AM_DEPENDENCIES([CXX])],
5175dd5f640Smrg		  [m4_define([AC_PROG_CXX],
5185dd5f640Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
519e9554658SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5205dd5f640Smrg		  [_AM_DEPENDENCIES([OBJC])],
5215dd5f640Smrg		  [m4_define([AC_PROG_OBJC],
5225dd5f640Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5235dd5f640SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5245dd5f640Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5255dd5f640Smrg		  [m4_define([AC_PROG_OBJCXX],
5265dd5f640Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
527e9554658Smrg])
5285dd5f640SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5295dd5f640Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5305dd5f640Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5315dd5f640Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
532c2b339b4SmrgAC_CONFIG_COMMANDS_PRE(dnl
533c2b339b4Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
534c2b339b4Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
535e9554658Smrg
5365dd5f640Smrg# POSIX will say in a future version that running "rm -f" with no argument
5375dd5f640Smrg# is OK; and we want to be able to make that assumption in our Makefile
5385dd5f640Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5395dd5f640Smrg# actually supported "in the wild" to an acceptable degree.
5405dd5f640Smrg# See automake bug#10828.
5415dd5f640Smrg# To make any issue more visible, cause the running configure to be aborted
5425dd5f640Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5435dd5f640Smrg# user can still override this though.
5445dd5f640Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5455dd5f640Smrg  cat >&2 <<'END'
5465dd5f640SmrgOops!
5475dd5f640Smrg
5485dd5f640SmrgYour 'rm' program seems unable to run without file operands specified
5495dd5f640Smrgon the command line, even when the '-f' option is present.  This is contrary
5505dd5f640Smrgto the behaviour of most rm programs out there, and not conforming with
5515dd5f640Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5525dd5f640Smrg
5535dd5f640SmrgPlease tell bug-automake@gnu.org about your system, including the value
5545dd5f640Smrgof your $PATH and any error possibly output before this message.  This
5555dd5f640Smrgcan help us improve future automake versions.
5565dd5f640Smrg
5575dd5f640SmrgEND
5585dd5f640Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5595dd5f640Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5605dd5f640Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5615dd5f640Smrg    echo >&2
5625dd5f640Smrg  else
5635dd5f640Smrg    cat >&2 <<'END'
5645dd5f640SmrgAborting the configuration process, to ensure you take notice of the issue.
5655dd5f640Smrg
5665dd5f640SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5675dd5f640Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5685dd5f640Smrg
5695dd5f640SmrgIf you want to complete the configuration process using your problematic
5705dd5f640Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5715dd5f640Smrgto "yes", and re-run configure.
5725dd5f640Smrg
5735dd5f640SmrgEND
5745dd5f640Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5755dd5f640Smrg  fi
5765dd5f640Smrgfi])
5775dd5f640Smrg
5785dd5f640Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
579c2b339b4Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
580c2b339b4Smrgdnl mangled by Autoconf and run in a shell conditional statement.
581c2b339b4Smrgm4_define([_AC_COMPILER_EXEEXT],
582c2b339b4Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
583c2b339b4Smrg
584e9554658Smrg# When config.status generates a header, we must update the stamp-h file.
585e9554658Smrg# This file resides in the same directory as the config header
586e9554658Smrg# that is generated.  The stamp files are numbered to have different names.
587e9554658Smrg
588e9554658Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
589e9554658Smrg# loop where config.status creates the headers, so we can generate
590e9554658Smrg# our stamp files there.
591e9554658SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
592e9554658Smrg[# Compute $1's index in $config_headers.
593c2b339b4Smrg_am_arg=$1
594e9554658Smrg_am_stamp_count=1
595e9554658Smrgfor _am_header in $config_headers :; do
596e9554658Smrg  case $_am_header in
597c2b339b4Smrg    $_am_arg | $_am_arg:* )
598e9554658Smrg      break ;;
599e9554658Smrg    * )
600e9554658Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
601e9554658Smrg  esac
602e9554658Smrgdone
603c2b339b4Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
604e9554658Smrg
6055dd5f640Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
606e9554658Smrg#
607e9554658Smrg# This file is free software; the Free Software Foundation
608e9554658Smrg# gives unlimited permission to copy and/or distribute it,
609e9554658Smrg# with or without modifications, as long as this notice is preserved.
610e9554658Smrg
611e9554658Smrg# AM_PROG_INSTALL_SH
612e9554658Smrg# ------------------
613e9554658Smrg# Define $install_sh.
614e9554658SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
615e9554658Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
616c2b339b4Smrgif test x"${install_sh}" != xset; then
617c2b339b4Smrg  case $am_aux_dir in
618c2b339b4Smrg  *\ * | *\	*)
619c2b339b4Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
620c2b339b4Smrg  *)
621c2b339b4Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
622c2b339b4Smrg  esac
623c2b339b4Smrgfi
6245dd5f640SmrgAC_SUBST([install_sh])])
625e9554658Smrg
6265dd5f640Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
627e9554658Smrg#
628e9554658Smrg# This file is free software; the Free Software Foundation
629e9554658Smrg# gives unlimited permission to copy and/or distribute it,
630e9554658Smrg# with or without modifications, as long as this notice is preserved.
631e9554658Smrg
632e9554658Smrg# Check whether the underlying file-system supports filenames
633e9554658Smrg# with a leading dot.  For instance MS-DOS doesn't.
634e9554658SmrgAC_DEFUN([AM_SET_LEADING_DOT],
635e9554658Smrg[rm -rf .tst 2>/dev/null
636e9554658Smrgmkdir .tst 2>/dev/null
637e9554658Smrgif test -d .tst; then
638e9554658Smrg  am__leading_dot=.
639e9554658Smrgelse
640e9554658Smrg  am__leading_dot=_
641e9554658Smrgfi
642e9554658Smrgrmdir .tst 2>/dev/null
643e9554658SmrgAC_SUBST([am__leading_dot])])
644e9554658Smrg
645e9554658Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
646e9554658Smrg# From Jim Meyering
647e9554658Smrg
6485dd5f640Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
649e9554658Smrg#
650e9554658Smrg# This file is free software; the Free Software Foundation
651e9554658Smrg# gives unlimited permission to copy and/or distribute it,
652e9554658Smrg# with or without modifications, as long as this notice is preserved.
653e9554658Smrg
654c2b339b4Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
655c2b339b4Smrg# ----------------------------------
656c2b339b4Smrg# Control maintainer-specific portions of Makefiles.
6575dd5f640Smrg# Default is to disable them, unless 'enable' is passed literally.
6585dd5f640Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
659c2b339b4Smrg# can override the default with the --enable/--disable switch.
660e9554658SmrgAC_DEFUN([AM_MAINTAINER_MODE],
661c2b339b4Smrg[m4_case(m4_default([$1], [disable]),
662c2b339b4Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
663c2b339b4Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
664c2b339b4Smrg       [m4_define([am_maintainer_other], [enable])
665c2b339b4Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6665dd5f640SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
667c2b339b4Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
668c2b339b4Smrg  AC_ARG_ENABLE([maintainer-mode],
6695dd5f640Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
6705dd5f640Smrg      am_maintainer_other[ make rules and dependencies not useful
6715dd5f640Smrg      (and sometimes confusing) to the casual installer])],
6725dd5f640Smrg    [USE_MAINTAINER_MODE=$enableval],
6735dd5f640Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
674e9554658Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
675c2b339b4Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
676e9554658Smrg  MAINT=$MAINTAINER_MODE_TRUE
677c2b339b4Smrg  AC_SUBST([MAINT])dnl
678e9554658Smrg]
679e9554658Smrg)
680e9554658Smrg
681e9554658Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
682e9554658Smrg
6835dd5f640Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
684e9554658Smrg#
685e9554658Smrg# This file is free software; the Free Software Foundation
686e9554658Smrg# gives unlimited permission to copy and/or distribute it,
687e9554658Smrg# with or without modifications, as long as this notice is preserved.
688e9554658Smrg
689e9554658Smrg# AM_MAKE_INCLUDE()
690e9554658Smrg# -----------------
691e9554658Smrg# Check to see how make treats includes.
692e9554658SmrgAC_DEFUN([AM_MAKE_INCLUDE],
693e9554658Smrg[am_make=${MAKE-make}
694e9554658Smrgcat > confinc << 'END'
695e9554658Smrgam__doit:
696c2b339b4Smrg	@echo this is the am__doit target
697e9554658Smrg.PHONY: am__doit
698e9554658SmrgEND
699e9554658Smrg# If we don't find an include directive, just comment out the code.
700e9554658SmrgAC_MSG_CHECKING([for style of include used by $am_make])
701e9554658Smrgam__include="#"
702e9554658Smrgam__quote=
703e9554658Smrg_am_result=none
704e9554658Smrg# First try GNU make style include.
705e9554658Smrgecho "include confinc" > confmf
7065dd5f640Smrg# Ignore all kinds of additional output from 'make'.
707c2b339b4Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
708c2b339b4Smrg*the\ am__doit\ target*)
709c2b339b4Smrg  am__include=include
710c2b339b4Smrg  am__quote=
711c2b339b4Smrg  _am_result=GNU
712c2b339b4Smrg  ;;
713c2b339b4Smrgesac
714e9554658Smrg# Now try BSD make style include.
715e9554658Smrgif test "$am__include" = "#"; then
716e9554658Smrg   echo '.include "confinc"' > confmf
717c2b339b4Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
718c2b339b4Smrg   *the\ am__doit\ target*)
719c2b339b4Smrg     am__include=.include
720c2b339b4Smrg     am__quote="\""
721c2b339b4Smrg     _am_result=BSD
722c2b339b4Smrg     ;;
723c2b339b4Smrg   esac
724e9554658Smrgfi
725e9554658SmrgAC_SUBST([am__include])
726e9554658SmrgAC_SUBST([am__quote])
727e9554658SmrgAC_MSG_RESULT([$_am_result])
728e9554658Smrgrm -f confinc confmf
729e9554658Smrg])
730e9554658Smrg
731e9554658Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
732e9554658Smrg
7335dd5f640Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
734e9554658Smrg#
735e9554658Smrg# This file is free software; the Free Software Foundation
736e9554658Smrg# gives unlimited permission to copy and/or distribute it,
737e9554658Smrg# with or without modifications, as long as this notice is preserved.
738e9554658Smrg
739e9554658Smrg# AM_MISSING_PROG(NAME, PROGRAM)
740e9554658Smrg# ------------------------------
741e9554658SmrgAC_DEFUN([AM_MISSING_PROG],
742e9554658Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
743e9554658Smrg$1=${$1-"${am_missing_run}$2"}
744e9554658SmrgAC_SUBST($1)])
745e9554658Smrg
746e9554658Smrg# AM_MISSING_HAS_RUN
747e9554658Smrg# ------------------
7485dd5f640Smrg# Define MISSING if not defined so far and test if it is modern enough.
7495dd5f640Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
750e9554658SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
751e9554658Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
752e9554658SmrgAC_REQUIRE_AUX_FILE([missing])dnl
753c2b339b4Smrgif test x"${MISSING+set}" != xset; then
754c2b339b4Smrg  case $am_aux_dir in
755c2b339b4Smrg  *\ * | *\	*)
756c2b339b4Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
757c2b339b4Smrg  *)
758c2b339b4Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
759c2b339b4Smrg  esac
760c2b339b4Smrgfi
761e9554658Smrg# Use eval to expand $SHELL
7625dd5f640Smrgif eval "$MISSING --is-lightweight"; then
7635dd5f640Smrg  am_missing_run="$MISSING "
764e9554658Smrgelse
765e9554658Smrg  am_missing_run=
7665dd5f640Smrg  AC_MSG_WARN(['missing' script is too old or missing])
767e9554658Smrgfi
768e9554658Smrg])
769e9554658Smrg
770e9554658Smrg# Helper functions for option handling.                     -*- Autoconf -*-
771e9554658Smrg
7725dd5f640Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
773e9554658Smrg#
774e9554658Smrg# This file is free software; the Free Software Foundation
775e9554658Smrg# gives unlimited permission to copy and/or distribute it,
776e9554658Smrg# with or without modifications, as long as this notice is preserved.
777e9554658Smrg
778e9554658Smrg# _AM_MANGLE_OPTION(NAME)
779e9554658Smrg# -----------------------
780e9554658SmrgAC_DEFUN([_AM_MANGLE_OPTION],
781e9554658Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782e9554658Smrg
783e9554658Smrg# _AM_SET_OPTION(NAME)
7845dd5f640Smrg# --------------------
785e9554658Smrg# Set option NAME.  Presently that only means defining a flag for this option.
786e9554658SmrgAC_DEFUN([_AM_SET_OPTION],
7875dd5f640Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
788e9554658Smrg
789e9554658Smrg# _AM_SET_OPTIONS(OPTIONS)
7905dd5f640Smrg# ------------------------
791e9554658Smrg# OPTIONS is a space-separated list of Automake options.
792e9554658SmrgAC_DEFUN([_AM_SET_OPTIONS],
793c2b339b4Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794e9554658Smrg
795e9554658Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
796e9554658Smrg# -------------------------------------------
797e9554658Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
798e9554658SmrgAC_DEFUN([_AM_IF_OPTION],
799e9554658Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800e9554658Smrg
8015dd5f640Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
8025dd5f640Smrg#
8035dd5f640Smrg# This file is free software; the Free Software Foundation
8045dd5f640Smrg# gives unlimited permission to copy and/or distribute it,
8055dd5f640Smrg# with or without modifications, as long as this notice is preserved.
8065dd5f640Smrg
8075dd5f640Smrg# _AM_PROG_CC_C_O
8085dd5f640Smrg# ---------------
8095dd5f640Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
8105dd5f640Smrg# to automatically call this.
8115dd5f640SmrgAC_DEFUN([_AM_PROG_CC_C_O],
8125dd5f640Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
8135dd5f640SmrgAC_REQUIRE_AUX_FILE([compile])dnl
8145dd5f640SmrgAC_LANG_PUSH([C])dnl
8155dd5f640SmrgAC_CACHE_CHECK(
8165dd5f640Smrg  [whether $CC understands -c and -o together],
8175dd5f640Smrg  [am_cv_prog_cc_c_o],
8185dd5f640Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
8195dd5f640Smrg  # Make sure it works both with $CC and with simple cc.
8205dd5f640Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
8215dd5f640Smrg  # compilers refuse to overwrite an existing .o file with -o,
8225dd5f640Smrg  # though they will create one.
8235dd5f640Smrg  am_cv_prog_cc_c_o=yes
8245dd5f640Smrg  for am_i in 1 2; do
8255dd5f640Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
8265dd5f640Smrg         && test -f conftest2.$ac_objext; then
8275dd5f640Smrg      : OK
8285dd5f640Smrg    else
8295dd5f640Smrg      am_cv_prog_cc_c_o=no
8305dd5f640Smrg      break
8315dd5f640Smrg    fi
8325dd5f640Smrg  done
8335dd5f640Smrg  rm -f core conftest*
8345dd5f640Smrg  unset am_i])
8355dd5f640Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8365dd5f640Smrg   # Losing compiler, so override with the script.
8375dd5f640Smrg   # FIXME: It is wrong to rewrite CC.
8385dd5f640Smrg   # But if we don't then we get into trouble of one sort or another.
8395dd5f640Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8405dd5f640Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8415dd5f640Smrg   CC="$am_aux_dir/compile $CC"
8425dd5f640Smrgfi
8435dd5f640SmrgAC_LANG_POP([C])])
8445dd5f640Smrg
8455dd5f640Smrg# For backward compatibility.
8465dd5f640SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
847e9554658Smrg
8485dd5f640Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
849e9554658Smrg#
850e9554658Smrg# This file is free software; the Free Software Foundation
851e9554658Smrg# gives unlimited permission to copy and/or distribute it,
852e9554658Smrg# with or without modifications, as long as this notice is preserved.
853e9554658Smrg
8545dd5f640Smrg# AM_RUN_LOG(COMMAND)
8555dd5f640Smrg# -------------------
8565dd5f640Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8575dd5f640Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8585dd5f640SmrgAC_DEFUN([AM_RUN_LOG],
8595dd5f640Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8605dd5f640Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8615dd5f640Smrg   ac_status=$?
8625dd5f640Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8635dd5f640Smrg   (exit $ac_status); }])
8645dd5f640Smrg
8655dd5f640Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8665dd5f640Smrg
8675dd5f640Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
8685dd5f640Smrg#
8695dd5f640Smrg# This file is free software; the Free Software Foundation
8705dd5f640Smrg# gives unlimited permission to copy and/or distribute it,
8715dd5f640Smrg# with or without modifications, as long as this notice is preserved.
872e9554658Smrg
873e9554658Smrg# AM_SANITY_CHECK
874e9554658Smrg# ---------------
875e9554658SmrgAC_DEFUN([AM_SANITY_CHECK],
876e9554658Smrg[AC_MSG_CHECKING([whether build environment is sane])
877c2b339b4Smrg# Reject unsafe characters in $srcdir or the absolute working directory
878c2b339b4Smrg# name.  Accept space and tab only in the latter.
879c2b339b4Smrgam_lf='
880c2b339b4Smrg'
881c2b339b4Smrgcase `pwd` in
882c2b339b4Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
883c2b339b4Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
884c2b339b4Smrgesac
885c2b339b4Smrgcase $srcdir in
886c2b339b4Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8875dd5f640Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
888c2b339b4Smrgesac
889c2b339b4Smrg
8905dd5f640Smrg# Do 'set' in a subshell so we don't clobber the current shell's
891e9554658Smrg# arguments.  Must try -L first in case configure is actually a
892e9554658Smrg# symlink; some systems play weird games with the mod time of symlinks
893e9554658Smrg# (eg FreeBSD returns the mod time of the symlink's containing
894e9554658Smrg# directory).
895e9554658Smrgif (
8965dd5f640Smrg   am_has_slept=no
8975dd5f640Smrg   for am_try in 1 2; do
8985dd5f640Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8995dd5f640Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9005dd5f640Smrg     if test "$[*]" = "X"; then
9015dd5f640Smrg	# -L didn't work.
9025dd5f640Smrg	set X `ls -t "$srcdir/configure" conftest.file`
9035dd5f640Smrg     fi
9045dd5f640Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
9055dd5f640Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
9065dd5f640Smrg
9075dd5f640Smrg	# If neither matched, then we have a broken ls.  This can happen
9085dd5f640Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
9095dd5f640Smrg	# broken ls alias from the environment.  This has actually
9105dd5f640Smrg	# happened.  Such a system could not be considered "sane".
9115dd5f640Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
9125dd5f640Smrg  alias in your environment])
9135dd5f640Smrg     fi
9145dd5f640Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
9155dd5f640Smrg       break
9165dd5f640Smrg     fi
9175dd5f640Smrg     # Just in case.
9185dd5f640Smrg     sleep 1
9195dd5f640Smrg     am_has_slept=yes
9205dd5f640Smrg   done
921e9554658Smrg   test "$[2]" = conftest.file
922e9554658Smrg   )
923e9554658Smrgthen
924e9554658Smrg   # Ok.
925e9554658Smrg   :
926e9554658Smrgelse
927e9554658Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
928e9554658SmrgCheck your system clock])
929e9554658Smrgfi
9305dd5f640SmrgAC_MSG_RESULT([yes])
9315dd5f640Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
9325dd5f640Smrg# generated files are strictly newer.
9335dd5f640Smrgam_sleep_pid=
9345dd5f640Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9355dd5f640Smrg  ( sleep 1 ) &
9365dd5f640Smrg  am_sleep_pid=$!
9375dd5f640Smrgfi
9385dd5f640SmrgAC_CONFIG_COMMANDS_PRE(
9395dd5f640Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9405dd5f640Smrg   if test -n "$am_sleep_pid"; then
9415dd5f640Smrg     # Hide warnings about reused PIDs.
9425dd5f640Smrg     wait $am_sleep_pid 2>/dev/null
9435dd5f640Smrg   fi
9445dd5f640Smrg   AC_MSG_RESULT([done])])
9455dd5f640Smrgrm -f conftest.file
9465dd5f640Smrg])
947e9554658Smrg
9485dd5f640Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
949c2b339b4Smrg#
950c2b339b4Smrg# This file is free software; the Free Software Foundation
951c2b339b4Smrg# gives unlimited permission to copy and/or distribute it,
952c2b339b4Smrg# with or without modifications, as long as this notice is preserved.
953c2b339b4Smrg
954c2b339b4Smrg# AM_SILENT_RULES([DEFAULT])
955c2b339b4Smrg# --------------------------
956c2b339b4Smrg# Enable less verbose build rules; with the default set to DEFAULT
9575dd5f640Smrg# ("yes" being less verbose, "no" or empty being verbose).
958c2b339b4SmrgAC_DEFUN([AM_SILENT_RULES],
9595dd5f640Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9605dd5f640SmrgAS_HELP_STRING(
9615dd5f640Smrg  [--enable-silent-rules],
9625dd5f640Smrg  [less verbose build output (undo: "make V=1")])
9635dd5f640SmrgAS_HELP_STRING(
9645dd5f640Smrg  [--disable-silent-rules],
9655dd5f640Smrg  [verbose build output (undo: "make V=0")])dnl
9665dd5f640Smrg])
9675dd5f640Smrgcase $enable_silent_rules in @%:@ (((
9685dd5f640Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9695dd5f640Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9705dd5f640Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
971c2b339b4Smrgesac
9725dd5f640Smrgdnl
9735dd5f640Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9745dd5f640Smrgdnl do not support nested variable expansions.
9755dd5f640Smrgdnl See automake bug#9928 and bug#10237.
9765dd5f640Smrgam_make=${MAKE-make}
9775dd5f640SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9785dd5f640Smrg   [am_cv_make_support_nested_variables],
9795dd5f640Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9805dd5f640SmrgBAR0=false
9815dd5f640SmrgBAR1=true
9825dd5f640SmrgV=1
9835dd5f640Smrgam__doit:
9845dd5f640Smrg	@$(TRUE)
9855dd5f640Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9865dd5f640Smrg  am_cv_make_support_nested_variables=yes
9875dd5f640Smrgelse
9885dd5f640Smrg  am_cv_make_support_nested_variables=no
9895dd5f640Smrgfi])
9905dd5f640Smrgif test $am_cv_make_support_nested_variables = yes; then
9915dd5f640Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9925dd5f640Smrg  AM_V='$(V)'
9935dd5f640Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9945dd5f640Smrgelse
9955dd5f640Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9965dd5f640Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9975dd5f640Smrgfi
9985dd5f640SmrgAC_SUBST([AM_V])dnl
9995dd5f640SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10005dd5f640SmrgAC_SUBST([AM_DEFAULT_V])dnl
10015dd5f640SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1002c2b339b4SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1003c2b339b4SmrgAM_BACKSLASH='\'
1004c2b339b4SmrgAC_SUBST([AM_BACKSLASH])dnl
1005c2b339b4Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1006c2b339b4Smrg])
1007c2b339b4Smrg
10085dd5f640Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
1009e9554658Smrg#
1010e9554658Smrg# This file is free software; the Free Software Foundation
1011e9554658Smrg# gives unlimited permission to copy and/or distribute it,
1012e9554658Smrg# with or without modifications, as long as this notice is preserved.
1013e9554658Smrg
1014e9554658Smrg# AM_PROG_INSTALL_STRIP
1015e9554658Smrg# ---------------------
10165dd5f640Smrg# One issue with vendor 'install' (even GNU) is that you can't
1017e9554658Smrg# specify the program used to strip binaries.  This is especially
1018e9554658Smrg# annoying in cross-compiling environments, where the build's strip
1019e9554658Smrg# is unlikely to handle the host's binaries.
1020e9554658Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
10215dd5f640Smrg# always use install-sh in "make install-strip", and initialize
1022e9554658Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
1023e9554658SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1024e9554658Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
10255dd5f640Smrg# Installed binaries are usually stripped using 'strip' when the user
10265dd5f640Smrg# run "make install-strip".  However 'strip' might not be the right
1027e9554658Smrg# tool to use in cross-compilation environments, therefore Automake
10285dd5f640Smrg# will honor the 'STRIP' environment variable to overrule this program.
10295dd5f640Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1030e9554658Smrgif test "$cross_compiling" != no; then
1031e9554658Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
1032e9554658Smrgfi
1033e9554658SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1034e9554658SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1035e9554658Smrg
10365dd5f640Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
1037e9554658Smrg#
1038e9554658Smrg# This file is free software; the Free Software Foundation
1039e9554658Smrg# gives unlimited permission to copy and/or distribute it,
1040e9554658Smrg# with or without modifications, as long as this notice is preserved.
1041e9554658Smrg
1042e9554658Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1043e9554658Smrg# ---------------------------
1044c2b339b4Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1045e9554658Smrg# This macro is traced by Automake.
1046e9554658SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1047e9554658Smrg
1048c2b339b4Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10495dd5f640Smrg# --------------------------
1050c2b339b4Smrg# Public sister of _AM_SUBST_NOTMAKE.
1051c2b339b4SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1052c2b339b4Smrg
1053e9554658Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1054e9554658Smrg
10555dd5f640Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
1056e9554658Smrg#
1057e9554658Smrg# This file is free software; the Free Software Foundation
1058e9554658Smrg# gives unlimited permission to copy and/or distribute it,
1059e9554658Smrg# with or without modifications, as long as this notice is preserved.
1060e9554658Smrg
1061e9554658Smrg# _AM_PROG_TAR(FORMAT)
1062e9554658Smrg# --------------------
1063e9554658Smrg# Check how to create a tarball in format FORMAT.
10645dd5f640Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1065e9554658Smrg#
1066e9554658Smrg# Substitute a variable $(am__tar) that is a command
1067e9554658Smrg# writing to stdout a FORMAT-tarball containing the directory
1068e9554658Smrg# $tardir.
1069e9554658Smrg#     tardir=directory && $(am__tar) > result.tar
1070e9554658Smrg#
1071e9554658Smrg# Substitute a variable $(am__untar) that extract such
1072e9554658Smrg# a tarball read from stdin.
1073e9554658Smrg#     $(am__untar) < result.tar
10745dd5f640Smrg#
1075e9554658SmrgAC_DEFUN([_AM_PROG_TAR],
10765dd5f640Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10775dd5f640Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10785dd5f640SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10795dd5f640Smrg
10805dd5f640Smrg# We'll loop over all known methods to create a tar archive until one works.
1081e9554658Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1082e9554658Smrg
10835dd5f640Smrgm4_if([$1], [v7],
10845dd5f640Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10855dd5f640Smrg
10865dd5f640Smrg  [m4_case([$1],
10875dd5f640Smrg    [ustar],
10885dd5f640Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10895dd5f640Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10905dd5f640Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10915dd5f640Smrg      # and bug#13588).
10925dd5f640Smrg      am_max_uid=2097151 # 2^21 - 1
10935dd5f640Smrg      am_max_gid=$am_max_uid
10945dd5f640Smrg      # The $UID and $GID variables are not portable, so we need to resort
10955dd5f640Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10965dd5f640Smrg      # below are definitely unexpected, so allow the users to see them
10975dd5f640Smrg      # (that is, avoid stderr redirection).
10985dd5f640Smrg      am_uid=`id -u || echo unknown`
10995dd5f640Smrg      am_gid=`id -g || echo unknown`
11005dd5f640Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11015dd5f640Smrg      if test $am_uid -le $am_max_uid; then
11025dd5f640Smrg         AC_MSG_RESULT([yes])
11035dd5f640Smrg      else
11045dd5f640Smrg         AC_MSG_RESULT([no])
11055dd5f640Smrg         _am_tools=none
11065dd5f640Smrg      fi
11075dd5f640Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
11085dd5f640Smrg      if test $am_gid -le $am_max_gid; then
11095dd5f640Smrg         AC_MSG_RESULT([yes])
11105dd5f640Smrg      else
11115dd5f640Smrg        AC_MSG_RESULT([no])
11125dd5f640Smrg        _am_tools=none
11135dd5f640Smrg      fi],
1114e9554658Smrg
11155dd5f640Smrg  [pax],
11165dd5f640Smrg    [],
11175dd5f640Smrg
11185dd5f640Smrg  [m4_fatal([Unknown tar format])])
11195dd5f640Smrg
11205dd5f640Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
11215dd5f640Smrg
11225dd5f640Smrg  # Go ahead even if we have the value already cached.  We do so because we
11235dd5f640Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
11245dd5f640Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
11255dd5f640Smrg
11265dd5f640Smrg  for _am_tool in $_am_tools; do
11275dd5f640Smrg    case $_am_tool in
11285dd5f640Smrg    gnutar)
11295dd5f640Smrg      for _am_tar in tar gnutar gtar; do
11305dd5f640Smrg        AM_RUN_LOG([$_am_tar --version]) && break
11315dd5f640Smrg      done
11325dd5f640Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11335dd5f640Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11345dd5f640Smrg      am__untar="$_am_tar -xf -"
11355dd5f640Smrg      ;;
11365dd5f640Smrg    plaintar)
11375dd5f640Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11385dd5f640Smrg      # ustar tarball either.
11395dd5f640Smrg      (tar --version) >/dev/null 2>&1 && continue
11405dd5f640Smrg      am__tar='tar chf - "$$tardir"'
11415dd5f640Smrg      am__tar_='tar chf - "$tardir"'
11425dd5f640Smrg      am__untar='tar xf -'
11435dd5f640Smrg      ;;
11445dd5f640Smrg    pax)
11455dd5f640Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11465dd5f640Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11475dd5f640Smrg      am__untar='pax -r'
11485dd5f640Smrg      ;;
11495dd5f640Smrg    cpio)
11505dd5f640Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11515dd5f640Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11525dd5f640Smrg      am__untar='cpio -i -H $1 -d'
11535dd5f640Smrg      ;;
11545dd5f640Smrg    none)
11555dd5f640Smrg      am__tar=false
11565dd5f640Smrg      am__tar_=false
11575dd5f640Smrg      am__untar=false
11585dd5f640Smrg      ;;
11595dd5f640Smrg    esac
11605dd5f640Smrg
11615dd5f640Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11625dd5f640Smrg    # and am__untar set.
11635dd5f640Smrg    test -n "${am_cv_prog_tar_$1}" && break
11645dd5f640Smrg
11655dd5f640Smrg    # tar/untar a dummy directory, and stop if the command works.
11665dd5f640Smrg    rm -rf conftest.dir
11675dd5f640Smrg    mkdir conftest.dir
11685dd5f640Smrg    echo GrepMe > conftest.dir/file
11695dd5f640Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11705dd5f640Smrg    rm -rf conftest.dir
11715dd5f640Smrg    if test -s conftest.tar; then
11725dd5f640Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11735dd5f640Smrg      AM_RUN_LOG([cat conftest.dir/file])
11745dd5f640Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11755dd5f640Smrg    fi
11765dd5f640Smrg  done
1177e9554658Smrg  rm -rf conftest.dir
1178e9554658Smrg
11795dd5f640Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11805dd5f640Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11815dd5f640Smrg
1182e9554658SmrgAC_SUBST([am__tar])
1183e9554658SmrgAC_SUBST([am__untar])
1184e9554658Smrg]) # _AM_PROG_TAR
1185e9554658Smrg
1186309c398aSmrg# iconv.m4 serial AM4 (gettext-0.11.3)
1187309c398aSmrgdnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
1188309c398aSmrgdnl This file is free software; the Free Software Foundation
1189309c398aSmrgdnl gives unlimited permission to copy and/or distribute it,
1190309c398aSmrgdnl with or without modifications, as long as this notice is preserved.
1191e9554658Smrg
1192309c398aSmrgdnl From Bruno Haible.
1193e9554658Smrg
1194309c398aSmrgAC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
1195309c398aSmrg[
1196309c398aSmrg  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
1197309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1198309c398aSmrg  AC_REQUIRE([AC_LIB_RPATH])
1199e9554658Smrg
1200309c398aSmrg  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
1201309c398aSmrg  dnl accordingly.
1202309c398aSmrg  AC_LIB_LINKFLAGS_BODY([iconv])
1203309c398aSmrg])
1204e9554658Smrg
1205309c398aSmrgAC_DEFUN([AM_ICONV_LINK],
1206309c398aSmrg[
1207309c398aSmrg  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
1208309c398aSmrg  dnl those with the standalone portable GNU libiconv installed).
1209309c398aSmrg
1210309c398aSmrg  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
1211309c398aSmrg  dnl accordingly.
1212309c398aSmrg  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
1213309c398aSmrg
1214309c398aSmrg  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
1215309c398aSmrg  dnl because if the user has installed libiconv and not disabled its use
1216309c398aSmrg  dnl via --without-libiconv-prefix, he wants to use it. The first
1217309c398aSmrg  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
1218309c398aSmrg  am_save_CPPFLAGS="$CPPFLAGS"
1219309c398aSmrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
1220309c398aSmrg
1221309c398aSmrg  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
1222309c398aSmrg    am_cv_func_iconv="no, consider installing GNU libiconv"
1223309c398aSmrg    am_cv_lib_iconv=no
1224309c398aSmrg    AC_TRY_LINK([#include <stdlib.h>
1225309c398aSmrg#include <iconv.h>],
1226309c398aSmrg      [iconv_t cd = iconv_open("","");
1227309c398aSmrg       iconv(cd,NULL,NULL,NULL,NULL);
1228309c398aSmrg       iconv_close(cd);],
1229309c398aSmrg      am_cv_func_iconv=yes)
1230309c398aSmrg    if test "$am_cv_func_iconv" != yes; then
1231309c398aSmrg      am_save_LIBS="$LIBS"
1232309c398aSmrg      LIBS="$LIBS $LIBICONV"
1233309c398aSmrg      AC_TRY_LINK([#include <stdlib.h>
1234309c398aSmrg#include <iconv.h>],
1235309c398aSmrg        [iconv_t cd = iconv_open("","");
1236309c398aSmrg         iconv(cd,NULL,NULL,NULL,NULL);
1237309c398aSmrg         iconv_close(cd);],
1238309c398aSmrg        am_cv_lib_iconv=yes
1239309c398aSmrg        am_cv_func_iconv=yes)
1240309c398aSmrg      LIBS="$am_save_LIBS"
1241309c398aSmrg    fi
1242309c398aSmrg  ])
1243309c398aSmrg  if test "$am_cv_func_iconv" = yes; then
1244309c398aSmrg    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
1245309c398aSmrg  fi
1246309c398aSmrg  if test "$am_cv_lib_iconv" = yes; then
1247309c398aSmrg    AC_MSG_CHECKING([how to link with libiconv])
1248309c398aSmrg    AC_MSG_RESULT([$LIBICONV])
1249309c398aSmrg  else
1250309c398aSmrg    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
1251309c398aSmrg    dnl either.
1252309c398aSmrg    CPPFLAGS="$am_save_CPPFLAGS"
1253309c398aSmrg    LIBICONV=
1254309c398aSmrg    LTLIBICONV=
1255309c398aSmrg  fi
1256309c398aSmrg  AC_SUBST(LIBICONV)
1257309c398aSmrg  AC_SUBST(LTLIBICONV)
1258309c398aSmrg])
1259e9554658Smrg
1260309c398aSmrgAC_DEFUN([AM_ICONV],
1261309c398aSmrg[
1262309c398aSmrg  AM_ICONV_LINK
1263309c398aSmrg  if test "$am_cv_func_iconv" = yes; then
1264309c398aSmrg    AC_MSG_CHECKING([for iconv declaration])
1265309c398aSmrg    AC_CACHE_VAL(am_cv_proto_iconv, [
1266309c398aSmrg      AC_TRY_COMPILE([
1267309c398aSmrg#include <stdlib.h>
1268309c398aSmrg#include <iconv.h>
1269309c398aSmrgextern
1270309c398aSmrg#ifdef __cplusplus
1271309c398aSmrg"C"
1272309c398aSmrg#endif
1273309c398aSmrg#if defined(__STDC__) || defined(__cplusplus)
1274309c398aSmrgsize_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1275309c398aSmrg#else
1276309c398aSmrgsize_t iconv();
1277309c398aSmrg#endif
1278309c398aSmrg], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
1279309c398aSmrg      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);"])
1280309c398aSmrg    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1281309c398aSmrg    AC_MSG_RESULT([$]{ac_t:-
1282309c398aSmrg         }[$]am_cv_proto_iconv)
1283309c398aSmrg    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
1284309c398aSmrg      [Define as const if the declaration of iconv() needs const.])
1285309c398aSmrg  fi
1286309c398aSmrg])
1287e9554658Smrg
1288309c398aSmrg# lib-ld.m4 serial 3 (gettext-0.13)
1289309c398aSmrgdnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
1290309c398aSmrgdnl This file is free software; the Free Software Foundation
1291309c398aSmrgdnl gives unlimited permission to copy and/or distribute it,
1292309c398aSmrgdnl with or without modifications, as long as this notice is preserved.
1293309c398aSmrg
1294309c398aSmrgdnl Subroutines of libtool.m4,
1295309c398aSmrgdnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
1296309c398aSmrgdnl with libtool.m4.
1297309c398aSmrg
1298309c398aSmrgdnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
1299309c398aSmrgAC_DEFUN([AC_LIB_PROG_LD_GNU],
1300309c398aSmrg[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
1301309c398aSmrg[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1302309c398aSmrgcase `$LD -v 2>&1 </dev/null` in
1303309c398aSmrg*GNU* | *'with BFD'*)
1304309c398aSmrg  acl_cv_prog_gnu_ld=yes ;;
1305309c398aSmrg*)
1306309c398aSmrg  acl_cv_prog_gnu_ld=no ;;
1307309c398aSmrgesac])
1308309c398aSmrgwith_gnu_ld=$acl_cv_prog_gnu_ld
1309309c398aSmrg])
1310e9554658Smrg
1311309c398aSmrgdnl From libtool-1.4. Sets the variable LD.
1312309c398aSmrgAC_DEFUN([AC_LIB_PROG_LD],
1313309c398aSmrg[AC_ARG_WITH(gnu-ld,
1314309c398aSmrg[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1315309c398aSmrgtest "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1316309c398aSmrgAC_REQUIRE([AC_PROG_CC])dnl
1317309c398aSmrgAC_REQUIRE([AC_CANONICAL_HOST])dnl
1318309c398aSmrg# Prepare PATH_SEPARATOR.
1319309c398aSmrg# The user is always right.
1320309c398aSmrgif test "${PATH_SEPARATOR+set}" != set; then
1321309c398aSmrg  echo "#! /bin/sh" >conf$$.sh
1322309c398aSmrg  echo  "exit 0"   >>conf$$.sh
1323309c398aSmrg  chmod +x conf$$.sh
1324309c398aSmrg  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
1325309c398aSmrg    PATH_SEPARATOR=';'
1326309c398aSmrg  else
1327309c398aSmrg    PATH_SEPARATOR=:
1328309c398aSmrg  fi
1329309c398aSmrg  rm -f conf$$.sh
1330e9554658Smrgfi
1331309c398aSmrgac_prog=ld
1332309c398aSmrgif test "$GCC" = yes; then
1333309c398aSmrg  # Check if gcc -print-prog-name=ld gives a path.
1334309c398aSmrg  AC_MSG_CHECKING([for ld used by GCC])
1335309c398aSmrg  case $host in
1336309c398aSmrg  *-*-mingw*)
1337309c398aSmrg    # gcc leaves a trailing carriage return which upsets mingw
1338309c398aSmrg    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1339309c398aSmrg  *)
1340309c398aSmrg    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1341309c398aSmrg  esac
1342309c398aSmrg  case $ac_prog in
1343309c398aSmrg    # Accept absolute paths.
1344309c398aSmrg    [[\\/]* | [A-Za-z]:[\\/]*)]
1345309c398aSmrg      [re_direlt='/[^/][^/]*/\.\./']
1346309c398aSmrg      # Canonicalize the path of ld
1347309c398aSmrg      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1348309c398aSmrg      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1349309c398aSmrg	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1350309c398aSmrg      done
1351309c398aSmrg      test -z "$LD" && LD="$ac_prog"
1352309c398aSmrg      ;;
1353309c398aSmrg  "")
1354309c398aSmrg    # If it fails, then pretend we aren't using GCC.
1355309c398aSmrg    ac_prog=ld
1356309c398aSmrg    ;;
1357309c398aSmrg  *)
1358309c398aSmrg    # If it is relative, then search for the first ld in PATH.
1359309c398aSmrg    with_gnu_ld=unknown
1360309c398aSmrg    ;;
1361309c398aSmrg  esac
1362309c398aSmrgelif test "$with_gnu_ld" = yes; then
1363309c398aSmrg  AC_MSG_CHECKING([for GNU ld])
1364309c398aSmrgelse
1365309c398aSmrg  AC_MSG_CHECKING([for non-GNU ld])
1366e9554658Smrgfi
1367309c398aSmrgAC_CACHE_VAL(acl_cv_path_LD,
1368309c398aSmrg[if test -z "$LD"; then
1369309c398aSmrg  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1370309c398aSmrg  for ac_dir in $PATH; do
1371309c398aSmrg    test -z "$ac_dir" && ac_dir=.
1372309c398aSmrg    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1373309c398aSmrg      acl_cv_path_LD="$ac_dir/$ac_prog"
1374309c398aSmrg      # Check to see if the program is GNU ld.  I'd rather use --version,
1375309c398aSmrg      # but apparently some GNU ld's only accept -v.
1376309c398aSmrg      # Break only if it was the GNU/non-GNU ld that we prefer.
1377309c398aSmrg      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
1378309c398aSmrg      *GNU* | *'with BFD'*)
1379309c398aSmrg	test "$with_gnu_ld" != no && break ;;
1380309c398aSmrg      *)
1381309c398aSmrg	test "$with_gnu_ld" != yes && break ;;
1382309c398aSmrg      esac
1383309c398aSmrg    fi
1384309c398aSmrg  done
1385309c398aSmrg  IFS="$ac_save_ifs"
1386309c398aSmrgelse
1387309c398aSmrg  acl_cv_path_LD="$LD" # Let the user override the test with a path.
1388309c398aSmrgfi])
1389309c398aSmrgLD="$acl_cv_path_LD"
1390309c398aSmrgif test -n "$LD"; then
1391309c398aSmrg  AC_MSG_RESULT($LD)
1392309c398aSmrgelse
1393309c398aSmrg  AC_MSG_RESULT(no)
1394e9554658Smrgfi
1395309c398aSmrgtest -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1396309c398aSmrgAC_LIB_PROG_LD_GNU
1397309c398aSmrg])
1398e9554658Smrg
1399309c398aSmrg# lib-link.m4 serial 9 (gettext-0.16)
1400309c398aSmrgdnl Copyright (C) 2001-2006 Free Software Foundation, Inc.
1401309c398aSmrgdnl This file is free software; the Free Software Foundation
1402309c398aSmrgdnl gives unlimited permission to copy and/or distribute it,
1403309c398aSmrgdnl with or without modifications, as long as this notice is preserved.
1404309c398aSmrg
1405309c398aSmrgdnl From Bruno Haible.
1406309c398aSmrg
1407309c398aSmrgAC_PREREQ(2.50)
1408309c398aSmrg
1409309c398aSmrgdnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
1410309c398aSmrgdnl the libraries corresponding to explicit and implicit dependencies.
1411309c398aSmrgdnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
1412309c398aSmrgdnl augments the CPPFLAGS variable.
1413309c398aSmrgAC_DEFUN([AC_LIB_LINKFLAGS],
1414309c398aSmrg[
1415309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1416309c398aSmrg  AC_REQUIRE([AC_LIB_RPATH])
1417309c398aSmrg  define([Name],[translit([$1],[./-], [___])])
1418309c398aSmrg  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1419309c398aSmrg                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1420309c398aSmrg  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1421309c398aSmrg    AC_LIB_LINKFLAGS_BODY([$1], [$2])
1422309c398aSmrg    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1423309c398aSmrg    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1424309c398aSmrg    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1425309c398aSmrg  ])
1426309c398aSmrg  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1427309c398aSmrg  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1428309c398aSmrg  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1429309c398aSmrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1430309c398aSmrg  AC_SUBST([LIB]NAME)
1431309c398aSmrg  AC_SUBST([LTLIB]NAME)
1432309c398aSmrg  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1433309c398aSmrg  dnl results of this search when this library appears as a dependency.
1434309c398aSmrg  HAVE_LIB[]NAME=yes
1435309c398aSmrg  undefine([Name])
1436309c398aSmrg  undefine([NAME])
1437309c398aSmrg])
1438e9554658Smrg
1439309c398aSmrgdnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
1440309c398aSmrgdnl searches for libname and the libraries corresponding to explicit and
1441309c398aSmrgdnl implicit dependencies, together with the specified include files and
1442309c398aSmrgdnl the ability to compile and link the specified testcode. If found, it
1443309c398aSmrgdnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
1444309c398aSmrgdnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1445309c398aSmrgdnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1446309c398aSmrgdnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1447309c398aSmrgAC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1448309c398aSmrg[
1449309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1450309c398aSmrg  AC_REQUIRE([AC_LIB_RPATH])
1451309c398aSmrg  define([Name],[translit([$1],[./-], [___])])
1452309c398aSmrg  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1453309c398aSmrg                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1454309c398aSmrg
1455309c398aSmrg  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1456309c398aSmrg  dnl accordingly.
1457309c398aSmrg  AC_LIB_LINKFLAGS_BODY([$1], [$2])
1458309c398aSmrg
1459309c398aSmrg  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1460309c398aSmrg  dnl because if the user has installed lib[]Name and not disabled its use
1461309c398aSmrg  dnl via --without-lib[]Name-prefix, he wants to use it.
1462309c398aSmrg  ac_save_CPPFLAGS="$CPPFLAGS"
1463309c398aSmrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1464309c398aSmrg
1465309c398aSmrg  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1466309c398aSmrg    ac_save_LIBS="$LIBS"
1467309c398aSmrg    LIBS="$LIBS $LIB[]NAME"
1468309c398aSmrg    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
1469309c398aSmrg    LIBS="$ac_save_LIBS"
1470309c398aSmrg  ])
1471309c398aSmrg  if test "$ac_cv_lib[]Name" = yes; then
1472309c398aSmrg    HAVE_LIB[]NAME=yes
1473309c398aSmrg    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
1474309c398aSmrg    AC_MSG_CHECKING([how to link with lib[]$1])
1475309c398aSmrg    AC_MSG_RESULT([$LIB[]NAME])
1476309c398aSmrg  else
1477309c398aSmrg    HAVE_LIB[]NAME=no
1478309c398aSmrg    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1479309c398aSmrg    dnl $INC[]NAME either.
1480309c398aSmrg    CPPFLAGS="$ac_save_CPPFLAGS"
1481309c398aSmrg    LIB[]NAME=
1482309c398aSmrg    LTLIB[]NAME=
1483309c398aSmrg  fi
1484309c398aSmrg  AC_SUBST([HAVE_LIB]NAME)
1485309c398aSmrg  AC_SUBST([LIB]NAME)
1486309c398aSmrg  AC_SUBST([LTLIB]NAME)
1487309c398aSmrg  undefine([Name])
1488309c398aSmrg  undefine([NAME])
1489309c398aSmrg])
1490e9554658Smrg
1491309c398aSmrgdnl Determine the platform dependent parameters needed to use rpath:
1492309c398aSmrgdnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
1493309c398aSmrgdnl hardcode_direct, hardcode_minus_L.
1494309c398aSmrgAC_DEFUN([AC_LIB_RPATH],
1495309c398aSmrg[
1496309c398aSmrg  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
1497309c398aSmrg  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
1498309c398aSmrg  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1499309c398aSmrg  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1500309c398aSmrg  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1501309c398aSmrg  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1502309c398aSmrg  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
1503309c398aSmrg    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1504309c398aSmrg    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1505309c398aSmrg    . ./conftest.sh
1506309c398aSmrg    rm -f ./conftest.sh
1507309c398aSmrg    acl_cv_rpath=done
1508309c398aSmrg  ])
1509309c398aSmrg  wl="$acl_cv_wl"
1510309c398aSmrg  libext="$acl_cv_libext"
1511309c398aSmrg  shlibext="$acl_cv_shlibext"
1512309c398aSmrg  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1513309c398aSmrg  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1514309c398aSmrg  hardcode_direct="$acl_cv_hardcode_direct"
1515309c398aSmrg  hardcode_minus_L="$acl_cv_hardcode_minus_L"
1516309c398aSmrg  dnl Determine whether the user wants rpath handling at all.
1517309c398aSmrg  AC_ARG_ENABLE(rpath,
1518309c398aSmrg    [  --disable-rpath         do not hardcode runtime library paths],
1519309c398aSmrg    :, enable_rpath=yes)
1520309c398aSmrg])
1521e9554658Smrg
1522309c398aSmrgdnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1523309c398aSmrgdnl the libraries corresponding to explicit and implicit dependencies.
1524309c398aSmrgdnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1525309c398aSmrgAC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1526309c398aSmrg[
1527309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1528309c398aSmrg  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1529309c398aSmrg                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1530309c398aSmrg  dnl By default, look in $includedir and $libdir.
1531309c398aSmrg  use_additional=yes
1532309c398aSmrg  AC_LIB_WITH_FINAL_PREFIX([
1533309c398aSmrg    eval additional_includedir=\"$includedir\"
1534309c398aSmrg    eval additional_libdir=\"$libdir\"
1535309c398aSmrg  ])
1536309c398aSmrg  AC_LIB_ARG_WITH([lib$1-prefix],
1537309c398aSmrg[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
1538309c398aSmrg  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
1539309c398aSmrg[
1540309c398aSmrg    if test "X$withval" = "Xno"; then
1541309c398aSmrg      use_additional=no
1542309c398aSmrg    else
1543309c398aSmrg      if test "X$withval" = "X"; then
1544309c398aSmrg        AC_LIB_WITH_FINAL_PREFIX([
1545309c398aSmrg          eval additional_includedir=\"$includedir\"
1546309c398aSmrg          eval additional_libdir=\"$libdir\"
1547309c398aSmrg        ])
1548309c398aSmrg      else
1549309c398aSmrg        additional_includedir="$withval/include"
1550309c398aSmrg        additional_libdir="$withval/$acl_libdirstem"
1551309c398aSmrg      fi
1552309c398aSmrg    fi
1553309c398aSmrg])
1554309c398aSmrg  dnl Search the library and its dependencies in $additional_libdir and
1555309c398aSmrg  dnl $LDFLAGS. Using breadth-first-seach.
1556309c398aSmrg  LIB[]NAME=
1557309c398aSmrg  LTLIB[]NAME=
1558309c398aSmrg  INC[]NAME=
1559309c398aSmrg  rpathdirs=
1560309c398aSmrg  ltrpathdirs=
1561309c398aSmrg  names_already_handled=
1562309c398aSmrg  names_next_round='$1 $2'
1563309c398aSmrg  while test -n "$names_next_round"; do
1564309c398aSmrg    names_this_round="$names_next_round"
1565309c398aSmrg    names_next_round=
1566309c398aSmrg    for name in $names_this_round; do
1567309c398aSmrg      already_handled=
1568309c398aSmrg      for n in $names_already_handled; do
1569309c398aSmrg        if test "$n" = "$name"; then
1570309c398aSmrg          already_handled=yes
1571309c398aSmrg          break
1572309c398aSmrg        fi
1573309c398aSmrg      done
1574309c398aSmrg      if test -z "$already_handled"; then
1575309c398aSmrg        names_already_handled="$names_already_handled $name"
1576309c398aSmrg        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1577309c398aSmrg        dnl or AC_LIB_HAVE_LINKFLAGS call.
1578309c398aSmrg        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1579309c398aSmrg        eval value=\"\$HAVE_LIB$uppername\"
1580309c398aSmrg        if test -n "$value"; then
1581309c398aSmrg          if test "$value" = yes; then
1582309c398aSmrg            eval value=\"\$LIB$uppername\"
1583309c398aSmrg            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1584309c398aSmrg            eval value=\"\$LTLIB$uppername\"
1585309c398aSmrg            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1586309c398aSmrg          else
1587309c398aSmrg            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1588309c398aSmrg            dnl that this library doesn't exist. So just drop it.
1589309c398aSmrg            :
1590309c398aSmrg          fi
1591309c398aSmrg        else
1592309c398aSmrg          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1593309c398aSmrg          dnl and the already constructed $LIBNAME/$LTLIBNAME.
1594309c398aSmrg          found_dir=
1595309c398aSmrg          found_la=
1596309c398aSmrg          found_so=
1597309c398aSmrg          found_a=
1598309c398aSmrg          if test $use_additional = yes; then
1599309c398aSmrg            if test -n "$shlibext" \
1600309c398aSmrg               && { test -f "$additional_libdir/lib$name.$shlibext" \
1601309c398aSmrg                    || { test "$shlibext" = dll \
1602309c398aSmrg                         && test -f "$additional_libdir/lib$name.dll.a"; }; }; then
1603309c398aSmrg              found_dir="$additional_libdir"
1604309c398aSmrg              if test -f "$additional_libdir/lib$name.$shlibext"; then
1605309c398aSmrg                found_so="$additional_libdir/lib$name.$shlibext"
1606309c398aSmrg              else
1607309c398aSmrg                found_so="$additional_libdir/lib$name.dll.a"
1608309c398aSmrg              fi
1609309c398aSmrg              if test -f "$additional_libdir/lib$name.la"; then
1610309c398aSmrg                found_la="$additional_libdir/lib$name.la"
1611309c398aSmrg              fi
1612309c398aSmrg            else
1613309c398aSmrg              if test -f "$additional_libdir/lib$name.$libext"; then
1614309c398aSmrg                found_dir="$additional_libdir"
1615309c398aSmrg                found_a="$additional_libdir/lib$name.$libext"
1616309c398aSmrg                if test -f "$additional_libdir/lib$name.la"; then
1617309c398aSmrg                  found_la="$additional_libdir/lib$name.la"
1618309c398aSmrg                fi
1619309c398aSmrg              fi
1620309c398aSmrg            fi
1621309c398aSmrg          fi
1622309c398aSmrg          if test "X$found_dir" = "X"; then
1623309c398aSmrg            for x in $LDFLAGS $LTLIB[]NAME; do
1624309c398aSmrg              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1625309c398aSmrg              case "$x" in
1626309c398aSmrg                -L*)
1627309c398aSmrg                  dir=`echo "X$x" | sed -e 's/^X-L//'`
1628309c398aSmrg                  if test -n "$shlibext" \
1629309c398aSmrg                     && { test -f "$dir/lib$name.$shlibext" \
1630309c398aSmrg                          || { test "$shlibext" = dll \
1631309c398aSmrg                               && test -f "$dir/lib$name.dll.a"; }; }; then
1632309c398aSmrg                    found_dir="$dir"
1633309c398aSmrg                    if test -f "$dir/lib$name.$shlibext"; then
1634309c398aSmrg                      found_so="$dir/lib$name.$shlibext"
1635309c398aSmrg                    else
1636309c398aSmrg                      found_so="$dir/lib$name.dll.a"
1637309c398aSmrg                    fi
1638309c398aSmrg                    if test -f "$dir/lib$name.la"; then
1639309c398aSmrg                      found_la="$dir/lib$name.la"
1640309c398aSmrg                    fi
1641309c398aSmrg                  else
1642309c398aSmrg                    if test -f "$dir/lib$name.$libext"; then
1643309c398aSmrg                      found_dir="$dir"
1644309c398aSmrg                      found_a="$dir/lib$name.$libext"
1645309c398aSmrg                      if test -f "$dir/lib$name.la"; then
1646309c398aSmrg                        found_la="$dir/lib$name.la"
1647309c398aSmrg                      fi
1648309c398aSmrg                    fi
1649309c398aSmrg                  fi
1650309c398aSmrg                  ;;
1651309c398aSmrg              esac
1652309c398aSmrg              if test "X$found_dir" != "X"; then
1653309c398aSmrg                break
1654309c398aSmrg              fi
1655309c398aSmrg            done
1656309c398aSmrg          fi
1657309c398aSmrg          if test "X$found_dir" != "X"; then
1658309c398aSmrg            dnl Found the library.
1659309c398aSmrg            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1660309c398aSmrg            if test "X$found_so" != "X"; then
1661309c398aSmrg              dnl Linking with a shared library. We attempt to hardcode its
1662309c398aSmrg              dnl directory into the executable's runpath, unless it's the
1663309c398aSmrg              dnl standard /usr/lib.
1664309c398aSmrg              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
1665309c398aSmrg                dnl No hardcoding is needed.
1666309c398aSmrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1667309c398aSmrg              else
1668309c398aSmrg                dnl Use an explicit option to hardcode DIR into the resulting
1669309c398aSmrg                dnl binary.
1670309c398aSmrg                dnl Potentially add DIR to ltrpathdirs.
1671309c398aSmrg                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1672309c398aSmrg                haveit=
1673309c398aSmrg                for x in $ltrpathdirs; do
1674309c398aSmrg                  if test "X$x" = "X$found_dir"; then
1675309c398aSmrg                    haveit=yes
1676309c398aSmrg                    break
1677309c398aSmrg                  fi
1678309c398aSmrg                done
1679309c398aSmrg                if test -z "$haveit"; then
1680309c398aSmrg                  ltrpathdirs="$ltrpathdirs $found_dir"
1681309c398aSmrg                fi
1682309c398aSmrg                dnl The hardcoding into $LIBNAME is system dependent.
1683309c398aSmrg                if test "$hardcode_direct" = yes; then
1684309c398aSmrg                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1685309c398aSmrg                  dnl resulting binary.
1686309c398aSmrg                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1687309c398aSmrg                else
1688309c398aSmrg                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1689309c398aSmrg                    dnl Use an explicit option to hardcode DIR into the resulting
1690309c398aSmrg                    dnl binary.
1691309c398aSmrg                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1692309c398aSmrg                    dnl Potentially add DIR to rpathdirs.
1693309c398aSmrg                    dnl The rpathdirs will be appended to $LIBNAME at the end.
1694309c398aSmrg                    haveit=
1695309c398aSmrg                    for x in $rpathdirs; do
1696309c398aSmrg                      if test "X$x" = "X$found_dir"; then
1697309c398aSmrg                        haveit=yes
1698309c398aSmrg                        break
1699309c398aSmrg                      fi
1700309c398aSmrg                    done
1701309c398aSmrg                    if test -z "$haveit"; then
1702309c398aSmrg                      rpathdirs="$rpathdirs $found_dir"
1703309c398aSmrg                    fi
1704309c398aSmrg                  else
1705309c398aSmrg                    dnl Rely on "-L$found_dir".
1706309c398aSmrg                    dnl But don't add it if it's already contained in the LDFLAGS
1707309c398aSmrg                    dnl or the already constructed $LIBNAME
1708309c398aSmrg                    haveit=
1709309c398aSmrg                    for x in $LDFLAGS $LIB[]NAME; do
1710309c398aSmrg                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1711309c398aSmrg                      if test "X$x" = "X-L$found_dir"; then
1712309c398aSmrg                        haveit=yes
1713309c398aSmrg                        break
1714309c398aSmrg                      fi
1715309c398aSmrg                    done
1716309c398aSmrg                    if test -z "$haveit"; then
1717309c398aSmrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1718309c398aSmrg                    fi
1719309c398aSmrg                    if test "$hardcode_minus_L" != no; then
1720309c398aSmrg                      dnl FIXME: Not sure whether we should use
1721309c398aSmrg                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1722309c398aSmrg                      dnl here.
1723309c398aSmrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1724309c398aSmrg                    else
1725309c398aSmrg                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
1726309c398aSmrg                      dnl here, because this doesn't fit in flags passed to the
1727309c398aSmrg                      dnl compiler. So give up. No hardcoding. This affects only
1728309c398aSmrg                      dnl very old systems.
1729309c398aSmrg                      dnl FIXME: Not sure whether we should use
1730309c398aSmrg                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1731309c398aSmrg                      dnl here.
1732309c398aSmrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1733309c398aSmrg                    fi
1734309c398aSmrg                  fi
1735309c398aSmrg                fi
1736309c398aSmrg              fi
1737309c398aSmrg            else
1738309c398aSmrg              if test "X$found_a" != "X"; then
1739309c398aSmrg                dnl Linking with a static library.
1740309c398aSmrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1741309c398aSmrg              else
1742309c398aSmrg                dnl We shouldn't come here, but anyway it's good to have a
1743309c398aSmrg                dnl fallback.
1744309c398aSmrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1745309c398aSmrg              fi
1746309c398aSmrg            fi
1747309c398aSmrg            dnl Assume the include files are nearby.
1748309c398aSmrg            additional_includedir=
1749309c398aSmrg            case "$found_dir" in
1750309c398aSmrg              */$acl_libdirstem | */$acl_libdirstem/)
1751309c398aSmrg                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
1752309c398aSmrg                additional_includedir="$basedir/include"
1753309c398aSmrg                ;;
1754309c398aSmrg            esac
1755309c398aSmrg            if test "X$additional_includedir" != "X"; then
1756309c398aSmrg              dnl Potentially add $additional_includedir to $INCNAME.
1757309c398aSmrg              dnl But don't add it
1758309c398aSmrg              dnl   1. if it's the standard /usr/include,
1759309c398aSmrg              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1760309c398aSmrg              dnl   3. if it's already present in $CPPFLAGS or the already
1761309c398aSmrg              dnl      constructed $INCNAME,
1762309c398aSmrg              dnl   4. if it doesn't exist as a directory.
1763309c398aSmrg              if test "X$additional_includedir" != "X/usr/include"; then
1764309c398aSmrg                haveit=
1765309c398aSmrg                if test "X$additional_includedir" = "X/usr/local/include"; then
1766309c398aSmrg                  if test -n "$GCC"; then
1767309c398aSmrg                    case $host_os in
1768309c398aSmrg                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1769309c398aSmrg                    esac
1770309c398aSmrg                  fi
1771309c398aSmrg                fi
1772309c398aSmrg                if test -z "$haveit"; then
1773309c398aSmrg                  for x in $CPPFLAGS $INC[]NAME; do
1774309c398aSmrg                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1775309c398aSmrg                    if test "X$x" = "X-I$additional_includedir"; then
1776309c398aSmrg                      haveit=yes
1777309c398aSmrg                      break
1778309c398aSmrg                    fi
1779309c398aSmrg                  done
1780309c398aSmrg                  if test -z "$haveit"; then
1781309c398aSmrg                    if test -d "$additional_includedir"; then
1782309c398aSmrg                      dnl Really add $additional_includedir to $INCNAME.
1783309c398aSmrg                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1784309c398aSmrg                    fi
1785309c398aSmrg                  fi
1786309c398aSmrg                fi
1787309c398aSmrg              fi
1788309c398aSmrg            fi
1789309c398aSmrg            dnl Look for dependencies.
1790309c398aSmrg            if test -n "$found_la"; then
1791309c398aSmrg              dnl Read the .la file. It defines the variables
1792309c398aSmrg              dnl dlname, library_names, old_library, dependency_libs, current,
1793309c398aSmrg              dnl age, revision, installed, dlopen, dlpreopen, libdir.
1794309c398aSmrg              save_libdir="$libdir"
1795309c398aSmrg              case "$found_la" in
1796309c398aSmrg                */* | *\\*) . "$found_la" ;;
1797309c398aSmrg                *) . "./$found_la" ;;
1798309c398aSmrg              esac
1799309c398aSmrg              libdir="$save_libdir"
1800309c398aSmrg              dnl We use only dependency_libs.
1801309c398aSmrg              for dep in $dependency_libs; do
1802309c398aSmrg                case "$dep" in
1803309c398aSmrg                  -L*)
1804309c398aSmrg                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1805309c398aSmrg                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1806309c398aSmrg                    dnl But don't add it
1807309c398aSmrg                    dnl   1. if it's the standard /usr/lib,
1808309c398aSmrg                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1809309c398aSmrg                    dnl   3. if it's already present in $LDFLAGS or the already
1810309c398aSmrg                    dnl      constructed $LIBNAME,
1811309c398aSmrg                    dnl   4. if it doesn't exist as a directory.
1812309c398aSmrg                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
1813309c398aSmrg                      haveit=
1814309c398aSmrg                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
1815309c398aSmrg                        if test -n "$GCC"; then
1816309c398aSmrg                          case $host_os in
1817309c398aSmrg                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1818309c398aSmrg                          esac
1819309c398aSmrg                        fi
1820309c398aSmrg                      fi
1821309c398aSmrg                      if test -z "$haveit"; then
1822309c398aSmrg                        haveit=
1823309c398aSmrg                        for x in $LDFLAGS $LIB[]NAME; do
1824309c398aSmrg                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1825309c398aSmrg                          if test "X$x" = "X-L$additional_libdir"; then
1826309c398aSmrg                            haveit=yes
1827309c398aSmrg                            break
1828309c398aSmrg                          fi
1829309c398aSmrg                        done
1830309c398aSmrg                        if test -z "$haveit"; then
1831309c398aSmrg                          if test -d "$additional_libdir"; then
1832309c398aSmrg                            dnl Really add $additional_libdir to $LIBNAME.
1833309c398aSmrg                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1834309c398aSmrg                          fi
1835309c398aSmrg                        fi
1836309c398aSmrg                        haveit=
1837309c398aSmrg                        for x in $LDFLAGS $LTLIB[]NAME; do
1838309c398aSmrg                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1839309c398aSmrg                          if test "X$x" = "X-L$additional_libdir"; then
1840309c398aSmrg                            haveit=yes
1841309c398aSmrg                            break
1842309c398aSmrg                          fi
1843309c398aSmrg                        done
1844309c398aSmrg                        if test -z "$haveit"; then
1845309c398aSmrg                          if test -d "$additional_libdir"; then
1846309c398aSmrg                            dnl Really add $additional_libdir to $LTLIBNAME.
1847309c398aSmrg                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1848309c398aSmrg                          fi
1849309c398aSmrg                        fi
1850309c398aSmrg                      fi
1851309c398aSmrg                    fi
1852309c398aSmrg                    ;;
1853309c398aSmrg                  -R*)
1854309c398aSmrg                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
1855309c398aSmrg                    if test "$enable_rpath" != no; then
1856309c398aSmrg                      dnl Potentially add DIR to rpathdirs.
1857309c398aSmrg                      dnl The rpathdirs will be appended to $LIBNAME at the end.
1858309c398aSmrg                      haveit=
1859309c398aSmrg                      for x in $rpathdirs; do
1860309c398aSmrg                        if test "X$x" = "X$dir"; then
1861309c398aSmrg                          haveit=yes
1862309c398aSmrg                          break
1863309c398aSmrg                        fi
1864309c398aSmrg                      done
1865309c398aSmrg                      if test -z "$haveit"; then
1866309c398aSmrg                        rpathdirs="$rpathdirs $dir"
1867309c398aSmrg                      fi
1868309c398aSmrg                      dnl Potentially add DIR to ltrpathdirs.
1869309c398aSmrg                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1870309c398aSmrg                      haveit=
1871309c398aSmrg                      for x in $ltrpathdirs; do
1872309c398aSmrg                        if test "X$x" = "X$dir"; then
1873309c398aSmrg                          haveit=yes
1874309c398aSmrg                          break
1875309c398aSmrg                        fi
1876309c398aSmrg                      done
1877309c398aSmrg                      if test -z "$haveit"; then
1878309c398aSmrg                        ltrpathdirs="$ltrpathdirs $dir"
1879309c398aSmrg                      fi
1880309c398aSmrg                    fi
1881309c398aSmrg                    ;;
1882309c398aSmrg                  -l*)
1883309c398aSmrg                    dnl Handle this in the next round.
1884309c398aSmrg                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1885309c398aSmrg                    ;;
1886309c398aSmrg                  *.la)
1887309c398aSmrg                    dnl Handle this in the next round. Throw away the .la's
1888309c398aSmrg                    dnl directory; it is already contained in a preceding -L
1889309c398aSmrg                    dnl option.
1890309c398aSmrg                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1891309c398aSmrg                    ;;
1892309c398aSmrg                  *)
1893309c398aSmrg                    dnl Most likely an immediate library name.
1894309c398aSmrg                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1895309c398aSmrg                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1896309c398aSmrg                    ;;
1897309c398aSmrg                esac
1898309c398aSmrg              done
1899309c398aSmrg            fi
1900309c398aSmrg          else
1901309c398aSmrg            dnl Didn't find the library; assume it is in the system directories
1902309c398aSmrg            dnl known to the linker and runtime loader. (All the system
1903309c398aSmrg            dnl directories known to the linker should also be known to the
1904309c398aSmrg            dnl runtime loader, otherwise the system is severely misconfigured.)
1905309c398aSmrg            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1906309c398aSmrg            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1907309c398aSmrg          fi
1908309c398aSmrg        fi
1909309c398aSmrg      fi
1910309c398aSmrg    done
1911309c398aSmrg  done
1912309c398aSmrg  if test "X$rpathdirs" != "X"; then
1913309c398aSmrg    if test -n "$hardcode_libdir_separator"; then
1914309c398aSmrg      dnl Weird platform: only the last -rpath option counts, the user must
1915309c398aSmrg      dnl pass all path elements in one option. We can arrange that for a
1916309c398aSmrg      dnl single library, but not when more than one $LIBNAMEs are used.
1917309c398aSmrg      alldirs=
1918309c398aSmrg      for found_dir in $rpathdirs; do
1919309c398aSmrg        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
1920309c398aSmrg      done
1921309c398aSmrg      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
1922309c398aSmrg      acl_save_libdir="$libdir"
1923309c398aSmrg      libdir="$alldirs"
1924309c398aSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
1925309c398aSmrg      libdir="$acl_save_libdir"
1926309c398aSmrg      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1927309c398aSmrg    else
1928309c398aSmrg      dnl The -rpath options are cumulative.
1929309c398aSmrg      for found_dir in $rpathdirs; do
1930309c398aSmrg        acl_save_libdir="$libdir"
1931309c398aSmrg        libdir="$found_dir"
1932309c398aSmrg        eval flag=\"$hardcode_libdir_flag_spec\"
1933309c398aSmrg        libdir="$acl_save_libdir"
1934309c398aSmrg        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1935309c398aSmrg      done
1936309c398aSmrg    fi
1937309c398aSmrg  fi
1938309c398aSmrg  if test "X$ltrpathdirs" != "X"; then
1939309c398aSmrg    dnl When using libtool, the option that works for both libraries and
1940309c398aSmrg    dnl executables is -R. The -R options are cumulative.
1941309c398aSmrg    for found_dir in $ltrpathdirs; do
1942309c398aSmrg      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1943309c398aSmrg    done
1944309c398aSmrg  fi
1945309c398aSmrg])
19468903d43aSmrg
1947309c398aSmrgdnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1948309c398aSmrgdnl unless already present in VAR.
1949309c398aSmrgdnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1950309c398aSmrgdnl contains two or three consecutive elements that belong together.
1951309c398aSmrgAC_DEFUN([AC_LIB_APPENDTOVAR],
1952309c398aSmrg[
1953309c398aSmrg  for element in [$2]; do
1954309c398aSmrg    haveit=
1955309c398aSmrg    for x in $[$1]; do
1956309c398aSmrg      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1957309c398aSmrg      if test "X$x" = "X$element"; then
1958309c398aSmrg        haveit=yes
1959309c398aSmrg        break
1960309c398aSmrg      fi
1961309c398aSmrg    done
1962309c398aSmrg    if test -z "$haveit"; then
1963309c398aSmrg      [$1]="${[$1]}${[$1]:+ }$element"
1964309c398aSmrg    fi
1965309c398aSmrg  done
1966309c398aSmrg])
19678903d43aSmrg
1968309c398aSmrgdnl For those cases where a variable contains several -L and -l options
1969309c398aSmrgdnl referring to unknown libraries and directories, this macro determines the
1970309c398aSmrgdnl necessary additional linker options for the runtime path.
1971309c398aSmrgdnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
1972309c398aSmrgdnl sets LDADDVAR to linker options needed together with LIBSVALUE.
1973309c398aSmrgdnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
1974309c398aSmrgdnl otherwise linking without libtool is assumed.
1975309c398aSmrgAC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
1976309c398aSmrg[
1977309c398aSmrg  AC_REQUIRE([AC_LIB_RPATH])
1978309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1979309c398aSmrg  $1=
1980309c398aSmrg  if test "$enable_rpath" != no; then
1981309c398aSmrg    if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1982309c398aSmrg      dnl Use an explicit option to hardcode directories into the resulting
1983309c398aSmrg      dnl binary.
1984309c398aSmrg      rpathdirs=
1985309c398aSmrg      next=
1986309c398aSmrg      for opt in $2; do
1987309c398aSmrg        if test -n "$next"; then
1988309c398aSmrg          dir="$next"
1989309c398aSmrg          dnl No need to hardcode the standard /usr/lib.
1990309c398aSmrg          if test "X$dir" != "X/usr/$acl_libdirstem"; then
1991309c398aSmrg            rpathdirs="$rpathdirs $dir"
1992309c398aSmrg          fi
1993309c398aSmrg          next=
1994309c398aSmrg        else
1995309c398aSmrg          case $opt in
1996309c398aSmrg            -L) next=yes ;;
1997309c398aSmrg            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
1998309c398aSmrg                 dnl No need to hardcode the standard /usr/lib.
1999309c398aSmrg                 if test "X$dir" != "X/usr/$acl_libdirstem"; then
2000309c398aSmrg                   rpathdirs="$rpathdirs $dir"
2001309c398aSmrg                 fi
2002309c398aSmrg                 next= ;;
2003309c398aSmrg            *) next= ;;
2004309c398aSmrg          esac
2005309c398aSmrg        fi
2006309c398aSmrg      done
2007309c398aSmrg      if test "X$rpathdirs" != "X"; then
2008309c398aSmrg        if test -n ""$3""; then
2009309c398aSmrg          dnl libtool is used for linking. Use -R options.
2010309c398aSmrg          for dir in $rpathdirs; do
2011309c398aSmrg            $1="${$1}${$1:+ }-R$dir"
2012309c398aSmrg          done
2013309c398aSmrg        else
2014309c398aSmrg          dnl The linker is used for linking directly.
2015309c398aSmrg          if test -n "$hardcode_libdir_separator"; then
2016309c398aSmrg            dnl Weird platform: only the last -rpath option counts, the user
2017309c398aSmrg            dnl must pass all path elements in one option.
2018309c398aSmrg            alldirs=
2019309c398aSmrg            for dir in $rpathdirs; do
2020309c398aSmrg              alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
2021309c398aSmrg            done
2022309c398aSmrg            acl_save_libdir="$libdir"
2023309c398aSmrg            libdir="$alldirs"
2024309c398aSmrg            eval flag=\"$hardcode_libdir_flag_spec\"
2025309c398aSmrg            libdir="$acl_save_libdir"
2026309c398aSmrg            $1="$flag"
2027309c398aSmrg          else
2028309c398aSmrg            dnl The -rpath options are cumulative.
2029309c398aSmrg            for dir in $rpathdirs; do
2030309c398aSmrg              acl_save_libdir="$libdir"
2031309c398aSmrg              libdir="$dir"
2032309c398aSmrg              eval flag=\"$hardcode_libdir_flag_spec\"
2033309c398aSmrg              libdir="$acl_save_libdir"
2034309c398aSmrg              $1="${$1}${$1:+ }$flag"
2035309c398aSmrg            done
2036309c398aSmrg          fi
2037309c398aSmrg        fi
2038309c398aSmrg      fi
2039309c398aSmrg    fi
2040309c398aSmrg  fi
2041309c398aSmrg  AC_SUBST([$1])
2042309c398aSmrg])
2043e9554658Smrg
2044309c398aSmrg# lib-prefix.m4 serial 5 (gettext-0.15)
2045309c398aSmrgdnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
2046309c398aSmrgdnl This file is free software; the Free Software Foundation
2047309c398aSmrgdnl gives unlimited permission to copy and/or distribute it,
2048309c398aSmrgdnl with or without modifications, as long as this notice is preserved.
2049309c398aSmrg
2050309c398aSmrgdnl From Bruno Haible.
2051309c398aSmrg
2052309c398aSmrgdnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
2053309c398aSmrgdnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
2054309c398aSmrgdnl require excessive bracketing.
2055309c398aSmrgifdef([AC_HELP_STRING],
2056309c398aSmrg[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
2057309c398aSmrg[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
2058309c398aSmrg
2059309c398aSmrgdnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
2060309c398aSmrgdnl to access previously installed libraries. The basic assumption is that
2061309c398aSmrgdnl a user will want packages to use other packages he previously installed
2062309c398aSmrgdnl with the same --prefix option.
2063309c398aSmrgdnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
2064309c398aSmrgdnl libraries, but is otherwise very convenient.
2065309c398aSmrgAC_DEFUN([AC_LIB_PREFIX],
2066309c398aSmrg[
2067309c398aSmrg  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
2068309c398aSmrg  AC_REQUIRE([AC_PROG_CC])
2069309c398aSmrg  AC_REQUIRE([AC_CANONICAL_HOST])
2070309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
2071309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2072309c398aSmrg  dnl By default, look in $includedir and $libdir.
2073309c398aSmrg  use_additional=yes
2074309c398aSmrg  AC_LIB_WITH_FINAL_PREFIX([
2075309c398aSmrg    eval additional_includedir=\"$includedir\"
2076309c398aSmrg    eval additional_libdir=\"$libdir\"
2077309c398aSmrg  ])
2078309c398aSmrg  AC_LIB_ARG_WITH([lib-prefix],
2079309c398aSmrg[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
2080309c398aSmrg  --without-lib-prefix    don't search for libraries in includedir and libdir],
2081309c398aSmrg[
2082309c398aSmrg    if test "X$withval" = "Xno"; then
2083309c398aSmrg      use_additional=no
2084309c398aSmrg    else
2085309c398aSmrg      if test "X$withval" = "X"; then
2086309c398aSmrg        AC_LIB_WITH_FINAL_PREFIX([
2087309c398aSmrg          eval additional_includedir=\"$includedir\"
2088309c398aSmrg          eval additional_libdir=\"$libdir\"
2089309c398aSmrg        ])
2090309c398aSmrg      else
2091309c398aSmrg        additional_includedir="$withval/include"
2092309c398aSmrg        additional_libdir="$withval/$acl_libdirstem"
2093309c398aSmrg      fi
2094309c398aSmrg    fi
2095309c398aSmrg])
2096309c398aSmrg  if test $use_additional = yes; then
2097309c398aSmrg    dnl Potentially add $additional_includedir to $CPPFLAGS.
2098309c398aSmrg    dnl But don't add it
2099309c398aSmrg    dnl   1. if it's the standard /usr/include,
2100309c398aSmrg    dnl   2. if it's already present in $CPPFLAGS,
2101309c398aSmrg    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
2102309c398aSmrg    dnl   4. if it doesn't exist as a directory.
2103309c398aSmrg    if test "X$additional_includedir" != "X/usr/include"; then
2104309c398aSmrg      haveit=
2105309c398aSmrg      for x in $CPPFLAGS; do
2106309c398aSmrg        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2107309c398aSmrg        if test "X$x" = "X-I$additional_includedir"; then
2108309c398aSmrg          haveit=yes
2109309c398aSmrg          break
2110309c398aSmrg        fi
2111309c398aSmrg      done
2112309c398aSmrg      if test -z "$haveit"; then
2113309c398aSmrg        if test "X$additional_includedir" = "X/usr/local/include"; then
2114309c398aSmrg          if test -n "$GCC"; then
2115309c398aSmrg            case $host_os in
2116309c398aSmrg              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
2117309c398aSmrg            esac
2118309c398aSmrg          fi
2119309c398aSmrg        fi
2120309c398aSmrg        if test -z "$haveit"; then
2121309c398aSmrg          if test -d "$additional_includedir"; then
2122309c398aSmrg            dnl Really add $additional_includedir to $CPPFLAGS.
2123309c398aSmrg            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
2124309c398aSmrg          fi
2125309c398aSmrg        fi
2126309c398aSmrg      fi
2127309c398aSmrg    fi
2128309c398aSmrg    dnl Potentially add $additional_libdir to $LDFLAGS.
2129309c398aSmrg    dnl But don't add it
2130309c398aSmrg    dnl   1. if it's the standard /usr/lib,
2131309c398aSmrg    dnl   2. if it's already present in $LDFLAGS,
2132309c398aSmrg    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
2133309c398aSmrg    dnl   4. if it doesn't exist as a directory.
2134309c398aSmrg    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
2135309c398aSmrg      haveit=
2136309c398aSmrg      for x in $LDFLAGS; do
2137309c398aSmrg        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2138309c398aSmrg        if test "X$x" = "X-L$additional_libdir"; then
2139309c398aSmrg          haveit=yes
2140309c398aSmrg          break
2141309c398aSmrg        fi
2142309c398aSmrg      done
2143309c398aSmrg      if test -z "$haveit"; then
2144309c398aSmrg        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
2145309c398aSmrg          if test -n "$GCC"; then
2146309c398aSmrg            case $host_os in
2147309c398aSmrg              linux*) haveit=yes;;
2148309c398aSmrg            esac
2149309c398aSmrg          fi
2150309c398aSmrg        fi
2151309c398aSmrg        if test -z "$haveit"; then
2152309c398aSmrg          if test -d "$additional_libdir"; then
2153309c398aSmrg            dnl Really add $additional_libdir to $LDFLAGS.
2154309c398aSmrg            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
2155309c398aSmrg          fi
2156309c398aSmrg        fi
2157309c398aSmrg      fi
2158309c398aSmrg    fi
2159309c398aSmrg  fi
2160309c398aSmrg])
2161309c398aSmrg
2162309c398aSmrgdnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
2163309c398aSmrgdnl acl_final_exec_prefix, containing the values to which $prefix and
2164309c398aSmrgdnl $exec_prefix will expand at the end of the configure script.
2165309c398aSmrgAC_DEFUN([AC_LIB_PREPARE_PREFIX],
2166309c398aSmrg[
2167309c398aSmrg  dnl Unfortunately, prefix and exec_prefix get only finally determined
2168309c398aSmrg  dnl at the end of configure.
2169309c398aSmrg  if test "X$prefix" = "XNONE"; then
2170309c398aSmrg    acl_final_prefix="$ac_default_prefix"
2171309c398aSmrg  else
2172309c398aSmrg    acl_final_prefix="$prefix"
2173309c398aSmrg  fi
2174309c398aSmrg  if test "X$exec_prefix" = "XNONE"; then
2175309c398aSmrg    acl_final_exec_prefix='${prefix}'
2176309c398aSmrg  else
2177309c398aSmrg    acl_final_exec_prefix="$exec_prefix"
2178309c398aSmrg  fi
2179309c398aSmrg  acl_save_prefix="$prefix"
2180309c398aSmrg  prefix="$acl_final_prefix"
2181309c398aSmrg  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
2182309c398aSmrg  prefix="$acl_save_prefix"
2183309c398aSmrg])
2184309c398aSmrg
2185309c398aSmrgdnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
2186309c398aSmrgdnl variables prefix and exec_prefix bound to the values they will have
2187309c398aSmrgdnl at the end of the configure script.
2188309c398aSmrgAC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
2189309c398aSmrg[
2190309c398aSmrg  acl_save_prefix="$prefix"
2191309c398aSmrg  prefix="$acl_final_prefix"
2192309c398aSmrg  acl_save_exec_prefix="$exec_prefix"
2193309c398aSmrg  exec_prefix="$acl_final_exec_prefix"
2194309c398aSmrg  $1
2195309c398aSmrg  exec_prefix="$acl_save_exec_prefix"
2196309c398aSmrg  prefix="$acl_save_prefix"
2197309c398aSmrg])
2198309c398aSmrg
2199309c398aSmrgdnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
2200309c398aSmrgdnl the basename of the libdir, either "lib" or "lib64".
2201309c398aSmrgAC_DEFUN([AC_LIB_PREPARE_MULTILIB],
2202309c398aSmrg[
2203309c398aSmrg  dnl There is no formal standard regarding lib and lib64. The current
2204309c398aSmrg  dnl practice is that on a system supporting 32-bit and 64-bit instruction
2205309c398aSmrg  dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
2206309c398aSmrg  dnl libraries go under $prefix/lib. We determine the compiler's default
2207309c398aSmrg  dnl mode by looking at the compiler's library search path. If at least
2208309c398aSmrg  dnl of its elements ends in /lib64 or points to a directory whose absolute
2209309c398aSmrg  dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
2210309c398aSmrg  dnl default, namely "lib".
2211309c398aSmrg  acl_libdirstem=lib
2212309c398aSmrg  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
2213309c398aSmrg  if test -n "$searchpath"; then
2214309c398aSmrg    acl_save_IFS="${IFS= 	}"; IFS=":"
2215309c398aSmrg    for searchdir in $searchpath; do
2216309c398aSmrg      if test -d "$searchdir"; then
2217309c398aSmrg        case "$searchdir" in
2218309c398aSmrg          */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
2219309c398aSmrg          *) searchdir=`cd "$searchdir" && pwd`
2220309c398aSmrg             case "$searchdir" in
2221309c398aSmrg               */lib64 ) acl_libdirstem=lib64 ;;
2222309c398aSmrg             esac ;;
2223309c398aSmrg        esac
2224309c398aSmrg      fi
2225309c398aSmrg    done
2226309c398aSmrg    IFS="$acl_save_IFS"
2227309c398aSmrg  fi
2228309c398aSmrg])
2229309c398aSmrg
2230309c398aSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2231309c398aSmrg# 
2232309c398aSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2233309c398aSmrg#
2234309c398aSmrg# This program is free software; you can redistribute it and/or modify
2235309c398aSmrg# it under the terms of the GNU General Public License as published by
2236309c398aSmrg# the Free Software Foundation; either version 2 of the License, or
2237309c398aSmrg# (at your option) any later version.
2238309c398aSmrg#
2239309c398aSmrg# This program is distributed in the hope that it will be useful, but
2240309c398aSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
2241309c398aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2242309c398aSmrg# General Public License for more details.
2243309c398aSmrg#
2244309c398aSmrg# You should have received a copy of the GNU General Public License
2245309c398aSmrg# along with this program; if not, write to the Free Software
2246309c398aSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2247309c398aSmrg#
2248309c398aSmrg# As a special exception to the GNU General Public License, if you
2249309c398aSmrg# distribute this file as part of a program that contains a
2250309c398aSmrg# configuration script generated by Autoconf, you may include it under
2251309c398aSmrg# the same distribution terms that you use for the rest of that program.
2252309c398aSmrg
2253309c398aSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2254309c398aSmrg# ----------------------------------
2255309c398aSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
2256309c398aSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2257309c398aSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2258309c398aSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2259309c398aSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2260309c398aSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2261309c398aSmrgfi
2262309c398aSmrgif test -n "$PKG_CONFIG"; then
2263309c398aSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
2264309c398aSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2265309c398aSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2266309c398aSmrg		AC_MSG_RESULT([yes])
2267309c398aSmrg	else
2268309c398aSmrg		AC_MSG_RESULT([no])
2269309c398aSmrg		PKG_CONFIG=""
2270309c398aSmrg	fi
2271309c398aSmrg		
2272309c398aSmrgfi[]dnl
2273309c398aSmrg])# PKG_PROG_PKG_CONFIG
2274309c398aSmrg
2275309c398aSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2276309c398aSmrg#
2277309c398aSmrg# Check to see whether a particular set of modules exists.  Similar
2278309c398aSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2279309c398aSmrg#
2280309c398aSmrg#
2281309c398aSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
2282309c398aSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
2283309c398aSmrg# PKG_CHECK_EXISTS manually
2284309c398aSmrg# --------------------------------------------------------------
2285309c398aSmrgAC_DEFUN([PKG_CHECK_EXISTS],
2286309c398aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2287309c398aSmrgif test -n "$PKG_CONFIG" && \
2288309c398aSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2289309c398aSmrg  m4_ifval([$2], [$2], [:])
2290309c398aSmrgm4_ifvaln([$3], [else
2291309c398aSmrg  $3])dnl
2292309c398aSmrgfi])
2293309c398aSmrg
2294309c398aSmrg
2295309c398aSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2296309c398aSmrg# ---------------------------------------------
2297309c398aSmrgm4_define([_PKG_CONFIG],
2298309c398aSmrg[if test -n "$$1"; then
2299309c398aSmrg    pkg_cv_[]$1="$$1"
2300309c398aSmrg elif test -n "$PKG_CONFIG"; then
2301309c398aSmrg    PKG_CHECK_EXISTS([$3],
2302309c398aSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2303309c398aSmrg		     [pkg_failed=yes])
2304309c398aSmrg else
2305309c398aSmrg    pkg_failed=untried
2306309c398aSmrgfi[]dnl
2307309c398aSmrg])# _PKG_CONFIG
2308309c398aSmrg
2309309c398aSmrg# _PKG_SHORT_ERRORS_SUPPORTED
2310309c398aSmrg# -----------------------------
2311309c398aSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2312309c398aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2313309c398aSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2314309c398aSmrg        _pkg_short_errors_supported=yes
2315309c398aSmrgelse
2316309c398aSmrg        _pkg_short_errors_supported=no
2317309c398aSmrgfi[]dnl
2318309c398aSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
2319309c398aSmrg
2320309c398aSmrg
2321309c398aSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2322309c398aSmrg# [ACTION-IF-NOT-FOUND])
2323309c398aSmrg#
2324309c398aSmrg#
2325309c398aSmrg# Note that if there is a possibility the first call to
2326309c398aSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
2327309c398aSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2328309c398aSmrg#
2329309c398aSmrg#
2330309c398aSmrg# --------------------------------------------------------------
2331309c398aSmrgAC_DEFUN([PKG_CHECK_MODULES],
2332309c398aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2333309c398aSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2334309c398aSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2335309c398aSmrg
2336309c398aSmrgpkg_failed=no
2337309c398aSmrgAC_MSG_CHECKING([for $1])
2338309c398aSmrg
2339309c398aSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2340309c398aSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2341309c398aSmrg
2342309c398aSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2343309c398aSmrgand $1[]_LIBS to avoid the need to call pkg-config.
2344309c398aSmrgSee the pkg-config man page for more details.])
2345309c398aSmrg
2346309c398aSmrgif test $pkg_failed = yes; then
2347309c398aSmrg        _PKG_SHORT_ERRORS_SUPPORTED
2348309c398aSmrg        if test $_pkg_short_errors_supported = yes; then
2349309c398aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2350309c398aSmrg        else 
2351309c398aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2352309c398aSmrg        fi
2353309c398aSmrg	# Put the nasty error message in config.log where it belongs
2354309c398aSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2355309c398aSmrg
2356309c398aSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
2357309c398aSmrg[Package requirements ($2) were not met:
2358309c398aSmrg
2359309c398aSmrg$$1_PKG_ERRORS
2360309c398aSmrg
2361309c398aSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
2362309c398aSmrginstalled software in a non-standard prefix.
2363309c398aSmrg
2364309c398aSmrg_PKG_TEXT
2365309c398aSmrg])],
2366309c398aSmrg		[AC_MSG_RESULT([no])
2367309c398aSmrg                $4])
2368309c398aSmrgelif test $pkg_failed = untried; then
2369309c398aSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
2370309c398aSmrg[The pkg-config script could not be found or is too old.  Make sure it
2371309c398aSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
2372309c398aSmrgpath to pkg-config.
2373309c398aSmrg
2374309c398aSmrg_PKG_TEXT
2375309c398aSmrg
2376309c398aSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
2377309c398aSmrg		[$4])
2378309c398aSmrgelse
2379309c398aSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2380309c398aSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2381309c398aSmrg        AC_MSG_RESULT([yes])
2382309c398aSmrg	ifelse([$3], , :, [$3])
2383309c398aSmrgfi[]dnl
2384309c398aSmrg])# PKG_CHECK_MODULES
2385309c398aSmrg
2386309c398aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
2387309c398aSmrgdnl
2388309c398aSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
23895dd5f640Smrgdnl
2390309c398aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
2391309c398aSmrgdnl copy of this software and associated documentation files (the "Software"),
2392309c398aSmrgdnl to deal in the Software without restriction, including without limitation
2393309c398aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
2394309c398aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
2395309c398aSmrgdnl Software is furnished to do so, subject to the following conditions:
2396309c398aSmrgdnl
2397309c398aSmrgdnl The above copyright notice and this permission notice (including the next
2398309c398aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
2399309c398aSmrgdnl Software.
2400309c398aSmrgdnl
2401309c398aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2402309c398aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2403309c398aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2404309c398aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2405309c398aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2406309c398aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2407309c398aSmrgdnl DEALINGS IN THE SOFTWARE.
2408309c398aSmrg
2409309c398aSmrg# XORG_MACROS_VERSION(required-version)
2410309c398aSmrg# -------------------------------------
2411309c398aSmrg# Minimum version: 1.1.0
2412309c398aSmrg#
2413309c398aSmrg# If you're using a macro added in Version 1.1 or newer, include this in
2414309c398aSmrg# your configure.ac with the minimum required version, such as:
2415309c398aSmrg# XORG_MACROS_VERSION(1.1)
2416309c398aSmrg#
2417309c398aSmrg# To ensure that this macro is defined, also add:
2418309c398aSmrg# m4_ifndef([XORG_MACROS_VERSION],
2419309c398aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
2420309c398aSmrg#
2421309c398aSmrg#
24225dd5f640Smrg# See the "minimum version" comment for each macro you use to see what
2423309c398aSmrg# version you require.
2424309c398aSmrgm4_defun([XORG_MACROS_VERSION],[
24255dd5f640Smrgm4_define([vers_have], [1.17.1])
2426309c398aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
2427309c398aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
2428309c398aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
2429309c398aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
2430309c398aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
2431309c398aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
2432309c398aSmrgm4_undefine([vers_have])
2433309c398aSmrgm4_undefine([maj_have])
2434309c398aSmrgm4_undefine([maj_needed])
2435309c398aSmrg]) # XORG_MACROS_VERSION
2436309c398aSmrg
2437309c398aSmrg# XORG_PROG_RAWCPP()
2438309c398aSmrg# ------------------
2439309c398aSmrg# Minimum version: 1.0.0
2440309c398aSmrg#
2441309c398aSmrg# Find cpp program and necessary flags for use in pre-processing text files
2442309c398aSmrg# such as man pages and config files
2443309c398aSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
2444309c398aSmrgAC_REQUIRE([AC_PROG_CPP])
24455dd5f640SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
2446309c398aSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
2447309c398aSmrg
2448309c398aSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
2449309c398aSmrg# which is not the best choice for supporting other OS'es, but covers most
2450309c398aSmrg# of the ones we need for now.
2451309c398aSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
2452309c398aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
2453309c398aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2454309c398aSmrg	AC_MSG_RESULT([no])
2455309c398aSmrgelse
2456309c398aSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2457309c398aSmrg		RAWCPPFLAGS=-undef
2458309c398aSmrg		AC_MSG_RESULT([yes])
2459309c398aSmrg	# under Cygwin unix is still defined even with -undef
2460309c398aSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2461309c398aSmrg		RAWCPPFLAGS="-undef -ansi"
2462309c398aSmrg		AC_MSG_RESULT([yes, with -ansi])
2463309c398aSmrg	else
2464309c398aSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
2465309c398aSmrg	fi
2466309c398aSmrgfi
2467309c398aSmrgrm -f conftest.$ac_ext
2468309c398aSmrg
2469309c398aSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
2470309c398aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
2471309c398aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
2472309c398aSmrg	AC_MSG_RESULT([no])
2473309c398aSmrgelse
2474309c398aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
2475309c398aSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
2476309c398aSmrg		AC_MSG_RESULT([yes])
2477309c398aSmrg	else
2478309c398aSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
2479309c398aSmrg	fi
2480309c398aSmrgfi
2481309c398aSmrgrm -f conftest.$ac_ext
2482309c398aSmrgAC_SUBST(RAWCPPFLAGS)
2483309c398aSmrg]) # XORG_PROG_RAWCPP
2484309c398aSmrg
2485309c398aSmrg# XORG_MANPAGE_SECTIONS()
2486309c398aSmrg# -----------------------
2487309c398aSmrg# Minimum version: 1.0.0
2488309c398aSmrg#
2489309c398aSmrg# Determine which sections man pages go in for the different man page types
2490309c398aSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
2491309c398aSmrg# Not sure if there's any better way than just hardcoding by OS name.
2492309c398aSmrg# Override default settings by setting environment variables
2493309c398aSmrg# Added MAN_SUBSTS in version 1.8
2494309c398aSmrg# Added AC_PROG_SED in version 1.8
2495309c398aSmrg
2496309c398aSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
2497309c398aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2498309c398aSmrgAC_REQUIRE([AC_PROG_SED])
2499309c398aSmrg
2500309c398aSmrgif test x$APP_MAN_SUFFIX = x    ; then
2501309c398aSmrg    APP_MAN_SUFFIX=1
2502309c398aSmrgfi
2503309c398aSmrgif test x$APP_MAN_DIR = x    ; then
2504309c398aSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
2505309c398aSmrgfi
2506309c398aSmrg
2507309c398aSmrgif test x$LIB_MAN_SUFFIX = x    ; then
2508309c398aSmrg    LIB_MAN_SUFFIX=3
2509309c398aSmrgfi
2510309c398aSmrgif test x$LIB_MAN_DIR = x    ; then
2511309c398aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
2512309c398aSmrgfi
2513309c398aSmrg
2514309c398aSmrgif test x$FILE_MAN_SUFFIX = x    ; then
2515309c398aSmrg    case $host_os in
2516309c398aSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
2517309c398aSmrg	*)		FILE_MAN_SUFFIX=5  ;;
2518309c398aSmrg    esac
2519309c398aSmrgfi
2520309c398aSmrgif test x$FILE_MAN_DIR = x    ; then
2521309c398aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
2522309c398aSmrgfi
2523309c398aSmrg
2524309c398aSmrgif test x$MISC_MAN_SUFFIX = x    ; then
2525309c398aSmrg    case $host_os in
2526309c398aSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
2527309c398aSmrg	*)		MISC_MAN_SUFFIX=7  ;;
2528309c398aSmrg    esac
2529309c398aSmrgfi
2530309c398aSmrgif test x$MISC_MAN_DIR = x    ; then
2531309c398aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
2532309c398aSmrgfi
2533309c398aSmrg
2534309c398aSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
2535309c398aSmrg    case $host_os in
2536309c398aSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
2537309c398aSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
2538309c398aSmrg    esac
2539309c398aSmrgfi
2540309c398aSmrgif test x$DRIVER_MAN_DIR = x    ; then
2541309c398aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
2542309c398aSmrgfi
2543309c398aSmrg
2544309c398aSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
2545309c398aSmrg    case $host_os in
2546309c398aSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
2547309c398aSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
2548309c398aSmrg    esac
2549309c398aSmrgfi
2550309c398aSmrgif test x$ADMIN_MAN_DIR = x    ; then
2551309c398aSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
2552309c398aSmrgfi
2553309c398aSmrg
2554309c398aSmrg
2555309c398aSmrgAC_SUBST([APP_MAN_SUFFIX])
2556309c398aSmrgAC_SUBST([LIB_MAN_SUFFIX])
2557309c398aSmrgAC_SUBST([FILE_MAN_SUFFIX])
2558309c398aSmrgAC_SUBST([MISC_MAN_SUFFIX])
2559309c398aSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
2560309c398aSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
2561309c398aSmrgAC_SUBST([APP_MAN_DIR])
2562309c398aSmrgAC_SUBST([LIB_MAN_DIR])
2563309c398aSmrgAC_SUBST([FILE_MAN_DIR])
2564309c398aSmrgAC_SUBST([MISC_MAN_DIR])
2565309c398aSmrgAC_SUBST([DRIVER_MAN_DIR])
2566309c398aSmrgAC_SUBST([ADMIN_MAN_DIR])
2567309c398aSmrg
2568309c398aSmrgXORG_MAN_PAGE="X Version 11"
2569309c398aSmrgAC_SUBST([XORG_MAN_PAGE])
2570309c398aSmrgMAN_SUBSTS="\
2571309c398aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2572309c398aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2573309c398aSmrg	-e 's|__xservername__|Xorg|g' \
2574309c398aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
2575309c398aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
2576309c398aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
2577309c398aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
2578309c398aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
2579309c398aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
2580309c398aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
2581309c398aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
2582309c398aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
2583309c398aSmrgAC_SUBST([MAN_SUBSTS])
2584309c398aSmrg
2585309c398aSmrg]) # XORG_MANPAGE_SECTIONS
2586309c398aSmrg
2587309c398aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
2588309c398aSmrg# ------------------------
2589309c398aSmrg# Minimum version: 1.7.0
2590309c398aSmrg#
2591309c398aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
2592309c398aSmrg# provided by xorg-sgml-doctools, if installed.
25938903d43aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
25948903d43aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
25958903d43aSmrgXORG_SGML_PATH=
25968903d43aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
25978903d43aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
25988903d43aSmrg    [m4_ifval([$1],[:],
25998903d43aSmrg        [if test x"$cross_compiling" != x"yes" ; then
26008903d43aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
26018903d43aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
26028903d43aSmrg         fi])
26038903d43aSmrg    ])
26048903d43aSmrg
26058903d43aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
26068903d43aSmrg# the path and the name of the doc stylesheet
26078903d43aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
26088903d43aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
26098903d43aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
26108903d43aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
26118903d43aSmrgelse
26128903d43aSmrg   AC_MSG_RESULT([no])
26138903d43aSmrgfi
26148903d43aSmrg
26158903d43aSmrgAC_SUBST(XORG_SGML_PATH)
26168903d43aSmrgAC_SUBST(STYLESHEET_SRCDIR)
26178903d43aSmrgAC_SUBST(XSL_STYLESHEET)
26188903d43aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
26198903d43aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
26208903d43aSmrg
2621e9554658Smrg# XORG_CHECK_LINUXDOC
2622e9554658Smrg# -------------------
2623e9554658Smrg# Minimum version: 1.0.0
2624e9554658Smrg#
2625e9554658Smrg# Defines the variable MAKE_TEXT if the necessary tools and
2626e9554658Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
2627e9554658Smrg# Whether or not the necessary tools and files are found can be checked
2628e9554658Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
2629e9554658SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
26308903d43aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
26318903d43aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
2632e9554658Smrg
2633e9554658SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
2634e9554658Smrg
26358903d43aSmrgAC_MSG_CHECKING([whether to build documentation])
2636e9554658Smrg
26378903d43aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
2638e9554658Smrg   BUILDDOC=yes
2639e9554658Smrgelse
2640e9554658Smrg   BUILDDOC=no
2641e9554658Smrgfi
2642e9554658Smrg
2643e9554658SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
2644e9554658Smrg
2645e9554658SmrgAC_MSG_RESULT([$BUILDDOC])
2646e9554658Smrg
26478903d43aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
2648e9554658Smrg
26498903d43aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
2650e9554658Smrg   BUILDPDFDOC=yes
2651e9554658Smrgelse
2652e9554658Smrg   BUILDPDFDOC=no
2653e9554658Smrgfi
2654e9554658Smrg
2655e9554658SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2656e9554658Smrg
2657e9554658SmrgAC_MSG_RESULT([$BUILDPDFDOC])
2658e9554658Smrg
26598903d43aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
2660e9554658SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
2661e9554658SmrgMAKE_PDF="$PS2PDF"
2662e9554658SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
2663e9554658Smrg
2664e9554658SmrgAC_SUBST(MAKE_TEXT)
2665e9554658SmrgAC_SUBST(MAKE_PS)
2666e9554658SmrgAC_SUBST(MAKE_PDF)
2667e9554658SmrgAC_SUBST(MAKE_HTML)
2668e9554658Smrg]) # XORG_CHECK_LINUXDOC
2669e9554658Smrg
2670e9554658Smrg# XORG_CHECK_DOCBOOK
2671e9554658Smrg# -------------------
2672e9554658Smrg# Minimum version: 1.0.0
2673e9554658Smrg#
2674e9554658Smrg# Checks for the ability to build output formats from SGML DocBook source.
2675e9554658Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
2676e9554658Smrg# indicates whether the necessary tools and files are found and, if set,
2677e9554658Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
2678e9554658SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
26798903d43aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
26808903d43aSmrg
2681e9554658SmrgBUILDTXTDOC=no
2682e9554658SmrgBUILDPDFDOC=no
2683e9554658SmrgBUILDPSDOC=no
2684e9554658SmrgBUILDHTMLDOC=no
2685e9554658Smrg
2686e9554658SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
2687e9554658SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
2688e9554658SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
2689e9554658SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
2690e9554658Smrg
26918903d43aSmrgAC_MSG_CHECKING([whether to build text documentation])
26928903d43aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
2693e9554658Smrg   test x$BUILD_TXTDOC != xno; then
2694e9554658Smrg	BUILDTXTDOC=yes
2695e9554658Smrgfi
2696e9554658SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
2697e9554658SmrgAC_MSG_RESULT([$BUILDTXTDOC])
2698e9554658Smrg
26998903d43aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
27008903d43aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
2701e9554658Smrg   test x$BUILD_PDFDOC != xno; then
2702e9554658Smrg	BUILDPDFDOC=yes
2703e9554658Smrgfi
2704e9554658SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2705e9554658SmrgAC_MSG_RESULT([$BUILDPDFDOC])
2706e9554658Smrg
27078903d43aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
27088903d43aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
2709e9554658Smrg   test x$BUILD_PSDOC != xno; then
2710e9554658Smrg	BUILDPSDOC=yes
2711e9554658Smrgfi
2712e9554658SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
2713e9554658SmrgAC_MSG_RESULT([$BUILDPSDOC])
2714e9554658Smrg
27158903d43aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
27168903d43aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
2717e9554658Smrg   test x$BUILD_HTMLDOC != xno; then
2718e9554658Smrg	BUILDHTMLDOC=yes
2719e9554658Smrgfi
2720e9554658SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
2721e9554658SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
2722e9554658Smrg
2723e9554658SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
2724e9554658SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
2725e9554658SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
2726e9554658SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
2727e9554658Smrg
2728e9554658SmrgAC_SUBST(MAKE_TEXT)
2729e9554658SmrgAC_SUBST(MAKE_PS)
2730e9554658SmrgAC_SUBST(MAKE_PDF)
2731e9554658SmrgAC_SUBST(MAKE_HTML)
2732e9554658Smrg]) # XORG_CHECK_DOCBOOK
2733e9554658Smrg
2734309c398aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
27358903d43aSmrg# ----------------
27368903d43aSmrg# Minimum version: 1.5.0
2737309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
27388903d43aSmrg#
27398903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
27408903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
27418903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
27428903d43aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
2743309c398aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
2744309c398aSmrg# --with-xmlto assumes 'auto'.
27458903d43aSmrg#
27468903d43aSmrg# Interface to module:
27478903d43aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
27488903d43aSmrg# XMLTO:	returns the path of the xmlto program found
27498903d43aSmrg#		returns the path set by the user in the environment
27508903d43aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
27518903d43aSmrg#		'no' user instructs the module not to use xmlto
27528903d43aSmrg#
27538903d43aSmrg# Added in version 1.10.0
27548903d43aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
27558903d43aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
27568903d43aSmrg#
27578903d43aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
27588903d43aSmrg#
27598903d43aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
27608903d43aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
2761309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
27628903d43aSmrgAC_ARG_WITH(xmlto,
27638903d43aSmrg	AS_HELP_STRING([--with-xmlto],
2764309c398aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
2765309c398aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
2766309c398aSmrgm4_undefine([_defopt])
27678903d43aSmrg
27688903d43aSmrgif test "x$use_xmlto" = x"auto"; then
27698903d43aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
27708903d43aSmrg   if test "x$XMLTO" = "x"; then
27718903d43aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
27728903d43aSmrg	have_xmlto=no
27738903d43aSmrg   else
27748903d43aSmrg        have_xmlto=yes
27758903d43aSmrg   fi
27768903d43aSmrgelif test "x$use_xmlto" = x"yes" ; then
27778903d43aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
27788903d43aSmrg   if test "x$XMLTO" = "x"; then
27798903d43aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
27808903d43aSmrg   fi
27818903d43aSmrg   have_xmlto=yes
27828903d43aSmrgelif test "x$use_xmlto" = x"no" ; then
27838903d43aSmrg   if test "x$XMLTO" != "x"; then
27848903d43aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
27858903d43aSmrg   fi
27868903d43aSmrg   have_xmlto=no
27878903d43aSmrgelse
27888903d43aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
27898903d43aSmrgfi
27908903d43aSmrg
27918903d43aSmrg# Test for a minimum version of xmlto, if provided.
27928903d43aSmrgm4_ifval([$1],
27938903d43aSmrg[if test "$have_xmlto" = yes; then
27948903d43aSmrg    # scrape the xmlto version
27958903d43aSmrg    AC_MSG_CHECKING([the xmlto version])
27968903d43aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
27978903d43aSmrg    AC_MSG_RESULT([$xmlto_version])
27988903d43aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
27998903d43aSmrg        [if test "x$use_xmlto" = xauto; then
28008903d43aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
28018903d43aSmrg            have_xmlto=no
28028903d43aSmrg        else
28038903d43aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
28048903d43aSmrg        fi])
28058903d43aSmrgfi])
28068903d43aSmrg
28078903d43aSmrg# Test for the ability of xmlto to generate a text target
28088903d43aSmrghave_xmlto_text=no
28098903d43aSmrgcat > conftest.xml << "EOF"
28108903d43aSmrgEOF
28118903d43aSmrgAS_IF([test "$have_xmlto" = yes],
28128903d43aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
28138903d43aSmrg             [have_xmlto_text=yes],
28148903d43aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
28158903d43aSmrgrm -f conftest.xml
28168903d43aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
28178903d43aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
28188903d43aSmrg]) # XORG_WITH_XMLTO
28198903d43aSmrg
2820309c398aSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2821309c398aSmrg# --------------------------------------------
2822309c398aSmrg# Minimum version: 1.12.0
2823309c398aSmrg# Minimum version for optional DEFAULT argument: 1.12.0
2824309c398aSmrg#
2825309c398aSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2826309c398aSmrg# XML-based language used for the transformation of XML documents.
2827309c398aSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2828309c398aSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2829309c398aSmrg# The XSLT processor is often used as a standalone tool for transformations.
2830309c398aSmrg# It should not be assumed that this tool is used only to work with documnetation.
2831309c398aSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2832309c398aSmrg#
2833309c398aSmrg# Interface to module:
2834309c398aSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2835309c398aSmrg# XSLTPROC:	 returns the path of the xsltproc program found
2836309c398aSmrg#		 returns the path set by the user in the environment
2837309c398aSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2838309c398aSmrg#		  'no' user instructs the module not to use xsltproc
2839309c398aSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2840309c398aSmrg#
2841309c398aSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2842309c398aSmrg#
2843309c398aSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2844309c398aSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2845309c398aSmrg# Preserves the interface, should it be implemented later
2846309c398aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2847309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2848309c398aSmrgAC_ARG_WITH(xsltproc,
2849309c398aSmrg	AS_HELP_STRING([--with-xsltproc],
2850309c398aSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2851309c398aSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2852309c398aSmrgm4_undefine([_defopt])
2853309c398aSmrg
2854309c398aSmrgif test "x$use_xsltproc" = x"auto"; then
2855309c398aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2856309c398aSmrg   if test "x$XSLTPROC" = "x"; then
2857309c398aSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2858309c398aSmrg	have_xsltproc=no
2859309c398aSmrg   else
2860309c398aSmrg        have_xsltproc=yes
2861309c398aSmrg   fi
2862309c398aSmrgelif test "x$use_xsltproc" = x"yes" ; then
2863309c398aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2864309c398aSmrg   if test "x$XSLTPROC" = "x"; then
2865309c398aSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2866309c398aSmrg   fi
2867309c398aSmrg   have_xsltproc=yes
2868309c398aSmrgelif test "x$use_xsltproc" = x"no" ; then
2869309c398aSmrg   if test "x$XSLTPROC" != "x"; then
2870309c398aSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2871309c398aSmrg   fi
2872309c398aSmrg   have_xsltproc=no
2873309c398aSmrgelse
2874309c398aSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2875309c398aSmrgfi
2876309c398aSmrg
2877309c398aSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2878309c398aSmrg]) # XORG_WITH_XSLTPROC
2879309c398aSmrg
2880309c398aSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2881309c398aSmrg# ----------------------------------------
2882309c398aSmrg# Minimum version: 1.15.0
2883309c398aSmrg#
2884309c398aSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
2885309c398aSmrg# scanning arbitrary text files, extracting information from those text files,
2886309c398aSmrg# and printing reports based on that information.
2887309c398aSmrg#
2888309c398aSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2889309c398aSmrg#
2890309c398aSmrg# Interface to module:
2891309c398aSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
2892309c398aSmrg# PERL:	     returns the path of the perl program found
2893309c398aSmrg#	     returns the path set by the user in the environment
2894309c398aSmrg# --with-perl: 'yes' user instructs the module to use perl
2895309c398aSmrg#	       'no' user instructs the module not to use perl
2896309c398aSmrg# have_perl: returns yes if perl found in PATH or no
2897309c398aSmrg#
2898309c398aSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2899309c398aSmrg#
2900309c398aSmrgAC_DEFUN([XORG_WITH_PERL],[
2901309c398aSmrgAC_ARG_VAR([PERL], [Path to perl command])
2902309c398aSmrg# Preserves the interface, should it be implemented later
2903309c398aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2904309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2905309c398aSmrgAC_ARG_WITH(perl,
2906309c398aSmrg	AS_HELP_STRING([--with-perl],
2907309c398aSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2908309c398aSmrg	   [use_perl=$withval], [use_perl=]_defopt)
2909309c398aSmrgm4_undefine([_defopt])
2910309c398aSmrg
2911309c398aSmrgif test "x$use_perl" = x"auto"; then
2912309c398aSmrg   AC_PATH_PROG([PERL], [perl])
2913309c398aSmrg   if test "x$PERL" = "x"; then
2914309c398aSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2915309c398aSmrg	have_perl=no
2916309c398aSmrg   else
2917309c398aSmrg        have_perl=yes
2918309c398aSmrg   fi
2919309c398aSmrgelif test "x$use_perl" = x"yes" ; then
2920309c398aSmrg   AC_PATH_PROG([PERL], [perl])
2921309c398aSmrg   if test "x$PERL" = "x"; then
2922309c398aSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2923309c398aSmrg   fi
2924309c398aSmrg   have_perl=yes
2925309c398aSmrgelif test "x$use_perl" = x"no" ; then
2926309c398aSmrg   if test "x$PERL" != "x"; then
2927309c398aSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2928309c398aSmrg   fi
2929309c398aSmrg   have_perl=no
2930309c398aSmrgelse
2931309c398aSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2932309c398aSmrgfi
2933309c398aSmrg
2934309c398aSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2935309c398aSmrg]) # XORG_WITH_PERL
2936309c398aSmrg
2937309c398aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
29388903d43aSmrg# ----------------
29398903d43aSmrg# Minimum version: 1.5.0
2940309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
29418903d43aSmrg#
29428903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
29438903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
29448903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
29458903d43aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
2946309c398aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2947309c398aSmrg# --with-asciidoc assumes 'auto'.
29488903d43aSmrg#
29498903d43aSmrg# Interface to module:
29508903d43aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
29518903d43aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
29528903d43aSmrg#		 returns the path set by the user in the environment
29538903d43aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
29548903d43aSmrg#		  'no' user instructs the module not to use asciidoc
29558903d43aSmrg#
29568903d43aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
29578903d43aSmrg#
29588903d43aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
29598903d43aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2960309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
29618903d43aSmrgAC_ARG_WITH(asciidoc,
29628903d43aSmrg	AS_HELP_STRING([--with-asciidoc],
2963309c398aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2964309c398aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2965309c398aSmrgm4_undefine([_defopt])
29668903d43aSmrg
29678903d43aSmrgif test "x$use_asciidoc" = x"auto"; then
29688903d43aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
29698903d43aSmrg   if test "x$ASCIIDOC" = "x"; then
29708903d43aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
29718903d43aSmrg	have_asciidoc=no
29728903d43aSmrg   else
29738903d43aSmrg        have_asciidoc=yes
29748903d43aSmrg   fi
29758903d43aSmrgelif test "x$use_asciidoc" = x"yes" ; then
29768903d43aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
29778903d43aSmrg   if test "x$ASCIIDOC" = "x"; then
29788903d43aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
29798903d43aSmrg   fi
29808903d43aSmrg   have_asciidoc=yes
29818903d43aSmrgelif test "x$use_asciidoc" = x"no" ; then
29828903d43aSmrg   if test "x$ASCIIDOC" != "x"; then
29838903d43aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
29848903d43aSmrg   fi
29858903d43aSmrg   have_asciidoc=no
29868903d43aSmrgelse
29878903d43aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
29888903d43aSmrgfi
29898903d43aSmrgm4_ifval([$1],
29908903d43aSmrg[if test "$have_asciidoc" = yes; then
29918903d43aSmrg    # scrape the asciidoc version
29928903d43aSmrg    AC_MSG_CHECKING([the asciidoc version])
29938903d43aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
29948903d43aSmrg    AC_MSG_RESULT([$asciidoc_version])
29958903d43aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
29968903d43aSmrg        [if test "x$use_asciidoc" = xauto; then
29978903d43aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
29988903d43aSmrg            have_asciidoc=no
29998903d43aSmrg        else
30008903d43aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
30018903d43aSmrg        fi])
30028903d43aSmrgfi])
30038903d43aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
30048903d43aSmrg]) # XORG_WITH_ASCIIDOC
30058903d43aSmrg
3006309c398aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
30078903d43aSmrg# --------------------------------
30088903d43aSmrg# Minimum version: 1.5.0
3009309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
30108903d43aSmrg#
30118903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
30128903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
30138903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
30148903d43aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
3015309c398aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
3016309c398aSmrg# --with-doxygen assumes 'auto'.
30178903d43aSmrg#
30188903d43aSmrg# Interface to module:
30198903d43aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
30208903d43aSmrg# DOXYGEN:	 returns the path of the doxygen program found
30218903d43aSmrg#		 returns the path set by the user in the environment
30228903d43aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
30238903d43aSmrg#		  'no' user instructs the module not to use doxygen
30248903d43aSmrg#
30258903d43aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
30268903d43aSmrg#
30278903d43aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
30288903d43aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
3029309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
30308903d43aSmrgAC_ARG_WITH(doxygen,
30318903d43aSmrg	AS_HELP_STRING([--with-doxygen],
3032309c398aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
3033309c398aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
3034309c398aSmrgm4_undefine([_defopt])
30358903d43aSmrg
30368903d43aSmrgif test "x$use_doxygen" = x"auto"; then
30378903d43aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
30388903d43aSmrg   if test "x$DOXYGEN" = "x"; then
30398903d43aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
30408903d43aSmrg	have_doxygen=no
30418903d43aSmrg   else
30428903d43aSmrg        have_doxygen=yes
30438903d43aSmrg   fi
30448903d43aSmrgelif test "x$use_doxygen" = x"yes" ; then
30458903d43aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
30468903d43aSmrg   if test "x$DOXYGEN" = "x"; then
30478903d43aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
30488903d43aSmrg   fi
30498903d43aSmrg   have_doxygen=yes
30508903d43aSmrgelif test "x$use_doxygen" = x"no" ; then
30518903d43aSmrg   if test "x$DOXYGEN" != "x"; then
30528903d43aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
30538903d43aSmrg   fi
30548903d43aSmrg   have_doxygen=no
30558903d43aSmrgelse
30568903d43aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
30578903d43aSmrgfi
30588903d43aSmrgm4_ifval([$1],
30598903d43aSmrg[if test "$have_doxygen" = yes; then
30608903d43aSmrg    # scrape the doxygen version
30618903d43aSmrg    AC_MSG_CHECKING([the doxygen version])
30628903d43aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
30638903d43aSmrg    AC_MSG_RESULT([$doxygen_version])
30648903d43aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
30658903d43aSmrg        [if test "x$use_doxygen" = xauto; then
30668903d43aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
30678903d43aSmrg            have_doxygen=no
30688903d43aSmrg        else
30698903d43aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
30708903d43aSmrg        fi])
30718903d43aSmrgfi])
30728903d43aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
30738903d43aSmrg]) # XORG_WITH_DOXYGEN
30748903d43aSmrg
3075309c398aSmrg# XORG_WITH_GROFF([DEFAULT])
30768903d43aSmrg# ----------------
30778903d43aSmrg# Minimum version: 1.6.0
3078309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
30798903d43aSmrg#
30808903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
30818903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
30828903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
30838903d43aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
3084309c398aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
3085309c398aSmrg# --with-groff assumes 'auto'.
30868903d43aSmrg#
30878903d43aSmrg# Interface to module:
30888903d43aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
30898903d43aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
30908903d43aSmrg# HAVE_GROFF_MS: the -ms macros package
30918903d43aSmrg# GROFF:	 returns the path of the groff program found
30928903d43aSmrg#		 returns the path set by the user in the environment
30938903d43aSmrg# --with-groff:	 'yes' user instructs the module to use groff
30948903d43aSmrg#		 'no' user instructs the module not to use groff
30958903d43aSmrg#
30968903d43aSmrg# Added in version 1.9.0:
30978903d43aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
30988903d43aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
30998903d43aSmrg#		   psselect from the psutils package.
31008903d43aSmrg#		   the ghostcript package. Refer to the grohtml man pages
31018903d43aSmrg#
31028903d43aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
31038903d43aSmrg#
31048903d43aSmrg# OS and distros often splits groff in a basic and full package, the former
31058903d43aSmrg# having the groff program and the later having devices, fonts and macros
31068903d43aSmrg# Checking for the groff executable is not enough.
31078903d43aSmrg#
31088903d43aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
31098903d43aSmrg# unset HAVE_GROFF or GROFF env variables.
31108903d43aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
31118903d43aSmrg#
31128903d43aSmrgAC_DEFUN([XORG_WITH_GROFF],[
31138903d43aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
3114309c398aSmrgm4_define([_defopt], m4_default([$1], [auto]))
31158903d43aSmrgAC_ARG_WITH(groff,
31168903d43aSmrg	AS_HELP_STRING([--with-groff],
3117309c398aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
3118309c398aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
3119309c398aSmrgm4_undefine([_defopt])
31208903d43aSmrg
31218903d43aSmrgif test "x$use_groff" = x"auto"; then
31228903d43aSmrg   AC_PATH_PROG([GROFF], [groff])
31238903d43aSmrg   if test "x$GROFF" = "x"; then
31248903d43aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
31258903d43aSmrg	have_groff=no
31268903d43aSmrg   else
31278903d43aSmrg        have_groff=yes
31288903d43aSmrg   fi
31298903d43aSmrgelif test "x$use_groff" = x"yes" ; then
31308903d43aSmrg   AC_PATH_PROG([GROFF], [groff])
31318903d43aSmrg   if test "x$GROFF" = "x"; then
31328903d43aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
31338903d43aSmrg   fi
31348903d43aSmrg   have_groff=yes
31358903d43aSmrgelif test "x$use_groff" = x"no" ; then
31368903d43aSmrg   if test "x$GROFF" != "x"; then
31378903d43aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
31388903d43aSmrg   fi
31398903d43aSmrg   have_groff=no
31408903d43aSmrgelse
31418903d43aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
31428903d43aSmrgfi
31438903d43aSmrg
31448903d43aSmrg# We have groff, test for the presence of the macro packages
31458903d43aSmrgif test "x$have_groff" = x"yes"; then
31468903d43aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
31478903d43aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
31488903d43aSmrg        groff_ms_works=yes
31498903d43aSmrg    else
31508903d43aSmrg        groff_ms_works=no
31518903d43aSmrg    fi
31528903d43aSmrg    AC_MSG_RESULT([$groff_ms_works])
31538903d43aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
31548903d43aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
31558903d43aSmrg        groff_mm_works=yes
31568903d43aSmrg    else
31578903d43aSmrg        groff_mm_works=no
31588903d43aSmrg    fi
31598903d43aSmrg    AC_MSG_RESULT([$groff_mm_works])
31608903d43aSmrgfi
31618903d43aSmrg
31628903d43aSmrg# We have groff, test for HTML dependencies, one command per package
31638903d43aSmrgif test "x$have_groff" = x"yes"; then
31648903d43aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
31658903d43aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
31668903d43aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
31678903d43aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
31688903d43aSmrg      have_groff_html=yes
31698903d43aSmrg   else
31708903d43aSmrg      have_groff_html=no
31718903d43aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
31728903d43aSmrg   fi
31738903d43aSmrgfi
31748903d43aSmrg
31758903d43aSmrg# Set Automake conditionals for Makefiles
31768903d43aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
31778903d43aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
31788903d43aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
31798903d43aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
31808903d43aSmrg]) # XORG_WITH_GROFF
31818903d43aSmrg
3182309c398aSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
3183309c398aSmrg# ---------------------------------------
31848903d43aSmrg# Minimum version: 1.6.0
3185309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
3186309c398aSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
31878903d43aSmrg#
31888903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
31898903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
31908903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
31918903d43aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
3192309c398aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
3193309c398aSmrg# --with-fop assumes 'auto'.
31948903d43aSmrg#
31958903d43aSmrg# Interface to module:
31968903d43aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
31978903d43aSmrg# FOP:	 	returns the path of the fop program found
31988903d43aSmrg#		returns the path set by the user in the environment
31998903d43aSmrg# --with-fop: 	'yes' user instructs the module to use fop
32008903d43aSmrg#		'no' user instructs the module not to use fop
32018903d43aSmrg#
32028903d43aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
32038903d43aSmrg#
32048903d43aSmrgAC_DEFUN([XORG_WITH_FOP],[
32058903d43aSmrgAC_ARG_VAR([FOP], [Path to fop command])
3206309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
32078903d43aSmrgAC_ARG_WITH(fop,
32088903d43aSmrg	AS_HELP_STRING([--with-fop],
3209309c398aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
3210309c398aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
3211309c398aSmrgm4_undefine([_defopt])
32128903d43aSmrg
32138903d43aSmrgif test "x$use_fop" = x"auto"; then
32148903d43aSmrg   AC_PATH_PROG([FOP], [fop])
32158903d43aSmrg   if test "x$FOP" = "x"; then
32168903d43aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
32178903d43aSmrg	have_fop=no
32188903d43aSmrg   else
32198903d43aSmrg        have_fop=yes
32208903d43aSmrg   fi
32218903d43aSmrgelif test "x$use_fop" = x"yes" ; then
32228903d43aSmrg   AC_PATH_PROG([FOP], [fop])
32238903d43aSmrg   if test "x$FOP" = "x"; then
32248903d43aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
32258903d43aSmrg   fi
32268903d43aSmrg   have_fop=yes
32278903d43aSmrgelif test "x$use_fop" = x"no" ; then
32288903d43aSmrg   if test "x$FOP" != "x"; then
32298903d43aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
32308903d43aSmrg   fi
32318903d43aSmrg   have_fop=no
32328903d43aSmrgelse
32338903d43aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
32348903d43aSmrgfi
3235309c398aSmrg
3236309c398aSmrg# Test for a minimum version of fop, if provided.
3237309c398aSmrgm4_ifval([$1],
3238309c398aSmrg[if test "$have_fop" = yes; then
3239309c398aSmrg    # scrape the fop version
3240309c398aSmrg    AC_MSG_CHECKING([for fop minimum version])
3241309c398aSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
3242309c398aSmrg    AC_MSG_RESULT([$fop_version])
3243309c398aSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
3244309c398aSmrg        [if test "x$use_fop" = xauto; then
3245309c398aSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
3246309c398aSmrg            have_fop=no
3247309c398aSmrg        else
3248309c398aSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
3249309c398aSmrg        fi])
3250309c398aSmrgfi])
32518903d43aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
32528903d43aSmrg]) # XORG_WITH_FOP
32538903d43aSmrg
3254309c398aSmrg# XORG_WITH_PS2PDF([DEFAULT])
32558903d43aSmrg# ----------------
32568903d43aSmrg# Minimum version: 1.6.0
3257309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
32588903d43aSmrg#
32598903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
32608903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
32618903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
32628903d43aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
3263309c398aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
3264309c398aSmrg# --with-ps2pdf assumes 'auto'.
32658903d43aSmrg#
32668903d43aSmrg# Interface to module:
32678903d43aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
32688903d43aSmrg# PS2PDF:	returns the path of the ps2pdf program found
32698903d43aSmrg#		returns the path set by the user in the environment
32708903d43aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
32718903d43aSmrg#		 'no' user instructs the module not to use ps2pdf
32728903d43aSmrg#
32738903d43aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
32748903d43aSmrg#
32758903d43aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
32768903d43aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
3277309c398aSmrgm4_define([_defopt], m4_default([$1], [auto]))
32788903d43aSmrgAC_ARG_WITH(ps2pdf,
32798903d43aSmrg	AS_HELP_STRING([--with-ps2pdf],
3280309c398aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
3281309c398aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
3282309c398aSmrgm4_undefine([_defopt])
32838903d43aSmrg
32848903d43aSmrgif test "x$use_ps2pdf" = x"auto"; then
32858903d43aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
32868903d43aSmrg   if test "x$PS2PDF" = "x"; then
32878903d43aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
32888903d43aSmrg	have_ps2pdf=no
32898903d43aSmrg   else
32908903d43aSmrg        have_ps2pdf=yes
32918903d43aSmrg   fi
32928903d43aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
32938903d43aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
32948903d43aSmrg   if test "x$PS2PDF" = "x"; then
32958903d43aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
32968903d43aSmrg   fi
32978903d43aSmrg   have_ps2pdf=yes
32988903d43aSmrgelif test "x$use_ps2pdf" = x"no" ; then
32998903d43aSmrg   if test "x$PS2PDF" != "x"; then
33008903d43aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
33018903d43aSmrg   fi
33028903d43aSmrg   have_ps2pdf=no
33038903d43aSmrgelse
33048903d43aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
33058903d43aSmrgfi
33068903d43aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
33078903d43aSmrg]) # XORG_WITH_PS2PDF
33088903d43aSmrg
33098903d43aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
33108903d43aSmrg# ----------------
33118903d43aSmrg# Minimum version: 1.6.0
33128903d43aSmrg#
33138903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
33148903d43aSmrg# not at the appropriate level. This macro enables a builder to skip all
33158903d43aSmrg# documentation targets except traditional man pages.
33168903d43aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
33178903d43aSmrg# maximum flexibilty in controlling documentation building.
33188903d43aSmrg# Refer to:
33198903d43aSmrg# XORG_WITH_XMLTO         --with-xmlto
33208903d43aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
33218903d43aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
33228903d43aSmrg# XORG_WITH_FOP           --with-fop
33238903d43aSmrg# XORG_WITH_GROFF         --with-groff
33248903d43aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
33258903d43aSmrg#
33268903d43aSmrg# Interface to module:
33278903d43aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
33288903d43aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
33298903d43aSmrg#		 'no' user instructs the module not to generate docs
33308903d43aSmrg# parm1:	specify the default value, yes or no.
33318903d43aSmrg#
33328903d43aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
3333309c398aSmrgm4_define([docs_default], m4_default([$1], [yes]))
33348903d43aSmrgAC_ARG_ENABLE(docs,
33358903d43aSmrg	AS_HELP_STRING([--enable-docs],
3336309c398aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
3337309c398aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
3338309c398aSmrgm4_undefine([docs_default])
33398903d43aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
33408903d43aSmrgAC_MSG_CHECKING([whether to build documentation])
33418903d43aSmrgAC_MSG_RESULT([$build_docs])
33428903d43aSmrg]) # XORG_ENABLE_DOCS
33438903d43aSmrg
33448903d43aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
33458903d43aSmrg# ----------------
33468903d43aSmrg# Minimum version: 1.6.0
33478903d43aSmrg#
33488903d43aSmrg# This macro enables a builder to skip all developer documentation.
33498903d43aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
33508903d43aSmrg# maximum flexibilty in controlling documentation building.
33518903d43aSmrg# Refer to:
33528903d43aSmrg# XORG_WITH_XMLTO         --with-xmlto
33538903d43aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
33548903d43aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
33558903d43aSmrg# XORG_WITH_FOP           --with-fop
33568903d43aSmrg# XORG_WITH_GROFF         --with-groff
33578903d43aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
33588903d43aSmrg#
33598903d43aSmrg# Interface to module:
33608903d43aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
33618903d43aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
33628903d43aSmrg#			'no' user instructs the module not to generate developer docs
33638903d43aSmrg# parm1:		specify the default value, yes or no.
33648903d43aSmrg#
33658903d43aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
3366309c398aSmrgm4_define([devel_default], m4_default([$1], [yes]))
33678903d43aSmrgAC_ARG_ENABLE(devel-docs,
33688903d43aSmrg	AS_HELP_STRING([--enable-devel-docs],
3369309c398aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
3370309c398aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
3371309c398aSmrgm4_undefine([devel_default])
33728903d43aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
33738903d43aSmrgAC_MSG_CHECKING([whether to build developer documentation])
33748903d43aSmrgAC_MSG_RESULT([$build_devel_docs])
33758903d43aSmrg]) # XORG_ENABLE_DEVEL_DOCS
33768903d43aSmrg
33778903d43aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
33788903d43aSmrg# ----------------
33798903d43aSmrg# Minimum version: 1.6.0
33808903d43aSmrg#
33818903d43aSmrg# This macro enables a builder to skip all functional specification targets.
33828903d43aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
33838903d43aSmrg# maximum flexibilty in controlling documentation building.
33848903d43aSmrg# Refer to:
33858903d43aSmrg# XORG_WITH_XMLTO         --with-xmlto
33868903d43aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
33878903d43aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
33888903d43aSmrg# XORG_WITH_FOP           --with-fop
33898903d43aSmrg# XORG_WITH_GROFF         --with-groff
33908903d43aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
33918903d43aSmrg#
33928903d43aSmrg# Interface to module:
33938903d43aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
33948903d43aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
33958903d43aSmrg#			'no' user instructs the module not to generate specs
33968903d43aSmrg# parm1:		specify the default value, yes or no.
33978903d43aSmrg#
33988903d43aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
3399309c398aSmrgm4_define([spec_default], m4_default([$1], [yes]))
34008903d43aSmrgAC_ARG_ENABLE(specs,
34018903d43aSmrg	AS_HELP_STRING([--enable-specs],
3402309c398aSmrg	   [Enable building the specs (default: ]spec_default[)]),
3403309c398aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
3404309c398aSmrgm4_undefine([spec_default])
34058903d43aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
34068903d43aSmrgAC_MSG_CHECKING([whether to build functional specifications])
34078903d43aSmrgAC_MSG_RESULT([$build_specs])
34088903d43aSmrg]) # XORG_ENABLE_SPECS
34098903d43aSmrg
3410309c398aSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
3411309c398aSmrg# ----------------------------------------------
3412309c398aSmrg# Minimum version: 1.13.0
3413309c398aSmrg#
3414309c398aSmrg# This macro enables a builder to enable/disable unit testing
3415309c398aSmrg# It makes no assumption about the test cases implementation
3416309c398aSmrg# Test cases may or may not use Automake "Support for test suites"
3417309c398aSmrg# They may or may not use the software utility library GLib
3418309c398aSmrg#
3419309c398aSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
3420309c398aSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
3421309c398aSmrg# The variable enable_unit_tests is used by other macros in this file.
3422309c398aSmrg#
3423309c398aSmrg# Interface to module:
3424309c398aSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
3425309c398aSmrg# enable_unit_tests:    used in configure.ac for additional configuration
3426309c398aSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
3427309c398aSmrg#			'no' user instructs the module not to build tests
3428309c398aSmrg# parm1:		specify the default value, yes or no.
3429309c398aSmrg#
3430309c398aSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
3431309c398aSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
3432309c398aSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
3433309c398aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
3434309c398aSmrgm4_define([_defopt], m4_default([$1], [auto]))
3435309c398aSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
3436309c398aSmrg	[Enable building unit test cases (default: ]_defopt[)]),
3437309c398aSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
3438309c398aSmrgm4_undefine([_defopt])
3439309c398aSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
3440309c398aSmrgAC_MSG_CHECKING([whether to build unit test cases])
3441309c398aSmrgAC_MSG_RESULT([$enable_unit_tests])
3442309c398aSmrg]) # XORG_ENABLE_UNIT_TESTS
3443309c398aSmrg
34445dd5f640Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
34455dd5f640Smrg# ------------------------------------------------------
34465dd5f640Smrg# Minimum version: 1.17.0
34475dd5f640Smrg#
34485dd5f640Smrg# This macro enables a builder to enable/disable integration testing
34495dd5f640Smrg# It makes no assumption about the test cases' implementation
34505dd5f640Smrg# Test cases may or may not use Automake "Support for test suites"
34515dd5f640Smrg#
34525dd5f640Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
34535dd5f640Smrg# usually requires less dependencies and may be built and run under less
34545dd5f640Smrg# stringent environments than integration tests.
34555dd5f640Smrg#
34565dd5f640Smrg# Interface to module:
34575dd5f640Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
34585dd5f640Smrg# enable_integration_tests:   used in configure.ac for additional configuration
34595dd5f640Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
34605dd5f640Smrg#                             'no' user instructs the module not to build tests
34615dd5f640Smrg# parm1:                      specify the default value, yes or no.
34625dd5f640Smrg#
34635dd5f640SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
34645dd5f640SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
34655dd5f640Smrgm4_define([_defopt], m4_default([$1], [auto]))
34665dd5f640SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
34675dd5f640Smrg	[Enable building integration test cases (default: ]_defopt[)]),
34685dd5f640Smrg	[enable_integration_tests=$enableval],
34695dd5f640Smrg	[enable_integration_tests=]_defopt)
34705dd5f640Smrgm4_undefine([_defopt])
34715dd5f640SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
34725dd5f640Smrg	[test "x$enable_integration_tests" != xno])
34735dd5f640SmrgAC_MSG_CHECKING([whether to build unit test cases])
34745dd5f640SmrgAC_MSG_RESULT([$enable_integration_tests])
34755dd5f640Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
34765dd5f640Smrg
3477309c398aSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
3478309c398aSmrg# ----------------------------------------
3479309c398aSmrg# Minimum version: 1.13.0
3480309c398aSmrg#
3481309c398aSmrg# GLib is a library which provides advanced data structures and functions.
3482309c398aSmrg# This macro enables a module to test for the presence of Glib.
3483309c398aSmrg#
3484309c398aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
3485309c398aSmrg# Otherwise the value of $enable_unit_tests is blank.
3486309c398aSmrg#
34875dd5f640Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
34885dd5f640Smrg# test support usually requires less dependencies and may be built and run under
34895dd5f640Smrg# less stringent environments than integration tests.
34905dd5f640Smrg#
3491309c398aSmrg# Interface to module:
3492309c398aSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
3493309c398aSmrg# with_glib: used in configure.ac to know if GLib has been found
3494309c398aSmrg# --with-glib:	'yes' user instructs the module to use glib
3495309c398aSmrg#		'no' user instructs the module not to use glib
3496309c398aSmrg#
3497309c398aSmrgAC_DEFUN([XORG_WITH_GLIB],[
3498309c398aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3499309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
3500309c398aSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
3501309c398aSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
3502309c398aSmrg	[with_glib=$withval], [with_glib=]_defopt)
3503309c398aSmrgm4_undefine([_defopt])
3504309c398aSmrg
3505309c398aSmrghave_glib=no
3506309c398aSmrg# Do not probe GLib if user explicitly disabled unit testing
3507309c398aSmrgif test "x$enable_unit_tests" != x"no"; then
3508309c398aSmrg  # Do not probe GLib if user explicitly disabled it
3509309c398aSmrg  if test "x$with_glib" != x"no"; then
3510309c398aSmrg    m4_ifval(
3511309c398aSmrg      [$1],
3512309c398aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
3513309c398aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
3514309c398aSmrg    )
3515309c398aSmrg  fi
3516309c398aSmrgfi
3517309c398aSmrg
3518309c398aSmrg# Not having GLib when unit testing has been explicitly requested is an error
3519309c398aSmrgif test "x$enable_unit_tests" = x"yes"; then
3520309c398aSmrg  if test "x$have_glib" = x"no"; then
3521309c398aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
3522309c398aSmrg  fi
3523309c398aSmrgfi
3524309c398aSmrg
3525309c398aSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
3526309c398aSmrgif test "x$enable_unit_tests" = x"no"; then
3527309c398aSmrg  if test "x$with_glib" = x"yes"; then
3528309c398aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
3529309c398aSmrg  fi
3530309c398aSmrgfi
3531309c398aSmrg
3532309c398aSmrg# Not having GLib when it has been explicitly requested is an error
3533309c398aSmrgif test "x$with_glib" = x"yes"; then
3534309c398aSmrg  if test "x$have_glib" = x"no"; then
3535309c398aSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
3536309c398aSmrg  fi
3537309c398aSmrgfi
3538309c398aSmrg
3539309c398aSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
3540309c398aSmrg]) # XORG_WITH_GLIB
3541309c398aSmrg
3542309c398aSmrg# XORG_LD_WRAP([required|optional])
3543309c398aSmrg# ---------------------------------
3544309c398aSmrg# Minimum version: 1.13.0
3545309c398aSmrg#
3546309c398aSmrg# Check if linker supports -wrap, passed via compiler flags
3547309c398aSmrg#
3548309c398aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
3549309c398aSmrg# Otherwise the value of $enable_unit_tests is blank.
3550309c398aSmrg#
3551309c398aSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
3552309c398aSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
3553309c398aSmrg# available, an argument of "optional" allows use when some unit tests require
3554309c398aSmrg# ld -wrap and others do not.
3555309c398aSmrg#
3556309c398aSmrgAC_DEFUN([XORG_LD_WRAP],[
3557309c398aSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
3558309c398aSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
3559309c398aSmrg                      void __wrap_exit(int status) { return; }],
3560309c398aSmrg                     [exit(0);])])
3561309c398aSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
3562309c398aSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
3563309c398aSmrg  if test "x$have_ld_wrap" = x"no"; then
3564309c398aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
3565309c398aSmrg  fi
3566309c398aSmrgfi
3567309c398aSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
3568309c398aSmrg#
3569309c398aSmrg]) # XORG_LD_WRAP
3570309c398aSmrg
3571309c398aSmrg# XORG_CHECK_LINKER_FLAGS
3572309c398aSmrg# -----------------------
3573309c398aSmrg# SYNOPSIS
3574309c398aSmrg#
3575309c398aSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
3576309c398aSmrg#
3577309c398aSmrg# DESCRIPTION
3578309c398aSmrg#
3579309c398aSmrg#   Check whether the given linker FLAGS work with the current language's
3580309c398aSmrg#   linker, or whether they give an error.
3581309c398aSmrg#
3582309c398aSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
3583309c398aSmrg#   success/failure.
3584309c398aSmrg#
3585309c398aSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
3586309c398aSmrg#
3587309c398aSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
3588309c398aSmrg#
3589309c398aSmrg# LICENSE
3590309c398aSmrg#
3591309c398aSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
3592309c398aSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
3593309c398aSmrg#   Copyright (c) 2009 Matteo Frigo
3594309c398aSmrg#
3595309c398aSmrg#   This program is free software: you can redistribute it and/or modify it
3596309c398aSmrg#   under the terms of the GNU General Public License as published by the
3597309c398aSmrg#   Free Software Foundation, either version 3 of the License, or (at your
3598309c398aSmrg#   option) any later version.
3599309c398aSmrg#
3600309c398aSmrg#   This program is distributed in the hope that it will be useful, but
3601309c398aSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
3602309c398aSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
3603309c398aSmrg#   Public License for more details.
3604309c398aSmrg#
3605309c398aSmrg#   You should have received a copy of the GNU General Public License along
3606309c398aSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
3607309c398aSmrg#
3608309c398aSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
3609309c398aSmrg#   gives unlimited permission to copy, distribute and modify the configure
3610309c398aSmrg#   scripts that are the output of Autoconf when processing the Macro. You
3611309c398aSmrg#   need not follow the terms of the GNU General Public License when using
3612309c398aSmrg#   or distributing such scripts, even though portions of the text of the
3613309c398aSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
3614309c398aSmrg#   all other use of the material that constitutes the Autoconf Macro.
3615309c398aSmrg#
3616309c398aSmrg#   This special exception to the GPL applies to versions of the Autoconf
3617309c398aSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
3618309c398aSmrg#   modified version of the Autoconf Macro, you may extend this special
3619309c398aSmrg#   exception to the GPL to apply to your modified version as well.#
3620309c398aSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
3621309c398aSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
3622309c398aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
3623309c398aSmrgAS_LITERAL_IF([$1],
3624309c398aSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
3625309c398aSmrg      ax_save_FLAGS=$LDFLAGS
3626309c398aSmrg      LDFLAGS="$1"
3627309c398aSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
3628309c398aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3629309c398aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3630309c398aSmrg      LDFLAGS=$ax_save_FLAGS])],
3631309c398aSmrg  [ax_save_FLAGS=$LDFLAGS
3632309c398aSmrg   LDFLAGS="$1"
3633309c398aSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3634309c398aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3635309c398aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3636309c398aSmrg   LDFLAGS=$ax_save_FLAGS])
3637309c398aSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
3638309c398aSmrgAC_MSG_RESULT($xorg_check_linker_flags)
3639309c398aSmrgif test "x$xorg_check_linker_flags" = xyes; then
3640309c398aSmrg	m4_default([$2], :)
3641309c398aSmrgelse
3642309c398aSmrg	m4_default([$3], :)
3643309c398aSmrgfi
3644309c398aSmrg]) # XORG_CHECK_LINKER_FLAGS
3645309c398aSmrg
3646309c398aSmrg# XORG_MEMORY_CHECK_FLAGS
3647309c398aSmrg# -----------------------
3648309c398aSmrg# Minimum version: 1.16.0
3649309c398aSmrg#
3650309c398aSmrg# This macro attempts to find appropriate memory checking functionality
3651309c398aSmrg# for various platforms which unit testing code may use to catch various
3652309c398aSmrg# forms of memory allocation and access errors in testing.
3653309c398aSmrg#
3654309c398aSmrg# Interface to module:
3655309c398aSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
3656309c398aSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
3657309c398aSmrg#
3658309c398aSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
3659309c398aSmrg#
3660309c398aSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
3661309c398aSmrg
3662309c398aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
3663309c398aSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
3664309c398aSmrg           [Environment variables to enable memory checking in tests])
3665309c398aSmrg
3666309c398aSmrg# Check for different types of support on different platforms
3667309c398aSmrgcase $host_os in
3668309c398aSmrg    solaris*)
3669309c398aSmrg        AC_CHECK_LIB([umem], [umem_alloc],
3670309c398aSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
3671309c398aSmrg        ;;
3672309c398aSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
3673309c398aSmrg        # both directly and inverted, so should not be 0 or 255.
3674309c398aSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
3675309c398aSmrg        ;;
3676309c398aSmrg    darwin*)
3677309c398aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
3678309c398aSmrg        ;;
3679309c398aSmrg    *bsd*)
3680309c398aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
3681309c398aSmrg        ;;
3682309c398aSmrgesac
3683309c398aSmrg
3684309c398aSmrg# User supplied flags override default flags
3685309c398aSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
3686309c398aSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
3687309c398aSmrgfi
3688309c398aSmrg
3689309c398aSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
3690309c398aSmrg]) # XORG_WITH_LINT
3691309c398aSmrg
3692e9554658Smrg# XORG_CHECK_MALLOC_ZERO
3693e9554658Smrg# ----------------------
3694e9554658Smrg# Minimum version: 1.0.0
3695e9554658Smrg#
3696e9554658Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
3697e9554658Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
3698e9554658Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
3699e9554658SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
3700e9554658SmrgAC_ARG_ENABLE(malloc0returnsnull,
3701c2b339b4Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
3702e9554658Smrg		       [malloc(0) returns NULL (default: auto)]),
3703e9554658Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
3704e9554658Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
3705e9554658Smrg
3706e9554658SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
3707e9554658Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
3708309c398aSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
3709309c398aSmrg#include <stdlib.h>
3710309c398aSmrg],[
3711e9554658Smrg    char *m0, *r0, *c0, *p;
3712e9554658Smrg    m0 = malloc(0);
3713e9554658Smrg    p = malloc(10);
3714e9554658Smrg    r0 = realloc(p,0);
3715309c398aSmrg    c0 = calloc(0,10);
3716309c398aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
3717309c398aSmrg])],
3718e9554658Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
37198903d43aSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
37208903d43aSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
3721e9554658Smrgfi
3722e9554658SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
3723e9554658Smrg
3724e9554658Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
3725e9554658Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
3726e9554658Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
3727e9554658Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
3728e9554658Smrgelse
3729e9554658Smrg	MALLOC_ZERO_CFLAGS=""
3730e9554658Smrg	XMALLOC_ZERO_CFLAGS=""
3731e9554658Smrg	XTMALLOC_ZERO_CFLAGS=""
3732e9554658Smrgfi
3733e9554658Smrg
3734e9554658SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
3735e9554658SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
3736e9554658SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
3737e9554658Smrg]) # XORG_CHECK_MALLOC_ZERO
3738e9554658Smrg
3739e9554658Smrg# XORG_WITH_LINT()
3740e9554658Smrg# ----------------
3741e9554658Smrg# Minimum version: 1.1.0
3742e9554658Smrg#
37438903d43aSmrg# This macro enables the use of a tool that flags some suspicious and
37448903d43aSmrg# non-portable constructs (likely to be bugs) in C language source code.
37458903d43aSmrg# It will attempt to locate the tool and use appropriate options.
37468903d43aSmrg# There are various lint type tools on different platforms.
37478903d43aSmrg#
37488903d43aSmrg# Interface to module:
37498903d43aSmrg# LINT:		returns the path to the tool found on the platform
37508903d43aSmrg#		or the value set to LINT on the configure cmd line
37518903d43aSmrg#		also an Automake conditional
37528903d43aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
37538903d43aSmrg#
37548903d43aSmrg# --with-lint:	'yes' user instructs the module to use lint
37558903d43aSmrg#		'no' user instructs the module not to use lint (default)
37568903d43aSmrg#
37578903d43aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
37588903d43aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3759e9554658Smrg#
3760e9554658SmrgAC_DEFUN([XORG_WITH_LINT],[
3761e9554658Smrg
37628903d43aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
37638903d43aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3764c2b339b4SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3765e9554658Smrg		[Use a lint-style source code checker (default: disabled)])],
3766e9554658Smrg		[use_lint=$withval], [use_lint=no])
37678903d43aSmrg
37688903d43aSmrg# Obtain platform specific info like program name and options
37698903d43aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
37708903d43aSmrgcase $host_os in
37718903d43aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
37728903d43aSmrg	lint_name=splint
37738903d43aSmrg	lint_options="-badflag"
37748903d43aSmrg	;;
37758903d43aSmrg  *freebsd* | *netbsd*)
37768903d43aSmrg	lint_name=lint
37778903d43aSmrg	lint_options="-u -b"
37788903d43aSmrg	;;
37798903d43aSmrg  *solaris*)
37808903d43aSmrg	lint_name=lint
37818903d43aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
37828903d43aSmrg	;;
37838903d43aSmrgesac
37848903d43aSmrg
37858903d43aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
37868903d43aSmrgif test "x$use_lint" = x"yes" ; then
37878903d43aSmrg   AC_PATH_PROG([LINT], [$lint_name])
37888903d43aSmrg   if test "x$LINT" = "x"; then
37898903d43aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
37908903d43aSmrg   fi
37918903d43aSmrgelif test "x$use_lint" = x"no" ; then
37928903d43aSmrg   if test "x$LINT" != "x"; then
37938903d43aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
37948903d43aSmrg   fi
3795e9554658Smrgelse
37968903d43aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3797e9554658Smrgfi
37988903d43aSmrg
37998903d43aSmrg# User supplied flags override default flags
38008903d43aSmrgif test "x$LINT_FLAGS" != "x"; then
38018903d43aSmrg   lint_options=$LINT_FLAGS
3802e9554658Smrgfi
3803e9554658Smrg
38048903d43aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
38058903d43aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3806e9554658Smrg
3807e9554658Smrg]) # XORG_WITH_LINT
3808e9554658Smrg
3809e9554658Smrg# XORG_LINT_LIBRARY(LIBNAME)
3810e9554658Smrg# --------------------------
3811e9554658Smrg# Minimum version: 1.1.0
3812e9554658Smrg#
3813e9554658Smrg# Sets up flags for building lint libraries for checking programs that call
3814e9554658Smrg# functions in the library.
3815e9554658Smrg#
38168903d43aSmrg# Interface to module:
38178903d43aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
38188903d43aSmrg# MAKE_LINT_LIB		- Automake conditional
38198903d43aSmrg#
38208903d43aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
38218903d43aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
3822e9554658Smrg
3823e9554658SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3824e9554658SmrgAC_REQUIRE([XORG_WITH_LINT])
3825c2b339b4SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3826e9554658Smrg	[Create lint library (default: disabled)])],
3827e9554658Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
38288903d43aSmrg
38298903d43aSmrgif test "x$make_lint_lib" = x"yes" ; then
38308903d43aSmrg   LINTLIB=llib-l$1.ln
38318903d43aSmrg   if test "x$LINT" = "x"; then
38328903d43aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
38338903d43aSmrg   fi
38348903d43aSmrgelif test "x$make_lint_lib" != x"no" ; then
38358903d43aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3836e9554658Smrgfi
38378903d43aSmrg
3838e9554658SmrgAC_SUBST(LINTLIB)
3839e9554658SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3840e9554658Smrg
3841e9554658Smrg]) # XORG_LINT_LIBRARY
3842e9554658Smrg
3843309c398aSmrg# XORG_COMPILER_BRAND
3844309c398aSmrg# -------------------
3845309c398aSmrg# Minimum version: 1.14.0
3846309c398aSmrg#
3847309c398aSmrg# Checks for various brands of compilers and sets flags as appropriate:
3848309c398aSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
38495dd5f640Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3850309c398aSmrg#   clang compiler - sets CLANGCC to "yes"
3851309c398aSmrg#   Intel compiler - sets INTELCC to "yes"
3852309c398aSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3853309c398aSmrg#
3854309c398aSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
38555dd5f640SmrgAC_LANG_CASE(
38565dd5f640Smrg	[C], [
38575dd5f640Smrg		AC_REQUIRE([AC_PROG_CC_C99])
38585dd5f640Smrg	],
38595dd5f640Smrg	[C++], [
38605dd5f640Smrg		AC_REQUIRE([AC_PROG_CXX])
38615dd5f640Smrg	]
38625dd5f640Smrg)
3863309c398aSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3864309c398aSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3865309c398aSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3866309c398aSmrg]) # XORG_COMPILER_BRAND
3867309c398aSmrg
3868309c398aSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3869309c398aSmrg# ---------------
3870309c398aSmrg# Minimum version: 1.16.0
3871309c398aSmrg#
3872309c398aSmrg# Test if the compiler works when passed the given flag as a command line argument.
3873309c398aSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
3874309c398aSmrg# next flag in the list until there are no more options.
3875309c398aSmrg#
3876309c398aSmrg# Note that this does not guarantee that the compiler supports the flag as some
3877309c398aSmrg# compilers will simply ignore arguments that they do not understand, but we do
3878309c398aSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3879309c398aSmrg# -Werror=unused-command-line-argument
3880309c398aSmrg#
3881309c398aSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3882309c398aSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3883309c398aSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3884309c398aSmrg
38855dd5f640SmrgAC_LANG_COMPILER_REQUIRE
38865dd5f640Smrg
38875dd5f640SmrgAC_LANG_CASE(
38885dd5f640Smrg	[C], [
38895dd5f640Smrg		AC_REQUIRE([AC_PROG_CC_C99])
38905dd5f640Smrg		define([PREFIX], [C])
38915dd5f640Smrg		define([CACHE_PREFIX], [cc])
38925dd5f640Smrg		define([COMPILER], [$CC])
38935dd5f640Smrg	],
38945dd5f640Smrg	[C++], [
38955dd5f640Smrg		define([PREFIX], [CXX])
38965dd5f640Smrg		define([CACHE_PREFIX], [cxx])
38975dd5f640Smrg		define([COMPILER], [$CXX])
38985dd5f640Smrg	]
38995dd5f640Smrg)
39005dd5f640Smrg
39015dd5f640Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3902309c398aSmrg
39035dd5f640Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
39045dd5f640Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
39055dd5f640Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
39065dd5f640Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3907309c398aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
39085dd5f640Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
39095dd5f640Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
39105dd5f640Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
39115dd5f640Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3912309c398aSmrgfi
3913309c398aSmrg
39145dd5f640Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
39155dd5f640Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
39165dd5f640Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3917309c398aSmrg	fi
39185dd5f640Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
39195dd5f640Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
39205dd5f640Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3921309c398aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
39225dd5f640Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
39235dd5f640Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
39245dd5f640Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
39255dd5f640Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3926309c398aSmrgfi
3927309c398aSmrg
3928309c398aSmrgfound="no"
3929309c398aSmrgm4_foreach([flag], m4_cdr($@), [
3930309c398aSmrg	if test $found = "no" ; then
39315dd5f640Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
39325dd5f640Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3933309c398aSmrg		fi
3934309c398aSmrg
39355dd5f640Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
39365dd5f640Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3937309c398aSmrg		fi
3938309c398aSmrg
39395dd5f640Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3940309c398aSmrg
3941309c398aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
39425dd5f640Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
39435dd5f640Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
39445dd5f640Smrg		AC_CACHE_VAL($cacheid,
3945309c398aSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
39465dd5f640Smrg					     [eval $cacheid=yes],
39475dd5f640Smrg					     [eval $cacheid=no])])
3948309c398aSmrg
39495dd5f640Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3950309c398aSmrg
39515dd5f640Smrg		eval supported=\$$cacheid
3952309c398aSmrg		AC_MSG_RESULT([$supported])
3953309c398aSmrg		if test "$supported" = "yes" ; then
3954309c398aSmrg			$1="$$1 ]flag["
3955309c398aSmrg			found="yes"
3956309c398aSmrg		fi
3957309c398aSmrg	fi
3958309c398aSmrg])
3959309c398aSmrg]) # XORG_TESTSET_CFLAG
3960309c398aSmrg
3961309c398aSmrg# XORG_COMPILER_FLAGS
3962309c398aSmrg# ---------------
3963309c398aSmrg# Minimum version: 1.16.0
3964309c398aSmrg#
39655dd5f640Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
39665dd5f640Smrg# arguments supported by the selected compiler which do NOT alter the generated
39675dd5f640Smrg# code.  These arguments will cause the compiler to print various warnings
39685dd5f640Smrg# during compilation AND turn a conservative set of warnings into errors.
3969309c398aSmrg#
39705dd5f640Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
39715dd5f640Smrg# future versions of util-macros as options are added to new compilers.
3972309c398aSmrg#
3973309c398aSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3974309c398aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3975309c398aSmrg
3976309c398aSmrgAC_ARG_ENABLE(selective-werror,
3977309c398aSmrg              AS_HELP_STRING([--disable-selective-werror],
3978309c398aSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3979309c398aSmrg              [SELECTIVE_WERROR=$enableval],
3980309c398aSmrg              [SELECTIVE_WERROR=yes])
3981309c398aSmrg
39825dd5f640SmrgAC_LANG_CASE(
39835dd5f640Smrg        [C], [
39845dd5f640Smrg                define([PREFIX], [C])
39855dd5f640Smrg        ],
39865dd5f640Smrg        [C++], [
39875dd5f640Smrg                define([PREFIX], [CXX])
39885dd5f640Smrg        ]
39895dd5f640Smrg)
3990309c398aSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3991309c398aSmrgif test "x$SUNCC" = "xyes"; then
39925dd5f640Smrg    [BASE_]PREFIX[FLAGS]="-v"
3993309c398aSmrgelse
39945dd5f640Smrg    [BASE_]PREFIX[FLAGS]=""
3995309c398aSmrgfi
3996309c398aSmrg
3997309c398aSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
39985dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
39995dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
40005dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
40015dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
40025dd5f640Smrg
40035dd5f640SmrgAC_LANG_CASE(
40045dd5f640Smrg	[C], [
40055dd5f640Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
40065dd5f640Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
40075dd5f640Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
40085dd5f640Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
40095dd5f640Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
40105dd5f640Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
40115dd5f640Smrg	]
40125dd5f640Smrg)
4013309c398aSmrg
4014309c398aSmrg# This chunk adds additional warnings that could catch undesired effects.
40155dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
40165dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
40175dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
40185dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
40195dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
40205dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
40215dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
4022309c398aSmrg
4023309c398aSmrg# These are currently disabled because they are noisy.  They will be enabled
4024309c398aSmrg# in the future once the codebase is sufficiently modernized to silence
4025309c398aSmrg# them.  For now, I don't want them to drown out the other warnings.
40265dd5f640Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
40275dd5f640Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
40285dd5f640Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
4029309c398aSmrg
4030309c398aSmrg# Turn some warnings into errors, so we don't accidently get successful builds
4031309c398aSmrg# when there are problems that should be fixed.
4032309c398aSmrg
4033309c398aSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
40345dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
40355dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
40365dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
40375dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
40385dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
40395dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
40405dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
40415dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
40425dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
40435dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
40445dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
40455dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
40465dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
4047309c398aSmrgelse
4048309c398aSmrgAC_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])
40495dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
40505dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
40515dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
40525dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
40535dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
40545dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
40555dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
40565dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
40575dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
40585dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
40595dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
40605dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
40615dd5f640SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
40625dd5f640Smrgfi
40635dd5f640Smrg
40645dd5f640SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
4065309c398aSmrg]) # XORG_COMPILER_FLAGS
4066309c398aSmrg
4067c2b339b4Smrg# XORG_CWARNFLAGS
4068c2b339b4Smrg# ---------------
4069c2b339b4Smrg# Minimum version: 1.2.0
4070309c398aSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
4071c2b339b4Smrg#
4072c2b339b4Smrg# Defines CWARNFLAGS to enable C compiler warnings.
4073c2b339b4Smrg#
4074309c398aSmrg# This function is deprecated because it defines -fno-strict-aliasing
4075309c398aSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
4076309c398aSmrg# is needed, then it should be added explicitly in the module when
4077309c398aSmrg# it is updated to use BASE_CFLAGS.
4078309c398aSmrg#
4079c2b339b4SmrgAC_DEFUN([XORG_CWARNFLAGS], [
4080309c398aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
4081309c398aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
40825dd5f640SmrgAC_LANG_CASE(
40835dd5f640Smrg	[C], [
40845dd5f640Smrg		CWARNFLAGS="$BASE_CFLAGS"
40855dd5f640Smrg		if  test "x$GCC" = xyes ; then
40865dd5f640Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
40875dd5f640Smrg		fi
40885dd5f640Smrg		AC_SUBST(CWARNFLAGS)
40895dd5f640Smrg	]
40905dd5f640Smrg)
4091c2b339b4Smrg]) # XORG_CWARNFLAGS
4092c2b339b4Smrg
4093c2b339b4Smrg# XORG_STRICT_OPTION
4094c2b339b4Smrg# -----------------------
4095c2b339b4Smrg# Minimum version: 1.3.0
4096c2b339b4Smrg#
4097309c398aSmrg# Add configure option to enable strict compilation flags, such as treating
4098309c398aSmrg# warnings as fatal errors.
4099309c398aSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
41005dd5f640Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
4101309c398aSmrg#
4102309c398aSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
4103309c398aSmrg# when strict compilation is unconditionally desired.
4104c2b339b4SmrgAC_DEFUN([XORG_STRICT_OPTION], [
4105c2b339b4SmrgAC_REQUIRE([XORG_CWARNFLAGS])
4106309c398aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
4107c2b339b4Smrg
4108c2b339b4SmrgAC_ARG_ENABLE(strict-compilation,
4109c2b339b4Smrg			  AS_HELP_STRING([--enable-strict-compilation],
4110c2b339b4Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
4111c2b339b4Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
4112309c398aSmrg
41135dd5f640SmrgAC_LANG_CASE(
41145dd5f640Smrg        [C], [
41155dd5f640Smrg                define([PREFIX], [C])
41165dd5f640Smrg        ],
41175dd5f640Smrg        [C++], [
41185dd5f640Smrg                define([PREFIX], [CXX])
41195dd5f640Smrg        ]
41205dd5f640Smrg)
41215dd5f640Smrg
41225dd5f640Smrg[STRICT_]PREFIX[FLAGS]=""
41235dd5f640SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
41245dd5f640SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
4125309c398aSmrg
4126309c398aSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
4127309c398aSmrg# activate it with -Werror, so we add it here explicitly.
41285dd5f640SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
4129309c398aSmrg
4130c2b339b4Smrgif test "x$STRICT_COMPILE" = "xyes"; then
41315dd5f640Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
41325dd5f640Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
4133c2b339b4Smrgfi
41345dd5f640SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
41355dd5f640SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
41365dd5f640SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
4137c2b339b4Smrg]) # XORG_STRICT_OPTION
4138c2b339b4Smrg
4139c2b339b4Smrg# XORG_DEFAULT_OPTIONS
4140c2b339b4Smrg# --------------------
4141c2b339b4Smrg# Minimum version: 1.3.0
4142c2b339b4Smrg#
4143c2b339b4Smrg# Defines default options for X.Org modules.
4144c2b339b4Smrg#
4145c2b339b4SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
41468903d43aSmrgAC_REQUIRE([AC_PROG_INSTALL])
4147309c398aSmrgXORG_COMPILER_FLAGS
4148c2b339b4SmrgXORG_CWARNFLAGS
4149c2b339b4SmrgXORG_STRICT_OPTION
4150c2b339b4SmrgXORG_RELEASE_VERSION
4151c2b339b4SmrgXORG_CHANGELOG
41528903d43aSmrgXORG_INSTALL
4153c2b339b4SmrgXORG_MANPAGE_SECTIONS
41548903d43aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
41558903d43aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
4156c2b339b4Smrg]) # XORG_DEFAULT_OPTIONS
41578903d43aSmrg
41588903d43aSmrg# XORG_INSTALL()
41598903d43aSmrg# ----------------
41608903d43aSmrg# Minimum version: 1.4.0
41618903d43aSmrg#
41628903d43aSmrg# Defines the variable INSTALL_CMD as the command to copy
41638903d43aSmrg# INSTALL from $prefix/share/util-macros.
41648903d43aSmrg#
41658903d43aSmrgAC_DEFUN([XORG_INSTALL], [
41668903d43aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
41678903d43aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
41688903d43aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
41698903d43aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
41708903d43aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
41718903d43aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
41728903d43aSmrgAC_SUBST([INSTALL_CMD])
41738903d43aSmrg]) # XORG_INSTALL
4174e9554658Smrgdnl Copyright 2005 Red Hat, Inc
4175e9554658Smrgdnl
4176e9554658Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
4177e9554658Smrgdnl documentation for any purpose is hereby granted without fee, provided that
4178e9554658Smrgdnl the above copyright notice appear in all copies and that both that
4179e9554658Smrgdnl copyright notice and this permission notice appear in supporting
4180e9554658Smrgdnl documentation.
4181e9554658Smrgdnl
4182e9554658Smrgdnl The above copyright notice and this permission notice shall be included
4183e9554658Smrgdnl in all copies or substantial portions of the Software.
4184e9554658Smrgdnl
4185e9554658Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4186e9554658Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4187e9554658Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
4188e9554658Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
4189e9554658Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
4190e9554658Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4191e9554658Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
4192e9554658Smrgdnl
4193e9554658Smrgdnl Except as contained in this notice, the name of the copyright holders shall
4194e9554658Smrgdnl not be used in advertising or otherwise to promote the sale, use or
4195e9554658Smrgdnl other dealings in this Software without prior written authorization
4196e9554658Smrgdnl from the copyright holders.
4197e9554658Smrgdnl
4198e9554658Smrg
4199e9554658Smrg# XORG_RELEASE_VERSION
4200e9554658Smrg# --------------------
42018903d43aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
42025dd5f640Smrg
4203e9554658SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
4204e9554658Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
4205e9554658Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
4206e9554658Smrg		[Major version of this package])
4207c2b339b4Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
4208e9554658Smrg	if test "x$PVM" = "x"; then
4209e9554658Smrg		PVM="0"
4210e9554658Smrg	fi
4211e9554658Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
4212e9554658Smrg		[$PVM],
4213e9554658Smrg		[Minor version of this package])
4214c2b339b4Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
4215e9554658Smrg	if test "x$PVP" = "x"; then
4216e9554658Smrg		PVP="0"
4217e9554658Smrg	fi
4218e9554658Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
4219e9554658Smrg		[$PVP],
4220e9554658Smrg		[Patch version of this package])
4221e9554658Smrg])
4222e9554658Smrg
4223c2b339b4Smrg# XORG_CHANGELOG()
4224c2b339b4Smrg# ----------------
4225c2b339b4Smrg# Minimum version: 1.2.0
4226c2b339b4Smrg#
4227c2b339b4Smrg# Defines the variable CHANGELOG_CMD as the command to generate
4228c2b339b4Smrg# ChangeLog from git.
4229c2b339b4Smrg#
4230c2b339b4Smrg#
4231c2b339b4SmrgAC_DEFUN([XORG_CHANGELOG], [
42328903d43aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
42338903d43aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
42348903d43aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
4235c2b339b4Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
4236c2b339b4SmrgAC_SUBST([CHANGELOG_CMD])
4237c2b339b4Smrg]) # XORG_CHANGELOG
4238c2b339b4Smrg
4239