diff --git a/configure.ac b/configure.ac index f3147b26c9..b77e2aae9c 100644 --- a/configure.ac +++ b/configure.ac @@ -682,15 +682,24 @@ AG_GST_CHECK_FEATURE(QUICKTIME, [QuickTime wrapper], qtwrapper, [ dnl check for shm_open (for shm plugin) translit(dnm, m, l) AM_CONDITIONAL(USE_SHM, true) AG_GST_CHECK_FEATURE(SHM, [POSIX shared memory source and sink], shm, [ - if test "x$HAVE_SYS_SOCKET_H" = "xyes"; then - AC_CHECK_LIB([rt], [shm_open], - AC_CHECK_DECL([MSG_NOSIGNAL], HAVE_SHM=yes, HAVE_SHM=no, [ -#include - ]), - HAVE_SHM=no) - else - HAVE_SHM=no - fi + if test "x$HAVE_SYS_SOCKET_H" = "xyes"; then + case $host in + *-darwin* | *-macos10*) + AM_CONDITIONAL([HAVE_OSX], true) + AC_DEFINE(HAVE_OSX,[1],[Apple Mac OS X operating system detected]) + HAVE_SHM=yes + ;; + *) + AC_CHECK_LIB([rt], [shm_open], + AC_CHECK_DECL([MSG_NOSIGNAL], HAVE_SHM=yes, HAVE_SHM=no, [ + #include + ]), + HAVE_SHM=no) + ;; + esac + else + HAVE_SHM=no + fi ]) dnl check for Video CD diff --git a/sys/shm/Makefile.am b/sys/shm/Makefile.am index ec11cfffd0..dc89d8e6d3 100644 --- a/sys/shm/Makefile.am +++ b/sys/shm/Makefile.am @@ -2,8 +2,14 @@ plugin_LTLIBRARIES = libgstshm.la libgstshm_la_SOURCES = shmpipe.c shmalloc.c gstshm.c gstshmsrc.c gstshmsink.c libgstshm_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_CFLAGS) -DSHM_PIPE_USE_GLIB -libgstshm_la_LIBADD = -lrt libgstshm_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GST_BASE_LIBS) + +if HAVE_OSX +libgstshm_la_LIBADD = +else +libgstshm_la_LIBADD = -lrt +endif + libgstshm_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstshmsrc.h gstshmsink.h shmpipe.h shmalloc.h diff --git a/sys/shm/shmpipe.c b/sys/shm/shmpipe.c index c692417e1d..4da027b721 100644 --- a/sys/shm/shmpipe.c +++ b/sys/shm/shmpipe.c @@ -27,6 +27,12 @@ #include "config.h" #endif +#ifdef HAVE_OSX +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL SO_NOSIGPIPE +#endif +#endif + #include "shmpipe.h" #include @@ -278,7 +284,11 @@ sp_open_shm (char *path, int id, mode_t perms, size_t size) if (path) flags = O_RDONLY; else +#ifdef HAVE_OSX + flags = O_RDWR | O_CREAT | O_EXCL; +#else flags = O_RDWR | O_CREAT | O_TRUNC | O_EXCL; +#endif area->shm_fd = -1;