Bug 705: Make building works under Mingw by disabling socket.h and in.h includes only when Mingw is used

This commit is contained in:
fmoatamr
2009-11-05 11:17:44 +01:00
parent 41b20ef8ea
commit 46d64d4b8e
4 changed files with 21 additions and 8 deletions

View File

@@ -21,9 +21,15 @@
#include <stdio.h>
#include <sstream>
#include "ns3/net-anim-config.h"
// Socket related includes
#include <sys/socket.h>
#include <netinet/in.h>
#if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_NETINET_IN_H)
# include <sys/socket.h>
# include <netinet/in.h>
#else
#include <fcntl.h>
#endif
// ns3 includes
#include "ns3/animation-interface.h"
@@ -58,6 +64,7 @@ bool AnimationInterface::SetOutputFile (const std::string& fn)
bool AnimationInterface::SetServerPort (uint16_t port)
{
#if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_NETINET_IN_H)
int s = socket (AF_INET, SOCK_STREAM, 0);
struct sockaddr_in addr;
addr.sin_family = AF_INET;
@@ -77,6 +84,8 @@ bool AnimationInterface::SetServerPort (uint16_t port)
int t = 1;
setsockopt (s, SOL_SOCKET, SO_LINGER, &t, sizeof(t));
return true;
#endif
return false;//never reached unless the above is disabled
}
bool AnimationInterface::SetInternalAnimation ()

View File

@@ -21,10 +21,6 @@
#include <iostream>
#include <sstream>
// Socket related includes
#include <sys/socket.h>
#include <netinet/in.h>
// ns3 includes
#include "ns3/animation-interface.h"
#include "ns3/point-to-point-dumbbell-helper.h"

View File

@@ -1,5 +1,11 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def configure(conf):
conf.check(header_name='sys/socket.h', define_name='HAVE_SYS_SOCKET_H')
conf.check(header_name='netinet/in.h', define_name='HAVE_NETINET_IN_H')
conf.write_config_header('ns3/net-anim-config.h', top=True)
def build(bld):
obj = bld.create_ns3_module('net-anim')
obj.source = [

View File

@@ -14,10 +14,12 @@ def configure(conf):
conf.report_optional_feature("XmlIo", "XmlIo",
conf.env['ENABLE_LIBXML2'],
"library 'libxml-2.0 >= 2.7' not found")
conf.sub_config('stats')
conf.write_config_header('ns3/contrib-config.h', top=True)
conf.sub_config('stats')
conf.sub_config('net-anim')
def build(bld):
module = bld.create_ns3_module('contrib', ['simulator', 'common'])
module.source = [