home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / f77cmd.zip / f77 / README.OS2 < prev   
Text File  |  1994-09-10  |  9KB  |  176 lines

  1. Sat Sep 10 00:47:31 PST 1994
  2.  
  3.  
  4. ========
  5. OVERVIEW
  6. ========
  7.  
  8.    f77 is a bourne shell script that provides a command line interface
  9. for compiling Fortran 77 source code by running the f2c Fortran to C
  10. converter and the gcc/emx compiler for you automagically. [Although you
  11. will need an OS/2 port of the UNIX bourne shell, you can still start it
  12. from the stock OS/2 CMD.EXE shell if you like.] From the perspective of
  13. the command line options and associated behavior of the script, it's
  14. pretty much just like a "real" UNIX f77 compiler.
  15.  
  16.    I hacked this from the "fc" script provided in the f2c distribution
  17. from netlib. I renamed it to f77.cmd because fc is a builtin command to
  18. the korn shell.  Currently, the PD korn shell seems to be the best port
  19. of any of the UNIX shells to OS/2 I've seen, so something had to give.
  20.  
  21.    This script depends heavily on several UNIX applications. But don't
  22. worry, all the required applications have been ported to OS/2, and are
  23. freely available. If you don't happen to have these applications, you
  24. will need to find and install them to get f77 to work on your system.
  25. You must also configure f77 for your system by making some small changes
  26. to the f77.cmd script itself with your favorite text editor.
  27.  
  28.  
  29. =================
  30. REQUIRED SOFTWARE
  31. =================
  32.  
  33.    Note that f77 is designed to work with the f2c Fortran to C converter
  34. and gcc/emx compiler. The gcc/emx compiler is used to compile the C code
  35. generated by the f2c converter into object code.  So, the most important
  36. items you will need installed on your system, are f2c and the gcc/emx
  37. compiler! It is certainly possible to modify the f77.cmd script to work
  38. with other compilers. However, I do not own any of the commercial C
  39. compilers for OS/2, nor do I have any plans to purchase one, so you are
  40. on your own in this regard. If you haven't used f2c before, I highly
  41. recommend that you run through the whole process "by hand" a few times
  42. before trying to install f77.
  43.  
  44.    The next most important item you will need is a working OS/2 port of
  45. a UNIX bourne shell. I used the port of the public domain korn shell in
  46. my development (ksh49.zip from ftp-os2.nmsu.edu). I *strongly* recommend
  47. that you use this shell. Others *may* work, but I have found that many
  48. of the other ports of UNIX shells to OS/2 to have serious flaws, (no
  49. flames intended, these ports are not an easy job!) For example, many of
  50. them do *NOT* correctly return the exit code from a process, rendering
  51. them completely useless for scripts like f77, or for use under a make
  52. utility.
  53.  
  54.    There are a few other UNIX tools that you will need, below is a
  55. complete shopping list (with pointers to which files to grab from host
  56. ftp-os2.nmsu.edu);
  57.  
  58.    basename     part of GNU shellutils, file 2_x/unix/gnusutil.zip
  59.    f2c        f2c Fortran to C converter, file 2_x/unix/f2cbin.zip
  60.    gcc/emx    gcc/emx C compiler, see file 2_x/unix/emx08h/install.doc
  61.    getopt       source and executable *included* in this distribution!
  62.    ksh            public domain korn shell, file 2_x/unix/ksh49.zip
  63.    rm           also part of GNU shellutils, file 2_x/unix/gnusutil.zip
  64.    sed            GNU sed, file 2_x/unix/gnused.zip
  65.  
  66.    You'll also need the command line version of getopt. Since OS/2 ports
  67. of this were not to be found anywhere, I did some hunting, and located
  68. source code for it, written by AT&T, and released to the public domain.
  69. (The enclosed source is an unmodified copy from the latest distribution
  70. of smail for Linux.  It builds fine under gcc/emx without any changes.)
  71. To install the included executable, move or copy it to some directory in
  72. your search path, or edit f77.cmd, and change the value assigned to the
  73. PATH environment variable to include directory where you put getopt.exe.
  74.  
  75.  
  76. =============
  77. CONFIGURATION
  78. =============
  79.  
  80.    You will need to configure f77 for your system by editing f77.cmd
  81. with a text editor such as vi. All configurations that might require any
  82. changes are all grouped into a section of code that begins with the line
  83. "# beg configuration section" and ends with "# end configuration section"
  84.  
  85.    If you already know the UNIX bourne shell and want to get on with it,
  86. just search f77.cmd for the string "LOCAL CONFIG", the comments should be
  87. self explanatory. Move f77.cmd to a directory in your path and you'll be
  88. all set.
  89.  
  90.    To be more precise, here is a list of changes you'll need to make;
  91.  
  92.  
  93.    (1) You will need to decide where you want f77.cmd to reside in your
  94.        file system, and edit the very 1-st line to reflect your choice.
  95.        This is because the OS/2 CMD.EXE command processor, which passes
  96.        the file off to the ksh, does *NOT* pass the full path name of
  97.        f77.cmd, making it impossible for the korn shell to know where
  98.        the heck it is. Can you say Bogus? I'd bet money that this was
  99.        code written by Microsoft when they were involved in OS/2
  100.        development. At any rate, thank god they are now out of the
  101.        OS/2 picture!
  102.  
  103.    (2) If all the required support executable are in your default path,
  104.        you can skip this step. If you want to "hide them" somewhere to
  105.        avoid conflicts, or just because you wouldn't ordinarily use
  106.        them, then uncomment, and edit the PATH variable to reflect where
  107.        you put them. Be careful to keep the syntax shown, don't leave
  108.        off the quotes, and don't use the OS/2 style backslash "\" in
  109.        the path.
  110.  
  111.    (3) Find the line where the environment variable CFLAGS_F2C is being
  112.        assigned a value. Edit the argument to the -I flag to reflect
  113.        where your f2c.h header file is stored. If gcc automatically
  114.        knows where to find f2c.h, (ie: by virtue of it being in a
  115.        directory in the gcc environment variable C_INCLUDE_PATH), you
  116.        can just eliminate the -I flag and the directory argument.
  117.        If you changed the value of F2CFLAGS to change the type of C
  118.        code generated by f2c (ie: ANSI instead of K&R), you may have
  119.        to make corresponding adjustments to CFLAGS_F2C so the C code
  120.        compiles correctly.
  121.  
  122.  
  123.    (4) Find the lines where the environment variable METHOD1DEFLIBS and
  124.        METHOD2DEFLIBS are assigned values. These variables specify the
  125.        libraries to be used when linking EMX method 1 and 2 type
  126.        executables. Edit the argument to the -L flag to reflect the
  127.        directory where your f2c support library is stored.  If gcc knows
  128.        where to find the f2c library, (ie: by virtue of it being in a
  129.        directory in the gcc environment variable LIBRARY_PATH ), you can
  130.        just eliminate the -L flag and the directory argument.  If the
  131.        actual name of the library is not f2c, change the "-lf2c" to the
  132.        correct value. For EMX method 2 executables, you may want to use
  133.        my dynamic link support libraries, namely -lf2clib -lf2cdll.
  134.        The resulting executables will be roughly 30K smaller in size.
  135.  
  136.  
  137.    There IS one major difference with UNIX f77 compilers. Under UNIX, the
  138. ".F" file suffix is used to denote Fortran 77 code with C preprocessor
  139. statements in it. This doesn't fly under OS/2 since you can't have a
  140. file with both a ".F" and a ".f" suffix in the same directory. So, I
  141. more or less pulled the ".fpp" suffix out of the air to use instead of
  142. ".F" under OS/2. You can configure this to suit your own tastes by
  143. editing f77.cmd and setting the fpp and FPP environment variables
  144. accordingly. The script is configured to use a ".f" suffix for ordinary
  145. fortran files. You can also change this to suit your tastes by setting
  146. the for and FOR variables accordingly.
  147.  
  148.  
  149. =============
  150. DOCUMENTATION
  151. =============
  152.  
  153.    If you have GNU man installed on your system, copy the f77.1 man
  154. page to your man/man1 directory. A formatted version of the man page
  155. is included in the file f77.doc for those that don't have GNU man.
  156.  
  157.    The command line switches recognized by f77.cmd are very similar to
  158. those of UNIX f77 compilers. There are some additional switches unique
  159. to f2c and gcc/emx, but for the most part, it is the same.  For those
  160. who want to get started right away, see the EXAMPLES section near the
  161. end of the man page.
  162.  
  163.  
  164. =========
  165. TEST CASE
  166. =========
  167.  
  168.    If you want to test your configuration, change to the "examples" sub-
  169. directory, and run the f77demo script. The demo compiles the traditional
  170. "hello world" program with various switches.
  171.  
  172.  
  173. Best Regards,
  174. John C. Peterson
  175. jcp%octagon.UUCP@ucsd.edu
  176.