Compiling the Source Code:
--------------------------

Well, for the moment, zsnes source may be a little hard to compile. Here 
is a quick guide (based on my own experience and on a doc written by zsKnight)
explaining how to compile zsnes. With these tools, I can build both dos and
win version, I hope it will also work for you

(slightly updated by stainless)


First, you need the following software:

DOS port: 
- NASM v0.98.39 or higher
- DJGPP v2 or higher, (GCC also installed) : http://www.delorie.com/djgpp/
                   using the zip picker, the default choices are ok if you
                   check C and C++ in the programming languages. You also need 
                   to get zlib which is available with the full distribution 
                   of djgpp. You can get it at :
                   ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/zlib112b.zip
- zlib : http://www.info-zip.org/pub/infozip/zlib/
- libpng : http://www.libpng.org/
                Build the static versions of both of these libraries using
                DJGPP and do a 'make install' to put them where DJGPP
                can find them.  Afterwards you can go ahead and delete
                the source for them from your hard drive.

Then to build the executable, go to the src directory and type:
make -f makefile.ms PLATFORM=dos

You may also want to compress zsnes.exe with upx (http://upx.sourceforge.net),
it will divide its size by 10.


DOS port cross compiling: 
-You need to get the DJGPP cross compiler and everything else mentioned above.
-You might need to edit makefile.ms and change 
     i386-pc-msdosdjgpp-gcc and i386-pc-msdosdjgpp-g++ to something else.

Then to build the executable, go to the src directory and type:
make -f makefile.ms PLATFORM=dos-cross

If you have any problems we will probably not help you as cross compiling
     is an advanced feature only for people who know what they are doing.

     

Windows port with MSVC: 
- GNU Make : it comes with djgpp
- NASM v0.98.39 : http://nasm.sf.net/
- MSVC++ 6.0 or higher : not freely available, you'll have to buy it
                   You need to run VCVARS32.BAT.  If you get an 
                   out of environment space error, type 'command /e:32768' 
                   (to create a new command.com entity with more 
                   environment space)
                   I have been able to successfully build ZSNES using the
                   Intel C++ drop-in replacement for Microsoft's C++ compiler
                   that comes with MSVC++ 5 and above.  Since ZSNES contains
                   relatively small amounts of C, I don't see how Intel's
                   compiler could provide any useful optimizations (maybe
                   for winlink.cpp?).
- DX8.0 SDK or higher : you can get it at microsoft.com. It is quite big.
                   Also, edit makefile.win to set the correct path to your 
                   SDK. I also had some problems with vc++ using its own 
                   (old) directx headers instead of the sdk headers. I replaced 
                   these old headers (in the include directory of vc++ dir) 
                   with the newer ones.
- zlib : http://www.info-zip.org/pub/infozip/zlib/
		   you need the Win9x/WinNT static library (the dll version 
		   doesn't seem to work with zsnes). Rename the static version 
		   to zlib.lib and put it somewhere where vc++ will find it 
		   (for example, the lib directory in vc++ dir).
- libpng : http://www.libpng.org/
            I'm not sure if the dynamically linked version of libpng
            will work with ZSNES.  To be safe I would recommend to just
            go ahead and build the static version.  Rename it to libpng.lib
            and put it somewhere where MSVC++ will find it (usually the
            lib subdirectory of your main MSVC++ directory).

Don't forget to set the correct path to the directx sdk in makefile.win!
Then to build the executable, go to the src directory and type:
make -f makefile.msvc

You may also want to compress zsnesw.exe with upx (http://upx.sourceforge.net),
it will divide its size by 10.


Windows port cross compiling: 
-You need to get the MinGW cross compiler and everything else mentioned 
     above with one exception. You need to get a copy of DirectX 8 or 
     higher for MinGW.
-You might need to edit makefile.ms and change 
     i586-mingw32msvc-gcc, i586-mingw32msvc-g++, and i586-mingw32msvc-windres
     to something else.

Then to build the executable, go to the src directory and type:
make -f makefile.ms PLATFORM=win32-cross

If you have any problems we will probably not help you as cross compiling
     is an advanced feature only for people who know what they are doing.

     
     
Linux/SDL/POSIX port:
I assume the standard development tools are installed (gcc, make, ...)
You'll also need : 
- SDL (Simple DirectMedia Layer) : check www.libsdl.org to grab SDL 1.2.0 or
                                   later. If you are using rpm packages, don't
                                   forget the -devel package.
- NASM v0.98.39 : http://nasm.sf.net/
- zlib : http://www.info-zip.org/pub/infozip/zlib/
                                   it is probably already installed on your 
                                   system, maybe you are just missing the 
                                   development headers. Check in the 
                                   packages available with your distribution 
                                   or go to the page above
- libpng : http://www.libpng.org/
                    You might also need libpng, ZSNES will compile without
                    PNG support but I have found doing so to make ZSNES
                    unstable for some weird reason.  If you don't have
                    libpng, either get it and install it or pass the
                    --without-png option to the 'configure' script.

Then to build the executable, go to the src directory and type:
sh ./autogen.sh && gmake && gmake install

Note: you require root to install zsnes to the the default (/usr/local/*) 
directory

Also Note: libpng (optional) needs to be recent, or zsnes will not use it 

You may also want to compress the zsnes executable with upx
(http://upx.sourceforge.net), it will divide its size by 10.
                                
