dnl Process this file with autoconf to produce configure.
AC_INIT(guile-gtk.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(guile-gtk, 0.12a)

##
## NOTE: before changing anything here, please read README.gnome-guile
##

INSTALLED_DEFS_FILES=""
AC_SUBST(INSTALLED_DEFS_FILES)

if test x$prefix = xNONE; then
  defsdir=$ac_default_prefix/share/gtk
else
  defsdir=$prefix/share/gtk
fi

AC_MSG_CHECKING(whether to install gtk.defs)
if test ! -f $defsdir/gtk.defs ||
   test	"`head -1 $defsdir/gtk.defs`" = ";; (installed by guile-gtk)"; then
  INSTALLED_DEFS_FILES="gtk.defs $INSTALLED_DEFS_FILES"
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to install gdk.defs)
if test ! -f $defsdir/gdk.defs ||
   test "`head -1 $defsdir/gdk.defs`" = ";; (installed by guile-gtk)"; then
  INSTALLED_DEFS_FILES="gdk.defs $INSTALLED_DEFS_FILES"
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

AC_PROG_CC
AM_PROG_LIBTOOL

AC_ARG_ENABLE(debug,
            [  --enable-debug          compile with -g for debugging symbols],
            [ CFLAGS="-g $CFLAGS" ])

AM_PATH_GTK(1.0.0,,AC_ERROR(need at least Gtk+ version 1.0))

GNOME_CHECK_GUILE(fail)

saved_LIBS="$LIBS"

# Check for bleeding edge Guile functions
LIBS="$GUILE_LIBS $LIBS"
AC_CHECK_FUNCS(scm_internal_cwdr scm_done_malloc scm_reverse_x scm_puts)

# Check for cutting edge Gtk functions
LIBS="$GTK_LIBS $saved_LIBS"
AC_CHECK_FUNCS(gdk_color_copy gtk_widget_peek_colormap)

LIBS="$saved_LIBS"

AC_OUTPUT([Makefile build-guile-gtk], [chmod +x build-guile-gtk])
