configure.ac: Changes to remove POSIXisms (mmap in this case) and to build DLLs on Windows.

Original commit message from CVS:
* configure.ac: Changes to remove POSIXisms (mmap in this case)
and to build DLLs on Windows.
* gst/Makefile.am:
* gst/elements/gstfilesrc.c: (gst_filesrc_get),
(gst_filesrc_open_file):
* gst/schedulers/Makefile.am:
This commit is contained in:
David Schleef 2004-04-13 22:18:36 +00:00
parent b3a5ebd27c
commit f8c81337c5
6 changed files with 106 additions and 17 deletions

View file

@ -1,3 +1,12 @@
2004-04-13 David Schleef <ds@schleef.org>
* configure.ac: Changes to remove POSIXisms (mmap in this case)
and to build DLLs on Windows.
* gst/Makefile.am:
* gst/elements/gstfilesrc.c: (gst_filesrc_get),
(gst_filesrc_open_file):
* gst/schedulers/Makefile.am:
2004-04-13 David Schleef <ds@schleef.org> 2004-04-13 David Schleef <ds@schleef.org>
* gst/gstcaps.c: (gst_caps_structure_fixate_field_nearest_int), * gst/gstcaps.c: (gst_caps_structure_fixate_field_nearest_int),

View file

@ -183,6 +183,16 @@ AC_MSG_RESULT(no)
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
]) ])
dnl check for mmap
AC_FUNC_MMAP()
if test "$ac_cv_func_mmap_fixed_mapped" = "yes" ; then
GST_DISABLE_OMEGA_COTHREADS=no
else
GST_DISABLE_OMEGA_COTHREADS=yes
fi
dnl for future --disabling, maybe. Right now, it depends on HAVE_MMAP
AM_CONDITIONAL(GST_DISABLE_OMEGA_COTHREADS, test "x$GST_DISABLE_OMEGA_COTHREADS" = "xyes")
dnl check for makecontext and define HAVE_MAKECONTEXT if we have it dnl check for makecontext and define HAVE_MAKECONTEXT if we have it
AC_CHECK_MCSC() AC_CHECK_MCSC()
if test "$ac_cv_check_mcsc" = "yes"; then if test "$ac_cv_check_mcsc" = "yes"; then
@ -217,6 +227,11 @@ if test x$enable_gcov = xyes ; then
fi fi
AM_CONDITIONAL(GST_GCOV_ENABLED, test x$enable_gcov = xyes) AM_CONDITIONAL(GST_GCOV_ENABLED, test x$enable_gcov = xyes)
dnl Check for some compiler flags that optimize our code.
dnl Only enable this for CVS builds for now
if test "x$GST_CVS" = "xyes"; then
AS_COMPILER_FLAG(-fno-common,GST_INT_CFLAGS="$GST_INT_CFLAGS -fno-common",)
fi
dnl Check for essential libraries first: dnl Check for essential libraries first:
dnl ==================================== dnl ====================================
@ -550,7 +565,7 @@ GST_INT_CFLAGS="$GST_INT_CFLAGS -I\$(top_srcdir)/libs -I\$(top_srcdir)/include"
AC_SUBST(GST_CFLAGS, "$LIBGST_CFLAGS $GST_INT_CFLAGS") AC_SUBST(GST_CFLAGS, "$LIBGST_CFLAGS $GST_INT_CFLAGS")
AC_SUBST(GST_LIBS, "$LIBGST_LIBS $GST_INT_LIBS") AC_SUBST(GST_LIBS, "$LIBGST_LIBS $GST_INT_LIBS")
GST_PLUGIN_LDFLAGS="-module -avoid-version" GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*"
AC_SUBST(GST_PLUGIN_LDFLAGS, "$GST_PLUGIN_LDFLAGS") AC_SUBST(GST_PLUGIN_LDFLAGS, "$GST_PLUGIN_LDFLAGS")

View file

