diff --git a/linphone/mediastreamer2/autogen.sh b/linphone/mediastreamer2/autogen.sh
index 4268f67363ea9706d322b790f3dd15e42a30c3a8..50299b9364a307c23303a96454de2f5d77ed4688 100755
--- a/linphone/mediastreamer2/autogen.sh
+++ b/linphone/mediastreamer2/autogen.sh
@@ -23,7 +23,8 @@ fi
 echo "Generating build scripts in mediastreamer..."
 set -x
 $LIBTOOLIZE --copy --force
-autoheader
 $ACLOCAL  $ACLOCAL_ARGS
+autoheader
 $AUTOMAKE --force-missing --add-missing --copy
 autoconf
+
diff --git a/linphone/mediastreamer2/configure.ac b/linphone/mediastreamer2/configure.ac
index 264269c1b477cc84882aa384b883d796a4475b18..42174faed321f71dd2bb20a4b003c18a24fc1494 100644
--- a/linphone/mediastreamer2/configure.ac
+++ b/linphone/mediastreamer2/configure.ac
@@ -83,6 +83,7 @@ AC_ARG_ENABLE(debug,
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_CXX
+AC_PROG_OBJC
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
 AC_ENABLE_SHARED(yes)
@@ -342,7 +343,7 @@ AC_ARG_ENABLE(macaqsnd,
         yes) macaqsnd=true ;;
         no)  macaqsnd=false ;;
         *) AC_MSG_ERROR(bad value ${enableval} for --enable-macaqsnd) ;;
-      esac],[macaqsnd=yes])
+      esac],[macaqsnd=true])
 
 if test "$macosx_found" != "yes" ; then
 	macaqsnd=false
diff --git a/linphone/mediastreamer2/src/Makefile.am b/linphone/mediastreamer2/src/Makefile.am
index 8c1d0070a5824d8826ce59174e737ee625a87615..c85f158464cde725c1ce4a0fe48543e7ddd9f306 100644
--- a/linphone/mediastreamer2/src/Makefile.am
+++ b/linphone/mediastreamer2/src/Makefile.am
@@ -92,7 +92,7 @@ endif
 if BUILD_VIDEO
 
 if BUILD_MACOSX
-libmediastreamer_la_SOURCES+=msv4m.c
+libmediastreamer_la_SOURCES+=msv4m.m
 endif
 
 if BUILD_V4L
@@ -178,6 +178,8 @@ if BUILD_VIDEO
 AM_CFLAGS+=$(VIDEO_CFLAGS)
 endif
 
+AM_OBJCFLAGS=$(AM_CFLAGS)
+
 imgdir=$(datadir)/images/
 
 img_DATA=nowebcamCIF.jpg
