summaryrefslogtreecommitdiff
blob: 6707ff093644686ba3d501970a85a8f2fc2e4ea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
diff --git a/lstm/lstmrecognizer.cpp b/lstm/lstmrecognizer.cpp
index 1d4f0f3..7192ba7 100644
--- a/lstm/lstmrecognizer.cpp
+++ b/lstm/lstmrecognizer.cpp
@@ -16,6 +16,11 @@
 // limitations under the License.
 ///////////////////////////////////////////////////////////////////////
 
+// Include automatically generated configuration file if running autoconf.
+#ifdef HAVE_CONFIG_H
+#include "config_auto.h"
+#endif
+
 #include "lstmrecognizer.h"
 
 #include "allheaders.h"
diff --git a/lstm/lstmtrainer.cpp b/lstm/lstmtrainer.cpp
index ab66702..fd3f247 100644
--- a/lstm/lstmtrainer.cpp
+++ b/lstm/lstmtrainer.cpp
@@ -16,6 +16,11 @@
 // limitations under the License.
 ///////////////////////////////////////////////////////////////////////
 
+// Include automatically generated configuration file if running autoconf.
+#ifdef HAVE_CONFIG_H
+#include "config_auto.h"
+#endif
+
 #include "lstmtrainer.h"
 #include <string>
 
diff --git a/lstm/network.cpp b/lstm/network.cpp
index 795d4a5..791848a 100644
--- a/lstm/network.cpp
+++ b/lstm/network.cpp
@@ -16,6 +16,11 @@
 // limitations under the License.
 ///////////////////////////////////////////////////////////////////////
 
+// Include automatically generated configuration file if running autoconf.
+#ifdef HAVE_CONFIG_H
+#include "config_auto.h"
+#endif
+
 #include "network.h"
 
 #include <stdlib.h>
@@ -277,27 +282,31 @@ double Network::Random(double range) {
   return randomizer_->SignedRand(range);
 }
 
-#ifndef GRAPHICS_DISABLED
 // === Debug image display methods. ===
 // Displays the image of the matrix to the forward window.
 void Network::DisplayForward(const NetworkIO& matrix) {
+#ifndef GRAPHICS_DISABLED  // do nothing if there's no graphics
   Pix* image = matrix.ToPix();
   ClearWindow(false, name_.string(), pixGetWidth(image),
               pixGetHeight(image), &forward_win_);
   DisplayImage(image, forward_win_);
   forward_win_->Update();
+#endif  // GRAPHICS_DISABLED
 }
 
 // Displays the image of the matrix to the backward window.
 void Network::DisplayBackward(const NetworkIO& matrix) {
+#ifndef GRAPHICS_DISABLED  // do nothing if there's no graphics
   Pix* image = matrix.ToPix();
   STRING window_name = name_ + "-back";
   ClearWindow(false, window_name.string(), pixGetWidth(image),
               pixGetHeight(image), &backward_win_);
   DisplayImage(image, backward_win_);
   backward_win_->Update();
+#endif  // GRAPHICS_DISABLED
 }
 
+#ifndef GRAPHICS_DISABLED
 // Creates the window if needed, otherwise clears it.
 void Network::ClearWindow(bool tess_coords, const char* window_name,
                           int width, int height, ScrollView** window) {
diff --git a/viewer/svutil.cpp b/viewer/svutil.cpp
index 34a2286..84a4b94 100644
--- a/viewer/svutil.cpp
+++ b/viewer/svutil.cpp
@@ -83,6 +83,27 @@ void SVMutex::Unlock() {
 #endif
 }
 
+// Create new thread.
+void SVSync::StartThread(void *(*func)(void*), void* arg) {
+#ifdef _WIN32
+  LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func;
+  DWORD threadid;
+  HANDLE newthread = CreateThread(
+  NULL,          // default security attributes
+  0,             // use default stack size
+  f,             // thread function
+  arg,           // argument to thread function
+  0,             // use default creation flags
+  &threadid);    // returns the thread identifier
+#else
+  pthread_t helper;
+  pthread_attr_t attr;
+  pthread_attr_init(&attr);
+  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+  pthread_create(&helper, &attr, func, arg);
+#endif
+}
+
 #ifndef GRAPHICS_DISABLED
 
 const int kMaxMsgSize = 4096;
@@ -186,29 +207,6 @@ void SVSemaphore::Wait() {
 #endif
 }
 
-
-// Create new thread.
-
-void SVSync::StartThread(void *(*func)(void*), void* arg) {
-#ifdef _WIN32
-  LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func;
-  DWORD threadid;
-  HANDLE newthread = CreateThread(
-  NULL,          // default security attributes
-  0,             // use default stack size
-  f,             // thread function
-  arg,           // argument to thread function
-  0,             // use default creation flags
-  &threadid);    // returns the thread identifier
-#else
-  pthread_t helper;
-  pthread_attr_t attr;
-  pthread_attr_init(&attr);
-  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-  pthread_create(&helper, &attr, func, arg);
-#endif
-}
-
 // Place a message in the message buffer (and flush it).
 void SVNetwork::Send(const char* msg) {
   mutex_send_->Lock();