fix configure.ac; unify identifiers (WIN32 vs _WIN32)

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@688 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
zdenop@gmail.com 2012-03-02 17:31:24 +00:00
parent 657722aeca
commit e216adab43
16 changed files with 42 additions and 51 deletions

View File

@ -24,7 +24,7 @@
#include "allheaders.h" #include "allheaders.h"
#ifdef USE_NLS #ifdef USING_GETTEXT
#include <libintl.h> #include <libintl.h>
#include <locale.h> #include <locale.h>
#define _(x) gettext(x) #define _(x) gettext(x)

View File

@ -46,7 +46,7 @@
**********************************************************************/ **********************************************************************/
int main(int argc, char **argv) { int main(int argc, char **argv) {
#ifdef USE_NLS #ifdef USING_GETTEXT
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View File

@ -27,6 +27,11 @@
# #
# All the rest is auto-generated. # All the rest is auto-generated.
# create m4 directory if it not exists
if [ ! -d m4 ]; then
mkdir m4
fi
bail_out() bail_out()
{ {
echo echo

View File

@ -17,7 +17,7 @@
* *
**********************************************************************/ **********************************************************************/
#ifdef WIN32 #ifdef _WIN32
#ifndef __GNUC__ #ifndef __GNUC__
#include <windows.h> #include <windows.h>
#endif /* __GNUC__ */ #endif /* __GNUC__ */

View File

@ -19,7 +19,7 @@
// //
// The parameters editor is used to edit all the parameters used within // The parameters editor is used to edit all the parameters used within
// tesseract from the ui. // tesseract from the ui.
#ifdef WIN32 #ifdef _WIN32
#else #else
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>

View File

@ -21,13 +21,13 @@
#include "ambigs.h" #include "ambigs.h"
#include "helpers.h" #include "helpers.h"
#ifdef WIN32 #ifdef _WIN32
#ifndef __GNUC__ #ifndef __GNUC__
#define strtok_r strtok_s #define strtok_r strtok_s
#else #else
#include "strtok_r.h" #include "strtok_r.h"
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#endif /* WIN32 */ #endif /* _WIN32 */
namespace tesseract { namespace tesseract {

View File

@ -25,7 +25,7 @@ CCUtil::~CCUtil() {
CCUtilMutex::CCUtilMutex() { CCUtilMutex::CCUtilMutex() {
#ifdef WIN32 #ifdef _WIN32
mutex_ = CreateMutex(0, FALSE, 0); mutex_ = CreateMutex(0, FALSE, 0);
#else #else
pthread_mutex_init(&mutex_, NULL); pthread_mutex_init(&mutex_, NULL);
@ -33,7 +33,7 @@ CCUtilMutex::CCUtilMutex() {
} }
void CCUtilMutex::Lock() { void CCUtilMutex::Lock() {
#ifdef WIN32 #ifdef _WIN32
WaitForSingleObject(mutex_, INFINITE); WaitForSingleObject(mutex_, INFINITE);
#else #else
pthread_mutex_lock(&mutex_); pthread_mutex_lock(&mutex_);
@ -41,7 +41,7 @@ void CCUtilMutex::Lock() {
} }
void CCUtilMutex::Unlock() { void CCUtilMutex::Unlock() {
#ifdef WIN32 #ifdef _WIN32
ReleaseMutex(mutex_); ReleaseMutex(mutex_);
#else #else
pthread_mutex_unlock(&mutex_); pthread_mutex_unlock(&mutex_);

View File

@ -26,7 +26,7 @@
#include "params.h" #include "params.h"
#include "unicharset.h" #include "unicharset.h"
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else #else
#include <pthread.h> #include <pthread.h>
@ -43,7 +43,7 @@ class CCUtilMutex {
void Unlock(); void Unlock();
private: private:
#ifdef WIN32 #ifdef _WIN32
HANDLE mutex_; HANDLE mutex_;
#else #else
pthread_mutex_t mutex_; pthread_mutex_t mutex_;

View File

@ -71,7 +71,7 @@ FEATURE_SET ExtractMicros(TBLOB *Blob, const DENORM& denorm) {
Feature->Params[MFBulge1] = 0.0f; Feature->Params[MFBulge1] = 0.0f;
Feature->Params[MFBulge2] = 0.0f; Feature->Params[MFBulge2] = 0.0f;
#ifndef WIN32 #ifndef _WIN32
// Assert that feature parameters are well defined. // Assert that feature parameters are well defined.
int i; int i;
for (i = 0; i < Feature->Type->NumParams; i++) { for (i = 0; i < Feature->Type->NumParams; i++) {

View File

@ -169,7 +169,7 @@ FEATURE ReadFeature(FILE *File, const FEATURE_DESC_STRUCT* FeatureDesc) {
for (i = 0; i < Feature->Type->NumParams; i++) { for (i = 0; i < Feature->Type->NumParams; i++) {
if (fscanf (File, "%f", &(Feature->Params[i])) != 1) if (fscanf (File, "%f", &(Feature->Params[i])) != 1)
DoError (ILLEGAL_FEATURE_PARAM, "Illegal feature parameter spec"); DoError (ILLEGAL_FEATURE_PARAM, "Illegal feature parameter spec");
#ifndef WIN32 #ifndef _WIN32
assert (!isnan(Feature->Params[i])); assert (!isnan(Feature->Params[i]));
#endif #endif
} }
@ -230,7 +230,7 @@ void WriteFeature(FILE *File, FEATURE Feature) {
int i; int i;
for (i = 0; i < Feature->Type->NumParams; i++) { for (i = 0; i < Feature->Type->NumParams; i++) {
#ifndef WIN32 #ifndef _WIN32
assert(!isnan(Feature->Params[i])); assert(!isnan(Feature->Params[i]));
#endif #endif
fprintf(File, " %g", Feature->Params[i]); fprintf(File, " %g", Feature->Params[i]);

View File

@ -98,20 +98,6 @@ if test "$enable_embedded" = "yes"; then
AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED]) AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED])
fi 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 # check whether to build multiple libraries
AC_MSG_CHECKING(--enable-multiple-libraries argument) AC_MSG_CHECKING(--enable-multiple-libraries argument)
AC_ARG_ENABLE([multiple-libraries], AC_ARG_ENABLE([multiple-libraries],

View File

@ -28,7 +28,7 @@ using std::min;
using std::max; using std::max;
#endif #endif
#ifdef WIN32 #ifdef _WIN32
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
#endif #endif

View File

@ -29,7 +29,7 @@
#include "const.h" #include "const.h"
#include "char_samp.h" #include "char_samp.h"
#ifdef WIN32 #ifdef _WIN32
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
#endif #endif

View File

@ -30,7 +30,7 @@
#include <stdio.h> #include <stdio.h>
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include <math.h> #include <math.h>
#ifdef WIN32 #ifdef _WIN32
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
#endif #endif

View File

@ -21,7 +21,7 @@
// thread/process creation & synchronization and network connection. // thread/process creation & synchronization and network connection.
#include <stdio.h> #include <stdio.h>
#ifdef WIN32 #ifdef _WIN32
struct addrinfo { struct addrinfo {
struct sockaddr* ai_addr; struct sockaddr* ai_addr;
int ai_addrlen; int ai_addrlen;
@ -64,7 +64,7 @@ const int kMaxMsgSize = 4096;
// Signals a thread to exit. // Signals a thread to exit.
void SVSync::ExitThread() { void SVSync::ExitThread() {
#ifdef WIN32 #ifdef _WIN32
// ExitThread(0); // ExitThread(0);
#else #else
pthread_exit(0); pthread_exit(0);
@ -73,7 +73,7 @@ void SVSync::ExitThread() {
// Starts a new process. // Starts a new process.
void SVSync::StartProcess(const char* executable, const char* args) { void SVSync::StartProcess(const char* executable, const char* args) {
#ifdef WIN32 #ifdef _WIN32
std::string proc; std::string proc;
proc.append(executable); proc.append(executable);
proc.append(" "); proc.append(" ");
@ -123,7 +123,7 @@ void SVSync::StartProcess(const char* executable, const char* args) {
} }
SVSemaphore::SVSemaphore() { SVSemaphore::SVSemaphore() {
#ifdef WIN32 #ifdef _WIN32
semaphore_ = CreateSemaphore(0, 0, 10, 0); semaphore_ = CreateSemaphore(0, 0, 10, 0);
#else #else
sem_init(&semaphore_, 0, 0); sem_init(&semaphore_, 0, 0);
@ -131,7 +131,7 @@ SVSemaphore::SVSemaphore() {
} }
void SVSemaphore::Signal() { void SVSemaphore::Signal() {
#ifdef WIN32 #ifdef _WIN32
ReleaseSemaphore(semaphore_, 1, NULL); ReleaseSemaphore(semaphore_, 1, NULL);
#else #else
sem_post(&semaphore_); sem_post(&semaphore_);
@ -139,7 +139,7 @@ void SVSemaphore::Signal() {
} }
void SVSemaphore::Wait() { void SVSemaphore::Wait() {
#ifdef WIN32 #ifdef _WIN32
WaitForSingleObject(semaphore_, INFINITE); WaitForSingleObject(semaphore_, INFINITE);
#else #else
sem_wait(&semaphore_); sem_wait(&semaphore_);
@ -147,7 +147,7 @@ void SVSemaphore::Wait() {
} }
SVMutex::SVMutex() { SVMutex::SVMutex() {
#ifdef WIN32 #ifdef _WIN32
mutex_ = CreateMutex(0, FALSE, 0); mutex_ = CreateMutex(0, FALSE, 0);
#else #else
pthread_mutex_init(&mutex_, NULL); pthread_mutex_init(&mutex_, NULL);
@ -155,7 +155,7 @@ SVMutex::SVMutex() {
} }
void SVMutex::Lock() { void SVMutex::Lock() {
#ifdef WIN32 #ifdef _WIN32
WaitForSingleObject(mutex_, INFINITE); WaitForSingleObject(mutex_, INFINITE);
#else #else
pthread_mutex_lock(&mutex_); pthread_mutex_lock(&mutex_);
@ -163,7 +163,7 @@ void SVMutex::Lock() {
} }
void SVMutex::Unlock() { void SVMutex::Unlock() {
#ifdef WIN32 #ifdef _WIN32
ReleaseMutex(mutex_); ReleaseMutex(mutex_);
#else #else
pthread_mutex_unlock(&mutex_); pthread_mutex_unlock(&mutex_);
@ -173,7 +173,7 @@ void SVMutex::Unlock() {
// Create new thread. // Create new thread.
void SVSync::StartThread(void *(*func)(void*), void* arg) { void SVSync::StartThread(void *(*func)(void*), void* arg) {
#ifdef WIN32 #ifdef _WIN32
LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func; LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func;
DWORD threadid; DWORD threadid;
HANDLE newthread = CreateThread( HANDLE newthread = CreateThread(
@ -210,7 +210,7 @@ void SVNetwork::Flush() {
// This will always return one line of char* (denoted by \n). // This will always return one line of char* (denoted by \n).
char* SVNetwork::Receive() { char* SVNetwork::Receive() {
char* result = NULL; char* result = NULL;
#ifdef WIN32 #ifdef _WIN32
if (has_content) { result = strtok (NULL, "\n"); } if (has_content) { result = strtok (NULL, "\n"); }
#else #else
if (buffer_ptr_ != NULL) { result = strtok_r(NULL, "\n", &buffer_ptr_); } if (buffer_ptr_ != NULL) { result = strtok_r(NULL, "\n", &buffer_ptr_); }
@ -246,7 +246,7 @@ char* SVNetwork::Receive() {
if (i <= 0) { return NULL; } if (i <= 0) { return NULL; }
msg_buffer_in_[i] = '\0'; msg_buffer_in_[i] = '\0';
has_content = true; has_content = true;
#ifdef WIN32 #ifdef _WIN32
return strtok(msg_buffer_in_, "\n"); return strtok(msg_buffer_in_, "\n");
#else #else
// Setup a new string tokenizer. // Setup a new string tokenizer.
@ -257,7 +257,7 @@ char* SVNetwork::Receive() {
// Close the connection to the server. // Close the connection to the server.
void SVNetwork::Close() { void SVNetwork::Close() {
#ifdef WIN32 #ifdef _WIN32
closesocket(stream_); closesocket(stream_);
#else #else
close(stream_); close(stream_);
@ -267,7 +267,7 @@ void SVNetwork::Close() {
// The program to invoke to start ScrollView // The program to invoke to start ScrollView
static const char* ScrollViewProg() { static const char* ScrollViewProg() {
#ifdef WIN32 #ifdef _WIN32
const char* prog = "java -Xms512m -Xmx1024m"; const char* prog = "java -Xms512m -Xmx1024m";
#else #else
const char* prog = "sh"; 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 // exceptions in piccolo. Ideally piccolo would be debugged to make
// this unnecessary. // this unnecessary.
// Also the path has to be separated by ; on windows and : otherwise. // 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;" const char* cmd_template = "-Djava.library.path=%s -cp %s/ScrollView.jar;"
"%s/piccolo-1.2.jar;%s/piccolox-1.2.jar" "%s/piccolo-1.2.jar;%s/piccolox-1.2.jar"
" com.google.scrollview.ScrollView"; " com.google.scrollview.ScrollView";
@ -332,7 +332,7 @@ static int GetAddrInfoNonLinux(const char* hostname, int port,
(*addr_info)->ai_socktype = SOCK_STREAM; (*addr_info)->ai_socktype = SOCK_STREAM;
struct hostent *name; struct hostent *name;
#ifdef WIN32 #ifdef _WIN32
WSADATA wsaData; WSADATA wsaData;
WSAStartup(MAKEWORD(1, 1), &wsaData); WSAStartup(MAKEWORD(1, 1), &wsaData);
name = gethostbyname(hostname); name = gethostbyname(hostname);
@ -412,7 +412,7 @@ SVNetwork::SVNetwork(const char* hostname, int port) {
while (connect(stream_, (struct sockaddr *) addr_info->ai_addr, while (connect(stream_, (struct sockaddr *) addr_info->ai_addr,
addr_info->ai_addrlen) < 0) { addr_info->ai_addrlen) < 0) {
std::cout << "ScrollView: Waiting for server...\n"; std::cout << "ScrollView: Waiting for server...\n";
#ifdef WIN32 #ifdef _WIN32
Sleep(1000); Sleep(1000);
#else #else
sleep(1); sleep(1);

View File

@ -24,7 +24,7 @@
#ifndef TESSERACT_VIEWER_SVUTIL_H__ #ifndef TESSERACT_VIEWER_SVUTIL_H__
#define TESSERACT_VIEWER_SVUTIL_H__ #define TESSERACT_VIEWER_SVUTIL_H__
#ifdef WIN32 #ifdef _WIN32
#ifndef __GNUC__ #ifndef __GNUC__
#include <windows.h> #include <windows.h>
#define snprintf _snprintf #define snprintf _snprintf
@ -73,7 +73,7 @@ class SVSemaphore {
/// Wait on a semaphore. /// Wait on a semaphore.
void Wait(); void Wait();
private: private:
#ifdef WIN32 #ifdef _WIN32
HANDLE semaphore_; HANDLE semaphore_;
#else #else
sem_t semaphore_; sem_t semaphore_;
@ -91,7 +91,7 @@ class SVMutex {
/// Unlocks on a mutex. /// Unlocks on a mutex.
void Unlock(); void Unlock();
private: private:
#ifdef WIN32 #ifdef _WIN32
HANDLE mutex_; HANDLE mutex_;
#else #else
pthread_mutex_t mutex_; pthread_mutex_t mutex_;