README 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. As shipped, "makefile" is a copy of "makefile.u", a Unix makefile.
  2. Variants for other systems have names of the form makefile.* and
  3. have initial comments saying how to invoke them. You may wish to
  4. copy one of the other makefile.* files to makefile.
  5. If you use a C++ compiler, first say
  6. make hadd
  7. to create a suitable f2c.h from f2c.h0 and f2ch.add. Otherwise,
  8. make f2c.h
  9. will just copy f2c.h0 to f2c.h .
  10. If your compiler does not recognize ANSI C headers,
  11. compile with KR_headers defined: either add -DKR_headers
  12. to the definition of CFLAGS in the makefile, or insert
  13. #define KR_headers
  14. at the top of f2c.h .
  15. If your system lacks onexit() and you are not using an ANSI C
  16. compiler, then you should compile main.c with NO_ONEXIT defined.
  17. See the comments about onexit in makefile.u.
  18. If your system has a double drem() function such that drem(a,b)
  19. is the IEEE remainder function (with double a, b), then you may
  20. wish to compile r_mod.c and d_mod.c with IEEE_drem defined.
  21. To check for transmission errors, issue the command
  22. make check
  23. or
  24. make -f makefile.u check
  25. This assumes you have the xsum program whose source, xsum.c,
  26. is distributed as part of "all from f2c/src", and that it
  27. is installed somewhere in your search path. If you do not
  28. have xsum, you can obtain xsum.c by sending the following E-mail
  29. message to netlib@netlib.bell-labs.com
  30. send xsum.c from f2c/src
  31. For convenience, the f2c.h0 in this directory is a copy of netlib's
  32. "f2c.h from f2c". It is best to install f2c.h in a standard place,
  33. so "include f2c.h" will work in any directory without further ado.
  34. Beware that the makefiles do not cause recompilation when f2c.h is
  35. changed.
  36. On machines, such as those using a DEC Alpha processor, on which
  37. sizeof(short) == 2, sizeof(int) == sizeof(float) == 4, and
  38. sizeof(long) == sizeof(double) == 8, it suffices to modify f2c.h by
  39. removing the first occurrence of "long " on each line containing
  40. "long ". On Unix systems, you can do this by issuing the commands
  41. mv f2c.h f2c.h0
  42. sed 's/long int /int /' f2c.h0 >f2c.h
  43. On such machines, one can enable INTEGER*8 by uncommenting the typedefs
  44. of longint and ulongint in f2c.h and adjusting them, so they read
  45. typedef long longint;
  46. typedef unsigned long ulongint;
  47. and by compiling libf2c with -DAllow_TYQUAD, as discussed below.
  48. Most of the routines in libf2c are support routines for Fortran
  49. intrinsic functions or for operations that f2c chooses not
  50. to do "in line". There are a few exceptions, summarized below --
  51. functions and subroutines that appear to your program as ordinary
  52. external Fortran routines.
  53. If you use the REAL valued functions listed below (ERF, ERFC,
  54. DTIME, and ETIME) with "f2c -R", then you need to compile the
  55. corresponding source files with -DREAL=float. To do this, it is
  56. perhaps simplest to add "-DREAL=float" to CFLAGS in the makefile.
  57. 1. CALL ABORT prints a message and causes a core dump.
  58. 2. ERF(r) and DERF(d) and the REAL and DOUBLE PRECISION
  59. error functions (with x REAL and d DOUBLE PRECISION);
  60. DERF must be declared DOUBLE PRECISION in your program.
  61. Both ERF and DERF assume your C library provides the
  62. underlying erf() function (which not all systems do).
  63. 3. ERFC(r) and DERFC(d) are the complementary error functions:
  64. ERFC(r) = 1 - ERF(r) and DERFC(d) = 1.d0 - DERFC(d)
  65. (except that their results may be more accurate than
  66. explicitly evaluating the above formulae would give).
  67. Again, ERFC and r are REAL, and DERFC and d are DOUBLE
  68. PRECISION (and must be declared as such in your program),
  69. and ERFC and DERFC rely on your system's erfc().
  70. 4. CALL GETARG(n,s), where n is an INTEGER and s is a CHARACTER
  71. variable, sets s to the n-th command-line argument (or to
  72. all blanks if there are fewer than n command-line arguments);
  73. CALL GETARG(0,s) sets s to the name of the program (on systems
  74. that support this feature). See IARGC below.
  75. 5. CALL GETENV(name, value), where name and value are of type
  76. CHARACTER, sets value to the environment value, $name, of
  77. name (or to blanks if $name has not been set).
  78. 6. NARGS = IARGC() sets NARGS to the number of command-line
  79. arguments (an INTEGER value).
  80. 7. CALL SIGNAL(n,func), where n is an INTEGER and func is an
  81. EXTERNAL procedure, arranges for func to be invoked when n
  82. occurs (on systems where this makes sense).
  83. If your compiler complains about the signal calls in main.c, s_paus.c,
  84. and signal_.c, you may need to adjust signal1.h suitably. See the
  85. comments in signal1.h.
  86. 8. ETIME(ARR) and DTIME(ARR) are REAL functions that return
  87. execution times. ARR is declared REAL ARR(2). The elapsed
  88. user and system CPU times are stored in ARR(1) and ARR(2),
  89. respectively. ETIME returns the total elapsed CPU time,
  90. i.e., ARR(1) + ARR(2). DTIME returns total elapsed CPU
  91. time since the previous call on DTIME.
  92. 9. CALL SYSTEM(cmd), where cmd is of type CHARACTER, passes
  93. cmd to the system's command processor (on systems where
  94. this can be done).
  95. 10. CALL FLUSH flushes all buffers.
  96. 11. FTELL(i) is an INTEGER function that returns the current
  97. offset of Fortran unit i (or -1 if unit i is not open).
  98. 12. CALL FSEEK(i, offset, whence, *errlab) attemps to move
  99. Fortran unit i to the specified offset: absolute offset
  100. if whence = 0; relative to the current offset if whence = 1;
  101. relative to the end of the file if whence = 2. It branches
  102. to label errlab if unit i is not open or if the call
  103. otherwise fails.
  104. The routines whose objects are makefile.u's $(I77) are for I/O.
  105. The following comments apply to them.
  106. If your system lacks /usr/include/local.h ,
  107. then you should create an appropriate local.h in
  108. this directory. An appropriate local.h may simply
  109. be empty, or it may #define VAX or #define CRAY
  110. (or whatever else you must do to make fp.h work right).
  111. Alternatively, edit fp.h to suite your machine.
  112. If your system lacks /usr/include/fcntl.h , then you
  113. should simply create an empty fcntl.h in this directory.
  114. If your compiler then complains about creat and open not
  115. having a prototype, compile with OPEN_DECL defined.
  116. On many systems, open and creat are declared in fcntl.h .
  117. If your system's sprintf does not work the way ANSI C
  118. specifies -- specifically, if it does not return the
  119. number of characters transmitted -- then insert the line
  120. #define USE_STRLEN
  121. at the end of fmt.h . This is necessary with
  122. at least some versions of Sun software.
  123. In particular, if you get a warning about an improper
  124. pointer/integer combination in compiling wref.c, then
  125. you need to compile with -DUSE_STRLEN .
  126. If your system's fopen does not like the ANSI binary
  127. reading and writing modes "rb" and "wb", then you should
  128. compile open.c with NON_ANSI_RW_MODES #defined.
  129. If you get error messages about references to cf->_ptr
  130. and cf->_base when compiling wrtfmt.c and wsfe.c or to
  131. stderr->_flag when compiling err.c, then insert the line
  132. #define NON_UNIX_STDIO
  133. at the beginning of fio.h, and recompile everything (or
  134. at least those modules that contain NON_UNIX_STDIO).
  135. Unformatted sequential records consist of a length of record
  136. contents, the record contents themselves, and the length of
  137. record contents again (for backspace). Prior to 17 Oct. 1991,
  138. the length was of type int; now it is of type long, but you
  139. can change it back to int by inserting
  140. #define UIOLEN_int
  141. at the beginning of fio.h. This affects only sue.c and uio.c .
  142. If you have a really ancient K&R C compiler that does not understand
  143. void, add -Dvoid=int to the definition of CFLAGS in the makefile.
  144. On VAX, Cray, or Research Tenth-Edition Unix systems, you may
  145. need to add -DVAX, -DCRAY, or -DV10 (respectively) to CFLAGS
  146. to make fp.h work correctly. Alternatively, you may need to
  147. edit fp.h to suit your machine.
  148. If your compiler complains about the signal calls in main.c, s_paus.c,
  149. and signal_.c, you may need to adjust signal1.h suitably. See the
  150. comments in signal1.h.
  151. You may need to supply the following non-ANSI routines:
  152. fstat(int fileds, struct stat *buf) is similar
  153. to stat(char *name, struct stat *buf), except that
  154. the first argument, fileds, is the file descriptor
  155. returned by open rather than the name of the file.
  156. fstat is used in the system-dependent routine
  157. canseek (in the libf2c source file err.c), which
  158. is supposed to return 1 if it's possible to issue
  159. seeks on the file in question, 0 if it's not; you may
  160. need to suitably modify err.c . On non-UNIX systems,
  161. you can avoid references to fstat and stat by compiling
  162. with NON_UNIX_STDIO defined; in that case, you may need
  163. to supply access(char *Name,0), which is supposed to
  164. return 0 if file Name exists, nonzero otherwise.
  165. char * mktemp(char *buf) is supposed to replace the
  166. 6 trailing X's in buf with a unique number and then
  167. return buf. The idea is to get a unique name for
  168. a temporary file.
  169. On non-UNIX systems, you may need to change a few other,
  170. e.g.: the form of name computed by mktemp() in endfile.c and
  171. open.c; the use of the open(), close(), and creat() system
  172. calls in endfile.c, err.c, open.c; and the modes in calls on
  173. fopen() and fdopen() (and perhaps the use of fdopen() itself
  174. -- it's supposed to return a FILE* corresponding to a given
  175. an integer file descriptor) in err.c and open.c (component ufmt
  176. of struct unit is 1 for formatted I/O -- text mode on some systems
  177. -- and 0 for unformatted I/O -- binary mode on some systems).
  178. Compiling with -DNON_UNIX_STDIO omits all references to creat()
  179. and almost all references to open() and close(), the exception
  180. being in the function f__isdev() (in open.c).
  181. If you wish to use translated Fortran that has funny notions
  182. of record length for direct unformatted I/O (i.e., that assumes
  183. RECL= values in OPEN statements are not bytes but rather counts
  184. of some other units -- e.g., 4-character words for VMS), then you
  185. should insert an appropriate #define for url_Adjust at the
  186. beginning of open.c . For VMS Fortran, for example,
  187. #define url_Adjust(x) x *= 4
  188. would suffice.
  189. By default, Fortran I/O units 5, 6, and 0 are pre-connected to
  190. stdin, stdout, and stderr, respectively. You can change this
  191. behavior by changing f_init() in err.c to suit your needs.
  192. Note that f2c assumes READ(*... means READ(5... and WRITE(*...
  193. means WRITE(6... . Moreover, an OPEN(n,... statement that does
  194. not specify a file name (and does not specify STATUS='SCRATCH')
  195. assumes FILE='fort.n' . You can change this by editing open.c
  196. and endfile.c suitably.
  197. Unless you adjust the "#define MXUNIT" line in fio.h, Fortran units
  198. 0, 1, ..., 99 are available, i.e., the highest allowed unit number
  199. is MXUNIT - 1.
  200. Lines protected from compilation by #ifdef Allow_TYQUAD
  201. are for a possible extension to 64-bit integers in which
  202. integer = int = 32 bits and longint = long = 64 bits.
  203. The makefile does not attempt to compile pow_qq.c, qbitbits.c,
  204. and qbitshft.c, which are meant for use with INTEGER*8. To use
  205. INTEGER*8, you must modify f2c.h to declare longint and ulongint
  206. appropriately; then add $(QINT) to the end of the makefile's
  207. dependency list for libf2c.a (if makefile is a copy of makefile.u;
  208. for the PC makefiles, add pow_qq.obj qbitbits.obj qbitshft.obj
  209. to the library's dependency list and adjust libf2c.lbc or libf2c.sy
  210. accordingly). Also add -DAllow_TYQUAD to the makefile's CFLAGS
  211. assignment. To make longint and ulongint available, it may suffice
  212. to add -DINTEGER_STAR_8 to the CFLAGS assignment.
  213. Following Fortran 90, s_cat.c and s_copy.c allow the target of a
  214. (character string) assignment to be appear on its right-hand, at
  215. the cost of some extra overhead for all run-time concatenations.
  216. If you prefer the extra efficiency that comes with the Fortran 77
  217. requirement that the left-hand side of a character assignment not
  218. be involved in the right-hand side, compile s_cat.c and s_copy.c
  219. with -DNO_OVERWRITE .
  220. Extensions (Feb. 1993) to NAMELIST processing:
  221. 1. Reading a ? instead of &name (the start of a namelist) causes
  222. the namelist being sought to be written to stdout (unit 6);
  223. to omit this feature, compile rsne.c with -DNo_Namelist_Questions.
  224. 2. Reading the wrong namelist name now leads to an error message
  225. and an attempt to skip input until the right namelist name is found;
  226. to omit this feature, compile rsne.c with -DNo_Bad_Namelist_Skip.
  227. 3. Namelist writes now insert newlines before each variable; to omit
  228. this feature, compile xwsne.c with -DNo_Extra_Namelist_Newlines.
  229. 4. (Sept. 1995) When looking for the &name that starts namelist
  230. input, lines whose first non-blank character is something other
  231. than &, $, or ? are treated as comment lines and ignored, unless
  232. rsne.c is compiled with -DNo_Namelist_Comments.
  233. Nonstandard extension (Feb. 1993) to open: for sequential files,
  234. ACCESS='APPEND' (or access='anything else starting with "A" or "a"')
  235. causes the file to be positioned at end-of-file, so a write will
  236. append to the file.
  237. Some buggy Fortran programs use unformatted direct I/O to write
  238. an incomplete record and later read more from that record than
  239. they have written. For records other than the last, the unwritten
  240. portion of the record reads as binary zeros. The last record is
  241. a special case: attempting to read more from it than was written
  242. gives end-of-file -- which may help one find a bug. Some other
  243. Fortran I/O libraries treat the last record no differently than
  244. others and thus give no help in finding the bug of reading more
  245. than was written. If you wish to have this behavior, compile
  246. uio.c with -DPad_UDread .
  247. If you want to be able to catch write failures (e.g., due to a
  248. disk being full) with an ERR= specifier, compile dfe.c, due.c,
  249. sfe.c, sue.c, and wsle.c with -DALWAYS_FLUSH. This will lead to
  250. slower execution and more I/O, but should make ERR= work as
  251. expected, provided fflush returns an error return when its
  252. physical write fails.
  253. Carriage controls are meant to be interpreted by the UNIX col
  254. program (or a similar program). Sometimes it's convenient to use
  255. only ' ' as the carriage control character (normal single spacing).
  256. If you compile lwrite.c and wsfe.c with -DOMIT_BLANK_CC, formatted
  257. external output lines will have an initial ' ' quietly omitted,
  258. making use of the col program unnecessary with output that only
  259. has ' ' for carriage control.
  260. The Fortran 77 Standard leaves it up to the implementation whether
  261. formatted writes of floating-point numbers of absolute value < 1 have
  262. a zero before the decimal point. By default, libI77 omits such
  263. superfluous zeros, but you can cause them to appear by compiling
  264. lwrite.c, wref.c, and wrtfmt.c with -DWANT_LEAD_0 .
  265. If your (Unix) system lacks a ranlib command, you don't need it.
  266. Either comment out the makefile's ranlib invocation, or install
  267. a harmless "ranlib" command somewhere in your PATH, such as the
  268. one-line shell script
  269. exit 0
  270. or (on some systems)
  271. exec /usr/bin/ar lts $1 >/dev/null
  272. By default, the routines that implement complex and double complex
  273. division, c_div.c and z_div.c, call sig_die to print an error message
  274. and exit if they see a divisor of 0, as this is sometimes helpful for
  275. debugging. On systems with IEEE arithmetic, compiling c_div.c and
  276. z_div.c with -DIEEE_COMPLEX_DIVIDE causes them instead to set both
  277. the real and imaginary parts of the result to +INFINITY if the
  278. numerator is nonzero, or to NaN if it vanishes.
  279. Nowadays most Unix and Linux systems have function
  280. int ftruncate(int fildes, off_t len);
  281. defined in system header file unistd.h that adjusts the length of file
  282. descriptor fildes to length len. Unless endfile.c is compiled with
  283. -DNO_TRUNCATE, endfile.c #includes "unistd.h" and calls ftruncate() if
  284. necessary to shorten files. If your system lacks ftruncate(), compile
  285. endfile.c with -DNO_TRUNCATE to make endfile.c use the older and more
  286. portable scheme of shortening a file by copying to a temporary file
  287. and back again.
  288. The initializations for "f2c -trapuv" are done by _uninit_f2c(),
  289. whose source is uninit.c, introduced June 2001. On IEEE-arithmetic
  290. systems, _uninit_f2c should initialize floating-point variables to
  291. signaling NaNs and, at its first invocation, should enable the
  292. invalid operation exception. Alas, the rules for distinguishing
  293. signaling from quiet NaNs were not specified in the IEEE P754 standard,
  294. nor were the precise means of enabling and disabling IEEE-arithmetic
  295. exceptions, and these details are thus system dependent. There are
  296. #ifdef's in uninit.c that specify them for some popular systems. If
  297. yours is not one of these systems, it may take some detective work to
  298. discover the appropriate details for your system. Sometimes it helps
  299. to look in the standard include directories for header files with
  300. relevant-sounding names, such as ieeefp.h, nan.h, or trap.h, and
  301. it may be simplest to run experiments to see what distinguishes a
  302. signaling from a quiet NaN. (If x is initialized to a signaling
  303. NaN and the invalid operation exception is masked off, as it should
  304. be by default on IEEE-arithmetic systems, then computing, say,
  305. y = x + 1 will yield a quiet NaN.)