diff --git a/Makefile.am b/Makefile.am
index bdb3502aa3dfc956ec850c57e9032fe49bca7b4f..bedcdbf7386d5b1475b81692b636bb43db827bf3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,10 +27,10 @@ SUBDIRS =		include @docs_dirs@ @readline_dir@ \
 			@bench_dirs@ support-files
 
 # Relink after clean
-CLEANFILES =		linked_client_sources linked_server_sources linked_libmysql_sources linked_libmysql_r_sources
+CLEANFILES =		linked_client_sources linked_server_sources linked_libmysql_sources linked_libmysql_r_sources linked_include_sources
 
 # This is just so that the linking is done early.
-config.h:	linked_client_sources linked_server_sources linked_include_sources
+config.h:	linked_include_sources linked_client_sources linked_server_sources
 
 linked_include_sources:
 	cd include; $(MAKE) link_sources
diff --git a/include/Makefile.am b/include/Makefile.am
index 4e2fdb22574a4a1c6c161cacd91ca456e45484b0..1833ea8096bd3661b3d324552a76c41ef3f3e3f9 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -19,9 +19,9 @@ BUILT_SOURCES =		mysql_version.h m_ctype.h
 pkginclude_HEADERS =	dbug.h m_string.h my_sys.h mysql.h mysql_com.h \
 			mysqld_error.h my_list.h \
 		        my_pthread.h my_no_pthread.h raid.h errmsg.h \
-			my_config.h my_global.h my_net.h \
+			my_global.h my_net.h \
 			sslopt-case.h sslopt-longopts.h sslopt-usage.h \
-			sslopt-vars.h my_config.h $(BUILT_SOURCES)
+			sslopt-vars.h $(BUILT_SOURCES)
 noinst_HEADERS =	global.h config-win.h \
 			nisam.h heap.h merge.h \
 			myisam.h myisampack.h myisammrg.h ft_global.h\
@@ -30,6 +30,7 @@ noinst_HEADERS =	global.h config-win.h \
 			my_tree.h hash.h thr_alarm.h thr_lock.h \
 			getopt.h t_ctype.h violite.h \
 			mysql_version.h.in
+EXTRA_DIST=		my_config.h
 
 # mysql_version.h are generated
 SUPERCLEANFILES =	mysql_version.h my_global.h