summaryrefslogtreecommitdiff
path: root/lang/f2c/patches/patch-ac
blob: e7015f99027a965cf20b5dcd78ad410571c34074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
$NetBSD: patch-ac,v 1.4 1999/01/14 13:56:04 frueauf Exp $

Much cleanup of the script.  Added various options such as
-O for optimization
-fPIC for PIC support
-Wall for gcc warnings
-Wl,  for additional linker arguments

--- fc.orig	Tue May 16 17:37:49 1995
+++ fc	Tue Jan 12 20:31:32 1999
@@ -1,26 +1,54 @@
 #!/bin/sh
-PATH=/v/bin:/bin:/usr/bin
+PATH=/bin:/usr/bin:PREFIX/bin
+#USAGESTART
 # f77-style shell script to compile and load fortran, C, and assembly codes
-
+#
 #	usage:	f77 [options] files [-l library]
-
+#
 #	Options:
-
-#		-o objfile	Override default executable name a.out.
-
+#
 #		-c		Do not call linker, leave relocatables in *.o.
-
+#
 #		-C		Check that subscripts are in bounds.
-
-#		-S		leave assembler output on file.s
-
+#
+#		-D def		passed to C compiler (for .c files)
+#				or to cpp (for .F files)
+#
+#		-fPIC		turn on the -fPIC flag to the c compiler
+#
+#		-I includepath	passed to C compiler (for .c files)
+#				or to cpp (for .F files), and to f2c
+#
 #		-l library	(passed to ld).
-
+#
+#		-L includepath	passed to ld.  Library include path
+#
+#		-Ntnnn		allow nnn entries in table t
+#
+#		-o objfile	Override default executable name a.out.
+#
+#		-O		turn on the -O flag to the c compiler
+#
+#		-O1		turn on the -O1 flag to the c compiler
+#
+#		-O2		turn on the -O2 flag to the c compiler
+#
+#		-O3		turn on the -O3 flag to the c compiler
+#
+#		-P		emit .P files
+#
+#		-S		leave assembler output on file.s
+#
 #		-u		complain about undeclared variables
-
+#
 #		-w		omit all warning messages
-
+#
 #		-w66		omit Fortran 66 compatibility warning messages
-
+#
+#		-Wall		turn on the -Wall flag to the c compiler
+#
+#		-Wl,		Pass options to the linker.  For example, -Wl,-R/usr/X11R6/lib
+#				passes "-R/usr/X11R6/lib" to the linker
+#
 #		files		FORTRAN source files ending in .f .
 #				FORTRAN with cpp preprocessor directives
@@ -30,21 +58,18 @@
 #				efl source files ending in .e .
 #				RATFOR files ending in .r .
-
+#
 #				f2c prototype files ending in .P ; such
 #				files only affect subsequent files.
 
-#		-D def		passed to C compiler (for .c files)
-#				or to cpp (for .F files)
-
-#		-I includepath	passed to C compiler (for .c files)
-#				or to cpp (for .F files), and to f2c
+# if no input arguments, then spit out the help stuff from the beginning
+# of this file.
+if [ $# = 0 ]; then
+ cat $0 | awk '$1 == "#USAGESTART", $1 == ""' | tail +2 | sed 's/#//g'
+fi
 
-#		-Ntnnn		allow nnn entries in table t
-
-#		-P		emit .P files
 
 s=/tmp/stderr_$$
 t=/tmp/f77_$$.o
-CC=${CC_f2c:-'cc -common'}
+CC=${CC_f2c:-'cc '}
 EFL=${EFL:-efl}
 EFLFLAGS=${EFLFLAGS:-'system=portable deltastno=10'}
@@ -58,25 +83,29 @@
 OUTF=a.out
 cOPT=1
-set -- `getopt cCD:gI:N:Oo:Suw6 "$@"`
-case $? in 0);; *) rc=$?; exit;; esac
+ARGS=
 CPPFLAGS=
