0001-sidplay2-libs-2.1.1.patch 10.4 KB
Various fixes to compile libsidplay2 with newer gcc compilers

Downloaded from
http://tsubasa.googlecode.com/svn/trunk/tsubasa/sidplay2-libs/sidplay2-libs-2.1.1.diff

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>

--- sidplay-libs-2.1.1.orig/Makefile.in
+++ sidplay-libs-2.1.1/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -253,7 +253,7 @@
 	fi; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -f $$subdir/TAGS && \
+	    test ! -f $$subdir/TAGS || \
 	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
@@ -264,7 +264,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -z "$$unique" && unique=$$empty_fix; \
+	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
 	    $$tags $$unique; \
 	fi
--- sidplay-libs-2.1.1.orig/aclocal.m4
+++ sidplay-libs-2.1.1/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.8.4 -*- Autoconf -*-
+# generated automatically by aclocal 1.8.5 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
 # Free Software Foundation, Inc.
@@ -40,7 +40,7 @@
 # Call AM_AUTOMAKE_VERSION so it can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.8.4])])
+	 [AM_AUTOMAKE_VERSION([1.8.5])])
 
 # AM_AUX_DIR_EXPAND
 
--- sidplay-libs-2.1.1.orig/builders/Makefile.in
+++ sidplay-libs-2.1.1/builders/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -130,9 +130,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  builders/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  builders/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  builders/Makefile
+	  $(AUTOMAKE) --foreign  builders/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -234,7 +234,7 @@
 	fi; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -f $$subdir/TAGS && \
+	    test ! -f $$subdir/TAGS || \
 	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
@@ -245,7 +245,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -z "$$unique" && unique=$$empty_fix; \
+	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
 	    $$tags $$unique; \
 	fi
--- sidplay-libs-2.1.1.orig/builders/hardsid-builder/src/hardsid-builder.cpp
+++ sidplay-libs-2.1.1/builders/hardsid-builder/src/hardsid-builder.cpp
@@ -47,6 +47,7 @@
  ***************************************************************************/
 
 #include <stdio.h>
+#include <cstring>
 #include "config.h"
 
 #ifdef HAVE_EXCEPTIONS
--- sidplay-libs-2.1.1.orig/builders/resid-builder/src/resid-builder.cpp
+++ sidplay-libs-2.1.1/builders/resid-builder/src/resid-builder.cpp
@@ -37,6 +37,7 @@
  ***************************************************************************/
 
 #include <stdio.h>
+#include <cstring>
 
 #include "config.h"
 #ifdef HAVE_EXCEPTIONS
--- sidplay-libs-2.1.1.orig/builders/resid-builder/src/resid.cpp
+++ sidplay-libs-2.1.1/builders/resid-builder/src/resid.cpp
@@ -16,6 +16,7 @@
  *                                                                         *
  ***************************************************************************/
 
+#include <cstring>
 #include "config.h"
 
 #ifdef HAVE_EXCEPTIONS
--- sidplay-libs-2.1.1.orig/configure.ac
+++ sidplay-libs-2.1.1/configure.ac
@@ -2,7 +2,7 @@
 
 #Variables
 pwd=`pwd`
-builders='${libdir}'/sidplay/builders
+builders='${libdir}'/
 ac_configure_args="$ac_configure_args --disable-library-checks"
 
 AC_CONFIG_AUX_DIR(unix)
@@ -11,7 +11,7 @@
 
 hardsid=false
 case "$host" in
-    *linux*) hardsid=true
+    *linux*|*-k*bsd*-gnu) hardsid=true
         ;;
 esac
 AM_CONDITIONAL(HARDSID, test x$hardsid = xtrue)
--- sidplay-libs-2.1.1.orig/libsidplay/include/sidplay/SmartPtr.h
+++ sidplay-libs-2.1.1/libsidplay/include/sidplay/SmartPtr.h
@@ -17,16 +17,16 @@
 		doFree = bufOwner;
 		if ( bufferLen >= 1 )
 		{
-			pBufCurrent = ( bufBegin = buffer );
-			bufEnd = bufBegin + bufferLen;
-			bufLen = bufferLen;
-			status = true;
+			this->pBufCurrent = ( this->bufBegin = buffer );
+			this->bufEnd = this->bufBegin + bufferLen;
+			this->bufLen = bufferLen;
+			this->status = true;
 		}
 		else
 		{
-			pBufCurrent = ( bufBegin = ( bufEnd = 0 ));
-			bufLen = 0;
-			status = false;
+			this->pBufCurrent = ( this->bufBegin = ( this->bufEnd = 0 ));
+			this->bufLen = 0;
+			this->status = false;
 		}
 	}
 	
@@ -211,16 +211,16 @@
 	{
 		if ( bufferLen >= 1 )
 		{
-			pBufCurrent = ( bufBegin = buffer );
-			bufEnd = bufBegin + bufferLen;
-			bufLen = bufferLen;
-			status = true;
+			this->pBufCurrent = ( this->bufBegin = buffer );
+			this->bufEnd = this->bufBegin + bufferLen;
+			this->bufLen = bufferLen;
+			this->status = true;
 		}
 		else
 		{
-			pBufCurrent = bufBegin = bufEnd = 0;
-			bufLen = 0;
-			status = false;
+			this->pBufCurrent = this->bufBegin = this->bufEnd = 0;
+			this->bufLen = 0;
+			this->status = false;
 		}
 	}
 };
