mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-23 18:49:08 +08:00
fix cygwin build (issue 1289)
This commit is contained in:
parent
f8613fab22
commit
c0640a4bef
@ -66,7 +66,7 @@ libtesseract_la_LIBADD = \
|
||||
libtesseract_la_LDFLAGS += -version-info $(GENERIC_LIBRARY_VERSION)
|
||||
|
||||
bin_PROGRAMS = tesseract
|
||||
tesseract_SOURCES = $(top_srcdir)/api/tesseractmain.cpp
|
||||
tesseract_SOURCES = tesseractmain.cpp
|
||||
tesseract_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
if VISIBILITY
|
||||
tesseract_CPPFLAGS += -DTESS_IMPORTS
|
||||
@ -78,7 +78,7 @@ if USE_OPENCL
|
||||
tesseract_LDADD += $(OPENCL_LIB)
|
||||
endif
|
||||
|
||||
if MINGW
|
||||
if T_WIN
|
||||
tesseract_LDADD += -lws2_32
|
||||
libtesseract_la_LDFLAGS += -no-undefined -Wl,--as-needed -lws2_32
|
||||
endif
|
||||
|
@ -1,3 +1,4 @@
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
SUBDIRS =
|
||||
AM_CXXFLAGS =
|
||||
|
||||
@ -40,8 +41,7 @@ libtesseract_ccutil_la_SOURCES = \
|
||||
unichar.cpp unicharmap.cpp unicharset.cpp unicodes.cpp \
|
||||
params.cpp universalambigs.cpp
|
||||
|
||||
|
||||
if MINGW
|
||||
if T_WIN
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/vs2008/port -DWINDLLNAME=\"lib@GENERIC_LIBRARY_NAME@\"
|
||||
noinst_HEADERS += ../vs2010/port/strtok_r.h
|
||||
libtesseract_ccutil_la_SOURCES += ../vs2010/port/strtok_r.cpp
|
||||
|
@ -24,13 +24,13 @@
|
||||
#include "helpers.h"
|
||||
#include "universalambigs.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined _WIN32 || defined(__CYGWIN__)
|
||||
#ifndef __GNUC__
|
||||
#define strtok_r strtok_s
|
||||
#else
|
||||
#include "strtok_r.h"
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* _WIN32 */
|
||||
#endif /* _WIN32 __CYGWIN__*/
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "tprintf.h"
|
||||
|
||||
// workaround for "'off_t' was not declared in this scope" with -std=c++11
|
||||
#if !defined(off_t) && !defined(__APPLE__)
|
||||
#if !defined(off_t) && !defined(__APPLE__) && !defined(__CYGWIN__)
|
||||
typedef long off_t;
|
||||
#endif // off_t
|
||||
|
||||
|
16
configure.ac
16
configure.ac
@ -62,7 +62,7 @@ AC_CONFIG_HEADERS(config_auto.h:config/config.h.in)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
# default conditional
|
||||
AM_CONDITIONAL(MINGW, false)
|
||||
AM_CONDITIONAL(T_WIN, false)
|
||||
AM_CONDITIONAL(OSX, false)
|
||||
AM_CONDITIONAL(GRAPHICS_DISABLED, false)
|
||||
|
||||
@ -77,12 +77,14 @@ AC_CANONICAL_HOST
|
||||
case "${host_os}" in
|
||||
mingw32*)
|
||||
AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
|
||||
AM_CONDITIONAL(MINGW, true)
|
||||
AM_CONDITIONAL(T_WIN, true)
|
||||
AM_CONDITIONAL(ADD_RT, false)
|
||||
AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed'])
|
||||
;;
|
||||
cygwin*)
|
||||
AM_CONDITIONAL(ADD_RT, false)
|
||||
AM_CONDITIONAL(ADD_RT, false)
|
||||
AM_CONDITIONAL(T_WIN, true)
|
||||
AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed'])
|
||||
;;
|
||||
solaris*)
|
||||
LIBS="-lsocket -lnsl -lrt -lxnet"
|
||||
@ -408,13 +410,9 @@ AM_CONDITIONAL(ENABLE_TRAINING, $have_cairo)
|
||||
|
||||
# set c++11 support based on platform/compiler
|
||||
if test "x$has_cpp11" = "xyes"; then
|
||||
case "$host" in
|
||||
case "${host_os}" in
|
||||
cygwin*)
|
||||
if test "x$snprintfworks" = "xno"; then
|
||||
# cygwin workaround
|
||||
# http://stackoverflow.com/questions/20149633/how-to-use-snprintf-in-g-std-c11-version-4-8-2/20149792#20149792
|
||||
CXXFLAGS="$CXXFLAGS -std=gnu++11"
|
||||
fi
|
||||
CXXFLAGS="$CXXFLAGS -std=gnu++11"
|
||||
;;
|
||||
*-darwin* | *-macos10*)
|
||||
if test "x$CLANG" = "xyes"; then
|
||||
|
@ -1,3 +1,4 @@
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
AM_CPPFLAGS += \
|
||||
-DUSE_STD_NAMESPACE -DPANGO_ENABLE_ENGINE\
|
||||
-I$(top_srcdir)/ccmain -I$(top_srcdir)/api \
|
||||
@ -9,7 +10,7 @@ AM_CPPFLAGS += \
|
||||
|
||||
EXTRA_DIST = tesstrain.sh
|
||||
|
||||
if MINGW
|
||||
if T_WIN
|
||||
# try static build
|
||||
#AM_LDFLAGS += -all-static
|
||||
#libic=-lsicuin -licudt -lsicuuc
|
||||
@ -279,7 +280,7 @@ wordlist2dawg_LDADD += \
|
||||
../api/libtesseract.la
|
||||
endif
|
||||
|
||||
if MINGW
|
||||
if T_WIN
|
||||
ambiguous_words_LDADD += -lws2_32
|
||||
classifier_tester_LDADD += -lws2_32
|
||||
cntraining_LDADD += -lws2_32
|
||||
|
@ -222,7 +222,7 @@ void SVNetwork::Flush() {
|
||||
// This will always return one line of char* (denoted by \n).
|
||||
char* SVNetwork::Receive() {
|
||||
char* result = NULL;
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
if (has_content) { result = strtok (NULL, "\n"); }
|
||||
#else
|
||||
if (buffer_ptr_ != NULL) { result = strtok_r(NULL, "\n", &buffer_ptr_); }
|
||||
|
Loading…
Reference in New Issue
Block a user