1 | # configure.ac
|
---|
2 |
|
---|
3 | # Copyright (c) 2018-2024 Cosmin Truta
|
---|
4 | # Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
---|
5 |
|
---|
6 | # This code is released under the libpng license.
|
---|
7 | # For conditions of distribution and use, see the disclaimer
|
---|
8 | # and license in png.h
|
---|
9 |
|
---|
10 | dnl Process this file with autoconf to produce a configure script.
|
---|
11 | dnl
|
---|
12 | dnl Minor upgrades (compatible ABI): increment the package version
|
---|
13 | dnl (third field in two places below) and set the PNGLIB_RELEASE
|
---|
14 | dnl variable.
|
---|
15 | dnl
|
---|
16 | dnl Major upgrades (incompatible ABI): increment the package major
|
---|
17 | dnl version (second field, or first if desired), set the minor
|
---|
18 | dnl to 0, set PNGLIB_MAJOR below *and* follow the instructions in
|
---|
19 | dnl Makefile.am to upgrade the package name.
|
---|
20 |
|
---|
21 | dnl This is here to prevent earlier autoconf from being used, it
|
---|
22 | dnl should not be necessary to regenerate configure if the time
|
---|
23 | dnl stamps are correct
|
---|
24 | AC_PREREQ([2.68])
|
---|
25 |
|
---|
26 | dnl Version number stuff here:
|
---|
27 |
|
---|
28 | AC_INIT([libpng],[1.6.43],[[email protected]])
|
---|
29 | AC_CONFIG_MACRO_DIR([scripts/autoconf])
|
---|
30 |
|
---|
31 | # libpng does not follow GNU file name conventions (hence 'foreign')
|
---|
32 | # color-tests requires automake 1.11 or later
|
---|
33 | # silent-rules requires automake 1.11 or later
|
---|
34 | # dist-xz requires automake 1.11 or later
|
---|
35 | # 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
|
---|
36 | # 1.13 is required for parallel tests
|
---|
37 | AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects])
|
---|
38 | # The following line causes --disable-maintainer-mode to be the default to
|
---|
39 | # configure. This is necessary because libpng distributions cannot rely on the
|
---|
40 | # time stamps of the autotools generated files being correct
|
---|
41 | AM_MAINTAINER_MODE
|
---|
42 |
|
---|
43 | dnl configure.ac and Makefile.am expect automake 1.11.2 or a compatible later
|
---|
44 | dnl version; aclocal.m4 will generate a failure if you use a prior version of
|
---|
45 | dnl automake, so the following is not necessary (and is not defined anyway):
|
---|
46 | dnl AM_PREREQ([1.11.2])
|
---|
47 | dnl stop configure from automagically running automake
|
---|
48 |
|
---|
49 | PNGLIB_VERSION=1.6.43
|
---|
50 | PNGLIB_MAJOR=1
|
---|
51 | PNGLIB_MINOR=6
|
---|
52 | PNGLIB_RELEASE=43
|
---|
53 |
|
---|
54 | dnl End of version number stuff
|
---|
55 |
|
---|
56 | AC_CONFIG_SRCDIR([pngget.c])
|
---|
57 | AC_CONFIG_HEADERS([config.h])
|
---|
58 |
|
---|
59 | # Check for basic programs.
|
---|
60 | AC_LANG([C])
|
---|
61 | AC_PROG_CC
|
---|
62 | AM_PROG_AS
|
---|
63 | LT_PATH_LD
|
---|
64 | AC_PROG_CPP
|
---|
65 | AC_PROG_AWK
|
---|
66 | AC_PROG_INSTALL
|
---|
67 | AC_PROG_LN_S
|
---|
68 | AC_PROG_MAKE_SET
|
---|
69 |
|
---|
70 | dnl libtool/libtoolize; version 2.4.2 is the tested version. This or any
|
---|
71 | dnl compatible later version may be used
|
---|
72 | LT_INIT([win32-dll])
|
---|
73 | LT_PREREQ([2.4.2])
|
---|
74 |
|
---|
75 | dnl Declare the AWK variable.
|
---|
76 | AC_ARG_VAR(AWK, [AWK language processor])
|
---|
77 |
|
---|
78 | # Some awk implementations crash when confronted with pnglibconf.dfa.
|
---|
79 | # Run a test now, to make sure this doesn't happen.
|
---|
80 | AC_MSG_CHECKING([if awk ($AWK) works])
|
---|
81 | if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\
|
---|
82 | ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
|
---|
83 | ${srcdir}/pngusr.dfa 1>&2
|
---|
84 | then
|
---|
85 | AC_MSG_RESULT([yes])
|
---|
86 | else
|
---|
87 | AC_MSG_FAILURE([no], 1)
|
---|
88 | fi
|
---|
89 |
|
---|
90 | # This is a remnant of the old cc -E validation, where it may have been
|
---|
91 | # necessary to use a different preprocessor for .dfn files
|
---|
92 | DFNCPP="$CPP"
|
---|
93 | AC_SUBST(DFNCPP)
|
---|
94 |
|
---|
95 | AC_ARG_ENABLE([tests],
|
---|
96 | AS_HELP_STRING([--disable-tests],
|
---|
97 | [do not build the test programs (default is to build)]),
|
---|
98 | [enable_tests="$enableval"],
|
---|
99 | [enable_tests=yes])
|
---|
100 |
|
---|
101 | AM_CONDITIONAL([ENABLE_TESTS],
|
---|
102 | [test "$enable_tests" != "no"])
|
---|
103 |
|
---|
104 | AC_ARG_ENABLE([tools],
|
---|
105 | AS_HELP_STRING([--disable-tools],
|
---|
106 | [do not build the auxiliary tools (default is to build)]),
|
---|
107 | [enable_tools="$enableval"],
|
---|
108 | [enable_tools=yes])
|
---|
109 |
|
---|
110 | AM_CONDITIONAL([ENABLE_TOOLS],
|
---|
111 | [test "$enable_tools" != "no"])
|
---|
112 |
|
---|
113 | # -Werror cannot be passed to GCC in CFLAGS because configure will fail
|
---|
114 | # (it checks the compiler with a program that generates a warning).
|
---|
115 | # Add the following option to deal with this:
|
---|
116 | AC_ARG_VAR(PNG_COPTS,
|
---|
117 | [additional flags for the C compiler, to be used for options that would]
|
---|
118 | [cause configure itself to fail])
|
---|
119 | AC_ARG_ENABLE(werror,
|
---|
120 | AS_HELP_STRING([[[--enable-werror[=OPT]]]],
|
---|
121 | [Pass -Werror or the given argument to the compiler if it is supported]),
|
---|
122 | [test "$enable_werror" = "yes" && enable_werror="-Werror"
|
---|
123 | if test "$enable_werror" != "no"; then
|
---|
124 | sav_CFLAGS="$CFLAGS"
|
---|
125 | CFLAGS="$enable_werror $CFLAGS"
|
---|
126 | AC_MSG_CHECKING([if the compiler allows $enable_werror])
|
---|
127 | AC_COMPILE_IFELSE(
|
---|
128 | [AC_LANG_SOURCE([
|
---|
129 | [int main(int argc, char **argv){]
|
---|
130 | [return argv[argc-1][0];]
|
---|
131 | [}]])],
|
---|
132 | AC_MSG_RESULT(yes)
|
---|
133 | PNG_COPTS="$PNG_COPTS $enable_werror",
|
---|
134 | AC_MSG_RESULT(no))
|
---|
135 | CFLAGS="$sav_CFLAGS"
|
---|
136 | fi],)
|
---|
137 |
|
---|
138 | # For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89.
|
---|
139 | # In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining
|
---|
140 | # _POSIX_SOURCE to 1. This is incompatible with the new default mode, so
|
---|
141 | # we test for that and force the "-std=c89" compiler option:
|
---|
142 | AC_MSG_CHECKING([if we need to force back C standard to C89])
|
---|
143 | AC_COMPILE_IFELSE(
|
---|
144 | [AC_LANG_PROGRAM([
|
---|
145 | [#define _POSIX_SOURCE 1]
|
---|
146 | [#include <stdio.h>]
|
---|
147 | ])],
|
---|
148 | AC_MSG_RESULT(no),[
|
---|
149 | if test "x$GCC" != "xyes"; then
|
---|
150 | AC_MSG_ERROR(
|
---|
151 | [Forcing back to C89 is required but the flags are only known for GCC])
|
---|
152 | fi
|
---|
153 | AC_MSG_RESULT(yes)
|
---|
154 | CFLAGS="$CFLAGS -std=c89"
|
---|
155 | ])
|
---|
156 |
|
---|
157 | # Checks for structures and compiler characteristics.
|
---|
158 | AC_STRUCT_TM
|
---|
159 | AC_C_RESTRICT
|
---|
160 |
|
---|
161 | # Checks for library functions.
|
---|
162 | AC_CHECK_FUNCS([pow], ,
|
---|
163 | [AC_CHECK_LIB([m], [pow], , [AC_MSG_ERROR([cannot find pow])])])
|
---|
164 |
|
---|
165 | # Some later POSIX 1003.1 functions are required for test programs, failure
|
---|
166 | # here is soft (the corresponding test program is not built).
|
---|
167 | AC_CHECK_FUNC([clock_gettime], , [AC_MSG_WARN([not building timepng])])
|
---|
168 | AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
|
---|
169 |
|
---|
170 | AC_ARG_WITH(zlib-prefix,
|
---|
171 | AS_HELP_STRING([[[--with-zlib-prefix]]],
|
---|
172 | [prefix that may have been used in installed zlib]),
|
---|
173 | [ZPREFIX=${withval}],
|
---|
174 | [ZPREFIX='z_'])
|
---|
175 | AC_CHECK_LIB([z], [zlibVersion], ,
|
---|
176 | [AC_CHECK_LIB([z], [${ZPREFIX}zlibVersion], ,
|
---|
177 | [AC_MSG_ERROR([zlib not installed])])])
|
---|
178 |
|
---|
179 | # The following is for pngvalid, to ensure it catches FP errors even on
|
---|
180 | # platforms that don't enable FP exceptions, the function appears in the math
|
---|
181 | # library (typically), it's not an error if it is not found.
|
---|
182 | AC_CHECK_LIB([m], [feenableexcept])
|
---|
183 | AC_CHECK_FUNCS([feenableexcept])
|
---|
184 |
|
---|
185 | AC_MSG_CHECKING([if using Solaris linker])
|
---|
186 | SLD=`$LD --version 2>&1 | grep Solaris`
|
---|
187 | if test "$SLD"; then
|
---|
188 | have_solaris_ld=yes
|
---|
189 | AC_MSG_RESULT(yes)
|
---|
190 | else
|
---|
191 | have_solaris_ld=no
|
---|
192 | AC_MSG_RESULT(no)
|
---|
193 | fi
|
---|
194 | AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
|
---|
195 |
|
---|
196 | AC_MSG_CHECKING([if libraries can be versioned])
|
---|
197 | # Special case for PE/COFF platforms: ld reports
|
---|
198 | # support for version-script, but doesn't actually
|
---|
199 | # DO anything with it.
|
---|
200 | case $host in
|
---|
201 | *cygwin* | *mingw32* | *interix* )
|
---|
202 | have_ld_version_script=no
|
---|
203 | AC_MSG_RESULT(no)
|
---|
204 | ;;
|
---|
205 | * )
|
---|
206 |
|
---|
207 | if test "$have_solaris_ld" = "yes"; then
|
---|
208 | GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
|
---|
209 | else
|
---|
210 | GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
---|
211 | fi
|
---|
212 |
|
---|
213 | if test "$GLD"; then
|
---|
214 | have_ld_version_script=yes
|
---|
215 | AC_MSG_RESULT(yes)
|
---|
216 | else
|
---|
217 | have_ld_version_script=no
|
---|
218 | AC_MSG_RESULT(no)
|
---|
219 | AC_MSG_WARN(*** You have not enabled versioned symbols.)
|
---|
220 | fi
|
---|
221 | ;;
|
---|
222 | esac
|
---|
223 |
|
---|
224 | AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
---|
225 |
|
---|
226 | if test "$have_ld_version_script" = "yes"; then
|
---|
227 | AC_MSG_CHECKING([for symbol prefix])
|
---|
228 | SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
|
---|
229 | | ${CPP:-${CC:-gcc} -E} - 2>&1 \
|
---|
230 | | ${EGREP:-grep} "^PREFIX=" \
|
---|
231 | | ${SED:-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
|
---|
232 | AC_SUBST(SYMBOL_PREFIX)
|
---|
233 | AC_MSG_RESULT($SYMBOL_PREFIX)
|
---|
234 | fi
|
---|
235 |
|
---|
236 | # Substitutions for .in files
|
---|
237 | AC_SUBST(PNGLIB_VERSION)
|
---|
238 | AC_SUBST(PNGLIB_MAJOR)
|
---|
239 | AC_SUBST(PNGLIB_MINOR)
|
---|
240 | AC_SUBST(PNGLIB_RELEASE)
|
---|
241 |
|
---|
242 | # Additional arguments (and substitutions)
|
---|
243 | # Allow the pkg-config directory to be set
|
---|
244 | AC_ARG_WITH(pkgconfigdir,
|
---|
245 | AS_HELP_STRING([[[--with-pkgconfigdir]]],
|
---|
246 | [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
|
---|
247 | [pkgconfigdir=${withval}],
|
---|
248 | [pkgconfigdir='${libdir}/pkgconfig'])
|
---|
249 |
|
---|
250 | AC_SUBST([pkgconfigdir])
|
---|
251 | AC_MSG_NOTICE([[pkgconfig directory is ${pkgconfigdir}]])
|
---|
252 |
|
---|
253 | # Make the *-config binary config scripts optional
|
---|
254 | AC_ARG_WITH(binconfigs,
|
---|
255 | AS_HELP_STRING([[[--with-binconfigs]]],
|
---|
256 | [Generate shell libpng-config scripts as well as pkg-config data]
|
---|
257 | [@<:@default=yes@:>@]),
|
---|
258 | [if test "${withval}" = no; then
|
---|
259 | binconfigs=
|
---|
260 | AC_MSG_NOTICE([[libpng-config scripts will not be built]])
|
---|
261 | else
|
---|
262 | binconfigs='${binconfigs}'
|
---|
263 | fi],
|
---|
264 | [binconfigs='${binconfigs}'])
|
---|
265 | AC_SUBST([binconfigs])
|
---|
266 |
|
---|
267 | # Support for prefixes to the API function names; this will generate defines
|
---|
268 | # at the start of the build to rename exported library functions
|
---|
269 | AC_ARG_WITH(libpng-prefix,
|
---|
270 | AS_HELP_STRING([[[--with-libpng-prefix]]],
|
---|
271 | [prefix libpng exported function (API) names with the given value]),
|
---|
272 | [if test "${withval:-no}" != "no"; then
|
---|
273 | AC_SUBST([PNG_PREFIX], [${withval}])
|
---|
274 | fi])
|
---|
275 | AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"])
|
---|
276 |
|
---|
277 | # Control over what links are made for installed files. Versioned files are
|
---|
278 | # always installed, when the following options are turned on corresponding
|
---|
279 | # unversioned links are also created (normally as symbolic links):
|
---|
280 | AC_ARG_ENABLE([unversioned-links],
|
---|
281 | AS_HELP_STRING([[[--enable-unversioned-links]]],
|
---|
282 | [Installed libpng header files are placed in a versioned subdirectory]
|
---|
283 | [and installed libpng library (including DLL) files are versioned.]
|
---|
284 | [If this option is enabled unversioned links will be created pointing to]
|
---|
285 | [the corresponding installed files. If you use libpng.pc or]
|
---|
286 | [libpng-config for all builds you do not need these links, but if you]
|
---|
287 | [compile programs directly they will typically #include <png.h> and]
|
---|
288 | [link with -lpng; in that case you need the links.]
|
---|
289 | [The links can be installed manually using 'make install-header-links']
|
---|
290 | [and 'make install-library-links' and can be removed using the]
|
---|
291 | [corresponding uninstall- targets. If you do enable this option every]
|
---|
292 | [libpng 'make install' will recreate the links to point to the just]
|
---|
293 | [installed version of libpng. The default is to create the links;]
|
---|
294 | [use --disable-unversioned-links to change this]))
|
---|
295 |
|
---|
296 | # The AM_CONDITIONAL test is written so that the default is enabled;
|
---|
297 | # --disable-unversioned-links must be given to turn the option off.
|
---|
298 | AM_CONDITIONAL([DO_INSTALL_LINKS],[test "$enable_unversioned_links" != "no"])
|
---|
299 |
|
---|
300 | AC_ARG_ENABLE([unversioned-libpng-pc],
|
---|
301 | AS_HELP_STRING([[[--enable-unversioned-libpng-pc]]],
|
---|
302 | [Install the configuration file 'libpng.pc' as a link to the versioned]
|
---|
303 | [version. This is done by default - use --disable-unversioned-libpng-pc]
|
---|
304 | [to change this.]))
|
---|
305 | AM_CONDITIONAL([DO_INSTALL_LIBPNG_PC],
|
---|
306 | [test "$enable_unversioned_libpng_pc" != "no"])
|
---|
307 |
|
---|
308 | AC_ARG_ENABLE([unversioned-libpng-config],
|
---|
309 | AS_HELP_STRING([[[--enable-unversioned-libpng-config]]],
|
---|
310 | [Install the configuration file 'libpng-config' as a link to the]
|
---|
311 | [versioned version. This is done by default - use]
|
---|
312 | [--disable-unversioned-libpng-config to change this.]))
|
---|
313 | AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
|
---|
314 | [test "$enable_unversioned_libpng_config" != "no"])
|
---|
315 |
|
---|
316 | # HOST-SPECIFIC OPTIONS
|
---|
317 | # =====================
|
---|
318 | #
|
---|
319 | # DEFAULT
|
---|
320 | # =======
|
---|
321 | #
|
---|
322 | AC_ARG_ENABLE([hardware-optimizations],
|
---|
323 | AS_HELP_STRING([[[--enable-hardware-optimizations]]],
|
---|
324 | [Enable hardware optimizations: =no/off, yes/on.]),
|
---|
325 | [case "$enableval" in
|
---|
326 | no|off)
|
---|
327 | # disable hardware optimization on all systems:
|
---|
328 | enable_arm_neon=no
|
---|
329 | AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
---|
330 | [Disable ARM_NEON optimizations])
|
---|
331 | enable_mips_msa=no
|
---|
332 | AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
---|
333 | [Disable MIPS_MSA optimizations])
|
---|
334 | enable_mips_mmi=no
|
---|
335 | AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
|
---|
336 | [Disable MIPS_MMI optimizations])
|
---|
337 | enable_powerpc_vsx=no
|
---|
338 | AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
|
---|
339 | [Disable POWERPC VSX optimizations])
|
---|
340 | enable_intel_sse=no
|
---|
341 | AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
---|
342 | [Disable INTEL_SSE optimizations])
|
---|
343 | enable_loongarch_lsx=no
|
---|
344 | AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [0],
|
---|
345 | [Disable LOONGARCH_LSX optimizations])
|
---|
346 | ;;
|
---|
347 | *)
|
---|
348 | # allow enabling hardware optimization on any system:
|
---|
349 | case "$host_cpu" in
|
---|
350 | arm*|aarch64*)
|
---|
351 | enable_arm_neon=yes
|
---|
352 | AC_DEFINE([PNG_ARM_NEON_OPT], [2],
|
---|
353 | [Enable ARM_NEON optimizations])
|
---|
354 | ;;
|
---|
355 | mipsel*|mips64el*)
|
---|
356 | enable_mips_mmi=yes
|
---|
357 | enable_mips_msa=yes
|
---|
358 | AC_DEFINE([PNG_MIPS_MMI_OPT], [1],
|
---|
359 | [Enable MIPS_MMI optimizations])
|
---|
360 | AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
|
---|
361 | [Enable MIPS_MSA optimizations])
|
---|
362 | ;;
|
---|
363 | i?86|x86_64)
|
---|
364 | enable_intel_sse=yes
|
---|
365 | AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
---|
366 | [Enable Intel SSE optimizations])
|
---|
367 | ;;
|
---|
368 | powerpc*|ppc64*)
|
---|
369 | enable_powerpc_vsx=yes
|
---|
370 | AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
|
---|
371 | [Enable POWERPC VSX optimizations])
|
---|
372 | ;;
|
---|
373 | loongarch*)
|
---|
374 | enable_loongarch_lsx=yes
|
---|
375 | AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
|
---|
376 | [Enable LOONGARCH_LSX optimizations])
|
---|
377 | ;;
|
---|
378 | esac
|
---|
379 | ;;
|
---|
380 | esac])
|
---|
381 |
|
---|
382 | # ARM NEON
|
---|
383 | # ========
|
---|
384 |
|
---|
385 | AC_ARG_ENABLE([arm-neon],
|
---|
386 | AS_HELP_STRING([[[--enable-arm-neon]]],
|
---|
387 | [Enable ARM NEON optimizations: =no/off, check, api, yes/on.]
|
---|
388 | [no/off: disable the optimizations;]
|
---|
389 | [check: use internal checking code (deprecated and poorly supported);]
|
---|
390 | [api: disable by default, enable by a call to png_set_option;]
|
---|
391 | [yes/on: turn on unconditionally.]
|
---|
392 | [If not specified: determined by the compiler.]),
|
---|
393 | [case "$enableval" in
|
---|
394 | no|off)
|
---|
395 | # disable the default enabling on __ARM_NEON__ systems:
|
---|
396 | AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
---|
397 | [Disable ARM Neon optimizations])
|
---|
398 | # Prevent inclusion of the assembler files below:
|
---|
399 | enable_arm_neon=no ;;
|
---|
400 | check)
|
---|
401 | AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
|
---|
402 | [Check for ARM Neon support at run-time]);;
|
---|
403 | api)
|
---|
404 | AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [],
|
---|
405 | [Turn on ARM Neon optimizations at run-time]);;
|
---|
406 | yes|on)
|
---|
407 | AC_DEFINE([PNG_ARM_NEON_OPT], [2],
|
---|
408 | [Enable ARM Neon optimizations])
|
---|
409 | AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api';]
|
---|
410 | [if you want the optimizations unconditionally,]
|
---|
411 | [pass '-mfpu=neon' to the compiler.]);;
|
---|
412 | *)
|
---|
413 | AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}:]
|
---|
414 | [invalid argument])
|
---|
415 | esac])
|
---|
416 |
|
---|
417 | # Add ARM-specific files to all builds where $host_cpu is arm ('arm*') or
|
---|
418 | # where ARM optimizations were explicitly requested. (This allows a fallback
|
---|
419 | # if a future host CPU does not match 'arm*'.)
|
---|
420 |
|
---|
421 | AM_CONDITIONAL([PNG_ARM_NEON],
|
---|
422 | [test "$enable_arm_neon" != 'no' &&
|
---|
423 | case "$host_cpu" in
|
---|
424 | arm*|aarch64*) : ;;
|
---|
425 | *) test "$enable_arm_neon" != '' ;;
|
---|
426 | esac])
|
---|
427 |
|
---|
428 | # MIPS MSA
|
---|
429 | # ========
|
---|
430 |
|
---|
431 | AC_ARG_ENABLE([mips-msa],
|
---|
432 | AS_HELP_STRING([[[--enable-mips-msa]]],
|
---|
433 | [Enable MIPS MSA optimizations: =no/off, check, api, yes/on.]
|
---|
434 | [no/off: disable the optimizations;]
|
---|
435 | [check: use internal checking code (deprecated and poorly supported);]
|
---|
436 | [api: disable by default, enable by a call to png_set_option;]
|
---|
437 | [yes/on: turn on unconditionally.]
|
---|
438 | [If not specified: determined by the compiler.]),
|
---|
439 | [case "$enableval" in
|
---|
440 | no|off)
|
---|
441 | # disable the default enabling on __mips_msa systems:
|
---|
442 | AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
---|
443 | [Disable MIPS MSA optimizations])
|
---|
444 | # Prevent inclusion of the assembler files below:
|
---|
445 | enable_mips_msa=no ;;
|
---|
446 | check)
|
---|
447 | AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
|
---|
448 | [Check for MIPS MSA support at run-time]);;
|
---|
449 | api)
|
---|
450 | AC_DEFINE([PNG_MIPS_MSA_API_SUPPORTED], [],
|
---|
451 | [Turn on MIPS MSA optimizations at run-time]);;
|
---|
452 | yes|on)
|
---|
453 | AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
|
---|
454 | [Enable MIPS MSA optimizations])
|
---|
455 | AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api';]
|
---|
456 | [if you want the optimizations unconditionally,]
|
---|
457 | [pass '-mmsa -mfp64' to the compiler.]);;
|
---|
458 | *)
|
---|
459 | AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}:]
|
---|
460 | [invalid argument])
|
---|
461 | esac])
|
---|
462 |
|
---|
463 | # Add MIPS-specific files to all builds where $host_cpu is mips ('mips*') or
|
---|
464 | # where MIPS optimizations were explicitly requested. (This allows a fallback
|
---|
465 | # if a future host CPU does not match 'mips*'.)
|
---|
466 |
|
---|
467 | AM_CONDITIONAL([PNG_MIPS_MSA],
|
---|
468 | [test "$enable_mips_msa" != 'no' &&
|
---|
469 | case "$host_cpu" in
|
---|
470 | mipsel*|mips64el*) : ;;
|
---|
471 | esac])
|
---|
472 |
|
---|
473 | # MIPS MMI
|
---|
474 | # ========
|
---|
475 |
|
---|
476 | AC_ARG_ENABLE([mips-mmi],
|
---|
477 | AS_HELP_STRING([[[--enable-mips-mmi]]],
|
---|
478 | [Enable MIPS MMI optimizations: =no/off, check, api, yes/on.]
|
---|
479 | [no/off: disable the optimizations;]
|
---|
480 | [check: use internal checking code (deprecated and poorly supported);]
|
---|
481 | [api: disable by default, enable by a call to png_set_option;]
|
---|
482 | [yes/on: turn on unconditionally.]
|
---|
483 | [If not specified: determined by the compiler.]),
|
---|
484 | [case "$enableval" in
|
---|
485 | no|off)
|
---|
486 | # disable the default enabling on __mips_mmi systems:
|
---|
487 | AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
|
---|
488 | [Disable MIPS MMI optimizations])
|
---|
489 | # Prevent inclusion of the assembler files below:
|
---|
490 | enable_mips_mmi=no;;
|
---|
491 | check)
|
---|
492 | AC_DEFINE([PNG_MIPS_MMI_CHECK_SUPPORTED], [],
|
---|
493 | [Check for MIPS MMI support at run-time]);;
|
---|
494 | api)
|
---|
495 | AC_DEFINE([PNG_MIPS_MMI_API_SUPPORTED], [],
|
---|
496 | [Turn on MIPS MMI optimizations at run-time]);;
|
---|
497 | yes|on)
|
---|
498 | AC_DEFINE([PNG_MIPS_MMI_OPT], [1],
|
---|
499 | [Enable MIPS MMI optimizations])
|
---|
500 | AC_MSG_WARN([--enable-mips-mmi: please specify 'check' or 'api';]
|
---|
501 | [if you want the optimizations unconditionally]
|
---|
502 | [pass '-mloongson-mmi -march=loongson3a' to the compiler.]);;
|
---|
503 | *)
|
---|
504 | AC_MSG_ERROR([--enable-mips-mmi=${enable_mips_mmi}:]
|
---|
505 | [invalid argument])
|
---|
506 | esac])
|
---|
507 |
|
---|
508 | # Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
|
---|
509 | # where MIPS optimizations were explicitly requested. (This allows a fallback
|
---|
510 | # if a future host CPU does not match 'mips*'.)
|
---|
511 |
|
---|
512 | AM_CONDITIONAL([PNG_MIPS_MMI],
|
---|
513 | [test "$enable_mips_mmi" != 'no' &&
|
---|
514 | case "$host_cpu" in
|
---|
515 | mipsel*|mips64el*) : ;;
|
---|
516 | esac])
|
---|
517 |
|
---|
518 | # INTEL SSE
|
---|
519 | # =========
|
---|
520 |
|
---|
521 | AC_ARG_ENABLE([intel-sse],
|
---|
522 | AS_HELP_STRING([[[--enable-intel-sse]]],
|
---|
523 | [Enable Intel SSE optimizations: =no/off, yes/on.]
|
---|
524 | [no/off: disable the optimizations;]
|
---|
525 | [yes/on: enable the optimizations.]
|
---|
526 | [If not specified: determined by the compiler.]),
|
---|
527 | [case "$enableval" in
|
---|
528 | no|off)
|
---|
529 | # disable the default enabling:
|
---|
530 | AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
---|
531 | [Disable Intel SSE optimizations])
|
---|
532 | # Prevent inclusion of the assembler files below:
|
---|
533 | enable_intel_sse=no ;;
|
---|
534 | yes|on)
|
---|
535 | AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
---|
536 | [Enable Intel SSE optimizations]);;
|
---|
537 | *)
|
---|
538 | AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}:]
|
---|
539 | [invalid argument])
|
---|
540 | esac])
|
---|
541 |
|
---|
542 | # Add Intel-specific files to all builds where $host_cpu is Intel ('x86*') or
|
---|
543 | # where Intel optimizations were explicitly requested. (This allows a fallback
|
---|
544 | # if a future host CPU does not match 'x86*'.)
|
---|
545 | AM_CONDITIONAL([PNG_INTEL_SSE],
|
---|
546 | [test "$enable_intel_sse" != 'no' &&
|
---|
547 | case "$host_cpu" in
|
---|
548 | i?86|x86_64) : ;;
|
---|
549 | *) test "$enable_intel_sse" != '' ;;
|
---|
550 | esac])
|
---|
551 |
|
---|
552 | # POWERPC VSX
|
---|
553 | # ===========
|
---|
554 |
|
---|
555 | AC_ARG_ENABLE([powerpc-vsx],
|
---|
556 | AS_HELP_STRING([[[--enable-powerpc-vsx]]],
|
---|
557 | [Enable POWERPC VSX optimizations: =no/off, check, api, yes/on.]
|
---|
558 | [no/off: disable the optimizations;]
|
---|
559 | [check: use internal checking code;]
|
---|
560 | [api: disable by default, enable by a call to png_set_option;]
|
---|
561 | [yes/on: turn on unconditionally.]
|
---|
562 | [If not specified: determined by the compiler.]),
|
---|
563 | [case "$enableval" in
|
---|
564 | no|off)
|
---|
565 | # disable the default enabling on __ppc64__ systems:
|
---|
566 | AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
|
---|
567 | [Disable POWERPC VSX optimizations])
|
---|
568 | # Prevent inclusion of the platform-specific files below:
|
---|
569 | enable_powerpc_vsx=no ;;
|
---|
570 | check)
|
---|
571 | AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [],
|
---|
572 | [Check for POWERPC VSX support at run-time])
|
---|
573 | AC_MSG_WARN([--enable-powerpc-vsx: please see contrib/powerpc/README]
|
---|
574 | [for the list of supported systems.]);;
|
---|
575 | api)
|
---|
576 | AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [],
|
---|
577 | [Turn on POWERPC VSX optimizations at run-time]);;
|
---|
578 | yes|on)
|
---|
579 | AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
|
---|
580 | [Enable POWERPC VSX optimizations])
|
---|
581 | AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api';]
|
---|
582 | [if you want the optimizations unconditionally,]
|
---|
583 | [pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler.]);;
|
---|
584 | *)
|
---|
585 | AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}:]
|
---|
586 | [invalid argument])
|
---|
587 | esac])
|
---|
588 |
|
---|
589 | # Add PowerPC-specific files to all builds where $host_cpu is powerpc
|
---|
590 | # ('powerpc*') or where PowerPC optimizations were explicitly requested.
|
---|
591 | # (This allows a fallback if a future host CPU does not match 'powerpc*'.)
|
---|
592 |
|
---|
593 | AM_CONDITIONAL([PNG_POWERPC_VSX],
|
---|
594 | [test "$enable_powerpc_vsx" != 'no' &&
|
---|
595 | case "$host_cpu" in
|
---|
596 | powerpc*|ppc64*) : ;;
|
---|
597 | esac])
|
---|
598 |
|
---|
599 | # LOONGARCH LSX
|
---|
600 | # =============
|
---|
601 |
|
---|
602 | AC_ARG_ENABLE([loongarch-lsx],
|
---|
603 | AS_HELP_STRING([[[--enable-loongarch-lsx]]],
|
---|
604 | [Enable LOONGARCH LSX optimizations: =no/off, yes/on:]
|
---|
605 | [no/off: disable the optimizations;]
|
---|
606 | [yes/on: turn on unconditionally.]
|
---|
607 | [If not specified: determined by the compiler.]),
|
---|
608 | [case "$enableval" in
|
---|
609 | no|off)
|
---|
610 | # disable the default enabling on __loongarch_simd systems:
|
---|
611 | AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [0],
|
---|
612 | [Disable LOONGARCH LSX optimizations])
|
---|
613 | # Prevent inclusion of the assembler files below:
|
---|
614 | enable_loongarch_lsx=no;;
|
---|
615 | yes|on)
|
---|
616 | AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
|
---|
617 | [Enable LOONGARCH LSX optimizations])
|
---|
618 | ;;
|
---|
619 | *)
|
---|
620 | AC_MSG_ERROR([--enable-loongarch-lsx=${enable_loongarch_lsx}:]
|
---|
621 | [invalid argument])
|
---|
622 | esac])
|
---|
623 |
|
---|
624 | if test "$enable_loongarch_lsx" != "no" &&
|
---|
625 | case "$host_cpu" in
|
---|
626 | loongarch*) : ;;
|
---|
627 | *) test "$enable_loongarch_lsx" != '' ;;
|
---|
628 | esac
|
---|
629 | then
|
---|
630 | compiler_support_loongarch_lsx=no
|
---|
631 | AC_MSG_CHECKING(whether to use LoongArch LSX intrinsics)
|
---|
632 | save_CFLAGS="$CFLAGS"
|
---|
633 | LSX_CFLAGS="${LSX_CFLAGS:-"-mlsx"}"
|
---|
634 | CFLAGS="$CFLAGS $LSX_CFLAGS"
|
---|
635 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
---|
636 | #include <lsxintrin.h>
|
---|
637 | int main(){
|
---|
638 | __m128i a, b, c;
|
---|
639 | a = __lsx_vadd_w(b, c);
|
---|
640 | return 0;
|
---|
641 | }]])],compiler_support_loongarch_lsx=yes)
|
---|
642 | CFLAGS="$save_CFLAGS"
|
---|
643 | AC_MSG_RESULT($compiler_support_loongarch_lsx)
|
---|
644 | if test "$compiler_support_loongarch_lsx" = "yes"; then
|
---|
645 | AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
|
---|
646 | [Enable LOONGARCH LSX optimizations])
|
---|
647 | else
|
---|
648 | AC_MSG_WARN([Compiler does not support loongarch LSX.])
|
---|
649 | fi
|
---|
650 | fi
|
---|
651 |
|
---|
652 | # Add LoongArch specific files to all builds where the host_cpu is loongarch
|
---|
653 | # ('loongarch*') or where LoongArch optimizations were explicitly requested.
|
---|
654 | # (This allows a fallback if a future host CPU does not match 'loongarch*'.)
|
---|
655 |
|
---|
656 | AM_CONDITIONAL([PNG_LOONGARCH_LSX],
|
---|
657 | [test "$enable_loongarch_lsx" != "no" &&
|
---|
658 | test "$compiler_support_loongarch_lsx" = "yes" &&
|
---|
659 | case "$host_cpu" in
|
---|
660 | loongarch*) : ;;
|
---|
661 | *) test "$enable_loongarch_lsx" != '' ;;
|
---|
662 | esac])
|
---|
663 |
|
---|
664 | AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
---|
665 |
|
---|
666 | # Config files, substituting as above
|
---|
667 | AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
|
---|
668 | AC_CONFIG_FILES([libpng-config:libpng-config.in],
|
---|
669 | [chmod +x libpng-config])
|
---|
670 |
|
---|
671 | AC_OUTPUT
|
---|