AC_INIT([Theme-D-Gnome], [0.9.4], [tommi.hoynalanmaa at iki.fi], [theme-d-gnome], [http://www.iki.fi/tohoyn/theme-d/theme-d-gnome.html])

AM_INIT_AUTOMAKE

AC_CONFIG_MACRO_DIR([m4])

AC_ARG_WITH([guile],
  [AS_HELP_STRING([--with-guile],
    [Guile version to be used])],
  [guile_spec=$withval],
  [guile_spec=no])

CHECK_GUILE_VERSION
GUILE_PACKAGE=guile-$MY_GUILE_VERSION

mylibdir=$(pkg-config --variable=libdir guile-gnome-gtk-2)

if test "$mylibdir" = "" ; then
   echo "guile-gnome2 development files not found" ;
   exit 1 ;
fi

SRC_DIR=$(pwd)

LIB_DIR=$(get-theme-d-config-var lib-dir)

AC_SUBST(MY_GUILE_VERSION)

AC_SUBST(mylibdir)

AC_SUBST(SRC_DIR)

AC_SUBST(LIB_DIR)

AC_ARG_WITH([guile-gnome],
  [AS_HELP_STRING([--with-guile-gnome],
    [Specify the guile-gnome version])],
  [guile_gnome=$withval],
  [guile_gnome=2.16.5])

if test \( "$guile_gnome" != 2.16.2 -a \
  "$guile_gnome" != 2.16.4 -a \
  "$guile_gnome" != 2.16.5 \) ; then
  echo "Error: unsupported guile-gnome version" ;
  exit 1 ;
fi

wrap_target=$(pwd)/gnome/wrap-${guile_gnome}

wrapdir=$(pwd)/gnome/wrap

if test -h $wrapdir || test -e $wrapdir ; then
   rm $wrapdir ;
fi

ln -s $wrap_target $wrapdir

AC_SUBST(MODULE_DIR, $(${PKG_CONFIG} --variable=sitedir $GUILE_PACKAGE))

AC_SUBST(EXAMPLES_DIR, $docdir/examples)

API_VERSION=2
AC_SUBST(API_VERSION)

AC_CONFIG_FILES([Makefile
                 doc/Makefile
		 gnome/Makefile
		 theme-d-gnome/Makefile
                 theme-d-gnome/runtime/Makefile
		 scripts/Makefile
		 gnome-examples/Makefile
		 gnome-examples/theme-d-gnome-demo/Makefile
])
AC_OUTPUT
