diff -uN ming-0.4.2/configure.ORG ming-0.4.2/configure
--- ming-0.4.2/configure.ORG	Thu Sep 18 10:00:06 2008
+++ ming-0.4.2/configure	Fri Mar  6 14:25:07 2009
@@ -21984,7 +21984,8 @@
    { (exit 1); exit 1; }; } ;;
 esac
 
-if test x"$WORDS_BIGENDIAN" != x; then
+#if test x"$WORDS_BIGENDIAN" != x; then
+if test x"$ac_cv_c_bigendian" = x"yes"; then
 	CFLAGS="$CFLAGS -DSWF_BIG_ENDIAN"
 else
 	CFLAGS="$CFLAGS -DSWF_LITTLE_ENDIAN"
diff -uN ming-0.4.2/perl_ext/Makefile.PL.ORG ming-0.4.2/perl_ext/Makefile.PL
--- ming-0.4.2/perl_ext/Makefile.PL.ORG	Mon Jul 14 05:14:52 2008
+++ ming-0.4.2/perl_ext/Makefile.PL	Fri Mar  6 14:21:58 2009
@@ -150,7 +150,7 @@
     'OBJECT'       => "$XS_OBJECTS",
     'LDFROM'       => "$LD_OBJECTS",
     'INC'          => "-I$MING_TOP_SRCDIR/src -I$BUILDDIR -I$MING_TOP_BUILDDIR/src -I$SRCDIR",
-    'LIBS'         => [ $libs ],
+    'LIBS'         => "-L/usr/local/lib -R/usr/local/lib $libs",
     'PM'	   => $PM_HASH,
     'MAN3PODS'	   => $MAN3_HASH,
     'TYPEMAPS'     => ["$SRCDIR/typemap"],
