#! /bin/bash

parent=$(dirname $(pwd))

if ! test -f autogen.marker ; then
  script -c 'autoreconf -ivf' autogen.logg
  script -c 'time NOCONFIGURE=skip ./autogen.sh' -a autogen.logg
  touch autogen.marker
  echo '>>>>>>>>>> after autogen.sh'
else
  echo '>>>>>>>>>> skipped autogen.sh'
fi

export PKG_CONFIG_PATH=$parent/install/lib/pkgconfig

flags=""
flags="$flags --prefix=$parent/install"
flags="$flags --with-typelib-dir=$parent/install"
if test -f gnumeric.desktop ; then
  flags="$flags --with-gir-dir=$parent/install"
  flags="$flags --with-gi-overrides-dir=$parent/install"
  #FIXME never works flags="$flags --enable-introspection=yes"
fi

env=""
env="$env PKG_CONFIG_PATH=$parent/install/lib/pkgconfig"

cmd="$env ./configure $flags"
script -c "echo -n configuring in: ; pwd ;
        echo ':; $cmd' ; $cmd" configure.logg
