diff --git a/.gitignore b/.gitignore
index 21c6cd392c0dea68db16669ebab61d96077ffafc..4cf33912bea10f5118c1fa8f0cf47c4100f4ce84 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,11 @@
 *~
 test-oop
 *.pc
+*.o
+*.lo
+*.la
+.libs
+.deps
 # autoconf related
 configure
 aclocal.m4
diff --git a/Makefile.am b/Makefile.am
index fca032f768dce661eeb71a5bfccaec29f9bad414..e7ab79f79fd0aeaad52f87590dbb84f592a9129d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,7 +51,7 @@ noinst_PROGRAMS = test-oop
 
 test_oop_SOURCES = test-oop.c
 test_oop_CFLAGS = $(GLIB2_CFLAGS) $(GLIB_INCLUDES) $(TCL_INCLUDES) $(WWW_INCLUDES)
-test_oop_LDADD = $(lib_LTLIBRARIES) $(GLIB2_LIBS) $(ADNS_LIBS) $(TCL_LIBS) $(READLINE_LIBS)
+test_oop_LDADD = $(lib_LTLIBRARIES) $(ADNS_LIBS) $(GLIB2_LIBS) $(GLIB_LIBS) $(TCL_LIBS) $(WWW_LIBS) $(READLINE_LIBS)
 
 release: dist
 	gzip -dc $(PACKAGE)-$(VERSION).tar.gz | bzip2 -9 \
diff --git a/configure.ac b/configure.ac
index 9dafa6d79af74ac20b0e3bc191920a99a8bc09b6..70752b997fe29f76e8a85e12233d9cfef42fc7be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(INSTALL)
-AM_INIT_AUTOMAKE(liboop,1.0)
+AC_INIT(liboop,1.0)
+AC_CONFIG_SRCDIR(INSTALL)
+AM_INIT_AUTOMAKE
 AC_CANONICAL_HOST
 AM_PROG_LIBTOOL
 AC_PROG_CC
@@ -71,7 +72,7 @@ if test xno != x$with_glib; then
 fi
 
 if test xno != x$with_tcl; then
-  for version in 8.4 8.3 8.2 8.1 8.0 ; do
+  for version in 8.6 8.5 8.4 8.3 8.2 8.1 8.0 ; do
     CPPFLAGS="$save_cppflags -I/usr/include/tcl$version"
     AC_CHECK_LIB(tcl$version,Tcl_Main,[
     AC_CHECK_HEADER(tcl.h,[
diff --git a/glib.c b/glib.c
index d2b785e86415da8eee78f5430a6d1f3b964777e0..e86eca86e585ec2be5aec0d1fcb49001d5071b68 100644
--- a/glib.c
+++ b/glib.c
@@ -4,6 +4,8 @@
    terms of the GNU Lesser General Public License, version 2.1 or later.
    See the file COPYING for details. */
 
+#ifdef HAVE_GLIB
+
 #include "glib.h"
 #include "oop-glib.h"
 #include "oop.h"
@@ -108,7 +110,7 @@ void *oop_glib_return(void) {
 	return ret;
 }
 
-#ifdef HAVE_POLL_H
+#if defined(HAVE_POLL_H) && GLIB_MAJOR_VERSION < 2
 static gint real_poll(GPollFD *array,guint num,gint timeout) {
 	assert(sizeof(GPollFD) == sizeof(struct pollfd));
 	return poll((struct pollfd *) array,num,timeout);
@@ -130,3 +132,5 @@ void oop_glib_delete(void) {
 	oop_select_delete(sel);
 	oop_sys_delete(sys);
 }
+
+#endif  /* HAVE_GLIB */