From f8c81337c5173d5c2b1d1d3c54efbbec26ae59a3 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 13 Apr 2004 22:18:36 +0000 Subject: [PATCH] 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: --- ChangeLog | 9 +++++++++ configure.ac | 17 ++++++++++++++++- gst/Makefile.am | 29 ++++++++++++++++++++++++----- gst/elements/gstfilesrc.c | 23 +++++++++++++++++++---- gst/schedulers/Makefile.am | 22 +++++++++++++++++++--- plugins/elements/gstfilesrc.c | 23 +++++++++++++++++++---- 6 files changed, 106 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index adec29446a..d2e11011cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-04-13 David Schleef + + * 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 * gst/gstcaps.c: (gst_caps_structure_fixate_field_nearest_int), diff --git a/configure.ac b/configure.ac index b8242bb485..f25db12d03 100644 --- a/configure.ac +++ b/configure.ac @@ -183,6 +183,16 @@ 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 AC_CHECK_MCSC() if test "$ac_cv_check_mcsc" = "yes"; then @@ -217,6 +227,11 @@ if test x$enable_gcov = xyes ; then fi 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 ==================================== @@ -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_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") diff --git a/gst/Makefile.am b/gst/Makefile.am index 95b3734d57..cc889ebcbd 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -1,5 +1,10 @@ lib_LTLIBRARIES = libgstreamer-@GST_MAJORMINOR@.la +AS_LIBTOOL_LIB = libgstreamer-@GST_MAJORMINOR@ +if GST_DISABLE_OMEGA_COTHREADS +noinst_LTLIBRARIES = +else noinst_LTLIBRARIES = libcothreads.la +endif if HAVE_CPU_I386 GSTARCH_SRCS = gstcpuid_i386.s @@ -135,7 +140,7 @@ BUILT_SOURCES = \ $(built_header_make) \ $(built_source_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 = $(built_header_configure) @@ -148,8 +153,9 @@ libgstreamer_@GST_MAJORMINOR@_la_CFLAGS = \ libgstreamer_@GST_MAJORMINOR@_la_LIBADD = \ $(LIBGST_LIBS) $(GST_PARSE_LIBADD) $(GST_REGISTRY_LIBADD) $(VALGRIND_LIBS) 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 @@ -215,9 +221,13 @@ noinst_HEADERS = \ gstarch.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_CFLAGS = $(libgstreamer_@GST_MAJORMINOR@_la_CFLAGS) +endif 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" \ $^ > 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 + diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index 69eaf387f3..4ee66f135a 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -31,7 +31,9 @@ #include #include #include +#ifdef HAVE_MMAP #include +#endif #include #include @@ -357,6 +359,7 @@ gst_filesrc_get_property (GObject * object, guint prop_id, GValue * value, } } +#ifdef HAVE_MMAP static void gst_filesrc_free_parent_mmap (GstBuffer * buf) { @@ -377,7 +380,9 @@ gst_filesrc_free_parent_mmap (GstBuffer * buf) GST_BUFFER_DATA (buf) = NULL; } +#endif +#ifdef HAVE_MMAP static GstBuffer * 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; } +#endif +#ifdef HAVE_MMAP static GstBuffer * 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); } +#endif +#ifdef HAVE_MMAP /** * gst_filesrc_get_mmap: * @pad: #GstPad to push a buffer from @@ -593,6 +602,7 @@ gst_filesrc_get_mmap (GstFileSrc * src) src->curoffset += GST_BUFFER_SIZE (buf); return buf; } +#endif static GstBuffer * gst_filesrc_get_read (GstFileSrc * src) @@ -669,12 +679,15 @@ gst_filesrc_get (GstPad * pad) return GST_DATA (gst_event_new (GST_EVENT_EOS)); } } - +#ifdef HAVE_MMAP if (src->using_mmap) { return GST_DATA (gst_filesrc_get_mmap (src)); } else { 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 */ @@ -736,13 +749,15 @@ gst_filesrc_open_file (GstFileSrc * src) /* find the file length */ src->filelen = stat_results.st_size; + src->using_mmap = FALSE; +#ifdef HAVE_MMAP /* allocate the first mmap'd region */ src->mapbuf = gst_filesrc_map_region (src, 0, src->mapsize); - if (src->mapbuf == NULL) { - src->using_mmap = FALSE; - } else { + if (src->mapbuf != NULL) { src->using_mmap = TRUE; } +#endif + src->curoffset = 0; diff --git a/gst/schedulers/Makefile.am b/gst/schedulers/Makefile.am index c4ba7a9aa3..001f1516fa 100644 --- a/gst/schedulers/Makefile.am +++ b/gst/schedulers/Makefile.am @@ -1,18 +1,28 @@ plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ -plugin_LTLIBRARIES = \ +if GST_DISABLE_OMEGA_COTHREADS +omegaschedulers = +else +omegaschedulers = \ libgstbasicomegascheduler.la \ + libgstentryomegascheduler.la \ + libgstoptomegascheduler.la +endif + +plugin_LTLIBRARIES = \ + $(omegaschedulers) \ libgstbasicgthreadscheduler.la \ libgstentrygthreadscheduler.la \ - libgstentryomegascheduler.la \ libgstoptscheduler.la \ - libgstoptomegascheduler.la \ libgstoptgthreadscheduler.la +if GST_DISABLE_OMEGA_COTHREADS +else libgstbasicomegascheduler_la_SOURCES = gstbasicscheduler.c libgstbasicomegascheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_OMEGA libgstbasicomegascheduler_la_LIBADD = ../libcothreads.la libgstbasicomegascheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +endif libgstbasicgthreadscheduler_la_SOURCES = gstbasicscheduler.c 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_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +if GST_DISABLE_OMEGA_COTHREADS +else libgstentryomegascheduler_la_SOURCES = entryscheduler.c libgstentryomegascheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_OMEGA libgstentryomegascheduler_la_LIBADD = ../libcothreads.la libgstentryomegascheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +endif libgstoptscheduler_la_SOURCES = gstoptimalscheduler.c libgstoptscheduler_la_CFLAGS = $(GST_CFLAGS) libgstoptscheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +if GST_DISABLE_OMEGA_COTHREADS +else libgstoptomegascheduler_la_SOURCES = gstoptimalscheduler.c libgstoptomegascheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_OMEGA -DUSE_COTHREADS libgstoptomegascheduler_la_LIBADD = ../libcothreads.la libgstoptomegascheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +endif libgstoptgthreadscheduler_la_SOURCES = gstoptimalscheduler.c libgstoptgthreadscheduler_la_CFLAGS = $(GST_CFLAGS) -D_COTHREADS_GTHREAD -DUSE_COTHREADS diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 69eaf387f3..4ee66f135a 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -31,7 +31,9 @@ #include #include #include +#ifdef HAVE_MMAP #include +#endif #include #include @@ -357,6 +359,7 @@ gst_filesrc_get_property (GObject * object, guint prop_id, GValue * value, } } +#ifdef HAVE_MMAP static void gst_filesrc_free_parent_mmap (GstBuffer * buf) { @@ -377,7 +380,9 @@ gst_filesrc_free_parent_mmap (GstBuffer * buf) GST_BUFFER_DATA (buf) = NULL; } +#endif +#ifdef HAVE_MMAP static GstBuffer * 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; } +#endif +#ifdef HAVE_MMAP static GstBuffer * 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); } +#endif +#ifdef HAVE_MMAP /** * gst_filesrc_get_mmap: * @pad: #GstPad to push a buffer from @@ -593,6 +602,7 @@ gst_filesrc_get_mmap (GstFileSrc * src) src->curoffset += GST_BUFFER_SIZE (buf); return buf; } +#endif static GstBuffer * gst_filesrc_get_read (GstFileSrc * src) @@ -669,12 +679,15 @@ gst_filesrc_get (GstPad * pad) return GST_DATA (gst_event_new (GST_EVENT_EOS)); } } - +#ifdef HAVE_MMAP if (src->using_mmap) { return GST_DATA (gst_filesrc_get_mmap (src)); } else { 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 */ @@ -736,13 +749,15 @@ gst_filesrc_open_file (GstFileSrc * src) /* find the file length */ src->filelen = stat_results.st_size; + src->using_mmap = FALSE; +#ifdef HAVE_MMAP /* allocate the first mmap'd region */ src->mapbuf = gst_filesrc_map_region (src, 0, src->mapsize); - if (src->mapbuf == NULL) { - src->using_mmap = FALSE; - } else { + if (src->mapbuf != NULL) { src->using_mmap = TRUE; } +#endif + src->curoffset = 0;