source: trunk/compile_f2c/compile_f2c @ 1802

Last change on this file since 1802 was 946, checked in by andreasw, 12 years ago

added a few things for building of loadable libraries

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1#!/bin/sh
2
3# Copyright (C) 2007  International Business Machines.
4# All Rights Reserved.
5# This file is distributed under the Common Public License.
6# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
7#
8## $Id: compile_f2c 946 2008-02-25 14:32:34Z lou $
9#
10# Author: Andreas Waechter     IBM      2007-06-09
11
12
13########################################################################
14# Replace the following to the location of your vcf2c.lib library
15# Note that there must be no space before and after "="
16
17f2clibdir=/usr/local/lib/libf2c
18
19#You should not have to change anything below this line
20########################################################################
21
22#Find out what the
23if test `which cygpath | wc -l` -eq 0; then
24  CYGPATH_W=echo
25else
26  CYGPATH_W='cygpath -w'
27fi
28
29if test "$F2C_CC" = ""; then
30  F2C_CC=cl
31fi
32
33f2clib=`$CYGPATH_W $f2clibdir/vcf2c.lib`
34mainobj=`$CYGPATH_W $f2clibdir/main.obj`
35
36# Get rid of the \
37f2clib=`echo $f2clib | sed -e s'!\\\\!/!g'`
38mainobj=`echo $mainobj | sed -e s'!\\\\!/!g'`
39
40
41if test "$#" -eq 1 && test "$1" = "-FLIBS"; then
42  echo $f2clib
43  exit 0
44fi
45
46cincs="-I`$CYGPATH_W $f2clibdir`"
47
48options=
49makedll=
50linkflags=
51incs=
52fsrc=
53objs=
54outfile=
55while test "$#" -gt 0
56do
57  arg="$1"
58  shift
59  if test "$outfile" = next; then
60    outfile="$arg"
61  else
62
63    case "$arg" in
64      -I*)
65        incs="$incs $arg"
66        ;;
67      -o)
68        if test "$outfile" != ""; then
69          echo "There are more than two -o options"
70          exit 1
71        fi
72        outfile=next
73        ;;
74      -c)
75        options="$options $arg"
76        f2clib=
77        mainobj=
78        ;;
79      -shared)
80        makedll=yes
81        linkflags="$linkflags -dll"
82        ;;
83      -def:*)
84        linkflags="$linkflags $arg"
85        ;;
86      -*)
87        options="$options $arg"
88        ;;
89      *.[fF])
90        fsrc="$fsrc $arg"
91        ;;
92      *)
93        objs="$objs $arg"
94        ;;
95    esac
96  fi
97done
98
99if test "$fsrc" = "" && test "$objs" = "" ; then
100  echo "No source or object files given"
101  exit 1
102fi
103
104csrc=
105if test "$fsrc" != ""; then
106  for f in $fsrc; do
107    cf=`echo $f | sed -e 's|.[fF]$|.c|' -e 's|.*/||'`
108    csrc="$csrc $cf"
109  done
110
111  echo f2c $incs $fsrc
112  f2c $incs $fsrc
113  f2c_status=$?
114  if test $f2c_status != 0; then
115    rm -f $csrc
116    exit $f2c_status
117  fi
118fi
119
120
121if test "$outfile"; then
122  cout="-o `$CYGPATH_W $outfile`"
123fi
124
125if test x$makedll = xyes; then
126  echo $F2C_CC $options $cincs $csrc $objs $cout $f2clib -link $linkflags
127
128  $F2C_CC $options $cincs $csrc $objs $cout $f2clib -link $linkflags
129else
130  echo $F2C_CC $options $cincs $csrc $objs $cout $mainobj $f2clib
131
132  $F2C_CC $options $cincs $csrc $objs $cout $mainobj $f2clib
133fi
134cl_status=$?
135
136rm -f $csrc
137
138exit $cl_status
Note: See TracBrowser for help on using the repository browser.