Improved autoconf to find leptonica headers if present

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@168 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
theraysmith 2008-04-22 17:34:42 +00:00
parent 3cf46f21d4
commit f3e67dd89b
6 changed files with 281 additions and 90 deletions

View File

@ -56,4 +56,7 @@ April 21 2008 - V2.02 (again)
Fixed namespace collisions with jpeg library (INT32).
Portability fixes for Windows for new code.
Updates to autoconf system for new code.
April 22 2008 - V2.03
Fixed crash introduced in 2.02.
Fixed lack of tessembedded.cpp in distribution.
Added test for leptonica header files and conditional test for lib.

View File

@ -1,3 +1,8 @@
Tesseract release notes April 22 2008 - V2.03
2.02 was unrunnable, due to a last-minute "simple" change.
2.03 fixes the problem and also adds an include check for leptonica
to make it more usable.
Tesseract release notes April 21 2008 - V2.02
Improvements to clustering, training and classifier.
Major internationalization improvements for large-character-set

View File

@ -78,6 +78,8 @@ SUBDIRS =
AM_CPPFLAGS = -I$(top_srcdir)/ccutil -I$(top_srcdir)/ccstruct -I$(top_srcdir)/image -I$(top_srcdir)/viewer -I$(top_srcdir)/ccops -I$(top_srcdir)/dict -I$(top_srcdir)/classify -I$(top_srcdir)/wordrec -I$(top_srcdir)/cutil -I$(top_srcdir)/textord
EXTRA_DIST = tessembedded.cpp
include_HEADERS = adaptions.h applybox.h baseapi.h blobcmp.h callnet.h charcut.h control.h docqual.h expandblob.h fixspace.h fixxht.h imgscale.h matmatch.h output.h paircmp.h reject.h scaleimg.h tessbox.h tessedit.h tesseractmain.h tessvars.h tfacep.h pagewalk.h pgedit.h varabled.h tessembedded.h tessio.h tfacepp.h tstruct.h werdit.h

View File

@ -9,6 +9,9 @@
/* Define to 1 if you have the `acos' function. */
#undef HAVE_ACOS
/* Define to 1 if you have the <allheaders.h> header file. */
#undef HAVE_ALLHEADERS_H
/* Define to 1 if you have the `asin' function. */
#undef HAVE_ASIN

331
configure vendored
View File

