~ubuntu-branches/ubuntu/trusty/x11proto-core/trusty-proposed

« back to all changes in this revision

Viewing changes to aclocal.m4

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2011-04-05 23:28:42 UTC
  • mfrom: (1.4.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20110405232842-b2ckujwo0os0qf2x
Import upstream version 7.0.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
m4_ifndef([AC_AUTOCONF_VERSION],
15
15
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16
 
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17
 
[m4_warning([this file was generated for autoconf 2.68.
 
16
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.66],,
 
17
[m4_warning([this file was generated for autoconf 2.66.
18
18
You have another version of autoconf.  It may work, but is not guaranteed to.
19
19
If you have problems, you may need to regenerate the build system entirely.
20
20
To do so, use the procedure documented by the package, typically `autoreconf'.])])
21
21
 
 
22
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 
23
# serial 1 (pkg-config-0.24)
 
24
 
25
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 
26
#
 
27
# This program is free software; you can redistribute it and/or modify
 
28
# it under the terms of the GNU General Public License as published by
 
29
# the Free Software Foundation; either version 2 of the License, or
 
30
# (at your option) any later version.
 
31
#
 
32
# This program is distributed in the hope that it will be useful, but
 
33
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
34
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
35
# General Public License for more details.
 
36
#
 
37
# You should have received a copy of the GNU General Public License
 
38
# along with this program; if not, write to the Free Software
 
39
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
40
#
 
41
# As a special exception to the GNU General Public License, if you
 
42
# distribute this file as part of a program that contains a
 
43
# configuration script generated by Autoconf, you may include it under
 
44
# the same distribution terms that you use for the rest of that program.
 
45
 
 
46
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
 
47
# ----------------------------------
 
48
AC_DEFUN([PKG_PROG_PKG_CONFIG],
 
49
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
 
50
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
 
51
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
 
52
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
 
53
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
 
54
 
 
55
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 
56
        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
 
57
fi
 
58
if test -n "$PKG_CONFIG"; then
 
59
        _pkg_min_version=m4_default([$1], [0.9.0])
 
60
        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
 
61
        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
 
62
                AC_MSG_RESULT([yes])
 
63
        else
 
64
                AC_MSG_RESULT([no])
 
65
                PKG_CONFIG=""
 
66
        fi
 
67
fi[]dnl
 
68
])# PKG_PROG_PKG_CONFIG
 
69
 
 
70
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
71
#
 
72
# Check to see whether a particular set of modules exists.  Similar
 
73
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
 
74
#
 
75
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 
76
# only at the first occurence in configure.ac, so if the first place
 
77
# it's called might be skipped (such as if it is within an "if", you
 
78
# have to call PKG_CHECK_EXISTS manually
 
79
# --------------------------------------------------------------
 
80
AC_DEFUN([PKG_CHECK_EXISTS],
 
81
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 
82
if test -n "$PKG_CONFIG" && \
 
83
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
 
84
  m4_default([$2], [:])
 
85
m4_ifvaln([$3], [else
 
86
  $3])dnl
 
87
fi])
 
88
 
 
89
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
 
90
# ---------------------------------------------
 
91
m4_define([_PKG_CONFIG],
 
92
[if test -n "$$1"; then
 
93
    pkg_cv_[]$1="$$1"
 
94
 elif test -n "$PKG_CONFIG"; then
 
95
    PKG_CHECK_EXISTS([$3],
 
96
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
 
97
                     [pkg_failed=yes])
 
98
 else
 
99
    pkg_failed=untried
 
100
fi[]dnl
 
101
])# _PKG_CONFIG
 
102
 
 
103
# _PKG_SHORT_ERRORS_SUPPORTED
 
104
# -----------------------------
 
105
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
 
106
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 
107
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 
108
        _pkg_short_errors_supported=yes
 
109
else
 
110
        _pkg_short_errors_supported=no
 
111
fi[]dnl
 
112
])# _PKG_SHORT_ERRORS_SUPPORTED
 
113
 
 
114
 
 
115
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
 
116
# [ACTION-IF-NOT-FOUND])
 
117
#
 
118
#
 
119
# Note that if there is a possibility the first call to
 
120
# PKG_CHECK_MODULES might not happen, you should be sure to include an
 
121
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
 
122
#
 
123
#
 
124
# --------------------------------------------------------------
 
125
AC_DEFUN([PKG_CHECK_MODULES],
 
126
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 
127
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
 
128
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
129
 
 
130
pkg_failed=no
 
131
AC_MSG_CHECKING([for $1])
 
132
 
 
133
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 
134
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
135
 
 
136
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
 
137
and $1[]_LIBS to avoid the need to call pkg-config.
 
138
See the pkg-config man page for more details.])
 
139
 
 
140
if test $pkg_failed = yes; then
 
141
        AC_MSG_RESULT([no])
 
142
        _PKG_SHORT_ERRORS_SUPPORTED
 
143
        if test $_pkg_short_errors_supported = yes; then
 
144
                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
 
145
        else 
 
146
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
 
147
        fi
 
148
        # Put the nasty error message in config.log where it belongs
 
149
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 
150
 
 
151
        m4_default([$4], [AC_MSG_ERROR(
 
152
[Package requirements ($2) were not met:
 
153
 
 
154
$$1_PKG_ERRORS
 
155
 
 
156
Consider adjusting the PKG_CONFIG_PATH environment variable if you
 
157
installed software in a non-standard prefix.
 
158
 
 
159
_PKG_TEXT])
 
160
        ])
 
161
elif test $pkg_failed = untried; then
 
162
        AC_MSG_RESULT([no])
 
163
        m4_default([$4], [AC_MSG_FAILURE(
 
164
[The pkg-config script could not be found or is too old.  Make sure it
 
165
is in your PATH or set the PKG_CONFIG environment variable to the full
 
166
path to pkg-config.
 
167
 
 
168
_PKG_TEXT
 
169
 
 
170
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
 
171
        ])
 
172
else
 
173
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
 
174
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
 
175
        AC_MSG_RESULT([yes])
 
176
        $3
 
177
fi[]dnl
 
178
])# PKG_CHECK_MODULES
 
179
 
22
180
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23
181
#
24
182
# This file is free software; the Free Software Foundation
1055
1213
# See the "minimum version" comment for each macro you use to see what 
1056
1214
# version you require.
1057
1215
m4_defun([XORG_MACROS_VERSION],[
1058
 
m4_define([vers_have], [1.11.0])
 
1216
m4_define([vers_have], [1.13.0])
1059
1217
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1060
1218
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1061
1219
m4_if(m4_cmp(maj_have, maj_needed), 0,,
1205
1363
        -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1206
1364
        -e 's|__xservername__|Xorg|g' \
1207
1365
        -e 's|__xconfigfile__|xorg.conf|g' \
 
1366
        -e 's|__xorgconfdir__|xorg.conf.d|g' \
1208
1367
        -e 's|__projectroot__|\$(prefix)|g' \
1209
1368
        -e 's|__apploaddir__|\$(appdefaultdir)|g' \
1210
1369
        -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1450
1609
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1451
1610
]) # XORG_WITH_XMLTO
1452
1611
 
 
1612
# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
 
1613
# --------------------------------------------
 
1614
# Minimum version: 1.12.0
 
1615
# Minimum version for optional DEFAULT argument: 1.12.0
 
1616
#
 
1617
# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
 
1618
# XML-based language used for the transformation of XML documents.
 
1619
# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
 
1620
# It is used under the cover by xmlto to generate html files from DocBook/XML.
 
1621
# The XSLT processor is often used as a standalone tool for transformations.
 
1622
# It should not be assumed that this tool is used only to work with documnetation.
 
1623
# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
 
1624
#
 
1625
# Interface to module:
 
1626
# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
 
1627
# XSLTPROC:      returns the path of the xsltproc program found
 
1628
#                returns the path set by the user in the environment
 
1629
# --with-xsltproc: 'yes' user instructs the module to use xsltproc
 
1630
#                 'no' user instructs the module not to use xsltproc
 
1631
# have_xsltproc: returns yes if xsltproc found in PATH or no
 
1632
#
 
1633
# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
 
1634
#
 
1635
AC_DEFUN([XORG_WITH_XSLTPROC],[
 
1636
AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
 
1637
m4_define([_defopt], m4_default([$2], [auto]))
 
1638
AC_ARG_WITH(xsltproc,
 
1639
        AS_HELP_STRING([--with-xsltproc],
 
1640
           [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
 
1641
           [use_xsltproc=$withval], [use_xsltproc=]_defopt)
 
1642
m4_undefine([_defopt])
 
1643
 
 
1644
if test "x$use_xsltproc" = x"auto"; then
 
1645
   AC_PATH_PROG([XSLTPROC], [xsltproc])
 
1646
   if test "x$XSLTPROC" = "x"; then
 
1647
        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
 
1648
        have_xsltproc=no
 
1649
   else
 
1650
        have_xsltproc=yes
 
1651
   fi
 
1652
elif test "x$use_xsltproc" = x"yes" ; then
 
1653
   AC_PATH_PROG([XSLTPROC], [xsltproc])
 
1654
   if test "x$XSLTPROC" = "x"; then
 
1655
        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
 
1656
   fi
 
1657
   have_xsltproc=yes
 
1658
elif test "x$use_xsltproc" = x"no" ; then
 
1659
   if test "x$XSLTPROC" != "x"; then
 
1660
      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
 
1661
   fi
 
1662
   have_xsltproc=no
 
1663
else
 
1664
   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
 
1665
fi
 
1666
 
 
1667
# Checking for minimum version is not implemented
 
1668
# but we want to keep the interface consistent with other commands
 
1669
m4_ifval([$1],[AC_MSG_WARN(Checking for MIN-VERSION is not implemented.)])
 
1670
 
 
1671
AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
 
1672
]) # XORG_WITH_XSLTPROC
 
1673
 
 
1674
 
1453
1675
# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1454
1676
# ----------------
1455
1677
# Minimum version: 1.5.0
1906
2128
AC_MSG_RESULT([$build_specs])
1907
2129
]) # XORG_ENABLE_SPECS
1908
2130
 
 
2131
# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
 
2132
# ----------------------------------------------
 
2133
# Minimum version: 1.13.0
 
2134
#
 
2135
# This macro enables a builder to enable/disable unit testing
 
2136
# It makes no assumption about the test cases implementation
 
2137
# Test cases may or may not use Automake "Support for test suites"
 
2138
# They may or may not use the software utility library GLib
 
2139
#
 
2140
# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
 
2141
# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
 
2142
# The variable enable_unit_tests is used by other macros in this file.
 
2143
#
 
2144
# Interface to module:
 
2145
# ENABLE_UNIT_TESTS:    used in makefiles to conditionally build tests
 
2146
# enable_unit_tests:    used in configure.ac for additional configuration
 
2147
# --enable-unit-tests:  'yes' user instructs the module to build tests
 
2148
#                       'no' user instructs the module not to build tests
 
2149
# parm1:                specify the default value, yes or no.
 
2150
#
 
2151
AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
 
2152
AC_BEFORE([$0], [XORG_WITH_GLIB])
 
2153
AC_BEFORE([$0], [XORG_LD_WRAP])
 
2154
m4_define([_defopt], m4_default([$1], [auto]))
 
2155
AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
 
2156
        [Enable building unit test cases (default: ]_defopt[)]),
 
2157
        [enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
 
2158
m4_undefine([_defopt])
 
2159
AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
 
2160
AC_MSG_CHECKING([whether to build unit test cases])
 
2161
AC_MSG_RESULT([$enable_unit_tests])
 
2162
]) # XORG_ENABLE_UNIT_TESTS
 
2163
 
 
2164
# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
 
2165
# ----------------------------------------
 
2166
# Minimum version: 1.13.0
 
2167
#
 
2168
# GLib is a library which provides advanced data structures and functions.
 
2169
# This macro enables a module to test for the presence of Glib.
 
2170
#
 
2171
# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
 
2172
# Otherwise the value of $enable_unit_tests is blank.
 
2173
#
 
2174
# Interface to module:
 
2175
# HAVE_GLIB: used in makefiles to conditionally build targets
 
2176
# with_glib: used in configure.ac to know if GLib has been found
 
2177
# --with-glib:  'yes' user instructs the module to use glib
 
2178
#               'no' user instructs the module not to use glib
 
2179
#
 
2180
AC_DEFUN([XORG_WITH_GLIB],[
 
2181
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 
2182
m4_define([_defopt], m4_default([$2], [auto]))
 
2183
AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
 
2184
        [Use GLib library for unit testing (default: ]_defopt[)]),
 
2185
        [with_glib=$withval], [with_glib=]_defopt)
 
2186
m4_undefine([_defopt])
 
2187
 
 
2188
have_glib=no
 
2189
# Do not probe GLib if user explicitly disabled unit testing
 
2190
if test "x$enable_unit_tests" != x"no"; then
 
2191
  # Do not probe GLib if user explicitly disabled it
 
2192
  if test "x$with_glib" != x"no"; then
 
2193
    m4_ifval(
 
2194
      [$1],
 
2195
      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
 
2196
      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
 
2197
    )
 
2198
  fi
 
2199
fi
 
2200
 
 
2201
# Not having GLib when unit testing has been explicitly requested is an error
 
2202
if test "x$enable_unit_tests" = x"yes"; then
 
2203
  if test "x$have_glib" = x"no"; then
 
2204
    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
 
2205
  fi
 
2206
fi
 
2207
 
 
2208
# Having unit testing disabled when GLib has been explicitly requested is an error
 
2209
if test "x$enable_unit_tests" = x"no"; then
 
2210
  if test "x$with_glib" = x"yes"; then
 
2211
    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
 
2212
  fi
 
2213
fi
 
2214
 
 
2215
# Not having GLib when it has been explicitly requested is an error
 
2216
if test "x$with_glib" = x"yes"; then
 
2217
  if test "x$have_glib" = x"no"; then
 
2218
    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
 
2219
  fi
 
2220
fi
 
2221
 
 
2222
AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
 
2223
]) # XORG_WITH_GLIB
 
2224
 
 
2225
# XORG_LD_WRAP
 
2226
# ------------
 
2227
# Minimum version: 1.13.0
 
2228
#
 
2229
# Check if linker supports -wrap, passed via compiler flags
 
2230
#
 
2231
# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
 
2232
# Otherwise the value of $enable_unit_tests is blank.
 
2233
#
 
2234
AC_DEFUN([XORG_LD_WRAP],[
 
2235
XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no])
 
2236
# Not having ld wrap when unit testing has been explicitly requested is an error
 
2237
if test "x$enable_unit_tests" = x"yes"; then
 
2238
  if test "x$have_ld_wrap" = x"no"; then
 
2239
    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
 
2240
  fi
 
2241
fi
 
2242
AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
 
2243
#
 
2244
]) # XORG_LD_WRAP
 
2245
 
 
2246
# XORG_CHECK_LINKER_FLAGS
 
2247
# -----------------------
 
2248
# SYNOPSIS
 
2249
#
 
2250
#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
 
2251
#
 
2252
# DESCRIPTION
 
2253
#
 
2254
#   Check whether the given linker FLAGS work with the current language's
 
2255
#   linker, or whether they give an error.
 
2256
#
 
2257
#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
 
2258
#   success/failure.
 
2259
#
 
2260
#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
 
2261
#
 
2262
# LICENSE
 
2263
#
 
2264
#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
 
2265
#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
 
2266
#   Copyright (c) 2009 Matteo Frigo
 
2267
#
 
2268
#   This program is free software: you can redistribute it and/or modify it
 
2269
#   under the terms of the GNU General Public License as published by the
 
2270
#   Free Software Foundation, either version 3 of the License, or (at your
 
2271
#   option) any later version.
 
2272
#
 
2273
#   This program is distributed in the hope that it will be useful, but
 
2274
#   WITHOUT ANY WARRANTY; without even the implied warranty of
 
2275
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 
2276
#   Public License for more details.
 
2277
#
 
2278
#   You should have received a copy of the GNU General Public License along
 
2279
#   with this program. If not, see <http://www.gnu.org/licenses/>.
 
2280
#
 
2281
#   As a special exception, the respective Autoconf Macro's copyright owner
 
2282
#   gives unlimited permission to copy, distribute and modify the configure
 
2283
#   scripts that are the output of Autoconf when processing the Macro. You
 
2284
#   need not follow the terms of the GNU General Public License when using
 
2285
#   or distributing such scripts, even though portions of the text of the
 
2286
#   Macro appear in them. The GNU General Public License (GPL) does govern
 
2287
#   all other use of the material that constitutes the Autoconf Macro.
 
2288
#
 
2289
#   This special exception to the GPL applies to versions of the Autoconf
 
2290
#   Macro released by the Autoconf Archive. When you make and distribute a
 
2291
#   modified version of the Autoconf Macro, you may extend this special
 
2292
#   exception to the GPL to apply to your modified version as well.#
 
2293
AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
 
2294
[AC_MSG_CHECKING([whether the linker accepts $1])
 
2295
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
 
2296
AS_LITERAL_IF([$1],
 
2297
  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
 
2298
      ax_save_FLAGS=$LDFLAGS
 
2299
      LDFLAGS="$1"
 
2300
      AC_LINK_IFELSE([AC_LANG_PROGRAM()],
 
2301
        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
 
2302
        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
 
2303
      LDFLAGS=$ax_save_FLAGS])],
 
2304
  [ax_save_FLAGS=$LDFLAGS
 
2305
   LDFLAGS="$1"
 
2306
   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
 
2307
     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
 
2308
     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
 
2309
   LDFLAGS=$ax_save_FLAGS])
 
2310
eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
 
2311
AC_MSG_RESULT($xorg_check_linker_flags)
 
2312
if test "x$xorg_check_linker_flags" = xyes; then
 
2313
        m4_default([$2], :)
 
2314
else
 
2315
        m4_default([$3], :)
 
2316
fi
 
2317
]) # XORG_CHECK_LINKER_FLAGS
 
2318
 
1909
2319
# XORG_CHECK_MALLOC_ZERO
1910
2320
# ----------------------
1911
2321
# Minimum version: 1.0.0
2211
2621
AC_SUBST([CHANGELOG_CMD])
2212
2622
]) # XORG_CHANGELOG
2213
2623
 
2214
 
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2215
 
2216
 
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2217
 
#
2218
 
# This program is free software; you can redistribute it and/or modify
2219
 
# it under the terms of the GNU General Public License as published by
2220
 
# the Free Software Foundation; either version 2 of the License, or
2221
 
# (at your option) any later version.
2222
 
#
2223
 
# This program is distributed in the hope that it will be useful, but
2224
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
2225
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2226
 
# General Public License for more details.
2227
 
#
2228
 
# You should have received a copy of the GNU General Public License
2229
 
# along with this program; if not, write to the Free Software
2230
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2231
 
#
2232
 
# As a special exception to the GNU General Public License, if you
2233
 
# distribute this file as part of a program that contains a
2234
 
# configuration script generated by Autoconf, you may include it under
2235
 
# the same distribution terms that you use for the rest of that program.
2236
 
 
2237
 
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2238
 
# ----------------------------------
2239
 
AC_DEFUN([PKG_PROG_PKG_CONFIG],
2240
 
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2241
 
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2242
 
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2243
 
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2244
 
        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2245
 
fi
2246
 
if test -n "$PKG_CONFIG"; then
2247
 
        _pkg_min_version=m4_default([$1], [0.9.0])
2248
 
        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2249
 
        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2250
 
                AC_MSG_RESULT([yes])
2251
 
        else
2252
 
                AC_MSG_RESULT([no])
2253
 
                PKG_CONFIG=""
2254
 
        fi
2255
 
                
2256
 
fi[]dnl
2257
 
])# PKG_PROG_PKG_CONFIG
2258
 
 
2259
 
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2260
 
#
2261
 
# Check to see whether a particular set of modules exists.  Similar
2262
 
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2263
 
#
2264
 
#
2265
 
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
2266
 
# this or PKG_CHECK_MODULES is called, or make sure to call
2267
 
# PKG_CHECK_EXISTS manually
2268
 
# --------------------------------------------------------------
2269
 
AC_DEFUN([PKG_CHECK_EXISTS],
2270
 
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2271
 
if test -n "$PKG_CONFIG" && \
2272
 
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2273
 
  m4_ifval([$2], [$2], [:])
2274
 
m4_ifvaln([$3], [else
2275
 
  $3])dnl
2276
 
fi])
2277
 
 
2278
 
 
2279
 
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2280
 
# ---------------------------------------------
2281
 
m4_define([_PKG_CONFIG],
2282
 
[if test -n "$$1"; then
2283
 
    pkg_cv_[]$1="$$1"
2284
 
 elif test -n "$PKG_CONFIG"; then
2285
 
    PKG_CHECK_EXISTS([$3],
2286
 
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2287
 
                     [pkg_failed=yes])
2288
 
 else
2289
 
    pkg_failed=untried
2290
 
fi[]dnl
2291
 
])# _PKG_CONFIG
2292
 
 
2293
 
# _PKG_SHORT_ERRORS_SUPPORTED
2294
 
# -----------------------------
2295
 
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2296
 
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2297
 
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2298
 
        _pkg_short_errors_supported=yes
2299
 
else
2300
 
        _pkg_short_errors_supported=no
2301
 
fi[]dnl
2302
 
])# _PKG_SHORT_ERRORS_SUPPORTED
2303
 
 
2304
 
 
2305
 
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2306
 
# [ACTION-IF-NOT-FOUND])
2307
 
#
2308
 
#
2309
 
# Note that if there is a possibility the first call to
2310
 
# PKG_CHECK_MODULES might not happen, you should be sure to include an
2311
 
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2312
 
#
2313
 
#
2314
 
# --------------------------------------------------------------
2315
 
AC_DEFUN([PKG_CHECK_MODULES],
2316
 
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2317
 
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2318
 
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2319
 
 
2320
 
pkg_failed=no
2321
 
AC_MSG_CHECKING([for $1])
2322
 
 
2323
 
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2324
 
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2325
 
 
2326
 
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2327
 
and $1[]_LIBS to avoid the need to call pkg-config.
2328
 
See the pkg-config man page for more details.])
2329
 
 
2330
 
if test $pkg_failed = yes; then
2331
 
        _PKG_SHORT_ERRORS_SUPPORTED
2332
 
        if test $_pkg_short_errors_supported = yes; then
2333
 
                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2334
 
        else 
2335
 
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2336
 
        fi
2337
 
        # Put the nasty error message in config.log where it belongs
2338
 
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2339
 
 
2340
 
        ifelse([$4], , [AC_MSG_ERROR(dnl
2341
 
[Package requirements ($2) were not met:
2342
 
 
2343
 
$$1_PKG_ERRORS
2344
 
 
2345
 
Consider adjusting the PKG_CONFIG_PATH environment variable if you
2346
 
installed software in a non-standard prefix.
2347
 
 
2348
 
_PKG_TEXT
2349
 
])],
2350
 
                [AC_MSG_RESULT([no])
2351
 
                $4])
2352
 
elif test $pkg_failed = untried; then
2353
 
        ifelse([$4], , [AC_MSG_FAILURE(dnl
2354
 
[The pkg-config script could not be found or is too old.  Make sure it
2355
 
is in your PATH or set the PKG_CONFIG environment variable to the full
2356
 
path to pkg-config.
2357
 
 
2358
 
_PKG_TEXT
2359
 
 
2360
 
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
2361
 
                [$4])
2362
 
else
2363
 
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2364
 
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2365
 
        AC_MSG_RESULT([yes])
2366
 
        ifelse([$3], , :, [$3])
2367
 
fi[]dnl
2368
 
])# PKG_CHECK_MODULES
2369