mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-11 12:43:17 +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)
|
libtesseract_la_LDFLAGS += -version-info $(GENERIC_LIBRARY_VERSION)
|
||||||
|
|
||||||
bin_PROGRAMS = tesseract
|
bin_PROGRAMS = tesseract
|
||||||
tesseract_SOURCES = $(top_srcdir)/api/tesseractmain.cpp
|
tesseract_SOURCES = tesseractmain.cpp
|
||||||
tesseract_CPPFLAGS = $(AM_CPPFLAGS)
|
tesseract_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
if VISIBILITY
|
if VISIBILITY
|
||||||
tesseract_CPPFLAGS += -DTESS_IMPORTS
|
tesseract_CPPFLAGS += -DTESS_IMPORTS
|
||||||
@ -78,7 +78,7 @@ if USE_OPENCL
|
|||||||
tesseract_LDADD += $(OPENCL_LIB)
|
tesseract_LDADD += $(OPENCL_LIB)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if MINGW
|
if T_WIN
|
||||||
tesseract_LDADD += -lws2_32
|
tesseract_LDADD += -lws2_32
|
||||||
libtesseract_la_LDFLAGS += -no-undefined -Wl,--as-needed -lws2_32
|
libtesseract_la_LDFLAGS += -no-undefined -Wl,--as-needed -lws2_32
|
||||||
endif
|
endif
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
AUTOMAKE_OPTIONS = subdir-objects
|
||||||
SUBDIRS =
|
SUBDIRS =
|
||||||
AM_CXXFLAGS =
|
AM_CXXFLAGS =
|
||||||
|
|
||||||
@ -40,8 +41,7 @@ libtesseract_ccutil_la_SOURCES = \
|
|||||||
unichar.cpp unicharmap.cpp unicharset.cpp unicodes.cpp \
|
unichar.cpp unicharmap.cpp unicharset.cpp unicodes.cpp \
|
||||||
params.cpp universalambigs.cpp
|
params.cpp universalambigs.cpp
|
||||||
|
|
||||||
|
if T_WIN
|
||||||
if MINGW
|
|
||||||
AM_CPPFLAGS += -I$(top_srcdir)/vs2008/port -DWINDLLNAME=\"lib@GENERIC_LIBRARY_NAME@\"
|
AM_CPPFLAGS += -I$(top_srcdir)/vs2008/port -DWINDLLNAME=\"lib@GENERIC_LIBRARY_NAME@\"
|
||||||
noinst_HEADERS += ../vs2010/port/strtok_r.h
|
noinst_HEADERS += ../vs2010/port/strtok_r.h
|
||||||
libtesseract_ccutil_la_SOURCES += ../vs2010/port/strtok_r.cpp
|
libtesseract_ccutil_la_SOURCES += ../vs2010/port/strtok_r.cpp
|
||||||
|
@ -24,13 +24,13 @@
|
|||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "universalambigs.h"
|
#include "universalambigs.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined _WIN32 || defined(__CYGWIN__)
|
||||||
#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 __CYGWIN__*/
|
||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "tprintf.h"
|
#include "tprintf.h"
|
||||||
|
|
||||||
// workaround for "'off_t' was not declared in this scope" with -std=c++11
|
// 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;
|
typedef long off_t;
|
||||||
#endif // 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
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
# default conditional
|
# default conditional
|
||||||
AM_CONDITIONAL(MINGW, false)
|
AM_CONDITIONAL(T_WIN, false)
|
||||||
AM_CONDITIONAL(OSX, false)
|
AM_CONDITIONAL(OSX, false)
|
||||||
AM_CONDITIONAL(GRAPHICS_DISABLED, false)
|
AM_CONDITIONAL(GRAPHICS_DISABLED, false)
|
||||||
|
|
||||||
@ -77,12 +77,14 @@ AC_CANONICAL_HOST
|
|||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
mingw32*)
|
mingw32*)
|
||||||
AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
|
AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
|
||||||
AM_CONDITIONAL(MINGW, true)
|
AM_CONDITIONAL(T_WIN, true)
|
||||||
AM_CONDITIONAL(ADD_RT, false)
|
AM_CONDITIONAL(ADD_RT, false)
|
||||||
AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed'])
|
AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed'])
|
||||||
;;
|
;;
|
||||||
cygwin*)
|
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*)
|
solaris*)
|
||||||
LIBS="-lsocket -lnsl -lrt -lxnet"
|
LIBS="-lsocket -lnsl -lrt -lxnet"
|
||||||
@ -408,13 +410,9 @@ AM_CONDITIONAL(ENABLE_TRAINING, $have_cairo)
|
|||||||
|
|
||||||
# set c++11 support based on platform/compiler
|
# set c++11 support based on platform/compiler
|
||||||
if test "x$has_cpp11" = "xyes"; then
|
if test "x$has_cpp11" = "xyes"; then
|
||||||
case "$host" in
|
case "${host_os}" in
|
||||||
cygwin*)
|
cygwin*)
|
||||||
if test "x$snprintfworks" = "xno"; then
|
CXXFLAGS="$CXXFLAGS -std=gnu++11"
|
||||||
# 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
|
|
||||||
;;
|
;;
|
||||||
*-darwin* | *-macos10*)
|
*-darwin* | *-macos10*)
|
||||||
if test "x$CLANG" = "xyes"; then
|
if test "x$CLANG" = "xyes"; then
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
AUTOMAKE_OPTIONS = subdir-objects
|
||||||
AM_CPPFLAGS += \
|
AM_CPPFLAGS += \
|
||||||
-DUSE_STD_NAMESPACE -DPANGO_ENABLE_ENGINE\
|
-DUSE_STD_NAMESPACE -DPANGO_ENABLE_ENGINE\
|
||||||
-I$(top_srcdir)/ccmain -I$(top_srcdir)/api \
|
-I$(top_srcdir)/ccmain -I$(top_srcdir)/api \
|
||||||
@ -9,7 +10,7 @@ AM_CPPFLAGS += \
|
|||||||
|
|
||||||
EXTRA_DIST = tesstrain.sh
|
EXTRA_DIST = tesstrain.sh
|
||||||
|
|
||||||
if MINGW
|
if T_WIN
|
||||||
# try static build
|
# try static build
|
||||||
#AM_LDFLAGS += -all-static
|
#AM_LDFLAGS += -all-static
|
||||||
#libic=-lsicuin -licudt -lsicuuc
|
#libic=-lsicuin -licudt -lsicuuc
|
||||||
@ -279,7 +280,7 @@ wordlist2dawg_LDADD += \
|
|||||||
../api/libtesseract.la
|
../api/libtesseract.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if MINGW
|
if T_WIN
|
||||||
ambiguous_words_LDADD += -lws2_32
|
ambiguous_words_LDADD += -lws2_32
|
||||||
classifier_tester_LDADD += -lws2_32
|
classifier_tester_LDADD += -lws2_32
|
||||||
cntraining_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).
|
// 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
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
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_); }
|
||||||
|
Loading…
Reference in New Issue
Block a user