Install jpeg62.dll in SDK directory, not Windows system directory.  Also, check whether SDK is already installed prior to re-installing


git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@153 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/README-turbo.txt b/README-turbo.txt
index 684f9f4..4704114 100755
--- a/README-turbo.txt
+++ b/README-turbo.txt
@@ -66,11 +66,19 @@
 system.
 
 The Windows version of libjpeg-turbo installs jpeg62.dll into
-%systemroot%\system32.  However, if jpeg62.dll also exists in an application's
-install directory, then Windows will load the application's version of it
-first.  Thus, if an application ships with jpeg62.dll, then back up the
-application's version of jpeg62.dll and copy %systemroot%\system32\jpeg62.dll
-into the application's install directory to accelerate it.
+c:\libjpeg-turbo\bin, and the PATH environment variable can be modified such
+that this directory is searched before any others that might contain
+jpeg62.dll.  However, if jpeg62.dll also exists in an application's install
+directory, then Windows will load the application's version of it first.  Thus,
+if an application ships with jpeg62.dll, then back up the application's version
+of jpeg62.dll and copy c:\libjpeg-turbo\bin\jpeg62.dll into the application's
+install directory to accelerate it.
+
+libjpeg-turbo's version of jpeg62.dll requires the Visual C++ 2008 C run time
+DLL (msvcr90.dll).  This library ships with more recent versions of Windows,
+but users of older versions can obtain it from the Visual C++ 2008
+Redistributable Package, which is available as a free download from Microsoft's
+web site.
 
 Mac applications typically embed their own copies of libjpeg.62.dylib inside
 the (hidden) application bundle, so it is not possible to globally replace
diff --git a/release/libjpeg-turbo.nsi b/release/libjpeg-turbo.nsi
index 6142d66..28c6d56 100644
--- a/release/libjpeg-turbo.nsi
+++ b/release/libjpeg-turbo.nsi
@@ -12,12 +12,31 @@
 
 Section "libjpeg-turbo SDK for ${PLATFORM} (required)"
 	SectionIn RO
+!ifdef GCC
+	IfFileExists $SYSDIR/libturbojpeg.dll exists 0
+!else
+	IfFileExists $SYSDIR/turbojpeg.dll exists 0
+!endif
+	goto notexists
+	exists:
+!ifdef GCC
+	MessageBox MB_OK "An existing version of the libjpeg-turbo SDK for ${PLATFORM} is already installed.  Please uninstall it first."
+!else
+	MessageBox MB_OK "An existing version of the libjpeg-turbo SDK for ${PLATFORM} or the TurboJPEG SDK is already installed.  Please uninstall it first."
+!endif
+	quit
+
+	notexists:
 	SetOutPath $SYSDIR
 !ifdef GCC
 	File "${WLIBDIR}\libturbojpeg.dll"
-	File "${WLIBDIR}\libjpeg-62.dll"
 !else
 	File "${WLIBDIR}\turbojpeg.dll"
+!endif
+	SetOutPath $INSTDIR\bin
+!ifdef GCC
+	File "${WLIBDIR}\libjpeg-62.dll"
+!else
 	File "${WLIBDIR}\jpeg62.dll"
 !endif
 	SetOutPath $INSTDIR\lib
@@ -62,14 +81,14 @@
 	DeleteRegKey HKLM "SOFTWARE\${APPNAME} ${VERSION}"
 
 !ifdef GCC
-	Delete $SYSDIR\libjpeg-62.dll
+	Delete $INSTDIR\bin\libjpeg-62.dll
 	Delete $SYSDIR\libturbojpeg.dll
 	Delete $INSTDIR\lib\libturbojpeg.dll.a"
 	Delete $INSTDIR\lib\libturbojpeg.a"
 	Delete $INSTDIR\lib\libjpeg.dll.a"
 	Delete $INSTDIR\lib\libjpeg.a"
 !else
-	Delete $SYSDIR\jpeg62.dll
+	Delete $INSTDIR\bin\jpeg62.dll
 	Delete $SYSDIR\turbojpeg.dll
 	Delete $INSTDIR\lib\jpeg.lib
 	Delete $INSTDIR\lib\jpeg-static.lib
@@ -90,6 +109,7 @@
 
 	RMDir "$INSTDIR\include"
 	RMDir "$INSTDIR\lib"
+	RMDir "$INSTDIR\bin"
 	RMDir "$INSTDIR"
 
 SectionEnd