+
+
+if test "$python" = yes; then
+ # Extract the first word of "python2", so it can be a program name with args.
+set dummy python2; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_pythonpath+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $pythonpath in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_pythonpath="$pythonpath" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_pythonpath="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+pythonpath=$ac_cv_path_pythonpath
+if test -n "$pythonpath"; then
+ { echo "$as_me:$LINENO: result: $pythonpath" >&5
+echo "${ECHO_T}$pythonpath" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ if test "_$pythonpath" = _ ; then
+ # Extract the first word of "python", so it can be a program name with args.
+set dummy python; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_pythonpath+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $pythonpath in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_pythonpath="$pythonpath" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_pythonpath="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+pythonpath=$ac_cv_path_pythonpath
+if test -n "$pythonpath"; then
+ { echo "$as_me:$LINENO: result: $pythonpath" >&5
+echo "${ECHO_T}$pythonpath" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ fi
+ if test "_$pythonpath" = _ ; then
+ python=no
+ else
+ { echo "$as_me:$LINENO: checking Python version" >&5
+echo $ECHO_N "checking Python version... $ECHO_C" >&6; }
+ PY_VER=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("VERSION")[0];'`
+ PY_LIB=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1);'`
+ PY_INC=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("INCLUDEPY")[0];'`
+ $pythonpath -c "import sys; map(int,sys.version[:3].split('.')) >= [2,2] or sys.exit(1)"
+ { echo "$as_me:$LINENO: result: $PY_VER" >&5
+echo "${ECHO_T}$PY_VER" >&6; }
+ if test "$?" != "1"; then
+ { echo "$as_me:$LINENO: checking Python compile flags" >&5
+echo $ECHO_N "checking Python compile flags... $ECHO_C" >&6; }
+ PY_PREFIX=`$pythonpath -c 'import sys; print sys.prefix'`
+ PY_EXEC_PREFIX=`$pythonpath -c 'import sys; print sys.exec_prefix'`
+ if test -f $PY_INC/Python.h; then
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_PYTHON 1
+_ACEOF
+
+ PY_LIBS="-L$PY_LIB/config -lpython$PY_VER -lpthread -lutil"
+ PY_CFLAGS="-I$PY_INC"
+ { echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
+ CFLAGS="$CFLAGS $PY_CFLAGS"
+ LIBS="$LIBS $PY_LIBS"
+ else
+ python=no
+ { echo "$as_me:$LINENO: result: Can't find Python.h" >&5
+echo "${ECHO_T}Can't find Python.h" >&6; }
+ fi
+ else
+ echo "Python too old. Only 2.2 or above is supported."
+ python=no
+ fi
+ fi
+fi
+
+ if test "x$python" = "xyes"; then
+ DO_PYTHON_TRUE=
+ DO_PYTHON_FALSE='#'
+else
+ DO_PYTHON_TRUE='#'
+ DO_PYTHON_FALSE=
+fi
+
+