#
# imgtools.m4 --
#
#	This file provides a set of custom autoconf macros for
#       imgtools.
#
# Copyright (c) 2016 by Simon Bachmann <simonbachmann@bluewin.ch>
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and its documentation for any purpose, provided that the
# above copyright notice and the following two paragraphs appear in
# all copies of this software.
# 

#------------------------------------------------------------------------
# IMGTOOLS_ENABLE_CPUTIME --
#
#	Specify if the custom profiling add-on (cputime) should be 
#       compiled in.
#       DEPRECATED - Now cputime is compiled in if --enable-debug is passed
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--enable-cputime
#
#	Defines the following vars:
#		IMGTOOLS_CPUTIME
#------------------------------------------------------------------------

#AC_DEFUN([IMGTOOLS_ENABLE_CPUTIME], [
    #AC_MSG_CHECKING([for build with cputime])
    #AC_ARG_ENABLE(cputime,
	#AC_HELP_STRING([--enable-cputime],
	    #[build with profiling enabled (default: off)]),
	#[tcl_ok=$enableval], [tcl_ok=no])
    #if test "$tcl_ok" = "no"; then
	#AC_MSG_RESULT([no])
    #else
	#AC_DEFINE(IMGTOOLS_CPUTIME)
	#AC_MSG_RESULT([yes])
    #fi
#])

#------------------------------------------------------------------------
# IMGTOOLS_ENABLE_EXACT --
#
#	Specify if the debuggint option --exact (dont use catrom cache)
#       should be compiled.
#       DEPRECATED - now, the exact filters are compiled in if --enable-debug is passed
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--enable-exact
#
#	Defines the following vars:
#		IMGTOOLS_EXACT
#------------------------------------------------------------------------

#AC_DEFUN([IMGTOOLS_ENABLE_EXACT], [
    #AC_MSG_CHECKING([for build with exact option])
    #AC_ARG_ENABLE(exact,
	#AC_HELP_STRING([--enable-exact],
	    #[build with debuggin option -exact enabled (default: off)]),
	#[tcl_ok=$enableval], [tcl_ok=no])
    #if test "$tcl_ok" = "no"; then
	#AC_MSG_RESULT([no])
    #else
	#AC_DEFINE(IMGTOOLS_EXACT)
	#AC_MSG_RESULT([yes])
    #fi
#])

#------------------------------------------------------------------------
# IMGTOOLS_ENABLE_DEBUG --
#
#	Specify if the debugging tools should be compiled.
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--enable-debug
#
#	If true, defines the following vars:
#		IMGTOOLS_EXACT
#               IMGTOOLS_DEBUG
#
#       If false, defines the following vars:
#               NDEBUG
#, 
#------------------------------------------------------------------------

AC_DEFUN([IMGTOOLS_ENABLE_DEBUG], [
    AC_MSG_CHECKING([for build with debugging tools])
    AC_ARG_ENABLE(debug,
	AC_HELP_STRING([--enable-debug],
	    [build with debuggin tools (default: off)]),
	[tcl_ok=$enableval], [tcl_ok=no])
    if test "$tcl_ok" = "no"; then
	AC_DEFINE(NDEBUG)
	AC_MSG_RESULT([no])
    else
	AC_DEFINE(IMGTOOLS_DEBUG)
	AC_DEFINE(IMGTOOLS_EXACT)
	AC_MSG_RESULT([yes])
    fi
])

