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