Re: [Sofia-sip-devel] [PATCH] Fix gai_strerror re-declaration in MinGW

2010-07-08 Thread Pekka Pessi
2010/7/8 Stefano Sabatini :
> Exactly, this way the patch is much simpler.

Thanks! Applied.

-- 
Pekka.Pessi mail at nokia.com

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] [PATCH] Fix gai_strerror re-declaration in MinGW

2010-07-08 Thread Stefano Sabatini
On date Wednesday 2010-07-07 17:30:57 +0300, Pekka Pessi phoned this:
> 2010/7/6 Stefano Sabatini :
> > Hi, as in subject.
> >
> > The patch requires to run autoheader to re-generate the config.h.in
> > file.
> 
> Thanks for patch. I wonder if it is enough just to #undef
> gai_strerror? No need to check its declaration?

Exactly, this way the patch is much simpler.

Regards.
>From 3ed1bea1f042248645e25d4b26f4f57dcf12f6ce Mon Sep 17 00:00:00 2001
From: Stefano Sabatini 
Date: Tue, 6 Jul 2010 15:43:13 +0200
Subject: [PATCH 2/2] Undefine gai_strerror symbol if the function is not defined.

Avoid a re-definition issue and fix compilation in MinGW, where
gai_strerror is declared but not defined.
---
 libsofia-sip-ua/su/su_addrinfo.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libsofia-sip-ua/su/su_addrinfo.c b/libsofia-sip-ua/su/su_addrinfo.c
index c8005c0..6637da3 100644
--- a/libsofia-sip-ua/su/su_addrinfo.c
+++ b/libsofia-sip-ua/su/su_addrinfo.c
@@ -820,6 +820,8 @@ freeaddrinfo(ai)
 #endif
 
 #if !HAVE_GAI_STRERROR
+#undef gai_strerror
+
 static
 char *
 gai_strerror(ecode)
-- 
1.7.1

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] [PATCH] Fix gai_strerror re-declaration in MinGW

2010-07-07 Thread Pekka Pessi
2010/7/6 Stefano Sabatini :
> Hi, as in subject.
>
> The patch requires to run autoheader to re-generate the config.h.in
> file.

Thanks for patch. I wonder if it is enough just to #undef
gai_strerror? No need to check its declaration?

-- 
Pekka.Pessi mail at nokia.com

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


[Sofia-sip-devel] [PATCH] Fix gai_strerror re-declaration in MinGW

2010-07-06 Thread Stefano Sabatini
Hi, as in subject.

The patch requires to run autoheader to re-generate the config.h.in
file.

Regards.
>From c75913c29b31450936a366f4b918bb29cde461e7 Mon Sep 17 00:00:00 2001
Message-Id: 
In-Reply-To: 
References: 
From: Stefano Sabatini 
Date: Tue, 6 Jul 2010 15:43:13 +0200
Subject: [fix-mingw-compilation PATCH 2/2] Avoid gai_strerror redefinition if it has been already declared.

Fix compilation on MinGW (where it is declared but not defined).
---
 libsofia-sip-ua/su/su_addrinfo.c |4 
 m4/sac-general.m4|6 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libsofia-sip-ua/su/su_addrinfo.c b/libsofia-sip-ua/su/su_addrinfo.c
index c8005c0..4663fee 100644
--- a/libsofia-sip-ua/su/su_addrinfo.c
+++ b/libsofia-sip-ua/su/su_addrinfo.c
@@ -820,6 +820,10 @@ freeaddrinfo(ai)
 #endif
 
 #if !HAVE_GAI_STRERROR
+#if HAVE_DECL_GAI_STRERROR
+#undef gai_strerror
+#endif
+
 static
 char *
 gai_strerror(ecode)
diff --git a/m4/sac-general.m4 b/m4/sac-general.m4
index de0ba9a..ec42733 100644
--- a/m4/sac-general.m4
+++ b/m4/sac-general.m4
@@ -359,6 +359,9 @@ fi
 ])
 
 if test "$ac_cc_environment" = mingw32 ; then
+
+AC_CHECK_DECLS([gai_strerror], [], [], [[#include ]])
+
 CFLAGS="$CFLAGS -I${srcdir}/win32/pthread -DWINVER=0x0501 \
 	-D_WIN32_WINNT=0x0501 -DIN_LIBSOFIA_SIP_UA -DIN_LIBSOFIA_SRES \
 	-mms-bitfields \
@@ -370,7 +373,10 @@ MINGW_ENVIRONMENT=1
 AC_SUBST(MINGW_ENVIRONMENT)
 AC_DEFINE([HAVE_MINGW], [1], [Define to 1 if you are compiling in MinGW environment])
 AC_DEFINE([HAVE_WIN32], [1], [Define to 1 if you have WIN32])
+else
+AC_CHECK_DECLS([gai_strerror])
 fi
+
 AM_CONDITIONAL([HAVE_MINGW32], [test "x$ac_cc_environment" != x])
 ])dnl
 
-- 
1.7.1

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel