]>
Commit | Line | Data |
---|---|---|
f7537631 JB |
1 | --- tesseract-3.00/configure.ac.orig 1970-01-01 01:00:00.000000000 +0100 |
2 | +++ tesseract-3.00/configure.ac 2010-11-14 20:43:34.455103290 +0100 | |
3 | @@ -0,0 +1,436 @@ | |
4 | +# -*-Shell-script-*- | |
5 | +# | |
6 | +# Copyright (c) Luc Vincent | |
7 | + | |
8 | +# ---------------------------------------- | |
9 | +# Initialization | |
10 | +# ---------------------------------------- | |
11 | + | |
12 | +AC_PREREQ(2.50) | |
13 | +AC_CONFIG_MACRO_DIR([m4]) | |
14 | +AC_INIT(tesseract, 3.00, theraysmith@gmail.com) | |
15 | +AC_REVISION($Id$) | |
16 | +AC_CONFIG_AUX_DIR(config) | |
17 | +AC_CONFIG_SRCDIR(api/tesseractmain.cpp) | |
18 | +AC_PREFIX_DEFAULT(/usr/local) | |
19 | +AC_CANONICAL_HOST | |
20 | + | |
21 | +# Define date of package, etc. Could be useful in auto-generated | |
22 | +# documentation. | |
23 | +# TODO(luc) Generate good documentation using doxygen or equivalent | |
24 | +PACKAGE_YEAR=2010 | |
25 | +PACKAGE_DATE="09/30" | |
26 | + | |
27 | +AC_DEFINE_UNQUOTED(PACKAGE_NAME,["${PACKAGE_NAME}"],[Name of package]) | |
28 | +AC_DEFINE_UNQUOTED(PACKAGE_VERSION,["${PACKAGE_VERSION}"],[Version number]) | |
29 | +AC_DEFINE_UNQUOTED(PACKAGE_YEAR,"$PACKAGE_YEAR",[Official year for this release]) | |
30 | +AC_DEFINE_UNQUOTED(PACKAGE_DATE,"$PACKAGE_DATE",[Official date of release]) | |
31 | + | |
32 | +AC_SUBST(PACKAGE_NAME) | |
33 | +AC_SUBST(PACKAGE_VERSION) | |
34 | +AC_SUBST(PACKAGE_YEAR) | |
35 | +AC_SUBST(PACKAGE_DATE) | |
36 | + | |
37 | +GENERIC_LIBRARY_NAME=tesseract | |
38 | + | |
39 | +# Release versioning | |
40 | +GENERIC_MAJOR_VERSION=3 | |
41 | +GENERIC_MINOR_VERSION=0 | |
42 | +GENERIC_MICRO_VERSION=0 | |
43 | + | |
44 | +# API version (often = GENERIC_MAJOR_VERSION.GENERIC_MINOR_VERSION) | |
45 | +GENERIC_API_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION | |
46 | +GENERIC_LIBRARY_VERSION=$GENERIC_MAJOR_VERSION:$GENERIC_MINOR_VERSION | |
47 | +AC_SUBST(GENERIC_API_VERSION) | |
48 | +AC_SUBST(GENERIC_MAJOR_VERSION) | |
49 | + | |
50 | +AC_SUBST(GENERIC_LIBRARY_VERSION) | |
51 | +PACKAGE=$GENERIC_LIBRARY_NAME | |
52 | +AC_SUBST(GENERIC_LIBRARY_NAME) | |
53 | + | |
54 | +GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION | |
55 | +GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION | |
56 | +AC_SUBST(GENERIC_RELEASE) | |
57 | +AC_SUBST(GENERIC_VERSION) | |
58 | + | |
59 | +includedir="${includedir}/tesseract" | |
60 | + | |
61 | +AC_ARG_WITH(extra-includes, | |
62 | + AC_HELP_STRING([--with-extra-includes=DIR], | |
63 | + [Define an additional directory for include files]), | |
64 | + [ if test -d "$withval" ; then | |
65 | + CFLAGS="$CFLAGS -I$withval" | |
66 | + else | |
67 | + AC_MSG_ERROR([Cannot stat directory $withval]) | |
68 | + fi ] ) | |
69 | + | |
70 | +AC_ARG_WITH(extra-libraries, | |
71 | + AC_HELP_STRING([--with-extra-libraries=DIR], | |
72 | + [Define an additional directory for library files]), | |
73 | + [ if test -d "$withval" ; then | |
74 | + LDFLAGS="$LDFLAGS -L$withval" | |
75 | + else | |
76 | + AC_MSG_ERROR([Cannot stat directory $withval]) | |
77 | + fi ] ) | |
78 | + | |
79 | +AC_MSG_CHECKING(--enable-graphics argument) | |
80 | +AC_ARG_ENABLE([graphics], | |
81 | + [ --enable-graphics Enable graphics (ScrollView) (default).], | |
82 | + [enable_graphics=$enableval], | |
83 | + [enable_graphics="yes"]) | |
84 | +AC_MSG_RESULT($enable_graphics) | |
85 | +if test "$enable_graphics" = "no"; then | |
86 | + AC_DEFINE([DISABLE_GRAPHICS], [], [Disable graphics]) | |
87 | +fi | |
88 | + | |
89 | +localedir='${prefix}/share/locale' | |
90 | + | |
91 | +# Not used yet, so disable | |
92 | +#AC_ARG_ENABLE([gettext], | |
93 | +# [ --enable-gettext Enable gettext (default).], | |
94 | +# [enable_gettext=$enableval], | |
95 | +# [enable_gettext="yes"]) | |
96 | +#AC_MSG_RESULT($enable_gettext) | |
97 | +#if test "$enable_gettext" = "yes"; then | |
98 | +# AM_GNU_GETTEXT_VERSION([0.17]) | |
99 | +# AM_GNU_GETTEXT([external]) | |
100 | +# AC_SUBST(localedir) | |
101 | +#else | |
102 | +# AC_DEFINE([NO_GETTEXT], [], [Disable Gettext]) | |
103 | +#fi | |
104 | +#AM_CONDITIONAL([USING_GETTEXT], [test "$enable_gettext" = "yes"]) | |
105 | + | |
106 | +# Always look into a "gnu" directory. | |
107 | +curwd=`pwd` | |
108 | +if test -d $curwd/gnu/include ; then | |
109 | + CPPFLAGS="$CPPFLAGS -I$curwd/gnu/include" | |
110 | +fi | |
111 | +if test -d $curwd/gnu/lib ; then | |
112 | + LDFLAGS="$LDFLAGS -L$curwd/gnu/lib" | |
113 | +fi | |
114 | + | |
115 | +# Special cases | |
116 | +case "$host" in | |
117 | + *-darwin* | *-macos10*) | |
118 | + if test -d /opt/local ; then | |
119 | + CPPFLAGS="$CPPFLAGS -I/opt/local/include" | |
120 | + LDFLAGS="$LDFLAGS -L/opt/local/lib" | |
121 | + elif test -d /sw ; then | |
122 | + CPPFLAGS="$CPPFLAGS -I/sw/include" | |
123 | + LDFLAGS="$LDFLAGS -L/sw/lib" | |
124 | + fi | |
125 | + ;; | |
126 | +esac | |
127 | + | |
128 | +# ---------------------------------------- | |
129 | +# Check Compiler Characteristics and | |
130 | +# configure automake. The two appear to | |
131 | +# be intimately linked... | |
132 | +# ---------------------------------------- | |
133 | + | |
134 | +# Define order of compilers | |
135 | +AC_PROG_CXX(cl.exe g++) | |
136 | +# Not needed | |
137 | +# AC_PROG_CC | |
138 | + | |
139 | +AC_PROG_LIBTOOL | |
140 | + | |
141 | +# Automake configuration | |
142 | +# ---------------------------------------- | |
143 | + | |
144 | +# Note: may need to configure automake to use ZIP as a distribution | |
145 | +# format because of an apparent bug with GZIP, which results in bogus | |
146 | +# archives. | |
147 | +# TODO(luc) Resolve this issue. | |
148 | +#AM_INIT_AUTOMAKE(dist-zip) | |
149 | +AM_INIT_AUTOMAKE | |
150 | +AM_CONFIG_HEADER(config_auto.h:config/config.h.in) | |
151 | +#AM_PROG_CC_C_O | |
152 | +AM_MAINTAINER_MODE | |
153 | +# Need to tell automake if Visual C++ is being used: | |
154 | +AM_CONDITIONAL(USING_CL, test x$CC = xcl.exe) | |
155 | + | |
156 | +# Additional checking of compiler characteristics | |
157 | +# ---------------------------------------- | |
158 | + | |
159 | +# Check Endianness. If Big Endian, this will define WORDS_BIGENDIAN | |
160 | +# See also at end of this file, where we define INTEL_BYTE_ORDER | |
161 | +# or MOTOROLA_BYTE_ORDER. | |
162 | +AC_C_BIGENDIAN | |
163 | + | |
164 | + | |
165 | +# ---------------------------------------- | |
166 | +# Check for programs we need | |
167 | +# ---------------------------------------- | |
168 | + | |
169 | +# Check where all the following programs are and set | |
170 | +# variables accordingly: | |
171 | +LT_INIT | |
172 | +# AC_PROG_LN_S | |
173 | +# AC_PATH_PROG(MV, mv) | |
174 | +# AC_PATH_PROG(CP, cp) | |
175 | +# AC_PATH_PROG(RM, rm) | |
176 | +# AC_PATH_PROG(AR, ar) | |
177 | +# AC_PATH_PROG(TOUCH, touch) | |
178 | +# AC_PATH_PROG(SED, sed) | |
179 | +# AC_PATH_PROG(BASH, bash, ,[$PATH:/usr/bin:/util/tools/bin]) | |
180 | +# # To use substitution in makefiles, use something like: | |
181 | +# AC_SUBST(BASH) | |
182 | + | |
183 | +# TODO(luc) Handle documentation. None of the following | |
184 | +# is really needed until then | |
185 | +# | |
186 | +# AC_PROG_DOXYGEN_VERSION(1.3.2,[DOXYGEN_OK=1]) | |
187 | +# AC_PATH_PROG(DOT, dot) | |
188 | +# AC_PATH_PROG(LATEX, latex) | |
189 | +# AC_PATH_PROG(DVIPS, dvips) | |
190 | +# AC_PATH_PROG(MAKEINDEX, makeindex) | |
191 | +# AC_PATH_PROG(PDFLATEX, pdflatex) | |
192 | +# AC_PATH_PROG(GZIP, gzip) | |
193 | +# | |
194 | +# if test -z "$DOXYGEN_OK" -o -z "$DOT"; then | |
195 | +# AC_MSG_WARN([------------------------------------ | |
196 | +# *** Disabling automatic documentation generation for this | |
197 | +# *** package. Please check that you have 'doxygen' (version | |
198 | +# *** $ac_doxygen_version or later) and 'graphviz' (aka, 'dot') | |
199 | +# *** installed on your system. In addition, to generate | |
200 | +# *** PostScript and PDF documentation, you will need to have | |
201 | +# *** LaTeX and PdfLaTeX respectively. Re-run this configuration | |
202 | +# *** script after you have updated your environment. | |
203 | +# --------------------------------------------------------]) | |
204 | +# | |
205 | +# # We have appropriate version of doxygen and dot, so we | |
206 | +# # can generate documentation. It remains to be seen whether | |
207 | +# # we can generate PDF and PostScript documentation.. | |
208 | +# else | |
209 | +# GENERATE_DOCUMENTATION="true" | |
210 | +# | |
211 | +# # Determine if PostScript documentation is generated: | |
212 | +# if test -z "$LATEX" -o -z "$DVIPS" -o -z "$MAKEINDEX"; then | |
213 | +# AC_MSG_WARN([Disabling generation of PostScript documentation]) | |
214 | +# else | |
215 | +# GENERATE_PS_DOCUMENTATION="true" | |
216 | +# fi | |
217 | +# | |
218 | +# # Determine if PDF documentation is generated: | |
219 | +# if test -z "$PDFLATEX" -o -z "$MAKEINDEX"; then | |
220 | +# AC_MSG_WARN([Disabling generation of PDF documentation]) | |
221 | +# else | |
222 | +# GENERATE_PDF_DOCUMENTATION="true" | |
223 | +# fi | |
224 | +# fi | |
225 | +# | |
226 | +# # These substitutions could be inside the 'else' | |
227 | +# # conditionals above, but it is not necessary and would | |
228 | +# # only cause some confusion... | |
229 | +# AC_SUBST(DOXYGEN) | |
230 | +# AC_SUBST(DOT) | |
231 | +# AC_SUBST(LATEX) | |
232 | +# AC_SUBST(DVIPS) | |
233 | +# AC_SUBST(MAKEINDEX) | |
234 | +# AC_SUBST(PDFLATEX) | |
235 | +# AC_SUBST(GZIP) | |
236 | +# | |
237 | +# # Adjust makefiles based on the kind of documentation that | |
238 | +# # is being generated, | |
239 | +# AM_CONDITIONAL(GENERATE_DOCUMENTATION, test -n "$GENERATE_DOCUMENTATION") | |
240 | +# AM_CONDITIONAL(GENERATE_PS_DOCUMENTATION, test -n "$GENERATE_PS_DOCUMENTATION") | |
241 | +# AM_CONDITIONAL(GENERATE_PDF_DOCUMENTATION, test -n "$GENERATE_PDF_DOCUMENTATION") | |
242 | + | |
243 | + | |
244 | +# Test for GNUWIN32 tools (only useful under windows) | |
245 | +# AC_PATH_GNUWIN32 | |
246 | + | |
247 | +# ---------------------------------------- | |
248 | +# C++ related options | |
249 | +# ---------------------------------------- | |
250 | + | |
251 | +AC_LANG_CPLUSPLUS | |
252 | + | |
253 | +# Enable --enable-debug or --disable-debug and set | |
254 | +# compile options accordingly. We are supposed to be either | |
255 | +# in debug mode or in optimize mode. Note that in debug mode, | |
256 | +# DEBUG_MODE will be set by this macro | |
257 | +# AC_CXX_OPTIMIZE | |
258 | +# AC_CXX_BOOL | |
259 | +# AC_CXX_TYPENAME | |
260 | +# AC_CXX_STDINCLUDES | |
261 | +# AC_CXX_RPO | |
262 | + | |
263 | +# ---------------------------------------- | |
264 | +# Check for libraries | |
265 | +# ---------------------------------------- | |
266 | + | |
267 | +# This option seems to always add -lm to the link line, | |
268 | +# which causes unnecessary warnings with Visual C++. | |
269 | +# Comment it out for now. | |
270 | +#AC_CHECK_LIB(m,sqrt) | |
271 | +AC_CHECK_LIB(z,deflate) | |
272 | +AC_CHECK_LIB(png,png_read_png) | |
273 | +AC_CHECK_LIB(jpeg,jpeg_read_scanlines) | |
274 | +AC_CHECK_LIB(pthread,sem_init) | |
275 | + | |
276 | +# ---------------------------------------- | |
277 | +# Checks for header files. | |
278 | +# ---------------------------------------- | |
279 | + | |
280 | +AC_HEADER_STDC | |
281 | +AC_HEADER_TIME | |
282 | +AC_HEADER_SYS_WAIT | |
283 | +AC_CHECK_HEADERS(sys/ipc.h sys/shm.h) | |
284 | +AC_CHECK_HEADERS(limits.h malloc.h) | |
285 | +AC_CHECK_HEADERS(allheaders.h) | |
286 | +# Enable use of system-defined bool type if available: | |
287 | +AC_HEADER_STDBOOL | |
288 | + | |
289 | +# Misc | |
290 | +AC_SYS_INTERPRETER | |
291 | +AC_SYS_LARGEFILE | |
292 | + | |
293 | + | |
294 | +# ---------------------------------------- | |
295 | +# Checks for typedefs, structures, and compiler characteristics. | |
296 | +# ---------------------------------------- | |
297 | + | |
298 | +AC_CHECK_TYPES(wchar_t) | |
299 | +AC_CHECK_TYPES(long long int) | |
300 | +AC_CHECK_TYPES(mbstate_t,,,[#include "wchar.h"]) | |
301 | + | |
302 | +#AC_TYPE_MODE_T | |
303 | +#AC_TYPE_OFF_T | |
304 | +AC_TYPE_SIZE_T | |
305 | +#AC_TYPE_PID_T | |
306 | + | |
307 | + | |
308 | +# ---------------------------------------- | |
309 | +# Checks for library functions. | |
310 | +# ---------------------------------------- | |
311 | + | |
312 | +AC_FUNC_MMAP | |
313 | +AC_FUNC_FORK | |
314 | +AC_CHECK_FUNCS(strerror vsnprintf) | |
315 | +AC_CHECK_FUNCS(gethostname) | |
316 | +AC_CHECK_FUNCS(strchr memcpy) | |
317 | +AC_CHECK_FUNCS(acos asin) | |
318 | + | |
319 | +# ---------------------------------------- | |
320 | +# Test auxilliary packages | |
321 | +# ---------------------------------------- | |
322 | + | |
323 | +# Search JPEG library - not needed at the moment | |
324 | +# AC_PATH_JPEG(, | |
325 | +# [ no_jpeg=yes | |
326 | +# AC_MSG_WARN([JPEG support is disabled]) ]) | |
327 | + | |
328 | +# Search LIBTIFF library | |
329 | +AC_PATH_LIBTIFF(, | |
330 | +[ no_libtiff=yes | |
331 | + AC_MSG_WARN([TIFF support is disabled]) ]) | |
332 | + | |
333 | +# Check location of leptonica/liblept headers. | |
334 | +have_lept=no | |
335 | +for incd in /usr/local/include /usr/include | |
336 | +do | |
337 | + for lept in . leptonica liblept | |
338 | + do | |
339 | + if test -r "$incd/$lept/allheaders.h" ; then | |
340 | + CPPFLAGS="$CPPFLAGS -I$incd/$lept" | |
341 | + have_lept=yes | |
342 | + fi | |
343 | + done | |
344 | +done | |
345 | +if test "$have_lept" = yes ; then | |
346 | +AC_CHECK_LIB(lept,pixCreate) | |
347 | +fi | |
348 | + | |
349 | + | |
350 | +# ---------------------------------------- | |
351 | +# Final Tasks and Output | |
352 | +# ---------------------------------------- | |
353 | + | |
354 | +# Define installation paths | |
355 | +# AC_DEFINE_INSTALL_PATHS | |
356 | +# Redundant with PACKAGE_VERSION - comment out | |
357 | +# AC_DEFINE_UNQUOTED(TESSERACT_VERSION,["${PACKAGE_VERSION}"],[version string]) | |
358 | + | |
359 | +# Output files | |
360 | +AC_CONFIG_FILES(Makefile) | |
361 | +#if test "$enable_gettext" = "yes"; then | |
362 | +#AC_CONFIG_FILES(po/Makefile.in) | |
363 | +#fi | |
364 | +AC_CONFIG_FILES(api/Makefile) | |
365 | +AC_CONFIG_FILES(ccmain/Makefile) | |
366 | +AC_CONFIG_FILES(ccstruct/Makefile) | |
367 | +AC_CONFIG_FILES(ccutil/Makefile) | |
368 | +AC_CONFIG_FILES(classify/Makefile) | |
369 | +AC_CONFIG_FILES(cutil/Makefile) | |
370 | +AC_CONFIG_FILES(dict/Makefile) | |
371 | +AC_CONFIG_FILES(image/Makefile) | |
372 | +AC_CONFIG_FILES(textord/Makefile) | |
373 | +AC_CONFIG_FILES(viewer/Makefile) | |
374 | +AC_CONFIG_FILES(wordrec/Makefile) | |
375 | +AC_CONFIG_FILES(training/Makefile) | |
376 | +AC_CONFIG_FILES(tessdata/Makefile) | |
377 | +AC_CONFIG_FILES(tessdata/configs/Makefile) | |
378 | +AC_CONFIG_FILES(tessdata/tessconfigs/Makefile) | |
379 | +AC_CONFIG_FILES(testing/Makefile) | |
380 | +AC_CONFIG_FILES(vs2008/Makefile) | |
381 | +AC_CONFIG_FILES(vs2008/dlltest/Makefile) | |
382 | +AC_CONFIG_FILES(vs2008/include/Makefile) | |
383 | +AC_CONFIG_FILES(vs2008/include/leptonica/Makefile) | |
384 | +if test "$enable_graphics" = "yes"; then | |
385 | +AC_CONFIG_FILES(java/Makefile) | |
386 | +AC_CONFIG_FILES(java/com/Makefile) | |
387 | +AC_CONFIG_FILES(java/com/google/Makefile) | |
388 | +AC_CONFIG_FILES(java/com/google/scrollview/Makefile) | |
389 | +AC_CONFIG_FILES(java/com/google/scrollview/events/Makefile) | |
390 | +AC_CONFIG_FILES(java/com/google/scrollview/ui/Makefile) | |
391 | +fi | |
392 | +# AC_CONFIG_FILES(doc/Doxyfile) | |
393 | +# AC_CONFIG_FILES(doc/header.html) | |
394 | +# AC_CONFIG_FILES(doc/footer.html) | |
395 | +# AC_CONFIG_FILES(doc/header.tex) | |
396 | +# AC_CONFIG_FILES(doc/RTF_ExtensionFile) | |
397 | +# AC_CONFIG_FILES(doc/Makefile) | |
398 | +AC_OUTPUT | |
399 | + | |
400 | +# Final message | |
401 | +echo "" | |
402 | +echo "Configuration is done." | |
403 | +echo "You can now build $PACKAGE_NAME by running:" | |
404 | +# test x$GXX = xyes && \ | |
405 | +# echo "% make depend [optional]" | |
406 | +echo "" | |
407 | +echo "% make" | |
408 | + | |
409 | +# ---------------------------------------- | |
410 | +# CONFIG Template | |
411 | +# ---------------------------------------- | |
412 | + | |
413 | +# Fence added in configuration file | |
414 | +AH_TOP([ | |
415 | +#ifndef CONFIG_AUTO_H | |
416 | +#define CONFIG_AUTO_H | |
417 | +/* config_auto.h: begin */ | |
418 | +]) | |
419 | + | |
420 | +# Stuff added at bottom of file | |
421 | +AH_BOTTOM([ | |
422 | + | |
423 | +/* Miscellaneous defines */ | |
424 | +#define AUTOCONF 1 | |
425 | + | |
426 | +#ifdef DISABLE_GRAPHICS | |
427 | +#define GRAPHICS_DISABLED | |
428 | +#endif | |
429 | + | |
430 | +/* Not used yet | |
431 | +#ifndef NO_GETTEXT | |
432 | +#define USING_GETTEXT | |
433 | +#endif | |
434 | +*/ | |
435 | + | |
436 | +/* config_auto.h: end */ | |
437 | +#endif | |
438 | +]) | |
439 | + | |
440 | --- tesseract-3.00/acinclude.m4.orig 1970-01-01 01:00:00.000000000 +0100 | |
441 | +++ tesseract-3.00/acinclude.m4 2010-11-14 20:50:19.967101613 +0100 | |
442 | @@ -0,0 +1,156 @@ | |
443 | +dnl ------------------------------------------------------------------ | |
444 | +dnl @synopsis AC_PATH_LIBTIFF([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | |
445 | +dnl Process option --with-libtiff. | |
446 | +dnl Search LIBTIFF along the extra | |
447 | +dnl Define HAVE_LIBTIFF. | |
448 | +dnl Set output variable LIBTIFF_CFLAGS and LIBTIFF_LIBS | |
449 | +dnl -- inspired from previous AC_PATH_JPEG | |
450 | +dnl ------------------------------------------------------------------ | |
451 | +AC_DEFUN([AC_PATH_LIBTIFF], | |
452 | +[ | |
453 | + AC_REQUIRE([AC_CANONICAL_HOST]) | |
454 | + case $host in | |
455 | + *msdos* | *go32* | *mingw32* | *cygwin* | *windows*) | |
456 | + USING_WIN=yes | |
457 | + ;; | |
458 | + *) | |
459 | + USING_WIN=no | |
460 | + esac | |
461 | + AC_ARG_VAR(LIBTIFF_LIBS,[Tiff library to link against]) | |
462 | + AC_ARG_VAR(LIBTIFF_CFLAGS,[Compile flags needed for TIFF support]) | |
463 | + ac_libtiff=no | |
464 | + AC_ARG_WITH(libtiff, | |
465 | + AC_HELP_STRING([--with-libtiff=DIR], | |
466 | + [where the www.libtiff.org libtiff library is located]), | |
467 | + [ac_libtiff=$withval], [ac_libtiff=yes] ) | |
468 | + AC_MSG_CHECKING([for Leffler libtiff library]) | |
469 | + # Need to define TOP_SRCDIR for the cases where the LIBTIFF library | |
470 | + # is checked in with the code, at the top-level | |
471 | + TOP_SRCDIR=`cd $srcdir; pwd` | |
472 | + LOCAL_LIBTIFFDIR=$TOP_SRCDIR/libtiff | |
473 | + # First of all, deal with the case when 'cl.exe' is used as compiler | |
474 | + # indeed, when this is the case, we can only rely on finding | |
475 | + # the right library and includes, but we can't try compiling | |
476 | + # and linking. In addition, library needs to be specifically | |
477 | + # supplied on the link line and special flags are needed... | |
478 | + if test "x$CXX" = "xcl.exe" ; then | |
479 | + if test "x$ac_libtiff" = "xyes" ; then | |
480 | + # If LIBTIFF_LIBS has been set on configure command line | |
481 | + # or as environment variable, just use it if it exists | |
482 | + if test "x$LIBTIFF_LIBS" != "x" ; then | |
483 | + AC_MSG_RESULT(user specified as $LIBTIFF_LIBS) | |
484 | + if test "x$LIBTIFF_CFLAGS" = "x" ; then | |
485 | + AC_MSG_WARN(LIBTIFF_CFLAGS is empty) | |
486 | + fi | |
487 | + fi | |
488 | + # Otherwise, test if libtiff is at top level directory, under libtiff | |
489 | + if test "x$LIBTIFF_LIBS" = "x" && test -r "$LOCAL_LIBTIFFDIR/lib/libtiff.a" && test -r "$LOCAL_LIBTIFFDIR/lib/libjpeg.a" && test -r "$LOCAL_LIBTIFFDIR/lib/libz.a" ; then | |
490 | + AC_MSG_RESULT($LOCAL_LIBTIFFDIR/lib/libtiff.a) | |
491 | + LIBTIFF_LIBS="$LOCAL_LIBTIFFDIR/lib/libtiff.a $LOCAL_LIBTIFFDIR/lib/libjpeg.a $LOCAL_LIBTIFFDIR/lib/libz.a user32.lib" | |
492 | + LIBTIFF_CFLAGS="-I$LOCAL_LIBTIFFDIR/include" | |
493 | + fi | |
494 | + # Otherwise, if GnuWin32 was previously located | |
495 | + if test "x$LIBTIFF_LIBS" = "x" && test -r "$GNUWIN32_BASE/lib/libtiff.a" && test -r "$GNUWIN32_BASE/lib/libjpeg.a" && test -r "$GNUWIN32_BASE/lib/libz.a" ; then | |
496 | + AC_MSG_RESULT($GNUWIN32_BASE/lib/libtiff.a) | |
497 | + AC_MSG_WARN($GNUWIN32_BASE/lib/libtiff.a version 3.5.7 works. Some versions like 3.6.1 do not!) | |
498 | + LIBTIFF_LIBS="$GNUWIN32_BASE/lib/libtiff.a $GNUWIN32_BASE/lib/libjpeg.a $GNUWIN32_BASE/lib/libz.a user32.lib" | |
499 | + fi | |
500 | + if test "x$LIBTIFF_LIBS" = "x" ; then | |
501 | + AC_MSG_RESULT(not found or incomplete) | |
502 | + ac_libtiff=no | |
503 | + fi | |
504 | + elif test "x$ac_libtiff" != "xno" ; then | |
505 | + test x${LIBTIFF_LIBS+set} != xset && LIBTIFF_LIBS="$ac_libtiff/libtiff" | |
506 | + test x${LIBTIFF_CFLAGS+set} != xset && LIBTIFF_CFLAGS="-I$ac_libtiff" | |
507 | + fi | |
508 | + # If we are not using CL, that is we are either using gcc/cygwin | |
509 | + # or we are not running under Windows: | |
510 | + else | |
511 | + # Process specification | |
512 | + if test "x$ac_libtiff" = "xyes" ; then | |
513 | + if test "x$LIBTIFF_LIBS" = "x" ; then | |
514 | + # If local libtiff exists at top level, and we are running windows, use it first: | |
515 | + if test "x$USING_WIN" = "xyes" && test -r "$LOCAL_LIBTIFFDIR/lib/libtiff.a" && test -r "$LOCAL_LIBTIFFDIR/lib/libjpeg.a" && test -r "$LOCAL_LIBTIFFDIR/lib/libz.a" ; then | |
516 | + AC_MSG_RESULT($LOCAL_LIBTIFFDIR/lib/libtiff.a) | |
517 | + LIBTIFF_LIBS="$LOCAL_LIBTIFFDIR/lib/libtiff.a $LOCAL_LIBTIFFDIR/lib/libjpeg.a $LOCAL_LIBTIFFDIR/lib/libz.a -lole32 -luuid -lwsock32" | |
518 | + LIBTIFF_CFLAGS="-I$LOCAL_LIBTIFFDIR/include" | |
519 | + fi | |
520 | + # If GNUWIN32_BASE is defined, it means we are running under | |
521 | + # Windows and we should use these builds if available because | |
522 | + # they are the best bet | |
523 | + if test "x$LIBTIFF_LIBS" = "x" && test "x$GNUWIN32_BASE" != "x" ; then | |
524 | + # With version 3.5.7 of gnuwin32 libtiff, we do not need to link | |
525 | + # against "$GNUWIN32_BASE/lib/libgw32c.a", so no need to test | |
526 | + if test -r "$GNUWIN32_BASE/lib/libtiff.a" && test -r "$GNUWIN32_BASE/lib/libjpeg.a" && test -r "$GNUWIN32_BASE/lib/libz.a" ; then | |
527 | + AC_MSG_RESULT($GNUWIN32_BASE/lib/libtiff.a) | |
528 | + # With 3.5.7 version of libtiff, no need to add | |
529 | + # $GNUWIN32_BASE/lib/libgw32c.a after $GNUWIN32_BASE/lib/libz.a | |
530 | + LIBTIFF_LIBS="$GNUWIN32_BASE/lib/libtiff.a $GNUWIN32_BASE/lib/libjpeg.a $GNUWIN32_BASE/lib/libz.a -lole32 -luuid -lwsock32" | |
531 | + else | |
532 | + AC_MSG_RESULT([GNUWIN32 not found or incomplete. Trying something else]) | |
533 | + fi | |
534 | + fi | |
535 | + # If LIBTIFF_LIBS is still not defined after potentially going | |
536 | + # the GNUWIN32 route, then try using home built versions | |
537 | + if test "x$LIBTIFF_LIBS" = "x" ; then | |
538 | + TIFF_PACKAGE="$HOME_UNIX/packages/libtiff/libtiff" | |
539 | + if test -d "$TIFF_PACKAGE" ; then | |
540 | + LIBTIFF_LIBS="$TIFF_PACKAGE/libtiff.a" | |
541 | + LIBTIFF_CFLAGS="-I$TIFF_PACKAGE" | |
542 | + else | |
543 | + LIBTIFF_LIBS="-ltiff" | |
544 | + fi | |
545 | + fi | |
546 | + fi | |
547 | + elif test "x$ac_libtiff" != "xno" ; then | |
548 | + test "x${LIBTIFF_LIBS+set}" != "xset" && LIBTIFF_LIBS="$ac_libtiff/libtiff.a" | |
549 | + test "x${LIBTIFF_CFLAGS+set}" != "xset" && LIBTIFF_CFLAGS="-I$ac_libtiff" | |
550 | + fi | |
551 | + # Try linking - recall that -Wall is typically on, and any warning | |
552 | + # will cause this test to fail... This, by the way, is one of the | |
553 | + # reasons we cannot run this test when using the Microsoft compiler (cl), | |
554 | + # which outputs tons of "garbage" on stdout: | |
555 | + if test "x$ac_libtiff" != "xno" ; then | |
556 | + AC_MSG_CHECKING([linking with $LIBTIFF_LIBS]) | |
557 | + save_CFLAGS="$CFLAGS" | |
558 | + save_CXXFLAGS="$CXXFLAGS" | |
559 | + save_LIBS="$LIBS" | |
560 | + CFLAGS="$CFLAGS $LIBTIFF_CFLAGS" | |
561 | + CXXFLAGS="$CXXFLAGS $LIBTIFF_CFLAGS" | |
562 | + LIBS="$LIBS $LIBTIFF_LIBS -lm" | |
563 | + AC_TRY_LINK([ | |
564 | +#ifdef __cplusplus | |
565 | +extern "C" { | |
566 | +#endif | |
567 | +#include <stdio.h> | |
568 | +#include <tiffio.h> | |
569 | +#ifdef __cplusplus | |
570 | +} | |
571 | +#endif ],[ | |
572 | +TIFFClose((TIFF *) 0);], | |
573 | + [ac_libtiff=ok],[ac_libtiff=no]) | |
574 | + CFLAGS="$save_CFLAGS" | |
575 | + CXXFLAGS="$save_CXXFLAGS" | |
576 | + LIBS="$save_LIBS" | |
577 | + AC_MSG_RESULT($ac_libtiff) | |
578 | + fi | |
579 | + fi | |
580 | + # Finish | |
581 | + if test "x$ac_libtiff" = "xno"; then | |
582 | + LIBTIFF_CFLAGS= ; LIBTIFF_LIBS= | |
583 | + ifelse([$2],,:,[$2]) | |
584 | + else | |
585 | + AC_DEFINE(HAVE_LIBTIFF,1,[Define if you have the www.libtiff.org LIBTIFF library.]) | |
586 | + AC_MSG_RESULT([setting LIBTIFF_CFLAGS=$LIBTIFF_CFLAGS]) | |
587 | + AC_MSG_RESULT([setting LIBTIFF_LIBS=$LIBTIFF_LIBS]) | |
588 | + CFLAGS="$LIBTIFF_CFLAGS $CFLAGS" | |
589 | + CXXFLAGS="$LIBTIFF_CFLAGS $CXXFLAGS" | |
590 | + if test "x$CXX" = "xcl.exe" ; then | |
591 | + LIBS="$LIBTIFF_LIBS $LIBS" | |
592 | + else | |
593 | + LIBS="$LIBTIFF_LIBS $LIBS -lm" | |
594 | + fi | |
595 | + ifelse([$1],,:,[$1]) | |
596 | + fi | |
597 | + AM_CONDITIONAL(HAVE_LIBTIFF, test x$ac_libtiff != xno) | |
598 | +]) |