Compile a test program to ensure that we have working atomic resource counting.
authorRichard Boulton <richard@tartarus.org>
Fri, 4 Feb 2000 02:25:34 +0000 (02:25 +0000)
committerRichard Boulton <richard@tartarus.org>
Fri, 4 Feb 2000 02:25:34 +0000 (02:25 +0000)
Original commit message from CVS:
Compile a test program to ensure that we have working atomic resource
counting.

A few small changes (include headers, fix a cast) to stop compiler
warnings.

configure.in
gst/gstelement.c
gst/gstplugin.c

index 9ad6fdc..d715296 100644 (file)
@@ -86,13 +86,23 @@ dnl Check for atomic.h
 dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
 dnl defines the wrong default symbol as well (HAVE_ASM_ATOMIC_H)
 AC_CHECK_HEADER(asm/atomic.h, HAVE_ATOMIC_H=yes, HAVE_ATOMIC_H=no)
-AC_EGREP_HEADER(atomic_set, asm/atomic.h,, 
-  [
-   if test x$HAVE_ATOMIC_H = xyes; then
-     AC_MSG_WARN("Atomic reference counting is out of date: doing without.")
-   fi
-   HAVE_ATOMIC_H=no
-])
+dnl Do a compile to check that it has atomic_set (eg, linux 2.0 didn't)
+if test x$HAVE_ATOMIC_H = xyes; then
+  AC_TRY_RUN([
+#include "asm/atomic.h"
+main() { atomic_t t; atomic_set(&t,0); return 0;}
+  ],, [
+    # Not successful
+    if test x$HAVE_ATOMIC_H = xyes; then
+      AC_MSG_WARN(Atomic reference counting is out of date: doing without.)
+    fi
+    HAVE_ATOMIC_H=no
+  ], [
+    # Cross compiling
+    AC_MSG_RESULT(yes)
+    AC_MSG_WARN(Can't check properly for atomic reference counting.  Assuming OK.)
+  ])
+fi
 
 dnl Check for MMX capable compiler
 AC_MSG_CHECKING(Checking MMX compilation)
index 1d8d365..84ecc8b 100644 (file)
@@ -422,7 +422,7 @@ xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) {
   while (pads) {
     pad = GST_PAD(pads->data);
     // figure out if it's a direct pad or a ghostpad
-    if (pad->parent == element)
+    if (GST_ELEMENT(pad->parent) == element)
       gst_pad_save_thyself(pad,self);
     pads = g_list_next(pads);
   }
@@ -535,6 +535,7 @@ void gst_element_set_loop_function(GstElement *element,
                                    GstElementLoopFunction loop) {
   element->loopfunc = loop;
   if (element->threadstate != NULL)
+    // note that this casts a GstElement * to a char **.  Ick.
     cothread_setfunc(element->threadstate,gst_element_loopfunc_wrapper,
-                     0,element);
+                     0,(char **)element);
 }
index c7ca374..428f084 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/stat.h>
 #include <dirent.h>
 #include <unistd.h>
+#include <string.h>
 
 #include <gst/gstplugin.h>