diff --git a/linphone/mediastreamer2/src/aqsnd.c b/linphone/mediastreamer2/src/aqsnd.c
index 559a6c5b49aa4f4fea5a9b2ce63e5bb75bd50691..e2325c4ea49f869f08ff19dfd147559872faa9ff 100644
--- a/linphone/mediastreamer2/src/aqsnd.c
+++ b/linphone/mediastreamer2/src/aqsnd.c
@@ -240,18 +240,15 @@ void setupRead(MSSndCard *card) {
 
 static void aq_set_level(MSSndCard *card, MSSndCardMixerElem e, int percent)
 {
-	AQData *d=(AQData*)card->data;
 }
 
 static int aq_get_level(MSSndCard *card, MSSndCardMixerElem e)
 {
-	AQData *d=(AQData*)card->data;
 	return 0;
 }
 
 static void aq_set_source(MSSndCard *card, MSSndCardCapture source)
 {
-	AQData *d=(AQData*)card->data;
 }
 
 static void aq_init(MSSndCard *card){
@@ -298,8 +295,6 @@ MSSndCardDesc aq_card_desc={
 
 static MSSndCard *aq_duplicate(MSSndCard *obj){
 	MSSndCard *card=ms_snd_card_new(&aq_card_desc);
-	AQData *dcard=(AQData*)card->data;
-	AQData *dobj=(AQData*)obj->data;
 	card->name=ms_strdup(obj->name);
 	return card;
 }
@@ -450,7 +445,6 @@ static void aq_stop_r(MSSndCard *card){
 static void aq_start_w(MSSndCard *card){
 	ms_debug("aq_start_w");
 	AQData *d=(AQData*)card->data;
-	int i;
 	if(d->write_started == FALSE) {
 		OSStatus aqresult;
 		d->writeBufferByteSize = kSecondsPerBuffer * d->rate * (d->bits / 8);		
@@ -582,7 +576,7 @@ static int set_rate(MSFilter *f, void *arg){
 	d->rate=*((int*)arg);
 	return 0;
 }
-
+/*
 static int set_nchannels(MSFilter *f, void *arg){
 	ms_debug("set_nchannels %d", *((int*)arg));
 	MSSndCard *card=(MSSndCard*)f->data;
@@ -590,7 +584,7 @@ static int set_nchannels(MSFilter *f, void *arg){
 	d->stereo=(*((int*)arg)==2);
 	return 0;
 }
-
+*/
 static MSFilterMethod aq_methods[]={
 	{	MS_FILTER_SET_SAMPLE_RATE	, set_rate	},
 /* not support yet
diff --git a/linphone/mediastreamer2/src/ice.c b/linphone/mediastreamer2/src/ice.c
index 1b76cdad6d0704249cb1d7f7ea4946ff0f4a2364..253ffa036423840b819766e2781b525e960c4728 100644
--- a/linphone/mediastreamer2/src/ice.c
+++ b/linphone/mediastreamer2/src/ice.c
@@ -256,7 +256,7 @@ static int ice_sound_send_stun_request(RtpSession *session, struct IceCheckList
 			}
 			else if (cand_pair!=NULL)
 			{
-				struct CandidatePair *cand_pair2;
+				struct CandidatePair *cand_pair2=NULL;
 				int pos2;
 				for (pos2=0;pos2<pos && remote_candidates[pos2].remote_candidate.conn_addr[0]!='\0';pos2++)
 				{
diff --git a/linphone/mediastreamer2/src/mscommon.c b/linphone/mediastreamer2/src/mscommon.c
index 52a3ddf920e0980813b8fcf9a79495573642fc7e..6ee697d81b84ce08d8e2eb38b96319b3b020dce8 100644
--- a/linphone/mediastreamer2/src/mscommon.c
+++ b/linphone/mediastreamer2/src/mscommon.c
@@ -513,9 +513,6 @@ static MSWebCamDesc * ms_web_cam_descs[]={
 void ms_init(){
 	int i;
 	MSSndCardManager *cm;
-#ifdef __APPLE__
-	NSApplicationLoad();
-#endif
 
 #if !defined(_WIN32_WCE)
 	if (getenv("MEDIASTREAMER_DEBUG")!=NULL){
diff --git a/linphone/mediastreamer2/src/msv4m.c b/linphone/mediastreamer2/src/msv4m.m
similarity index 98%
rename from linphone/mediastreamer2/src/msv4m.c
rename to linphone/mediastreamer2/src/msv4m.m
index 5299732d82db1710a64d4cf1745d8c3aa996f978..de52a465fdf38d8a5829aa4de14ce897b06cecfa 100644
--- a/linphone/mediastreamer2/src/msv4m.c
+++ b/linphone/mediastreamer2/src/msv4m.m
@@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "mediastreamer2/msvideo.h"
 #include "mediastreamer2/msticker.h"
 #include "mediastreamer2/msv4l.h"
-//#include "nowebcam.h"
+#include "nowebcam.h"
 #include "mediastreamer2/mswebcam.h"
 
 // build for carbon
@@ -41,11 +41,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #if __APPLE_CC__
   #include <Carbon/Carbon.h>
   #include <QuicKTime/QuickTime.h>
+  #include <AppKit/AppKit.h>
 #else
   #include <ConditionalMacros.h>
   #include <QuickTimeComponents.h>
   #include <TextUtils.h>
-
+  #include <AppKit/AppKit.h>
   #include <stdio.h>
 #endif
 
@@ -215,7 +216,7 @@ static int v4m_close(v4mState *s)
   s->seqgrab=NULL;
   if (s->decomseq)
     CDSequenceEnd(s->decomseq);
-  s->decomseq=NULL;
+  s->decomseq=0;
   if (s->pgworld!=NULL)
     DisposeGWorld(s->pgworld);
   s->pgworld=NULL;
@@ -227,7 +228,7 @@ unsigned char *stdToPascalString(char *buffer, char * str) {
 
 		memcpy(buffer + 1, str, strlen(str));
 
-		return buffer;
+		return (unsigned char*)buffer;
 	} else {
 		return NULL;
 	}
@@ -601,8 +602,8 @@ MSWebCamDesc ms_v4m_cam_desc={
 
 char * genDeviceName(unsigned char * device,short inputIndex, unsigned char * input) 
 {
-	char buffer[32];
-	sprintf(buffer, "%s:%d:%s", device,inputIndex,input);
+	static char buffer[32];
+	snprintf(buffer,sizeof(buffer), "%s:%d:%s", device,inputIndex,input);
         return buffer;
 }
 
@@ -613,7 +614,7 @@ static char* pas2cstr(const char *pstr)
 {
     char *cstr = ms_malloc(pstr[0] + 1);
     memcpy(cstr, pstr+1, pstr[0]);
-    cstr[pstr[0]] = 0;
+    cstr[(int)pstr[0]] = 0;
     
     return cstr;
     
@@ -627,6 +628,7 @@ static void ms_v4m_detect(MSWebCamManager *obj){
         SGChannel _SGChanVideo;
 
         SeqGrabComponent _seqGrab;
+	NSApplicationLoad();
         
         if (_SGChanVideo) {
 		SGDisposeChannel(_seqGrab, _SGChanVideo);
diff --git a/linphone/oRTP/autogen.sh b/linphone/oRTP/autogen.sh
index 203deb262268213523443e9a20bb2f1efc9a1024..83085a0284d251ff154548d2fdc054fa25cd0557 100755
--- a/linphone/oRTP/autogen.sh
+++ b/linphone/oRTP/autogen.sh
@@ -9,10 +9,22 @@ else
 	AUTOMAKE=automake-${AM_VERSION}
 fi
 
+if test -f /opt/local/bin/glibtoolize ; then
+        # darwin
+        LIBTOOLIZE=/opt/local/bin/glibtoolize
+else
+        LIBTOOLIZE=libtoolize
+fi
+if test -d /opt/local/share/aclocal ; then
+        ACLOCAL_ARGS="-I /opt/local/share/aclocal"
+fi
+
+
 set -x
 rm -rf config.cache autom4te.cache
-$ACLOCAL
+$LIBTOOLIZE --copy --force
+$ACLOCAL $ACLOCAL_ARGS
 autoheader
 $AUTOMAKE --add-missing --copy
-libtoolize --copy --force
 autoconf
+