File: python.m4

package info (click to toggle)
streamtuner 0.99.99-15
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 5,220 kB
  • ctags: 2,980
  • sloc: ansic: 27,119; sh: 8,206; xml: 4,811; makefile: 444; python: 366
file content (78 lines) | stat: -rw-r--r-- 1,886 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# This file is part of streamtuner.
#
# Copyright (c) 2003, 2004 Jean-Yves Lefort.
#
# As a special exception to the streamtuner licensing terms, Jean-Yves
# Lefort gives unlimited permission to copy, distribute and modify
# this file.
#
# Based upon:
#
# Python file handling
# 	From Andrew Dalke
# 	Updated by James Henstridge

dnl AM_PATH_EMBEDDED_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
AC_DEFUN([AM_PATH_EMBEDDED_PYTHON],
[found=no
PYTHON_VERSION=""
PYTHON_PREFIX=""
EMBEDDED_PYTHON_CFLAGS=""
EMBEDDED_PYTHON_LIBS=""

AC_PATH_PROGS(PYTHON, [python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5], no)

if test "x$PYTHON" != "xno"; then
	minver=ifelse([$1],, 1.5.0, [$1])

	AC_MSG_CHECKING([Python version])

	changequote(<<, >>)dnl
	PYTHON_VERSION=`$PYTHON -c "
import sys, string

minver = '$minver'
pyver = string.split(sys.version)[0]

minver = map(string.atoi, string.split(minver, '.'))
pyver = map(string.atoi, string.split(pyver, '.'))

print sys.version[:3]

if pyver >= minver:
	sys.exit(0)
else:
	sys.exit(1)" 2>&AS_MESSAGE_LOG_FD`
	changequote([, ])dnl

	verstatus=$?

	if test -z "$PYTHON_VERSION"; then
		AC_MSG_RESULT([not found])
	else
		AC_MSG_RESULT([$PYTHON_VERSION])

		if test $verstatus -eq 0; then
			found=yes

			PYTHON_PREFIX=`AS_DIRNAME(["$PYTHON"])`
			PYTHON_PREFIX=`AS_DIRNAME(["$PYTHON_PREFIX"])`
			EMBEDDED_PYTHON_CFLAGS="-I$PYTHON_PREFIX/include/python$PYTHON_VERSION"
			EMBEDDED_PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lm -lutil -lpython$PYTHON_VERSION"
		else
			PYTHON_VERSION=""
			AC_MSG_WARN([the installed Python is too old (version $minver required)])
		fi
	fi
fi

if test $found = yes; then
	ifelse([$2],, :, [$2])
else
	ifelse([$3],, :, [$3])
fi

AC_SUBST(PYTHON_VERSION)
AC_SUBST(PYTHON_PREFIX)
AC_SUBST(EMBEDDED_PYTHON_CFLAGS)
AC_SUBST(EMBEDDED_PYTHON_LIBS)])