#!/bin/sh

# /*
#  * obpkg is distributed under the following license:
#  *
#  * Copyright (c) 2006 Steffen Wendzel <cdp@doomed-reality.org>
#  *
#  * Redistribution and use in source and binary forms, with or without
#  * modification, are permitted provided that the following conditions
#  * are met:
#  * 1. Redistributions of source code must retain the above copyright
#  *    notice, this list of conditions and the following disclaimer.
#  * 2. Redistributions in binary form must reproduce the above copyright
#  *    notice, this list of conditions and the following disclaimer in the
#  *    documentation and/or other materials provided with the distribution.
#  * 3. The name of the author may not be used to endorse or promote products
#  *    derived from this software without specific prior written permission
#  *
#  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
#  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
#  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
#  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
#  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
#  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
#  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#  * SUCH DAMAGE.
#  */

# This configure script does not depend on the GNU autotools. I know, the base
# system you run is OpenBSD and I just want to know some OpenBSD specific things.

# check if the ports are installed in /usr/ports
if [ -d /usr/ports -a -f /usr/ports/Makefile \
	-a -f /usr/ports/INDEX ]; then
        echo "found your ports"
else
        echo "couldn't find your ports! please install ports.tgz in /usr/ports"
        echo "and make sure that you have access to /usr/ports!"
        exit 1
fi

# check if a package I need is installed ($1=search key , $2=display name)
function chktool {
        pkg_info | grep $1 >/dev/null
        if [ "$?" = "0" ]; then
                echo "[found $2]"
        else
                echo "couldn't find $2! please install it."
                exit 1
        fi
}

chktool gtk+2 gtk+2.x
chktool pkgconfig pkg-config
chktool wget-1. wget-1.x

echo "your system seems to be READY for obpkg! let's start 'make'."
exit 0

