diff flibs.sh @ 5:9c27e323492f

[project @ 1993-08-08 01:29:13 by jwe] Initial revision
author jwe
date Sun, 08 Aug 1993 01:32:33 +0000
parents
children 9465b39f764a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flibs.sh	Sun Aug 08 01:32:33 1993 +0000
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+# flibs -- try to get the Fortran compiler to tell us what libraries
+# it expects to link to, and echo the result to the standard output.
+#
+# John W. Eaton
+# jwe@che.utexas.edu
+# Department of Chemical Engineering
+# The University of Texas at Austin
+
+trap 'rm -f conftest* core; exit 1' 1 3 15
+
+# Write a minimal program and compile it with -v.  I don't know what
+# to do if your compiler doesn't have -v...
+
+echo "      END" > conftest.f
+
+# I don't think that stripping commas out of this will ever hurt, and
+# we have to do it for the code that follows to understand the output
+# from `xlf -v'.  
+
+foutput=`${F77-f77} -v -o conftest conftest.f 2>&1 | sed 's/,/ /g'`
+
+flibs=
+lflags=
+want_arg=
+
+for arg in $foutput
+do
+  if test x$want_arg = x
+  then
+    want_arg=
+    case $arg in
+      -[lL]*)
+        exists=false
+        for f in $lflags
+        do
+          if test x$arg = x$f
+          then
+            exists=true
+          fi
+        done
+	if $exists || test x$arg = x-lm -o x$arg = x-lc
+	then
+	  arg=
+        else
+          lflags="$lflags $arg"
+	fi
+      ;;
+      -u)
+        want_arg=$arg
+      ;;
+      *)
+        arg=
+      ;;
+    esac
+  else
+    want_arg=
+  fi
+  if test x$arg != x
+  then
+    flibs="$flibs $arg"
+  fi
+done
+
+echo "$flibs"
+
+rm -f conftest* core
+
+# Bye-bye.
+
+exit 0