Allow Thrift to be built without the Python library.

- Modify configure.ac to check for Python conditionally, like we do for
  Java, Mono, and Erlang.
- Modify Makefile.am to add "py" to SUBDIRS only if Python was detected.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666488 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/configure.ac b/configure.ac
index 9e9a0b4..44e3168 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,8 +12,6 @@
                          Default = "/usr"])
 AS_IF([test "x$PY_PREFIX" = x], [PY_PREFIX="/usr"])
 
-AM_PATH_PYTHON(2.4,, :)
-
 
 AC_PROG_CC
 AC_PROG_CPP
@@ -57,6 +55,12 @@
 fi
 AM_CONDITIONAL(ENABLE_ERLANG, [test -n "$ERLC"])
 
+AX_THRIFT_LIB(py, [Python], yes)
+if test "$with_py" = "yes";  then
+  AM_PATH_PYTHON(2.4,, :)
+fi
+AM_CONDITIONAL(ENABLE_PYTHON, [test -n "$PYTHON" -a "$PYTHON" != ":"])
+
 AC_C_CONST
 AC_C_INLINE
 AC_C_VOLATILE
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 58ef555..1045237 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,6 +1,5 @@
 SUBDIRS = \
-  cpp \
-  py
+  cpp
 
 if ENABLE_MONO
 SUBDIRS += csharp
@@ -10,6 +9,10 @@
 SUBDIRS += java
 endif
 
+if ENABLE_PYTHON
+SUBDIRS += py
+endif
+
 if ENABLE_ERLANG
 SUBDIRS += erl
 endif
diff --git a/test/Makefile.am b/test/Makefile.am
index bf5a0d7..e34e033 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,9 +1,13 @@
-SUBDIRS = py
+SUBDIRS =
 
 if ENABLE_JAVA
 SUBDIRS += java
 endif
 
+if ENABLE_PYTHON
+SUBDIRS += py
+endif
+
 noinst_LTLIBRARIES = libtestgencpp.la
 libtestgencpp_la_SOURCES = \
 	gen-cpp/DebugProtoTest_types.cpp \