Bug 705: Make building works under Mingw by disabling socket.h and in.h includes only when Mingw is used
authorfmoatamr
Thu Nov 05 11:17:44 2009 +0100 (3 months ago)
changeset 5477ff7b28fe6a5c
parent 5476 f410b023d472
child 5478 a019314e2ab3
Bug 705: Make building works under Mingw by disabling socket.h and in.h includes only when Mingw is used
src/contrib/net-anim/animation-interface.cc
src/contrib/net-anim/point-to-point-dumbbell-helper.cc
src/contrib/net-anim/wscript
src/contrib/wscript
     1.1 --- a/src/contrib/net-anim/animation-interface.cc	Wed Nov 04 21:08:32 2009 -0800
     1.2 +++ b/src/contrib/net-anim/animation-interface.cc	Thu Nov 05 11:17:44 2009 +0100
     1.3 @@ -21,9 +21,15 @@
     1.4  #include <stdio.h>
     1.5  #include <sstream>
     1.6  
     1.7 +#include "ns3/net-anim-config.h"
     1.8 +
     1.9  // Socket related includes
    1.10 -#include <sys/socket.h>
    1.11 -#include <netinet/in.h>
    1.12 +#if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_NETINET_IN_H)
    1.13 +# include <sys/socket.h>
    1.14 +# include <netinet/in.h>
    1.15 +#else
    1.16 +#include <fcntl.h>
    1.17 +#endif
    1.18  
    1.19  // ns3 includes
    1.20  #include "ns3/animation-interface.h"
    1.21 @@ -58,6 +64,7 @@
    1.22  
    1.23  bool AnimationInterface::SetServerPort (uint16_t port)
    1.24  {
    1.25 +#if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_NETINET_IN_H)
    1.26    int s = socket (AF_INET, SOCK_STREAM, 0);
    1.27    struct sockaddr_in addr;
    1.28    addr.sin_family = AF_INET;
    1.29 @@ -77,6 +84,8 @@
    1.30    int t = 1;
    1.31    setsockopt (s, SOL_SOCKET, SO_LINGER, &t, sizeof(t));
    1.32    return true;
    1.33 +#endif
    1.34 +  return false;//never reached unless the above is disabled
    1.35  }
    1.36  
    1.37  bool AnimationInterface::SetInternalAnimation ()
     2.1 --- a/src/contrib/net-anim/point-to-point-dumbbell-helper.cc	Wed Nov 04 21:08:32 2009 -0800
     2.2 +++ b/src/contrib/net-anim/point-to-point-dumbbell-helper.cc	Thu Nov 05 11:17:44 2009 +0100
     2.3 @@ -21,10 +21,6 @@
     2.4  #include <iostream>
     2.5  #include <sstream>
     2.6  
     2.7 -// Socket related includes
     2.8 -#include <sys/socket.h>
     2.9 -#include <netinet/in.h>
    2.10 -
    2.11  // ns3 includes
    2.12  #include "ns3/animation-interface.h"
    2.13  #include "ns3/point-to-point-dumbbell-helper.h"
     3.1 --- a/src/contrib/net-anim/wscript	Wed Nov 04 21:08:32 2009 -0800
     3.2 +++ b/src/contrib/net-anim/wscript	Thu Nov 05 11:17:44 2009 +0100
     3.3 @@ -1,5 +1,11 @@
     3.4  ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
     3.5  
     3.6 +def configure(conf):
     3.7 +    conf.check(header_name='sys/socket.h', define_name='HAVE_SYS_SOCKET_H')
     3.8 +    conf.check(header_name='netinet/in.h', define_name='HAVE_NETINET_IN_H')
     3.9 +    conf.write_config_header('ns3/net-anim-config.h', top=True)
    3.10 +
    3.11 +
    3.12  def build(bld):
    3.13      obj = bld.create_ns3_module('net-anim')
    3.14      obj.source = [
     4.1 --- a/src/contrib/wscript	Wed Nov 04 21:08:32 2009 -0800
     4.2 +++ b/src/contrib/wscript	Thu Nov 05 11:17:44 2009 +0100
     4.3 @@ -14,9 +14,11 @@
     4.4      conf.report_optional_feature("XmlIo", "XmlIo",
     4.5                                   conf.env['ENABLE_LIBXML2'],
     4.6                                   "library 'libxml-2.0 >= 2.7' not found")
     4.7 +    conf.write_config_header('ns3/contrib-config.h', top=True)
     4.8 +
     4.9      conf.sub_config('stats')
    4.10 +    conf.sub_config('net-anim')
    4.11  
    4.12 -    conf.write_config_header('ns3/contrib-config.h', top=True)
    4.13  
    4.14  def build(bld):
    4.15      module = bld.create_ns3_module('contrib', ['simulator', 'common'])