home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 22 gnu
/
22-gnu.zip
/
f77cmd.zip
/
f77
/
README.OS2
< prev
Wrap
Text File
|
1994-09-10
|
9KB
|
176 lines
Sat Sep 10 00:47:31 PST 1994
========
OVERVIEW
========
f77 is a bourne shell script that provides a command line interface
for compiling Fortran 77 source code by running the f2c Fortran to C
converter and the gcc/emx compiler for you automagically. [Although you
will need an OS/2 port of the UNIX bourne shell, you can still start it
from the stock OS/2 CMD.EXE shell if you like.] From the perspective of
the command line options and associated behavior of the script, it's
pretty much just like a "real" UNIX f77 compiler.
I hacked this from the "fc" script provided in the f2c distribution
from netlib. I renamed it to f77.cmd because fc is a builtin command to
the korn shell. Currently, the PD korn shell seems to be the best port
of any of the UNIX shells to OS/2 I've seen, so something had to give.
This script depends heavily on several UNIX applications. But don't
worry, all the required applications have been ported to OS/2, and are
freely available. If you don't happen to have these applications, you
will need to find and install them to get f77 to work on your system.
You must also configure f77 for your system by making some small changes
to the f77.cmd script itself with your favorite text editor.
=================
REQUIRED SOFTWARE
=================
Note that f77 is designed to work with the f2c Fortran to C converter
and gcc/emx compiler. The gcc/emx compiler is used to compile the C code
generated by the f2c converter into object code. So, the most important
items you will need installed on your system, are f2c and the gcc/emx
compiler! It is certainly possible to modify the f77.cmd script to work
with other compilers. However, I do not own any of the commercial C
compilers for OS/2, nor do I have any plans to purchase one, so you are
on your own in this regard. If you haven't used f2c before, I highly
recommend that you run through the whole process "by hand" a few times
before trying to install f77.
The next most important item you will need is a working OS/2 port of
a UNIX bourne shell. I used the port of the public domain korn shell in
my development (ksh49.zip from ftp-os2.nmsu.edu). I *strongly* recommend
that you use this shell. Others *may* work, but I have found that many
of the other ports of UNIX shells to OS/2 to have serious flaws, (no
flames intended, these ports are not an easy job!) For example, many of
them do *NOT* correctly return the exit code from a process, rendering
them completely useless for scripts like f77, or for use under a make
utility.
There are a few other UNIX tools that you will need, below is a
complete shopping list (with pointers to which files to grab from host
ftp-os2.nmsu.edu);
basename part of GNU shellutils, file 2_x/unix/gnusutil.zip
f2c f2c Fortran to C converter, file 2_x/unix/f2cbin.zip
gcc/emx gcc/emx C compiler, see file 2_x/unix/emx08h/install.doc
getopt source and executable *included* in this distribution!
ksh public domain korn shell, file 2_x/unix/ksh49.zip
rm also part of GNU shellutils, file 2_x/unix/gnusutil.zip
sed GNU sed, file 2_x/unix/gnused.zip
You'll also need the command line version of getopt. Since OS/2 ports
of this were not to be found anywhere, I did some hunting, and located
source code for it, written by AT&T, and released to the public domain.
(The enclosed source is an unmodified copy from the latest distribution
of smail for Linux. It builds fine under gcc/emx without any changes.)
To install the included executable, move or copy it to some directory in
your search path, or edit f77.cmd, and change the value assigned to the
PATH environment variable to include directory where you put getopt.exe.
=============
CONFIGURATION
=============
You will need to configure f77 for your system by editing f77.cmd
with a text editor such as vi. All configurations that might require any
changes are all grouped into a section of code that begins with the line
"# beg configuration section" and ends with "# end configuration section"
If you already know the UNIX bourne shell and want to get on with it,
just search f77.cmd for the string "LOCAL CONFIG", the comments should be
self explanatory. Move f77.cmd to a directory in your path and you'll be
all set.
To be more precise, here is a list of changes you'll need to make;
(1) You will need to decide where you want f77.cmd to reside in your
file system, and edit the very 1-st line to reflect your choice.
This is because the OS/2 CMD.EXE command processor, which passes
the file off to the ksh, does *NOT* pass the full path name of
f77.cmd, making it impossible for the korn shell to know where
the heck it is. Can you say Bogus? I'd bet money that this was
code written by Microsoft when they were involved in OS/2
development. At any rate, thank god they are now out of the
OS/2 picture!
(2) If all the required support executable are in your default path,
you can skip this step. If you want to "hide them" somewhere to
avoid conflicts, or just because you wouldn't ordinarily use
them, then uncomment, and edit the PATH variable to reflect where
you put them. Be careful to keep the syntax shown, don't leave
off the quotes, and don't use the OS/2 style backslash "\" in
the path.
(3) Find the line where the environment variable CFLAGS_F2C is being
assigned a value. Edit the argument to the -I flag to reflect
where your f2c.h header file is stored. If gcc automatically
knows where to find f2c.h, (ie: by virtue of it being in a
directory in the gcc environment variable C_INCLUDE_PATH), you
can just eliminate the -I flag and the directory argument.
If you changed the value of F2CFLAGS to change the type of C
code generated by f2c (ie: ANSI instead of K&R), you may have
to make corresponding adjustments to CFLAGS_F2C so the C code
compiles correctly.
(4) Find the lines where the environment variable METHOD1DEFLIBS and
METHOD2DEFLIBS are assigned values. These variables specify the
libraries to be used when linking EMX method 1 and 2 type
executables. Edit the argument to the -L flag to reflect the
directory where your f2c support library is stored. If gcc knows
where to find the f2c library, (ie: by virtue of it being in a
directory in the gcc environment variable LIBRARY_PATH ), you can
just eliminate the -L flag and the directory argument. If the
actual name of the library is not f2c, change the "-lf2c" to the
correct value. For EMX method 2 executables, you may want to use
my dynamic link support libraries, namely -lf2clib -lf2cdll.
The resulting executables will be roughly 30K smaller in size.
There IS one major difference with UNIX f77 compilers. Under UNIX, the
".F" file suffix is used to denote Fortran 77 code with C preprocessor
statements in it. This doesn't fly under OS/2 since you can't have a
file with both a ".F" and a ".f" suffix in the same directory. So, I
more or less pulled the ".fpp" suffix out of the air to use instead of
".F" under OS/2. You can configure this to suit your own tastes by
editing f77.cmd and setting the fpp and FPP environment variables
accordingly. The script is configured to use a ".f" suffix for ordinary
fortran files. You can also change this to suit your tastes by setting
the for and FOR variables accordingly.
=============
DOCUMENTATION
=============
If you have GNU man installed on your system, copy the f77.1 man
page to your man/man1 directory. A formatted version of the man page
is included in the file f77.doc for those that don't have GNU man.
The command line switches recognized by f77.cmd are very similar to
those of UNIX f77 compilers. There are some additional switches unique
to f2c and gcc/emx, but for the most part, it is the same. For those
who want to get started right away, see the EXAMPLES section near the
end of the man page.
=========
TEST CASE
=========
If you want to test your configuration, change to the "examples" sub-
directory, and run the f77demo script. The demo compiles the traditional
"hello world" program with various switches.
Best Regards,
John C. Peterson
jcp%octagon.UUCP@ucsd.edu