From ed0fc3ae13eaa0791ecf1a6759eaf2f369fd9435 Mon Sep 17 00:00:00 2001
From: Fernando Ortiz <fortiz2k@gmail.com>
Date: Wed, 2 Sep 2015 22:46:14 -0500
Subject: [PATCH] changes from grawity/gale/liboop and some other changes

grawity/gale/liboop
  - changes taken from https://github.com/grawity/gale/commit/22ceb912292158885240bda94fb92cfa43317f37
  - https://github.com/grawity/gale/commit/46e485462c9d55c0983d976e624cdd75914517fd
  - and https://github.com/grawity/gale/commit/56398124fa4bd4bbb1d61bd666442147f303a9e8
---
 .gitignore   | 5 +++++
 Makefile.am  | 2 +-
 configure.ac | 7 ++++---
 glib.c       | 6 +++++-
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index 21c6cd3..4cf3391 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 fca032f..e7ab79f 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 9dafa6d..70752b9 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 d2b785e..e86eca8 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 */
-- 
GitLab