#!/bin/sh
# $Id: cfg-ncurses6,v 1.32 2019/07/27 20:45:49 tom Exp $
PACKAGE=ncurses
OPTS=
HERE=`partition`

MY_ABI=6
MY_DIR=/usr/local/ncurses6
MYDATA=/usr/local/ncurses/share/terminfo

case $HERE in
*debian*|*ubuntu*|*kfreebsd*)
	;;
fb*|nb*|ob*|*bsd*)
	OPTS="--with-hashed-db --enable-string-hacks"
	;;
esac

if [ -z "$CFLAGS" ]
then
case $HERE in
*debian5-*)
	;;
*debian*|*ubuntu*|*kfreebsd*)
	CFLAGS=`dpkg-buildflags   --get CFLAGS`;   export CFLAGS
	CXXFLAGS=`dpkg-buildflags --get CXXFLAGS`; export CXXFLAGS
	CPPFLAGS=`dpkg-buildflags --get CPPFLAGS`; export CPPFLAGS
	LDFLAGS=`dpkg-buildflags  --get LDFLAGS`;  export LDFLAGS
	OPTS="$OPTS --with-cxx-shared"
	;;
esac
fi

case $HERE in
testing-9)
	;;
*)
	OPTS="$OPTS --enable-pthreads-eintr"
	;;
esac

case $HERE in
nowhere)
	;;
*)
	OPTS="$OPTS --enable-weak-symbols"
	;;
esac

case $HERE in
*debian*|*fedora*|*suse*|*freebsd*|*netbsd*|*openbsd*)
	OPTS="$OPTS --with-versioned-syms"
	;;
esac

case $HERE in
*cygwin*)
	;;
*)
	OPTS="$OPTS --with-extra-suffix=$MY_ABI"
	;;
esac

case "$*" in
*--with-termlib*)
	;;
*)
	CPPFLAGS="$CPPFLAGS -DEXP_XTERM_1005"
	export CPPFLAGS
	;;
esac

case $HERE in
*debianold*)
	OPTS="$OPTS --with-gpm --with-pcre2"
	;;
esac

RPATH_LIST=../lib:$MY_DIR/lib \
cfg-ext-color $OPTS \
	--prefix=$MY_DIR \
	--program-suffix=$MY_ABI \
	--with-abi-version=$MY_ABI \
	--bindir=/usr/local/bin \
	--with-chtype=uint32_t \
	--enable-opaque-curses \
	--enable-opaque-form \
	--enable-opaque-menu \
	--enable-opaque-panel \
	--enable-sp-funcs \
	--enable-ext-mouse \
	--enable-ext-putwin \
	--enable-pc-files \
	--enable-rpath \
	--enable-wgetch-events \
	--enable-xmc-glitch \
	--with-default-terminfo-dir=$MYDATA \
	--with-terminfo-dirs=$MYDATA:/usr/share/terminfo \
	--with-develop \
	$*
