From 6a0dca4bac83b71942a4f3f77fba75f359cef393 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 14 May 2015 13:16:36 +0000
Subject: Haiku patch + upstream patches.


diff --git a/configure.in b/configure.in
index 7bb5def..cc3bd6f 100644
--- a/configure.in
+++ b/configure.in
@@ -59,11 +59,10 @@ AC_FUNC_STAT
 AC_CHECK_FUNCS([localtime_r socket])
 
 AC_CHECK_LIB(socket, socket, AC_DEFINE(HAVE_SOCKET) LIBS="$LIBS -lsocket")
+AC_CHECK_LIB(network, socket, AC_DEFINE(HAVE_SOCKET) LIBS="$LIBS -lnetwork")
 
 if test "$use_debug" = "yes"; then
-	CFLAGS="${CFLAGS} -g -DENABLE_DEBUG"
-else
-	CFLAGS="${CFLAGS} -O3"
+	CFLAGS="${CFLAGS} -DENABLE_DEBUG"
 fi
 
 # Choosing the target
@@ -78,7 +77,7 @@ if test "$use_ipv6" = "yes"; then
 	AC_CHECK_LIB(nsl, getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO) LIBS="$LIBS -lnsl")
 	CFLAGS="$CFLAGS -DENABLE_IPV6"
 else
-	AC_CHECK_FUNCS([gethostbyname_r inet_ntoa])
+	AC_CHECK_FUNCS([inet_ntoa])
 	AC_CHECK_LIB(nsl, inet_ntoa, AC_DEFINE(HAVE_INET_NTOA) LIBS="$LIBS -lnsl")
 fi
 
diff --git a/examples/Makefile.in b/examples/Makefile.in
index f4fb291..a7a0f19 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,7 +1,7 @@
 CC = @CC@
 CXX = @CXX@
 CFLAGS = -Wall @CFLAGS@
-LIBS = -L../src/ -lircclient -lpthread @LIBS@
+LIBS = -L../src/ -lircclient @LIBS@
 INCLUDES=-I../include
 
 EXAMPLES=spammer censor irctest ircftp colors
diff --git a/include/libircclient.h b/include/libircclient.h
index 4135383..5a14fc0 100644
--- a/include/libircclient.h
+++ b/include/libircclient.h
@@ -132,6 +132,7 @@ typedef void (*irc_dcc_callback_t) (irc_session_t * session, irc_dcc_t id, int s
 #define IN_INCLUDE_LIBIRC_H
 #include "libirc_errors.h"
 #include "libirc_events.h"
+#include "libirc_rfcnumeric.h"
 #include "libirc_options.h"
 #undef IN_INCLUDE_LIBIRC_H
 
diff --git a/src/Makefile.in b/src/Makefile.in
index e9fe96f..63047a7 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,12 +1,17 @@
 # $Id: Makefile.in 110 2012-02-13 03:07:47Z gyunaev $
 CC = @CC@
-CFLAGS = -Wall -DIN_BUILDING_LIBIRC @CFLAGS@
+CFLAGS = -fPIC -Wall -DIN_BUILDING_LIBIRC @CFLAGS@
 AR=@AR@ cr
 RANLIB=@RANLIB@
+INSTALL=install
+LN=ln -sf
 INCLUDES=-I../include
 DESTDIR=
 APIVERSION = 1
 
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+
 OBJS = libircclient.o
 
 all:	@TARGET@
@@ -15,19 +20,24 @@ static:	libircclient.a
 shared: libircclient.so
 shared_mingw: libircclient.dll
 
-install:
-	-mkdir -p $(DESTDIR)@prefix@/include
-	-mkdir -p $(DESTDIR)@libdir@
-	cp ../include/libircclient.h $(DESTDIR)@prefix@/include/libircclient.h
-	cp ../include/libirc_errors.h $(DESTDIR)@prefix@/include/libirc_errors.h
-	cp ../include/libirc_events.h  $(DESTDIR)@prefix@/include/libirc_events.h 
-	cp ../include/libirc_options.h  $(DESTDIR)@prefix@/include/libirc_options.h 
-	cp ../include/libirc_rfcnumeric.h  $(DESTDIR)@prefix@/include/libirc_rfcnumeric.h 
-	cp libircclient.so $(DESTDIR)@libdir@/libircclient.so.$(APIVERSION)
-	ln -fs libircclient.so.$(APIVERSION) $(DESTDIR)@libdir@/libircclient.so
+install: install-headers install-static install-shared
+install-headers:
+	$(INSTALL) -d $(DESTDIR)@includedir@
+	$(INSTALL) -m0644 ../include/libircclient.h $(DESTDIR)@includedir@/libircclient.h
+	$(INSTALL) -m0644 ../include/libirc_errors.h $(DESTDIR)@includedir@/libirc_errors.h
+	$(INSTALL) -m0644 ../include/libirc_events.h  $(DESTDIR)@includedir@/libirc_events.h 
+	$(INSTALL) -m0644 ../include/libirc_options.h  $(DESTDIR)@includedir@/libirc_options.h 
+	$(INSTALL) -m0644 ../include/libirc_rfcnumeric.h  $(DESTDIR)@includedir@/libirc_rfcnumeric.h 
+install-shared:
+	$(INSTALL) -d $(DESTDIR)@libdir@
+	$(INSTALL) -m0755 libircclient.so $(DESTDIR)@libdir@/libircclient.so.$(APIVERSION)
+	$(LN) libircclient.so.$(APIVERSION) $(DESTDIR)@libdir@/libircclient.so
+install-static:
+	$(INSTALL) -d $(DESTDIR)@libdir@
+	$(INSTALL) -m0644 libircclient.a $(DESTDIR)@libdir@/libircclient.a
 
 libircclient.so: libircclient.o
-	$(CC) -shared -s -Wl,-soname,libircclient.so.$(APIVERSION) -o libircclient.so libircclient.o @LIBS@
+	$(CC) $(CFLAGS) -shared -Wl,-soname,libircclient.so.$(APIVERSION) -o libircclient.so libircclient.o $(LDFLAGS) @LIBS@
 
 libircclient.dll: libircclient.o
 	$(CC) -shared -s -o libircclient.dll -Wl,-out-implib,libircclient.lib libircclient.o libircclient.def -lkernel32 -lwsock32 @LIBS@
-- 
1.8.3.4

