changeset 16908:d0e74d0be43f

I expanded your patch, Richard, to also do appropriate header checking in the configure script and then use that information. I removed some other #includes which don't appear to be needed. committer: Richard Laager <rlaager@wiktel.com>
author Evan Schoenberg <evan.s@dreskin.net>
date Sat, 05 May 2007 16:48:06 +0000
parents 533ebd404184
children 2be397cd726a
files configure.ac libpurple/nat-pmp.c
diffstat 2 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sat May 05 14:50:00 2007 +0000
+++ b/configure.ac	Sat May 05 16:48:06 2007 +0000
@@ -1922,6 +1922,7 @@
 AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h)
 AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h)
 AC_CHECK_HEADERS(termios.h)
+AC_CHECK_HEADERS(sys/sysctl.h sys/socket.h)
 AC_VAR_TIMEZONE_EXTERNALS
 
 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
--- a/libpurple/nat-pmp.c	Sat May 05 14:50:00 2007 +0000
+++ b/libpurple/nat-pmp.c	Sat May 05 16:48:06 2007 +0000
@@ -29,30 +29,25 @@
  */
 
 #include "nat-pmp.h"
+#include "internal.h"
 #include "debug.h"
 #include "signals.h"
 #include "network.h"
 
-#include <sys/types.h>
-#ifndef _WIN32
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
+#ifdef HAVE_SYS_SYSCTL_H
 #include <sys/sysctl.h>
-
-#include <net/if.h>
-#include <net/route.h>
-
-#include <netdb.h>
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
 
-#include <errno.h>
+/* We will need sysctl() and NET_RT_DUMP, both of which are not present
+ * on all platforms, to continue. */
+#if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP)
 
-#ifdef NET_RT_DUMP
+#include <sys/types.h>
+#include <net/route.h>
 
 #define PMP_DEBUG	1
 
@@ -548,4 +543,4 @@
 {
 
 }
-#endif /* #ifndef NET_RT_DUMP */
+#endif /* #if !(defined(HAVE_SYS_SYCTL_H) && defined(NET_RT_DUMP)) */