#!/bin/bash
#########################################################
# 							#
# This is BashStyle-NG  				#
#							#
# Licensed under GNU GENERAL PUBLIC LICENSE v3    	#
#							#
# Copyright 2007 - 2018 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"

for opt in ${@}; do
	case ${opt} in
		--prefix=* )		PREFIX="${opt/*=}" ;;
		--pcdir=* )		PCDIR="${opt/*=}" ;;
		--bindir=* )		BINDIR="${opt/*=}" ;;
		--docdir=* )		DOCDIR="${opt/*=}" ;;
		--mandir=* )		MANDIR="${opt/*=}" ;;
		--girpath=* )		GIRPATH="${opt/*=}" ;;
		--datadir=* )		DATADIR="${opt/*=}" ;;
		--python=* )		PYTHON="${opt/*=}" ;;
		--help | -h )		help_message ;;
		--no-postinstall )	DISABLE_POSTINSTALL=1
					echo "DISABLE_POSTINSTALL=1" >> \
						"${PWD}/.configure/results" ;;
	esac
	shift
done

if [[ ${GIRPATH} == "" ]]; then
	missing_girpath_message
	exit 1
fi

start_message
check_helper
copy_in_files
substitute_values
end_message
export_result
