#
# 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.
#


AC_ARG_WITH(jpeglib,	--with-jpeglib[=path]	specify a pathname for the independent jpeg library with progressive enhancements,	 jpeglib=$withval, jpeglib="no")


JPEGLIB_H_PLACES_D="$jpeglib \
	$jpeglib/include "
JPEGLIB_LIB_PLACES_D="$jpeglib \
	$jpeglib/lib \
	$jpeglib/bin"
JPEGLIB_H_PLACES="../jpeg \
	../jpeg/include \
	/usr/local/include \
	/usr/local/include/jpeg \
	/usr/local/jpeg \
	/usr/local/jpeg/include"
JPEGLIB_LIB_PLACES="../jpeg \
	../jpeg/lib \
	../jpeg/bin \
	/usr/local/lib \
	/usr/local/bin \
	/usr/local/lib/jpeg \
	/usr/local/jpeg \
	/usr/local/jpeg/lib \
	/usr/local/jpeg/bin"

if test "x$jpeglib" != "xno" ; then 
	if test "x$jpeglib" = "x" ; then
		jpeglib="yes"
		reqd=""
	else
		reqd="yes"
	fi
	NS_BEGIN_PACKAGE(jpeglib)
	NS_CHECK_HEADER_PATH(jpeglib.h,$JPEGLIB_H_PLACES,$jpeglib,$JPEGLIB_H_PLACES_D,V_INCLUDE_JPEGLIB,jpeglib)
	NS_CHECK_LIB_PATH(jpeg,$JPEGLIB_LIB_PLACES,$jpeglib,$JPEGLIB_LIB_PLACES_D,V_LIB_JPEGLIB,jpeglib)
	NS_END_PACKAGE(jpeglib,$reqd)
	V_JPEGWC_OBJ_C="misc/jpegwc-tclapi.o misc/jpegwc.o"
else
	V_JPEGWC_OBJ_C=""
fi


# V_DEFINE_JPEGWC="-D__JPEGWC__"

#AC_SUBST(V_DEFINE_JPEGWC)
#AC_SUBST(V_INCLUDE_JPEGWC)

AC_SUBST(V_LIB_JPEGLIB)
AC_SUBST(V_JPEGWC_OBJ_C)
