diff --git a/src/MAKE/MACHINES/Makefile.mingw32-cross b/src/MAKE/MACHINES/Makefile.mingw32-cross
index a5b338a32..54360462c 100644
--- a/src/MAKE/MACHINES/Makefile.mingw32-cross
+++ b/src/MAKE/MACHINES/Makefile.mingw32-cross
@@ -1,122 +1,122 @@
 # mingw32-cross = Win 32-bit, gcc-4.7.1, MinGW, internal FFT, no MPI, OpenMP
 
 SHELL = /bin/sh
 
 # ---------------------------------------------------------------------
 # compiler/linker settings
 # specify flags and libraries needed for your compiler
 
 CC =		i686-w64-mingw32-g++
 CCFLAGS =	-O3 -march=i686 -mtune=generic -mfpmath=387 -mpc64 -fopenmp	\
 		-ffast-math -fstrict-aliasing -Wall -W -Wno-uninitialized
 
 SHFLAGS =	# -fPIC (not needed on windows, all code is PIC)
 DEPFLAGS =	-M
 
-LINK =		i686-w64-mingw32-g++
+LINK =		i686-w64-mingw32-g++ -static
 LINKFLAGS =	-O2 -march=i686 -mtune=generic -mfpmath=387 -mpc64 -fopenmp
 LIB =           -lwsock32 -static-libgcc
 SIZE =		i686-w64-mingw32-size
 
 ARCHIVE =	i686-w64-mingw32-ar
 ARFLAGS =	-rc
 SHLIBFLAGS =	-shared
 
 # name of object file subdir for libraries in lib with leading '/'
 LIBOBJDIR = 	/Obj_mingw32
 
 # ---------------------------------------------------------------------
 # LAMMPS-specific settings, all OPTIONAL
 # specify settings for LAMMPS features you will use
 # if you change any -D setting, do full re-compile after "make clean"
 
 # LAMMPS ifdef settings
 # see possible settings in Section 2.2 (step 4) of manual
 
 LMP_INC =	-DLAMMPS_SMALLSMALL -DLAMMPS_JPEG -DLAMMPS_PNG -DLAMMPS_XDR -DLAMMPS_GZIP -DLAMMPS_FFMPEG
 
 # MPI library
 # see discussion in Section 2.2 (step 5) of manual
 # MPI wrapper compiler/linker can provide this info
 # can point to dummy MPI library in src/STUBS as in Makefile.serial
 # use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts
 # INC = path for mpi.h, MPI compiler settings
 # PATH = path for MPI library
 # LIB = name of MPI library
 
 MPI_INC =       -I../STUBS
 MPI_PATH =      -L../STUBS
 MPI_LIB =	-lmpi_mingw32
 
 # FFT library
 # see discussion in Section 2.2 (step 6) of manaul
 # can be left blank to use provided KISS FFT library
 # INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings
 # PATH = path for FFT library
 # LIB = name of FFT library
 
 FFT_INC =
 FFT_PATH = 
 FFT_LIB =
 
 # JPEG and/or PNG library
 # see discussion in Section 2.2 (step 7) of manual
 # only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC
 # INC = path(s) for jpeglib.h and/or png.h
 # PATH = path(s) for JPEG library and/or PNG library
 # LIB = name(s) of JPEG library and/or PNG library
 
 JPG_INC =       
 JPG_PATH = 	
