forked from libvips/libvips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1686 lines (1474 loc) · 51.7 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
# Process this file with autoconf to produce a configure script.
# also update the version number in the m4 macros below
AC_INIT([vips], [8.13.0], [[email protected]])
# required for gobject-introspection
AC_PREREQ([2.69])
# gobject-introspection recommends -Wno-portability
# foreign stops complaints about a missing README (we use README.md instead)
# and missing INSTALL (the standard Gnu INSTALL is not very useful)
# subdir-objects lets us have dummy.cc in a subdir
AM_INIT_AUTOMAKE([-Wno-portability foreign subdir-objects])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [8])
m4_define([vips_minor_version], [13])
m4_define([vips_micro_version], [0])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
VIPS_MAJOR_VERSION=vips_major_version()
VIPS_MINOR_VERSION=vips_minor_version()
VIPS_MICRO_VERSION=vips_micro_version()
VIPS_VERSION=vips_version()
VIPS_VERSION_STRING="$VIPS_VERSION-$(date -u -r $srcdir/ChangeLog)"
# packages add to these as we find them
VIPS_CFLAGS=""
VIPS_INCLUDES=""
VIPS_LIBS=""
# libtool library versioning ... not user-visible (except as part of the
# library file name) and does not correspond to major/minor/micro above
# rules:
# sources changed: increment revision
# binary interface changed: increment current, reset revision to 0
# binary interface changes backwards compatible?: increment age
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_REVISION=0
LIBRARY_CURRENT=57
LIBRARY_AGE=15
# patched into include/vips/version.h
AC_SUBST(VIPS_VERSION)
AC_SUBST(VIPS_VERSION_STRING)
AC_SUBST(VIPS_MAJOR_VERSION)
AC_SUBST(VIPS_MINOR_VERSION)
AC_SUBST(VIPS_MICRO_VERSION)
# put into library name by libsrc/Makefile.am and libsrcCC/Makefile.am
AC_SUBST(LIBRARY_CURRENT)
AC_SUBST(LIBRARY_REVISION)
AC_SUBST(LIBRARY_AGE)
# init introspection support
have_introspection=no
m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
GOBJECT_INTROSPECTION_CHECK([1.30.0])
if test "x$found_introspection" = x"yes"; then
have_introspection=yes
fi
], [
AM_CONDITIONAL([HAVE_INTROSPECTION], false)
])
# gir needs a list of source files to scan for introspection
#
# build with a glob and a list of files to exclude from scanning
# see also IGNORE_HFILES in doc/Makefile.am
introspection_sources=$(cd $srcdir/libvips ; find . -path ./deprecated -prune -o -name dummy.c -prune -o -name introspect.c -prune -o \( -name "*.c" -o -name "*.cpp" \) -print)
for name in $introspection_sources; do
vips_introspection_sources="$vips_introspection_sources $name"
done
# add headers that form the public vips8 API .. don't do a find and exclude,
# we end up excluding almost everything argh
headers="\
basic.h \
vips.h \
object.h \
image.h \
error.h \
foreign.h \
freqfilt.h \
interpolate.h \
header.h \
histogram.h \
operation.h \
enumtypes.h \
conversion.h \
arithmetic.h \
colour.h \
convolution.h \
create.h \
draw.h \
morphology.h \
mosaicing.h \
type.h \
rect.h \
resample.h \
memory.h \
region.h"
for name in $headers; do
vips_introspection_sources="$vips_introspection_sources include/vips/$name"
done
AC_SUBST(vips_introspection_sources)
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED(G_LOG_DOMAIN, "VIPS", [Domain for glib logging messages.])
m4_define([debug_default], [no])
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],[turn on debugging @<:@default=debug_default()@:>@]),,
enable_debug=debug_default())
if test x"$enable_debug" = x"yes"; then
VIPS_DEBUG_FLAGS="-DDEBUG_FATAL -DDEBUG_LEAK"
else
VIPS_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS"
if test x"$enable_debug" = x"no"; then
VIPS_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
fi
fi
# option to disable deprecated code, shaves a bit off the library size
AC_ARG_ENABLE(deprecated,
AS_HELP_STRING([--enable-deprecated], [build deprecated components (default: yes)]))
VIPS_ENABLE_DEPRECATED=0
if test x"$enable_deprecated" != x"no"; then
VIPS_ENABLE_DEPRECATED=1
enable_deprecated=yes
fi
AC_DEFINE_UNQUOTED(ENABLE_DEPRECATED,$VIPS_ENABLE_DEPRECATED,[define to build deprecated components])
AM_CONDITIONAL(ENABLE_DEPRECATED, [test x"$enable_deprecated" = x"yes"])
# this gets pasted into version.h as a #define
AC_SUBST(VIPS_ENABLE_DEPRECATED)
AC_MSG_CHECKING([for -mms-bitfields support])
case "$host_os" in
mingw*)
# makes gcc use win native alignment
# GCC >= 4.7 and Clang >= 11 does this automatically, see:
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1510#note_841637
VIPS_CFLAGS="-mms-bitfields $VIPS_CFLAGS"
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_RESULT([no])
;;
esac
# set the default directory for ICC profiles
case "$host_os" in
darwin*)
profile_dir="/Library/ColorSync/Profiles"
;;
mingw*)
# need double escapes since this will get pasted into a #define in a C
# header ... the C:\Windows is usually overwritten with the result of
# GetWindowsDirectoryW()
profile_dir="C:\\\\Windows\\\\System32\\\\spool\\\\drivers\\\\color"
;;
*)
profile_dir="/usr/share/color/icc"
;;
esac
AC_DEFINE_UNQUOTED(VIPS_ICC_DIR,"$profile_dir",[default directory for ICC profiles])
# we want largefile support, if possible
AC_SYS_LARGEFILE
# we use libtool and can generate DLLs cleanly on win32 if necessary
LT_INIT([win32-dll])
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_ARG_ENABLE([doxygen],
AS_HELP_STRING([--enable-doxygen], [enable C++ doc build (default: no)]),
[enable_doxygen="$enableval"],
[enable_doxygen=no])
if test x"$enable_doxygen" = x"yes"; then
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if ! test "$DOXYGEN"; then
AC_MSG_WARN([doxygen not found; C++ docs will not be generated])
enable_doxygen=no
fi
fi
AM_CONDITIONAL(HAVE_DOXYGEN, [test x"$enable_doxygen" = x"yes"])
# we need a fully expanded version of $libdir
# without this we get something like
# define VIPS_LIBDIR ${exec_prefix}/lib
# argh
test x"$prefix" = x"NONE" && prefix=$ac_default_prefix
test x"$exec_prefix" = x"NONE" && exec_prefix='${prefix}'
# set $expanded_value to the fully-expanded value of the argument
expand () {
eval expanded_value=$1
if test x"$expanded_value" != x"$1"; then
expand "$expanded_value"
fi
}
expand $libdir
VIPS_LIBDIR=$expanded_value
# this gets pasted into version.h as a #define
VIPS_EXEEXT=$EXEEXT
AC_SUBST(VIPS_EXEEXT)
# cplusplus/Doxyfile.in needs an input and output directory ... they are the
# same for copnfigure, but meson has separate source and build areas
DOXY_INPUT_DIRECTORY=$ac_pwd/$srcdir/cplusplus
DOXY_OUTPUT_DIRECTORY=$ac_pwd/$srcdir/cplusplus
AC_SUBST(DOXY_INPUT_DIRECTORY)
AC_SUBST(DOXY_OUTPUT_DIRECTORY)
# vips.c/im_guess_prefix.c need to know the exe suffix and (as a fallback)
# the configure-time install prefix
AC_DEFINE_UNQUOTED(VIPS_PREFIX,"$prefix",[configure-time install prefix])
AC_DEFINE_UNQUOTED(VIPS_LIBDIR,"$VIPS_LIBDIR",[configure-time library directory])
# i18n
# we need to name our .mo with major.minor so we can have multiple versions
# installed in parallel on Debian
expand vips$VIPS_MAJOR_VERSION.$VIPS_MINOR_VERSION
GETTEXT_PACKAGE=$expanded_value
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
[The prefix for our gettext translation domains.])
# the 'malkovich' one is there for testing only, remove for release
#ALL_LINGUAS="en_GB de malkovich"
ALL_LINGUAS="en_GB de"
AM_GLIB_GNU_GETTEXT
# Compatibility with pkg.m4 < 0.27
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR],
[AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir],
[install directory for *.pc pkg-config file])],
[],[with_pkgconfigdir='$(libdir)/pkgconfig'])
AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])])
# Compatibility with pkg.m4 < 0.28
m4_define_default([PKG_CHECK_VAR],
[AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])
AS_IF([test -z "$$1"], [$1=`$PKG_CONFIG --variable="$3" "$2"`])
AS_IF([test -n "$$1"], [$4], [$5])])
# we need to disable some features on some known-bad gcc versions
# these will be "" for clang etc.
#
# I couldn't get this to work, mysterious! do it ourselves
#
# AX_CHECK_COMPILE_FLAG([-dumpversion],
# [ax_gcc_version_option=yes],
# [ax_gcc_version_option=no]
# )
AC_MSG_CHECKING([for $CC version])
GCC_VERSION=""
version=$($CC -dumpversion)
if test $? = 0; then
GCC_VERSION=$version
AC_MSG_RESULT([$GCC_VERSION])
else
AC_MSG_RESULT([-dumpversion not supported])
fi
GCC_VERSION_MAJOR=$(echo $GCC_VERSION | cut -d'.' -f1)
GCC_VERSION_MINOR=$(echo $GCC_VERSION | cut -d'.' -f2)
GCC_VERSION_PATCH=$(echo $GCC_VERSION | cut -d'.' -f3)
# Checks for libraries.
# build list of pkg-config packages we used here
PACKAGES_USED=""
# build list of extra libs we need here
# the main one is jpeg: it does not have a .pc file, so when we make vips.pc
# we need to put -ljpeg into libs ourselves
EXTRA_LIBS_USED=""
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([errno.h math.h fcntl.h limits.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/time.h sys/mman.h sys/types.h sys/stat.h unistd.h io.h direct.h windows.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_RESTRICT
AX_GCC_VAR_ATTRIBUTE(vector_size)
AC_C_CONST
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
# g++/gcc 4.x and 5.x have rather broken vector support ... 5.4.1 seems to
# work, but 5.4.0 fails to even compile
AC_MSG_CHECKING([for $CC with working vector support])
if test x"$GCC_VERSION_MAJOR" != x"4" -a x"$GCC_VERSION_MAJOR" != x"5"; then
AC_MSG_RESULT([yes])
else
ax_cv_have_var_attribute_vector_size=no
AC_MSG_RESULT([no])
fi
# we need to be able to shuffle vectors in C++
if test x"$ax_cv_have_var_attribute_vector_size" = x"yes"; then
AC_MSG_CHECKING([for C++ vector shuffle])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
typedef float v4f __attribute__((vector_size(4 * sizeof(float)),aligned(16)));
]], [[
v4f f; f[3] = 99;
]])],[
AC_MSG_RESULT([yes])
have_vector_shuffle=yes
],[
AC_MSG_RESULT([no])
have_vector_shuffle=no
])
AC_LANG_POP([C++])
if test x"$have_vector_shuffle" = x"yes"; then
AC_DEFINE_UNQUOTED(HAVE_VECTOR_SHUFFLE, 1,
[define if your C++ can shuffle vectors])
fi
fi
# we also need to be able to mix vector and scalar arithmetic
if test x"$have_vector_shuffle" = x"yes"; then
AC_MSG_CHECKING([for C++ vector arithmetic])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
typedef float v4f __attribute__((vector_size(4 * sizeof(float)),aligned(16)));
]], [[
v4f f = {1, 2, 3, 4}; f *= 12.0;
v4f g = {5, 6, 7, 8}; f = g > 0 ? g : -1 * g;
]])],[
AC_MSG_RESULT([yes])
have_vector_arith=yes
],[
AC_MSG_RESULT([no])
have_vector_arith=no
])
AC_LANG_POP([C++])
fi
# gcc 7.2 seems to work, but then gets confused by signed constants in
# templates
if test x"$have_vector_arith" = x"yes"; then
AC_MSG_CHECKING([for C++ signed constants in vector templates])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
typedef float v4f __attribute__((vector_size(4 * sizeof(float)),aligned(16)));
template <typename T>
static void
h( v4f B )
{
v4f f;
f = -1 * B;
}
]], [[
]])],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
have_vector_arith=no
])
AC_LANG_POP([C++])
if test x"$have_vector_arith" = x"yes"; then
AC_DEFINE_UNQUOTED(HAVE_VECTOR_ARITH, 1,
[define if your C++ can mix vector and scalar arithmetic])
fi
fi
# Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([vsnprintf _aligned_malloc posix_memalign memalign])
AC_CHECK_LIB(m,cbrt,[AC_DEFINE(HAVE_CBRT,1,[have cbrt() in libm.])])
AC_CHECK_LIB(m,hypot,[AC_DEFINE(HAVE_HYPOT,1,[have hypot() in libm.])])
AC_CHECK_LIB(m,atan2,[AC_DEFINE(HAVE_ATAN2,1,[have atan2() in libm.])])
AC_CHECK_LIB(m,asinh,[AC_DEFINE(HAVE_ASINH,1,[have asinh() in libm.])])
# have to have these parts of glib ... we need glib 2.15 for gio
PKG_CHECK_MODULES(REQUIRED, glib-2.0 >= 2.40 gmodule-no-export-2.0 gobject-2.0 gio-2.0)
PACKAGES_USED="$PACKAGES_USED glib-2.0 gmodule-no-export-2.0 gobject-2.0 gio-2.0"
VIPS_CFLAGS="$VIPS_CFLAGS $GIO_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $GIO_LIBS"
# if available, we use pthread_setattr_default_np() to raise the per-thread
# stack size ... musl (libc on Alpine), for example, has a very small stack per
# thread by default
save_pthread_LIBS="$LIBS"
save_pthread_CFLAGS="$CFLAGS"
LIBS="$LIBS $REQUIRED_LIBS"
CFLAGS="$CFLAGS $REQUIRED_CFLAGS"
AC_CHECK_FUNC(pthread_setattr_default_np,
[AC_DEFINE(HAVE_PTHREAD_DEFAULT_NP,1,[have pthread_setattr_default_np().])
]
)
LIBS="$save_pthread_LIBS"
CFLAGS="$save_pthread_CFLAGS"
AC_MSG_CHECKING([whether to build dynamic modules])
# Disable modules by default when building static libraries
AS_IF([test x"$enable_static" = x"yes"],
[enable_modules_default=no],
[enable_modules_default=yes])
AC_ARG_ENABLE([modules],
AS_HELP_STRING([--disable-modules], [disable dynamic modules (default: test)]),
[enable_modules="$enableval"],
[enable_modules="$enable_modules_default"])
gmodule_supported_flag=no
gmodule_with_flag=yes
if test x"$enable_modules" = x"no"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([whether dynamic modules work])
PKG_CHECK_VAR([gmodule_supported], [gmodule-no-export-2.0], [gmodule_supported])
if test x"$gmodule_supported" = x"true"; then
gmodule_supported_flag=yes
gmodule_with_flag='module'
AC_DEFINE(ENABLE_MODULES,1,[define to enable loadable module support.])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
# check for gtk-doc
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
# we need expat ... the .pc file for expat is only available
# for recent linuxes, so we fall back to AM_WITH_EXPAT
PKG_CHECK_MODULES(EXPAT, expat,
[expat_found=yes
PACKAGES_USED="$PACKAGES_USED expat"
],
[AM_WITH_EXPAT
]
)
if test x"$expat_found" = x"no"; then
exit 1
fi
VIPS_CFLAGS="$VIPS_CFLAGS $EXPAT_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $EXPAT_LIBS"
# optional supporting libraries
AC_ARG_WITH([gsf],
AS_HELP_STRING([--without-gsf], [build without libgsf-1 (default: test)]))
# libgsf-1 1.14.21 crashes
# .27 is known to work well
# .26 seems OK but has not been tested much
# not sure about 22-25
if test x"$with_gsf" != x"no"; then
PKG_CHECK_MODULES(GSF, libgsf-1 >= 1.14.26,
[AC_DEFINE(HAVE_GSF,1,[define if you have libgsf-1 installed.])
with_gsf=yes
PACKAGES_USED="$PACKAGES_USED libgsf-1"
],
[AC_MSG_WARN([libgsf-1 not found; disabling dzsave support])
with_gsf=no
]
)
# zip64 and deflate-level came in .31
PKG_CHECK_MODULES(GSF_ZIP64, libgsf-1 >= 1.14.31,
[AC_DEFINE(HAVE_GSF_ZIP64,1,[define if your libgsf supports zip64.])
AC_DEFINE(HAVE_GSF_DEFLATE_LEVEL,1,
[define if your libgsf supports deflate-level.])
],
[:
]
)
fi
VIPS_CFLAGS="$VIPS_CFLAGS $GSF_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $GSF_LIBS"
AC_ARG_WITH([fftw],
AS_HELP_STRING([--without-fftw], [build without fftw (default: test)]))
if test x"$with_fftw" != x"no"; then
PKG_CHECK_MODULES(FFTW, fftw3,
[AC_DEFINE(HAVE_FFTW,1,[define if you have fftw3 installed.])
with_fftw=yes
PACKAGES_USED="$PACKAGES_USED fftw3"
],
[AC_MSG_WARN([fftw not found; disabling fftw support])
with_fftw=no
]
)
fi
VIPS_CFLAGS="$VIPS_CFLAGS $FFTW_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $FFTW_LIBS"
# ImageMagick
AC_ARG_WITH([magick],
AS_HELP_STRING([--without-magick], [build without libMagic (default: test)]),
[with_magick=$withval],
[with_magick=$gmodule_with_flag])
# libMagic as a dynamically loadable module
AS_IF([test x"$with_magick" = x"module"],
[with_magick_module=$gmodule_supported_flag],
[with_magick_module=no])
AC_ARG_WITH([magickpackage],
AS_HELP_STRING([--with-magickpackage=PACKAGE],
[use magick PACKAGE (default: MagickCore; try GraphicsMagick to build against gm instead)]))
if test x"$with_magickpackage" = x"yes"; then
AC_MSG_WARN([--with-magickpackage needs an argument, ignoring])
with_magick=no
with_magick_module=no
else
if test x"$with_magickpackage" = x""; then
# set the default magick package ... very old imagemagicks called it
# ImageMagick
PKG_CHECK_MODULES(MAGICK_WAND, MagickCore,
[with_magickpackage=MagickCore
],
[PKG_CHECK_MODULES(IMAGE_MAGICK, ImageMagick,
[with_magickpackage=ImageMagick
],
[AC_MSG_WARN([neither MagickCore nor ImageMagick found; disabling Magick support])
with_magick=no
with_magick_module=no
]
)
]
)
fi
fi
# we have a separate loader for magick7 with fewer ifdef
# options; only test for features on the magick6 case
magick_version=
if test x"$with_magick" != x"no"; then
PKG_CHECK_MODULES(MAGICK, $with_magickpackage >= 7.0,
[AC_DEFINE(HAVE_MAGICK7,1,[define if you have libMagick7 installed.])
with_magick=yes
magick7=yes
magick_version=magick7
AS_IF([test x"$with_magick_module" = x"no"],
[PACKAGES_USED="$PACKAGES_USED $with_magickpackage"])
],
[PKG_CHECK_MODULES(MAGICK, $with_magickpackage,
[AC_DEFINE(HAVE_MAGICK6,1,[define if you have libMagick6 installed.])
with_magick=yes
magick6=yes
magick_version=magick6
AS_IF([test x"$with_magick_module" = x"no"],
[PACKAGES_USED="$PACKAGES_USED $with_magickpackage"])
],
[AC_MSG_WARN([$with_magickpackage not found; disabling Magick support])
with_magick=no
with_magick_module=no
]
)
]
)
else
with_magick=no
with_magick_module=no
magick6=no
magick_version=none
with_magickpackage=none
fi
if test x"$magick6" = x"yes"; then
# do we have number_scenes in image_info ... imagemagick uses this
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $MAGICK_CFLAGS"
AC_CHECK_MEMBER([struct _ImageInfo.number_scenes],
AC_DEFINE(HAVE_NUMBER_SCENES,1,
[define if your magick has ImageInfo.number_scenes.]),
[],
[#include <magick/api.h>])
CFLAGS="$save_CFLAGS"
fi
if test x"$magick6" = x"yes"; then
# the magick6 API varies a lot between magick versions, and between GM and IM
# set CFLAGS too, since CHECK_FUNCS will try to compile / link / run code.
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$LIBS $MAGICK_LIBS"
CFLAGS="$CFLAGS $MAGICK_CFLAGS"
AC_CHECK_FUNCS([InheritException AcquireExceptionInfo SetImageProperty SetImageExtent AcquireImage GetVirtualPixels ResetImageProfileIterator ResetImageAttributeIterator ResetImagePropertyIterator MagickCoreGenesis SetImageOption BlobToStringInfo OptimizePlusImageLayers OptimizeImageTransparency])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
if test x"$magick6" = x"yes"; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $MAGICK_CFLAGS"
# the range of ColorspaceType has expanded several times
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <magick/api.h>],
[ColorspaceType colorspace = CMYColorspace]
)],
[AC_DEFINE(HAVE_CMYCOLORSPACE,1,
[define if your Magick has CMYColorspace.])
]
)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <magick/api.h>],
[ColorspaceType colorspace = HCLpColorspace]
)],
[AC_DEFINE(HAVE_HCLPCOLORSPACE,1,
[define if your Magick has HCLpColorspace.])
]
)
# GetImageMagick() takes two args under GM, three under IM
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <magick/api.h>],
[(void)GetImageMagick(NULL, 0, NULL)]
)],
[AC_DEFINE(HAVE_GETIMAGEMAGICK3,1,
[define if your GetImageMagick() takes three arguments.])
]
)
CFLAGS="$save_CFLAGS"
fi
# have flags to turn load and save off independently ... some people will want
# save but not load, for example
AC_ARG_ENABLE([magickload],
AS_HELP_STRING([--disable-magickload],
[disable libMagic load (default: enabled)]))
AC_ARG_ENABLE([magicksave],
AS_HELP_STRING([--disable-magicksave],
[disable libMagic save (default: enabled)]))
if test x"$enable_magicksave" != x"yes"; then
# we need ImportImagePixels ... GM is missing this sadly
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(ImportImagePixels,[
AC_DEFINE(HAVE_IMPORTIMAGEPIXELS,1,
[define if you have ImportImagePixels.])
],[]
)
AC_CHECK_FUNCS(ImagesToBlob,[
AC_DEFINE(HAVE_IMAGESTOBLOB,1,
[define if you have ImagesToBlob.])
],[]
)
LIBS="$save_LIBS"
fi
if test x"$with_magick" != x"no"; then
if test x"$enable_magickload" != x"no"; then
AC_DEFINE(ENABLE_MAGICKLOAD,1,[define to enable load with libMagick])
enable_magickload=yes
fi
if test x"$enable_magicksave" != x"no"; then
AC_DEFINE(ENABLE_MAGICKSAVE,1,[define to enable save with libMagick])
enable_magicksave=yes
fi
else
enable_magickload=no
enable_magicksave=no
fi
AS_IF([test x"$with_magick_module" = x"yes"],
[AC_DEFINE([MAGICK_MODULE], [1], [define to build libMagic as a dynamically loadable module.])],
[VIPS_CFLAGS="$VIPS_CFLAGS $MAGICK_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $MAGICK_LIBS"])
AM_CONDITIONAL(MAGICK_MODULE, [test x"$with_magick_module" = x"yes"])
# orc
AC_ARG_WITH([orc],
AS_HELP_STRING([--without-orc], [build without orc (default: test)]))
if test x"$with_orc" != x"no"; then
# we use loadpw etc.
PKG_CHECK_MODULES(ORC, orc-0.4 >= 0.4.11,
[AC_DEFINE(HAVE_ORC,1,[define if you have orc-0.4.11 or later installed.])
with_orc=yes
PACKAGES_USED="$PACKAGES_USED orc-0.4"
save_LIBS="$LIBS"
LIBS="$LIBS $ORC_LIBS"
AC_CHECK_FUNCS(orc_program_get_error,
AC_DEFINE(HAVE_ORC_PROGRAM_GET_ERROR,1,
[define if your orc has orc_program_get_error.]))
LIBS="$save_LIBS"
],
[AC_MSG_WARN([orc-0.4.11 or later not found; disabling orc support])
with_orc=no
]
)
fi
# orc 0.4.30+ works with cf-protection, but 0.4.30 has a bug with multiple
# definitions of OrcTargetPowerPCFlags, so insist on 0.4.31
if test x"$with_orc" = x"yes"; then
PKG_CHECK_MODULES(ORC_CF_PROTECTION, orc-0.4 >= 0.4.31,
[AC_DEFINE(HAVE_ORC_CF_PROTECTION,1,
[define if your orc works with cf-protection.]
)
],
[:
]
)
fi
VIPS_CFLAGS="$VIPS_CFLAGS $ORC_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $ORC_LIBS"
# lcms ... refuse to use lcms1
AC_ARG_WITH([lcms],
AS_HELP_STRING([--without-lcms], [build without lcms (default: test)]))
if test x"$with_lcms" != x"no"; then
PKG_CHECK_MODULES(LCMS, lcms2,
[AC_DEFINE(HAVE_LCMS2,1,[define if you have lcms2 installed.])
with_lcms="yes (lcms2)"
PACKAGES_USED="$PACKAGES_USED lcms2"
],
[AC_MSG_WARN([lcms2 not found; disabling ICC profile support])
with_lcms=no
]
)
fi
# we need a conditional for this to only compile in fallback profiles if lcms
# is detected
AM_CONDITIONAL(ENABLE_LCMS, [test x"$with_lcms" != x"no"])
VIPS_CFLAGS="$VIPS_CFLAGS $LCMS_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $LCMS_LIBS"
# OpenEXR
AC_ARG_WITH([OpenEXR],
AS_HELP_STRING([--without-OpenEXR], [build without OpenEXR (default: test)]))
# require 1.2.2 since 1.2.1 has a broken ImfCloseTiledInputFile()
if test x"$with_OpenEXR" != x"no"; then
PKG_CHECK_MODULES(OPENEXR, OpenEXR >= 1.2.2,
[AC_DEFINE(HAVE_OPENEXR,1,[define if you have OpenEXR >= 1.2.2 installed.])
with_OpenEXR=yes
PACKAGES_USED="$PACKAGES_USED OpenEXR"
],
[AC_MSG_WARN([OpenEXR not found; disabling OpenEXR support])
with_OpenEXR=no
]
)
fi
VIPS_CFLAGS="$VIPS_CFLAGS $OPENEXR_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $OPENEXR_LIBS"
# nifti
AC_ARG_WITH([nifti],
AS_HELP_STRING([--without-nifti], [build without nifti (default: test)]))
if test x"$with_nifti" != x"no"; then
FIND_NIFTI([
with_nifti=yes
],[
with_nifti=no
]
)
fi
VIPS_CFLAGS="$VIPS_CFLAGS $NIFTI_CFLAGS"
VIPS_INCLUDES="$VIPS_INCLUDES $NIFTI_INCLUDES"
VIPS_LIBS="$VIPS_LIBS $NIFTI_LIBS"
# jpeg-xl
AC_ARG_WITH([libjxl],
AS_HELP_STRING([--without-libjxl], [build without libjxl (default: test)]),
[with_libjxl=$withval],
[with_libjxl=test])
# libjxl as a dynamically loadable module
AS_IF([test x"$with_libjxl" = x"module" -o x"$with_libjxl" = x"test"],
[with_libjxl_module=$gmodule_supported_flag],
[with_libjxl_module=no])
if test x"$with_libjxl" != x"no"; then
PKG_CHECK_MODULES(LIBJXL, libjxl_threads >= 0.5 libjxl >= 0.5,
[AC_DEFINE(HAVE_LIBJXL,1,[define if you have libjxl >= 0.5 installed.])
with_libjxl=yes
AS_IF([test x"$with_libjxl_module" = x"no"],
[PACKAGES_USED="$PACKAGES_USED libjxl"])
],
[AS_IF([test x"$with_libjxl" = x"test"],
AC_MSG_WARN([libjxl not found; disabling libjxl support]),
AC_MSG_ERROR([libjxl not found]))
with_libjxl=no
with_libjxl_module=no
]
)
fi
if test x"$with_libjxl" = x"yes"; then
save_LIBS="$LIBS"
LIBS="$LIBS $LIBJXL_LIBS"
# Introduced in 0.6
AC_CHECK_FUNCS(JxlEncoderInitBasicInfo,[
AC_DEFINE(HAVE_LIBJXL_JXLENCODERINITBASICINFO,1,
[define if you have JxlEncoderInitBasicInfo.])
],[]
)
LIBS="$save_LIBS"
fi
AS_IF([test x"$with_libjxl_module" = x"yes"],
[AC_DEFINE([LIBJXL_MODULE], [1], [define to build libjxl as a dynamically loadable module.])],
[VIPS_CFLAGS="$VIPS_CFLAGS $LIBJXL_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $LIBJXL_LIBS"])
AM_CONDITIONAL(LIBJXL_MODULE, [test x"$with_libjxl_module" = x"yes"])
# openjpeg
AC_ARG_WITH([libopenjp2],
AS_HELP_STRING([--without-libopenjp2],
[build without libopenjp2 (default: test)]))
# 2.4 is the first one to have working threading and tiling
if test x"$with_libopenjp2" != x"no"; then
PKG_CHECK_MODULES(LIBOPENJP2, libopenjp2 >= 2.4,
[AC_DEFINE(HAVE_LIBOPENJP2,1,
[define if you have libopenjp2 >= 2.4 installed.])
with_libopenjp2=yes
PACKAGES_USED="$PACKAGES_USED libopenjp2"
],
[AC_MSG_WARN([libopenjp2 not found; disabling libopenjp2 support])
with_libopenjp2=no
]
)
fi
VIPS_CFLAGS="$VIPS_CFLAGS $LIBOPENJP2_CFLAGS"
VIPS_INCLUDES="$VIPS_INCLUDES $LIBOPENJP2_INCLUDES"
VIPS_LIBS="$VIPS_LIBS $LIBOPENJP2_LIBS"
# libheif
AC_ARG_WITH([heif],
AS_HELP_STRING([--without-heif], [build without libheif (default: test)]),
[with_heif=$withval],
[with_heif=$gmodule_with_flag])
# libheif as a dynamically loadable module
AS_IF([test x"$with_heif" = x"module"],
[with_heif_module=$gmodule_supported_flag],
[with_heif_module=no])
if test x"$with_heif" != x"no"; then
PKG_CHECK_MODULES(HEIF, libheif >= 1.3.0,
[with_heif=yes
PKG_CHECK_VAR([have_h265_decoder], [libheif], [builtin_h265_decoder])
PKG_CHECK_VAR([have_avif_decoder], [libheif], [builtin_avif_decoder])
# test for !=no so that we work for older libheif which does not have
# this variable
if test x"$have_h265_decoder" != x"no" -o x"$have_avif_decoder" = x"yes"; then
AC_DEFINE(HAVE_HEIF_DECODER,1,
[define if your libheif has decode support.])
fi
PKG_CHECK_VAR([have_h265_encoder], [libheif], [builtin_h265_encoder])
PKG_CHECK_VAR([have_avif_encoder], [libheif], [builtin_avif_encoder])
if test x"$have_h265_encoder" != x"no" -o x"$have_avif_encoder" = x"yes"; then
AC_DEFINE(HAVE_HEIF_ENCODER,1,
[define if your libheif has encode support.])
fi
AS_IF([test x"$with_heif_module" = x"no"],
[PACKAGES_USED="$PACKAGES_USED libheif"])
],
[AC_MSG_WARN([libheif >= 1.3.0 not found; disabling HEIF support])
with_heif=no
with_heif_module=no
have_h265_decoder=
have_h265_encoder=
have_avif_decoder=
have_avif_encoder=
]
)
fi
AS_IF([test x"$with_heif_module" = x"yes"],
[AC_DEFINE([HEIF_MODULE], [1], [define to build libheif as a dynamically loadable module.])],
[VIPS_CFLAGS="$VIPS_CFLAGS $HEIF_CFLAGS"
VIPS_LIBS="$VIPS_LIBS $HEIF_LIBS"])
AM_CONDITIONAL(HEIF_MODULE, [test x"$with_heif_module" = x"yes"])
# color profile support added in 1.3.3
if test x"$with_heif" = x"yes"; then
save_LIBS="$LIBS"
LIBS="$LIBS $HEIF_LIBS"
AC_CHECK_FUNCS(heif_image_handle_get_raw_color_profile,[
AC_DEFINE(HAVE_HEIF_COLOR_PROFILE,1,
[define if you have heif_image_handle_get_raw_color_profile.])
],[]
)
LIBS="$save_LIBS"
fi
# heif_context_set_maximum_image_size_limit added in 1.6.0
if test x"$with_heif" = x"yes"; then
save_LIBS="$LIBS"
LIBS="$LIBS $HEIF_LIBS"
AC_CHECK_FUNCS(heif_context_set_maximum_image_size_limit,[
AC_DEFINE(HAVE_HEIF_SET_MAX_IMAGE_SIZE_LIMIT,1,
[define if you have heif_context_set_maximum_image_size_limit.])
],[]
)
LIBS="$save_LIBS"
fi
# heif_main_brand added in 1.4.0, but heif_avif appeared in 1.7 ... just check
# the libheif version number since testing for enums is annoying
if test x"$with_heif" = x"yes"; then
PKG_CHECK_MODULES(HEIF_AVIF, libheif >= 1.7.0, [
AC_DEFINE(HAVE_HEIF_AVIF,1,[define if you have heif_avif.])
], [
])
fi
# heif_decoding_options.convert_hdr_to_8bit added in 1.7.0
if test x"$with_heif" = x"yes"; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $HEIF_CFLAGS"
AC_CHECK_MEMBER([struct heif_decoding_options.convert_hdr_to_8bit],[
AC_DEFINE(HAVE_HEIF_DECODING_OPTIONS_CONVERT_HDR_TO_8BIT,1,
[define if you have heif_decoding_options.convert_hdr_to_8bit])
],[],
[#include <libheif/heif.h>])
CFLAGS="$save_CFLAGS"
fi
# pdfium
AC_ARG_WITH([pdfium],
AS_HELP_STRING([--without-pdfium], [build without pdfium (default: test)]))
# pick 4200 as the starting version number ... no reason, really, it'd
# probably work with much older versions
if test x"$with_pdfium" != x"no"; then
PKG_CHECK_MODULES(PDFIUM, pdfium >= 4200, [
AC_DEFINE(HAVE_PDFIUM,1,[define if you have pdfium > 4200.])
if test x"$with_poppler" != x"no"; then
AC_MSG_WARN([PDFium found, disabling poppler])
with_poppler=no
fi
with_pdfium=yes
PACKAGES_USED="$PACKAGES_USED pdfium"
], [
with_pdfium=no
])
fi