From ec3e12b62a341d94440623a8d129fb1c5e4074e0 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Thu, 26 May 2011 22:42:16 +0200 Subject: [PATCH] Check for res_ndestroy. --- .hgignore | 1 + ObjXMPP.xcodeproj/project.pbxproj | 2 ++ autogen.sh | 1 + configure.ac | 13 +++++++++++++ src/Makefile | 1 + src/XMPPAuthenticator.m | 4 ++++ src/XMPPConnection.m | 4 ++++ src/XMPPExceptions.m | 4 ++++ src/XMPPIQ.m | 4 ++++ src/XMPPJID.m | 4 ++++ src/XMPPMessage.m | 4 ++++ src/XMPPPLAINAuth.m | 4 ++++ src/XMPPPresence.m | 4 ++++ src/XMPPRoster.m | 4 ++++ src/XMPPRosterItem.m | 4 ++++ src/XMPPSCRAMAuth.m | 4 ++++ src/XMPPSRVLookup.m | 6 ++++++ src/XMPPStanza.m | 4 ++++ 18 files changed, 72 insertions(+) diff --git a/.hgignore b/.hgignore index fca0562..6bd7ef5 100644 --- a/.hgignore +++ b/.hgignore @@ -8,6 +8,7 @@ aclocal.m4 autom4te.cache build buildsys.mk +config.h.in config.log config.status configure diff --git a/ObjXMPP.xcodeproj/project.pbxproj b/ObjXMPP.xcodeproj/project.pbxproj index 25ba762..49f843f 100644 --- a/ObjXMPP.xcodeproj/project.pbxproj +++ b/ObjXMPP.xcodeproj/project.pbxproj @@ -416,6 +416,7 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = HAVE_RES_NDESTROY; GCC_VERSION = 4.2; INFOPLIST_FILE = Info.plist; OTHER_LDFLAGS = ( @@ -439,6 +440,7 @@ FRAMEWORK_VERSION = A; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = HAVE_RES_NDESTROY; GCC_VERSION = 4.2; INFOPLIST_FILE = Info.plist; OTHER_LDFLAGS = ( diff --git a/autogen.sh b/autogen.sh index e96b271..14657bc 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,3 +1,4 @@ #!/bin/sh aclocal -I m4 || exit 1 autoconf || exit 1 +autoheader || exit 1 diff --git a/configure.ac b/configure.ac index 1a3876c..c33cbcd 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,18 @@ AC_TRY_LINK([#include [AC_MSG_RESULT([in -lbind])], [AC_MSG_ERROR(not found)])])])]) +AC_MSG_CHECKING([for res_ndestroy]) +AC_TRY_LINK([ + #include +], [ + res_ndestroy(&_res) +], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_NDESTROY, 1, [Whether we have res_ndestroy]) +], [ + AC_MSG_RESULT(no) +]) + AC_CHECK_LIB(objopenssl, main, [ LIBS="$LIBS -lobjopenssl -lcrypto" ], [ @@ -92,4 +104,5 @@ AC_SUBST(CPPFLAGS) AC_SUBST(PACKAGE, ObjXMPP) AC_CONFIG_FILES([buildsys.mk extra.mk]) +AC_CONFIG_HEADERS(config.h) AC_OUTPUT diff --git a/src/Makefile b/src/Makefile index a0005eb..7c9031c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -25,4 +25,5 @@ INCLUDES = ${SRCS:.m=.h} \ include ../buildsys.mk +CPPFLAGS += -I.. -DHAVE_CONFIG_H LD = ${OBJC} diff --git a/src/XMPPAuthenticator.m b/src/XMPPAuthenticator.m index bbbd359..035a6aa 100644 --- a/src/XMPPAuthenticator.m +++ b/src/XMPPAuthenticator.m @@ -20,6 +20,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #import "XMPPAuthenticator.h" @implementation XMPPAuthenticator diff --git a/src/XMPPConnection.m b/src/XMPPConnection.m index 719c373..1da719f 100644 --- a/src/XMPPConnection.m +++ b/src/XMPPConnection.m @@ -21,6 +21,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #define XMPP_CONNECTION_M #include diff --git a/src/XMPPExceptions.m b/src/XMPPExceptions.m index 687212b..99ac4ed 100644 --- a/src/XMPPExceptions.m +++ b/src/XMPPExceptions.m @@ -20,6 +20,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #import "XMPPExceptions.h" @implementation XMPPException diff --git a/src/XMPPIQ.m b/src/XMPPIQ.m index fba20ca..8defa63 100644 --- a/src/XMPPIQ.m +++ b/src/XMPPIQ.m @@ -21,6 +21,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #import "namespaces.h" #import "XMPPIQ.h" diff --git a/src/XMPPJID.m b/src/XMPPJID.m index 8c842fd..1de2a04 100644 --- a/src/XMPPJID.m +++ b/src/XMPPJID.m @@ -21,6 +21,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #import "XMPPJID.h" diff --git a/src/XMPPMessage.m b/src/XMPPMessage.m index 31495c5..900d549 100644 --- a/src/XMPPMessage.m +++ b/src/XMPPMessage.m @@ -21,6 +21,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #import "XMPPMessage.h" #import "namespaces.h" diff --git a/src/XMPPPLAINAuth.m b/src/XMPPPLAINAuth.m index af469e8..e671ed7 100644 --- a/src/XMPPPLAINAuth.m +++ b/src/XMPPPLAINAuth.m @@ -20,6 +20,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #import "XMPPPLAINAuth.h" #import "XMPPExceptions.h" diff --git a/src/XMPPPresence.m b/src/XMPPPresence.m index cd49476..fe8a57c 100644 --- a/src/XMPPPresence.m +++ b/src/XMPPPresence.m @@ -21,6 +21,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #import "XMPPPresence.h" #import "namespaces.h" diff --git a/src/XMPPRoster.m b/src/XMPPRoster.m index 94d1073..61faca9 100644 --- a/src/XMPPRoster.m +++ b/src/XMPPRoster.m @@ -20,6 +20,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #import "XMPPRoster.h" diff --git a/src/XMPPRosterItem.m b/src/XMPPRosterItem.m index 6bfeffb..53d3f70 100644 --- a/src/XMPPRosterItem.m +++ b/src/XMPPRosterItem.m @@ -20,6 +20,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #import "XMPPRosterItem.h" @implementation XMPPRosterItem diff --git a/src/XMPPSCRAMAuth.m b/src/XMPPSCRAMAuth.m index 02bb772..c5be21b 100644 --- a/src/XMPPSCRAMAuth.m +++ b/src/XMPPSCRAMAuth.m @@ -21,6 +21,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include diff --git a/src/XMPPSRVLookup.m b/src/XMPPSRVLookup.m index 10ea511..4fd1e4d 100644 --- a/src/XMPPSRVLookup.m +++ b/src/XMPPSRVLookup.m @@ -21,6 +21,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include @@ -239,7 +243,9 @@ } } @finally { [self freeMemory: answer]; +#ifdef HAVE_RES_NDESTROY res_ndestroy(&resState); +#endif } [pool release]; diff --git a/src/XMPPStanza.m b/src/XMPPStanza.m index 9396f46..10abab1 100644 --- a/src/XMPPStanza.m +++ b/src/XMPPStanza.m @@ -21,6 +21,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #import "XMPPStanza.h" #import "XMPPJID.h" #import "namespaces.h"