#!/bin/sh

MODE=${1-}

if [ -z "$MODE" ] ; then
    # For autopkgtest
    VAR="FIM_EXE=/usr/bin/fim abs_builddir="
    # Generate the Makefile from scratch
    dh_autoreconf_clean
    dh_autoreconf
    dh_auto_configure
    # Disable the command for target "all"
    sed -i -e 's/$(MAKE) $(AM_MAKEFLAGS) all-recursive/#/' Makefile
else
    VAR=
fi

# Pretend we are in a basic terminal
export TERM=vt102

# Ensure that there is no $DISPLAY when running the tests
export DISPLAY=

# Run the unit tests
make tests $VAR
