summaryrefslogtreecommitdiff
path: root/lang/f2c
diff options
context:
space:
mode:
authordmcmahill <dmcmahill>2007-02-05 14:33:21 +0000
committerdmcmahill <dmcmahill>2007-02-05 14:33:21 +0000
commit54bc853f6c862b655ded4677cbcdbb3661e42e21 (patch)
tree67804de1ddeb38485d84682df8706363f16a7809 /lang/f2c
parentd710c96bba214ced6c004a3e9267b1aa833ef36d (diff)
downloadpkgsrc-54bc853f6c862b655ded4677cbcdbb3661e42e21.tar.gz
- The f2c-f77 script that emulates a fortran comiler has deviated so much
from the original, that it has become easier to maintain it as its own file instead of a patch, so do that. - Improve the shell quoting quite a bit in the f2c-f77 script. Now you can pass things like -DFOO=this\ is\ a\ test and have the escapes actually work when the arguments get passed down to the underlying commands. Many thanks to Alan Barrett for help with the shell quoting. - bump pkgrev
Diffstat (limited to 'lang/f2c')
-rw-r--r--lang/f2c/Makefile7
-rw-r--r--lang/f2c/distinfo5
-rw-r--r--lang/f2c/files/f2c-f77.in441
-rw-r--r--lang/f2c/patches/patch-aa6
-rw-r--r--lang/f2c/patches/patch-ac494
5 files changed, 450 insertions, 503 deletions
diff --git a/lang/f2c/Makefile b/lang/f2c/Makefile
index 4caacd015fb..157a0005479 100644
--- a/lang/f2c/Makefile
+++ b/lang/f2c/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.38 2005/12/05 20:50:25 rillig Exp $
+# $NetBSD: Makefile,v 1.39 2007/02/05 14:33:21 dmcmahill Exp $
DISTNAME= f2c-20001205
-PKGREVISION= 8
+PKGREVISION= 9
CATEGORIES= lang
MASTER_SITES= ${MASTER_SITE_LOCAL}
@@ -30,7 +30,8 @@ MAKE_ENV+= F2CMAJOR=${F2CMAJOR:Q} F2CMINOR=${F2CMINOR:Q}
MAKE_ENV+= LIBOWN=${LIBOWN:Q} LIBGRP=${LIBGRP:Q}
MAKE_ENV+= AWK=${AWK:Q}
MAKE_ENV+= ECHO=${ECHO:Q}
-
+MAKE_ENV+= F2C_F77_IN=${FILESDIR:Q}/f2c-f77.in
+MAKE_ENV+= SCRIPT_SHELL=${TOOLS_PLATFORM.sh:Q}
WRKSRC= ${WRKDIR}/f2c
USE_LIBTOOL= yes
USE_TOOLS+= gunzip
diff --git a/lang/f2c/distinfo b/lang/f2c/distinfo
index 3a9078e8f44..be8c5d24abd 100644
--- a/lang/f2c/distinfo
+++ b/lang/f2c/distinfo
@@ -1,11 +1,10 @@
-$NetBSD: distinfo,v 1.14 2005/02/24 09:03:06 agc Exp $
+$NetBSD: distinfo,v 1.15 2007/02/05 14:33:21 dmcmahill Exp $
SHA1 (f2c-20001205.tar.gz) = f3cc1653eb962fee45d850df50890fc53448a17f
RMD160 (f2c-20001205.tar.gz) = b376105c33ca53df46cab458082b26dbc9a53762
Size (f2c-20001205.tar.gz) = 988607 bytes
-SHA1 (patch-aa) = ca2ced3179b4866ab6d1f8ffa6d7a4e08221cc9a
+SHA1 (patch-aa) = 43389ccb26799981a5f4c53954f615634ebf3a1d
SHA1 (patch-ab) = 97c676fa452daa674e11348412ccb26d38a7baa4
-SHA1 (patch-ac) = a80ca0b5be4bc675405db8f50bbf1ff6660004fe
SHA1 (patch-ad) = 7f204a45891e3632589ea8fb0e4e379a0a792dea
SHA1 (patch-ae) = f17254cab1449273ca44e652ed2f1a586a9a3e19
SHA1 (patch-af) = fe24139c21862e85c576118166b7deab8e421572
diff --git a/lang/f2c/files/f2c-f77.in b/lang/f2c/files/f2c-f77.in
new file mode 100644
index 00000000000..671b7b52ec9
--- /dev/null
+++ b/lang/f2c/files/f2c-f77.in
@@ -0,0 +1,441 @@
+#!@SHELL@
+PATH=$PATH:/bin:/usr/bin:@PREFIX@/bin
+#
+# This script has deviated so much from "fc" that it is now easier to
+# maintain it as its own file instead of a patch. Some improvements
+# over "fc" are:
+#
+# -O for optimization
+# -fPIC for PIC support
+# -Wxxx for gcc warnings
+# -Wl, for additional linker arguments
+# -pg for profiled code
+# -r8 promote REAL and COMPLEX to DOUBLE REAL and DOUBLE COMPLEX
+# -s to strip executible
+# -v for verbose output
+#
+# Also only pass -m* to the C compiler not f2c.
+#
+# Unknown options are passed on to the C compiler and C preprocessor.
+#
+#USAGESTART
+# f77-style shell script to compile and load fortran, C, and assembly codes
+#
+# usage: f2c-f77 [options] files [-l library]
+#
+# Options:
+#
+# -c Do not call linker, leave relocatables in *.o.
+#
+# -C Check that subscripts are in bounds.
+#
+# -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
+#
+# -g produce debugging information.
+#
+# -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
+#
+# -m xxx passed to the C compiler as -mxxx
+#
+# -Ntnnn allow nnn entries in table t
+#
+# -o objfile Override default executable name a.out.
+#
+# -pg pass -pg (generate profile information) to the c
+# compiler.
+#
+# -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
+#
+# -r8 promote REAL to DOUBLE PRECISION,
+# COMPLEX to DOUBLE COMPLEX
+#
+# -s Strip the symbol table from the executable file
+#
+# -S leave assembler output on file.s
+#
+# -u complain about undeclared variables
+#
+# -U def passed to C compiler (for .c files) or to
+# cpp (for .F files) to remove def
+#
+# -v be verbose. Output is produced on the standard
+# error output.
+#
+# -w omit all warning messages
+#
+# -w66 omit Fortran 66 compatibility warning messages
+#
+# -Wxxx turn on the -Wxxx 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
+# ending in .F
+# C source files ending in .c
+# Assembly language files ending in .s
+# efl source files ending in .e
+# RATFOR files ending in .r
+# Object files ending in .o
+# Shared libraries ending in .so
+#
+# f2c prototype files ending in .P ; such
+# files only affect subsequent files.
+
+# 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
+
+# Quote args to make them safe in the shell.
+#
+# After building up a quoted list, use it by evaling it inside
+# double quotes, like this:
+# eval "set -- $quotedlist"
+# or like this:
+# eval "\$command $quotedlist \$filename"
+shell_quote()
+{
+ local result=''
+ local arg
+ for arg in "$@" ; do
+ # Append a space if necessary
+ result="${result}${result:+ }"
+ # Convert each embedded ' to '\'',
+ # then insert ' at the beginning of the first line,
+ # and append ' at the end of the last line.
+ result="${result}$(printf "%s\n" "$arg" | \
+ sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/")"
+ # For shells that don't understand $(...), try the following:
+ #result="${result}`printf \"%s\\n\" \"\$arg\" | \
+ # sed -e \"s/'/'\\\\\\\\''/g\" -e \"1s/^/'/\" -e \"\\\$s/\\\$/'/\"`"
+ done
+ printf "%s\n" "$result"
+}
+
+tmpd=${TMPDIR:-/tmp}
+mytmp=${tmpd}/f2c_$$
+mkdir -m 0700 $mytmp
+if test $? -ne 0 ; then
+ echo "ERROR: Could not create temporary directory ${mytmp}"
+ echo "Either you do not have write permission to ${tmpd} or"
+ echo "${mytmp} already exists"
+ exit 1
+fi
+s=${mytmp}/stderr
+t=${mytmp}/f77.o
+CC=${CC_f2c:-'@CC@ '}
+EFL=${EFL:-efl}
+EFLFLAGS=${EFLFLAGS:-'system=portable deltastno=10'}
+RATFOR=${RATFOR:-ratfor}
+RFLAGS=${RFLAGS:-'-6&'}
+F2C=${F2C:-@PREFIX@/bin/f2c}
+F2CFLAGS=${F2CFLAGS:='-Aw8 -Nn802 -Nx400'}
+S2DBLFLAG="-R"
+CPP=${CPP:-'@CPP@ '}
+rc=0
+trap "rm -fr $s $t $mytmp ; exit \$rc" 0
+OUTF=a.out
+cOPT=1
+ARGS=
+CPPFLAGS=
+CFLAGS=-I@PREFIX@/include
+LIBS=
+FLIBS="-Wl,-R@PREFIX@/lib -L@PREFIX@/lib -lF77 -lI77 -lm"
+VERBOSE=no
+
+while
+ test -n "$1"
+do
+ case "$1"
+ in
+ -c) cOPT=0
+ shift
+ ;;
+
+ -C) F2CFLAGS="$F2CFLAGS -C"
+ shift;;
+
+ -D*) CPPFLAGS="$CPPFLAGS $(shell_quote "$1")"
+ shift;;
+
+ -fPIC) CFLAGS="$CFLAGS $1"
+ shift;;
+
+ -g) CFLAGS="$CFLAGS -g"
+ F2CFLAGS="$F2CFLAGS -g"
+ G="-g"
+ shift;;
+
+ -I) CFLAGS="$CFLAGS $(shell_quote "-I$2")"
+ CPPFLAGS="$CPPFLAGS $(shell_quote "-I$2")"
+ F2CFLAGS="$F2CFLAGS $(shell_quote "-I$2")"
+ shift 2
+ ;;
+
+ -I*) CFLAGS="$CFLAGS $(shell_quote "$1")"
+ CPPFLAGS="$CPPFLAGS $(shell_quote "$1")"
+ F2CFLAGS="$F2CFLAGS $(shell_quote "$1")"
+ shift 1
+ ;;
+
+ -l*) LIBS="$LIBS $(shell_quote "$1")"
+ shift 1
+ ;;
+
+ -L*) LIBS="$LIBS $(shell_quote "$1")"
+ shift 1
+ ;;
+
+ -m) CFLAGS="$CFLAGS $(shell_quote "-m$2")"
+ CPPFLAGS="$CPPFLAGS $(shell_quote "-m$2")"
+ shift 2
+ ;;
+
+ -m*) CFLAGS="$CFLAGS $(shell_quote "$1")"
+ CPPFLAGS="$CPPFLAGS $(shell_quote "$1")"
+ shift 1
+ ;;
+
+ -o) OUTF="$2"
+ shift 2
+ ;;
+
+ -N) F2CFLAGS="$F2CFLAGS $(shell_quote "$1""$2")"
+ shift 2
+ ;;
+
+ -O|-O1|-O2|-O3)
+ CFLAGS="$CFLAGS $1"
+ shift
+ ;;
+
+ -pg) CFLAGS="$CFLAGS $1"
+ shift;;
+
+ -P) F2CFLAGS="$F2CFLAGS $1"
+ shift
+ ;;
+
+ -r8) S2DBLFLAG="-r8"
+ shift
+ ;;
+
+ -s) CFLAGS="$CFLAGS -s"
+ shift
+ ;;
+
+ -S) CFLAGS="$CFLAGS -S"
+ cOPT=0
+ shift
+ ;;
+
+ -u) F2CFLAGS="$F2CFLAGS -u"
+ shift
+ ;;
+
+ -U*) CPPFLAGS="$CPPFLAGS $(shell_quote "$1")"
+ shift;;
+
+ -v) VERBOSE=yes
+ shift
+ ;;
+
+ -w) F2CFLAGS="$F2CFLAGS -w"
+ shift
+ ;;
+
+ -w66) F2CFLAGS="$F2CFLAGS -w66"
+ shift
+ ;;
+
+ -Wl*) CFLAGS="$CFLAGS $(shell_quote "$1")"
+ shift
+ ;;
+
+ -W*) CFLAGS="$CFLAGS $(shell_quote "$1")"
+ shift
+ ;;
+
+ -*) CFLAGS="$CFLAGS $(shell_quote "$1")"
+ CPPFLAGS="$CPPFLAGS $(shell_quote "$1")"
+ if test $VERBOSE = "yes"; then
+ echo "Warning: Passing unknown option $1 on to the c compiler"
+ fi
+ shift
+ ;;
+
+ *)
+ ARGS="$ARGS $(shell_quote "$1")"
+ shift
+ ;;
+ esac
+done
+
+if test $cOPT = 0; then
+ if test "$OUTF" != "a.out"; then
+ CFLAGS="$CFLAGS -o $(shell_quote "$OUTF")"
+ fi
+fi
+
+# set the flag that controls if REAL's are promoted to
+# DOUBLE PRECISION or not
+F2CFLAGS="$F2CFLAGS $S2DBLFLAGS"
+
+eval "set -- $ARGS"
+
+if test $VERBOSE = "yes"; then
+ F2CVER=`$F2C < /dev/null | awk '/.*version/ {print $6" "$7}'`
+ echo "f2c-f77:"
+ echo "F2C= $F2C, $F2CVER"
+ echo "CC= $CC"
+ echo "CFLAGS= $CFLAGS"
+ echo "CPPFLAGS= $CPPFLAGS"
+ echo "FLIBS= $FLIBS"
+ echo "LD_RUN_PATH= @PREFIX@/lib"
+fi
+
+while
+ test -n "$1"
+do
+ case "$1"
+ in
+ *.[fF])
+ case "$1" in *.f) f=".f";; *.F) f=".F";; esac
+ case "$1" in
+ *.f) b=`basename $1 .f`
+ if test $VERBOSE = "yes"; then
+ echo "$F2C $F2CFLAGS $1"
+ fi
+ eval "\$F2C $F2CFLAGS \$1"
+ rc=$?
+ ;;
+ *.F) b=`basename $1 .F`
+ $CPP $CPPFLAGS $1 >$b.i
+ rc=$?
+ case $rc in 0)
+ if test $VERBOSE="yes"; then
+ echo "$F2C $F2CFLAGS <$b.i >$b.c"
+ fi
+ eval "\$F2C $F2CFLAGS" <$b.i >$b.c
+ rc=$?
+ ;;esac
+ rm $b.i
+ ;;
+ esac
+ case $rc in 0);; *) exit;; esac
+ eval "\$CC -c $CFLAGS \$b.c" 2>$s
+ rc=$?
+ sed '/parameter .* is not referenced/d;/warning: too many parameters/d' $s 1>&2
+ case $rc in 0);; *) exit;; esac
+ OFILES="$OFILES $b.o"
+ rm $b.c
+ case $cOPT in 1) cOPT=2;; esac
+ shift
+ ;;
+ *.e)
+ b=`basename $1 .e`
+ eval "\$EFL $EFLFLAGS \$1" >$b.f
+ case $? in 0);; *) rc=$?; exit;; esac
+ eval "\$F2C $F2CFLAGS \$b.f"
+ case $? in 0);; *) rc=$?; exit;; esac
+ eval "\$CC -c $CFLAGS \$b.c"
+ case $? in 0);; *) rc=$?; exit;; esac
+ OFILES="$OFILES $b.o"
+ rm $b.[cf]
+ case $cOPT in 1) cOPT=2;; esac
+ shift
+ ;;
+ *.r)
+ b=`basename $1 .r`
+ eval "\$RATFOR $RFLAGS \$1" >$b.f
+ case $? in 0);; *) rc=$?; exit;; esac
+ eval "\$F2C $F2CFLAGS \$b.f"
+ case $? in 0);; *) rc=$?; exit;; esac
+ eval "\$CC -c $CFLAGS \$b.c"
+ case $? in 0);; *) rc=$?; exit;; esac
+ OFILES="$OFILES $b.o"
+ rm $b.[cf]
+ case $cOPT in 1) cOPT=2;; esac
+ shift
+ ;;
+ *.s)
+ echo $1: 1>&2
+ OFILE=`basename $1 .s`.o
+ eval "\${AS:-as} -o \$OFILE $AFLAGS \$1"
+ case $? in 0);; *) rc=$?; exit;; esac
+ OFILES="$OFILES $OFILE"
+ case $cOPT in 1) cOPT=2;; esac
+ shift
+ ;;
+ *.c)
+ echo $1: 1>&2
+ OFILE=`basename $1 .c`.o
+ eval "\$CC -c $CPPFLAGS $CFLAGS \$1"
+ rc=$?; case $rc in 0);; *) rc=$?; exit;; esac
+ OFILES="$OFILES $OFILE"
+ case $cOPT in 1) cOPT=2;; esac
+ shift
+ ;;
+ *.o)
+ OFILES="$OFILES $1"
+ case $cOPT in 1) cOPT=2;; esac
+ shift
+ ;;
+ *.so)
+ OFILES="$OFILES $1"
+ case $cOPT in 1) cOPT=2;; esac
+ shift
+ ;;
+ -l)
+ OFILES="$OFILES -l$2"
+ shift 2
+ case $cOPT in 1) cOPT=2;; esac
+ ;;
+ -l*)
+ OFILES="$OFILES $1"
+ shift
+ case $cOPT in 1) cOPT=2;; esac
+ ;;
+ -o)
+ OUTF=$2; shift 2;;
+ *.P)
+ F2CFLAGS="$F2CFLAGS $(shell_quote "$1")"
+ shift
+ ;;
+ *)
+ OFILES="$OFILES $1"
+ shift
+ case $cOPT in 1) cOPT=2;; esac
+ ;;
+ esac
+done
+
+case $cOPT
+in
+ 2) eval "\$CC $CFLAGS -o \$OUTF @MAIN@ $OFILES $LIBS $FLIBS"
+ ;;
+esac
+
+rc=$?
+exit $rc
+
diff --git a/lang/f2c/patches/patch-aa b/lang/f2c/patches/patch-aa
index 9050b253b9e..eb40f5cd682 100644
--- a/lang/f2c/patches/patch-aa
+++ b/lang/f2c/patches/patch-aa
@@ -1,4 +1,4 @@
-$NetBSD: patch-aa,v 1.14 2004/09/15 20:56:31 dmcmahill Exp $
+$NetBSD: patch-aa,v 1.15 2007/02/05 14:33:21 dmcmahill Exp $
--- Makefile.orig Tue Sep 14 16:47:52 2004
+++ Makefile
@@ -44,9 +44,9 @@ $NetBSD: patch-aa,v 1.14 2004/09/15 20:56:31 dmcmahill Exp $
+ ${BSD_INSTALL_MAN} ./f2c.1 ${PREFIX}/man/man1
+ ${BSD_INSTALL_MAN} ./f2c.0 ${PREFIX}/man/cat1
+
-+f2c-f77: fc f2c hello.f
++f2c-f77: ${F2C_F77_IN} f2c hello.f
+ ./src/f2c -Aw8 -Nn802 -Nx400 hello.f
+ $(CC) $(CFLAGS) -c hello.c
+ main=`$(NM) hello.o | ${AWK} 'BEGIN{x=""} {gsub(/\|/,""); for(i=1; i<=NF; i=i+1){if($$i ~ /MAIN/){x="-u " $$i}}} END{print x}'` ; \
+ ${ECHO} "Adding $$main to f2c-f77 script" ; \
-+ sed -e 's;@PREFIX@;${PREFIX};g' -e 's;@CC@;${CC};g' -e 's;@CPP@;${CPP};g' -e "s;@MAIN@;$$main;g" fc > f2c-f77
++ sed -e 's;@PREFIX@;${PREFIX};g' -e 's;@CC@;${CC};g' -e 's;@CPP@;${CPP};g' -e "s;@MAIN@;$$main;g" -e "s;@SHELL@;${SCRIPT_SHELL};g" ${F2C_F77_IN} > f2c-f77
diff --git a/lang/f2c/patches/patch-ac b/lang/f2c/patches/patch-ac
deleted file mode 100644
index 71ac39da7ef..00000000000
--- a/lang/f2c/patches/patch-ac
+++ /dev/null
@@ -1,494 +0,0 @@
-$NetBSD: patch-ac,v 1.15 2005/01/28 23:37:42 dmcmahill Exp $
-
-Much cleanup of the script. Added various options such as
--O for optimization
--fPIC for PIC support
--Wxxx for gcc warnings
--Wl, for additional linker arguments
--pg for profiled code
--r8 promote REAL and COMPLEX to DOUBLE REAL and DOUBLE COMPLEX
--s to strip executible
--v for verbose output
-
-Also only pass -m* to the C compiler not f2c.
-
-Unknown options are passed on to the C compiler and C preprocessor.
-
---- fc.orig 2000-07-07 21:47:06.000000000 +0000
-+++ fc
-@@ -1,179 +1,276 @@
--#! /bin/sh
--
--# NOTE: you may need to adjust the references to /usr/local/... below
--# (or remove them if they're not needed on your system).
--# You may need to remove "-Olimit 2000" in the -O processing
--# below or change it to something more suitable for your system.
--# See also the comments starting with ### below.
--
--# Note that with some shells, invocations of the form
--# CFLAGS='system-specific stuff' fc ...
--# may be useful as way to pass system-specific stuff to the C compiler.
--# The script below simply appends to the initial CFLAGS value.
--
--PATH=/usr/local/bin:/bin:/usr/bin
--
-+#!/bin/sh
-+PATH=$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]
--
-+#
-+# usage: f2c-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.
--
-+#
-+# -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
-+#
-+# -g produce debugging information.
-+#
-+# -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
-+#
-+# -m xxx passed to the C compiler as -mxxx
-+#
-+# -Ntnnn allow nnn entries in table t
-+#
-+# -o objfile Override default executable name a.out.
-+#
-+# -pg pass -pg (generate profile information) to the c
-+# compiler.
-+#
-+# -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
-+#
-+# -r8 promote REAL to DOUBLE PRECISION,
-+# COMPLEX to DOUBLE COMPLEX
-+#
-+# -s Strip the symbol table from the executable file
-+#
- # -S leave assembler output on file.s
--
--# -L libdir (passed to ld)
--
--# -l library (passed to ld)
--
-+#
- # -u complain about undeclared variables
--
-+#
-+# -U def passed to C compiler (for .c files) or to
-+# cpp (for .F files) to remove def
-+#
-+# -v be verbose. Output is produced on the standard
-+# error output.
-+#
- # -w omit all warning messages
--
-+#
- # -w66 omit Fortran 66 compatibility warning messages
--
--# files FORTRAN source files ending in .f .
-+#
-+# -Wxxx turn on the -Wxxx 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
--# ending in .F .
--# C source files ending in .c .
--# Assembly language files ending in .s .
--# efl source files ending in .e .
--# RATFOR files ending in .r .
--# Object files ending in .o .
--# Shared libraries ending in .so .
--
-+# ending in .F
-+# C source files ending in .c
-+# Assembly language files ending in .s
-+# efl source files ending in .e
-+# RATFOR files ending in .r
-+# Object files ending in .o
-+# Shared libraries ending in .so
-+#
- # 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
--
--# -m xxx passed to C compiler as -mxxx
--
--# -N tnnn allow nnn entries in table t
--
--# -P emit .P files
--
--# -U def passed to C compiler (for .c files)
--# or to cpp (for .F files) to remove def
--
--s=/tmp/stderr_$$
--t=/tmp/f77_$$.o
--### On some systems (e.g., IRIX), -common prevents complaints
--### about multiple definitions of COMMON blocks.
--#CC=${CC_f2c:-'cc -common'}
--CC=${CC_f2c:-'cc'}
-+# 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
-+
-+
-+tmpd=${TMPDIR:-/tmp}
-+mytmp=${tmpd}/f2c_$$
-+mkdir -m 0700 $mytmp
-+if test $? -ne 0 ; then
-+ echo "ERROR: Could not create temporary directory ${mytmp}"
-+ echo "Either you do not have write permission to ${tmpd} or"
-+ echo "${mytmp} already exists"
-+ exit 1
-+fi
-+s=${mytmp}/stderr
-+t=${mytmp}/f77.o
-+CC=${CC_f2c:-'@CC@ '}
- EFL=${EFL:-efl}
- EFLFLAGS=${EFLFLAGS:-'system=portable deltastno=10'}
- RATFOR=${RATFOR:-ratfor}
- RFLAGS=${RFLAGS:-'-6&'}
--F2C=${F2C:-/usr/local/bin/f2c}
--F2CFLAGS=${F2CFLAGS:='-ARw8 -Nn802 -Nq300 -Nx400'}
--CPP=${CPP:-/lib/cpp}
-+F2C=${F2C:-@PREFIX@/bin/f2c}
-+F2CFLAGS=${F2CFLAGS:='-Aw8 -Nn802 -Nx400'}
-+S2DBLFLAG="-R"
-+CPP=${CPP:-'@CPP@ '}
- rc=0
--trap "rm -f $s $t; exit \$rc" 0
-+trap "rm -fr $s $t $mytmp ; exit \$rc" 0
- OUTF=a.out
--OUTO=
- cOPT=1
--set -- `getopt cCD:gI:L:m:N:OU:o:Suw6 "$@"`
--case $? in 0);; *) rc=$?; exit;; esac
--CPPFLAGS=${CPPFLAGS:-'-I/usr/local/include'}
--CFLAGSF2C=${CFLAGSF2C:-'-I/usr/local/include'}
--OFILES=
-+ARGS=
-+CPPFLAGS=
-+CFLAGS=-I@PREFIX@/include
-+LIBS=
-+FLIBS="-Wl,-R@PREFIX@/lib -L@PREFIX@/lib -lF77 -lI77 -lm"
-+VERBOSE=no
-+
- 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;;
-
-- -I) CPPFLAGS="$CPPFLAGS -I$2"
-+ -I) CFLAGS="$CFLAGS -I$2"
-+ CPPFLAGS="$CPPFLAGS -I$2"
- F2CFLAGS="$F2CFLAGS -I$2"
- shift 2
- ;;
-
-+ -I*) CFLAGS="$CFLAGS $1"
-+ CPPFLAGS="$CPPFLAGS $1"
-+ F2CFLAGS="$F2CFLAGS $1"
-+ shift 1
-+ ;;
-+
-+ -l*) LIBS="$LIBS $1"
-+ shift 1
-+ ;;
-+
-+ -L*) LIBS="$LIBS $1"
-+ shift 1
-+ ;;
-+
- -m) CFLAGS="$CFLAGS -m$2"
-+ CPPFLAGS="$CPPFLAGS -m$2"
- shift 2
- ;;
-
-- -U) CPPFLAGS="$CPPFLAGS -U$2"
-+ -m*) CFLAGS="$CFLAGS $1"
-+ CPPFLAGS="$CPPFLAGS $1"
-+ shift 1
-+ ;;
-+
-+ -o) OUTF=$2
- shift 2
- ;;
-
-- -o) OUTF=$2
-- OUTO=$2
-+ -N) F2CFLAGS="$F2CFLAGS $1""$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 -Olimit 2000"
-+ -O|-O1|-O2|-O3)
-+ CFLAGS="$CFLAGS $1"
- shift
- ;;
-
-- -u) F2CFLAGS="$F2CFLAGS -u"
-+ -pg) CFLAGS="$CFLAGS $1"
-+ shift;;
-+
-+ -P) F2CFLAGS="$F2CFLAGS $1"
- shift
- ;;
-
-- -w) F2CFLAGS="$F2CFLAGS -w"
-- case $2 in -6) F2CFLAGS="$F2CFLAGS"66; shift
-- case $2 in -6) shift;; esac;; esac
-+ -r8) S2DBLFLAG="-r8"
- shift
- ;;
-
-- -L) OFILES="$OFILES $1$2"
-- shift 2
-- case $cOPT in 1) cOPT=2;; esac
-+ -s) CFLAGS="$CFLAGS -s"
-+ shift
- ;;
-
-- -L*) OFILES="$OFILES $1"
-+ -S) CFLAGS="$CFLAGS -S"
-+ cOPT=0
- shift
-- case $cOPT in 1) cOPT=2;; esac
- ;;
-
-- -N) F2CFLAGS="$F2CFLAGS $1""$2"
-- shift 2
-+ -u) F2CFLAGS="$F2CFLAGS -u"
-+ shift
- ;;
-
-- -P) F2CFLAGS="$F2CFLAGS $1"
-+ -U*) CPPFLAGS="$CPPFLAGS $1"
-+ shift;;
-+
-+ -v) VERBOSE=yes
- shift
- ;;
-
-+ -w) F2CFLAGS="$F2CFLAGS -w"
-+ shift
-+ ;;
-
-- -S) CFLAGS="$CFLAGS -S"
-- cOPT=0
-+ -w66) F2CFLAGS="$F2CFLAGS -w66"
-+ shift
-+ ;;
-+
-+ -Wl*) CFLAGS="$CFLAGS $1"
-+ shift
-+ ;;
-+
-+ -W*) CFLAGS="$CFLAGS $1"
-+ shift
-+ ;;
-+
-+ -*) CFLAGS="$CFLAGS $1"
-+ CPPFLAGS="$CPPFLAGS $1"
-+ if test $VERBOSE = "yes"; then
-+ echo "Warning: Passing unknown option $1 on to the c compiler"
-+ fi
- shift
- ;;
-
- *)
-- echo "invalid parameter $1" 1>&2
-+ ARGS="$ARGS $1"
- shift
- ;;
- esac
- done
--shift
--case $cOPT in 0) case $OUTO in '');; *) CFLAGS="$CFLAGS -o $OUTO";; esac;; esac
-+
-+if test $cOPT = 0; then
-+ if test "$OUTF" != "a.out"; then
-+ CFLAGS="$CFLAGS -o $OUTF"
-+ fi
-+fi
-+
-+# set the flag that controls if REAL's are promoted to
-+# DOUBLE PRECISION or not
-+F2CFLAGS="$F2CFLAGS $S2DBLFLAGS"
-+
-+set -- $ARGS
-+
-+if test $VERBOSE = "yes"; then
-+ F2CVER=`$F2C < /dev/null | awk '/.*version/ {print $6" "$7}'`
-+ echo "f2c-f77:"
-+ echo "F2C= $F2C, $F2CVER"
-+ echo "CC= $CC"
-+ echo "CFLAGS= $CFLAGS"
-+ echo "CPPFLAGS= $CPPFLAGS"
-+ echo "FLIBS= $FLIBS"
-+ echo "LD_RUN_PATH= @PREFIX@/lib"
-+fi
-+
- while
- test -n "$1"
- do
-@@ -183,6 +280,9 @@ do
- case "$1" in *.f) f=".f";; *.F) f=".F";; esac
- case "$1" in
- *.f) b=`basename $1 .f`
-+ if test $VERBOSE = "yes"; then
-+ echo "$F2C $F2CFLAGS $1"
-+ fi
- $F2C $F2CFLAGS $1
- rc=$?
- ;;
-@@ -190,6 +290,9 @@ do
- $CPP $CPPFLAGS $1 >$b.i
- rc=$?
- case $rc in 0)
-+ if test $VERBOSE="yes"; then
-+ echo "$F2C $F2CFLAGS <$b.i >$b.c"
-+ fi
- $F2C $F2CFLAGS <$b.i >$b.c
- rc=$?
- ;;esac
-@@ -197,7 +300,7 @@ do
- ;;
- esac
- case $rc in 0);; *) exit;; esac
-- $CC -c $CFLAGSF2C $CFLAGS $b.c 2>$s
-+ $CC -c $CFLAGS $b.c 2>$s
- rc=$?
- sed '/parameter .* is not referenced/d;/warning: too many parameters/d' $s 1>&2
- case $rc in 0);; *) exit;; esac
-@@ -212,7 +315,7 @@ do
- case $? in 0);; *) rc=$?; exit;; esac
- $F2C $F2CFLAGS $b.f
- case $? in 0);; *) rc=$?; exit;; esac
-- $CC -c $CFLAGSF2C $CFLAGS $b.c
-+ $CC -c $CFLAGS $b.c
- case $? in 0);; *) rc=$?; exit;; esac
- OFILES="$OFILES $b.o"
- rm $b.[cf]
-@@ -225,7 +328,7 @@ do
- case $? in 0);; *) rc=$?; exit;; esac
- $F2C $F2CFLAGS $b.f
- case $? in 0);; *) rc=$?; exit;; esac
-- $CC -c $CFLAGSF2C $CFLAGS $b.c
-+ $CC -c $CFLAGS $b.c
- case $? in 0);; *) rc=$?; exit;; esac
- OFILES="$OFILES $b.o"
- rm $b.[cf]
-@@ -244,7 +347,7 @@ do
- *.c)
- echo $1: 1>&2
- OFILE=`basename $1 .c`.o
-- $CC -c $CFLAGSF2C $CPPFLAGS $CFLAGS $1
-+ $CC -c $CPPFLAGS $CFLAGS $1
- rc=$?; case $rc in 0);; *) rc=$?; exit;; esac
- OFILES="$OFILES $OFILE"
- case $cOPT in 1) cOPT=2;; esac
-@@ -260,19 +363,18 @@ do
- case $cOPT in 1) cOPT=2;; esac
- shift
- ;;
-- -[lL])
-- OFILES="$OFILES $1$2"
-+ -l)
-+ OFILES="$OFILES -l$2"
- shift 2
- case $cOPT in 1) cOPT=2;; esac
- ;;
-- -[lL]*)
-+ -l*)
- OFILES="$OFILES $1"
- shift
- case $cOPT in 1) cOPT=2;; esac
- ;;
- -o)
-- case $cOPT in 0) CFLAGS="$CFLAGS -o $2";; *) OUTF=$2;; esac
-- shift 2;;
-+ OUTF=$2; shift 2;;
- *.P)
- F2CFLAGS="$F2CFLAGS $1"
- shift
-@@ -285,10 +387,12 @@ do
- esac
- done
-
--### On some (IRIX) systems, -Wl,-dont_warn_unused prevents complaints
--### about unnecessary -l options.
-+case $cOPT
-+in
-+ 2) $CC $CFLAGS -o $OUTF @MAIN@ $OFILES $LIBS $FLIBS
-+ ;;
-+esac
-
--#case $cOPT in 2) $CC -Wl,-dont_warn_unused -o $OUTF -u MAIN__ -L/usr/local/lib $OFILES -lf2c -lm;; esac
--case $cOPT in 2) $CC -o $OUTF -u MAIN__ -L/usr/local/lib $OFILES -lf2c -lm;; esac
- rc=$?
- exit $rc
-+