@ -1,5 +1,10 @@
lib_LTLIBRARIES = libgstreamer-@GST_MAJORMINOR@.la lib_LTLIBRARIES = libgstreamer-@GST_MAJORMINOR@.la
AS_LIBTOOL_LIB = libgstreamer-@GST_MAJORMINOR@
if GST_DISABLE_OMEGA_COTHREADS
noinst_LTLIBRARIES =
else
noinst_LTLIBRARIES = libcothreads.la noinst_LTLIBRARIES = libcothreads.la
endif
if HAVE_CPU_I386 if HAVE_CPU_I386
GSTARCH_SRCS = gstcpuid_i386.s GSTARCH_SRCS = gstcpuid_i386.s
@ -135,7 +140,7 @@ BUILT_SOURCES = \
$(built_header_make) \ $(built_header_make) \
$(built_source_make) $(built_source_make)
# CLEANFILES is for files generated by make # CLEANFILES is for files generated by make
CLEANFILES = $(built_header_make) $(built_source_make) CLEANFILES = $(built_header_make) $(built_source_make) $(as_dll_cleanfiles)
# DISTCLEANFILES is for files generated by configure # DISTCLEANFILES is for files generated by configure
DISTCLEANFILES = $(built_header_configure) DISTCLEANFILES = $(built_header_configure)
@ -148,8 +153,9 @@ libgstreamer_@GST_MAJORMINOR@_la_CFLAGS = \
libgstreamer_@GST_MAJORMINOR@_la_LIBADD = \ libgstreamer_@GST_MAJORMINOR@_la_LIBADD = \
$(LIBGST_LIBS) $(GST_PARSE_LIBADD) $(GST_REGISTRY_LIBADD) $(VALGRIND_LIBS) $(LIBGST_LIBS) $(GST_PARSE_LIBADD) $(GST_REGISTRY_LIBADD) $(VALGRIND_LIBS)
libgstreamer_@GST_MAJORMINOR@_la_LDFLAGS = \ libgstreamer_@GST_MAJORMINOR@_la_LDFLAGS = \
@GST_LT_LDFLAGS@ -version-info @GST_LIBVERSION@ @GST_LT_LDFLAGS@ -version-info @GST_LIBVERSION@ \
-export-symbols-regex [_]*\(gst_\|Gst\|GST_\).* \
$(as_libtool_LDFLAGS)
libgstreamer_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst libgstreamer_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst
@ -215,9 +221,13 @@ noinst_HEADERS = \
gstarch.h \ gstarch.h \
cothreads.h cothreads.h
# the compiler shoots cothreads.c in the head at -O6 if GST_DISABLE_OMEGA_COTHREADS
#libcothreads_la_SOURCES =
#libcothreads_la_CFLAGS =
else
libcothreads_la_SOURCES = cothreads.c libcothreads_la_SOURCES = cothreads.c
libcothreads_la_CFLAGS = $(libgstreamer_@GST_MAJORMINOR@_la_CFLAGS) libcothreads_la_CFLAGS = $(libgstreamer_@GST_MAJORMINOR@_la_CFLAGS)
endif
gstmarshal.h: gstmarshal.list gstmarshal.h: gstmarshal.list
@ -248,4 +258,13 @@ gstenumtypes.c: $(gst_headers)
--vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \ --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
$^ > gstenumtypes.c $^ > gstenumtypes.c
EXTRA_DIST = ROADMAP noinst_DATA = $(as_libtool_noinst_DATA_files)
EXTRA_DIST = ROADMAP $(as_libtool_EXTRA_DIST)
install-data-local: as-libtool-install-data-local
uninstall-local: as-libtool-uninstall-local
include $(top_srcdir)/common/as-libtool.mak

View file

