#!/bin/bash

JOBS=1

while getopts "j:" opt; do
    case "${opt}" in
        j)
            JOBS=${OPTARG}
            ;;
        *)
			exit 1
            ;;
    esac
done
shift $((OPTIND-1))

echorun() {
	echo $@
	$@
}

# job control support is required for $PIPESTATUS
cd bash
echorun ./configure --enable-library --disable-readline --disable-history \
	--disable-bang-history --disable-progcomp --without-bash-malloc --disable-nls \
	--disable-mem-scramble --disable-net-redirections --disable-restricted \
	$@
echorun make -j${JOBS} libbash.a
