VirtualBox

source: vbox/trunk/src/libs/libpng-1.6.43/configure.ac@ 106404

Last change on this file since 106404 was 105469, checked in by vboxsync, 5 months ago

libpng-1.6.43: Applied and adjusted our libpng changes to 1.6.43. bugref:8515

  • Property svn:eol-style set to native
File size: 23.9 KB
Line 
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
10dnl Process this file with autoconf to produce a configure script.
11dnl
12dnl Minor upgrades (compatible ABI): increment the package version
13dnl (third field in two places below) and set the PNGLIB_RELEASE
14dnl variable.
15dnl
16dnl Major upgrades (incompatible ABI): increment the package major
17dnl version (second field, or first if desired), set the minor
18dnl to 0, set PNGLIB_MAJOR below *and* follow the instructions in
19dnl Makefile.am to upgrade the package name.
20
21dnl This is here to prevent earlier autoconf from being used, it
22dnl should not be necessary to regenerate configure if the time
23dnl stamps are correct
24AC_PREREQ([2.68])
25
26dnl Version number stuff here:
27
28AC_INIT([libpng],[1.6.43],[[email protected]])
29AC_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
37AM_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
41AM_MAINTAINER_MODE
42
43dnl configure.ac and Makefile.am expect automake 1.11.2 or a compatible later
44dnl version; aclocal.m4 will generate a failure if you use a prior version of
45dnl automake, so the following is not necessary (and is not defined anyway):
46dnl AM_PREREQ([1.11.2])
47dnl stop configure from automagically running automake
48
49PNGLIB_VERSION=1.6.43
50PNGLIB_MAJOR=1
51PNGLIB_MINOR=6
52PNGLIB_RELEASE=43
53
54dnl End of version number stuff
55
56AC_CONFIG_SRCDIR([pngget.c])
57AC_CONFIG_HEADERS([config.h])
58
59# Check for basic programs.
60AC_LANG([C])
61AC_PROG_CC
62AM_PROG_AS
63LT_PATH_LD
64AC_PROG_CPP
65AC_PROG_AWK
66AC_PROG_INSTALL
67AC_PROG_LN_S
68AC_PROG_MAKE_SET
69
70dnl libtool/libtoolize; version 2.4.2 is the tested version. This or any
71dnl compatible later version may be used
72LT_INIT([win32-dll])
73LT_PREREQ([2.4.2])
74
75dnl Declare the AWK variable.
76AC_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.
80AC_MSG_CHECKING([if awk ($AWK) works])
81if ${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
84then
85 AC_MSG_RESULT([yes])
86else
87 AC_MSG_FAILURE([no], 1)
88fi
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
92DFNCPP="$CPP"
93AC_SUBST(DFNCPP)
94
95AC_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
101AM_CONDITIONAL([ENABLE_TESTS],
102 [test "$enable_tests" != "no"])
103
104AC_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
110AM_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:
116AC_ARG_VAR(PNG_COPTS,
117 [additional flags for the C compiler, to be used for options that would]
118 [cause configure itself to fail])
119AC_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:
142AC_MSG_CHECKING([if we need to force back C standard to C89])
143AC_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.
158AC_STRUCT_TM
159AC_C_RESTRICT
160
161# Checks for library functions.
162AC_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).
167AC_CHECK_FUNC([clock_gettime], , [AC_MSG_WARN([not building timepng])])
168AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
169
170AC_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_'])
175AC_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.
182AC_CHECK_LIB([m], [feenableexcept])
183AC_CHECK_FUNCS([feenableexcept])
184
185AC_MSG_CHECKING([if using Solaris linker])
186SLD=`$LD --version 2>&1 | grep Solaris`
187if test "$SLD"; then
188 have_solaris_ld=yes
189 AC_MSG_RESULT(yes)
190else
191 have_solaris_ld=no
192 AC_MSG_RESULT(no)
193fi
194AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
195
196AC_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.
200case $host in
201*cygwin* | *mingw32* | *interix* )
202 have_ld_version_script=no
203 AC_MSG_RESULT(no)
204;;
205* )
206
207if test "$have_solaris_ld" = "yes"; then
208 GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
209else
210 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
211fi
212
213if test "$GLD"; then
214 have_ld_version_script=yes
215 AC_MSG_RESULT(yes)
216else
217 have_ld_version_script=no
218 AC_MSG_RESULT(no)
219 AC_MSG_WARN(*** You have not enabled versioned symbols.)
220fi
221;;
222esac
223
224AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
225
226if 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)
234fi
235
236# Substitutions for .in files
237AC_SUBST(PNGLIB_VERSION)
238AC_SUBST(PNGLIB_MAJOR)
239AC_SUBST(PNGLIB_MINOR)
240AC_SUBST(PNGLIB_RELEASE)
241
242# Additional arguments (and substitutions)
243# Allow the pkg-config directory to be set
244AC_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
250AC_SUBST([pkgconfigdir])
251AC_MSG_NOTICE([[pkgconfig directory is ${pkgconfigdir}]])
252
253# Make the *-config binary config scripts optional
254AC_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}'])
265AC_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
269AC_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])
275AM_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):
280AC_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.
298AM_CONDITIONAL([DO_INSTALL_LINKS],[test "$enable_unversioned_links" != "no"])
299
300AC_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.]))
305AM_CONDITIONAL([DO_INSTALL_LIBPNG_PC],
306 [test "$enable_unversioned_libpng_pc" != "no"])
307
308AC_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.]))
313AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
314 [test "$enable_unversioned_libpng_config" != "no"])
315
316# HOST-SPECIFIC OPTIONS
317# =====================
318#
319# DEFAULT
320# =======
321#
322AC_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
385AC_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
421AM_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
431AC_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
467AM_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
476AC_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
512AM_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
521AC_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*'.)
545AM_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
555AC_ARG_ENABLE([powerpc-vsx],
556AS_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
593AM_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
602AC_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
624if test "$enable_loongarch_lsx" != "no" &&
625 case "$host_cpu" in
626 loongarch*) : ;;
627 *) test "$enable_loongarch_lsx" != '' ;;
628 esac
629then
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>
637int 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
650fi
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
656AM_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
664AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
665
666# Config files, substituting as above
667AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
668AC_CONFIG_FILES([libpng-config:libpng-config.in],
669 [chmod +x libpng-config])
670
671AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette