dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.53)
AC_INIT(configure.in)
AM_INIT_AUTOMAKE(gDesklets, 0.33.1, http://bugzilla.gnome.org/enter_bug.cgi?product=gdesklets)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

dnl Required programs
AC_PROG_CC
AC_PROG_CXX(gcc cc)
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_DISABLE_STATIC
AC_PROG_INTLTOOL
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_MAKE_SET

dnl Stolen from nautilus' configure.in *g*
AC_ARG_ENABLE(more-warnings,
[  --enable-more-warnings  Maximum compiler warnings],
set_more_warnings="$enableval",[
    set_more_warnings=no
])
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
    AC_MSG_RESULT(yes)
    CFLAGS="\
    -Wall \
    -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
    -Wnested-externs -Wpointer-arith \
    -Wcast-align -Wsign-compare \
    -std=gnu89 \
    $CFLAGS"

    for option in -Wno-strict-aliasing -Wno-sign-compare; do
        SAVE_CFLAGS="$CFLAGS"
        CFLAGS="$CFLAGS $option"
        AC_MSG_CHECKING([whether gcc understands $option])
        AC_TRY_COMPILE([], [],
            has_option=yes,
            has_option=no,)
        if test $has_option = no; then
            CFLAGS="$SAVE_CFLAGS"
        fi
        AC_MSG_RESULT($has_option)
        unset has_option
        unset SAVE_CFLAGS
    done
    unset option
else
    AC_MSG_RESULT(no)
fi

AM_PATH_PYTHON([2.3])
PYTHON_PREFIX=`python -c "import sys; print sys.prefix"`
PYTHON_CFLAGS="-I$PYTHON_PREFIX/include/python$PYTHON_VERSION"
AC_CHECK_HEADER([$PYTHON_PREFIX/include/python$PYTHON_VERSION/Python.h],,
    AC_ERROR([Can't find Python.h! You will need the python development package
              to successfully compile gDesklets.]))
AC_SUBST(PYTHON_CFLAGS)

PKG_CHECK_MODULES(UTILS, glib-2.0 gdk-pixbuf-2.0 gtk+-2.0 pygtk-2.0 >= 2.4.0)
AC_SUBST(UTILS_CFLAGS)
AC_SUBST(UTILS_LIBS)

PKG_CHECK_MODULES(EWMH, pygtk-2.0 >= 2.4.0 gdk-2.0)
AC_SUBST(EWMH_CFLAGS)
AC_SUBST(EWMH_LIBS)

PKG_CHECK_MODULES(GLIBTOP, pygtk-2.0 >= 2.4.0 libgtop-2.0 >= 2.6.0)
AC_SUBST(GLIBTOP_CFLAGS)
AC_SUBST(GLIBTOP_LIBS)

PKG_CHECK_MODULES(SVG, pygtk-2.0 >= 2.4.0 gtk+-2.0 librsvg-2.0)
AC_SUBST(SVG_CFLAGS)
AC_SUBST(SVG_LIBS)

PKG_CHECK_MODULES(SYSTRAY, pygtk-2.0 >= 2.4.0 libgnomeui-2.0 >= 2.2.0)
AC_SUBST(SYSTRAY_CFLAGS)
AC_SUBST(SYSTRAY_LIBS)

PKG_CHECK_MODULES(TILING, pygtk-2.0 >= 2.4.0 gtk+-2.0 gdk-pixbuf-2.0 gconf-2.0)
AC_SUBST(TILING_CFLAGS)
AC_SUBST(TILING_LIBS)

ALL_LINGUAS="ar az bg ca cs de el en_CA en_GB es eu fr he hr hu is it ja lt ms nl no pa pl pt pt_BR ru sq sr sr@Latn sv tr ko uk"
AC_SUBST(ALL_LINGUAS)
GETTEXT_PACKAGE=gdesklets
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
AM_GLIB_GNU_GETTEXT

coredir=${libdir}/gdesklets
AC_SUBST(coredir)

PIXMAPDIR=${datadir}/pixmaps
AC_SUBST(PIXMAPDIR)

localedir=${datadir}/locale
AC_SUBST(localedir)

gnulocaledir=${localedir}
AC_SUBST(gnulocaledir)

AC_PATH_PROG(UPDATE_MIME_DATABASE, update-mime-database)
AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, update-desktop-database)
AC_PATH_PROG(GCONFTOOL, gconftool-2)

AM_GCONF_SOURCE_2

AC_OUTPUT([
Controls/Calendar/Makefile
Controls/HDDTemp/Makefile
Controls/Makefile
Controls/Sensor/Makefile
Controls/System/Makefile
Controls/Time/Makefile
Controls/URI/Makefile
Makefile
Sensors/External/Makefile
Sensors/FontSelector/Makefile
Sensors/Makefile
config/Makefile
data/Makefile
display/Makefile
doc/Makefile
doc/man/Makefile
factory/Makefile
gDesklets.spec
libdesklets/Makefile
libdesklets/controls/Makefile
libdesklets/system/FreeBSD/Makefile
libdesklets/system/Linux/Makefile
libdesklets/system/Makefile
libdesklets/system/NetBSD/Makefile
libdesklets/system/OpenBSD/Makefile
main/Makefile
plugin/Makefile
po/Makefile.in
scripting/Makefile
sensor/Makefile
shell/Makefile
shell/plugins/ControlBrowser/Makefile
shell/plugins/ControlCollection/Makefile
shell/plugins/ControlsView/Makefile
shell/plugins/DisplayBrowser/Makefile
shell/plugins/DisplayCollection/Makefile
shell/plugins/DisplayView/Makefile
shell/plugins/Help/Makefile
shell/plugins/Makefile
shell/plugins/Menu/Makefile
shell/plugins/PackageInstaller/Makefile
shell/plugins/Profiles/Makefile
shell/plugins/Shell/Makefile
shell/plugins/StatusBar/Makefile
shell/plugins/ViewSwitch/Makefile
shell/plugins/gDeskletsClient/Makefile
tools/Makefile
utils/Makefile
])


echo "
=============
Configuration
=============

  gDesklets version: ${VERSION}
  Python prefix:     ${PYTHON_PREFIX}
  Python version:    ${PYTHON_VERSION}

  Install location:  ${prefix}
"
