xref: /aoo41x/main/aclocal.m4 (revision cdf0e10c)
1# generated automatically by aclocal 1.9.1 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
4# Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14
15dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
16dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
17dnl also defines GSTUFF_PKG_ERRORS on error
18AC_DEFUN(PKG_CHECK_MODULES, [
19  succeeded=no
20
21  if test -z "$PKG_CONFIG"; then
22    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
23  fi
24
25  if test "$PKG_CONFIG" = "no" ; then
26     echo "*** The pkg-config script could not be found. Make sure it is"
27     echo "*** in your path, or set the PKG_CONFIG environment variable"
28     echo "*** to the full path to pkg-config."
29     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
30  else
31     PKG_CONFIG_MIN_VERSION=0.9.0
32     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
33        AC_MSG_CHECKING(for $2)
34
35        if $PKG_CONFIG --exists "$2" ; then
36            AC_MSG_RESULT(yes)
37            succeeded=yes
38
39            AC_MSG_CHECKING($1_CFLAGS)
40            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
41            AC_MSG_RESULT($$1_CFLAGS)
42
43            AC_MSG_CHECKING($1_LIBS)
44            $1_LIBS=`$PKG_CONFIG --libs "$2"`
45            AC_MSG_RESULT($$1_LIBS)
46        else
47            $1_CFLAGS=""
48            $1_LIBS=""
49            ## If we have a custom action on failure, don't print errors, but
50            ## do set a variable so people can do so.
51            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
52            ifelse([$4], ,echo $$1_PKG_ERRORS,)
53        fi
54
55        AC_SUBST($1_CFLAGS)
56        AC_SUBST($1_LIBS)
57     else
58        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
59        echo "*** See http://www.freedesktop.org/software/pkgconfig"
60     fi
61  fi
62
63  if test $succeeded = yes; then
64     ifelse([$3], , :, [$3])
65  else
66     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
67  fi
68])
69
70
71
72
73# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
74# Free Software Foundation, Inc.
75
76# This program is free software; you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
78# the Free Software Foundation; either version 2, or (at your option)
79# any later version.
80
81# This program is distributed in the hope that it will be useful,
82# but WITHOUT ANY WARRANTY; without even the implied warranty of
83# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
84# GNU General Public License for more details.
85
86# You should have received a copy of the GNU General Public License
87# along with this program; if not, write to the Free Software
88# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
89# 02111-1307, USA.
90
91# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
92
93# Adds support for distributing Python modules and packages.  To
94# install modules, copy them to $(pythondir), using the python_PYTHON
95# automake variable.  To install a package with the same name as the
96# automake package, install to $(pkgpythondir), or use the
97# pkgpython_PYTHON automake variable.
98
99# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
100# locations to install python extension modules (shared libraries).
101# Another macro is required to find the appropriate flags to compile
102# extension modules.
103
104# If your package is configured with a different prefix to python,
105# users will have to add the install directory to the PYTHONPATH
106# environment variable, or create a .pth file (see the python
107# documentation for details).
108
109# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
110# cause an error if the version of python installed on the system
111# doesn't meet the requirement.  MINIMUM-VERSION should consist of
112# numbers and dots only.
113
114AC_DEFUN([AM_PATH_PYTHON],
115 [
116  dnl Find a Python interpreter.  Python versions prior to 1.5 are not
117  dnl supported because the default installation locations changed from
118  dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
119  dnl in 1.5.
120  m4_define([_AM_PYTHON_INTERPRETER_LIST],
121            [python python2 python2.6 python2.5 python2.4 python2.3 python2.2 dnl
122python2.1 python2.0 python1.6 python1.5])
123
124  m4_if([$1],[],[
125    dnl No version check is needed.
126    # Find any Python interpreter.
127    if test -z "$PYTHON"; then
128      PYTHON=:
129      AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST)
130    fi
131    am_display_PYTHON=python
132  ], [
133    dnl A version check is needed.
134    if test -n "$PYTHON"; then
135      # If the user set $PYTHON, use it and don't search something else.
136      AC_MSG_CHECKING([whether $PYTHON version >= $1])
137      AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
138			      [AC_MSG_RESULT(yes)],
139			      [AC_MSG_ERROR(too old)])
140      am_display_PYTHON=$PYTHON
141    else
142      # Otherwise, try each interpreter until we find one that satisfies
143      # VERSION.
144      AC_CACHE_CHECK([for a Python interpreter with version >= $1],
145	[am_cv_pathless_PYTHON],[
146	for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
147	  test "$am_cv_pathless_PYTHON" = none && break
148	  AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
149	done])
150      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
151      if test "$am_cv_pathless_PYTHON" = none; then
152	PYTHON=:
153      else
154        AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
155      fi
156      am_display_PYTHON=$am_cv_pathless_PYTHON
157    fi
158  ])
159
160  if test "$PYTHON" = :; then
161  dnl Run any user-specified action, or abort.
162    m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
163  else
164
165  dnl Query Python for its version number.  Getting [:3] seems to be
166  dnl the best way to do this; it's what "site.py" does in the standard
167  dnl library.
168
169  AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
170    [am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`])
171  AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
172
173  dnl Use the values of $prefix and $exec_prefix for the corresponding
174  dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX.  These are made
175  dnl distinct variables so they can be overridden if need be.  However,
176  dnl general consensus is that you shouldn't need this ability.
177
178  AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
179  AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
180
181  dnl At times (like when building shared libraries) you may want
182  dnl to know which OS platform Python thinks this is.
183
184  AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
185    [am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`])
186  AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
187
188
189  dnl Set up 4 directories:
190
191  dnl pythondir -- where to install python scripts.  This is the
192  dnl   site-packages directory, not the python standard library
193  dnl   directory like in previous automake betas.  This behavior
194  dnl   is more consistent with lispdir.m4 for example.
195  dnl Query distutils for this directory.  distutils does not exist in
196  dnl Python 1.5, so we fall back to the hardcoded directory if it
197  dnl doesn't work.
198  AC_CACHE_CHECK([for $am_display_PYTHON script directory],
199    [am_cv_python_pythondir],
200    [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
201     echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
202  AC_SUBST([pythondir], [$am_cv_python_pythondir])
203
204  dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
205  dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
206  dnl   more consistent with the rest of automake.
207
208  AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
209
210  dnl pyexecdir -- directory for installing python extension modules
211  dnl   (shared libraries)
212  dnl Query distutils for this directory.  distutils does not exist in
213  dnl Python 1.5, so we fall back to the hardcoded directory if it
214  dnl doesn't work.
215  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
216    [am_cv_python_pyexecdir],
217    [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
218     echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
219  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
220
221  dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
222
223  AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
224
225  dnl Run any user-specified action.
226  $2
227  fi
228
229])
230
231
232# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
233# ---------------------------------------------------------------------------
234# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
235# Run ACTION-IF-FALSE otherwise.
236# This test uses sys.hexversion instead of the string equivalent (first
237# word of sys.version), in order to cope with versions such as 2.2c1.
238# hexversion has been introduced in Python 1.5.2; it's probably not
239# worth to support older versions (1.5.1 was released on October 31, 1998).
240AC_DEFUN([AM_PYTHON_CHECK_VERSION],
241 [prog="import sys, string
242# split strings by '.' and convert to numeric.  Append some zeros
243# because we need at least 4 digits for the hex conversion.
244minver = map(int, string.split('$2', '.')) + [[0, 0, 0]]
245minverhex = 0
246for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
247sys.exit(sys.hexversion < minverhex)"
248  AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
249
250# Copyright (C) 2001, 2003 Free Software Foundation, Inc.     -*- Autoconf -*-
251
252# This program is free software; you can redistribute it and/or modify
253# it under the terms of the GNU General Public License as published by
254# the Free Software Foundation; either version 2, or (at your option)
255# any later version.
256
257# This program is distributed in the hope that it will be useful,
258# but WITHOUT ANY WARRANTY; without even the implied warranty of
259# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
260# GNU General Public License for more details.
261
262# You should have received a copy of the GNU General Public License
263# along with this program; if not, write to the Free Software
264# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
265# 02111-1307, USA.
266
267# AM_RUN_LOG(COMMAND)
268# -------------------
269# Run COMMAND, save the exit status in ac_status, and log it.
270# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
271AC_DEFUN([AM_RUN_LOG],
272[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
273   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
274   ac_status=$?
275   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
276   (exit $ac_status); }])
277
278m4_include([acinclude.m4])
279