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"
#ifdef USE_NLS
#ifdef USING_GETTEXT
#include <libintl.h>
#include <locale.h>
#define _(x) gettext(x)

View File

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

View File

@ -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

View File

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

View File

@ -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 <stdlib.h>
#include <stdio.h>

View File

@ -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 {

View File

@ -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_);

View File

@ -26,7 +26,7 @@
#include "params.h"
#include "unicharset.h"
#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
#else
#include <pthread.h>
@ -43,7 +43,7 @@ class CCUtilMutex {
void Unlock();
private:
#ifdef WIN32
#ifdef _WIN32
HANDLE mutex_;
#else
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[MFBulge2] = 0.0f;
#ifndef WIN32
#ifndef _WIN32
// Assert that feature parameters are well defined.
int 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++) {
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]);

View File

@ -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],

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
// thread/process creation & synchronization and network connection.
#include <stdio.h>
#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);

View File

@ -24,7 +24,7 @@
#ifndef TESSERACT_VIEWER_SVUTIL_H__
#define TESSERACT_VIEWER_SVUTIL_H__
#ifdef WIN32
#ifdef _WIN32
#ifndef __GNUC__
#include <windows.h>
#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_;