diff --git a/AUTHORS b/AUTHORS index 132333b7db..5e038ae510 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,3 @@ Erik Walthinsen Wim Taymans -Richard Boulton +Richard Boulton diff --git a/acconfig.h b/acconfig.h index 84726a9c50..06394d0370 100644 --- a/acconfig.h +++ b/acconfig.h @@ -2,6 +2,9 @@ #undef PLUGINS_SRCDIR #undef PLUGINS_USE_SRCDIR +#undef HAVE_CPU_I386 +#undef HAVE_CPU_PPC + #undef HAVE_GDK_PIXBUF #undef HAVE_LIBGHTTP #undef HAVE_LIBMMX diff --git a/config.h.in b/config.h.in deleted file mode 100644 index 23093e2433..0000000000 --- a/config.h.in +++ /dev/null @@ -1,32 +0,0 @@ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if the X Window System is missing or not being used. */ -#undef X_DISPLAY_MISSING - -#undef PLUGINS_DIR -#undef PLUGINS_SRCDIR -#undef PLUGINS_USE_SRCDIR - -#undef HAVE_GDK_PIXBUF -#undef HAVE_LIBGHTTP -#undef HAVE_LIBMMX -#undef HAVE_XAUDIO -#undef HAVE_CSSAUTH -#undef HAVE_NASM - -#undef HAVE_ATOMIC_H - -#undef DEBUG_ENABLED - -/* Name of package */ -#undef PACKAGE - -/* Version number of package */ -#undef VERSION - diff --git a/configure.in b/configure.in index 11f1000c9d..40d4ec3a43 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,7 @@ AC_INIT(gst/gstobject.h) +AC_CANONICAL_SYSTEM + AM_CONFIG_HEADER(config.h) STREAMER_MAJOR_VERSION=0 @@ -42,6 +44,17 @@ dnl ############################## dnl # Do automated configuration # dnl ############################## +dnl Set up conditionals for (target) host type: +dnl =========================================== + +case "x${target_cpu}" in + xi386) HAVE_CPU_I386=yes ; + AC_DEFINE(HAVE_CPU_I386) ;; + xpowerpc) HAVE_CPU_PPC=yes ; + AC_DEFINE(HAVE_CPU_PPC) ;; +esac + + dnl Check for tools: dnl ================ @@ -101,6 +114,7 @@ dnl Check for gtk AM_PATH_GTK(1.2.0) dnl Check for libghttp +dnl FIXME: need to check for header AC_CHECK_LIB(ghttp, ghttp_request_new, [GHTTP_LIBS="-lghttp" GST_HTTPSRC_GET_TYPE="gst_httpsrc_get_type" @@ -331,6 +345,8 @@ dnl ############################# dnl These should be "USE_*" instead of "HAVE_*", but some packages expect dnl HAVE_ and it is likely to be easier to stick with the old name +AM_CONDITIONAL(HAVE_CPU_I386, test "x$HAVE_CPU_I386" = "xyes") +AM_CONDITIONAL(HAVE_CPU_PPC, test "x$HAVE_CPU_PPC" = "xyes") AM_CONDITIONAL(HAVE_GDK_PIXBUF, test "x$USE_GDK_PIXBUF" = "xyes") AM_CONDITIONAL(HAVE_LIBGHTTP, test "x$USE_LIBGHTTP" = "xyes") AM_CONDITIONAL(HAVE_LIBMMX, test "x$USE_LIBMMX" = "xyes") diff --git a/gst/Makefile.am b/gst/Makefile.am index 00ffc27d53..454324844c 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -8,6 +8,16 @@ GSTOBJECT_SRCS = \ GSTOBJECT_INCLUDES = \ gstobject.h +if HAVE_CPU_I386 +GSTARCH_SRCS = gstcpuid_i386.s +else +if HAVE_CPU_PPC +GSTARCH_SRCS = gstppc.c +else +GSTARCH_SRCS = +endif +endif + libgst_la_SOURCES = \ gst.c \ $(GSTOBJECT_SRCS) \ @@ -16,7 +26,8 @@ libgst_la_SOURCES = \ gstbufferpool.c \ gstclock.c \ gstcpu.c \ - gstcpuid_i386.s \ + $(GSTI386_SRCS) \ + $(GSTPPC_SRCS) \ gstelement.c \ gstelementfactory.c \ gstbin.c \ diff --git a/gst/cothreads.c b/gst/cothreads.c index 4d57fe0cdd..2a4262c811 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -9,6 +9,7 @@ #include #include "cothreads.h" +#include "gstarch.h" pthread_key_t _cothread_key = -1; @@ -130,7 +131,7 @@ void cothread_switch(cothread_state *thread) { fprintf(stderr,"about to switch to thread #%d\n",ctx->current); /* save the current stack pointer, frame pointer, and pc */ - __asm__("movl %%esp, %0" : "=m"(current->sp) : : "esp", "ebp"); + GET_SP(current->sp); enter = setjmp(current->jmp); if (enter != 0) return; @@ -140,12 +141,12 @@ void cothread_switch(cothread_state *thread) { /* restore stack pointer and other stuff of new cothread */ if (thread->flags & COTHREAD_STARTED) { fprintf(stderr,"in thread \n"); - __asm__("movl %0, %%esp\n" : "=m"(thread->sp)); + SET_SP(thread->sp); // switch to it longjmp(thread->jmp,1); } else { - __asm__("movl %0, %%esp\n" : "=m"(thread->sp)); + SET_SP(thread->sp); // start it - __asm__("jmp " SYMBOL_NAME_STR(cothread_stub)); + JUMP(cothread_stub); } } diff --git a/gst/gstarch.h b/gst/gstarch.h new file mode 100644 index 0000000000..0e1ae82e03 --- /dev/null +++ b/gst/gstarch.h @@ -0,0 +1,12 @@ +#ifndef GST_HGUARD_GSTARCH_H +#define GST_HGUARD_GSTARCH_H + +#ifdef __I386__ +#include "gsti386.h" +#endif + +#ifdef __PPC__ +#include "gstppc.h" +#endif + +#endif /* GST_HGUARD_GSTARCH_H */ diff --git a/gst/gsti386.h b/gst/gsti386.h new file mode 100644 index 0000000000..485ff58ba9 --- /dev/null +++ b/gst/gsti386.h @@ -0,0 +1,16 @@ +#ifndef GST_HGUARD_GSTI386_H +#define GST_HGUARD_GSTI386_H + +/* Hmm - does this work, or do the braces cause other stack manipulation? + * XXX + */ +#define GET_SP(target) \ + __asm__("movl %%esp, %0" : "=m"(target) : : "esp", "ebp"); + +#define SET_SP(source) \ + __asm__("movl %0, %%esp\n" : "=m"(thread->sp)); + +#define JUMP(target) \ + __asm__("jmp " SYMBOL_NAME_STR(cothread_stub)) + +#endif /* GST_HGUARD_GSTI386_H */ diff --git a/gst/gstppc.h b/gst/gstppc.h new file mode 100644 index 0000000000..1e77389632 --- /dev/null +++ b/gst/gstppc.h @@ -0,0 +1,20 @@ +#ifndef GST_HGUARD_GSTPPC_H +#define GST_HGUARD_GSTPPC_H + +/* Hmm - does this work, or do the braces cause other stack manipulation? + * XXX + */ +#define GET_SP(target) { \ + register unsigned long r1 __asm__("r1"); \ + target = r1; \ +} + +#define SET_SP(source) { \ + register unsigned long r1 __asm__("r1"); \ + r1 = source; \ +} + +#define JUMP(target) \ + __asm__("b " SYMBOL_NAME_STR(cothread_stub)) + +#endif /* GST_HGUARD_GSTPPC_H */ diff --git a/libs/getbits/Makefile.am b/libs/getbits/Makefile.am index 7c926fff20..cc5c1e095a 100644 --- a/libs/getbits/Makefile.am +++ b/libs/getbits/Makefile.am @@ -2,7 +2,17 @@ filterdir = $(libdir)/gst filter_LTLIBRARIES = libgstgetbits.la -libgstgetbits_la_SOURCES = gstgetbits.c gstgetbits_inl.h gstgetbits_i386.s +if HAVE_CPU_I386 +GSTARCH_SRCS = gstgetbits_i386.s +else +if HAVE_CPU_PPC +GSTARCH_SRCS = gstgetbits_generic.c +else +GSTARCH_SRCS = +endif +endif + +libgstgetbits_la_SOURCES = gstgetbits.c gstgetbits_inl.h $(GSTARCH_SRCS) libgstgetbitsincludedir = $(includedir)/gst/libs/gstgetbits libgstgetbitsinclude_HEADERS = gstgetbits.h