Commit e57c1182 authored by Simon Morlat's avatar Simon Morlat

start porting on win32

parent d68cfb8c
Dependencies:
libantlr3c-3.2
antlr3-3.2
Newer versions won't compile.
On windows you have to edit /usr/local/include/antl3defs.h
replace:
#include <winsock.h>
by:
#include <winsock2.h>
......@@ -19,6 +19,10 @@ if test -d /opt/local/share/aclocal ; then
ACLOCAL_ARGS="-I /opt/local/share/aclocal"
fi
if test -d /share/aclocal ; then
ACLOCAL_ARGS="-I /share/aclocal"
fi
echo "Generating build scripts in belle-sip..."
set -x
$LIBTOOLIZE --copy --force
......
......@@ -37,12 +37,13 @@ else
CFLAGS="-g"
fi
STRICT_OPTIONS=" -Wall -Werror"
STRICT_OPTIONS=" -Wall -Werror -Wno-error=unknown-pragmas"
dnl because of antlr3 we must accept a few warnings...
LESS_STRICT_OPTIONS= #more portable
# LESS_STRICT_OPTIONS="$STRICT_OPTIONS -Wno-error=unused-function \
# -Wno-error=uninitialized -Wno-error=unused-variable \
# -Wno-error=unused-but-set-variable "
dnl more portable for the moment
LESS_STRICT_OPTIONS=
dnl LESS_STRICT_OPTIONS="$STRICT_OPTIONS -Wno-error=unused-function \
dnl -Wno-error=uninitialized -Wno-error=unused-variable \
dnl -Wno-error=unused-but-set-variable "
AC_SUBST(STRICT_OPTIONS)
AC_SUBST(LESS_STRICT_OPTIONS)
......@@ -51,7 +52,7 @@ AC_SUBST(LESS_STRICT_OPTIONS)
# Checks for header files.
AC_ARG_WITH( antlr,
[ --with-antlr Set prefix where libantlr can be found or "none" to disable (ex:/usr or /usr/local)[default=/usr] ],
[ --with-antlr Set prefix where libantlr3c can be found (ex:/usr or /usr/local)[default=/usr] ],
[ antlr_prefix=${withval}],[ antlr_prefix=/usr ])
found_antlr3=no
......@@ -131,6 +132,9 @@ case "$target_os" in
#hack for macport
CUNIT_LIBS+=" -lncurses"
;;
*mingw*)
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0501"
;;
esac
if test "$found_cunit" = "no" ; then
......
......@@ -18,10 +18,6 @@
#ifndef BELLE_SIP_MAINLOOP_H
#define BELLE_SIP_MAINLOOP_H
#include <errno.h>
#include <sys/socket.h>
#include <unistd.h>
#define BELLE_SIP_EVENT_READ 1
......
......@@ -20,16 +20,27 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#ifndef WIN32
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <pthread.h>
#else
#include <ws2tcpip.h>
#include <winsock2.h>
#include <pthread.h>
#endif
/* include all public headers*/
......
......@@ -329,6 +329,8 @@ char *belle_sip_object_describe(void *obj){
return _belle_sip_object_describe_type(o->vptr);
}
#if !defined(WIN32)
#include <dlfcn.h>
char *belle_sip_object_describe_type_from_name(const char *name){
......@@ -351,3 +353,13 @@ char *belle_sip_object_describe_type_from_name(const char *name){
}
return _belle_sip_object_describe_type((belle_sip_object_vptr_t*)symbol);
}
#else
char *belle_sip_object_describe_type_from_name(const char *name){
return belle_sip_strdup_printf("Sorry belle_sip_object_describe_type_from_name() is not implemented on this platform.");
}
#endif
......@@ -22,12 +22,6 @@
#include "belle_sip_internal.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <pthread.h>
#define BELLE_SIP_RESOLVER_HINT_IPV6 (1)
#define BELLE_SIP_RESOLVER_HINT_SRV (1<<1)
......
......@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "belle_sip_internal.h"
#include "belle-sip/uri.h"
#include "belle-sip/parameters.h"
#include <stdlib.h>
......@@ -23,7 +24,6 @@
#include <stdarg.h>
#include "belle_sip_messageParser.h"
#include "belle_sip_messageLexer.h"
#include "belle_sip_internal.h"
#include "listeningpoint_internal.h"
......
......@@ -117,9 +117,7 @@ void belle_sip_logv(int level, const char *fmt, va_list args)
{
if (belle_sip_logv_out!=NULL && belle_sip_log_level_enabled(level))
belle_sip_logv_out(level,fmt,args);
#if !defined(_WIN32_WCE)
if ((level)==BELLE_SIP_FATAL) abort();
#endif
if ((level)==BELLE_SIP_LOG_FATAL) abort();
}
#endif
......@@ -470,6 +468,7 @@ char * belle_sip_strdup(const char *s){
return strdup(s);
}
#ifndef WIN32
uint64_t belle_sip_time_ms(void){
struct timespec ts;
static int clock_id=CLOCK_MONOTONIC;
......@@ -482,9 +481,13 @@ uint64_t belle_sip_time_ms(void){
return 0;
}
return (ts.tv_sec*1000LL) + (ts.tv_nsec/1000000LL);
}
#else
uint64_t belle_sip_time_ms(void){
return GetTickCount();
/* note use GetTickCount64 on windows phone 8*/
}
#endif
/**
* parser parameter pair
......@@ -526,8 +529,16 @@ unsigned int belle_sip_random(void){
belle_sip_error("Reading /dev/urandom failed.");
}else return tmp;
}else belle_sip_error("Could not open /dev/urandom");
#endif
#elif defined(WIN32)
static int initd=0;
if (!initd) {
srand(belle_sip_time_ms());
initd=1;
}
return rand()<<16 | rand();
#else
return (unsigned int) random();
#endif
}
static const char *symbols="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789-~";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment