OSDN Git Service

Also accept arguments for when invoked by Makefile.
[pf3gnuchains/gcc-fork.git] / gcc / configure.frag
1 # configure.frag for GNU CC
2 # Process the Makefile fragments from language directories.
3
4 # Copyright (C) 1997 Free Software Foundation, Inc.
5
6 #This file is part of GNU CC.
7
8 #GNU CC is free software; you can redistribute it and/or modify
9 #it under the terms of the GNU General Public License as published by
10 #the Free Software Foundation; either version 2, or (at your option)
11 #any later version.
12
13 #GNU CC is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #GNU General Public License for more details.
17
18 #You should have received a copy of the GNU General Public License
19 #along with GNU CC; see the file COPYING.  If not, write to
20 #the Free Software Foundation, 59 Temple Place - Suite 330,
21 #Boston, MA 02111-1307, USA.
22
23 rm -f Make-lang
24 touch Make-lang
25
26 # We can either be invoked with . from configure or from Makefile.
27 # Some shells can't pass arguments to source'd scripts.
28 # ??? This needs some rethinking.
29
30 if [ x"$1" != x ] ; then
31         savesrcdir=$1
32         savesubdirs=$2
33 else
34         savesrcdir=$srcdir
35         savesubdirs=$subdirs
36 fi
37
38 for subdir in . $savesubdirs
39 do
40         oldsrcdir=$savesrcdir
41
42         # Re-adjust the path
43         case $oldsrcdir in
44         /*)
45                 case $subdir in
46                 .)
47                         srcdir=$oldsrcdir
48                         ;;
49                 *)
50                         srcdir=$oldsrcdir/$subdir
51                         ;;
52                 esac
53                 ;;
54         *)
55                 case $subdir in
56                 .)
57                         ;;
58                 *)
59                         oldsrcdir=../${oldsrcdir}
60                         srcdir=$oldsrcdir/$subdir
61                         ;;
62                 esac
63                 ;;
64         esac
65         mainsrcdir=$oldsrcdir
66         STARTDIR=`pwd`
67         test -d $subdir || mkdir $subdir
68         cd $subdir
69
70         # If this is the top level Makefile, add the language fragments.
71         if [ $subdir = . ]
72         then
73                 for s in .. $savesubdirs
74                 do
75                         if [ $s != ".." ]
76                         then
77                                 cat ${mainsrcdir}/$s/Make-lang.in >> Make-lang
78                         fi
79                 done
80         fi
81
82         cd $STARTDIR
83 done   # end of current-dir SUBDIRS loop
84
85 srcdir=$savesrcdir