AC_INIT(../../src/rebecca/AimlFacade.cpp)

AC_ARG_WITH([doxygen],
	         AC_HELP_STRING([--without-doxygen],
                            ["If you want to disable generating doxygen"]),
			[no_doxygen="true"],,)

AC_ARG_WITH([console],
	         AC_HELP_STRING([--without-console],
                            ["If you want to disable generating the console sample"]),
			[no_console="true"],,)

AC_ARG_WITH([consoleHtmlConverter],
	         AC_HELP_STRING([--without-consoleHtmlConverter],
                            ["If you want to disable generating the console html converter sample"]),
			[no_consoleHtmlConverter="true"],,)

AC_ARG_WITH([qtgui],
	         AC_HELP_STRING([--without-qtgui],
                            ["If you want to disable generating the Qt gui sample"]),
			[no_qtgui="true"],,)

AC_ARG_WITH([samples],
	         AC_HELP_STRING([--without-samples],
                            ["If you want to disable generating all the samples
							 listed above.  This would be console, consoleHtmlConverter,
							 and qtgui"]),
			[no_samples="true"],,)

AC_ARG_WITH([regression],
             AC_HELP_STRING([--without-regression],
                            ["If you want to disable generating the regression suite"]),
            [no_regression="true"],,)


dnl  These are arguments are hidden.  They are arguments to be used with 
dnl the rpm build system.
AC_ARG_WITH([build_prefix],,[BUILD_prefix="$withval"],[BUILD_prefix=/usr/local],)
AC_MSG_RESULT(build_prefix is $BUILD_prefix)
AC_SUBST(BUILD_prefix)

AC_ARG_WITH([build_exec_prefix],,[BUILD_exec_prefix="$withval"],[BUILD_exec_prefix=/usr/local],)
AC_MSG_RESULT(build_exec_prefix is $BUILD_exec_prefix)
AC_SUBST(BUILD_exec_prefix)

AC_ARG_WITH([build_includedir],,[BUILD_includedir="$withval"],[BUILD_includedir=${includedir}],)
AC_MSG_RESULT(build_includedir is $BUILD_includedir)
AC_SUBST(BUILD_includedir)

AC_ARG_WITH([build_libdir],,[BUILD_libdir="$withval"],[BUILD_libdir=${libdir}],)
AC_MSG_RESULT(build_libdir is $BUILD_libdir)
AC_SUBST(BUILD_libdir)

AC_ARG_WITH([build_datadir],,[BUILD_datadir="$withval"],[BUILD_datadir=${datadir}],)
AC_MSG_RESULT(build_datadir is $BUILD_datadir)
AC_SUBST(BUILD_datadir)

if test "$no_doxygen" != true; then
    doxygen_api=../../doc/doxygen/api/html/*.*
    doxygen_api_framework=../../doc/doxygen/api+framework/html/*.*
    doxygen_api_framework_samples=../../doc/doxygen/api+framework+samples/html/*.*
    doxygen_api_samples=../../doc/doxygen/api+samples/html/*.*
	doxygenate=doxygenGen

    dnl Create the necessary directories
	mkdir ../../doc/doxygen/api
	mkdir ../../doc/doxygen/api/html
	mkdir ../../doc/doxygen/api+framework
	mkdir ../../doc/doxygen/api+framework/html
	mkdir ../../doc/doxygen/api+framework+samples
	mkdir ../../doc/doxygen/api+framework+samples/html
    mkdir ../../doc/doxygen/api+samples
	mkdir ../../doc/doxygen/api+samples/html

    dnl If I don't create at least one file
    dnl The make file will complain
	touch ../../doc/doxygen/api/html/dummy.html
	touch ../../doc/doxygen/api+framework/html/dummy.html
	touch ../../doc/doxygen/api+framework+samples/html/dummy.html
	touch ../../doc/doxygen/api+samples/html/dummy.html

    AC_SUBST(doxygen_api)
    AC_SUBST(doxygen_api_framework)
    AC_SUBST(doxygen_api_framework_samples)
    AC_SUBST(doxygen_api_samples)
	AC_SUBST(doxygenate)
fi

AC_CONFIG_SUBDIRS(scripts)
AC_CONFIG_SUBDIRS(lib)
if test "$no_samples" != true; then
    if test "$no_console" != true; then
        AC_CONFIG_SUBDIRS(console) 
		samples=console
    fi
	if test "$no_consoleHtmlConverter" != true; then
	    AC_CONFIG_SUBDIRS(consoleHtmlConverter_tag_layer)
	    samples="$samples consoleHtmlConverter_tag_layer"
	fi
	if test "$no_qtgui" != true; then
	   AC_CONFIG_SUBDIRS(qtgui)
	   samples="$samples qtgui"
	fi
fi

if test "$no_regression" != true; then
    AC_CONFIG_SUBDIRS(regression)
	samples="$samples regression"
fi

AC_SUBST(samples)
AM_INIT_AUTOMAKE(RebeccaAIML,0.0.1)
AC_OUTPUT(Makefile)
