[Mesa-dev] [PATCH] autoconf: use python2 binary if available

Xavier Chantry chantry.xavier at gmail.com
Sat Oct 23 08:32:39 PDT 2010


and use PYTHON2 in src/gallium/auxiliary/Makefile

This fixes gallium build on a system where /usr/bin/python is v3 and
/usr/bin/python2 is v2.

python indices/u_indices_gen.py > indices/u_indices_gen.c
python indices/u_unfilled_gen.py > indices/u_unfilled_gen.c
  File "indices/u_indices_gen.py", line 63
    print '''/* File automatically generated by indices.py */'''
                                                               ^
SyntaxError: invalid syntax
python util/u_format_srgb.py > util/u_format_srgb.c
  File "indices/u_unfilled_gen.py", line 53
    print '''/* File automatically generated by u_unfilled_gen.py */'''
                                                                      ^
SyntaxError: invalid syntax
python util/u_format_table.py util/u_format.csv > util/u_format_table.c
  File "util/u_format_srgb.py", line 59
    print 'const float'
                      ^
SyntaxError: invalid syntax
python util/u_half.py > util/u_half.c
  File "util/u_format_table.py", line 83
    print '/* This file is autogenerated by u_format_table.py from u_format.csv. Do not edit directly. */'
                                                                                                         ^
SyntaxError: invalid syntax
  File "util/u_half.py", line 59
    print "const " + t + " " + n + "[" + str(l) + "] = {"
                 ^
SyntaxError: invalid syntax

Signed-off-by: Xavier Chantry <chantry.xavier at gmail.com>
---
 configs/autoconf.in            |    2 +-
 configure.ac                   |    3 +++
 src/gallium/auxiliary/Makefile |   10 +++++-----
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 9bdbefe..e2d70c6 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -53,7 +53,7 @@ MKDEP_OPTIONS = @MKDEP_OPTIONS@
 INSTALL = @INSTALL@
 
 # Python and flags (generally only needed by the developers)
-PYTHON2 = python
+PYTHON2 = @PYTHON2@
 PYTHON_FLAGS = -t -O -O
 
 # Library names (base name)
diff --git a/configure.ac b/configure.ac
index 364ee03..d6f15b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@ AC_PROG_CPP
 AC_PROG_CC
 AC_PROG_CXX
 AC_CHECK_PROGS([MAKE], [gmake make])
+AC_CHECK_PROGS([PYTHON2], [python2 python])
 AC_PATH_PROG([MKDEP], [makedepend])
 AC_PATH_PROG([SED], [sed])
 
@@ -1691,6 +1692,8 @@ echo ""
 echo "        CFLAGS:          $cflags"
 echo "        CXXFLAGS:        $cxxflags"
 echo "        Macros:          $defines"
+echo ""
+echo "        PYTHON2:         $PYTHON2"
 
 echo ""
 echo "        Run '${MAKE-make}' to build Mesa"
diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index abd33f6..f37d59e 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -211,16 +211,16 @@ include ../Makefile.template
 
 
 indices/u_indices_gen.c: indices/u_indices_gen.py
-	python $< > $@
+	$(PYTHON2) $< > $@
 
 indices/u_unfilled_gen.c: indices/u_unfilled_gen.py
-	python $< > $@
+	$(PYTHON2) $< > $@
 
 util/u_format_srgb.c: util/u_format_srgb.py
-	python $< > $@
+	$(PYTHON2) $< > $@
 
 util/u_format_table.c: util/u_format_table.py util/u_format_pack.py util/u_format_parse.py util/u_format.csv
-	python util/u_format_table.py util/u_format.csv > $@
+	$(PYTHON2) util/u_format_table.py util/u_format.csv > $@
 
 util/u_half.c: util/u_half.py
-	python util/u_half.py > $@
+	$(PYTHON2) util/u_half.py > $@
-- 
1.7.3.2



More information about the mesa-dev mailing list