Index: pjproject/trunk/aconfigure.ac
===================================================================
--- pjproject/trunk/aconfigure.ac	(revision 3464)
+++ pjproject/trunk/aconfigure.ac	(revision 3664)
@@ -409,4 +409,7 @@
 	ac_os_objs="$ac_os_objs file_access_win32.o file_io_win32.o os_core_win32.o os_error_win32.o os_time_win32.o os_timestamp_win32.o guid_win32.o"
 	;;
+  *darwin*)
+	ac_os_objs="$ac_os_objs os_core_darwin.o"
+	;;
   *)
 	ac_os_objs="$ac_os_objs file_access_unistd.o file_io_ansi.o os_core_unix.o os_error_unix.o os_time_unix.o os_timestamp_posix.o"
@@ -578,6 +581,5 @@
 	AC_ARG_ENABLE(oss,
 		      AC_HELP_STRING([--disable-oss],
-				     [Disable OSS audio (default: not disabled)])
-		      ,
+				     [Disable OSS audio (default: not disabled)]),
 		      [
 			if test "$enable_oss" = "no"; then
@@ -586,4 +588,35 @@
 			fi
 		      ])
+	;;
+ esac
+fi
+
+AC_SUBST(ac_pjmedia_video)
+if test "$enable_video" = "no"; then
+  true;
+else
+ case $target in
+  arm-apple-darwin*)
+	ac_pjmedia_video=iphone_os
+	AC_SUBST(ac_ios_cflags)
+	ac_ios_cflags="-DPJMEDIA_VIDEO_DEV_HAS_IOS=1"
+	LIBS="$LIBS -framework AVFoundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
+	AC_MSG_RESULT([Checking video device backend... AVFoundation])
+	;;
+  *darwin*)
+	ac_pjmedia_video=mac_os
+	AC_SUBST(ac_pjmedia_video_has_qt)
+	AC_SUBST(ac_qt_cflags)
+	SAVED_LIBS="$LIBS"
+	LIBS="-framework QTKit"
+	AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_qt=yes],[ac_pjmedia_video_has_qt=no])
+	LIBS="$SAVED_LIBS"
+	if test "$ac_pjmedia_video_has_qt" = "yes"; then
+	  ac_qt_cflags="-DPJMEDIA_VIDEO_DEV_HAS_QT=1"
+	  LIBS="$LIBS -framework QTKit -framework Foundation -framework AppKit -framework QuartzCore -framework OpenGL"
+	  AC_MSG_RESULT([Checking if QTKit framework is available... yes])
+	else
+	  AC_MSG_RESULT([Checking if QTKit framework is available... no])
+	fi
 	;;
  esac
@@ -726,4 +759,117 @@
 	     )
 
+dnl # SDL
+AC_ARG_ENABLE(sdl,
+	      AC_HELP_STRING([--disable-sdl],
+			     [Disable SDL (default: not disabled)]),
+	      [
+		if test "$enable_sdl" = "no"; then
+		  AC_MSG_RESULT([Checking if SDL is disabled... yes])
+		fi
+	      ],
+	      [
+		  AC_MSG_CHECKING([SDL availability..])
+		  if sdl-config --version; then
+				  AC_SUBST(ac_sdl_cflags)
+			  AC_SUBST(ac_sdl_ldflags)
+			  ac_sdl_cflags=`sdl-config --cflags`
+			  ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
+			  ac_sdl_ldflags=`sdl-config --libs`
+			  LIBS="$LIBS $ac_sdl_ldflags"
+		   fi
+	      ])
+
+
+dnl # FFMPEG stuffs
+AC_ARG_ENABLE(ffmpeg,
+	      AC_HELP_STRING([--disable-ffmpeg],
+			     [Disable ffmpeg (default: not disabled)]),
+	      [
+	        AC_SUBST(ac_has_ffmpeg,0)
+		if test "$enable_ffmpeg" = "no"; then
+			AC_MSG_RESULT([Checking if ffmpeg is disabled... yes])
+		fi
+	      ],
+	      [
+		AC_SUBST(ac_ffmpeg_cflags)
+		AC_SUBST(ac_ffmpeg_ldflags)
+
+		FFMPEG_PREFIX=""
+    		if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
+			FFMPEG_PREFIX=$with_ffmpeg
+			AC_MSG_RESULT([Using ffmpeg prefix... $FFMPEG_PREFIX])
+			LIBS="-L$FFMPEG_PREFIX/lib $LIBS"
+			LDFLAGS="-L$FFMPEG_PREFIX/lib $LDFLAGS"
+			CFLAGS="-I$FFMPEG_PREFIX/include $CFLAGS"
+		fi
+
+		AC_CHECK_LIB(avdevice,
+			     avdevice_version,
+			     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
+			      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavdevice"
+			     ]
+			     )
+		AC_CHECK_LIB(avformat,
+			     av_register_all,
+			     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
+			      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavformat"
+			     ]
+			     )
+		AC_CHECK_LIB(avcodec,
+			     avcodec_init,
+			     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
+			      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcodec"
+			     ]
+			     )
+		AC_CHECK_LIB(swscale,
+			     sws_scale,
+			     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
+			      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lswscale"
+			     ]
+			     )
+		AC_CHECK_LIB(avutil,
+			     av_malloc,
+			     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
+			      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavutil"
+			     ]
+			     )
+		AC_CHECK_LIB(avcore,
+			     avcore_version,
+			     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCORE=1"
+			      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcore"
+			     ]
+			     )
+		LIBS="$LIBS $ac_ffmpeg_ldflags"
+	      ]
+	      )
+
+AC_ARG_WITH(ffmpeg,
+    AC_HELP_STRING([--with-ffmpeg=DIR],
+		   [Specify alternate FFMPEG prefix]),
+    [],
+    [with_ffmpeg=no]
+    )
+
+
+dnl # Video for Linux 2
+AC_ARG_ENABLE(v4l2,
+	      AC_HELP_STRING([--disable-v4l2],
+			     [Disable Video4Linux2 (default: not disabled)]),
+	      [
+		if test "$enable_v4l2" = "no"; then
+		  AC_MSG_RESULT([Checking if V4L2 is disabled... yes])
+		fi
+	      ],
+	      [
+	        AC_SUBST(ac_v4l2_cflags)
+	        AC_SUBST(ac_v4l2_ldflags)
+		AC_CHECK_LIB(v4l2,
+			     v4l2_open,
+			     [ac_v4l2_cflags="-DPJMEDIA_VIDEO_DEV_HAS_V4L2=1"
+			      ac_v4l2_ldflags="-lv4l2"
+			      LIBS="$LIBS -lv4l2"
+			     ]
+			     )
+	      ])
 
 dnl ########################################################
