Python GDB intergration work for the build system.
Ray Donnelly [Thu, 2 May 2013 23:02:41 +0000 (00:02 +0100)]
Adds a --with-python=</path/to/python-config.sh> option.

Makefile.in
configure
configure.ac

index 43fe553..1aefec0 100644 (file)
@@ -84,6 +84,7 @@ CLOOG_VERSION=cloog-@CLOOG_VERSION@
 ISL_VERSION=isl-@ISL_VERSION@
 GDB_VERSION=gdb-@GDB_VERSION@
 EXPAT_VERSION=expat-@EXPAT_VERSION@
+WITH_PYTHON=@WITH_PYTHON@
 HAVE_MPC=@have_mpc@
 HAVE_MPFR=@have_mpfr@
 HAVE_GMP=@have_gmp@
@@ -127,6 +128,10 @@ ifeq ($(HAVE_EXPAT),no)
   EXPAT_DIR=$(TEMP_INSTALLDIR)
 endif
 
+ifneq ($(WITH_PYTHON),)
+  WITH_PYTHON:=--with-python=$(WITH_PYTHON)
+endif
+
 # Figure out where to find the ld binary.
 FIND_TARGET_LD=\
        `[ -d $(TARGET_BINUTILS_BUILDDIR)/gold ] && echo "gold" || echo "ld"`
@@ -810,7 +815,7 @@ config-target-gdb: stmp-config-target-gdb
 
 GDB_CONFIG_ARGS=$(host_baseargs) --prefix=$(prefix) \
        --target=$(GDB_TARGET) --host=${cur_host} --build=${cur_build} \
-       --disable-nls
+       $(WITH_PYTHON) --disable-nls
 
 # For gdb versions 7.2 and higher, expat is required.
 ifeq ($(GDB_MIN_VERSION_7_2),yes)
@@ -818,11 +823,6 @@ stmp-config-target-gdb: stmp-install-host-expat
 GDB_CONFIG_ARGS += --with-expat --with-libexpat-prefix=$(EXPAT_DIR)
 endif
 
-# For gdb 7.x, disable python support for now
-ifeq ($(filter gdb-6.%,$(GDB_VERSION)),)
-GDB_CONFIG_ARGS += --with-python=no
-endif
-
 stmp-config-target-gdb: config.status $(canadian_stmp)
        ([ -d ${GDB_VERSION} ] || \
          mkdir ${GDB_VERSION}) && \
index 5c81f66..f2638a7 100755 (executable)
--- a/configure
+++ b/configure
@@ -560,6 +560,7 @@ have_gmp
 have_mpfr
 have_mpc
 sysroot
+WITH_PYTHON
 EXPAT_VERSION
 GDB_MIN_VERSION_7_2
 GDB_VERSION
@@ -657,6 +658,7 @@ with_cloog_version
 with_isl_version
 with_gdb_version
 with_expat_version
+with_python
 with_sysroot
 with_mpc
 with_mpfr
@@ -1318,6 +1320,8 @@ Optional Packages:
                           use gdb-VERSION (default is 6.6)
   --with-expat-version=VERSION
                           use expat-VERSION (default is 2.0.1)
+  --with-python=WITH_PYTHON
+                          use python WITH_PYTHON)
   --with-sysroot=DIR
                           use target sysroot in DIR
   --with-mpc=PATH
@@ -2852,6 +2856,24 @@ fi
 fi
 
 
+if test "$GDB_MIN_VERSION_7_2" == "yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking with python" >&5
+$as_echo_n "checking with python... " >&6; }
+
+# Check whether --with-python was given.
+if test "${with_python+set}" = set; then :
+  withval=$with_python; if test x"$withval" != x ; then
+     WITH_PYTHON="$withval"
+   fi
+else
+  WITH_PYTHON=""
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $WITH_PYTHON" >&5
+$as_echo "$WITH_PYTHON" >&6; }
+fi
+
+
 # For certain targets, with gdb 7.2+, the proper gdb target is
 # arm-linux-android.
 if test "$GDB_MIN_VERSION_7_2" == "yes"; then
index 99e353a..b316a7e 100644 (file)
@@ -559,6 +559,19 @@ ANDROID_CHECK_PACKAGE(expat-${EXPAT_VERSION})
 fi
 AC_SUBST(EXPAT_VERSION)
 
+if test "$GDB_MIN_VERSION_7_2" == "yes"; then
+AC_MSG_CHECKING([with python])
+AC_ARG_WITH([python],
+  [  --with-python=WITH_PYTHON
+                          use python WITH_PYTHON)],
+  [if test x"$withval" != x ; then
+     WITH_PYTHON="$withval"
+   fi],
+[WITH_PYTHON=""])
+AC_MSG_RESULT($WITH_PYTHON)
+fi
+AC_SUBST(WITH_PYTHON)
+
 # For certain targets, with gdb 7.2+, the proper gdb target is 
 # arm-linux-android.
 if test "$GDB_MIN_VERSION_7_2" == "yes"; then