~ubuntu-branches/ubuntu/quantal/vice/quantal

« back to all changes in this revision

Viewing changes to acinclude.m4

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-03-31 00:37:15 UTC
  • mfrom: (1.1.7 upstream) (9.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090331003715-i5yisvcfv7mgz3eh
Tags: 2.1.dfsg-1
* New major upstream release (closes: #495937).
* Add desktop files (closes: #501181).

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
fi
58
58
AC_SUBST($1)dnl
59
59
])
 
60
 
 
61
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 
62
 
63
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 
64
#
 
65
# This program is free software; you can redistribute it and/or modify
 
66
# it under the terms of the GNU General Public License as published by
 
67
# the Free Software Foundation; either version 2 of the License, or
 
68
# (at your option) any later version.
 
69
#
 
70
# This program is distributed in the hope that it will be useful, but
 
71
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
72
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
73
# General Public License for more details.
 
74
#
 
75
# You should have received a copy of the GNU General Public License
 
76
# along with this program; if not, write to the Free Software
 
77
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
78
#
 
79
# As a special exception to the GNU General Public License, if you
 
80
# distribute this file as part of a program that contains a
 
81
# configuration script generated by Autoconf, you may include it under
 
82
# the same distribution terms that you use for the rest of that program.
 
83
 
 
84
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
 
85
# ----------------------------------
 
86
AC_DEFUN([PKG_PROG_PKG_CONFIG],
 
87
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
 
88
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
 
89
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
 
90
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 
91
        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
 
92
fi
 
93
if test -n "$PKG_CONFIG"; then
 
94
        _pkg_min_version=m4_default([$1], [0.9.0])
 
95
        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
 
96
        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
 
97
                AC_MSG_RESULT([yes])
 
98
        else
 
99
                AC_MSG_RESULT([no])
 
100
                PKG_CONFIG=""
 
101
        fi
 
102
                
 
103
fi[]dnl
 
104
])# PKG_PROG_PKG_CONFIG
 
105
 
 
106
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
107
#
 
108
# Check to see whether a particular set of modules exists.  Similar
 
109
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
 
110
#
 
111
#
 
112
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
 
113
# this or PKG_CHECK_MODULES is called, or make sure to call
 
114
# PKG_CHECK_EXISTS manually
 
115
# --------------------------------------------------------------
 
116
AC_DEFUN([PKG_CHECK_EXISTS],
 
117
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 
118
if test -n "$PKG_CONFIG" && \
 
119
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
 
120
  m4_ifval([$2], [$2], [:])
 
121
m4_ifvaln([$3], [else
 
122
  $3])dnl
 
123
fi])
 
124
 
 
125
 
 
126
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
 
127
# ---------------------------------------------
 
128
m4_define([_PKG_CONFIG],
 
129
[if test -n "$PKG_CONFIG"; then
 
130
    if test -n "$$1"; then
 
131
        pkg_cv_[]$1="$$1"
 
132
    else
 
133
        PKG_CHECK_EXISTS([$3],
 
134
                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
 
135
                         [pkg_failed=yes])
 
136
    fi
 
137
else
 
138
        pkg_failed=untried
 
139
fi[]dnl
 
140
])# _PKG_CONFIG
 
141
 
 
142
# _PKG_SHORT_ERRORS_SUPPORTED
 
143
# -----------------------------
 
144
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
 
145
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 
146
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 
147
        _pkg_short_errors_supported=yes
 
148
else
 
149
        _pkg_short_errors_supported=no
 
150
fi[]dnl
 
151
])# _PKG_SHORT_ERRORS_SUPPORTED
 
152
 
 
153
 
 
154
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
 
155
# [ACTION-IF-NOT-FOUND])
 
156
#
 
157
#
 
158
# Note that if there is a possibility the first call to
 
159
# PKG_CHECK_MODULES might not happen, you should be sure to include an
 
160
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
 
161
#
 
162
#
 
163
# --------------------------------------------------------------
 
164
AC_DEFUN([PKG_CHECK_MODULES],
 
165
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 
166
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
 
167
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
168
 
 
169
pkg_failed=no
 
170
AC_MSG_CHECKING([for $1])
 
171
 
 
172
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 
173
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
174
 
 
175
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
 
176
and $1[]_LIBS to avoid the need to call pkg-config.
 
177
See the pkg-config man page for more details.])
 
178
 
 
179
if test $pkg_failed = yes; then
 
180
        _PKG_SHORT_ERRORS_SUPPORTED
 
181
        if test $_pkg_short_errors_supported = yes; then
 
182
                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
 
183
        else 
 
184
                $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
 
185
        fi
 
186
        # Put the nasty error message in config.log where it belongs
 
187
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 
188
 
 
189
        ifelse([$4], , [AC_MSG_ERROR(dnl
 
190
[Package requirements ($2) were not met:
 
191
 
 
192
$$1_PKG_ERRORS
 
193
 
 
194
Consider adjusting the PKG_CONFIG_PATH environment variable if you
 
195
installed software in a non-standard prefix.
 
196
 
 
197
_PKG_TEXT
 
198
])],
 
199
                [$4])
 
200
elif test $pkg_failed = untried; then
 
201
        ifelse([$4], , [AC_MSG_FAILURE(dnl
 
202
[The pkg-config script could not be found or is too old.  Make sure it
 
203
is in your PATH or set the PKG_CONFIG environment variable to the full
 
204
path to pkg-config.
 
205
 
 
206
_PKG_TEXT
 
207
 
 
208
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
 
209
                [$4])
 
210
else
 
211
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
 
212
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
 
213
        AC_MSG_RESULT([yes])
 
214
        ifelse([$3], , :, [$3])
 
215
fi[]dnl
 
216
])# PKG_CHECK_MODULES