diff -Nurd -x'*~' autotrace-0.31.1.orig/Makefile.am autotrace-0.31.1/Makefile.am
--- autotrace-0.31.1.orig/Makefile.am	2002-10-30 11:51:46.000000000 -0500
+++ autotrace-0.31.1/Makefile.am	2011-08-10 00:21:22.000000000 -0400
@@ -10,7 +10,7 @@
 autotrace.sln autotrace.vcproj libming.sln libming.vcproj	\
 autotrace.pc.in autotrace.spec.in TODO HACKING FAQ
 
-AUTOMAKE_OPTIONS = foreign no-dependencies
+AUTOMAKE_OPTIONS = foreign
 
 autotraceincludedir=$(includedir)/autotrace
 lib_LTLIBRARIES=libautotrace.la
@@ -127,12 +127,13 @@
 
 INCLUDES = $(MAGICK_CFLAGS) $(LIBPSTOEDIT_CFLAGS)
 autotrace_LDADD =				\
-		libautotrace.la			\
+		libautotrace.la
+		-lm
+libautotrace_la_LIBADD =			\
 		$(MAGICK_LDFLAGS)		\
 		$(LIBPNG_LDFLAGS)		\
 		$(LIBSWF_LDFLAGS)		\
-		$(LIBPSTOEDIT_LIBS)		\
-		-lm
+		$(LIBPSTOEDIT_LIBS)
 
 m4datadir = $(datadir)/aclocal
 m4data_DATA = autotrace.m4
diff -Nurd -x'*~' autotrace-0.31.1.orig/acconfig.h autotrace-0.31.1/acconfig.h
--- autotrace-0.31.1.orig/acconfig.h	2002-10-29 23:50:13.000000000 -0500
+++ autotrace-0.31.1/acconfig.h	1969-12-31 19:00:00.000000000 -0500
@@ -1,30 +0,0 @@
-/* acconfig.h
-   This file is in the public domain.
-
-   Descriptive text for the C preprocessor macros that
-   the distributed Autoconf macros can define.
-   No software package will use all of them; autoheader copies the ones
-   your configure.in uses into your configuration header file templates.
-
-   The entries are in sort -df order: alphabetical, case insensitive,
-   ignoring punctuation (such as underscores).  Although this order
-   can split up related entries, it makes it easier to check whether
-   a given entry is in the file.
-
-   Leave the following blank line there!!  Autoheader needs it.  */
-
-
-/* Other stuff */
-#undef AUTOTRACE_VERSION
-#undef AUTOTRACE_WEB
-#undef HAVE_LIBPNG
-#undef HAVE_LIBSWF
-#undef HAVE_MAGICK
-#undef HAVE_LIBPSTOEDIT
-#undef HAVE_MKSTEMP
-
-
-/* Leave that blank line there!!  Autoheader needs it.
-   If you're adding to this file, keep in mind:
-   The entries are in sort -df order: alphabetical, case insensitive,
-   ignoring punctuation (such as underscores).  */
diff -Nurd -x'*~' autotrace-0.31.1.orig/autotrace.m4 autotrace-0.31.1/autotrace.m4
--- autotrace-0.31.1.orig/autotrace.m4	2002-10-10 16:44:12.000000000 -0400
+++ autotrace-0.31.1/autotrace.m4	2007-06-25 02:48:10.000000000 -0400
@@ -4,7 +4,7 @@
 dnl AM_PATH_AUTOTRACE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
 dnl Test to see if libautotrace is installed, and define AUTOTRACE_CFLAGS, LIBS
 dnl
