README 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. To compile f2c on Linux or Unix systems, copy makefile.u to makefile,
  2. edit makefile if necessary (see the comments in it and below) and
  3. type "make" (or maybe "nmake", depending on your system).
  4. To compile f2c.exe on MS Windows systems with Microsoft Visual C++,
  5. copy makefile.vc makefile
  6. nmake
  7. With other PC compilers, you may need to compile xsum.c with -DMSDOS
  8. (i.e., with MSDOS #defined).
  9. If your compiler does not understand ANSI/ISO C syntax (i.e., if
  10. you have a K&R C compiler), compile with -DKR_headers .
  11. On non-Unix systems where files have separate binary and text modes,
  12. you may need to "make xsumr.out" rather than "make xsum.out".
  13. If (in accordance with what follows) you need to any of the source
  14. files (excluding the makefile), first issue a "make xsum.out" (or, if
  15. appropriate, "make xsumr.out") to check the validity of the f2c source,
  16. then make your changes, then type "make f2c".
  17. The file usignal.h is for the benefit of strictly ANSI include files
  18. on a UNIX system -- the ANSI signal.h does not define SIGHUP or SIGQUIT.
  19. You may need to modify usignal.h if you are not running f2c on a UNIX
  20. system.
  21. Should you get the message "xsum0.out xsum1.out differ", see what lines
  22. are different (`diff xsum0.out xsum1.out`) and ask netlib
  23. (e.g., netlib@netlib.org) to send you the files in question,
  24. plus the current xsum0.out (which may have changed) "from f2c/src".
  25. For example, if exec.c and expr.c have incorrect check sums, you would
  26. send netlib the message
  27. send exec.c expr.c xsum0.out from f2c/src
  28. You can also ftp these files from netlib.bell-labs.com; for more
  29. details, ask netlib@netlib.org to "send readme from f2c".
  30. On some systems, the malloc and free in malloc.c let f2c run faster
  31. than do the standard malloc and free. Other systems may not tolerate
  32. redefinition of malloc and free (though changes of 8 Nov. 1994 may
  33. render this less of a problem than hitherto). If your system permits
  34. use of a user-supplied malloc, you may wish to change the MALLOC =
  35. line in the makefile to "MALLOC = malloc.o", or to type
  36. make MALLOC=malloc.o
  37. instead of
  38. make
  39. Still other systems have a -lmalloc that provides performance
  40. competitive with that from malloc.c; you may wish to compare the two
  41. on your system. If your system does not permit user-supplied malloc
  42. routines, then f2c may fault with "MALLOC=malloc.o", or may display
  43. other untoward behavior.
  44. On some BSD systems, you may need to create a file named "string.h"
  45. whose single line is
  46. #include <strings.h>
  47. you may need to add " -Dstrchr=index" to the "CFLAGS =" assignment
  48. in the makefile, and you may need to add " memset.o" to the "OBJECTS ="
  49. assignment in the makefile -- see the comments in memset.c .
  50. For non-UNIX systems, you may need to change some things in sysdep.c,
  51. such as the choice of intermediate file names.
  52. On some systems, you may need to modify parts of sysdep.h (which is
  53. included by defs.h). In particular, for Sun 4.1 systems and perhaps
  54. some others, you need to comment out the typedef of size_t. For some
  55. systems (e.g., IRIX 4.0.1 and AIX) it is better to add
  56. #define ANSI_Libraries
  57. to the beginning of sysdep.h (or to supply -DANSI_Libraries in the
  58. makefile).
  59. Alas, some systems #define __STDC__ but do not provide a true standard
  60. (ANSI or ISO) C environment, e.g. do not provide stdlib.h . If yours
  61. is such a system, then (a) you should complain loudly to your vendor
  62. about __STDC__ being erroneously defined, and (b) you should insert
  63. #undef __STDC__
  64. at the beginning of sysdep.h . You may need to make other adjustments.
  65. For some non-ANSI versions of stdio, you must change the values given
  66. to binread and binwrite in sysdep.c from "rb" and "wb" to "r" and "w".
  67. You may need to make this change if you run f2c and get an error
  68. message of the form
  69. Compiler error ... cannot open intermediate file ...
  70. In the days of yore, two libraries, libF77 and libI77, were used with
  71. f77 (the Fortran compiler on which f2c is based). Separate source for
  72. these libraries is still available from netlib, but it is more
  73. convenient to combine them into a single library, libf2c. Source for
  74. this combined library is also available from netlib in f2c/libf2c.zip,
  75. e.g.,
  76. http://netlib.bell-labs.com/netlib/f2c/libf2c.zip
  77. or
  78. http://www.netlib.org/f2c/libf2c.zip
  79. (and similarly for other netlib mirrors). After unzipping libf2c.zip,
  80. copy the relevant makefile.* to makefile, edit makefile if necessary
  81. (see the comments in it and in libf2c/README) and invoke "make" or
  82. "nmake". The resulting library is called *f2c.lib on MS Windows
  83. systems and libf2c.a or libf2c.so on Linux and Unix systems;
  84. makefile.u just shows how to make libf2c.a. Details on creating the
  85. shared-library variant, libf2c.so, are system-dependent; some that
  86. have worked under Linux appear below. For some other systems, you can
  87. glean the details from the system-dependent makefile variants in
  88. directory http://www.netlib.org/ampl/solvers/funclink or
  89. http://netlib.bell-labs.com/netlib/ampl/solvers/funclink, etc.
  90. In general, under Linux it is necessary to compile libf2c (or libI77)
  91. with -DNON_UNIX_STDIO . Under at least one variant of Linux, you can
  92. make and install a shared-library version of libf2c by compiling
  93. libI77 with -DNON_UNIX_STDIO, creating libf2c.a as above, and then
  94. executing
  95. mkdir t
  96. ln lib?77/*.o t
  97. cd t; cc -shared -o ../libf2c.so -Wl,-soname,libf2c.so.1 *.o
  98. cd ..
  99. rm -r t
  100. rm /usr/lib/libf2c*
  101. mv libf2c.a libf2c.so /usr/lib
  102. cd /usr/lib
  103. ln libf2c.so libf2c.so.1
  104. ln libf2c.so libf2c.so.1.0.0
  105. On some other systems, /usr/local/lib is the appropriate installation
  106. directory.
  107. Some older C compilers object to
  108. typedef void (*foo)();
  109. or to
  110. typedef void zap;
  111. zap (*foo)();
  112. If yours is such a compiler, change the definition of VOID in
  113. f2c.h from void to int.
  114. For convenience with systems that use control-Z to denote end-of-file,
  115. f2c treats control-Z characters (ASCII 26, '\x1a') that appear at the
  116. beginning of a line as an end-of-file indicator. You can disable this
  117. test by compiling lex.c with NO_EOF_CHAR_CHECK #defined, or can
  118. change control-Z to some other character by #defining EOF_CHAR to
  119. be the desired value.
  120. If your machine has IEEE, VAX, or IBM-mainframe arithmetic, but your
  121. printf is inaccurate (e.g., with Symantec C++ version 6.0,
  122. printf("%.17g",12.) prints 12.000000000000001), you can make f2c print
  123. correctly rounded numbers by compiling with -DUSE_DTOA and adding
  124. dtoa.o g_fmt.o to the makefile's OBJECTS = line, so it becomes
  125. OBJECTS = $(OBJECTSd) malloc.o dtoa.o g_fmt.o
  126. Also add the rule
  127. dtoa.o: dtoa.c
  128. $(CC) -c $(CFLAGS) -DMALLOC=ckalloc -DIEEE... dtoa.c
  129. (without the initial tab) to the makefile, where IEEE... is one of
  130. IEEE_MC68k, IEEE_8087, VAX, or IBM, depending on your machine's
  131. arithmetic. See the comments near the start of dtoa.c.
  132. The relevant source files, dtoa.c and g_fmt.c, are available
  133. separately from netlib's fp directory. For example, you could
  134. send the E-mail message
  135. send dtoa.c g_fmt.c from fp
  136. to netlib@netlib.netlib.org (or use anonymous ftp from
  137. ftp.netlib.org and look in directory /netlib/fp).
  138. The makefile has a rule for creating tokdefs.h. If you cannot use the
  139. makefile, an alternative is to extract tokdefs.h from the beginning of
  140. gram.c: it's the first 100 lines.
  141. File mem.c has #ifdef CRAY lines that are appropriate for machines
  142. with the conventional CRAY architecture, but not for "Cray" machines
  143. based on DEC Alpha chips, such as the T3E; on such machines, you may
  144. need to make a suitable adjustment, e.g., add #undef CRAY to sysdep.h.
  145. Please send bug reports to dmg at acm.org (with " at " changed to "@").
  146. The old index file (now called "readme" due to unfortunate changes in
  147. netlib conventions: "send readme from f2c") will report recent
  148. changes in the recent-change log at its end; all changes will be shown
  149. in the "changes" file ("send changes from f2c"). To keep current
  150. source, you will need to request xsum0.out and version.c, in addition
  151. to the changed source files.