THRIFT-2835 Add possibility to distribute generators separately from thrift core, and load them dynamically
Client: Compiler
Patch: Nobuaki Sukegawa, rebased by dtmuller

Also fixed by dtmuller:
* Add plugin namespace for erlang language binding
* Fix unit test test_const_value
* Don't clear type cache with every t_program conversion
* Type "wb" may not be supported by popen on non-Windows platforms
* Fix constness of AST type signatures
diff --git a/lib/Makefile.am b/lib/Makefile.am
index f12e092..5f17fca 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -21,8 +21,11 @@
 PRECROSS_TARGET =
 
 if WITH_CPP
+# cpp dir is picked directly by plugin build
+if !WITH_PLUGIN
 SUBDIRS += cpp
 endif
+endif
 
 if WITH_C_GLIB
 SUBDIRS += c_glib