-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
347 lines (305 loc) · 9.01 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
AC_INIT([imlib2],[1.12.3],[[email protected]])
AC_CONFIG_SRCDIR(configure.ac)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(1.6 dist-xz -Wno-portability)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_USE_SYSTEM_EXTENSIONS
AC_C_BIGENDIAN
AC_PROG_CC
AM_PROG_AS
AC_PROG_CXX
AC_C_CONST
dnl Next two lines is a hack to prevent libtool checking for CXX/F77
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
LT_INIT
VERSION_CUR=13
VERSION_REV=3
VERSION_AGE=12
lt_version=${VERSION_CUR}:${VERSION_REV}:${VERSION_AGE}
AC_SUBST(lt_version)
PKG_PROG_PKG_CONFIG
AC_DEFUN([EC_LOADER_CHECK], [
m4_pushdef([NMDN], m4_tolower($1))
m4_pushdef([NMUP], m4_toupper($1))
m4_pushdef([DFLT], m4_strip($2))
AC_MSG_CHECKING([whether to enable NMUP support])
AC_ARG_WITH([NMDN],
AS_HELP_STRING([--without-NMDN], [Disable NMUP loader]),
[ NMDN[]_loader="$withval" ], [ NMDN[]_loader="DFLT" ]
)
AC_MSG_RESULT($NMDN[]_loader)
if test "$NMDN[]_loader" != "no"; then
ifelse([$3], [], [
NMDN[]_ok="no"
], [
PKG_CHECK_MODULES(NMUP, $3, [ NMDN[]_ok="yes" ], [ NMDN[]_ok="no" ])
])
ifelse([$4], [],, [
if test "$NMDN[]_ok" = "no" ; then
$4
fi
])
if test "$NMDN[]_ok" = "no" ; then
if test "$NMDN[]_loader" = "yes" ; then
AC_MSG_ERROR([NMUP support was requested but system does not support it])
else
AC_MSG_WARN([*** NMUP support will not be built ($2 not found) ***])
fi
fi
else
NMDN[]_ok="no"
fi
if test "$NMDN[]_ok" = "yes" ; then
AC_DEFINE(BUILD_[]NMUP[]_LOADER, [ 1 ], [ Build NMUP loader ])
fi
AM_CONDITIONAL(BUILD_[]NMUP[]_LOADER, [ test "$NMDN[]_ok" = "yes" ])
m4_popdef([NMDN])
m4_popdef([NMUP])
])
AC_ARG_ENABLE([filters],
[AS_HELP_STRING([--enable-filters], [Enable filters @<:@default=yes@:>@])],
enable_filters="$enableval",
enable_filters="yes"
)
if test "$enable_filters" = "yes"; then
AC_DEFINE(ENABLE_FILTERS, 1, [Enable filters])
fi
AM_CONDITIONAL(ENABLE_FILTERS, test "$enable_filters" = "yes")
AC_ARG_ENABLE([text],
[AS_HELP_STRING([--enable-text], [Enable text (TrueType font functions) @<:@default=yes@:>@])],
enable_text="$enableval",
enable_text="yes"
)
if test "$enable_text" = "yes"; then
AC_DEFINE(ENABLE_TEXT, 1, [Enable text functions])
fi
AM_CONDITIONAL(ENABLE_TEXT, test "$enable_text" = "yes")
mmx=no
amd64=no
case $host_cpu in
i*86) mmx="yes";;
x86_64) amd64="yes";;
amd64) amd64="yes";;
esac
case $host_os in
solaris*) mmx="no";;
darwin*) mmx="no";;
esac
AC_ARG_ENABLE([mmx],
[AS_HELP_STRING([--enable-mmx], [attempt compiling using x86 mmx assembly @<:@default=auto@:>@])],
[
if test x$enableval = xyes; then
mmx=yes
# Cannot compile with both options enabled
amd64=no
else
mmx=no
fi
]
)
AC_ARG_ENABLE([amd64],
[AS_HELP_STRING([--enable-amd64], [attempt compiling using amd64 assembly @<:@default=auto@:>@])],
[
if test x$enableval = xyes; then
amd64=yes
mmx=no
else
amd64=no
fi
]
)
AC_MSG_CHECKING(whether to enable x86 mmx support)
if test x$mmx = xyes; then
AC_DEFINE(DO_MMX_ASM, 1, [enabling MMX Assembly])
fi
AC_MSG_RESULT($mmx)
AM_CONDITIONAL(BUILD_MMX, test x$mmx = xyes)
AC_MSG_CHECKING(whether to enable amd64 asm support)
if test x$amd64 = xyes; then
AC_DEFINE(DO_AMD64_ASM, 1, [enabling AMD64 Assembly])
fi
AC_MSG_RESULT($amd64)
AM_CONDITIONAL(BUILD_AMD64, test x$amd64 = xyes)
if test "$enable_text" = "yes"; then
PKG_CHECK_MODULES(FREETYPE, freetype2)
fi
AC_PATH_X
AC_PATH_XTRA
if test "x$have_x" = "xno"; then
# If --without-x was passed, this will be "disabled" instead of "no" --
# so always treat "no" as an error
AC_MSG_ERROR(
[no X support found. Use --x-includes and --x-libraries to specify the X
path on your system, or --without-x to disable X support.])
fi
if test "x$have_x" = "xyes"; then
AC_DEFINE(BUILD_X11, 1, [enabling X11 support])
AC_MSG_CHECKING(whether to enable X11 MIT-SHM FD-passing support)
AC_ARG_WITH([x-shm-fd],
[AS_HELP_STRING([--without-x-shm-fd], [Disable X11 MIT-SHM FD-passing support])],
[
if test "$withval" = no ; then
x_shm_fd=no
else
x_shm_fd=yes
fi
],
[ x_shm_fd=auto ]
)
AC_MSG_RESULT($x_shm_fd)
if test "$x_shm_fd" != no ; then
PKG_CHECK_MODULES(X_SHM_FD, x11-xcb xcb xcb-shm >= 1.9, [ x_shm_fd="yes" ], [ x_shm_fd="no"])
else
x_shm_fd="no"
fi
if test "$x_shm_fd" = yes ; then
AC_DEFINE(HAVE_X11_SHM_FD, 1, [enabling X11 MIT-SHM FD-passing support])
fi
else
have_x="no"
x_shm_fd="no"
fi
AM_CONDITIONAL(BUILD_X11, test "x$have_x" = "xyes")
AC_CHECK_LIB(dl, dlopen, DLOPEN_LIBS=-ldl)
AC_SUBST(DLOPEN_LIBS)
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
[have_clock_gettime=no])])
if test "x$have_clock_gettime" != xno; then
AC_DEFINE(USE_MONOTONIC_CLOCK, 1, [Use monotonic clock from clock_gettime()])
if test "x$have_clock_gettime" != xyes; then
AC_SUBST(CLOCK_LIBS, [$have_clock_gettime])
fi
fi
# Regular image loaders
loader_check_gif() {
AC_CHECK_LIB(gif, DGifOpenFileName, gif_libs="-lgif" gif_ok=yes, gif_ok=no)
if test "$gif_ok" = yes; then
AC_CHECK_HEADER([gif_lib.h], , gif_ok=no)
if test "$gif_ok" = yes; then
GIF_LIBS=$gif_libs
AC_SUBST(GIF_LIBS)
fi
fi
}
EC_LOADER_CHECK(GIF, auto, , loader_check_gif)
EC_LOADER_CHECK(HEIF, auto, libheif)
EC_LOADER_CHECK(JPEG, auto, libjpeg)
EC_LOADER_CHECK(J2K, auto, libopenjp2)
EC_LOADER_CHECK(JXL, auto, libjxl libjxl_threads)
EC_LOADER_CHECK(PNG, auto, libpng)
EC_LOADER_CHECK(PS, auto, libspectre)
EC_LOADER_CHECK(RAW, auto, libraw)
EC_LOADER_CHECK(SVG, auto, librsvg-2.0 >= 2.46)
EC_LOADER_CHECK(TIFF, auto, libtiff-4)
EC_LOADER_CHECK(WEBP, auto, libwebpdemux)
EC_LOADER_CHECK(Y4M, auto, libyuv)
# Decompressors
loader_check_bz2() {
AC_CHECK_LIB(bz2, BZ2_bzRead, bz2_ok=yes, bz2_ok=no)
if test "$bz2_ok" = yes; then
AC_CHECK_HEADER([bzlib.h], , bz2_ok=no)
if test "$bz2_ok" = yes; then
BZ2_LIBS="-lbz2"
fi
fi
}
EC_LOADER_CHECK(BZ2, auto, bzip2, loader_check_bz2)
EC_LOADER_CHECK(LZMA, auto, liblzma)
EC_LOADER_CHECK(ZLIB, auto, zlib)
# Containers
EC_LOADER_CHECK(ID3, auto, id3tag)
AM_CONDITIONAL(BUILD_TEST, false)
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [Enable debug features @<:@default=no@:>@])],
[
if test x$enableval = xyes; then
AC_DEFINE(IMLIB2_DEBUG, 1, [Enable debug features])
fi
]
)
AM_CONDITIONAL(BUILD_DEBUG, test "$enable_debug" = "yes")
AC_ARG_ENABLE([doc-build],
[AS_HELP_STRING([--enable-doc-build], [Enable building documentation (not installed) @<:@default=no@:>@])]
)
AM_CONDITIONAL(BUILD_DOC, test "$enable_doc_build" = "yes")
EC_C_WARNINGS()
EC_C_VISIBILITY(yes)
EC_C_PACKING()
EC_C_ASAN()
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
VERSION_MAJOR=`echo $VERSION | awk -F. '{print $1}'`
VERSION_MINOR=`echo $VERSION | awk -F. '{print $2}'`
VERSION_MICRO=`echo $VERSION | awk -F. '{print $3}'`
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_MICRO)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_FILES([
Makefile
imlib2.pc
src/Makefile
src/lib/Makefile
src/lib/Imlib2.h
src/bin/Makefile
src/modules/Makefile
src/modules/filters/Makefile
src/modules/loaders/Makefile
test/Makefile
data/Makefile
data/fonts/Makefile
data/images/Makefile
doc/Makefile
doc/Doxyfile
doc/imlib2_intro.dox
README
])
AC_OUTPUT
#####################################################################
## Info
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo "Configuration Options Summary:"
echo
echo "Image loaders:"
echo " Regular image loaders"
echo " GIF.....................: $gif_ok"
echo " HEIF....................: $heif_ok"
echo " JPEG....................: $jpeg_ok"
echo " J2K.....................: $j2k_ok"
echo " JXL.....................: $jxl_ok"
echo " PNG.....................: $png_ok"
echo " PS......................: $ps_ok"
echo " RAW.....................: $raw_ok"
echo " SVG.....................: $svg_ok"
echo " TIFF....................: $tiff_ok"
echo " WEBP....................: $webp_ok"
echo " Y4M.....................: $y4m_ok"
echo " Decompressors"
echo " BZIP2...................: $bz2_ok"
echo " LZMA(XZ)................: $lzma_ok"
echo " ZLIB....................: $zlib_ok"
echo " Containers"
echo " ID3.....................: $id3_ok"
echo
echo "Build for X11.............: $have_x"
echo "Use X MIT-SHM FD-passing..: $x_shm_fd"
echo
echo "Use X86 MMX for speed.....: $mmx"
echo "Use AMD64 for speed.......: $amd64"
echo
echo "Include filters...........: $enable_filters"
echo "Include text functions....: $enable_text"
echo "Use visibility hiding.....: $enable_visibility_hiding"
echo "Use struct packing........: $enable_packing"
echo
echo "Installation path.........: $prefix"
echo