Tiny patch for SRV lookup on OS X 10.4.7
From: Geoff Schmidt <gschmidt@xxxxxxxxxxxx>
Date: Fri, 04 Aug 2006 06:15:50 +0200

Ladies and gentlemen --

I have been trying out the very nice gloox library on my PPC Powerbook running OS X 10.4.7. When my test program couldn't log into my gmail account, I discovered that configure was not defining HAVE_DN_SKIPNAME, causing the SRV lookup code to be compiled out. OS X in fact has dn_skipname, but it is a macro. There is a test in autoconf that tries to handle this case, but it fails on 10.4.7 because resolv.h fails to compile if netinet/in.h isn't included first due to an apparent header bug. So, I change configure.ac to include this header too, and now HAVE_D_SKIPNAME gets defined properly.

While I'm at it, a minor issue: --with-gnutls=X doesn't work quite right. It needs to look for gnutls-config in X rather than in the path. As it is now, it'll fail to find gnutls-config but proceed silently, resulting in a link failure when the sources are compiled for gnutls but -lgnutls isn't passed to the linker. A workaround is to put X on your path.

Anyway, here's a tiny configure.ac patch to fix the former issue, but not the latter. I can't guarantee it doesn't break things on other systems -- but those systews would have to have dn_skipname defined as a macro and provided in -lresolv, but not have netinet/in.h.

---snip---

*** configure.ac.orig   Thu Aug  3 23:31:14 2006
--- configure.ac        Fri Aug  4 00:04:17 2006
***************
*** 202,208 ****
AC_MSG_CHECKING([for dn_skipname in -lresolv (alternate version)])
        save_libs="$LIBS"
        LIBS="-lresolv $LIBS"
! AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <resolv.h>]], [[dn_skipname(0,0)]])],
                       [AC_MSG_RESULT(yes)
                        AC_DEFINE(HAVE_DN_SKIPNAME)
                        have_dn_skipname=yes],
--- 202,209 ----
AC_MSG_CHECKING([for dn_skipname in -lresolv (alternate version)])
        save_libs="$LIBS"
        LIBS="-lresolv $LIBS"
!       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
! #include <resolv.h>]], [[dn_skipname(0,0)]])],
                       [AC_MSG_RESULT(yes)
                        AC_DEFINE(HAVE_DN_SKIPNAME)
                        have_dn_skipname=yes],

---snip---

And here's an example of the failure (without that change):

configure:21522: checking for dn_skipname in -lresolv (alternate version) configure:21542: gcc -o conftest -g -O2 -I/Users/gschmidt/project/ libazrael/build/include -I/Users/gschmidt/project/libazrael/build/ include -I/Users/gschmidt/project/libazrael/build/include -L/Users/ gschmidt/project/libazrael/build/lib -L/Users/gschmidt/project/ libazrael/build/lib -L/Users/gschmidt/project/libazrael/build/lib conftest.c -lresolv -liksemel -lidn -L/Users/gschmidt/project/ libazrael/build/lib -lgnutls -L/Users/gschmidt/project/libazrael/ build//lib -lgcrypt -L/Users/gschmidt/project/libazrael/build//lib - lgpg-error -lz >&5
In file included from conftest.c:29:
/usr/include/resolv.h:189: error: array type has incomplete element type
/usr/include/resolv.h:203: error: field 'addr' has incomplete type
/usr/include/resolv.h:231: error: field 'sin' has incomplete type
configure:21548: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "gloox"
| #define VERSION "0.8.1-sic"
| #ifdef __cplusplus
| extern "C" void std::exit (int); using std::exit;
| #endif
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define HAVE_LIBIDN 1
| #define HAVE_GNUTLS 1
| #define HAVE_ZLIB 1
| #define HAVE_RES_QUERYDOMAIN 1
| /* end confdefs.h.  */
| #include <resolv.h>
| int
| main ()
| {
| dn_skipname(0,0)
|   ;
|   return 0;
| }
configure:21574: result: no

Thanks a lot! Hope it helps someone.

Geoff Schmidt
Auburn Quad
gschmidt@xxxxxxxxxxxx



--
gloox-dev mailing list
to unsubscribe:
send a message with subject 'unsubscribe gloox-dev' to minimalist@xxxxxxxxxx