Fix build error with MSVC.
diff --git a/.gitignore b/.gitignore
index 1d397cd..7b60760 100644
--- a/.gitignore
+++ b/.gitignore
@@ -279,6 +279,7 @@
 /man/iconvctl.3.html
 /man/iconv_open_into.3.html
 # Built by libcharset/Makefile.devel.
+/libcharset/include/libcharset.h.build.in
 /libcharset/include/localcharset.h.build.in
 
 # ---------- "make maintainerclean" gets you here ----------
@@ -321,6 +322,8 @@
 /libcharset/Makefile
 /libcharset/config.h
 /libcharset/libtool
+/libcharset/include/libcharset.h
+/libcharset/include/libcharset.h.inst
 /libcharset/include/localcharset.h
 /libcharset/include/localcharset.h.inst
 # Erased by libcharset/lib/Makefile.
diff --git a/libcharset/ChangeLog b/libcharset/ChangeLog
index 079cb0a..3da0683 100644
--- a/libcharset/ChangeLog
+++ b/libcharset/ChangeLog
@@ -1,3 +1,15 @@
+2019-06-30  Bruno Haible  <bruno@clisp.org>
+
+	Fix build error with MSVC.
+	* libcharset/Makefile.devel (include/libcharset.h.build.in): New target.
+	(all): Depend on it.
+	(totally-clean): Remove include/libcharset.h.build.in.
+	* libcharset/configure.ac: Generate include/libcharset.h and
+	include/libcharset.h.inst.
+	* libcharset/Makefile.in (include/libcharset.h): Remove rule.
+	(install-lib, install): Install libcharset.h.inst, not libcharset.h.
+	(GENERATED_FILES): Add include/libcharset.h.build.in.
+
 2019-03-04  Bruno Haible  <bruno@clisp.org>
 
 	Add support for --enable-relocatable.
diff --git a/libcharset/Makefile.devel b/libcharset/Makefile.devel
index 77b0823..04f4c7a 100644
--- a/libcharset/Makefile.devel
+++ b/libcharset/Makefile.devel
@@ -9,7 +9,7 @@
 CP = cp
 RM = rm -f
 
-all : configures include/localcharset.h.build.in
+all : configures include/libcharset.h.build.in include/localcharset.h.build.in
 
 autoconf/aclocal.m4 : $(wildcard m4/*.m4)
 	test -d autoconf || mkdir autoconf
@@ -24,12 +24,17 @@
 	$(AUTOHEADER) --include autoconf && rm -rf autom4te.cache
 	touch config.h.in
 
+include/libcharset.h.build.in : include/libcharset.h.in include/export.h
+	sed -e 's/extern \([^"]\)/extern LIBCHARSET_DLL_EXPORTED \1/' \
+	    -e '/#define _LIBCHARSET_H/r include/export.h' \
+	  < $< > $@
+
 include/localcharset.h.build.in : include/localcharset.h.in include/export.h
 	sed -e 's/extern \([^"]\)/extern LIBCHARSET_DLL_EXPORTED \1/' \
 	    -e '/#define _LOCALCHARSET_H/r include/export.h' \
 	  < $< > $@
 
 totally-clean : force
-	rm -f autoconf/aclocal.m4 configure config.h.in include/localcharset.h.build.in
+	rm -f autoconf/aclocal.m4 configure config.h.in include/libcharset.h.build.in include/localcharset.h.build.in
 
 force :
diff --git a/libcharset/Makefile.in b/libcharset/Makefile.in
index 5f599fe..e048197 100644
--- a/libcharset/Makefile.in
+++ b/libcharset/Makefile.in
@@ -30,25 +30,21 @@
 
 SHELL = @SHELL@
 
-all : include/libcharset.h force
+all : force
 	cd lib && $(MAKE) all
 
-include/libcharset.h :
-	if [ ! -d include ] ; then mkdir include ; fi
-	$(CP) $(srcdir)/include/libcharset.h.in include/libcharset.h
-
 # Installs the library and include files only. Typically called with only
 # $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here.
 install-lib : all force
 	cd lib && $(MAKE) install-lib libdir='$(libdir)' includedir='$(includedir)'
 	$(mkinstalldirs) $(includedir)
-	$(INSTALL_DATA) include/libcharset.h $(includedir)/libcharset.h
+	$(INSTALL_DATA) include/libcharset.h.inst $(includedir)/libcharset.h
 	$(INSTALL_DATA) include/localcharset.h.inst $(includedir)/localcharset.h
 
-install : include/libcharset.h include/localcharset.h force
+install : all force
 	cd lib && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)'
 	$(mkinstalldirs) $(DESTDIR)$(includedir)
-	$(INSTALL_DATA) include/libcharset.h $(DESTDIR)$(includedir)/libcharset.h
+	$(INSTALL_DATA) include/libcharset.h.inst $(DESTDIR)$(includedir)/libcharset.h
 	$(INSTALL_DATA) include/localcharset.h.inst $(DESTDIR)$(includedir)/localcharset.h
 
 install-strip : install
@@ -133,6 +129,7 @@
 # List of distributed files generated by autotools or Makefile.devel.
 GENERATED_FILES = \
   autoconf/aclocal.m4 configure config.h.in \
+  include/libcharset.h.build.in \
   include/localcharset.h.build.in
 # List of distributed files generated by "make".
 DISTRIBUTED_BUILT_FILES =
diff --git a/libcharset/configure.ac b/libcharset/configure.ac
index 362bde3..a071d25 100644
--- a/libcharset/configure.ac
+++ b/libcharset/configure.ac
@@ -60,6 +60,8 @@
 
 AC_CONFIG_FILES([Makefile])
 AC_CONFIG_FILES([lib/Makefile])
+AC_CONFIG_FILES([include/libcharset.h:include/libcharset.h.build.in])
+AC_CONFIG_FILES([include/libcharset.h.inst:include/libcharset.h.in])
 AC_CONFIG_FILES([include/localcharset.h:include/localcharset.h.build.in])
 AC_CONFIG_FILES([include/localcharset.h.inst:include/localcharset.h.in])
 AC_OUTPUT