#!/bin/sh

# Clean up disables if not in help mode
[ "$help" != "1" ] && rm -f disable-* producers.dat filters.dat transitions.dat consumers.dat

# Create the make.inc file
echo SUBDIRS = `find . -maxdepth 1 -type d | grep -v .svn | grep -v "^.$" | sed 's/\.\///'` > make.inc

# Iterate through arguments
for i in "$@"
do
	case $i in
		--disable-* )	touch disable-${i#--disable-} ;;
	esac
done

# Iterate through each of the components
for i in *
do
	if [ -d $i -a \( "$help" = "1" -o \( ! -f disable-$i -a ! -f $i/deprecated \) \) ]
	then
		if [ "$gpl" = "true" -o ! -f $i/gpl -o "$help" = "1" ]
		then
			[ -f $i/Makefile -a "$help" = "0" ] && echo "Configuring modules/$i:"
			if [ -x $i/configure ]
			then
				olddir2=`pwd`
				cd $i
				./configure "$@"
				[ $? != 0 ] && exit 1
				cd $olddir2
			elif [ -f $i/configure ]
			then
				echo "  configure script is not set executable!"
			fi
		elif [ "$help" = "0" ]
		then
			touch disable-$i
		fi
	fi
done

