1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
The following instructions assume that you already set up Cygwin/Msys
to know about the Microsoft 'cl' compiler and 'nmake'.
1. Download the f2c.exe Fortran to C compiler from netlib from
http://www.netlib.org/f2c/mswin/f2c.exe.gz
uncompress it, and put it somewhere in your PATH (e.g. into
/usr/local/bin). Make sure it is executable.
2. Download the source code for the f2c runtime library from
http://www.netlib.org/f2c/libf2c.zip
and put it into a directory in which you want to have a subdirectory
where you want to have the subdirectory "libf2c" containing the
runtime library, e.g., into /usr/local/lib. Uncompress this file,
for example by "unzip libf2c.zip" in a Cygwin or MSys window.
3. Compile the Fortran runtime library:
In the source directory (libf2c), type 'nmake -f makefile.vc all'
If you encounter an error during the compilation of "err.c" due to
a missing unistd.h, edit the makefile.vc file and add -DNO_ISATTY
to the CFLAGS (line 9).
If you encounter an error during the compilation of "arithchk.c"
(involving the "comptry.bat" file), edit the makefile.vc file and
delete the word "comptry.bat" in the 4th from last line.
NOTE: If you want to generate debug code (using --enable-debug with
configure), you need to change the makefile.vc file: Change the
definition of CFLAGS so that it no longer contains '-Ot1' but
'-MTd' instead.
4. Edit the script "compile_f2c" in this directory so that the
variable "f2clibdir" at the beginning is set to the directory
containing the libf2c runtime library. (If you installed it in
/usr/local/lib as suggested above, it is already defined correctly.)
5. Put the compile_f2c script somewhere into your path, e.g., into
/usr/local/bin - make sure it is executable.
6. To test it, copy the lines at the end of this file into a Fortran
source file (say, bla.f), and type
compile_f2c -o f2ctest bla.f
Running the executable f2ctest.exe hopefully makes you happy.
---------------------- 8< ----------------
program test
write (*,*) "It works!"
end
|