# 
# configure.in,v 1.51 2007/12/16 18:20:55 jenglish Exp
#
builtin(include, ../tclconfig/tcl.m4)
builtin(include, ../tclconfig/teax.m4)

AC_INIT([tile],[0.8.2])
AC_CONFIG_AUX_DIR(../tclconfig)
AC_REVISION(1.51)

# Usual Tcl stuff:
#
TEA_INIT([3.6])
TEA_PATH_TCLCONFIG
TEA_LOAD_TCLCONFIG
TEA_PATH_TKCONFIG
TEA_LOAD_TKCONFIG
TEA_PREFIX

dnl 
dnl Alternative to TEA_SETUP_COMPILER:
dnl (TEA_SETUP_COMPILER is for building Tcl itself)
dnl
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_OBJEXT

AC_ARG_ENABLE([private-headers],
    AC_HELP_STRING(
    	[--disable-private-headers], 
	[Disable if private headers are unavailable]),
    [have_private_headers=$enableval], [have_private_headers=yes])

AC_MSG_CHECKING([Did you ask for private headers?])
AC_MSG_RESULT(${have_private_headers})

if test ${have_private_headers} = "yes" ; then
    TEA_MISSING_POSIX_HEADERS
    TEA_PRIVATE_TCL_HEADERS
    TEA_PRIVATE_TK_HEADERS
else
    TEA_PUBLIC_TCL_HEADERS
    TEA_PUBLIC_TK_HEADERS
    AC_DEFINE(NO_PRIVATE_HEADERS)
fi

TEA_PROG_TCLSH
TEA_PROG_WISH

# Build stuff:
#
TEA_CONFIG_CFLAGS
TEA_PATH_X
dnl TEA_ENABLE_THREADS
TEA_ENABLE_SHARED
TEA_ENABLE_SYMBOLS

AC_DEFINE(USE_TCL_STUBS,1,[Use Tcl stub library])
AC_DEFINE(USE_TK_STUBS,1,[Use Tk stub library])
AC_DEFINE(BUILD_tile,1,[Source for tile package])

TEAX_CONFIG_LDFLAGS
TEAX_FIX_LIB_SPECS
TEAX_EXPAND_CFLAGS

# Platform-specific stuff:
# NB: With -DNO_PRIVATE_HEADERS, we need to link against libtk 
# in addition to libtkstub, at least on Windows.  We can get away 
# without doing this on Unix.
#
case "${TEA_WINDOWINGSYSTEM}" in
    win32)
	PLATFORM_OBJS='$(WIN_OBJS)'
	PKG_LIBS="${PKG_LIBS}"
	if test ${have_private_headers} = "no" ; then
	    TEA_ADD_LIBS($TK_LIB_SPEC)
	fi
	TEA_ADD_LIBS([user32.lib gdi32.lib])
	AC_CHECK_HEADER([uxtheme.h], 
		[AC_DEFINE(HAVE_UXTHEME_H,1,[XP uxtheme.h available])],
		[AC_MSG_NOTICE([xpnative theme will be unavailable])],
		[#include <windows.h>])
	;;
    aqua)
	PLATFORM_OBJS='$(MAC_OBJS)'	; # Ignore autoconf warning, it's bogus
	PKG_LIBS="${PKG_LIBS} -framework Carbon"
	;;
    x11)
	PLATFORM_OBJS='$(X11_OBJS)'
	;;
esac;
AC_SUBST(PLATFORM_OBJS)

#--------------------------------------------------------------------

AC_CONFIG_FILES([Makefile pkgIndex.tcl])
AC_OUTPUT

#*EOF*
