diff --git a/api/baseapi.cpp b/api/baseapi.cpp index 77a56ffc..c37136d0 100644 --- a/api/baseapi.cpp +++ b/api/baseapi.cpp @@ -24,7 +24,7 @@ #include "allheaders.h" -#ifdef USE_NLS +#ifdef USING_GETTEXT #include #include #define _(x) gettext(x) diff --git a/api/tesseractmain.cpp b/api/tesseractmain.cpp index 90ab82a2..aae62151 100644 --- a/api/tesseractmain.cpp +++ b/api/tesseractmain.cpp @@ -46,7 +46,7 @@ **********************************************************************/ int main(int argc, char **argv) { -#ifdef USE_NLS +#ifdef USING_GETTEXT setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff --git a/autogen.sh b/autogen.sh index 141d3d3d..68a46746 100755 --- a/autogen.sh +++ b/autogen.sh @@ -27,6 +27,11 @@ # # All the rest is auto-generated. +# create m4 directory if it not exists +if [ ! -d m4 ]; then + mkdir m4 +fi + bail_out() { echo diff --git a/ccmain/pagesegmain.cpp b/ccmain/pagesegmain.cpp index 10b98924..c20c7cf4 100644 --- a/ccmain/pagesegmain.cpp +++ b/ccmain/pagesegmain.cpp @@ -17,7 +17,7 @@ * **********************************************************************/ -#ifdef WIN32 +#ifdef _WIN32 #ifndef __GNUC__ #include #endif /* __GNUC__ */ diff --git a/ccmain/paramsd.cpp b/ccmain/paramsd.cpp index 65ed20d2..c5de303f 100644 --- a/ccmain/paramsd.cpp +++ b/ccmain/paramsd.cpp @@ -19,7 +19,7 @@ // // The parameters editor is used to edit all the parameters used within // tesseract from the ui. -#ifdef WIN32 +#ifdef _WIN32 #else #include #include diff --git a/ccutil/ambigs.cpp b/ccutil/ambigs.cpp index 72d93ac9..345081fc 100644 --- a/ccutil/ambigs.cpp +++ b/ccutil/ambigs.cpp @@ -21,13 +21,13 @@ #include "ambigs.h" #include "helpers.h" -#ifdef WIN32 +#ifdef _WIN32 #ifndef __GNUC__ #define strtok_r strtok_s #else #include "strtok_r.h" #endif /* __GNUC__ */ -#endif /* WIN32 */ +#endif /* _WIN32 */ namespace tesseract { diff --git a/ccutil/ccutil.cpp b/ccutil/ccutil.cpp index 0f62c3e8..8e75c5dd 100644 --- a/ccutil/ccutil.cpp +++ b/ccutil/ccutil.cpp @@ -25,7 +25,7 @@ CCUtil::~CCUtil() { CCUtilMutex::CCUtilMutex() { -#ifdef WIN32 +#ifdef _WIN32 mutex_ = CreateMutex(0, FALSE, 0); #else pthread_mutex_init(&mutex_, NULL); @@ -33,7 +33,7 @@ CCUtilMutex::CCUtilMutex() { } void CCUtilMutex::Lock() { -#ifdef WIN32 +#ifdef _WIN32 WaitForSingleObject(mutex_, INFINITE); #else pthread_mutex_lock(&mutex_); @@ -41,7 +41,7 @@ void CCUtilMutex::Lock() { } void CCUtilMutex::Unlock() { -#ifdef WIN32 +#ifdef _WIN32 ReleaseMutex(mutex_); #else pthread_mutex_unlock(&mutex_); diff --git a/ccutil/ccutil.h b/ccutil/ccutil.h index 4c120966..ccb24b10 100644 --- a/ccutil/ccutil.h +++ b/ccutil/ccutil.h @@ -26,7 +26,7 @@ #include "params.h" #include "unicharset.h" -#ifdef WIN32 +#ifdef _WIN32 #include #else #include @@ -43,7 +43,7 @@ class CCUtilMutex { void Unlock(); private: -#ifdef WIN32 +#ifdef _WIN32 HANDLE mutex_; #else pthread_mutex_t mutex_; diff --git a/classify/mf.cpp b/classify/mf.cpp index decc0b2d..d5f82bf3 100644 --- a/classify/mf.cpp +++ b/classify/mf.cpp @@ -71,7 +71,7 @@ FEATURE_SET ExtractMicros(TBLOB *Blob, const DENORM& denorm) { Feature->Params[MFBulge1] = 0.0f; Feature->Params[MFBulge2] = 0.0f; -#ifndef WIN32 +#ifndef _WIN32 // Assert that feature parameters are well defined. int i; for (i = 0; i < Feature->Type->NumParams; i++) { diff --git a/classify/ocrfeatures.cpp b/classify/ocrfeatures.cpp index 06dc5b0c..3685c5c6 100644 --- a/classify/ocrfeatures.cpp +++ b/classify/ocrfeatures.cpp @@ -169,7 +169,7 @@ FEATURE ReadFeature(FILE *File, const FEATURE_DESC_STRUCT* FeatureDesc) { for (i = 0; i < Feature->Type->NumParams; i++) { if (fscanf (File, "%f", &(Feature->Params[i])) != 1) DoError (ILLEGAL_FEATURE_PARAM, "Illegal feature parameter spec"); -#ifndef WIN32 +#ifndef _WIN32 assert (!isnan(Feature->Params[i])); #endif } @@ -230,7 +230,7 @@ void WriteFeature(FILE *File, FEATURE Feature) { int i; for (i = 0; i < Feature->Type->NumParams; i++) { -#ifndef WIN32 +#ifndef _WIN32 assert(!isnan(Feature->Params[i])); #endif fprintf(File, " %g", Feature->Params[i]); diff --git a/configure.ac b/configure.ac index 930bae43..5ff8b4b8 100644 --- a/configure.ac +++ b/configure.ac @@ -98,20 +98,6 @@ if test "$enable_embedded" = "yes"; then AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED]) fi -# check whether to build embedded version -AC_MSG_CHECKING(--enable-embedded argument) -AC_ARG_ENABLE([embedded], - [ --enable-embedded enable embedded build (default=no)], - [enable_embedded=$enableval], - [enable_embedded="no"]) -AC_MSG_RESULT($enable_embedded) -AM_CONDITIONAL([EMBEDDED], [test "$enable_embedded" = "yes"]) -if test "$enable_embedded" = "yes"; then - #AC_DEFINE([EMBEDDED], [], [Embedded Mode]) - AC_SUBST([AM_CXXFLAGS], [-DEMBEDDED]) - AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED]) -fi - # check whether to build multiple libraries AC_MSG_CHECKING(--enable-multiple-libraries argument) AC_ARG_ENABLE([multiple-libraries], diff --git a/cube/bmp_8.cpp b/cube/bmp_8.cpp index 460c31ea..4e5c9b7f 100644 --- a/cube/bmp_8.cpp +++ b/cube/bmp_8.cpp @@ -28,7 +28,7 @@ using std::min; using std::max; #endif -#ifdef WIN32 +#ifdef _WIN32 #ifndef M_PI #define M_PI 3.14159265358979323846 #endif diff --git a/cube/feature_chebyshev.cpp b/cube/feature_chebyshev.cpp index 70f77dc7..eeba8757 100644 --- a/cube/feature_chebyshev.cpp +++ b/cube/feature_chebyshev.cpp @@ -29,7 +29,7 @@ #include "const.h" #include "char_samp.h" -#ifdef WIN32 +#ifdef _WIN32 #ifndef M_PI #define M_PI 3.14159265358979323846 #endif diff --git a/training/mftraining.cpp b/training/mftraining.cpp index edd25946..907b2ee6 100644 --- a/training/mftraining.cpp +++ b/training/mftraining.cpp @@ -30,7 +30,7 @@ #include #define _USE_MATH_DEFINES #include -#ifdef WIN32 +#ifdef _WIN32 #ifndef M_PI #define M_PI 3.14159265358979323846 #endif diff --git a/viewer/svutil.cpp b/viewer/svutil.cpp index 070ece5c..bef51b12 100644 --- a/viewer/svutil.cpp +++ b/viewer/svutil.cpp @@ -21,7 +21,7 @@ // thread/process creation & synchronization and network connection. #include -#ifdef WIN32 +#ifdef _WIN32 struct addrinfo { struct sockaddr* ai_addr; int ai_addrlen; @@ -64,7 +64,7 @@ const int kMaxMsgSize = 4096; // Signals a thread to exit. void SVSync::ExitThread() { -#ifdef WIN32 +#ifdef _WIN32 // ExitThread(0); #else pthread_exit(0); @@ -73,7 +73,7 @@ void SVSync::ExitThread() { // Starts a new process. void SVSync::StartProcess(const char* executable, const char* args) { -#ifdef WIN32 +#ifdef _WIN32 std::string proc; proc.append(executable); proc.append(" "); @@ -123,7 +123,7 @@ void SVSync::StartProcess(const char* executable, const char* args) { } SVSemaphore::SVSemaphore() { -#ifdef WIN32 +#ifdef _WIN32 semaphore_ = CreateSemaphore(0, 0, 10, 0); #else sem_init(&semaphore_, 0, 0); @@ -131,7 +131,7 @@ SVSemaphore::SVSemaphore() { } void SVSemaphore::Signal() { -#ifdef WIN32 +#ifdef _WIN32 ReleaseSemaphore(semaphore_, 1, NULL); #else sem_post(&semaphore_); @@ -139,7 +139,7 @@ void SVSemaphore::Signal() { } void SVSemaphore::Wait() { -#ifdef WIN32 +#ifdef _WIN32 WaitForSingleObject(semaphore_, INFINITE); #else sem_wait(&semaphore_); @@ -147,7 +147,7 @@ void SVSemaphore::Wait() { } SVMutex::SVMutex() { -#ifdef WIN32 +#ifdef _WIN32 mutex_ = CreateMutex(0, FALSE, 0); #else pthread_mutex_init(&mutex_, NULL); @@ -155,7 +155,7 @@ SVMutex::SVMutex() { } void SVMutex::Lock() { -#ifdef WIN32 +#ifdef _WIN32 WaitForSingleObject(mutex_, INFINITE); #else pthread_mutex_lock(&mutex_); @@ -163,7 +163,7 @@ void SVMutex::Lock() { } void SVMutex::Unlock() { -#ifdef WIN32 +#ifdef _WIN32 ReleaseMutex(mutex_); #else pthread_mutex_unlock(&mutex_); @@ -173,7 +173,7 @@ void SVMutex::Unlock() { // Create new thread. void SVSync::StartThread(void *(*func)(void*), void* arg) { -#ifdef WIN32 +#ifdef _WIN32 LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func; DWORD threadid; HANDLE newthread = CreateThread( @@ -210,7 +210,7 @@ void SVNetwork::Flush() { // This will always return one line of char* (denoted by \n). char* SVNetwork::Receive() { char* result = NULL; -#ifdef WIN32 +#ifdef _WIN32 if (has_content) { result = strtok (NULL, "\n"); } #else if (buffer_ptr_ != NULL) { result = strtok_r(NULL, "\n", &buffer_ptr_); } @@ -246,7 +246,7 @@ char* SVNetwork::Receive() { if (i <= 0) { return NULL; } msg_buffer_in_[i] = '\0'; has_content = true; -#ifdef WIN32 +#ifdef _WIN32 return strtok(msg_buffer_in_, "\n"); #else // Setup a new string tokenizer. @@ -257,7 +257,7 @@ char* SVNetwork::Receive() { // Close the connection to the server. void SVNetwork::Close() { -#ifdef WIN32 +#ifdef _WIN32 closesocket(stream_); #else close(stream_); @@ -267,7 +267,7 @@ void SVNetwork::Close() { // The program to invoke to start ScrollView static const char* ScrollViewProg() { -#ifdef WIN32 +#ifdef _WIN32 const char* prog = "java -Xms512m -Xmx1024m"; #else const char* prog = "sh"; @@ -283,7 +283,7 @@ static std::string ScrollViewCommand(std::string scrollview_path) { // exceptions in piccolo. Ideally piccolo would be debugged to make // this unnecessary. // Also the path has to be separated by ; on windows and : otherwise. -#ifdef WIN32 +#ifdef _WIN32 const char* cmd_template = "-Djava.library.path=%s -cp %s/ScrollView.jar;" "%s/piccolo-1.2.jar;%s/piccolox-1.2.jar" " com.google.scrollview.ScrollView"; @@ -332,7 +332,7 @@ static int GetAddrInfoNonLinux(const char* hostname, int port, (*addr_info)->ai_socktype = SOCK_STREAM; struct hostent *name; -#ifdef WIN32 +#ifdef _WIN32 WSADATA wsaData; WSAStartup(MAKEWORD(1, 1), &wsaData); name = gethostbyname(hostname); @@ -412,7 +412,7 @@ SVNetwork::SVNetwork(const char* hostname, int port) { while (connect(stream_, (struct sockaddr *) addr_info->ai_addr, addr_info->ai_addrlen) < 0) { std::cout << "ScrollView: Waiting for server...\n"; -#ifdef WIN32 +#ifdef _WIN32 Sleep(1000); #else sleep(1); diff --git a/viewer/svutil.h b/viewer/svutil.h index 59916349..3ee719dc 100644 --- a/viewer/svutil.h +++ b/viewer/svutil.h @@ -24,7 +24,7 @@ #ifndef TESSERACT_VIEWER_SVUTIL_H__ #define TESSERACT_VIEWER_SVUTIL_H__ -#ifdef WIN32 +#ifdef _WIN32 #ifndef __GNUC__ #include #define snprintf _snprintf @@ -73,7 +73,7 @@ class SVSemaphore { /// Wait on a semaphore. void Wait(); private: -#ifdef WIN32 +#ifdef _WIN32 HANDLE semaphore_; #else sem_t semaphore_; @@ -91,7 +91,7 @@ class SVMutex { /// Unlocks on a mutex. void Unlock(); private: -#ifdef WIN32 +#ifdef _WIN32 HANDLE mutex_; #else pthread_mutex_t mutex_;