diff --git a/Makefile.am b/Makefile.am
index 9d1b69f..1f8ed58 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,11 @@
 ACLOCAL_AMFLAGS = -I m4
 AUTOMAKE_OPTIONS = 1.7
 
-SUBDIRS = docs codegen glib gobject examples
+SUBDIRS = docs glib gobject examples
+
+if ENABLE_CODEGEN
+SUBDIRS += codegen
+endif
 
 if ENABLE_INTROSPECTION
 SUBDIRS += gi
diff --git a/configure.ac b/configure.ac
index fb69237..47827e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,7 +85,7 @@ AC_PROG_CC
 AM_PROG_CC_STDC
 AM_PROG_CC_C_O
 
-# check that we have the minimum version of python necisary to build
+# check that we have the minimum version of python necessary to build
 JD_PATH_PYTHON(python_min_ver)
 
 # check if we are building for python 3
@@ -247,6 +247,9 @@ INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspecti
 AC_SUBST(INTROSPECTION_SCANNER)
 AC_SUBST(INTROSPECTION_COMPILER)
 
+dnl Do not install codegen for Python 3.
+AM_CONDITIONAL(ENABLE_CODEGEN, test $build_py3k = false)
+
 dnl add required cflags ...
 if test "x$GCC" = "xyes"; then
   JH_ADD_CFLAG([-Wall])
@@ -266,8 +269,6 @@ AC_CONFIG_FILES(
   Makefile
   pygobject-2.0.pc
   pygobject-2.0-uninstalled.pc
-  codegen/Makefile
-  codegen/pygobject-codegen-2.0
   docs/Makefile
   docs/reference/entities.docbook
   docs/xsl/fixxref.py
@@ -279,6 +280,13 @@ AC_CONFIG_FILES(
   examples/Makefile
   tests/Makefile
   PKG-INFO)
+
+if test $build_py3k = false; then
+  AC_CONFIG_FILES(
+    codegen/Makefile
+    codegen/pygobject-codegen-2.0)
+fi
+
 AC_OUTPUT
 
 echo
