From ec7550e64bd99890d91977ede7ec36b4faebef4e Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 19 Apr 2014 21:36:18 +0000
Subject: gcc2 build fix


diff --git a/configure.ac b/configure.ac
index 24e1698..6095b44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -255,7 +255,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
 dnl empty_array_size
 AC_MSG_CHECKING([how to create empty arrays])
 
-empty_array_size="xxxx"
+empty_array_size="xxx"
 AC_TRY_COMPILE([],[struct { int foo; int bar[]; } doo;], empty_array_size="")
 
 if test "x$empty_array_size" = "xxxx"; then
@@ -636,6 +636,7 @@ if test "x$enable_cddb" != "xno"; then
     [AC_MSG_WARN([new enough libcddb not found. CDDB access disabled. Get libcddb from http://libcddb.sourceforge.net])
     HAVE_CDDB=no])
     AC_CHECK_LIB(socket, connect)
+    AC_CHECK_LIB(network, connect)
     AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
 fi
 
diff --git a/example/mmc1.c b/example/mmc1.c
index 29991e7..66b7a67 100644
--- a/example/mmc1.c
+++ b/example/mmc1.c
@@ -90,9 +90,9 @@ main(int argc, const char *argv[])
     {
 	driver_return_code_t i_status;
 	bool b_erasable;
+	cdio_mmc_feature_profile_t disctype;
 
 	i_status = mmc_get_disc_erasable(p_cdio, &b_erasable);
-	cdio_mmc_feature_profile_t disctype;
 	if (DRIVER_OP_SUCCESS == i_status)
 	    printf("-- Disc is %serasable.\n", b_erasable ? "" : "not ");
 	else
-- 
2.14.3


From fbb4485e4292ac9ce8b52c95fbeae86ffdf1c103 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 12 Sep 2014 11:36:35 +0200
Subject: Fix tests for gcc2.


diff --git a/lib/driver/abs_path.c b/lib/driver/abs_path.c
index 235c5b4..f329f82 100644
--- a/lib/driver/abs_path.c
+++ b/lib/driver/abs_path.c
@@ -93,10 +93,12 @@ cdio_dirname(const char *fname)
 char *
 cdio_abspath(const char *cwd, const char *fname)
 {
+    size_t len;
+    char* result;
     if (isdirsep(*fname)) return strdup(fname);
 
-    size_t len   = strlen(cwd) + strlen(fname) + 2;
-    char* result = calloc(sizeof(char), len);
+    len   = strlen(cwd) + strlen(fname) + 2;
+    result = calloc(sizeof(char), len);
     snprintf(result, len, "%s%c%s",
 	     cwd, CDIO_FILE_SEPARATOR, fname);
     return result;
-- 
2.14.3


From 2af1bdaa4c314ee92fc265fc3202b2c37af514ce Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 5 Nov 2017 18:44:13 +0100
Subject: Fix gcc2 build.


diff --git a/src/getopt.c b/src/getopt.c
index 80c7cb2..b601eb9 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -830,6 +830,14 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
   {
     char c = *d->__nextchar++;
     char *temp = strchr (optstring, c);
+	char *nameend;
+	const struct option *p;
+	const struct option *pfound = NULL;
+	int exact = 0;
+	int ambig = 0;
+	int indfound = 0;
+	int option_index;
+
 
     /* Increment `optind' when we start to process its last character.  */
     if (*d->__nextchar == '\0')
@@ -877,14 +885,6 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 	if (longopts == NULL)
 	  goto no_longs;
 
-	char *nameend;
-	const struct option *p;
-	const struct option *pfound = NULL;
-	int exact = 0;
-	int ambig = 0;
-	int indfound = 0;
-	int option_index;
-
 	/* This is an option that requires an argument.  */
 	if (*d->__nextchar != '\0')
 	  {
-- 
2.14.3


From 9a51b8bffddaebf5ecef4dc002704cde56de8ca5 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Mon, 27 Aug 2018 19:01:36 +0200
Subject: fix gcc2 test for bincue.c


diff --git a/test/driver/bincue.c b/test/driver/bincue.c
index 9c0ece4..af548c2 100644
--- a/test/driver/bincue.c
+++ b/test/driver/bincue.c
@@ -119,6 +119,7 @@ main(int argc, const char *argv[])
     } else {
       /* Just test performing some operations. */
       cdio_set_blocksize(p_cdio, 2048);
+      {
       char *psz_device;
 
 #ifdef HAVE_CHDIR
@@ -143,6 +144,7 @@ main(int argc, const char *argv[])
       }
 
       cdio_destroy(p_cdio);
+      }
 
     }
     
-- 
2.16.4


From 8f7c8cdc2c25b80070886a6e8102643e5ccd7204 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Fri, 31 Aug 2018 18:46:24 +0200
Subject: fix realpath for the test


diff --git a/configure.ac b/configure.ac
index 6095b44..7600617 100644
--- a/configure.ac
+++ b/configure.ac
@@ -558,7 +558,7 @@ AC_SUBST(LIBCDIO_SOURCE_PATH)
 AC_CHECK_FUNCS( [chdir drand48 fseeko fseeko64 ftruncate geteuid getgid \
 		 getuid getpwuid gettimeofday lseek64 lstat memcpy memset mkstemp rand \
 		 seteuid setegid snprintf setenv strndup unsetenv tzset sleep \
-		 _stati64 usleep vsnprintf readlink realpath gmtime_r localtime_r] )
+		 _stati64 usleep vsnprintf readlink gmtime_r localtime_r] )
 
 # check for timegm() support
 AC_CHECK_FUNC(timegm, AC_DEFINE(HAVE_TIMEGM,1,
-- 
2.16.4