-AC_DEFUN(AM_PATH_AUTOTRACE,
+AC_DEFUN([AM_PATH_AUTOTRACE],
 [dnl
 dnl Get the cflags and libraries from the autotrace-config script
 dnl
diff -Nurd -x'*~' autotrace-0.31.1.orig/configure.in autotrace-0.31.1/configure.in
--- autotrace-0.31.1.orig/configure.in	2002-11-08 12:49:23.000000000 -0500
+++ autotrace-0.31.1/configure.in	2007-06-25 02:48:10.000000000 -0400
@@ -11,7 +11,7 @@
 AUTOTRACE_MINOR_VERSION=31
 AUTOTRACE_MICRO_VERSION=1
 AUTOTRACE_VERSION=${AUTOTRACE_MAJOR_VERSION}.${AUTOTRACE_MINOR_VERSION}.${AUTOTRACE_MICRO_VERSION}
-AC_DEFINE_UNQUOTED(AUTOTRACE_VERSION,"$AUTOTRACE_VERSION")
+AC_DEFINE_UNQUOTED(AUTOTRACE_VERSION,"$AUTOTRACE_VERSION", [Program version.])
 AC_SUBST(AUTOTRACE_VERSION)
 AM_INIT_AUTOMAKE(autotrace, $AUTOTRACE_VERSION, no-define)
 
@@ -30,14 +30,13 @@
 AC_PROG_LIBTOOL
 
 AUTOTRACE_WEB=http://autotrace.sourceforge.net
-AC_DEFINE_UNQUOTED(AUTOTRACE_WEB, "$AUTOTRACE_WEB")
+AC_DEFINE_UNQUOTED(AUTOTRACE_WEB, "$AUTOTRACE_WEB", [Program homepage.])
 
 AM_MAINTAINER_MODE
 
 AM_CONFIG_HEADER(config.h)
 
 AC_PROG_CPP
-AC_PROG_RANLIB
 dnl AC_CANONICAL_HOST
 dnl AC_ARG_PROGRAM
 AM_SANITY_CHECK
@@ -69,7 +69,7 @@
 			dnl
 			AC_MSG_CHECKING([ImageMagick - version >= 5.2.1])
 			dnl Get version and split it into MAJOR, MINOR and MICRO
-			MAGICK_VERSION=`Magick-config --version`
+			MAGICK_VERSION=`Magick-config --version | awk '{print $1}'`
 			changequote(,)dnl
 			MAGICK_MAJOR_VERSION=`echo $MAGICK_VERSION \
 			| sed -e 's/^\([0-9]*\).[0-9]*.[0-9]*$/\1/'`
@@ -80,10 +79,10 @@
 			changequote([,])dnl
 			MAGICK_MAJOR_VERSION_CHECK=`expr $MAGICK_MAJOR_VERSION \>= 5`
 			MAGICK_MINOR_VERSION_CHECK=`expr $MAGICK_MINOR_VERSION \>= 2`
-			dnl I don't consider ImageMagick 6.x.
-			if test "$MAGICK_VERSION" = "5.2.0" \
-			   || test "$MAGICK_MAJOR_VERSION_CHECK" = 0 \
-			   || test "$MAGICK_MINOR_VERSION_CHECK" = 0 ; then
+			MAGICK_MICRO_VERSION_CHECK=`expr $MAGICK_MICRO_VERSION \>= 1`
+			if    test "$MAGICK_MAJOR_VERSION_CHECK" = 0 \
+			   && test "$MAGICK_MINOR_VERSION_CHECK" = 0 \
+			   && test "$MAGICK_MICRO_VERSION_CHECK" = 0 ; then
 			   AC_MSG_RESULT(no($MAGICK_VERSION))
 		   	   AC_MSG_WARN([*** Version 5.2.1 or higher is required.             ***])
 			   AC_MSG_WARN([*** ImageMagick input handler is disabled.           ***])
@@ -92,7 +91,7 @@
 				AC_SUBST(MAGICK_CFLAGS)
 				AC_SUBST(MAGICK_LDFLAGS)
 				HAVE_MAGICK=yes
-				AC_DEFINE(HAVE_MAGICK)
+				AC_DEFINE([HAVE_MAGICK], 1, [Define to 1 if you have ImageMagick >= 5.2.1.])
 			fi
 		else
 			AC_MSG_WARN([*** Magick-config is found but magick/api.h is not found in $MAGICK_CFLAGS ***])
@@ -182,7 +181,7 @@
 	if test "x$HAVE_LIBPNG" = "xyes" ; then
 		LIBPNG_LDFLAGS="-lpng -lz -lm"
 		AC_SUBST(LIBPNG_LDFLAGS)
-		AC_DEFINE(HAVE_LIBPNG)
+		AC_DEFINE(HAVE_LIBPNG, 1, [Define to 1 if you have the `png' library (-lpng).])
 	else
 	   AC_MSG_WARN([*** libpng exists but cannot find png_read_png in the libpng. ***])
 	   AC_MSG_WARN([*** libpng might be old.                                      ***])
@@ -209,7 +208,7 @@
 	if test "$HAVE_LIBSWF" = "yes" ; then
 		LIBSWF_LDFLAGS="-lming -lm"
 		AC_SUBST(LIBSWF_LDFLAGS)
-		AC_DEFINE(HAVE_LIBSWF)
+		AC_DEFINE(HAVE_LIBSWF, 1, [Define to 1 if you have the `ming' library (-lming).])
 	else
  		AC_MSG_WARN([*** Cannot find libming.    ***])
 		AC_MSG_WARN([*** SWF output is disabled. ***])
@@ -250,11 +249,8 @@
 dnl pstoedit library
 dnl
 HAVE_LIBPSTOEDIT=no
-HAVE_LIBPSTOEDIT_320=no
-HAVE_LIBPSTOEDIT_321=no
 LIBPSTOEDIT_CFLAGS=
 LIBPSTOEDIT_LIBS=
-LIBPSTOEDIT_EXTRA_LIBS=
 
 AC_ARG_WITH(pstoedit,
 [  --with-pstoedit link with pstoedit library(default)
@@ -263,53 +259,7 @@
 dnl
 dnl 
 dnl
-AC_PROG_CXX
-dnl Standard C++ library and C++ Runtime
-dnl --- WORKAROUND for pstoedit 3.32.0
-CXX_RUNTIME_LIB=
-CXX_STD_LIB=
-if test x"$GXX" = xyes; then
-   AC_CHECK_LIB(g++,main,CXX_RUNTIME_LIB=-lg++)
-   AC_CHECK_LIB(stdc++,main,CXX_STD_LIB=-lstdc++,,${CXX_RUNTIME_LIB})
-fi
-AC_MSG_CHECKING([for C++ runtime])
-LIBPSTOEDIT_EXTRA_LIBS="${CXX_STD_LIB} ${CXX_RUNTIME_LIB}"
-AC_MSG_RESULT([${CXX_STD_LIB} ${CXX_RUNTIME_LIB}])
-dnl dl library
-dnl --- WORKAROUND for pstoedit 3.32.0
-LIBLD_LDFLAGS=
-AC_CHECK_LIB(dl,main,[LIBLD_LDFLAGS=-ldl])
-if test "x${LIBLD_LDFLAGS}" != x; then
-   LIBPSTOEDIT_EXTRA_LIBS="${LIBPSTOEDIT_EXTRA_LIBS} ${LIBLD_LDFLAGS}"
-fi
-
-echo '*** Checking pstoedit existence TWICE(if needed) ***'
-echo '*** This is the 1st check                        ***'
-AM_PATH_PSTOEDIT(3.32.1,HAVE_LIBPSTOEDIT_321=yes)
-if test ${HAVE_LIBPSTOEDIT_321} != yes; then
-   echo '*** The 1st check is failed.                     ***'
-   LIBS_BAKCUP=$LIBS
-   LIBS="$LIBS ${LIBPSTOEDIT_EXTRA_LIBS}"
-   echo '*** This is the 2nd check                        ***'
-   AM_PATH_PSTOEDIT(3.32.0,HAVE_LIBPSTOEDIT_320=yes)
-   LIBS=${LIBS_BAKCUP}
-
-   if test ${HAVE_LIBPSTOEDIT_320} = yes; then
-	echo '*** The 2nd check is passed.                     ***'
-        HAVE_LIBPSTOEDIT=yes
-	AC_DEFINE(HAVE_LIBPSTOEDIT)
-	LIBPSTOEDIT_LIBS="${PSTOEDIT_LIBS} ${LIBPSTOEDIT_EXTRA_LIBS}"
-	LIBPSTOEDIT_CFLAGS="${PSTOEDIT_CFLAGS}"
-   else
-        echo '*** The 2nd check is failed.                     ***'
-   fi
-else
-	echo '*** The 1st check is passed.                     ***'
-	HAVE_LIBPSTOEDIT=yes
-	AC_DEFINE(HAVE_LIBPSTOEDIT)
-	LIBPSTOEDIT_LIBS="${PSTOEDIT_LIBS} ${LIBPSTOEDIT_EXTRA_LIBS}"	
-	LIBPSTOEDIT_CFLAGS="${PSTOEDIT_CFLAGS}"
-fi
+PKG_CHECK_MODULES(LIBPSTOEDIT, pstoedit, HAVE_LIBPSTOEDIT=yes, HAVE_LIBPSTOEDIT=no)
 
 if test ${HAVE_LIBPSTOEDIT} = yes; then
 	AC_CHECK_FUNCS([mkstemp])
@@ -317,6 +267,7 @@
 	echo '*** However, these are experimental functions in autotrace.     ***'
 	echo '*** If you get an error in building time about pstoedit,        ***'
 	echo '*** you can run configure with --without-pstoedit option again. ***'
+	AC_DEFINE([HAVE_LIBPSTOEDIT], 1, [Define to 1 if you have the `pstoedit' library via pkg-config.])
 else
 	AC_MSG_WARN([
 *** Cannot find libpstoedit. ***
--- autotrace-0.31.1.orig/input-png.c 2002-10-10 20:44:14.000000000 +0000
+++ autotrace-0.31.1/input-png.c	2013-11-01 09:25:15.000000000 -0400
@@ -42,17 +42,17 @@
 
 static void handle_warning(png_structp png, const at_string message) {
         LOG1("PNG warning: %s", message);
-	at_exception_warning((at_exception_type *)png->error_ptr,
+	at_exception_warning((at_exception_type *)png_get_error_ptr(png),
 			     message);
-	/* at_exception_fatal((at_exception_type *)at_png->error_ptr,
+	/* at_exception_fatal((at_exception_type *)png_get_error_ptr(at_png),
 	   "PNG warning"); */
 }
 
 static void handle_error(png_structp png, const at_string message) {
 	LOG1("PNG error: %s", message);
-	at_exception_fatal((at_exception_type *)png->error_ptr,
+	at_exception_fatal((at_exception_type *)png_get_error_ptr(png),
 			   message);
-	/* at_exception_fatal((at_exception_type *)at_png->error_ptr,
+	/* at_exception_fatal((at_exception_type *)png_get_error_ptr(at_png),
 	   "PNG error"); */
 	
 }
@@ -157,8 +157,8 @@
 
 	png_set_strip_16(png_ptr);
 	png_set_packing(png_ptr);
-	if ((png_ptr->bit_depth < 8) ||
-	    (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
+	if ((png_get_bit_depth(png_ptr, info_ptr) < 8) ||
+	    (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) ||
 	    (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
 		png_set_expand(png_ptr);
 
@@ -181,20 +181,10 @@
 				   PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
 	} else
 		png_set_strip_alpha(png_ptr);
+	png_set_interlace_handling(png_ptr);
 	png_read_update_info(png_ptr, info_ptr);
 
-
-	info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
-							info_ptr->height * sizeof(png_bytep));
-#ifdef PNG_FREE_ME_SUPPORTED
-	info_ptr->free_me |= PNG_FREE_ROWS;
-#endif
-	for (row = 0; row < (int)info_ptr->height; row++)
-		info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
-								    png_get_rowbytes(png_ptr, info_ptr));
-	
-	png_read_image(png_ptr, info_ptr->row_pointers);
-	info_ptr->valid |= PNG_INFO_IDAT;
+	png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
 	png_read_end(png_ptr, info_ptr);
 	return png_get_rows(png_ptr, info_ptr);
 }
