1#!/bin/sh 2 3#configure - FireMake configuratin script 4#Copyright (C) 2002 Ian Gulliver 5# 6#This program is free software; you can redistribute it and/or modify 7#it under the terms of version 2 of the GNU General Public License as 8#published by the Free Software Foundation. 9# 10#This program is distributed in the hope that it will be useful, 11#but WITHOUT ANY WARRANTY; without even the implied warranty of 12#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13#GNU General Public License for more details. 14# 15#You should have received a copy of the GNU General Public License 16#along with this program; if not, write to the Free Software 17#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 19VERSION="1.9.9" 20 21ECHO=echo 22if test -f /usr/ucb/echo; then 23 ECHO=/usr/ucb/echo 24fi 25 26disp() { 27 if test ! "$LASTN" = "1"; then 28 $ECHO -n "$PREPEND" 1>&2 29 fi 30 LASTN="0" 31 $ECHO "$1" 1>&2 32} 33 34dispn() { 35 if test ! "$LASTN" = "1"; then 36 $ECHO -n "$PREPEND" 1>&2 37 fi 38 LASTN="1" 39 $ECHO -n "$1" 1>&2 40} 41 42module() { 43 test -f firemake/$1 44} 45 46PHASES="library init config header makefile" 47 48disp "FireMake v$VERSION starting...."; 49disp 50 51disp "= Starting dependency check =" 52for MODULE in `ls firemake`; do 53 REQ=`grep "^#require " firemake/$MODULE 2>/dev/null | cut -d ' ' -f 2`; 54 if test "$?" = "0"; then 55 # module has requirements, check that these modules exist 56 for FILE in $REQ; do 57 if test ! -f firemake/$FILE; then 58 disp " Module $MODULE requires module $FILE which is not present; aborting" 59 exit 1; 60 fi 61 done 62 fi 63done 64disp "= Done with dependency check =" 65disp 66 67 68for PHASE in $PHASES; do 69 disp "= Starting $PHASE phase =" 70 case "$PHASE" in 71 init) 72 exec > /dev/null 73 ;; 74 config) 75 exec > /dev/null 76 ;; 77 header) 78 exec > firemake.h 79 ;; 80 makefile) 81 exec > Makefile 82 ;; 83 esac 84 NEWDATA="1" 85 while test "$NEWDATA" = "1"; do 86 NEWDATA="0" 87 for MODULE in `ls firemake`; do 88 $ECHO "$DID " | grep " ${PHASE}_${MODULE} " > /dev/null 89 if test ! "$?" = "0"; then 90 grep "^#phase $PHASE" firemake/$MODULE > /dev/null 2>/dev/null 91 if test "$?" = "0"; then 92 SAT="1" 93 DEPS=`grep "^#after ${PHASE}_" firemake/$MODULE | cut -d ' ' -f 2`; 94 if test "$?" = "0"; then 95 #runtime dependencies 96 for DEP in $DEPS; do 97 $ECHO "$DID " | grep " ${DEP} " > /dev/null 98 if test ! "$?" = "0"; then 99 SAT="0" 100 fi 101 done 102 fi 103 if test "$SAT" = "1"; then # dependencies satisfied 104 PREPEND=" " 105 . firemake/$MODULE 106 unset PREPEND 107 DID="$DID ${PHASE}_${MODULE}" 108 NEWDATA="1" 109 fi 110 fi 111 fi 112 done 113 done 114 disp "= Done with $PHASE phase =" 115 disp 116done 117 118disp "Finished configuring. Now just run \"make\"" 119