@ -31,7 +31,9 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_MMAP
#include <sys/mman.h> #include <sys/mman.h>
#endif
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
@ -357,6 +359,7 @@ gst_filesrc_get_property (GObject * object, guint prop_id, GValue * value,
} }
} }
#ifdef HAVE_MMAP
static void static void
gst_filesrc_free_parent_mmap (GstBuffer * buf) gst_filesrc_free_parent_mmap (GstBuffer * buf)
{ {
@ -377,7 +380,9 @@ gst_filesrc_free_parent_mmap (GstBuffer * buf)
GST_BUFFER_DATA (buf) = NULL; GST_BUFFER_DATA (buf) = NULL;
} }
#endif
#ifdef HAVE_MMAP
static GstBuffer * static GstBuffer *
gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size) gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size)
{ {
@ -425,7 +430,9 @@ gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size)
return buf; return buf;
} }
#endif
#ifdef HAVE_MMAP
static GstBuffer * static GstBuffer *
gst_filesrc_map_small_region (GstFileSrc * src, off_t offset, size_t size) gst_filesrc_map_small_region (GstFileSrc * src, off_t offset, size_t size)
{ {
@ -457,7 +464,9 @@ gst_filesrc_map_small_region (GstFileSrc * src, off_t offset, size_t size)
return gst_filesrc_map_region (src, offset, size); return gst_filesrc_map_region (src, offset, size);
} }
#endif
#ifdef HAVE_MMAP
/** /**
* gst_filesrc_get_mmap: * gst_filesrc_get_mmap:
* @pad: #GstPad to push a buffer from * @pad: #GstPad to push a buffer from
@ -593,6 +602,7 @@ gst_filesrc_get_mmap (GstFileSrc * src)
src->curoffset += GST_BUFFER_SIZE (buf); src->curoffset += GST_BUFFER_SIZE (buf);
return buf; return buf;
} }
#endif
static GstBuffer * static GstBuffer *
gst_filesrc_get_read (GstFileSrc * src) gst_filesrc_get_read (GstFileSrc * src)
@ -669,12 +679,15 @@ gst_filesrc_get (GstPad * pad)
return GST_DATA (gst_event_new (GST_EVENT_EOS)); return GST_DATA (gst_event_new (GST_EVENT_EOS));
} }
} }
#ifdef HAVE_MMAP
if (src->using_mmap) { if (src->using_mmap) {
return GST_DATA (gst_filesrc_get_mmap (src)); return GST_DATA (gst_filesrc_get_mmap (src));
} else { } else {
return GST_DATA (gst_filesrc_get_read (src)); return GST_DATA (gst_filesrc_get_read (src));
} }
#else
return GST_DATA (gst_filesrc_get_read (src));
#endif
} }
/* TRUE if the filesize of the file was updated */ /* TRUE if the filesize of the file was updated */
@ -736,13 +749,15 @@ gst_filesrc_open_file (GstFileSrc * src)
/* find the file length */ /* find the file length */
src->filelen = stat_results.st_size; src->filelen = stat_results.st_size;
src->using_mmap = FALSE;
#ifdef HAVE_MMAP
/* allocate the first mmap'd region */ /* allocate the first mmap'd region */
src->mapbuf = gst_filesrc_map_region (src, 0, src->mapsize); src->mapbuf = gst_filesrc_map_region (src, 0, src->mapsize);
if (src->mapbuf == NULL) { if (src->mapbuf != NULL) {
src->using_mmap = FALSE;
} else {
src->using_mmap = TRUE; src->using_mmap = TRUE;
} }
#endif
src->curoffset = 0; src->curoffset = 0;

View file

@ -1,18 +1,28 @@
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
plugin_LTLIBRARIES = \ if GST_DISABLE_OMEGA_COTHREADS
omegaschedulers =
else
omegaschedulers = \
libgstbasicomegascheduler.la \ libgstbasicomegascheduler.la \
libgstentryomegascheduler.la \
libgstoptomegascheduler.la
endif
plugin_LTLIBRARIES = \
$(omegaschedulers) \
libgstbasicgthreadscheduler.la \ libgstbasicgthreadscheduler.la \
libgstentrygthreadscheduler.la \ libgstentrygthreadscheduler.la \
libgstentryomegascheduler.la \
libgstoptscheduler.la \ libgstoptscheduler.la \
libgstoptomegascheduler.la \
libgstoptgthreadscheduler.la libgstoptgthreadscheduler.la
if GST_DISABLE_OMEGA_COTHREADS
else
libgstbasicomegascheduler_la_SOURCES = gstbasicscheduler.c libgstbasicomegascheduler_la_SOURCES = gstbasicscheduler.c
libgstbasicomegascheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_OMEGA libgstbasicomegascheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_OMEGA
libgstbasicomegascheduler_la_LIBADD = ../libcothreads.la libgstbasicomegascheduler_la_LIBADD = ../libcothreads.la
libgstbasicomegascheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstbasicomegascheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
endif
libgstbasicgthreadscheduler_la_SOURCES = gstbasicscheduler.c libgstbasicgthreadscheduler_la_SOURCES = gstbasicscheduler.c
libgstbasicgthreadscheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_GTHREAD libgstbasicgthreadscheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_GTHREAD
@ -22,19 +32,25 @@ libgstentrygthreadscheduler_la_SOURCES = entryscheduler.c
libgstentrygthreadscheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_GTHREAD libgstentrygthreadscheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_GTHREAD
libgstentrygthreadscheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstentrygthreadscheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
if GST_DISABLE_OMEGA_COTHREADS
else
libgstentryomegascheduler_la_SOURCES = entryscheduler.c libgstentryomegascheduler_la_SOURCES = entryscheduler.c
libgstentryomegascheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_OMEGA libgstentryomegascheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_OMEGA
libgstentryomegascheduler_la_LIBADD = ../libcothreads.la libgstentryomegascheduler_la_LIBADD = ../libcothreads.la
libgstentryomegascheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstentryomegascheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
endif
libgstoptscheduler_la_SOURCES = gstoptimalscheduler.c libgstoptscheduler_la_SOURCES = gstoptimalscheduler.c
libgstoptscheduler_la_CFLAGS = $(GST_CFLAGS) libgstoptscheduler_la_CFLAGS = $(GST_CFLAGS)
libgstoptscheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstoptscheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
if GST_DISABLE_OMEGA_COTHREADS
else
libgstoptomegascheduler_la_SOURCES = gstoptimalscheduler.c libgstoptomegascheduler_la_SOURCES = gstoptimalscheduler.c
libgstoptomegascheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_OMEGA -DUSE_COTHREADS libgstoptomegascheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_OMEGA -DUSE_COTHREADS
libgstoptomegascheduler_la_LIBADD = ../libcothreads.la libgstoptomegascheduler_la_LIBADD = ../libcothreads.la
libgstoptomegascheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstoptomegascheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
endif
libgstoptgthreadscheduler_la_SOURCES = gstoptimalscheduler.c libgstoptgthreadscheduler_la_SOURCES = gstoptimalscheduler.c
libgstoptgthreadscheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_GTHREAD -DUSE_COTHREADS libgstoptgthreadscheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_GTHREAD -DUSE_COTHREADS

