root/trunk/acsite.m4

Revision 746, 7.8 kB (checked in by nicfit, 1 year ago)

Setup python patch with correct site-packges

Line 
1 dnl
2 dnl  Copyright (C) 2002,2007  Travis Shirk <travis@pobox.com>
3 dnl
4 dnl  This program is free software; you can redistribute it and/or modify
5 dnl  it under the terms of the GNU General Public License as published by
6 dnl  the Free Software Foundation; either version 2 of the License, or
7 dnl  (at your option) any later version.
8 dnl
9 dnl  This program is distributed in the hope that it will be useful,
10 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl  GNU General Public License for more details.
13 dnl
14 dnl  You should have received a copy of the GNU General Public License
15 dnl  along with this program; if not, write to the Free Software
16 dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 dnl
18
19 AC_DEFUN([ACX_CHECK_PYTHON], [
20    PYTHON=""
21    for python in python python2 python$1; do
22        dnl Unset to avoid cache hits that did not pass the version test
23        unset ac_cv_path_PYTHON
24        AC_PATH_PROGS([PYTHON], [$python])
25        if test -z "${PYTHON}"; then
26            continue
27        fi
28        AC_MSG_CHECKING([if ${PYTHON} is version >= $1])
29        version=`${PYTHON} -c 'import sys; print "%d.%d" % (sys.version_info[[0]], sys.version_info[[1]])'`
30        AX_COMPARE_VERSION([${version}], [ge], [$1])
31        if test ${ax_compare_version} = "true"; then
32            AC_MSG_RESULT([yes])
33            break
34        else
35            AC_MSG_RESULT([no])
36            PYTHON=""
37        fi
38    done
39
40    if test -z ${PYTHON}; then
41       AC_MSG_ERROR([python version $1 could not be found])
42    fi
43    PYTHON_VERSION=$version
44    AC_SUBST([PYTHON_VERSION])
45 ])
46
47 AC_DEFUN([ACX_CHECK_EYED3], [
48    AC_MSG_CHECKING([for eyeD3])
49    eyeD3_version=`${PYTHON} -c 'import eyeD3; import eyeD3.info; print eyeD3.info.VERSION;' 2> /dev/null`
50    AX_COMPARE_VERSION([${eyeD3_version}], [ge], [$1])
51    if test ${ax_compare_version} = "true"; then
52       AC_MSG_RESULT([yes])
53    else
54       AC_MSG_RESULT([no])
55       AC_MSG_ERROR([eyeD3 >= $1 required.])
56    fi
57 ])
58
59 AC_DEFUN([ACX_CHECK_DBUS_PYTHON], [
60    AC_MSG_CHECKING([for dbus-python])
61    dbus_version=`${PYTHON} -c 'import dbus; print "%d.%d.%d" % (dbus.version[[0]], dbus.version[[1]], dbus.version[[2]])' 2> /dev/null`
62    AX_COMPARE_VERSION([${dbus_version}], [ge], [$1])
63    if test ${ax_compare_version} = "true"; then
64       AC_MSG_RESULT([yes])
65    else
66       AC_MSG_RESULT([no])
67       AC_MSG_ERROR([dbus-python >= $1 required.])
68    fi
69 ])
70
71 AC_DEFUN([ACX_CHECK_PYVORBIS], [
72    AC_MSG_CHECKING([for pyvorbis])
73    if ${PYTHON} -c 'from ogg.vorbis import VorbisFile;' > /dev/null 2>&1; then
74       AC_MSG_RESULT([yes])
75    else
76       AC_MSG_RESULT([no])
77       AC_MSG_ERROR([pyvorbis required.])
78    fi
79 ])
80
81 AC_DEFUN([ACX_CHECK_GNOME_PYTHON], [
82    AC_MSG_CHECKING([for dbus-python])
83    dbus_version=`${PYTHON} -c 'import dbus; print "%d.%d.%d" % (dbus.version[[0]], dbus.version[[1]], dbus.version[[2]])' 2> /dev/null`
84    AX_COMPARE_VERSION([${dbus_version}], [ge], [$1])
85    if test ${ax_compare_version} = "true"; then
86       AC_MSG_RESULT([yes])
87    else
88       AC_MSG_RESULT([no])
89       AC_MSG_ERROR([dbus-python >= $1 required.])
90    fi
91 ])
92
93 AC_DEFUN([ACX_CHECK_CDDB_PY], [
94    AC_MSG_CHECKING([for cddb-py])
95    cddb_version=`${PYTHON} -c 'import CDDB; print CDDB.version;' 2> /dev/null`
96    AX_COMPARE_VERSION([${cddb_version}], [ge], [$1])
97    if test ${ax_compare_version} = "true"; then
98       AC_MSG_RESULT([yes])
99    else
100       AC_MSG_RESULT([no])
101       AC_MSG_ERROR([cddb-py >= $1 required.])
102    fi
103 ])
104
105 dnl #########################################################################
106 AC_DEFUN([AX_COMPARE_VERSION], [
107   # Used to indicate true or false condition
108   ax_compare_version=false
109
110   # Convert the two version strings to be compared into a format that
111   # allows a simple string comparison.  The end result is that a version
112   # string of the form 1.12.5-r617 will be converted to the form
113   # 0001001200050617.  In other words, each number is zero padded to four
114   # digits, and non digits are removed.
115   AS_VAR_PUSHDEF([A],[ax_compare_version_A])
116   A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
117                      -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
118                      -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
119                      -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
120                      -e 's/[[^0-9]]//g'`
121
122   AS_VAR_PUSHDEF([B],[ax_compare_version_B])
123   B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
124                      -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
125                      -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
126                      -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
127                      -e 's/[[^0-9]]//g'`
128
129   dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
130   dnl # then the first line is used to determine if the condition is true.
131   dnl # The sed right after the echo is to remove any indented white space.
132   m4_case(m4_tolower($2),
133   [lt],[
134     ax_compare_version=`echo "x$A
135 x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
136   ],
137   [gt],[
138     ax_compare_version=`echo "x$A
139 x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
140   ],
141   [le],[
142     ax_compare_version=`echo "x$A
143 x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
144   ],
145   [ge],[
146     ax_compare_version=`echo "x$A
147 x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
148   ],[
149     dnl Split the operator from the subversion count if present.
150     m4_bmatch(m4_substr($2,2),
151     [0],[
152       # A count of zero means use the length of the shorter version.
153       # Determine the number of characters in A and B.
154       ax_compare_version_len_A=`echo "$A" | awk '{print(length)}'`
155       ax_compare_version_len_B=`echo "$B" | awk '{print(length)}'`
156  
157       # Set A to no more than B's length and B to no more than A's length.
158       A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
159       B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
160     ],
161     [[0-9]+],[
162       # A count greater than zero means use only that many subversions
163       A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
164       B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
165     ],
166     [.+],[
167       AC_WARNING(
168         [illegal OP numeric parameter: $2])
169     ],[])
170
171     # Pad zeros at end of numbers to make same length.
172     ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
173     B="$B`echo $A | sed 's/./0/g'`"
174     A="$ax_compare_version_tmp_A"
175
176     # Check for equality or inequality as necessary.
177     m4_case(m4_tolower(m4_substr($2,0,2)),
178     [eq],[
179       test "x$A" = "x$B" && ax_compare_version=true
180     ],
181     [ne],[
182       test "x$A" != "x$B" && ax_compare_version=true
183     ],[
184       AC_WARNING([illegal OP parameter: $2])
185     ])
186   ])
187
188   AS_VAR_POPDEF([A])dnl
189   AS_VAR_POPDEF([B])dnl
190
191   dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
192   if test "$ax_compare_version" = "true" ; then
193     m4_ifvaln([$4],[$4],[:])dnl
194     m4_ifvaln([$5],[else $5])dnl
195   fi
196 ]) dnl AX_COMPARE_VERSION
197
198 dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
199 dnl
200 dnl example
201 dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
202 dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
203
204 AC_DEFUN([AS_AC_EXPAND],
205 [
206   EXP_VAR=[$1]
207   FROM_VAR=[$2]
208
209   dnl first expand prefix and exec_prefix if necessary
210   prefix_save=$prefix
211   exec_prefix_save=$exec_prefix
212
213   dnl if no prefix given, then use /usr/local, the default prefix
214   if test "x$prefix" = "xNONE"; then
215     prefix=$ac_default_prefix
216   fi
217   dnl if no exec_prefix given, then use prefix
218   if test "x$exec_prefix" = "xNONE"; then
219     exec_prefix=$prefix
220   fi
221
222   full_var="$FROM_VAR"
223   dnl loop until it doesn't change anymore
224   while true; do
225     new_full_var="`eval echo $full_var`"
226     if test "x$new_full_var"="x$full_var"; then break; fi
227     full_var=$new_full_var
228   done
229
230   dnl clean up
231   full_var=$new_full_var
232   AC_SUBST([$1], "$full_var")
233
234   dnl restore prefix and exec_prefix
235   prefix=$prefix_save
236   exec_prefix=$exec_prefix_save
237 ])
238
Note: See TracBrowser for help on using the browser.