-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1284 lines (1020 loc) · 44.6 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl -*- Autoconf -*-
dnl Tag Image File Format (TIFF) Software
dnl
dnl Copyright (C) 2004, Andrey Kiselev <[email protected]>
dnl
dnl Permission to use, copy, modify, distribute, and sell this software and
dnl its documentation for any purpose is hereby granted without fee, provided
dnl that (i) the above copyright notices and this permission notice appear in
dnl all copies of the software and related documentation, and (ii) the names of
dnl Sam Leffler and Silicon Graphics may not be used in any advertising or
dnl publicity relating to the software without the specific, prior written
dnl permission of Sam Leffler and Silicon Graphics.
dnl
dnl THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
dnl EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
dnl WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
dnl
dnl IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
dnl ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
dnl OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
dnl WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
dnl LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
dnl OF THIS SOFTWARE.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.64)
AC_INIT([LibTIFF Software],[4.5.0],[[email protected]],[tiff])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(m4)
AC_LANG(C)
dnl Compute the canonical host (run-time) system type variable
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([dist-xz tar-ustar])
dnl Do not rebuild generated files every time
AM_MAINTAINER_MODE
dnl Versioning.
dnl Don't fill the ALPHA_VERSION field, if not applicable.
LIBTIFF_MAJOR_VERSION=4
LIBTIFF_MINOR_VERSION=5
LIBTIFF_MICRO_VERSION=0
LIBTIFF_ALPHA_VERSION=
LIBTIFF_VERSION=$LIBTIFF_MAJOR_VERSION.$LIBTIFF_MINOR_VERSION.$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION
dnl This will be used with the 'make release' target
LIBTIFF_RELEASE_DATE=`date +"%Y%m%d"`
dnl Libtool library revision control info
dnl See the libtool documentation under the heading "Libtool's versioning
dnl system" in order to understand the meaning of these fields
dnl
dnl current
dnl The most recent interface number that this library implements.
dnl revision
dnl The implementation number of the current interface.
dnl age
dnl The difference between the newest and oldest interfaces that
dnl this library implements. In other words, the library implements
dnl all the interface numbers in the range from number current -
dnl age to current.
dnl
dnl Here are a set of rules to help you update your library version
dnl information:
dnl
dnl 1. Start with version information of `0:0:0' for each libtool library.
dnl 2. Update the version information only immediately before a public
dnl release of your software. More frequent updates are unnecessary, and
dnl only guarantee that the current interface number gets larger faster.
dnl 3. If the library source code has changed at all since the last update,
dnl then increment revision (`c:r:a' becomes `c:r+1:a').
dnl 4. If any interfaces have been added, removed, or changed since the last
dnl update, increment current, and set revision to 0.
dnl 5. If any interfaces have been added since the last public release, then
dnl increment age.
dnl 6. If any interfaces have been removed since the last public release,
dnl then set age to 0.
LIBTIFF_CURRENT=6
LIBTIFF_REVISION=0
LIBTIFF_AGE=0
LIBTIFF_VERSION_INFO=$LIBTIFF_CURRENT:$LIBTIFF_REVISION:$LIBTIFF_AGE
# This is a special hack for OpenBSD and MirOS systems. The dynamic linker
# in OpenBSD uses some special semantics for shared libraries. Their soname
# contains only two numbers, major and minor.
# See http://bugzilla.remotesensing.org/show_bug.cgi?id=838 for details.
#case "$host_os" in
# openbsd* | mirbsd*)
# LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION:0
# ;;
# *)
# LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION:$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION
# ;;
#esac
AC_SUBST(LIBTIFF_MAJOR_VERSION)
AC_SUBST(LIBTIFF_MINOR_VERSION)
AC_SUBST(LIBTIFF_MICRO_VERSION)
AC_SUBST(LIBTIFF_ALPHA_VERSION)
AC_SUBST(LIBTIFF_VERSION)
AC_SUBST(LIBTIFF_VERSION_INFO)
AC_SUBST(LIBTIFF_RELEASE_DATE)
dnl Checks for programs.
AC_PROG_CC_C99
AM_PROG_CC_C_O
dnl We want warnings. As many warnings as possible.
VL_PROG_CC_WARNINGS()
dnl Checks for programs
AC_PROG_INSTALL
AC_PROG_LN_S
# Used only for validating the source distribution during distcheck
AC_PATH_PROG(CMAKE, cmake)
# Check if LD supports linker scripts, and define automake conditional
# HAVE_LD_VERSION_SCRIPT if so. This functionality is currently
# constrained to compilers using GNU ld on ELF systems or systems
# which provide an adequate emulation thereof.
AC_ARG_ENABLE([ld-version-script],
AS_HELP_STRING([--disable-ld-version-script],
[disable linker version script (default is enabled if supported)]),
[have_ld_version_script=$enableval], [have_ld_version_script=yes])
if test "$have_ld_version_script" != no; then
AC_MSG_CHECKING([if LD -Wl,--version-script works])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
cat > conftest.map <<EOF
VERS_1 {
global: sym;
};
VERS_2 {
global: sym;
} VERS_1;
EOF
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[have_ld_version_script=yes], [have_ld_version_script=no])
rm -f conftest.map
LDFLAGS="$save_LDFLAGS"
AC_MSG_RESULT($have_ld_version_script)
fi
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
dnl Tests for Windows
AC_EXEEXT
AC_OBJEXT
dnl initialize libtool
LT_INIT([win32-dll])
LT_LANG([C++])
# Enable support for silent build rules
AM_SILENT_RULES
tiff_libs_private=
AC_SUBST(tiff_libs_private)
tiff_requires_private=
AC_SUBST(tiff_requires_private)
AM_CONDITIONAL(BUILD_STATIC, test "$enable_static" = "yes")
dnl We don't need to add math library to all targets
case "${host_os}" in
cygwin* | mingw32* | beos* | darwin*)
;;
*)
AC_CHECK_LIB(m,sin,[libm_lib=yes], [libm_lib=no],)
if test "x$libm_lib" = "xyes" ; then
LIBS="-lm $LIBS"
tiff_libs_private="-lm ${tiff_libs_private}"
fi
;;
esac
dnl Checks for header files.
AC_CHECK_HEADERS([assert.h fcntl.h io.h search.h unistd.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_BIGENDIAN
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
dnl If the `fseeko' function is available, define `HAVE_FSEEKO'. Define
dnl `_LARGEFILE_SOURCE' if necessary.
AC_FUNC_FSEEKO
dnl Check if optarg (and presumably related externs) already declared in headers
AC_CHECK_DECLS([optarg])
dnl ---------------------------------------------------------------------------
dnl Deprecated features and backward compatibilty
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE([deprecated],
AS_HELP_STRING([--enable-deprecated],
[enable deprecated features (default is disabled)]),
[enable_deprecated=$enableval], [enable_deprecated=no])
if test "$enable_deprecated" = "yes"; then
# Disable deprecated features to ensure clean build
CPPFLAGS="-DTIFF_DISABLE_DEPRECATED $CPPFLAGS"
fi
dnl ---------------------------------------------------------------------------
dnl Compute sized types for current CPU and compiler options
dnl ---------------------------------------------------------------------------
# Obtain the size of 'size_t' and define as SIZEOF_SIZE_T. Result is
# available in ac_cv_sizeof_size_t
AC_CHECK_SIZEOF([size_t])
# C99 fixed-size integer types
INT8_T='int8_t'
UINT8_T='uint8_t'
INT16_T='int16_t'
UINT16_T='uint16_t'
INT32_T='int32_t'
UINT32_T='uint32_t'
INT64_T='int64_t'
UINT64_T='uint64_t'
if test $ac_cv_sizeof_size_t -eq 4
then
SSIZE_T='int32_t'
elif test $ac_cv_sizeof_size_t -eq 8
then
SSIZE_T='int64_t'
else
AC_MSG_ERROR([Unsupported size_t size ${ac_cv_sizeof_size_t}; please add support])
fi
# Determine TIFF equivalent of ssize_t
AC_MSG_CHECKING(for signed size type)
AC_MSG_RESULT($SSIZE_T)
AC_DEFINE_UNQUOTED(TIFF_SSIZE_T,$SSIZE_T,[Signed size type])
dnl Checks for library functions.
AC_CHECK_FUNCS([mmap setmode])
dnl Will use local replacements for unavailable functions
AC_REPLACE_FUNCS(getopt)
dnl ---------------------------------------------------------------------------
dnl Check the native cpu bit order.
dnl ---------------------------------------------------------------------------
AC_MSG_CHECKING([native cpu bit order])
case "$host_cpu" in
i*86*|x86_64*)
HOST_FILLORDER=FILLORDER_LSB2MSB
AC_MSG_RESULT([lsb2msb])
;;
*)
HOST_FILLORDER=FILLORDER_MSB2LSB
AC_MSG_RESULT([msb2lsb])
;;
esac
AC_DEFINE_UNQUOTED(HOST_FILLORDER, $HOST_FILLORDER, [Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB)])
dnl ---------------------------------------------------------------------------
dnl Configure legacy tifconf.h HOST_BIGENDIAN.
dnl ---------------------------------------------------------------------------
if test "$ac_cv_c_bigendian" = yes ; then
HOST_BIGENDIAN=1
else
HOST_BIGENDIAN=0
fi
AC_DEFINE_UNQUOTED(HOST_BIGENDIAN,$HOST_BIGENDIAN,[Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel)])
dnl ---------------------------------------------------------------------------
dnl Make the POSIX.2 features available.
dnl ---------------------------------------------------------------------------
#_POSIX_C_SOURCE=2
#AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE, $_POSIX_C_SOURCE, [Define this macro to a positive integer to control which POSIX functionality is made available.])
dnl ---------------------------------------------------------------------------
dnl Set the floating point format.
dnl FIXME: write appropriate test.
dnl ---------------------------------------------------------------------------
HAVE_IEEEFP=1
AC_DEFINE_UNQUOTED(HAVE_IEEEFP, $HAVE_IEEEFP, [Define as 0 or 1 according to the floating point format supported by the machine])
dnl ---------------------------------------------------------------------------
dnl Enable run-time paths to libraries usage.
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(rpath,
AS_HELP_STRING([--enable-rpath],
[Enable runtime linker paths (-R libtool option)]),
[HAVE_RPATH=$enableval], [HAVE_RPATH=no])
AM_CONDITIONAL(HAVE_RPATH, test "$HAVE_RPATH" = "yes")
dnl ---------------------------------------------------------------------------
dnl Support large files.
dnl ---------------------------------------------------------------------------
AC_SYS_LARGEFILE
dnl ---------------------------------------------------------------------------
dnl Point to path where we should install documentation.
dnl ---------------------------------------------------------------------------
LIBTIFF_DOCDIR=\${prefix}/share/doc/${PACKAGE}-${LIBTIFF_VERSION}
AC_ARG_WITH(docdir,
AS_HELP_STRING([--with-docdir=DIR],
[directory where documentation should be installed]),,)
if test "x$with_docdir" != "x" ; then
LIBTIFF_DOCDIR=$with_docdir
fi
AC_SUBST(LIBTIFF_DOCDIR)
dnl ---------------------------------------------------------------------------
dnl Enable or disable parts of the build
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(tools,
AS_HELP_STRING([--disable-tools],
[Disable building of tools]),
[TIFF_TOOLS=$enableval], [TIFF_TOOLS=yes])
AM_CONDITIONAL(TIFF_TOOLS, test "$TIFF_TOOLS" = "yes")
AC_ARG_ENABLE(tests,
AS_HELP_STRING([--disable-tests],
[Disable building of tests]),
[TIFF_TESTS=$enableval], [TIFF_TESTS=yes])
AM_CONDITIONAL(TIFF_TESTS, test "$TIFF_TESTS" = "yes")
AC_ARG_ENABLE(contrib,
AS_HELP_STRING([--disable-contrib],
[Disable building of contrib]),
[TIFF_CONTRIB=$enableval], [TIFF_CONTRIB=yes])
AM_CONDITIONAL(TIFF_CONTRIB, test "$TIFF_CONTRIB" = "yes")
AC_ARG_ENABLE(docs,
AS_HELP_STRING([--disable-docs],
[Disable building of docs]),
[TIFF_DOCS=$enableval], [TIFF_DOCS=yes])
AM_CONDITIONAL(TIFF_DOCS, test "$TIFF_DOCS" = "yes")
dnl ---------------------------------------------------------------------------
dnl Switch on/off internal codecs.
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(ccitt,
AS_HELP_STRING([--disable-ccitt],
[disable support for CCITT Group 3 & 4 algorithms]),
[HAVE_CCITT=$enableval], [HAVE_CCITT=yes])
if test "$HAVE_CCITT" = "yes" ; then
AC_DEFINE(CCITT_SUPPORT,1,[Support CCITT Group 3 & 4 algorithms])
fi
AC_ARG_ENABLE(packbits,
AS_HELP_STRING([--disable-packbits],
[disable support for Macintosh PackBits algorithm]),
[HAVE_PACKBITS=$enableval], [HAVE_PACKBITS=yes])
if test "$HAVE_PACKBITS" = "yes" ; then
AC_DEFINE(PACKBITS_SUPPORT,1,[Support Macintosh PackBits algorithm])
fi
AC_ARG_ENABLE(lzw,
AS_HELP_STRING([--disable-lzw],
[disable support for LZW algorithm]),
[HAVE_LZW=$enableval], [HAVE_LZW=yes])
if test "$HAVE_LZW" = "yes" ; then
AC_DEFINE(LZW_SUPPORT,1,[Support LZW algorithm])
fi
AC_ARG_ENABLE(thunder,
AS_HELP_STRING([--disable-thunder],
[disable support for ThunderScan 4-bit RLE algorithm]),
[HAVE_THUNDER=$enableval], [HAVE_THUNDER=yes])
if test "$HAVE_THUNDER" = "yes" ; then
AC_DEFINE(THUNDER_SUPPORT,1,[Support ThunderScan 4-bit RLE algorithm])
fi
HAVE_NEXT=yes
AC_ARG_ENABLE(next,
AS_HELP_STRING([--disable-next],
[disable support for NeXT 2-bit RLE algorithm]),
[HAVE_NEXT=$enableval], [HAVE_NEXT=yes])
if test "$HAVE_NEXT" = "yes" ; then
AC_DEFINE(NEXT_SUPPORT,1,[Support NeXT 2-bit RLE algorithm])
fi
AC_ARG_ENABLE(logluv,
AS_HELP_STRING([--disable-logluv],
[disable support for LogLuv high dynamic range encoding]),
[HAVE_LOGLUV=$enableval], [HAVE_LOGLUV=yes])
if test "$HAVE_LOGLUV" = "yes" ; then
AC_DEFINE(LOGLUV_SUPPORT,1,[Support LogLuv high dynamic range encoding])
fi
dnl ---------------------------------------------------------------------------
dnl Switch on/off support for Microsoft Document Imaging
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(mdi,
AS_HELP_STRING([--disable-mdi],
[disable support for Microsoft Document Imaging]),
[HAVE_MDI=$enableval], [HAVE_MDI=yes])
if test "$HAVE_MDI" = "yes" ; then
AC_DEFINE(MDI_SUPPORT,1,[Support Microsoft Document Imaging format])
fi
dnl ---------------------------------------------------------------------------
dnl Check for ZLIB.
dnl ---------------------------------------------------------------------------
HAVE_ZLIB=no
AC_ARG_ENABLE(zlib,
AS_HELP_STRING([--disable-zlib],
[disable Zlib usage (required for Deflate compression, enabled by default)]),,)
AC_ARG_WITH(zlib-include-dir,
AS_HELP_STRING([--with-zlib-include-dir=DIR],
[location of Zlib headers]),,)
AC_ARG_WITH(zlib-lib-dir,
AS_HELP_STRING([--with-zlib-lib-dir=DIR],
[location of Zlib library binary]),,)
if test "x$enable_zlib" != "xno" ; then
if test "x$with_zlib_lib_dir" != "x" ; then
LDFLAGS="-L$with_zlib_lib_dir $LDFLAGS"
fi
AC_CHECK_LIB(z, inflateEnd, [zlib_lib=yes], [zlib_lib=no],)
if test "$zlib_lib" = "no" -a "x$with_zlib_lib_dir" != "x"; then
AC_MSG_ERROR([Zlib library not found at $with_zlib_lib_dir])
fi
if test "x$with_zlib_include_dir" != "x" ; then
CPPFLAGS="-I$with_zlib_include_dir $CPPFLAGS"
fi
AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no])
if test "$zlib_h" = "no" -a "x$with_zlib_include_dir" != "x" ; then
AC_MSG_ERROR([Zlib headers not found at $with_zlib_include_dir])
fi
if test "$zlib_lib" = "yes" -a "$zlib_h" = "yes" ; then
HAVE_ZLIB=yes
fi
fi
if test "$HAVE_ZLIB" = "yes" ; then
AC_DEFINE(ZIP_SUPPORT,1,[Support Deflate compression])
LIBS="-lz $LIBS"
tiff_libs_private="-lz ${tiff_libs_private}"
tiff_requires_private="zlib ${tiff_requires_private}"
if test "$HAVE_RPATH" = "yes" -a "x$with_zlib_lib_dir" != "x" ; then
LIBDIR="-R $with_zlib_lib_dir $LIBDIR"
fi
fi
dnl ---------------------------------------------------------------------------
dnl Check for libdeflate.
dnl ---------------------------------------------------------------------------
HAVE_LIBDEFLATE=no
AC_ARG_ENABLE(libdeflate,
AS_HELP_STRING([--disable-libdeflate],
[disable libdeflate usage (optional for faster Deflate support (still requires zlib), enabled by default)]),,)
AC_ARG_WITH(libdeflate-include-dir,
AS_HELP_STRING([--with-libdeflate-include-dir=DIR],
[location of libdeflate headers]),,)
AC_ARG_WITH(libdeflate-lib-dir,
AS_HELP_STRING([--with-libdeflate-lib-dir=DIR],
[location of libdeflate library binary]),,)
if test "x$enable_libdeflate" != "xno" ; then
if test "x$with_libdeflate_lib_dir" != "x" ; then
LDFLAGS="-L$with_libdeflate_lib_dir $LDFLAGS"
fi
AC_CHECK_LIB(deflate, libdeflate_zlib_decompress, [libdeflate_lib=yes], [libdeflate_lib=no],)
if test "$libdeflate_lib" = "no" -a "x$with_libdeflate_lib_dir" != "x"; then
AC_MSG_ERROR([libdeflate library not found at $with_libdeflate_lib_dir])
fi
if test "x$with_libdeflate_include_dir" != "x" ; then
CPPFLAGS="-I$with_libdeflate_include_dir $CPPFLAGS"
fi
AC_CHECK_HEADER(libdeflate.h, [libdeflate_h=yes], [libdeflate_h=no])
if test "$libdeflate_h" = "no" -a "x$with_libdeflate_include_dir" != "x" ; then
AC_MSG_ERROR([libdeflate headers not found at $with_libdeflate_include_dir])
fi
if test "$libdeflate_lib" = "yes" -a "$libdeflate_h" = "yes" ; then
HAVE_LIBDEFLATE=yes
fi
fi
if test "$HAVE_LIBDEFLATE" = "yes" -a "$HAVE_ZLIB" = "no" ; then
AC_MSG_WARN([libdeflate available but zlib is not. libdeflate cannot be used])
HAVE_LIBDEFLATE=no
fi
if test "$HAVE_LIBDEFLATE" = "yes" ; then
AC_DEFINE(LIBDEFLATE_SUPPORT,1,[Support libdeflate enhanced compression])
LIBS="-ldeflate $LIBS"
tiff_libs_private="-ldeflate ${tiff_libs_private}"
tiff_requires_private="libdeflate ${tiff_requires_private}"
if test "$HAVE_RPATH" = "yes" -a "x$with_libdeflate_lib_dir" != "x" ; then
LIBDIR="-R $with_libdeflate_lib_dir $LIBDIR"
fi
fi
dnl ---------------------------------------------------------------------------
dnl Check for Pixar log-format algorithm.
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(pixarlog,
AS_HELP_STRING([--disable-pixarlog],
[disable support for Pixar log-format algorithm (requires Zlib)]),
[HAVE_PIXARLOG=$enableval], [HAVE_PIXARLOG=yes])
if test "$HAVE_ZLIB" = "yes" -a "$HAVE_PIXARLOG" = "yes" ; then
AC_DEFINE(PIXARLOG_SUPPORT, 1,
[Support Pixar log-format algorithm (requires Zlib)])
else
HAVE_PIXARLOG=no
fi
dnl ---------------------------------------------------------------------------
dnl Check for JPEG.
dnl ---------------------------------------------------------------------------
HAVE_JPEG=no
HAVE_JPEGTURBO_DUAL_MODE_8_12=no
AC_ARG_ENABLE(jpeg,
AS_HELP_STRING([--disable-jpeg],
[disable IJG JPEG library usage (required for JPEG compression, enabled by default)]),,)
AC_ARG_WITH(jpeg-include-dir,
AS_HELP_STRING([--with-jpeg-include-dir=DIR],
[location of IJG JPEG library headers]),,)
AC_ARG_WITH(jpeg-lib-dir,
AS_HELP_STRING([--with-jpeg-lib-dir=DIR],
[location of IJG JPEG library binary]),,)
if test "x$enable_jpeg" != "xno" ; then
if test "x$with_jpeg_lib_dir" != "x" ; then
LDFLAGS="-L$with_jpeg_lib_dir $LDFLAGS"
fi
AC_CHECK_LIB(jpeg, jpeg_read_scanlines, [jpeg_lib=yes], [jpeg_lib=no],)
if test "$jpeg_lib" = "no" -a "x$with_jpeg_lib_dir" != "x" ; then
AC_MSG_ERROR([IJG JPEG library not found at $with_jpeg_lib_dir])
fi
if test "x$with_jpeg_include_dir" != "x" ; then
CPPFLAGS="-I$with_jpeg_include_dir $CPPFLAGS"
fi
AC_CHECK_HEADER(jpeglib.h, [jpeg_h=yes], [jpeg_h=no])
if test "$jpeg_h" = "no" -a "x$with_jpeg_include_dir" != "x" ; then
AC_MSG_ERROR([IJG JPEG library headers not found at $with_jpeg_include_dir])
fi
if test "$jpeg_lib" = "yes" -a "$jpeg_h" = "yes" ; then
dnl Check for jpeg12_read_scanlines which has been added in libjpeg-turbo 2.2
dnl for dual 8/12 bit mode.
AC_CHECK_LIB(jpeg, jpeg12_read_scanlines, [HAVE_JPEGTURBO_DUAL_MODE_8_12=yes], [HAVE_JPEGTURBO_DUAL_MODE_8_12=no],)
HAVE_JPEG=yes
fi
fi
if test "$HAVE_JPEG" = "yes" ; then
AC_DEFINE(JPEG_SUPPORT,1,[Support JPEG compression (requires IJG JPEG library)])
LIBS="-ljpeg $LIBS"
tiff_libs_private="-ljpeg ${tiff_libs_private}"
tiff_requires_private="libjpeg ${tiff_requires_private}"
if test "$HAVE_RPATH" = "yes" -a "x$with_jpeg_lib_dir" != "x" ; then
LIBDIR="-R $with_jpeg_lib_dir $LIBDIR"
fi
if test "$HAVE_JPEGTURBO_DUAL_MODE_8_12" = "yes"; then
AC_DEFINE(HAVE_JPEGTURBO_DUAL_MODE_8_12,1,[libjpeg-turbo >= 2.2 dual mode enabled])
fi
fi
AM_CONDITIONAL(HAVE_JPEG, test "$HAVE_JPEG" = 'yes')
AM_CONDITIONAL(HAVE_JPEGTURBO_DUAL_MODE_8_12, test "$HAVE_JPEGTURBO_DUAL_MODE_8_12" = 'yes')
dnl ---------------------------------------------------------------------------
dnl Check for Old JPEG.
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(old-jpeg,
AS_HELP_STRING([--disable-old-jpeg],
[disable support for Old JPEG compresson (read-only, enabled by default)]),
[HAVE_OJPEG=${enableval}], [HAVE_OJPEG=yes])
if test "$HAVE_JPEG" = "yes" -a "$HAVE_OJPEG" = "yes" ; then
AC_DEFINE(OJPEG_SUPPORT, 1,
[Support Old JPEG compresson (read-only)])
else
HAVE_OJPEG=no
fi
dnl ---------------------------------------------------------------------------
dnl Check for JBIG-KIT.
dnl ---------------------------------------------------------------------------
HAVE_JBIG=no
AC_ARG_ENABLE(jbig,
AS_HELP_STRING([--disable-jbig],
[disable JBIG-KIT usage (required for ISO JBIG compression, enabled by default)]),,)
AC_ARG_WITH(jbig-include-dir,
AS_HELP_STRING([--with-jbig-include-dir=DIR],
[location of JBIG-KIT headers]),,)
AC_ARG_WITH(jbig-lib-dir,
AS_HELP_STRING([--with-jbig-lib-dir=DIR],
[location of JBIG-KIT library binary]),,)
if test "x$enable_jbig" != "xno" ; then
if test "x$with_jbig_lib_dir" != "x" ; then
LDFLAGS="-L$with_jbig_lib_dir $LDFLAGS"
fi
AC_CHECK_LIB(jbig, jbg_dec_init, [jbig_lib=yes], [jbig_lib=no],)
if test "$jbig_lib" = "no" -a "x$with_jbig_lib_dir" != "x" ; then
AC_MSG_ERROR([JBIG-KIT library not found at $with_jbig_lib_dir])
fi
if test "x$with_jbig_include_dir" != "x" ; then
CPPFLAGS="-I$with_jbig_include_dir $CPPFLAGS"
fi
AC_CHECK_HEADER(jbig.h, [jbig_h=yes], [jbig_h=no])
if test "$jbig_h" = "no" -a "x$with_jbig_include_dir" != "x" ; then
AC_MSG_ERROR([JBIG-KIT library headers not found at $with_jbig_include_dir])
fi
if test "$jbig_lib" = "yes" -a "$jbig_h" = "yes" ; then
HAVE_JBIG=yes
fi
fi
if test "$HAVE_JBIG" = "yes" ; then
AC_DEFINE(JBIG_SUPPORT,1,[Support ISO JBIG compression (requires JBIG-KIT library)])
LIBS="-ljbig $LIBS"
tiff_libs_private="-ljbig ${tiff_libs_private}"
if test "$HAVE_RPATH" = "yes" -a "x$with_jbig_lib_dir" != "x" ; then
LIBDIR="-R $with_jbig_lib_dir $LIBDIR"
fi
# Older versions of jbigkit lack jbg_newlen
AC_CHECK_FUNCS([jbg_newlen])
fi
AM_CONDITIONAL(HAVE_JBIG, test "$HAVE_JBIG" = 'yes')
dnl ---------------------------------------------------------------------------
dnl Check for liblerc.
dnl ---------------------------------------------------------------------------
HAVE_LERC=no
STATIC_LERC=no
if test "$enable_static" = "no"; then
static_lerc=no
else
static_lerc=yes
fi
AM_CONDITIONAL([STATIC_LERC], [ test "$static_lerc" = yes ])
AC_ARG_ENABLE(lerc,
AS_HELP_STRING([--disable-lerc],
[disable liblerc usage (required for lerc compression, enabled by default)]),,)
AC_ARG_WITH(lerc-include-dir,
AS_HELP_STRING([--with-lerc-include-dir=DIR],
[location of liblerc headers]),,)
AC_ARG_WITH(lerc-lib-dir,
AS_HELP_STRING([--with-lerc-lib-dir=DIR],
[location of liblerc library binary]),,)
if test "x$enable_lerc" != "xno" ; then
if test "x$with_lerc_lib_dir" != "x" ; then
LDFLAGS="-L$with_lerc_lib_dir $LDFLAGS"
fi
lerc_lib_name="LercLib"
AC_CHECK_LIB("$lerc_lib_name", lerc_decode, [lerc_lib=yes], [lerc_lib=no],)
if test "$lerc_lib" = "no" ; then
lerc_lib_name="Lerc"
AC_CHECK_LIB("$lerc_lib_name", lerc_decode, [lerc_lib=yes], [lerc_lib=no],)
fi
if test "$lerc_lib" = "no" -a "x$with_lerc_lib_dir" != "x"; then
AC_MSG_ERROR([lerc library not found at $with_lerc_lib_dir])
fi
if test "x$with_lerc_include_dir" != "x" ; then
CPPFLAGS="-I$with_lerc_include_dir $CPPFLAGS"
fi
AC_CHECK_HEADER(Lerc_c_api.h, [lerc_c_api_h=yes], [lerc_c_api_h=no])
if test "$lerc_c_api_h" = "no" -a "x$with_lerc_include_dir" != "x" ; then
AC_MSG_ERROR([Liblerc headers not found at $with_lerc_include_dir])
fi
if test "$lerc_lib" = "yes" -a "$lerc_c_api_h" = "yes" ; then
HAVE_LERC=yes
fi
fi
if test "$HAVE_LERC" = "yes" ; then
AC_DEFINE(LERC_SUPPORT,1,[Support lerc compression])
LIBS="-l${lerc_lib_name} $LIBS"
tiff_libs_private="-l${lerc_lib_name} ${tiff_libs_private}"
if test "$HAVE_RPATH" = "yes" -a "x$with_lerc_lib_dir" != "x" ; then
LIBDIR="-R $with_lerc_lib_dir $LIBDIR"
fi
fi
AM_CONDITIONAL(HAVE_LERC, test "$HAVE_LERC" = 'yes')
dnl ---------------------------------------------------------------------------
dnl Check for liblzma2.
dnl ---------------------------------------------------------------------------
HAVE_LZMA=no
AC_ARG_ENABLE(lzma,
AS_HELP_STRING([--disable-lzma],
[disable liblzma usage (required for LZMA2 compression, enabled by default)]),,)
AC_ARG_WITH(lzma-include-dir,
AS_HELP_STRING([--with-lzma-include-dir=DIR],
[location of liblzma headers]),,)
AC_ARG_WITH(lzma-lib-dir,
AS_HELP_STRING([--with-lzma-lib-dir=DIR],
[location of liblzma library binary]),,)
if test "x$enable_lzma" != "xno" ; then
if test "x$with_lzma_lib_dir" != "x" ; then
LDFLAGS="-L$with_lzma_lib_dir $LDFLAGS"
fi
AC_CHECK_LIB(lzma, lzma_code, [lzma_lib=yes], [lzma_lib=no],)
if test "$lzma_lib" = "no" -a "x$with_lzma_lib_dir" != "x"; then
AC_MSG_ERROR([lzma library not found at $with_lzma_lib_dir])
fi
if test "x$with_lzma_include_dir" != "x" ; then
CPPFLAGS="-I$with_lzma_include_dir $CPPFLAGS"
fi
AC_CHECK_HEADER(lzma.h, [lzma_h=yes], [lzma_h=no])
if test "$lzma_h" = "no" -a "x$with_lzma_include_dir" != "x" ; then
AC_MSG_ERROR([Liblzma headers not found at $with_lzma_include_dir])
fi
if test "$lzma_lib" = "yes" -a "$lzma_h" = "yes" ; then
HAVE_LZMA=yes
fi
fi
if test "$HAVE_LZMA" = "yes" ; then
AC_DEFINE(LZMA_SUPPORT,1,[Support LZMA2 compression])
LIBS="-llzma $LIBS"
tiff_libs_private="-llzma ${tiff_libs_private}"
tiff_requires_private="liblzma ${tiff_requires_private}"
if test "$HAVE_RPATH" = "yes" -a "x$with_lzma_lib_dir" != "x" ; then
LIBDIR="-R $with_lzma_lib_dir $LIBDIR"
fi
fi
AM_CONDITIONAL(HAVE_LZMA, test "$HAVE_LZMA" = 'yes')
dnl ---------------------------------------------------------------------------
dnl Check for libzstd.
dnl ---------------------------------------------------------------------------
HAVE_ZSTD=no
AC_ARG_ENABLE(zstd,
AS_HELP_STRING([--disable-zstd],
[disable libzstd usage (required for zstd compression, enabled by default)]),,)
AC_ARG_WITH(zstd-include-dir,
AS_HELP_STRING([--with-zstd-include-dir=DIR],
[location of libzstd headers]),,)
AC_ARG_WITH(zstd-lib-dir,
AS_HELP_STRING([--with-zstd-lib-dir=DIR],
[location of libzstd library binary]),,)
if test "x$enable_zstd" != "xno" ; then
if test "x$with_zstd_lib_dir" != "x" ; then
LDFLAGS="-L$with_zstd_lib_dir $LDFLAGS"
fi
AC_CHECK_LIB(zstd, ZSTD_decompressStream, [zstd_lib=yes], [zstd_lib=no],)
if test "$zstd_lib" = "no" -a "x$with_zstd_lib_dir" != "x"; then
AC_MSG_ERROR([zstd library not found at $with_zstd_lib_dir])
fi
if test "x$with_zstd_include_dir" != "x" ; then
CPPFLAGS="-I$with_zstd_include_dir $CPPFLAGS"
fi
AC_CHECK_HEADER(zstd.h, [zstd_h=yes], [zstd_h=no])
if test "$zstd_h" = "no" -a "x$with_zstd_include_dir" != "x" ; then
AC_MSG_ERROR([Libzstd headers not found at $with_zstd_include_dir])
fi
if test "$zstd_lib" = "yes" -a "$zstd_h" = "yes" ; then
HAVE_ZSTD=yes
fi
fi
if test "$HAVE_ZSTD" = "yes" ; then
AC_DEFINE(ZSTD_SUPPORT,1,[Support zstd compression])
LIBS="-lzstd $LIBS"
tiff_libs_private="-lzstd ${tiff_libs_private}"
tiff_requires_private="libzstd ${tiff_requires_private}"
if test "$HAVE_RPATH" = "yes" -a "x$with_zstd_lib_dir" != "x" ; then
LIBDIR="-R $with_zstd_lib_dir $LIBDIR"
fi
fi
AM_CONDITIONAL(HAVE_ZSTD, test "$HAVE_ZSTD" = 'yes')
dnl ---------------------------------------------------------------------------
dnl Check for libwebp.
dnl ---------------------------------------------------------------------------
HAVE_WEBP=no
AC_ARG_ENABLE(webp,
AS_HELP_STRING([--disable-webp],
[disable libwebp usage (required for webp compression, enabled by default)]),,)
AC_ARG_WITH(webp-include-dir,
AS_HELP_STRING([--with-webp-include-dir=DIR],
[location of libwebp headers]),,)
AC_ARG_WITH(webp-lib-dir,
AS_HELP_STRING([--with-webp-lib-dir=DIR],
[location of libwebp library binary]),,)
if test "x$enable_webp" != "xno" ; then
if test "x$with_webp_lib_dir" != "x" ; then
LDFLAGS="-L$with_webp_lib_dir $LDFLAGS"
fi
AC_CHECK_LIB(webp, WebPDecode, [webp_lib=yes], [webp_lib=no],)
if test "$webp_lib" = "no" -a "x$with_webp_lib_dir" != "x"; then
AC_MSG_ERROR([webp library not found at $with_webp_lib_dir])
fi
if test "x$with_webp_include_dir" != "x" ; then
CPPFLAGS="-I$with_webp_include_dir $CPPFLAGS"
fi
AC_CHECK_HEADER(webp/decode.h, [webp_h=yes], [webp_h=no])
if test "$webp_h" = "no" -a "x$with_webp_include_dir" != "x" ; then
AC_MSG_ERROR([Libwebp headers not found at $with_webp_include_dir])
fi
if test "$webp_lib" = "yes" -a "$webp_h" = "yes" ; then
HAVE_WEBP=yes
fi
fi
if test "$HAVE_WEBP" = "yes" ; then
AC_DEFINE(WEBP_SUPPORT,1,[Support webp compression])
LIBS="-lwebp $LIBS"
tiff_libs_private="-lwebp ${tiff_libs_private}"
tiff_requires_private="libwebp ${tiff_requires_private}"
if test "$HAVE_RPATH" = "yes" -a "x$with_webp_lib_dir" != "x" ; then
LIBDIR="-R $with_webp_lib_dir $LIBDIR"
fi
fi
AM_CONDITIONAL(HAVE_WEBP, test "$HAVE_WEBP" = 'yes')
dnl ---------------------------------------------------------------------------
dnl Should 8/12 bit jpeg mode be enabled?
dnl This should not be used starting with libjpeg-turbo >= 2.2 that has
dnl built-in support for dual mode.
dnl ---------------------------------------------------------------------------
if test "$HAVE_JPEGTURBO_DUAL_MODE_8_12" = "no"; then
HAVE_JPEG12=no
AC_ARG_ENABLE(jpeg12,
AS_HELP_STRING([--enable-jpeg12],
[enable libjpeg 8/12bit dual mode (not to be used with libjpeg-turbo >= 2.2)]),,)
AC_ARG_WITH(jpeg12-include-dir,
AS_HELP_STRING([--with-jpeg12-include-dir=DIR],
[location of libjpeg 12bit headers]),,)
AC_ARG_WITH(jpeg12-lib,
AS_HELP_STRING([--with-jpeg12-lib=LIBRARY],
[path to libjpeg 12bit library]),,)
if test "x$enable_jpeg12" = "xyes" ; then
if test "x$with_jpeg12_lib" != "x" ; then
LIBS="$with_jpeg12_lib $LIBS"
fi
HAVE_JPEG12=yes
AC_DEFINE(JPEG_DUAL_MODE_8_12,1,[8/12 bit libjpeg dual mode enabled])
if test "x$with_jpeg12_include_dir" != "x" ; then
AC_DEFINE_UNQUOTED(LIBJPEG_12_PATH,"$with_jpeg12_include_dir/jpeglib.h",[12bit libjpeg primary include file with path])
fi
fi
fi
dnl ---------------------------------------------------------------------------
dnl Check for C++.
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(cxx,
AS_HELP_STRING([--enable-cxx],
[enable C++ stream API building (requires C++ compiler)]),
[HAVE_CXX=$enableval], [HAVE_CXX=yes])
if test "$HAVE_CXX" = "yes" ; then
AC_DEFINE(CXX_SUPPORT, 1, [Support C++ stream API (requires C++ compiler)])
else
HAVE_CXX=no
fi
AM_CONDITIONAL(HAVE_CXX, test "$HAVE_CXX" = "yes")
dnl ---------------------------------------------------------------------------
dnl Check for OpenGL and GLUT.
dnl ---------------------------------------------------------------------------
HAVE_OPENGL=no
AC_ARG_ENABLE(opengl,
AS_HELP_STRING([--disable-opengl],
[disable OpenGL usage (required by tiffgt, enabled by default)]),,)
if test "x$enable_opengl" != "xno" ; then
AC_PATH_XTRA
dnl AX_CHECK_GL sets GL_CFLAGS & GL_LIBS. Also PTHREAD_LIBS,
dnl PTHREAD_CFLAGS, & PTHREAD_CC as a side-effect
AX_CHECK_GL
dnl AX_CHECK_GLU sets GLU_CFLAGS & GLU_LIBS
AX_CHECK_GLU
dnl AX_CHECK_GLUT sets GLUT_CFLAGS & GLUT_LIBS
AX_CHECK_GLUT