winpthreads: do not expose IN_WINPTHREAD in public header files

When building winpthreads, define WINPTHREAD_API in config.h
instead of public pthread_compat.h.

Definition of WINPTHREAD_API in pthread_compat.h will only be used
by client code.

Note that IN_WINPTHREAD is still defined.
It is checked for in mingw-w64's time.h.

Signed-off-by: Kirill Makurin <maiddaisuki@outlook.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-libraries/winpthreads/configure.ac b/mingw-w64-libraries/winpthreads/configure.ac
index 45d3821..f29d3c2 100644
--- a/mingw-w64-libraries/winpthreads/configure.ac
+++ b/mingw-w64-libraries/winpthreads/configure.ac
@@ -54,5 +54,14 @@
 
 # Checks for library functions.
 
+# config.h
+AH_BOTTOM(
+[#ifdef DLL_EXPORT
+#define WINPTHREAD_API __declspec(dllexport)
+#else
+#define WINPTHREAD_API
+#endif]dnl
+)
+
 AC_CONFIG_FILES([Makefile tests/Makefile])
 AC_OUTPUT
diff --git a/mingw-w64-libraries/winpthreads/include/pthread_compat.h b/mingw-w64-libraries/winpthreads/include/pthread_compat.h
index 3a85528..b682a3a 100644
--- a/mingw-w64-libraries/winpthreads/include/pthread_compat.h
+++ b/mingw-w64-libraries/winpthreads/include/pthread_compat.h
@@ -66,18 +66,12 @@
 #define WINPTHREADS_TIME_BITS 64
 #endif
 
-#if defined(IN_WINPTHREAD)
-#  if defined(DLL_EXPORT)
-#    define WINPTHREAD_API  __declspec(dllexport)  /* building the DLL  */
-#  else
-#    define WINPTHREAD_API  /* building the static library  */
-#  endif
-#else
-#  if defined(WINPTHREADS_USE_DLLIMPORT)
-#    define WINPTHREAD_API  __declspec(dllimport)  /* user wants explicit `dllimport`  */
-#  else
-#    define WINPTHREAD_API  /* the default; auto imported in case of DLL  */
-#  endif
+#ifndef WINPTHREAD_API
+# ifdef WINPTHREADS_USE_DLLIMPORT
+#  define WINPTHREAD_API  __declspec(dllimport)
+# else
+#  define WINPTHREAD_API
+# endif
 #endif
 
 #ifndef __clockid_t_defined