| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375 | As shipped, "makefile" is a copy of "makefile.u", a Unix makefile.Variants for other systems have names of the form makefile.* andhave initial comments saying how to invoke them.  You may wish tocopy one of the other makefile.* files to makefile.If you use a C++ compiler, first say	make haddto create a suitable f2c.h from f2c.h0 and f2ch.add.  Otherwise,	make f2c.hwill just copy f2c.h0 to f2c.h .If your compiler does not recognize ANSI C headers,compile with KR_headers defined:  either add -DKR_headersto the definition of CFLAGS in the makefile, or insert#define KR_headersat the top of f2c.h .If your system lacks onexit() and you are not using an ANSI Ccompiler, then you should compile main.c with NO_ONEXIT defined.See the comments about onexit in makefile.u.If your system has a double drem() function such that drem(a,b)is the IEEE remainder function (with double a, b), then you maywish to compile r_mod.c and d_mod.c with IEEE_drem defined.To check for transmission errors, issue the command	make checkor	make -f makefile.u checkThis assumes you have the xsum program whose source, xsum.c,is distributed as part of "all from f2c/src", and that itis installed somewhere in your search path.  If you do nothave xsum, you can obtain xsum.c by sending the following E-mailmessage to netlib@netlib.bell-labs.com	send xsum.c from f2c/srcFor convenience, the f2c.h0 in this directory is a copy of netlib's"f2c.h from f2c".  It is best to install f2c.h in a standard place,so "include f2c.h" will work in any directory without further ado.Beware that the makefiles do not cause recompilation when f2c.h ischanged.On machines, such as those using a DEC Alpha processor, on whichsizeof(short) == 2, sizeof(int) == sizeof(float) == 4, andsizeof(long) == sizeof(double) == 8, it suffices to modify f2c.h byremoving the first occurrence of "long " on each line containing"long ".  On Unix systems, you can do this by issuing the commands	mv f2c.h f2c.h0	sed 's/long int /int /' f2c.h0 >f2c.hOn such machines, one can enable INTEGER*8 by uncommenting the typedefsof longint and ulongint in f2c.h and adjusting them, so they read	typedef long longint;	typedef unsigned long ulongint;and by compiling libf2c with -DAllow_TYQUAD, as discussed below.Most of the routines in libf2c are support routines for Fortranintrinsic functions or for operations that f2c chooses notto do "in line".  There are a few exceptions, summarized below --functions and subroutines that appear to your program as ordinaryexternal Fortran routines.If you use the REAL valued functions listed below (ERF, ERFC,DTIME, and ETIME) with "f2c -R", then you need to compile thecorresponding source files with -DREAL=float.  To do this, it isperhaps simplest to add "-DREAL=float" to CFLAGS in the makefile.1.	CALL ABORT prints a message and causes a core dump.2.	ERF(r) and DERF(d) and the REAL and DOUBLE PRECISION	error functions (with x REAL and d DOUBLE PRECISION);	DERF must be declared DOUBLE PRECISION in your program.	Both ERF and DERF assume your C library provides the	underlying erf() function (which not all systems do).3.	ERFC(r) and DERFC(d) are the complementary error functions:	ERFC(r) = 1 - ERF(r) and DERFC(d) = 1.d0 - DERFC(d)	(except that their results may be more accurate than	explicitly evaluating the above formulae would give).	Again, ERFC and r are REAL, and DERFC and d are DOUBLE	PRECISION (and must be declared as such in your program),	and ERFC and DERFC rely on your system's erfc().4.	CALL GETARG(n,s), where n is an INTEGER and s is a CHARACTER	variable, sets s to the n-th command-line argument (or to	all blanks if there are fewer than n command-line arguments);	CALL GETARG(0,s) sets s to the name of the program (on systems	that support this feature).  See IARGC below.5.	CALL GETENV(name, value), where name and value are of type	CHARACTER, sets value to the environment value, $name, of	name (or to blanks if $name has not been set).6.	NARGS = IARGC() sets NARGS to the number of command-line	arguments (an INTEGER value).7.	CALL SIGNAL(n,func), where n is an INTEGER and func is an	EXTERNAL procedure, arranges for func to be invoked when n	occurs (on systems where this makes sense).	If your compiler complains about the signal calls in main.c, s_paus.c,and signal_.c, you may need to adjust signal1.h suitably.  See thecomments in signal1.h.8.	ETIME(ARR) and DTIME(ARR) are REAL functions that return	execution times.  ARR is declared REAL ARR(2).  The elapsed	user and system CPU times are stored in ARR(1) and ARR(2),	respectively.  ETIME returns the total elapsed CPU time,	i.e., ARR(1) + ARR(2).  DTIME returns total elapsed CPU	time since the previous call on DTIME.9.	CALL SYSTEM(cmd), where cmd is of type CHARACTER, passes	cmd to the system's command processor (on systems where	this can be done).10.	CALL FLUSH flushes all buffers.11.	FTELL(i) is an INTEGER function that returns the current	offset of Fortran unit i (or -1 if unit i is not open).12.	CALL FSEEK(i, offset, whence, *errlab) attemps to move	Fortran unit i to the specified offset: absolute offset	if whence = 0; relative to the current offset if whence = 1;	relative to the end of the file if whence = 2.  It branches	to label errlab if unit i is not open or if the call	otherwise fails.The routines whose objects are makefile.u's $(I77) are for I/O.The following comments apply to them.If your system lacks /usr/include/local.h ,then you should create an appropriate local.h inthis directory.  An appropriate local.h may simplybe empty, or it may #define VAX or #define CRAY(or whatever else you must do to make fp.h work right).Alternatively, edit fp.h to suite your machine.If your system lacks /usr/include/fcntl.h , then youshould simply create an empty fcntl.h in this directory.If your compiler then complains about creat and open nothaving a prototype, compile with OPEN_DECL defined.On many systems, open and creat are declared in fcntl.h .If your system's sprintf does not work the way ANSI Cspecifies -- specifically, if it does not return thenumber of characters transmitted -- then insert the line#define USE_STRLENat the end of fmt.h .  This is necessary withat least some versions of Sun software.In particular, if you get a warning about an improperpointer/integer combination in compiling wref.c, thenyou need to compile with -DUSE_STRLEN .If your system's fopen does not like the ANSI binaryreading and writing modes "rb" and "wb", then you shouldcompile open.c with NON_ANSI_RW_MODES #defined.If you get error messages about references to cf->_ptrand cf->_base when compiling wrtfmt.c and wsfe.c or tostderr->_flag when compiling err.c, then insert the line#define NON_UNIX_STDIOat the beginning of fio.h, and recompile everything (orat least those modules that contain NON_UNIX_STDIO).Unformatted sequential records consist of a length of recordcontents, the record contents themselves, and the length ofrecord contents again (for backspace).  Prior to 17 Oct. 1991,the length was of type int; now it is of type long, but youcan change it back to int by inserting#define UIOLEN_intat the beginning of fio.h.  This affects only sue.c and uio.c .If you have a really ancient K&R C compiler that does not understandvoid, add -Dvoid=int to the definition of CFLAGS in the makefile.On VAX, Cray, or Research Tenth-Edition Unix systems, you mayneed to add -DVAX, -DCRAY, or -DV10 (respectively) to CFLAGSto make fp.h work correctly.  Alternatively, you may need toedit fp.h to suit your machine.If your compiler complains about the signal calls in main.c, s_paus.c,and signal_.c, you may need to adjust signal1.h suitably.  See thecomments in signal1.h.You may need to supply the following non-ANSI routines:  fstat(int fileds, struct stat *buf) is similarto stat(char *name, struct stat *buf), except thatthe first argument, fileds, is the file descriptorreturned by open rather than the name of the file.fstat is used in the system-dependent routinecanseek (in the libf2c source file err.c), whichis supposed to return 1 if it's possible to issueseeks on the file in question, 0 if it's not; you mayneed to suitably modify err.c .  On non-UNIX systems,you can avoid references to fstat and stat by compilingwith NON_UNIX_STDIO defined; in that case, you may needto supply access(char *Name,0), which is supposed toreturn 0 if file Name exists, nonzero otherwise.  char * mktemp(char *buf) is supposed to replace the6 trailing X's in buf with a unique number and thenreturn buf.  The idea is to get a unique name fora temporary file.On non-UNIX systems, you may need to change a few other,e.g.: the form of name computed by mktemp() in endfile.c andopen.c; the use of the open(), close(), and creat() systemcalls in endfile.c, err.c, open.c; and the modes in calls onfopen() and fdopen() (and perhaps the use of fdopen() itself-- it's supposed to return a FILE* corresponding to a givenan integer file descriptor) in err.c and open.c (component ufmtof struct unit is 1 for formatted I/O -- text mode on some systems-- and 0 for unformatted I/O -- binary mode on some systems).Compiling with -DNON_UNIX_STDIO omits all references to creat()and almost all references to open() and close(), the exceptionbeing in the function f__isdev() (in open.c).If you wish to use translated Fortran that has funny notionsof record length for direct unformatted I/O (i.e., that assumesRECL= values in OPEN statements are not bytes but rather countsof some other units -- e.g., 4-character words for VMS), then youshould insert an appropriate #define for url_Adjust at thebeginning of open.c .  For VMS Fortran, for example,#define url_Adjust(x) x *= 4would suffice.By default, Fortran I/O units 5, 6, and 0 are pre-connected tostdin, stdout, and stderr, respectively.  You can change thisbehavior by changing f_init() in err.c to suit your needs.Note that f2c assumes READ(*... means READ(5... and WRITE(*...means WRITE(6... .  Moreover, an OPEN(n,... statement that doesnot specify a file name (and does not specify STATUS='SCRATCH')assumes FILE='fort.n' .  You can change this by editing open.cand endfile.c suitably.Unless you adjust the "#define MXUNIT" line in fio.h, Fortran units0, 1, ..., 99 are available, i.e., the highest allowed unit numberis MXUNIT - 1.Lines protected from compilation by #ifdef Allow_TYQUADare for a possible extension to 64-bit integers in whichinteger = int = 32 bits and longint = long = 64 bits.The makefile does not attempt to compile pow_qq.c, qbitbits.c,and qbitshft.c, which are meant for use with INTEGER*8.  To useINTEGER*8, you must modify f2c.h to declare longint and ulongintappropriately; then add $(QINT) to the end of the makefile'sdependency list for libf2c.a (if makefile is a copy of makefile.u;for the PC makefiles, add pow_qq.obj qbitbits.obj qbitshft.objto the library's dependency list and adjust libf2c.lbc or libf2c.syaccordingly).  Also add -DAllow_TYQUAD to the makefile's CFLAGSassignment.  To make longint and ulongint available, it may sufficeto add -DINTEGER_STAR_8 to the CFLAGS assignment.Following Fortran 90, s_cat.c and s_copy.c allow the target of a(character string) assignment to be appear on its right-hand, atthe cost of some extra overhead for all run-time concatenations.If you prefer the  extra efficiency that comes with the Fortran 77requirement that the left-hand side of a character assignment notbe involved in the right-hand side, compile s_cat.c and s_copy.cwith -DNO_OVERWRITE .Extensions (Feb. 1993) to NAMELIST processing: 1. Reading a ? instead of &name (the start of a namelist) causesthe namelist being sought to be written to stdout (unit 6);to omit this feature, compile rsne.c with -DNo_Namelist_Questions. 2. Reading the wrong namelist name now leads to an error messageand an attempt to skip input until the right namelist name is found;to omit this feature, compile rsne.c with -DNo_Bad_Namelist_Skip. 3. Namelist writes now insert newlines before each variable; to omitthis feature, compile xwsne.c with -DNo_Extra_Namelist_Newlines. 4. (Sept. 1995) When looking for the &name that starts namelistinput, lines whose first non-blank character is something otherthan &, $, or ? are treated as comment lines and ignored, unlessrsne.c is compiled with -DNo_Namelist_Comments.Nonstandard extension (Feb. 1993) to open: for sequential files,ACCESS='APPEND' (or access='anything else starting with "A" or "a"')causes the file to be positioned at end-of-file, so a write willappend to the file.Some buggy Fortran programs use unformatted direct I/O to writean incomplete record and later read more from that record thanthey have written.  For records other than the last, the unwrittenportion of the record reads as binary zeros.  The last record isa special case: attempting to read more from it than was writtengives end-of-file -- which may help one find a bug.  Some otherFortran I/O libraries treat the last record no differently thanothers and thus give no help in finding the bug of reading morethan was written.  If you wish to have this behavior, compileuio.c with -DPad_UDread .If you want to be able to catch write failures (e.g., due to adisk being full) with an ERR= specifier, compile dfe.c, due.c,sfe.c, sue.c, and wsle.c with -DALWAYS_FLUSH.  This will lead toslower execution and more I/O, but should make ERR= work asexpected, provided fflush returns an error return when itsphysical write fails.Carriage controls are meant to be interpreted by the UNIX colprogram (or a similar program).  Sometimes it's convenient to useonly ' ' as the carriage control character (normal single spacing).If you compile lwrite.c and wsfe.c with -DOMIT_BLANK_CC, formattedexternal output lines will have an initial ' ' quietly omitted,making use of the col program unnecessary with output that onlyhas ' ' for carriage control.The Fortran 77 Standard leaves it up to the implementation whetherformatted writes of floating-point numbers of absolute value < 1 havea zero before the decimal point.  By default, libI77 omits suchsuperfluous zeros, but you can cause them to appear by compilinglwrite.c, wref.c, and wrtfmt.c with -DWANT_LEAD_0 .If your (Unix) system lacks a ranlib command, you don't need it.Either comment out the makefile's ranlib invocation, or installa harmless "ranlib" command somewhere in your PATH, such as theone-line shell script	exit 0or (on some systems)	exec /usr/bin/ar lts $1 >/dev/nullBy default, the routines that implement complex and double complexdivision, c_div.c and z_div.c, call sig_die to print an error messageand exit if they see a divisor of 0, as this is sometimes helpful fordebugging.  On systems with IEEE arithmetic, compiling c_div.c andz_div.c with -DIEEE_COMPLEX_DIVIDE causes them instead to set boththe real and imaginary parts of the result to +INFINITY if thenumerator is nonzero, or to NaN if it vanishes.Nowadays most Unix and Linux systems have function	int ftruncate(int fildes, off_t len);defined in system header file unistd.h that adjusts the length of filedescriptor fildes to length len.  Unless endfile.c is compiled with-DNO_TRUNCATE, endfile.c #includes "unistd.h" and calls ftruncate() ifnecessary to shorten files.  If your system lacks ftruncate(), compileendfile.c with -DNO_TRUNCATE to make endfile.c use the older and moreportable scheme of shortening a file by copying to a temporary fileand back again.The initializations for "f2c -trapuv" are done by _uninit_f2c(),whose source is uninit.c, introduced June 2001.  On IEEE-arithmeticsystems, _uninit_f2c should initialize floating-point variables tosignaling NaNs and, at its first invocation, should enable theinvalid operation exception.  Alas, the rules for distinguishingsignaling from quiet NaNs were not specified in the IEEE P754 standard,nor were the precise means of enabling and disabling IEEE-arithmeticexceptions, and these details are thus system dependent.  There are#ifdef's in uninit.c that specify them for some popular systems.  Ifyours is not one of these systems, it may take some detective work todiscover the appropriate details for your system.  Sometimes it helpsto look in the standard include directories for header files withrelevant-sounding names, such as ieeefp.h, nan.h, or trap.h, andit may be simplest to run experiments to see what distinguishes asignaling from a quiet NaN.  (If x is initialized to a signalingNaN and the invalid operation exception is masked off, as it shouldbe by default on IEEE-arithmetic systems, then computing, say,y = x + 1 will yield a quiet NaN.)
 |