--- sidplay-libs-2.1.1.orig/libsidplay/include/sidplay/sidendian.h
+++ sidplay-libs-2.1.1/libsidplay/include/sidplay/sidendian.h
@@ -16,6 +16,10 @@
  ***************************************************************************/
 /***************************************************************************
  *  $Log: sidendian.h,v $
+ *  Revision 1.6  2005/11/20 11:02:06  s_a_white
+ *  Work around for bug in gcc 4 (optimiser breaks if variable never has a
+ *  direct assignment).
+ *
  *  Revision 1.5  2001/07/03 22:44:13  s_a_white
  *  Added endian_16 to convert a 16 bit value to an array of 8s.
  *
@@ -141,7 +145,7 @@
 // Convert high-byte and low-byte to 16-bit word.
 inline uint_least16_t endian_16 (uint8_t hi, uint8_t lo)
 {
-    uint_least16_t word;
+    uint_least16_t word = 0;
     endian_16lo8 (word, lo);
     endian_16hi8 (word, hi);
     return word;
@@ -165,7 +169,7 @@
 
 inline void endian_16 (char ptr[2], uint_least16_t word)
 {
-	endian_16 ((uint8_t *) ptr, word);
+    endian_16 ((uint8_t *) ptr, word);
 }
 
 // Convert high-byte and low-byte to 16-bit little endian word.
@@ -334,7 +338,7 @@
 // Swap word endian.
 inline void endian_32swap8 (uint_least32_t &dword)
 {
-    uint_least16_t lo, hi;
+    uint_least16_t lo = 0, hi = 0;
     lo = endian_32lo16 (dword);
     hi = endian_32hi16 (dword);
     endian_16swap8 (lo);
@@ -346,8 +350,8 @@
 // Convert high-byte and low-byte to 32-bit word.
 inline uint_least32_t endian_32 (uint8_t hihi, uint8_t hilo, uint8_t hi, uint8_t lo)
 {
-    uint_least32_t dword;
-    uint_least16_t word;
+    uint_least32_t dword = 0;
+    uint_least16_t word  = 0;
     endian_32lo8  (dword, lo);
     endian_32hi8  (dword, hi);
     endian_16lo8  (word,  hilo);
@@ -374,7 +378,7 @@
     defined(SID_WORDS_LITTLEENDIAN)
     *((uint_least32_t *) ptr) = dword;
 #else
-    uint_least16_t word;
+    uint_least16_t word = 0;
     ptr[0] = endian_32lo8  (dword);
     ptr[1] = endian_32hi8  (dword);
     word   = endian_32hi16 (dword);
@@ -401,7 +405,7 @@
     defined(SID_WORDS_BIGENDIAN)
     *((uint_least32_t *) ptr) = dword;
 #else
-    uint_least16_t word;
+    uint_least16_t word = 0;
     word   = endian_32hi16 (dword);
     ptr[1] = endian_16lo8  (word);
     ptr[0] = endian_16hi8  (word);
--- sidplay-libs-2.1.1.orig/libsidplay/unix/config.h.in
+++ sidplay-libs-2.1.1/libsidplay/unix/config.h.in
@@ -72,22 +72,22 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* The size of a `char', as computed by sizeof. */
+/* The size of `char', as computed by sizeof. */
 #undef SIZEOF_CHAR
 
-/* The size of a `int', as computed by sizeof. */
+/* The size of `int', as computed by sizeof. */
 #undef SIZEOF_INT
 
 /* The number of bytes in type long */
 #undef SIZEOF_LONG
 
-/* The size of a `long int', as computed by sizeof. */
+/* The size of `long int', as computed by sizeof. */
 #undef SIZEOF_LONG_INT
 
 /* The number of bytes in type short */
 #undef SIZEOF_SHORT
 
-/* The size of a `short int', as computed by sizeof. */
+/* The size of `short int', as computed by sizeof. */
 #undef SIZEOF_SHORT_INT
 
 /* The number of bytes in type void* */
--- sidplay-libs-2.1.1.orig/libsidplay/unix/my_macros.m4
+++ sidplay-libs-2.1.1/libsidplay/unix/my_macros.m4
@@ -105,8 +105,9 @@
     AC_CACHE_VAL(test_cv_have_ios_openmode,
     [
         AC_TRY_COMPILE(
-            [#include <fstream.h>
-             #include <iomanip.h>],
+            [#include <fstream>
+             #include <iomanip>
+	     using namespace std;],
             [ios::openmode myTest = ios::in;],
             [test_cv_have_ios_openmode=yes],
             [test_cv_have_ios_openmode=no]
--- sidplay-libs-2.1.1.orig/libsidplay/unix/sidint.h
+++ sidplay-libs-2.1.1/libsidplay/unix/sidint.h
@@ -0,0 +1,17 @@
+#ifndef _UNIX_SIDINT_H
+#define _UNIX_SIDINT_H 1
+#ifndef _GENERATED_STDINT_H
+#define _GENERATED_STDINT_H "libsidplay 2.1.1"
+/* generated using a gnu compiler version gcc (Debian 4.3-20080219-1) 4.3.0 20080219 (prerelease) [gcc-4_3-branch revision 132456] Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
+
+#include <stdint.h>
+
+
+/* system headers have good uint64_t */
+#ifndef _HAVE_UINT64_T
+#define _HAVE_UINT64_T
+#endif
+
+  /* once */
+#endif
+#endif
--- sidplay-libs-2.1.1.orig/libsidutils/include/sidplay/utils/SidUsage.h
+++ sidplay-libs-2.1.1/libsidutils/include/sidplay/utils/SidUsage.h
@@ -33,7 +33,7 @@
     uint_least16_t length;  // usage scan length
 
     // Copy common parts of basic usage to extended usage.
-    sid2_usage_t &sid2_usage_t::operator= (const sid_usage_t &usage)
+    sid2_usage_t &operator= (const sid_usage_t &usage)
     {
         *((sid_usage_t *) this) = usage;
         return *this;