#
# Copyright (c) @ Regents of the University of California.
# All rights reserved.
# 
# 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. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
# 	This product includes software developed by the MASH Research
# 	Group at the University of California Berkeley.
# 4. Neither the name of the University nor of the Research Group may 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.
#
# @(#) $Header: /cvsroot/otcl-tclcl/conf/configure.in.srm,v 1.6 1999/05/26 13:09:08 suchi Exp $
#


AC_ARG_WITH(srm,	--with-srm[=path]	specify a pathname for the standalone SRM library, srm=$withval, srm="")


if test "x$enable_release" = "xyes" ; then
	# always enable SRM for the release version
	if test "x$srm" = "x" ; then
		srm="yes"
	fi
fi

SRM_H_PLACES_D="$srm \
	$srm/include \
	$srm/srmv2"
SRM_LIB_PLACES_D="$srm \
	$srm/lib \
	$srm/bin"
SRM_H_PLACES="../srm2.0 \
	../srm2.0/include \
	../srm2.0/srmv2 \
	/usr/local/include \
	/usr/local/include/srm2.0 \
	/usr/local/srm2.0 \
	/usr/local/srm2.0/include \
	/usr/local/srm2.0/srmv2"
SRM_LIB_PLACES="../srm2.0 \
	../srm2.0/lib \
	../srm2.0/bin \
	/usr/local/lib \
	/usr/local/bin \
	/usr/local/lib/srm2.0 \
	/usr/local/srm2.0 \
	/usr/local/srm2.0/lib \
	/usr/local/srm2.0/bin"


if test "$enable_mashsrm" = "yes" ; then
	V_MASH_SRMV2_OBJ="\$(SRMv2_OBJ)"
	V_INCLUDE_SRM="-I./srmv2"
	V_LIB_SRM=""
	V_INCLUDES="$V_INCLUDE_SRM $V_INCLUDES"
	echo "Compiling in mash SRMv2; not checking for standalone SRM"
else
	if test "x$srm" != "xno" ; then
		if test "x$srm" = "x" ; then
			srm="yes"
			reqd=""
		else
			reqd="yes"
		fi
		NS_BEGIN_PACKAGE(srm)
		NS_CHECK_HEADER_PATH(srmv2-api.h,$SRM_H_PLACES,$srm,$SRM_H_PLACES_D,V_INCLUDE_SRM,srm)
		NS_CHECK_LIB_PATH(srm,$SRM_LIB_PLACES,$srm,$SRM_LIB_PLACES_D,V_LIB_SRM,srm)
		NS_END_PACKAGE(srm,$reqd)
		if test "x$V_LIB_SRM" != "x" ; then
			V_MBV2_OBJ_CC="\$(MBV2_OBJ_CC)"
			V_MBV2_OBJ_TK_CC="\$(MBV2_OBJ_TK_CC)"
		fi
	fi

	V_MASH_SRMV2_OBJ=""
fi

AC_SUBST(V_MASH_SRMV2_OBJ)
AC_SUBST(V_INCLUDE_SRM)
AC_SUBST(V_LIB_SRM)

AC_SUBST(V_MBV2_OBJ_CC)
AC_SUBST(V_MBV2_OBJ_TK_CC)
