#!/bin/sh

# Copy the global QPID_VERSION.txt file into the source tree.
cp ../QPID_VERSION.txt .

aclocal -I m4
autoheader
libtoolize --automake

# Create initial Makefile fragments that will force make to generate
# the real ones.
cat > src/rubygen.mk <<EOF
\$(srcdir)/rubygen.mk: force
	\$(rgen_cmd)  \$(srcdir)/rubygen.mk
EOF
cat > src/managementgen.mk <<EOF
\$(srcdir)/managementgen.mk: force
	\$(mgen_cmd)
EOF

automake
autoconf

# Optionally do the build as well.
if [ "$1" = "-build" -o "$1" = "--build" ] ; then
    shift
    ./configure "$@"
    make
    make check
fi
