dnl Process this file with autoconf to produce a configure script.

AC_INIT(Source/robodoc.h)

AM_CONFIG_HEADER(Source/config.h)

AM_INIT_AUTOMAKE(robodoc, 4.0.18)

AC_PROG_MAKE_SET

dnl Checks for programs.
AC_PROG_CC

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

dnl Checks for library functions.
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strstr)

# Define a macro that is used to parse a --with-lua parameter.
#
# This macro is currently generic. You should be able to specify different
# directories for the libs and includes, such as:
# --with-lua-includes=/usr/includes/lua --with-lua-libs=/usr/lib/lua
#
# The macro is named LUA_DIR
AC_DEFUN([LUA_DIR],[
	AC_ARG_WITH(
		lua,
		[  --with-lua[=DIR]          Lua directory],
		,
		[with_lua="/usr"]
	)

	AC_MSG_CHECKING(for Lua)

	# make sure that a well known include file exists
	if test -e $with_lua/include/lua.h; then
		lua_libs="-L$with_lua/lib -llua -llualib"
                lua_includes="-I$with_lua/include -DUSE_LUA=1"
		AC_MSG_RESULT(yes)
	else
                lua_libs=""
                lua_includes=""
		AC_MSG_RESULT(no)
	fi
])

LUA_DIR

AC_SUBST(lua_libs)
AC_SUBST(lua_includes)

AC_OUTPUT(makefile Docs/makefile Source/makefile)
