From 90f973f74d88d5f7085220fb606b0bbc0d3c1646 Mon Sep 17 00:00:00 2001 From: Mathieu Bridon Date: Thu, 16 Aug 2018 13:55:15 +0200 Subject: [PATCH] build: Find Python the Autotools way An added advantage to this is that it makes it really easy to build with Python 3, the same way other Autotools projects support it: $ export PYTHON=/usr/bin/python3 $ ./configure --- configure.ac | 2 +- src/EGL/Makefile.am | 4 ++-- src/GL/Makefile.am | 3 +-- src/GLdispatch/vnd-glapi/Makefile.am | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 05efca0..149e345 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL AC_PROG_MKDIR_P -AC_CHECK_PROGS([PYTHON2], [python2.7 python2 python]) +AM_PATH_PYTHON([2.7]) if test "x$ac_cv_prog_cc_c99" = xno; then AC_MSG_ERROR([Building libglvnd requires a C99-enabled compiler]) diff --git a/src/EGL/Makefile.am b/src/EGL/Makefile.am index 1a2ee7c..6ade4cc 100644 --- a/src/EGL/Makefile.am +++ b/src/EGL/Makefile.am @@ -100,7 +100,7 @@ GENERATE_DEPS = \ $(GENERATE_LIST_FILES) g_egldispatchstubs.c : $(GENERATE_DEPS) - $(VM_V_GEN)$(PYTHON2) $(GENERATE_DISPATCH_SCRIPT) source $(GENERATE_LIST_FILES) > $@ + $(VM_V_GEN)$(PYTHON) $(GENERATE_DISPATCH_SCRIPT) source $(GENERATE_LIST_FILES) > $@ g_egldispatchstubs.h : $(GENERATE_DEPS) - $(VM_V_GEN)$(PYTHON2) $(GENERATE_DISPATCH_SCRIPT) header $(GENERATE_LIST_FILES) > $@ + $(VM_V_GEN)$(PYTHON) $(GENERATE_DISPATCH_SCRIPT) header $(GENERATE_LIST_FILES) > $@ diff --git a/src/GL/Makefile.am b/src/GL/Makefile.am index 769dcb6..854d8b7 100644 --- a/src/GL/Makefile.am +++ b/src/GL/Makefile.am @@ -50,8 +50,7 @@ glapi_gen_libglglxstubs_deps = \ $(glapi_gen_glx_xml) g_libglglxwrapper.c : $(glapi_gen_libglglxstubs_deps) - $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) \ - $(glapi_gen_libglglxstubs_script) $(glapi_gen_glx_xml) > $@ + $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS) $(glapi_gen_libglglxstubs_script) $(glapi_gen_glx_xml) > $@ libGL_la_CFLAGS = \ -I$(top_srcdir)/include diff --git a/src/GLdispatch/vnd-glapi/Makefile.am b/src/GLdispatch/vnd-glapi/Makefile.am index 7a40611..b799b81 100644 --- a/src/GLdispatch/vnd-glapi/Makefile.am +++ b/src/GLdispatch/vnd-glapi/Makefile.am @@ -12,7 +12,7 @@ glapi_gen_mapi_deps = \ $(glapi_gen_mapi_script) \ $(top_srcdir)/src/generate/genCommon.py \ $(glapi_gen_gl_xml) -glapi_gen_mapi = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_mapi_script) +glapi_gen_mapi = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS) $(glapi_gen_mapi_script) noinst_HEADERS = \ glapi.h \