VirtualBox

source: vbox/trunk/src/libs/libpng-1.6.42/configure.ac

Last change on this file was 103316, checked in by vboxsync, 3 months ago

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

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

© 2023 Oracle
ContactPrivacy policyTerms of Use