#!/bin/sh
cd lib/libiax2 && \
./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" --disable-shared && \
cd ../../lib/spandsp && \
./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" --disable-shared && \
cd ../..

if [ $? != 0 ]; then
	exit 1
fi

IAXMODEMVER="`cat VERSION`"
DSPVER=`grep "^ VERSION=" lib/spandsp/configure | sed "s/ VERSION='*\([^']*\)'*/\1/g"`
if [ -n "${DSPVER}" ]; then
	DSPVER="spandsp-${DSPVER}+"
fi
IAXVER=`grep "^ VERSION=" lib/libiax2/configure | sed "s/ VERSION='*\([^']*\)'*/\1/g"`
if [ -n "${IAXVER}" ]; then
	IAXVER="libiax2-${IAXVER}-SVN-20071223+"
fi

cat Makefile.in | sed -e "s/@VERSION@/${IAXMODEMVER}/g" | \
	sed -e "s/@DSPVER@/${DSPVER}/g" | \
	sed -e "s/@IAXVER@/${IAXVER}/g" > Makefile

echo ${IAXMODEMVER}
echo ${IAXVER}
echo ${DSPVER}

exit $?

