kernel32: Make win87em.dll into a stand-alone 16-bit module.
diff --git a/.gitignore b/.gitignore
index 908f8ae..52d76d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -118,7 +118,6 @@
 dlls/ver.dll16
 dlls/w32sys.dll16
 dlls/win32s16.dll16
-dlls/win87em.dll16
 dlls/winaspi.dll16
 dlls/windebug.dll16
 dlls/wineps16.drv16
diff --git a/configure b/configure
index 362d19a..a335b24 100755
--- a/configure
+++ b/configure
Binary files differ
diff --git a/configure.ac b/configure.ac
index f738f8d..133f239 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,6 +149,7 @@
     enable_vtdapi_vxd=${enable_vtdapi_vxd:-no}
     enable_vwin32_vxd=${enable_vwin32_vxd:-no}
     enable_w32skrnl=${enable_w32skrnl:-no}
+    enable_win87em_dll16=${enable_win87em_dll16:-no}
     enable_winedos=${enable_winedos:-no}
     enable_winevdm=${enable_winevdm:-no}
     enable_winhelp_exe16=${enable_winhelp_exe16:-no}
@@ -2217,6 +2218,7 @@
 WINE_CONFIG_MAKEFILE([dlls/vtdapi.vxd/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/vwin32.vxd/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/w32skrnl/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
+WINE_CONFIG_MAKEFILE([dlls/win87em.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/winealsa.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/wineaudioio.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/winecoreaudio.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index eeef5ff..8b1c14f 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -57,7 +57,6 @@
 	ver.dll16 \
 	w32sys.dll16 \
 	win32s16.dll16 \
-	win87em.dll16 \
 	winaspi.dll16 \
 	windebug.dll16 \
 	wineps16.drv16 \
@@ -90,7 +89,7 @@
 imm.dll16:
 	echo "imm32.dll" >$@
 
-comm.drv16 krnl386.exe16 system.drv16 toolhelp.dll16 win87em.dll16 windebug.dll16:
+comm.drv16 krnl386.exe16 system.drv16 toolhelp.dll16 windebug.dll16:
 	echo "kernel32.dll" >$@
 
 lzexpand.dll16:
diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in
index 467a576..3dec8f9 100644
--- a/dlls/kernel32/Makefile.in
+++ b/dlls/kernel32/Makefile.in
@@ -14,7 +14,6 @@
 	krnl386.exe.spec \
 	system.drv.spec \
 	toolhelp.spec \
-	win87em.spec \
 	windebug.spec
 
 C_SRCS = \
@@ -78,8 +77,7 @@
 	error16.c \
 	kernel16.c \
 	registry16.c \
-	toolhelp16.c \
-	win87em.c
+	toolhelp16.c
 
 RC_SRCS = kernel.rc
 
diff --git a/dlls/kernel32/win87em.spec b/dlls/kernel32/win87em.spec
deleted file mode 100644
index 968063e..0000000
--- a/dlls/kernel32/win87em.spec
+++ /dev/null
@@ -1,4 +0,0 @@
-1 pascal -register _fpMath() WIN87_fpmath
-3 pascal -ret16 __WinEm87Info(ptr word) WIN87_WinEm87Info
-4 pascal -ret16 __WinEm87Restore(ptr word) WIN87_WinEm87Restore
-5 pascal -ret16 __WinEm87Save(ptr word) WIN87_WinEm87Save
diff --git a/dlls/win87em.dll16/Makefile.in b/dlls/win87em.dll16/Makefile.in
new file mode 100644
index 0000000..929361d
--- /dev/null
+++ b/dlls/win87em.dll16/Makefile.in
@@ -0,0 +1,15 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = win87em.dll16
+IMPORTS   = kernel32
+EXTRADLLFLAGS = -Wb,--subsystem,win16
+
+SPEC_SRCS = win87em.dll16.spec
+
+C_SRCS = win87em.c
+
+@MAKE_DLL_RULES@
+
+@DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/kernel32/win87em.c b/dlls/win87em.dll16/win87em.c
similarity index 90%
rename from dlls/kernel32/win87em.c
rename to dlls/win87em.dll16/win87em.c
index 416d055..35a04c4 100644
--- a/dlls/kernel32/win87em.c
+++ b/dlls/win87em.dll16/win87em.c
@@ -57,7 +57,7 @@
 static WORD StackBottom = 0;
 static WORD Inthandler02hVar = 1;
 
-static void WIN87_ClearCtrlWord( CONTEXT86 *context )
+static void WIN87_ClearCtrlWord( CONTEXT *context )
 {
     context->Eax &= ~0xffff;  /* set AX to 0 */
     if (Installed)
@@ -69,7 +69,7 @@
     StatusWord_3 = StatusWord_2 = 0;
 }
 
-static void WIN87_SetCtrlWord( CONTEXT86 *context )
+static void WIN87_SetCtrlWord( CONTEXT *context )
 {
     CtrlWord_1 = LOWORD(context->Eax);
     context->Eax &= ~0x00c3;
@@ -82,7 +82,7 @@
     CtrlWord_2 = LOWORD(context->Eax);
 }
 
-static void WIN87_Init( CONTEXT86 *context )
+static void WIN87_Init( CONTEXT *context )
 {
     if (Installed) {
 #ifdef __i386__
@@ -99,12 +99,11 @@
 /***********************************************************************
  *		_fpMath (WIN87EM.1)
  */
-void WINAPI WIN87_fpmath( CONTEXT86 *context )
+void WINAPI _fpMath( CONTEXT *context )
 {
-    TRACE("(cs:eip=%x:%x es=%x bx=%04x ax=%04x dx=%04x)\n",
-                 (WORD)context->SegCs, context->Eip,
-                 (WORD)context->SegEs, (WORD)context->Ebx,
-                 (WORD)context->Eax, (WORD)context->Edx );
+    TRACE("(cs:eip=%04x:%04x es=%04x bx=%04x ax=%04x dx=%04x)\n",
+          context->SegCs, context->Eip, context->SegEs, context->Ebx,
+          context->Eax, context->Edx );
 
     switch(LOWORD(context->Ebx))
     {
@@ -224,8 +223,7 @@
 /***********************************************************************
  *		__WinEm87Info (WIN87EM.3)
  */
-void WINAPI WIN87_WinEm87Info(struct Win87EmInfoStruct *pWIS,
-                              int cbWin87EmInfoStruct)
+void WINAPI __WinEm87Info(struct Win87EmInfoStruct *pWIS, int cbWin87EmInfoStruct)
 {
   FIXME("(%p,%d), stub !\n",pWIS,cbWin87EmInfoStruct);
 }
@@ -233,8 +231,7 @@
 /***********************************************************************
  *		__WinEm87Restore (WIN87EM.4)
  */
-void WINAPI WIN87_WinEm87Restore(void *pWin87EmSaveArea,
-                                 int cbWin87EmSaveArea)
+void WINAPI __WinEm87Restore(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
 {
   FIXME("(%p,%d), stub !\n",
 	pWin87EmSaveArea,cbWin87EmSaveArea);
@@ -243,7 +240,7 @@
 /***********************************************************************
  *		__WinEm87Save (WIN87EM.5)
  */
-void WINAPI WIN87_WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
+void WINAPI __WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
 {
   FIXME("(%p,%d), stub !\n",
 	pWin87EmSaveArea,cbWin87EmSaveArea);
diff --git a/dlls/win87em.dll16/win87em.dll16.spec b/dlls/win87em.dll16/win87em.dll16.spec
new file mode 100644
index 0000000..0b9024c
--- /dev/null
+++ b/dlls/win87em.dll16/win87em.dll16.spec
@@ -0,0 +1,4 @@
+1 pascal -register _fpMath() _fpMath
+3 pascal -ret16 __WinEm87Info(ptr word) __WinEm87Info
+4 pascal -ret16 __WinEm87Restore(ptr word) __WinEm87Restore
+5 pascal -ret16 __WinEm87Save(ptr word) __WinEm87Save