source: trunk/third/libglade2/acinclude.m4 @ 18268

Revision 18268, 1.1 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18267, which included commits to RCS files with non-trunk default branches.
Line 
1dnl JH_PYTHON_CHECK(VERSIONTUPLE, EXTRA-CHECKS,
2dnl                 ACTION-IF-FOUND,ACTION-IF-NOT-FOUND)
3
4AC_DEFUN([JH_PYTHON_CHECK],
5[AC_CACHE_VAL([jh_cv_path_python],
6[if test "x$PYTHON" != x; then
7  jh_cv_path_python="$PYTHON"
8else
9dnl python code to check for required python
10jh_python_check='
11import sys, string
12if sys.version_info < $1:
13    sys.exit(1)
14$2
15sys.exit(0)'
16dnl
17  for jh_python in python python2 python2.3 python2.2 python2.1 python2.0; do
18    jh_save_IFS=$IFS; IFS=$PATH_SEPARATOR
19    jh_dummy="$PATH"
20    for jh_dir in $jh_dummy; do
21      IFS=$jh_save_IFS
22      test -z "$jh_dir" && jh_dir=.
23      if test -x "$jh_dir/$jh_python"; then
24        echo "checking $jh_dir/$jh_python" >&AS_MESSAGE_LOG_FD
25        if "$jh_dir/$jh_python" -c "$jh_python_check" 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
26        then
27          echo "$jh_dir/$jh_python looks okay" >&AS_MESSAGE_LOG_FD
28          jh_cv_path_python="$jh_dir/$jh_python"
29          break
30        fi
31      fi
32    done
33    test -n "$jh_cv_path_python" && break
34  done
35fi])
36if test -n "$jh_cv_path_python"; then
37  PYTHON="$jh_cv_path_python"
38  $3
39else
40  PYTHON="/usr/bin/env python"
41  $4
42fi
43])
Note: See TracBrowser for help on using the repository browser.