From f55dacbd2f80ce1fb91bb52885b8154aa1ce1b3c Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Wed, 18 Jun 2014 22:32:01 +0300
Subject: [PATCH] Don't undefine bool if defined by C99 stdbool.h

This is adopted from swig 2.0.8, change
 https://github.com/swig/swig/commit/4305a3cef9b210541c3b88ab2fd03d787c3bca66#diff-e00eca1bbacd9d243e51f4bf400b3000R63

and fixes build failures with Perl 5.20.

Regenerating the files with a current swig version would
be a more correct fix.
---
 perl/Amanda/Application.c | 10 ++++++----
 perl/Amanda/Archive.c     | 10 ++++++----
 perl/Amanda/Cmdline.c     | 10 ++++++----
 perl/Amanda/Config.c      | 10 ++++++----
 perl/Amanda/Debug.c       | 10 ++++++----
 perl/Amanda/Device.c      | 10 ++++++----
 perl/Amanda/Disklist.c    | 10 ++++++----
 perl/Amanda/Feature.c     | 10 ++++++----
 perl/Amanda/Header.c      | 10 ++++++----
 perl/Amanda/IPC/Binary.c  | 10 ++++++----
 perl/Amanda/Logfile.c     | 10 ++++++----
 perl/Amanda/MainLoop.c    | 10 ++++++----
 perl/Amanda/NDMP.c        | 10 ++++++----
 perl/Amanda/Tapelist.c    | 10 ++++++----
 perl/Amanda/Tests.c       | 10 ++++++----
 perl/Amanda/Util.c        | 10 ++++++----
 perl/Amanda/Xfer.c        | 10 ++++++----
 perl/Amanda/XferServer.c  | 10 ++++++----
 18 files changed, 108 insertions(+), 72 deletions(-)

diff --git a/perl/Amanda/Application.c b/perl/Amanda/Application.c
index 605ac6e..8327e74 100644
--- a/perl/Amanda/Application.c
+++ b/perl/Amanda/Application.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Archive.c b/perl/Amanda/Archive.c
index 3fbfc23..aac8f35 100644
--- a/perl/Amanda/Archive.c
+++ b/perl/Amanda/Archive.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Cmdline.c b/perl/Amanda/Cmdline.c
index 5a8d2ef..85709b1 100644
--- a/perl/Amanda/Cmdline.c
+++ b/perl/Amanda/Cmdline.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Config.c b/perl/Amanda/Config.c
index e8e53e0..3c1cf93 100644
--- a/perl/Amanda/Config.c
+++ b/perl/Amanda/Config.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Debug.c b/perl/Amanda/Debug.c
index 103aa3f..01a4029 100644
--- a/perl/Amanda/Debug.c
+++ b/perl/Amanda/Debug.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Device.c b/perl/Amanda/Device.c
index b8efee6..21e73dc 100644
--- a/perl/Amanda/Device.c
+++ b/perl/Amanda/Device.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Disklist.c b/perl/Amanda/Disklist.c
index 0a9874b..c064c38 100644
--- a/perl/Amanda/Disklist.c
+++ b/perl/Amanda/Disklist.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Feature.c b/perl/Amanda/Feature.c
index 6ad571a..53c6b0d 100644
--- a/perl/Amanda/Feature.c
+++ b/perl/Amanda/Feature.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Header.c b/perl/Amanda/Header.c
index faa12da..dc5c205 100644
--- a/perl/Amanda/Header.c
+++ b/perl/Amanda/Header.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/IPC/Binary.c b/perl/Amanda/IPC/Binary.c
index 5739c47..92e905d 100644
--- a/perl/Amanda/IPC/Binary.c
+++ b/perl/Amanda/IPC/Binary.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Logfile.c b/perl/Amanda/Logfile.c
index 7c39763..e4c8ef7 100644
--- a/perl/Amanda/Logfile.c
+++ b/perl/Amanda/Logfile.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/MainLoop.c b/perl/Amanda/MainLoop.c
index eeb96b1..b824e0c 100644
--- a/perl/Amanda/MainLoop.c
+++ b/perl/Amanda/MainLoop.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/NDMP.c b/perl/Amanda/NDMP.c
index cc7e75a..c2529df 100644
--- a/perl/Amanda/NDMP.c
+++ b/perl/Amanda/NDMP.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Tapelist.c b/perl/Amanda/Tapelist.c
index 611b085..dac0bd2 100644
--- a/perl/Amanda/Tapelist.c
+++ b/perl/Amanda/Tapelist.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Tests.c b/perl/Amanda/Tests.c
index 5177c57..7583d21 100644
--- a/perl/Amanda/Tests.c
+++ b/perl/Amanda/Tests.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Util.c b/perl/Amanda/Util.c
index 4357d9f..a4ad4a2 100644
--- a/perl/Amanda/Util.c
+++ b/perl/Amanda/Util.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/Xfer.c b/perl/Amanda/Xfer.c
index 4d3c0fc..ba1288c 100644
--- a/perl/Amanda/Xfer.c
+++ b/perl/Amanda/Xfer.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
diff --git a/perl/Amanda/XferServer.c b/perl/Amanda/XferServer.c
index 3ab6e64..5e5b087 100644
--- a/perl/Amanda/XferServer.c
+++ b/perl/Amanda/XferServer.c
@@ -1450,9 +1450,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1493,7 +1490,12 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
-
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
-- 
2.0.0