View file

@ -31,7 +31,9 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_MMAP
#include <sys/mman.h> #include <sys/mman.h>
#endif
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
@ -357,6 +359,7 @@ gst_filesrc_get_property (GObject * object, guint prop_id, GValue * value,
} }
} }
#ifdef HAVE_MMAP
static void static void
gst_filesrc_free_parent_mmap (GstBuffer * buf) gst_filesrc_free_parent_mmap (GstBuffer * buf)
{ {
@ -377,7 +380,9 @@ gst_filesrc_free_parent_mmap (GstBuffer * buf)
GST_BUFFER_DATA (buf) = NULL; GST_BUFFER_DATA (buf) = NULL;
} }
#endif
#ifdef HAVE_MMAP
static GstBuffer * static GstBuffer *
gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size) gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size)
{ {
@ -425,7 +430,9 @@ gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size)
return buf; return buf;
} }
#endif
#ifdef HAVE_MMAP
static GstBuffer * static GstBuffer *
gst_filesrc_map_small_region (GstFileSrc * src, off_t offset, size_t size) gst_filesrc_map_small_region (GstFileSrc * src, off_t offset, size_t size)
{ {
@ -457,7 +464,9 @@ gst_filesrc_map_small_region (GstFileSrc * src, off_t offset, size_t size)
return gst_filesrc_map_region (src, offset, size); return gst_filesrc_map_region (src, offset, size);
} }
#endif
#ifdef HAVE_MMAP
/** /**
* gst_filesrc_get_mmap: * gst_filesrc_get_mmap:
* @pad: #GstPad to push a buffer from * @pad: #GstPad to push a buffer from
@ -593,6 +602,7 @@ gst_filesrc_get_mmap (GstFileSrc * src)
src->curoffset += GST_BUFFER_SIZE (buf); src->curoffset += GST_BUFFER_SIZE (buf);
return buf; return buf;
} }
#endif
static GstBuffer * static GstBuffer *
gst_filesrc_get_read (GstFileSrc * src) gst_filesrc_get_read (GstFileSrc * src)
@ -669,12 +679,15 @@ gst_filesrc_get (GstPad * pad)
return GST_DATA (gst_event_new (GST_EVENT_EOS)); return GST_DATA (gst_event_new (GST_EVENT_EOS));
} }
} }
#ifdef HAVE_MMAP
if (src->using_mmap) { if (src->using_mmap) {
return GST_DATA (gst_filesrc_get_mmap (src)); return GST_DATA (gst_filesrc_get_mmap (src));
} else { } else {
return GST_DATA (gst_filesrc_get_read (src)); return GST_DATA (gst_filesrc_get_read (src));
} }
#else
return GST_DATA (gst_filesrc_get_read (src));
#endif
} }
/* TRUE if the filesize of the file was updated */ /* TRUE if the filesize of the file was updated */
@ -736,13 +749,15 @@ gst_filesrc_open_file (GstFileSrc * src)
/* find the file length */ /* find the file length */
src->filelen = stat_results.st_size; src->filelen = stat_results.st_size;
src->using_mmap = FALSE;
#ifdef HAVE_MMAP
/* allocate the first mmap'd region */ /* allocate the first mmap'd region */
src->mapbuf = gst_filesrc_map_region (src, 0, src->mapsize); src->mapbuf = gst_filesrc_map_region (src, 0, src->mapsize);
if (src->mapbuf == NULL) { if (src->mapbuf != NULL) {
src->using_mmap = FALSE;
} else {
src->using_mmap = TRUE; src->using_mmap = TRUE;
} }
#endif
src->curoffset = 0; src->curoffset = 0;