#!/bin/sh

###############################################################################
#
#    AntiRight
#    (c) 2004-2006 Jeffrey Bedard
#    antiright@gmail.com
# 
#    This file is part of AntiRight.
#
#     AntiRight is free software; you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation; either version 2 of the License, or
#     (at your option) any later version.
#
#     AntiRight is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.
#
#     You should have received a copy of the GNU General Public License
#     along with AntiRight; if not, write to the Free Software
#     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
###############################################################################

VERSION=2.99.1

if [ "$1" = "-d" ]; then
        echo 'Configuring with debug options...'
        CFLAGS="-g3 -Wall -W -Werror -DDEBUG"
elif [ "$1" = "-s" ]; then
        echo 'Setting up PREFIX for user install in ~/opt.'
        PREFIX=~/opt/antiright
fi

DEFS="$DEFS -DPACKAGE_STRING='\"AntiRight_$VERSION\"'"


if [ "$PREFIX" = "" ]; then
	PREFIX=/usr/local
fi
DEFS="$DEFS -DPREFIX='\"$PREFIX\"'"


INCLUDE="$INCLUDE -I/usr/pkg/include -I/usr/local/include -I/usr/X11R6/include"
LIBDIR="$LIBDIR -L/usr/pkg/lib -L/usr/local/lib -L/usr/X11R6/lib"

#if [ ! -f /usr/X11R6/include/Xm/XpmP.h ]; then
#    LIBS="$LIBS -lXpm"
#else
#    DEFS="$DEFS -DHAVE_XMXPM"
#fi

#LIBS="$LIBS -lXm -lXt -lX11 -lm"
DEFS="$DEFS -D_GNU_SOURCE"
echo Prefix is $PREFIX
echo "# Local Build Configuration" > config.mk
echo "VERSION=$VERSION" >> config.mk
echo "PREFIX=$PREFIX" >> config.mk
echo "INCLUDE=$INCLUDE" >> config.mk
echo "LIBDIR=$LIBDIR" >> config.mk
#echo "LIBS=$LIBS" >> config.mk
echo "ICONDIR=$ICONDIR" >> config.mk
echo "CPPFLAGS=$CPPFLAGS" >> config.mk
echo "DEFS=$DEFS" >> config.mk
echo "RESDIR=$RESDIR" >> config.mk