diff -uN ming-0.4.2/php_ext/make_module.sh.ORG ming-0.4.2/php_ext/make_module.sh
--- ming-0.4.2/php_ext/make_module.sh.ORG	Tue Jul  1 04:25:11 2008
+++ ming-0.4.2/php_ext/make_module.sh	Fri Mar  6 14:22:42 2009
@@ -11,6 +11,12 @@
 cp `php-config --extension-dir`/*.so tmp/modules 
 cd tmp
 phpize
+LDFLAGS="-L/usr/local/lib -R/usr/local/lib"
+export LDFLAGS
+CPPFLAGS="-I/usr/local/include"
+export CPPFLAGS
+CFLAGS="$CPPFLAGS"
+export CFLAGS
 ./configure --with-ming
 make
 #make install
diff -uN ming-0.4.2/php_ext/Makefile.in.ORG ming-0.4.2/php_ext/Makefile.in
--- ming-0.4.2/php_ext/Makefile.in.ORG	Thu Sep 18 09:59:59 2008
+++ ming-0.4.2/php_ext/Makefile.in	Fri Mar  6 10:17:34 2009
@@ -358,8 +358,8 @@
 	rm -rf tmp
 
 install: all
-	$(INSTALL) -d "$(DESTDIR)"/`php-config --extension-dir`
-	$(INSTALL) -m 755 tmp/modules/ming.so" "$(DESTDIR)"/`php-config --extension-dir`
+	$(INSTALL) -d `php-config --extension-dir`
+	$(INSTALL) -m 755 tmp/modules/ming.so `php-config --extension-dir`
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff -uN ming-0.4.2/test/actionscript/ActionScriptTest.c.ORG ming-0.4.2/test/actionscript/ActionScriptTest.c
--- ming-0.4.2/test/actionscript/ActionScriptTest.c.ORG	Tue Jul  1 03:37:39 2008
+++ ming-0.4.2/test/actionscript/ActionScriptTest.c	Wed Mar  4 18:26:35 2009
@@ -41,6 +41,45 @@
 #include <limits.h>
 #include <makeswf.h>
 
+#ifndef HAVE_VASPRINTF
+/* Workaround for the lack of vasprintf()
+ * As found on: http://unixpapa.com/incnote/stdio.html
+ * Seems to be Public Domain
+ */
+int
+vasprintf(char **ret, const char *format, va_list ap)
+{
+	va_list ap2;
+	int len = 100;        /* First guess at the size */
+	if ((*ret = (char *) malloc(len)) == NULL)
+	{
+		return -1;
+	}
+	while (1)
+	{
+		int nchar;
+		va_copy(ap2, ap);
+		nchar= vsnprintf(*ret, len, format, ap2);
+		if (nchar > -1 && nchar < len)
+		{
+			return nchar;
+		}
+		if (nchar > len)
+		{
+			len= nchar+1;
+		} else
+		{
+			len*= 2;
+		}
+		if ((*ret = (char *) realloc(*ret, len)) == NULL)
+		{
+			free(*ret);
+			return -1;
+		}
+	}
+}
+#endif
+
 static SWFMovie
 compile(const char* filename, const char* ppfile, int version)
 {
diff -uN ming-0.4.2/util/parser.c.ORG ming-0.4.2/util/parser.c
--- ming-0.4.2/util/parser.c.ORG	Sat Sep  6 23:53:53 2008
+++ ming-0.4.2/util/parser.c	Thu Mar  5 20:28:04 2009
@@ -242,7 +242,7 @@
   int i;
 
   gerec->GlyphIndex = malloc((glyphbits+31)/32 * sizeof(UI32) );
-  for( i=0; glyphbits; i++ ) {
+  for( i=0; i <= glyphbits; i++ ) {
 	  if( glyphbits > 32 ) {
 	  	gerec->GlyphIndex[i] = readBits(f, 32);
 	  	glyphbits -= 32;
@@ -253,7 +253,7 @@
   }
 
   gerec->GlyphAdvance = malloc((advancebits+31)/32 * sizeof(UI32) );
-  for( i=0; advancebits; i++ ) {
+  for( i=0; i <= advancebits; i++ ) {
 	  if( advancebits > 32 ) {
 	  	gerec->GlyphAdvance[i] = readBits(f, 32);
 	  	advancebits -= 32;
diff -uN ming-0.4.2/util/read.c.ORG ming-0.4.2/util/read.c
--- ming-0.4.2/util/read.c.ORG	Thu Apr 10 07:29:29 2008
+++ ming-0.4.2/util/read.c	Thu Mar  5 19:20:52 2009
@@ -122,6 +122,7 @@
 {
   char data[8];
 
+#ifdef SWF_LITTLE_ENDIAN
   data[4] = readUInt8(f);
   data[5] = readUInt8(f);
   data[6] = readUInt8(f);
@@ -130,6 +131,16 @@
   data[1] = readUInt8(f);
   data[2] = readUInt8(f);
   data[3] = readUInt8(f);
+#else
+  data[3] = readUInt8(f);
+  data[2] = readUInt8(f);
+  data[1] = readUInt8(f);
+  data[0] = readUInt8(f);
+  data[7] = readUInt8(f);
+  data[6] = readUInt8(f);
+  data[5] = readUInt8(f);
+  data[4] = readUInt8(f);
+#endif
 
   return *((double *)data);
 }
@@ -138,10 +149,17 @@
 {
   char data[4];
 
+#ifdef SWF_LITTLE_ENDIAN
   data[0] = readUInt8(f);
   data[1] = readUInt8(f);
   data[2] = readUInt8(f);
   data[3] = readUInt8(f);
+#else
+  data[3] = readUInt8(f);
+  data[2] = readUInt8(f);
+  data[1] = readUInt8(f);
+  data[0] = readUInt8(f);
+#endif
 
   return *((float *)data);
 }
@@ -374,8 +392,6 @@
 {
 	_dumpBytes(f, length, 1 );
 }
-
-  int j=0, i, k, l=0;
 
 void dumpBuffer(unsigned char *buf, int length)
 {
diff -uN ming-0.4.2/test/Video/test01.php.ORG ming-0.4.2/test/Video/test01.php
--- ming-0.4.2/test/Video/test01.php.ORG	Thu May  1 00:47:38 2008
+++ ming-0.4.2/test/Video/test01.php	Fri Mar  6 14:23:34 2009
@@ -2,6 +2,7 @@
 <?php
 $m = new SWFMovie(7);
 
+set_time_limit(90);
 $video = new SWFVideoStream("../Media/video01.flv");
 $video->setDimension(200, 200);
 $m->add($video);
