#!/bin/bash
#########################################################
# 							#
# This is BashStyle-NG  				#
#							#
# Licensed under GNU GENERAL PUBLIC LICENSE v3    	#
#							#
# Copyright 2007 - 2016 Christopher Bratusek		#
#							#
#########################################################

shopt -s extglob
export TOP_PID=$$

MODULES=( base color messages checks substitute depends )

for mod in "${MODULES[@]}"; do
	source "${PWD}"/.configure/"${mod}"
done

rm -f "${PWD}"/.configure/results

xcount=0
while [[ ${xcount} -le $# ]]; do
	case ${1} in
		--prefix=* )		PREFIX="${1/*=}" ;;
		--pcdir=* )		PCDIR="${1/*=}" ;;
		--bindir=* )		BINDIR="${1/*=}" ;;
		--docdir=* )		DOCDIR="${1/*=}" ;;
		--mandir=* )		MANDIR="${1/*=}" ;;
		--girpath=* )		GIRPATH="${1/*=}" ;;
		--datadir=* )		DATADIR="${1/*=}" ;;
		--python=* )		PYTHON="${1/*=}" ;;
		--help )		MODE=help ;;
		--no-postinstall )	echo "HERE111!!!1"
					DISABLE_POSTINSTALL=1
					echo "DISABLE_POSTINSTALL=1" >> \
						"${PWD}"/.configure/results ;;
	esac
	shift
	xcount=$((xcount+1))
done
unset xcount

if [[ ${MODE} == help ]]; then
	help_message
else
	if [[ ${GIRPATH} == "" ]]; then
		missing_girpath_message ; exit 1
	fi

	start_message
	check_helper
	copy_in_files
	substitute_values
	end_message
	export_result
fi
