changeset 809:39073da2ec56

[project @ 1994-10-14 16:34:03 by jwe]
author jwe
date Fri, 14 Oct 1994 16:34:03 +0000
parents e14a213685ec
children 1865b6725111
files flibs.sh
diffstat 1 files changed, 60 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flibs.sh	Fri Oct 14 14:23:15 1994 +0000
+++ b/flibs.sh	Fri Oct 14 16:34:03 1994 +0000
@@ -15,21 +15,31 @@
 
 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'.  
+# The easiest thing to do for xlf output is to replace all the commas
+# with spaces.  That causes problems for the output from f77 on
+# Solaris systems that looks something like
+#
+#  -Y P,colon:separated:path:of:lib:directories
+#
+# and that this sed command transforms to
+#
+#  -Y P colon:separated:path:of:lib:directories
+#
+# This is handled as a somewhat special case below.
 
 foutput=`${F77-f77} -v -o conftest conftest.f 2>&1 | sed 's/,/ /g'`
 
 flibs=
 lflags=
+
+# If want arg is set, we know we want the arg to be added to the list,
+# so we don't have to examine it.
 want_arg=
 
 for arg in $foutput
 do
   if test x$want_arg = x
   then
-    want_arg=
     case $arg in
       /*.a)
         exists=false
@@ -66,15 +76,59 @@
       -u)
         want_arg=$arg
       ;;
+      -Y)
+        want_arg=$arg
+        arg=
+      ;;
       *)
         arg=
       ;;
     esac
   else
-    want_arg=
+    if test x$want_arg = x-Y
+    then
+      if test x$arg = xP
+      then
+        want_arg=$arg
+      else
+        want_arg=
+      fi
+      arg=
+    else
+      if test x$want_arg = xP
+      then
+	dir_list=`echo $arg | sed 's/^[ \t]*P,//'`
+	arg=
+	save_IFS=$IFS
+	IFS=":"
+	for dir in $dir_list
+	do
+	  exists=false
+	  for f in $lflags
+	  do
+	    if test x$dir = x$f
+	    then
+	      exists=true
+	    fi
+	  done
+	  if $exists || test x$dir = x-lm -o x$dir = x-lc
+	  then
+	    true
+	  else
+	    lflags="$lflags $dir"
+	    arg="$arg -L $dir"
+	  fi
+	done
+	IFS="$save_IFS"
+      fi
+      want_arg=
+    fi
   fi
-  if test x$arg != x
+
+  if test "x$arg" = x
   then
+    true
+  else
     flibs="$flibs $arg"
   fi
 done