+CFLAGS=-IPREFIX/include 
+LIBS=
 while
-	test X"$1" != X--
+	test -n "$1"
 do
 	case "$1"
 	in
-	-C)	F2CFLAGS="$F2CFLAGS -C"
-		shift;;
-
 	-c)	cOPT=0
 		shift
 		;;
 
-	-D)	CPPFLAGS="$CPPFLAGS -D$2"
-		shift 2
-		;;
+	-C)	F2CFLAGS="$F2CFLAGS -C"
+		shift;;
+
+	-D*)	CPPFLAGS="$CPPFLAGS $1"
+		shift;;
+
+        -fPIC)  CFLAGS="$CFLAGS $1"
+                shift;;
 
 	-g)	CFLAGS="$CFLAGS -g"
 		F2CFLAGS="$F2CFLAGS -g"
+		G="-g"
 		shift;;
 
@@ -86,11 +115,37 @@
 		;;
 
+        -I*)    CFLAGS="$CFLAGS $1"
+                shift 1
+                ;;
+
+        -l*)    LIBS="$LIBS $1"
+                shift 1
+                ;;
+
+        -L*)    LIBS="$LIBS $1"
+                shift 1
+                ;;
+
 	-o)	OUTF=$2
 		shift 2
 		;;
 
-	-O)	case $2 in -1) O=-O1;; -2) O=-O2;; -3) O=-O3;; *) O=-O;; esac
-		case $O in -O);; *) shift;; esac
-		CFLAGS="$CFLAGS $O"
+#	-N)	F2CFLAGS="$F2CFLAGS $1""$2"
+#		shift 2
+#		;;
+# can't seem to find out what -N is supposed to do.
+
+	-O|-O1|-O2|-O3)	
+		CFLAGS="$CFLAGS $1"
+		shift
+		;;
+
+	-P)	F2CFLAGS="$F2CFLAGS $1"
+		shift
+		;;
+
+
+	-S)	CFLAGS="$CFLAGS -S"
+		cOPT=0
 		shift
 		;;
@@ -101,30 +156,38 @@
 
 	-w)	F2CFLAGS="$F2CFLAGS -w"
-		case $2 in -6) F2CFLAGS="$F2CFLAGS"66; shift
-			case $2 in -6) shift;; esac;; esac
 		shift
 		;;
 
-	-N)	F2CFLAGS="$F2CFLAGS $1""$2"
-		shift 2
+	-w66)	F2CFLAGS="$F2CFLAGS -w66"
+		shift
 		;;
 
-	-P)	F2CFLAGS="$F2CFLAGS $1"
+	-Wall)	CFLAGS="$CFLAGS -Wall"
 		shift
 		;;
 
-
-	-S)	CFLAGS="$CFLAGS -S"
-		cOPT=0
+	-Wl*)	CFLAGS="$CFLAGS $1"
 		shift
 		;;
 
+	-*)	echo "ERROR:  $1 is not a valid option"
+		exit 1
+		;;
+
 	*)
-		echo "invalid parameter $1" 1>&2
+		ARGS="$ARGS $1"
 		shift
 		;;
 	esac
 done
-shift
+
+if test $cOPT = 0; then
+  if test "$OUTF" != "a.out"; then
+    CFLAGS="$CFLAGS -o $OUTF"
+  fi
+fi
+set -- $ARGS
+
+
 while
 	test -n "$1"
@@ -232,5 +295,20 @@
 done
 
-case $cOPT in 2) $CC -o $OUTF -u MAIN__ $OFILES -lf2c -lm;; esac
+case $cOPT 
+in 
+  2) $CC $CFLAGS -o $OUTF -u _MAIN__ $OFILES $LIBS -LPREFIX/lib -lf2c -lm
+     ;; 
+esac
+
 rc=$?
 exit $rc
+
+
+
+
+
+
+
+
+
+