5
|
1 #!/bin/sh |
|
2 # |
|
3 # flibs -- try to get the Fortran compiler to tell us what libraries |
|
4 # it expects to link to, and echo the result to the standard output. |
|
5 # |
|
6 # John W. Eaton |
|
7 # jwe@che.utexas.edu |
|
8 # Department of Chemical Engineering |
|
9 # The University of Texas at Austin |
|
10 |
|
11 trap 'rm -f conftest* core; exit 1' 1 3 15 |
|
12 |
|
13 # Write a minimal program and compile it with -v. I don't know what |
|
14 # to do if your compiler doesn't have -v... |
|
15 |
|
16 echo " END" > conftest.f |
|
17 |
|
18 # I don't think that stripping commas out of this will ever hurt, and |
|
19 # we have to do it for the code that follows to understand the output |
|
20 # from `xlf -v'. |
|
21 |
|
22 foutput=`${F77-f77} -v -o conftest conftest.f 2>&1 | sed 's/,/ /g'` |
|
23 |
|
24 flibs= |
|
25 lflags= |
|
26 want_arg= |
|
27 |
|
28 for arg in $foutput |
|
29 do |
|
30 if test x$want_arg = x |
|
31 then |
|
32 want_arg= |
|
33 case $arg in |
313
|
34 /*.a) |
|
35 exists=false |
|
36 for f in $lflags |
|
37 do |
|
38 if test x$arg = x$f |
|
39 then |
|
40 exists=true |
|
41 fi |
|
42 done |
|
43 if $exists |
|
44 then |
|
45 arg= |
|
46 else |
|
47 lflags="$lflags $arg" |
|
48 fi |
|
49 ;; |
5
|
50 -[lL]*) |
|
51 exists=false |
|
52 for f in $lflags |
|
53 do |
|
54 if test x$arg = x$f |
|
55 then |
|
56 exists=true |
|
57 fi |
|
58 done |
|
59 if $exists || test x$arg = x-lm -o x$arg = x-lc |
|
60 then |
|
61 arg= |
|
62 else |
|
63 lflags="$lflags $arg" |
|
64 fi |
|
65 ;; |
|
66 -u) |
|
67 want_arg=$arg |
|
68 ;; |
|
69 *) |
|
70 arg= |
|
71 ;; |
|
72 esac |
|
73 else |
|
74 want_arg= |
|
75 fi |
|
76 if test x$arg != x |
|
77 then |
|
78 flibs="$flibs $arg" |
|
79 fi |
|
80 done |
|
81 |
|
82 echo "$flibs" |
|
83 |
|
84 rm -f conftest* core |
|
85 |
|
86 # Bye-bye. |
|
87 |
|
88 exit 0 |