-JPG_LIB =	-Wl,-Bstatic,-ljpeg,-lpng,-lz,-Bdynamic
+JPG_LIB =	-ljpeg -lpng -lz
 
 # ---------------------------------------------------------------------
 # build rules and dependencies
 # do not edit this section
 
 include	Makefile.package.settings
 include	Makefile.package
 
 EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
 EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
 EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
 
 # Path to src files
 
 vpath %.cpp ..
 vpath %.h ..
 
 # Link target
 
 $(EXE):	$(OBJ)
 	$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
 	$(SIZE) $(EXE)
 
 # Library targets
 
 lib:	$(OBJ)
 	$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
 
 shlib:	$(OBJ)
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \
         $(OBJ) $(EXTRA_LIB) $(LIB)
 
 # Compilation rules
 
 %.o:%.cpp
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
 
 %.d:%.cpp
 	$(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@
 
 %.o:%.cu
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
 
 # Individual dependencies
 
 DEPENDS = $(OBJ:.o=.d)
 sinclude $(DEPENDS)
 
 # Local Variables:
 # mode: makefile
 # End:
diff --git a/src/MAKE/MACHINES/Makefile.mingw32-cross-mpi b/src/MAKE/MACHINES/Makefile.mingw32-cross-mpi
index 593c23aa5..19b44a055 100644
--- a/src/MAKE/MACHINES/Makefile.mingw32-cross-mpi
+++ b/src/MAKE/MACHINES/Makefile.mingw32-cross-mpi
@@ -1,122 +1,122 @@
 # mingw32-cross-mpi = Win 32-bit, gcc-4.7.1, MinGW, internal FFT, MPICH2, OpenMP
 
 SHELL = /bin/sh
 
 # ---------------------------------------------------------------------
 # compiler/linker settings
 # specify flags and libraries needed for your compiler
 
 CC =		i686-w64-mingw32-g++
 CCFLAGS =	-O3 -march=i686 -mtune=generic -mfpmath=387 -mpc64 -fopenmp	\
 		-ffast-math -fstrict-aliasing -Wall -W -Wno-uninitialized
 
 SHFLAGS =	# -fPIC (not needed on windows, all code is PIC)
 DEPFLAGS =	-M
 
-LINK =		i686-w64-mingw32-g++ -v
+LINK =		i686-w64-mingw32-g++ -static
 LINKFLAGS =	-O2 -march=i686 -mtune=generic -mfpmath=387 -mpc64 -fopenmp 
 LIB =           -lwsock32 -static-libgcc
 SIZE =		i686-w64-mingw32-size
 
 ARCHIVE =	i686-w64-mingw32-ar
 ARFLAGS =	-rc
 SHLIBFLAGS =	-shared
 
 # name of object file subdir for libraries in lib with leading '/'
 LIBOBJDIR = 	/Obj_mingw32-mpi
 
 # ---------------------------------------------------------------------
 # LAMMPS-specific settings, all OPTIONAL
 # specify settings for LAMMPS features you will use
 # if you change any -D setting, do full re-compile after "make clean"
 
 # LAMMPS ifdef settings
 # see possible settings in Section 2.2 (step 4) of manual
 
 LMP_INC =	-DLAMMPS_SMALLSMALL -DLAMMPS_JPEG -DLAMMPS_PNG -DLAMMPS_XDR -DLAMMPS_GZIP -DLAMMPS_FFMPEG
 
 # MPI library
 # see discussion in Section 2.2 (step 5) of manual
 # MPI wrapper compiler/linker can provide this info
 # can point to dummy MPI library in src/STUBS as in Makefile.serial
 # use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts
 # INC = path for mpi.h, MPI compiler settings
 # PATH = path for MPI library
 # LIB = name of MPI library
 
 MPI_INC =       -I../../tools/mingw-cross/mpich2-win32/include
 MPI_PATH =      -L../../tools/mingw-cross/mpich2-win32/lib
 MPI_LIB =	-lmpi
 
 # FFT library
 # see discussion in Section 2.2 (step 6) of manaul
 # can be left blank to use provided KISS FFT library
 # INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings
 # PATH = path for FFT library
 # LIB = name of FFT library
 
 FFT_INC =
 FFT_PATH = 
 FFT_LIB =
 
 # JPEG and/or PNG library
 # see discussion in Section 2.2 (step 7) of manual
 # only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC
 # INC = path(s) for jpeglib.h and/or png.h
 # PATH = path(s) for JPEG library and/or PNG library
 # LIB = name(s) of JPEG library and/or PNG library
 
 JPG_INC =       
 JPG_PATH = 	
-JPG_LIB =	-Wl,-Bstatic,-ljpeg,-lpng,-lz,-Bdynamic
+JPG_LIB =	-ljpeg -lpng -lz
 
 # ---------------------------------------------------------------------
 # build rules and dependencies
 # do not edit this section
 
 include	Makefile.package.settings
 include	Makefile.package
 
 EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
 EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
 EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
 
 # Path to src files
 
 vpath %.cpp ..
 vpath %.h ..
 
 # Link target
 
 $(EXE):	$(OBJ)
 	$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
 	$(SIZE) $(EXE)
 
 # Library targets
 
 lib:	$(OBJ)
 	$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
 
 shlib:	$(OBJ)
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \
         $(OBJ) $(EXTRA_LIB) $(LIB)
 
 # Compilation rules
 
 %.o:%.cpp
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
 
 %.d:%.cpp
 	$(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@
 
 %.o:%.cu
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
 
 # Individual dependencies
 
 DEPENDS = $(OBJ:.o=.d)
 sinclude $(DEPENDS)
 
 # Local Variables:
 # mode: makefile
 # End:
diff --git a/src/MAKE/MACHINES/Makefile.mingw64-cross b/src/MAKE/MACHINES/Makefile.mingw64-cross
index 5ca0bfe0d..9791c73c3 100644
--- a/src/MAKE/MACHINES/Makefile.mingw64-cross
+++ b/src/MAKE/MACHINES/Makefile.mingw64-cross
@@ -1,122 +1,122 @@
 # mingw64-cross = Win 64-bit, gcc-4.7.1, MinGW, internal FFT, no MPI, OpenMP
 
 SHELL = /bin/sh
 
 # ---------------------------------------------------------------------
 # compiler/linker settings
 # specify flags and libraries needed for your compiler
 
 CC =		x86_64-w64-mingw32-g++
 CCFLAGS =	-O3 -march=core2 -mtune=core2 -mpc64 -msse2 -fopenmp	\
 		-ffast-math -fstrict-aliasing -Wall -W -Wno-uninitialized
 
 SHFLAGS =	# -fPIC (not needed on windows, all code is PIC)
 DEPFLAGS =	-M
 
-LINK =		x86_64-w64-mingw32-g++
+LINK =		x86_64-w64-mingw32-g++ -static
 LINKFLAGS =	-O2 -march=core2 -mtune=core2 -mpc64 -msse2 -fopenmp
 LIB =           -lwsock32 -static-libgcc
 SIZE =		x86_64-w64-mingw32-size
 
 ARCHIVE =	x86_64-w64-mingw32-ar
 ARFLAGS =	-rc
 SHLIBFLAGS =	-shared
 
 # name of object file subdir for libraries in lib with leading '/'
 LIBOBJDIR = 	/Obj_mingw64
 
 # ---------------------------------------------------------------------
 # LAMMPS-specific settings, all OPTIONAL
 # specify settings for LAMMPS features you will use
 # if you change any -D setting, do full re-compile after "make clean"
 
 # LAMMPS ifdef settings
 # see possible settings in Section 2.2 (step 4) of manual
 
 LMP_INC =	-DLAMMPS_SMALLBIG -DLAMMPS_JPEG -DLAMMPS_PNG -DLAMMPS_XDR -DLAMMPS_GZIP -DLAMMPS_FFMPEG
 
 # MPI library
 # see discussion in Section 2.2 (step 5) of manual
 # MPI wrapper compiler/linker can provide this info
 # can point to dummy MPI library in src/STUBS as in Makefile.serial
 # use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts
 # INC = path for mpi.h, MPI compiler settings
 # PATH = path for MPI library
 # LIB = name of MPI library
 
 MPI_INC =       -I../STUBS
 MPI_PATH =      -L../STUBS
 MPI_LIB =	-lmpi_mingw64
 
 # FFT library
 # see discussion in Section 2.2 (step 6) of manaul
 # can be left blank to use provided KISS FFT library
 # INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings
 # PATH = path for FFT library
 # LIB = name of FFT library
 
 FFT_INC =
 FFT_PATH = 
 FFT_LIB =
 
 # JPEG and/or PNG library
 # see discussion in Section 2.2 (step 7) of manual
 # only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC
 # INC = path(s) for jpeglib.h and/or png.h
 # PATH = path(s) for JPEG library and/or PNG library
 # LIB = name(s) of JPEG library and/or PNG library
 
 JPG_INC =       
 JPG_PATH = 	
-JPG_LIB =	-Wl,-Bstatic,-ljpeg,-lpng,-lz,-Bdynamic
+JPG_LIB =	-ljpeg -lpng -lz
 
 # ---------------------------------------------------------------------
 # build rules and dependencies
 # do not edit this section
 
 include	Makefile.package.settings
 include	Makefile.package
 
 EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
 EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
 EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
 
 # Path to src files
 
 vpath %.cpp ..
 vpath %.h ..
 
 # Link target
 
 $(EXE):	$(OBJ)
 	$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
 	$(SIZE) $(EXE)
 
 # Library targets
 
 lib:	$(OBJ)
 	$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
 
 shlib:	$(OBJ)
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \
         $(OBJ) $(EXTRA_LIB) $(LIB)
 
 # Compilation rules
 
 %.o:%.cpp
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
 
 %.d:%.cpp
 	$(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@
 
 %.o:%.cu
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
 
 # Individual dependencies
 
 DEPENDS = $(OBJ:.o=.d)
 sinclude $(DEPENDS)
 
 # Local Variables:
 # mode: makefile
 # End:
diff --git a/src/MAKE/MACHINES/Makefile.mingw64-cross-mpi b/src/MAKE/MACHINES/Makefile.mingw64-cross-mpi
index 86a4b3783..ccde7d445 100644
--- a/src/MAKE/MACHINES/Makefile.mingw64-cross-mpi
+++ b/src/MAKE/MACHINES/Makefile.mingw64-cross-mpi
@@ -1,122 +1,122 @@
 # mingw64-cross-mpi = Win 64-bit, gcc-4.7.1, MinGW, internal FFT, MPICH2, OpenMP
 
 SHELL = /bin/sh
 
 # ---------------------------------------------------------------------
 # compiler/linker settings
 # specify flags and libraries needed for your compiler
 
 CC =		x86_64-w64-mingw32-g++
 CCFLAGS =	-O3 -march=core2 -mtune=core2 -mpc64 -msse2 -fopenmp	\
 		-ffast-math -fstrict-aliasing -Wall -W -Wno-uninitialized
 
 SHFLAGS =	# -fPIC (not needed on windows, all code is PIC)
 DEPFLAGS =	-M
 
-LINK =		x86_64-w64-mingw32-g++
+LINK =		x86_64-w64-mingw32-g++ -static
 LINKFLAGS =	-O2 -march=core2 -mtune=core2 -mpc64 -msse2 -fopenmp
 LIB =           -lwsock32 -static-libgcc
 SIZE =		x86_64-w64-mingw32-size
 
 ARCHIVE =	x86_64-w64-mingw32-ar
 ARFLAGS =	-rc
 SHLIBFLAGS =	-shared
 
 # name of object file subdir for libraries in lib with leading '/'
 LIBOBJDIR = 	/Obj_mingw64-mpi
 
 # ---------------------------------------------------------------------
 # LAMMPS-specific settings, all OPTIONAL
 # specify settings for LAMMPS features you will use
 # if you change any -D setting, do full re-compile after "make clean"
 
 # LAMMPS ifdef settings
 # see possible settings in Section 2.2 (step 4) of manual
 
 LMP_INC =	-DLAMMPS_SMALLBIG -DLAMMPS_JPEG -DLAMMPS_PNG -DLAMMPS_XDR -DLAMMPS_GZIP -DLAMMPS_FFMPEG
 
 # MPI library
 # see discussion in Section 2.2 (step 5) of manual
 # MPI wrapper compiler/linker can provide this info
 # can point to dummy MPI library in src/STUBS as in Makefile.serial
 # use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts
 # INC = path for mpi.h, MPI compiler settings
 # PATH = path for MPI library
 # LIB = name of MPI library
 
 MPI_INC =       -I../../tools/mingw-cross/mpich2-win64/include
 MPI_PATH =      -L../../tools/mingw-cross/mpich2-win64/lib
 MPI_LIB =	-lmpi
 
 # FFT library
 # see discussion in Section 2.2 (step 6) of manaul
 # can be left blank to use provided KISS FFT library
 # INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings
 # PATH = path for FFT library
 # LIB = name of FFT library
 
 FFT_INC =
 FFT_PATH = 
 FFT_LIB =
 
 # JPEG and/or PNG library
 # see discussion in Section 2.2 (step 7) of manual
 # only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC
 # INC = path(s) for jpeglib.h and/or png.h
 # PATH = path(s) for JPEG library and/or PNG library
 # LIB = name(s) of JPEG library and/or PNG library
 
 JPG_INC =       
 JPG_PATH = 	
-JPG_LIB =	-Wl,-Bstatic,-ljpeg,-lpng,-lz,-Bdynamic
+JPG_LIB =	-ljpeg -lpng -lz
 
 # ---------------------------------------------------------------------
 # build rules and dependencies
 # do not edit this section
 
 include	Makefile.package.settings
 include	Makefile.package
 
 EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
 EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
 EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
 
 # Path to src files
 
 vpath %.cpp ..
 vpath %.h ..
 
 # Link target
 
 $(EXE):	$(OBJ)
 	$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
 	$(SIZE) $(EXE)
 
 # Library targets
 
 lib:	$(OBJ)
 	$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
 
 shlib:	$(OBJ)
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \
         $(OBJ) $(EXTRA_LIB) $(LIB)
 
 # Compilation rules
 
 %.o:%.cpp
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
 
 %.d:%.cpp
 	$(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@
 
 %.o:%.cu
 	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
 
 # Individual dependencies
 
 DEPENDS = $(OBJ:.o=.d)
 sinclude $(DEPENDS)
 
 # Local Variables:
 # mode: makefile
 # End:
diff --git a/tools/mingw-cross/lammps.nsis b/tools/mingw-cross/lammps.nsis
index 166ced3e9..cc3e80576 100644
--- a/tools/mingw-cross/lammps.nsis
+++ b/tools/mingw-cross/lammps.nsis
@@ -1,162 +1,157 @@
 #!Nsis Installer Command Script
 #
 # The following external defines are recognized:
 # ${VERSION} = YYYYMMDD
 # ${BIT}     = 32 or 64
 # ${LIBGCC}  = name of libgcc dll file to use
 # ${MINGW}   = <path to mingw windows dlls>
 
 !include "LogicLib.nsh"
 !include "EnvVarUpdate.nsh"
 !include "x64.nsh"
 
 RequestExecutionLevel admin
 
 !macro VerifyUserIsAdmin
 UserInfo::GetAccountType
 pop $0
 ${If} $0 != "admin"
    messageBox mb_iconstop "Administrator rights required!"
    setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
    quit
 ${EndIf}
 !macroend
 
 !macro CreateInternetShortcut FILENAME URL ICONFILE ICONINDEX
 WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
 WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconFile" "${ICONFILE}"
 WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconIndex" "${ICONINDEX}"
 !macroend
 
 !ifndef LIBGCC
 !define LIBGCC libgcc_s_sjlj-1.dll
 !endif
 
 !define LAMMPS "LAMMPS ${BIT}-bit ${VERSION}"
 OutFile "${BIT}bit/lammps-${BIT}bit-${VERSION}.exe"
 
 Name "${LAMMPS}"
 !if ${BIT} == 64
 InstallDir "$ProgramFiles64\${LAMMPS}"
 !define MPICHDIR "$ProgramFiles64\MPICH2\bin"
 !else
 InstallDir "$ProgramFiles\${LAMMPS}"
 !define MPICHDIR "$ProgramFiles\MPICH2\bin"
 !endif
 
 XPStyle on
 ShowInstDetails show
 ShowUninstDetails show
 SetCompressor lzma
 
 Page directory
 Page instfiles
 
 DirText "Please select the LAMMPS installation folder."
 
 function .onInit
   setShellVarContext all
 !insertmacro VerifyUserIsAdmin
 functionEnd
 
 Section "${LAMMPS}"
   SectionIn RO
   SetRegView ${BIT}
 
   CreateDirectory "$SMPROGRAMS\${LAMMPS}"
   CreateShortCut  "$SMPROGRAMS\${LAMMPS}\Uninstall.lnk"      "$INSTDIR\Uninstall.exe"          "" ""
   CreateShortCut  "$SMPROGRAMS\${LAMMPS}\README.lnk"         "$INSTDIR\README.txt"             "" ""
   CreateShortCut  "$SMPROGRAMS\${LAMMPS}\LAMMPS Manual.lnk"  "$INSTDIR\doc\LAMMPS-Manual.pdf"  "" ""
   CreateShortCut  "$SMPROGRAMS\${LAMMPS}\Colvars Manual.lnk" "$INSTDIR\doc\Colvars-Manual.pdf" "" ""
   CreateShortCut  "$SMPROGRAMS\${LAMMPS}\CreatAtoms Manual.lnk" "$INSTDIR\doc\CreateAtoms-Manual.pdf" "" ""
   CreateShortCut  "$SMPROGRAMS\${LAMMPS}\Benchmarks.lnk"     "$WINDIR\explorer.exe"  \
                                                              '/e,"$INSTDIR\Benchmarks"'  ""
   CreateShortCut  "$SMPROGRAMS\${LAMMPS}\Examples.lnk"       "$WINDIR\explorer.exe"    \
                                                              '/e,"$INSTDIR\Examples"'    ""
   CreateShortCut  "$SMPROGRAMS\${LAMMPS}\LICENSE.lnk"        "$INSTDIR\LICENSE.txt"            "" ""
 
 !insertmacro CreateInternetShortcut "$SMPROGRAMS\${LAMMPS}\LAMMPS WWW Site" \
   "http://lammps.sandia.gov" "" "0"
 !insertmacro CreateInternetShortcut "$SMPROGRAMS\${LAMMPS}\LAMMPS Commands" \
   "http://lammps.sandia.gov/doc/Section_commands.html#cmd_5" "" "0"
 
   SetOutPath "$INSTDIR"
   CreateDirectory "$INSTDIR\bin"
   CreateDirectory "$INSTDIR\Doc"
   CreateDirectory "$INSTDIR\Benchmarks"
   CreateDirectory "$INSTDIR\Examples"
   CreateDirectory "$INSTDIR\Potentials"
   CreateDirectory "$INSTDIR\frc_files"
 
   File /oname=License.txt lammps-current/LICENSE
   File /oname=README.txt  lammps-current/README
 
   SetOutPath "$INSTDIR\bin"
   File ${MINGW}/${LIBGCC}
-  File ${MINGW}/libgfortran-3.dll
-  File ${MINGW}/libgomp-1.dll
-  File ${MINGW}/libquadmath-0.dll
-  File ${MINGW}/libstdc++-6.dll
-  File ${MINGW}/pthreadGC2.dll
 
   File mingw${BIT}/*.exe
   File mingw${BIT}/*.dll
 
   SetOutPath "$INSTDIR\Doc"
   File /oname=LAMMPS-Manual.pdf  lammps-current/doc/Manual.pdf
   File /oname=Colvars-Manual.pdf lammps-current/doc/PDF/colvars-refman-lammps.pdf
   File /oname=CreateAtoms-Manual.pdf  lammps-current/tools/createatoms/Manual.pdf
 
   SetOutPath "$INSTDIR\Potentials"
   File lammps-current/potentials/*
 
   SetOutPath "$INSTDIR\Examples"
   File /r /x log.*.4 lammps-current/examples/*
 
   SetOutPath "$INSTDIR\frc_files"
   File /oname=README-msi2lmp.txt lammps-current/tools/msi2lmp/README.txt
   File /r lammps-current/tools/msi2lmp/frc_files/*
 
   SetOutPath "$INSTDIR\Benchmarks"
   File /r /x log.*.4 lammps-current/bench/*
 
   ${EnvVarUpdate} $0 "PATH"              "A" "HKLM" "${MPICHDIR}"
   ${EnvVarUpdate} $0 "PATH"              "A" "HKLM" "$INSTDIR\bin"
   ${EnvVarUpdate} $0 "LAMMPS_POTENTIALS" "A" "HKLM" "$INSTDIR\Potentials"
   ${EnvVarUpdate} $0 "MSI2LMP_LIBRARY"    "A" "HKLM" "$INSTDIR\frc_files"
 SectionEnd
 
 function un.onInit
   SetShellVarContext all
 !insertmacro VerifyUserIsAdmin
 functionEnd
 
 Section "Uninstall"
   SetRegView ${BIT}
 
   ${un.EnvVarUpdate} $0 "PATH"              "R" "HKLM" "${MPICHDIR}"
   ${un.EnvVarUpdate} $0 "PATH"              "R" "HKLM" "$INSTDIR\bin"
   ${un.EnvVarUpdate} $0 "LAMMPS_POTENTIALS" "R" "HKLM" "$INSTDIR\Potentials"
   ${un.EnvVarUpdate} $0 "MSI2LMP_LIBRARY"    "R" "HKLM" "$INSTDIR\frc_files"
 
   RMDir /r "$SMPROGRAMS\${LAMMPS}"
 
   Delete /REBOOTOK   "$INSTDIR\*.txt"
   Delete /REBOOTOK   "$INSTDIR\Uninstall.exe"
   RMDir /r /REBOOTOK "$INSTDIR\bin"
   RMDir /r /REBOOTOK "$INSTDIR\Benchmarks"
   RMDir /r /REBOOTOK "$INSTDIR\Doc"
   RMDir /r /REBOOTOK "$INSTDIR\Examples"
   RMDir /r /REBOOTOK "$INSTDIR\Potentials"
   RMDir /r /REBOOTOK "$INSTDIR\frc_files"
   RMDir /REBOOTOK "$INSTDIR"
 SectionEnd
 
 Section -post
   SetRegView ${BIT}
   WriteUninstaller "$INSTDIR\Uninstall.exe"
 SectionEnd
 
 # Local Variables:
 # mode: sh
 # End: