git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] configure: Add test for Python

From
DSDennis Stosberg <dennis@stosberg.net>
Date
Jul 6, 2006, 12:40 UTC
Message-ID
<20060706124038.G20591f4b@leonov.stosberg.net>

The test tries to find the path to a suitable Python binary. It also adds a --python=/path parameter to override the autodetection.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 config-lib.sh |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/config-lib.sh b/config-lib.sh
index 69999a8..50ad6e9 100755
--- a/config-lib.sh
+++ b/config-lib.sh
@@ -263,6 +263,7 @@ Installation directories:
 Miscellaneous options:
   --cc=COMPILER          use this C compiler to build MPlayer [gcc]
   --perl=PATH            path to perl binary [autodetect]
+  --python=PATH          path to python binary [autodetect]
   --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
   --with-install=PATH    use a custom install program (useful if your OS uses
                          a GNU-incompatible install utility by default and
@@ -299,6 +300,8 @@ EOF
 			_cc=`echo $ac_option | cut -d '=' -f 2` ;;
 		--perl=*)
 			_perl=`echo $ac_option | cut -d '=' -f 2` ;;
+		--python=*)
+			_python=`echo $ac_option | cut -d '=' -f 2` ;;
 		--target=*)
 			_target=`echo $ac_option | cut -d '=' -f 2` ;;
 		--with-install=*)
@@ -426,6 +429,24 @@ EOF
 		die "your perl version is too old"
 	fi
 	echores "$_perl_version"
+
+	echocheck "for python"
+	for __py_bin in python python2.4 python2.3; do
+		test "$_python" && continue
+
+		__candidate=`which $__py_bin`
+		test "$__candidate" || continue
+
+		$__candidate - <<EOF || continue
+import sys
+v = sys.version_info
+if v < (2, 3):
+    sys.exit(1)
+EOF
+		_python=$__candidate
+	done
+	test "$_python" || die "cannot find path to python"
+	echores "$_python"
 }
 
 write_config() {
@@ -437,6 +458,7 @@ # -------- Generated by configure ------
 
 CC = $_cc
 PERL_PATH = $_perl
+PYTHON_PATH = $_python
 INSTALL = $_install
 
 EOF
-- 
1.4.1
Message 1 of 1 in “configure: Add test for Python”
  1. 2/3 configure: Add test for PythonDennis Stosberg, Jul 6, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.