@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac Id: configure.ac.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for tesseract 2.02.
# Generated by GNU Autoconf 2.59 for tesseract 2.03.
#
# Report bugs to <theraysmith@gmail.com>.
#
@ -270,8 +270,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='tesseract'
PACKAGE_TARNAME='tesseract'
PACKAGE_VERSION='2.02'
PACKAGE_STRING='tesseract 2.02'
PACKAGE_VERSION='2.03'
PACKAGE_STRING='tesseract 2.03'
PACKAGE_BUGREPORT='theraysmith@gmail.com'
ac_unique_file="ccmain/tesseractmain.cpp"
@ -798,7 +798,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures tesseract 2.02 to adapt to many kinds of systems.
\`configure' configures tesseract 2.03 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -864,7 +864,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of tesseract 2.02:";;
short | recursive ) echo "Configuration of tesseract 2.03:";;
esac
cat <<\_ACEOF
@ -998,7 +998,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
tesseract configure 2.02
tesseract configure 2.03
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@ -1012,7 +1012,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by tesseract $as_me 2.02, which was
It was created by tesseract $as_me 2.03, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@ -1434,8 +1434,8 @@ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Define date of package, etc. Could be useful in auto-generated
# documentation.
# TODO(luc) Generate good documentation using doxygen or equivalent
PACKAGE_YEAR=2007
PACKAGE_DATE="07/2007"
PACKAGE_YEAR=2008
PACKAGE_DATE="04/22"
cat >>confdefs.h <<_ACEOF
@ -3759,79 +3759,6 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for pixCreate in -llept" >&5
echo $ECHO_N "checking for pixCreate in -llept... $ECHO_C" >&6
if test "${ac_cv_lib_lept_pixCreate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-llept $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char pixCreate ();
int
main ()
{
pixCreate ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_lept_pixCreate=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_lept_pixCreate=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_lept_pixCreate" >&5
echo "${ECHO_T}$ac_cv_lib_lept_pixCreate" >&6
if test $ac_cv_lib_lept_pixCreate = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBLEPT 1
_ACEOF
LIBS="-llept $LIBS"
fi
echo "$as_me:$LINENO: checking for sem_init in -lpthread" >&5
echo $ECHO_N "checking for sem_init in -lpthread... $ECHO_C" >&6
if test "${ac_cv_lib_pthread_sem_init+set}" = set; then
@ -3905,6 +3832,93 @@ _ACEOF
fi
# Check location of leptonica/liblept headers.
have_lept=no
for incd in /usr/local/include /usr/include
do
for lept in . leptonica liblept
do
if test -r "$incd/$lept/allheaders.h" ; then
CPPFLAGS="$CPPFLAGS -I$incd/$lept"
have_lept=yes
fi
done
done
if test "$have_lept" = yes ; then
echo "$as_me:$LINENO: checking for pixCreate in -llept" >&5
echo $ECHO_N "checking for pixCreate in -llept... $ECHO_C" >&6
if test "${ac_cv_lib_lept_pixCreate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-llept $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char pixCreate ();
int
main ()
{
pixCreate ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_lept_pixCreate=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_lept_pixCreate=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_lept_pixCreate" >&5
echo "${ECHO_T}$ac_cv_lib_lept_pixCreate" >&6
if test $ac_cv_lib_lept_pixCreate = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBLEPT 1
_ACEOF
LIBS="-llept $LIBS"
fi
fi
# ----------------------------------------
# Checks for header files.
@ -4826,6 +4840,155 @@ fi
done
for ac_header in allheaders.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to theraysmith@gmail.com ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
# Enable use of system-defined bool type if available:
echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6
@ -7676,7 +7839,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by tesseract $as_me 2.02, which was
This file was extended by tesseract $as_me 2.03, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -7739,7 +7902,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
tesseract config.status 2.02
tesseract config.status 2.03
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -7,7 +7,7 @@
# ----------------------------------------
AC_PREREQ(2.50)
AC_INIT(tesseract, 2.02, theraysmith@gmail.com)
AC_INIT(tesseract, 2.03, theraysmith@gmail.com)
AC_REVISION($Id: configure.ac,v 1.4 2007/02/02 22:38:17 theraysmith Exp $)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR(ccmain/tesseractmain.cpp)
@ -17,8 +17,8 @@ AC_CANONICAL_HOST
# Define date of package, etc. Could be useful in auto-generated
# documentation.
# TODO(luc) Generate good documentation using doxygen or equivalent
PACKAGE_YEAR=2007
PACKAGE_DATE="07/2007"
PACKAGE_YEAR=2008
PACKAGE_DATE="04/22"
AC_DEFINE_UNQUOTED(PACKAGE_NAME,["${PACKAGE_NAME}"],[Name of package])
AC_DEFINE_UNQUOTED(PACKAGE_VERSION,["${PACKAGE_VERSION}"],[Version number])
@ -216,9 +216,23 @@ AC_LANG_CPLUSPLUS
AC_CHECK_LIB(z,deflate)
AC_CHECK_LIB(png,png_read_png)
AC_CHECK_LIB(jpeg,jpeg_read_scanlines)
AC_CHECK_LIB(lept,pixCreate)
AC_CHECK_LIB(pthread,sem_init)
# Check location of leptonica/liblept headers.
have_lept=no
for incd in /usr/local/include /usr/include
do
for lept in . leptonica liblept
do
if test -r "$incd/$lept/allheaders.h" ; then
CPPFLAGS="$CPPFLAGS -I$incd/$lept"
have_lept=yes
fi
done
done
if test "$have_lept" = yes ; then
AC_CHECK_LIB(lept,pixCreate)
fi
# ----------------------------------------
# Checks for header files.
@ -229,6 +243,7 @@ AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(sys/ipc.h sys/shm.h)
AC_CHECK_HEADERS(limits.h malloc.h)
AC_CHECK_HEADERS(allheaders.h)
# Enable use of system-defined bool type if available:
AC_HEADER_STDBOOL