1998-08-25 10:54:06 +02:00
|
|
|
$NetBSD: patch-ac,v 1.3 1998/08/25 08:54:07 agc Exp $
|
|
|
|
|
|
|
|
Add various options to f2c, including PIC support
|
1998-08-07 13:08:53 +02:00
|
|
|
|
1998-07-21 18:40:45 +02:00
|
|
|
--- fc.orig Tue May 16 17:37:49 1995
|
1998-08-25 10:54:06 +02:00
|
|
|
+++ fc Mon Aug 24 14:05:40 1998
|
|
|
|
@@ -1,26 +1,51 @@
|
1998-07-21 18:40:45 +02:00
|
|
|
#!/bin/sh
|
|
|
|
-PATH=/v/bin:/bin:/usr/bin
|
|
|
|
+PATH=/bin:/usr/bin:PREFIX/bin
|
1998-08-25 10:54:06 +02:00
|
|
|
+#USAGESTART
|
1998-07-21 18:40:45 +02:00
|
|
|
# f77-style shell script to compile and load fortran, C, and assembly codes
|
1998-08-25 10:54:06 +02:00
|
|
|
-
|
|
|
|
+#
|
|
|
|
# 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.
|
|
|
|
+#
|
1998-07-21 18:40:45 +02:00
|
|
|
+# -O turn on the -O flag to the c compiler
|
1998-08-25 10:54:06 +02:00
|
|
|
+#
|
1998-07-21 18:40:45 +02:00
|
|
|
+# -O1 turn on the -O1 flag to the c compiler
|
1998-08-25 10:54:06 +02:00
|
|
|
+#
|
1998-07-21 18:40:45 +02:00
|
|
|
+# -O2 turn on the -O2 flag to the c compiler
|
1998-08-25 10:54:06 +02:00
|
|
|
+#
|
1998-07-21 18:40:45 +02:00
|
|
|
+# -O3 turn on the -O3 flag to the c compiler
|
1998-08-25 10:54:06 +02:00
|
|
|
+#
|
|
|
|
+# -P emit .P files
|
|
|
|
+#
|
|
|
|
+# -S leave assembler output on file.s
|
|
|
|
+#
|
|
|
|
# -u complain about undeclared variables
|
|
|
|
-
|
|
|
|
+#
|
|
|
|
# -w omit all warning messages
|
|
|
|
-
|
|
|
|
+#
|
1998-07-21 18:40:45 +02:00
|
|
|
# -w66 omit Fortran 66 compatibility warning messages
|
1998-08-25 10:54:06 +02:00
|
|
|
-
|
|
|
|
+#
|
|
|
|
+# -Wall turn on the -Wall flag to the c compiler
|
|
|
|
+#
|
|
|
|
# files FORTRAN source files ending in .f .
|
|
|
|
# FORTRAN with cpp preprocessor directives
|
|
|
|
@@ -30,21 +55,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
|
|
|
|
-
|
|
|
|
-# -Ntnnn allow nnn entries in table t
|
|
|
|
+# 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
|
|
|
|
|
|
|
|
-# -P emit .P files
|
1998-07-21 18:40:45 +02:00
|
|
|
|
|
|
|
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'}
|
1998-08-25 10:54:06 +02:00
|
|
|
@@ -58,25 +80,29 @@
|
1998-07-21 18:40:45 +02:00
|
|
|
OUTF=a.out
|
|
|
|
cOPT=1
|
|
|
|
-set -- `getopt cCD:gI:N:Oo:Suw6 "$@"`
|
1998-08-25 10:54:06 +02:00
|
|
|
-case $? in 0);; *) rc=$?; exit;; esac
|
|
|
|
+ARGS=
|
1998-07-21 18:40:45 +02:00
|
|
|
CPPFLAGS=
|
|
|
|
+CFLAGS=-IPREFIX/include
|
1998-08-25 10:54:06 +02:00
|
|
|
+LIBS=
|
1998-07-21 18:40:45 +02:00
|
|
|
while
|
1998-08-25 10:54:06 +02:00
|
|
|
- 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,45 +112,75 @@
|
|
|
|
;;
|
|
|
|
|
|
|
|
+ -I*) CFLAGS="$CFLAGS $1"
|
|
|
|
+ shift 1
|
|
|
|
+ ;;
|
|
|
|
+
|
|
|
|
+ -l*) LIBS="$LIBS $1"
|
|
|
|
+ shift 1
|
|
|
|
+ ;;
|
|
|
|
+
|
|
|
|
+ -L*) LIBS="$LIBS $1"
|
|
|
|
+ shift 1
|
|
|
|
+ ;;
|
|
|
|
+
|
|
|
|
-o) OUTF=$2
|
|
|
|
shift 2
|
1998-07-21 18:40:45 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
- -O) case $2 in -1) O=-O1;; -2) O=-O2;; -3) O=-O3;; *) O=-O;; esac
|
1998-08-25 10:54:06 +02:00
|
|
|
- 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
|
1998-07-21 18:40:45 +02:00
|
|
|
;;
|
|
|
|
|
1998-08-25 10:54:06 +02:00
|
|
|
- -u) F2CFLAGS="$F2CFLAGS -u"
|
|
|
|
+ -P) F2CFLAGS="$F2CFLAGS $1"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
- -w) F2CFLAGS="$F2CFLAGS -w"
|
|
|
|
- case $2 in -6) F2CFLAGS="$F2CFLAGS"66; shift
|
|
|
|
- case $2 in -6) shift;; esac;; esac
|
|
|
|
+
|
|
|
|
+ -S) CFLAGS="$CFLAGS -S"
|
|
|
|
+ cOPT=0
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
- -N) F2CFLAGS="$F2CFLAGS $1""$2"
|
|
|
|
- shift 2
|
|
|
|
+ -u) F2CFLAGS="$F2CFLAGS -u"
|
|
|
|
+ shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
- -P) F2CFLAGS="$F2CFLAGS $1"
|
|
|
|
+ -w) F2CFLAGS="$F2CFLAGS -w"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
+ -w66) F2CFLAGS="$F2CFLAGS -w66"
|
1998-07-21 18:40:45 +02:00
|
|
|
+ shift
|
|
|
|
+ ;;
|
1998-08-25 10:54:06 +02:00
|
|
|
|
|
|
|
- -S) CFLAGS="$CFLAGS -S"
|
|
|
|
- cOPT=0
|
|
|
|
+ -Wall) CFLAGS="$CFLAGS -Wall"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
+ -*) echo "ERROR: $1 is not a valid option"
|
|
|
|
+ exit 1
|
|
|
|
+ ;;
|
1998-07-21 18:40:45 +02:00
|
|
|
+
|
1998-08-25 10:54:06 +02:00
|
|
|
*)
|
|
|
|
- echo "invalid parameter $1" 1>&2
|
|
|
|
+ ARGS="$ARGS $1"
|
1998-07-21 18:40:45 +02:00
|
|
|
shift
|
1998-08-25 10:54:06 +02:00
|
|
|
;;
|
|
|
|
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 +288,20 @@
|
1998-07-21 18:40:45 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
-case $cOPT in 2) $CC -o $OUTF -u MAIN__ $OFILES -lf2c -lm;; esac
|
1998-08-25 10:54:06 +02:00
|
|
|
+case $cOPT
|
|
|
|
+in
|
|
|
|
+ 2) $CC $CFLAGS -o $OUTF -u _MAIN__ $OFILES $LIBS -LPREFIX/lib -lf2c -lm
|
|
|
|
+ ;;
|
|
|
|
+esac
|
|
|
|
+
|
1998-07-21 18:40:45 +02:00
|
|
|
rc=$?
|
|
|
|
exit $rc
|
1998-08-25 10:54:06 +02:00
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|