blob: 52dba94b4b98568bccd4d7ff4fdce6f8612c6e7c [file] [log] [blame]
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -06001# configure.ac
2
Cosmin Trutad4fb6212018-07-28 18:34:58 -04003# Copyright (c) 2018 Cosmin Truta
Glenn Randers-Pehrson93b34762017-01-03 22:18:22 -06004# Copyright (c) 2004-2016 Glenn Randers-Pehrson
Glenn Randers-Pehrson6c3d5bd2016-02-22 16:38:10 -06005
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
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060010dnl Process this file with autoconf to produce a configure script.
11dnl
12dnl Minor upgrades (compatible ABI): increment the package version
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -050013dnl (third field in two places below) and set the PNGLIB_RELEASE
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060014dnl 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
John Bowlerfeecc892012-01-28 00:48:08 -060024AC_PREREQ([2.68])
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060025
26dnl Version number stuff here:
27
Cosmin Trutaa40189c2019-04-14 14:10:32 -040028AC_INIT([libpng],[1.6.37],[png-mng-implement@lists.sourceforge.net])
John Bowlera23f3db2012-01-27 10:24:21 -060029AC_CONFIG_MACRO_DIR([scripts])
John Bowler05cbe5a2012-01-28 18:06:55 -060030
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
Glenn Randers-Pehrson871b1d02013-03-02 14:58:22 -060035# 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
36# 1.13 is required for parallel tests
John Bowler940b37b2013-10-04 19:56:19 -050037AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects])
Glenn Randers-Pehrson871b1d02013-03-02 14:58:22 -060038# The following line causes --disable-maintainer-mode to be the default to
Glenn Randers-Pehrsonfaa3e532016-07-25 07:49:34 -050039# configure. This is necessary because libpng distributions cannot rely on the
Glenn Randers-Pehrson871b1d02013-03-02 14:58:22 -060040# time stamps of the autotools generated files being correct
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060041AM_MAINTAINER_MODE
42
John Bowlerfeecc892012-01-28 00:48:08 -060043dnl 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
Cosmin Trutaa40189c2019-04-14 14:10:32 -040049PNGLIB_VERSION=1.6.37
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050050PNGLIB_MAJOR=1
Glenn Randers-Pehrson15ea1fa2011-11-23 15:28:01 -060051PNGLIB_MINOR=6
Cosmin Truta6a94d142018-12-30 12:00:41 -050052PNGLIB_RELEASE=37
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060053
54dnl End of version number stuff
55
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060056AC_CONFIG_SRCDIR([pngget.c])
John Bowler1eb2c482012-01-25 08:07:29 -060057AC_CONFIG_HEADERS([config.h])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060058
59# Checks for programs.
John Bowler71a10f22011-01-22 17:03:33 -060060AC_LANG([C])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060061AC_PROG_CC
Glenn Randers-Pehrson6d7705e2011-11-03 00:42:58 -050062AM_PROG_AS
John Bowler1eb2c482012-01-25 08:07:29 -060063LT_PATH_LD
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060064AC_PROG_CPP
Glenn Randers-Pehrson871b1d02013-03-02 14:58:22 -060065AC_PROG_AWK
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060066AC_PROG_INSTALL
67AC_PROG_LN_S
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060068AC_PROG_MAKE_SET
John Bowlerfeecc892012-01-28 00:48:08 -060069
Glenn Randers-Pehrsonfaa3e532016-07-25 07:49:34 -050070dnl libtool/libtoolize; version 2.4.2 is the tested version. This or any
John Bowlerfeecc892012-01-28 00:48:08 -060071dnl compatible later version may be used
Glenn Randers-Pehrson9f650592010-08-11 08:06:11 -050072LT_INIT([win32-dll])
John Bowlerfeecc892012-01-28 00:48:08 -060073LT_PREREQ([2.4.2])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060074
Glenn Randers-Pehrson871b1d02013-03-02 14:58:22 -060075# 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])
John Bowler71a10f22011-01-22 17:03:33 -060083else
Glenn Randers-Pehrson871b1d02013-03-02 14:58:22 -060084 AC_MSG_FAILURE([failed], 1)
John Bowler71a10f22011-01-22 17:03:33 -060085fi
86
Glenn Randers-Pehrson871b1d02013-03-02 14:58:22 -060087# 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
John Bowler1eb2c482012-01-25 08:07:29 -060092# -Werror cannot be passed to GCC in CFLAGS because configure will fail (it
93# checks the compiler with a program that generates a warning), add the
94# following option to deal with this
95AC_ARG_VAR(PNG_COPTS,
96 [additional flags for the C compiler, use this for options that would]
97 [cause configure itself to fail])
98AC_ARG_ENABLE(werror,
99 AS_HELP_STRING([[[--enable-werror[=OPT]]]],
100 [Pass -Werror or the given argument to the compiler if it is supported]),
101 [test "$enable_werror" = "yes" && enable_werror="-Werror"
102 if test "$enable_werror" != "no"; then
103 sav_CFLAGS="$CFLAGS"
104 CFLAGS="$enable_werror $CFLAGS"
105 AC_MSG_CHECKING([if the compiler allows $enable_werror])
106 AC_COMPILE_IFELSE(
107 [AC_LANG_SOURCE([
108 [int main(int argc, char **argv){]
109 [return argv[argc-1][0];]
110 [}]])],
111 AC_MSG_RESULT(yes)
112 PNG_COPTS="$PNG_COPTS $enable_werror",
113 AC_MSG_RESULT(no))
114 CFLAGS="$sav_CFLAGS"
115 fi],)
116
Dagobert Michelsen12e63e92016-03-14 16:21:06 +0100117# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
118# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
119# This is incompatible with the new default mode, so we test for that and force the
Glenn Randers-Pehrson46861bc2016-03-15 07:55:41 -0500120# "-std=c89" compiler option:
Dagobert Michelsen12e63e92016-03-14 16:21:06 +0100121AC_MSG_CHECKING([if we need to force back C standard to C89])
Glenn Randers-Pehrson46861bc2016-03-15 07:55:41 -0500122AC_COMPILE_IFELSE(
123 [AC_LANG_PROGRAM([
124 [#define _POSIX_SOURCE 1]
125 [#include <stdio.h>]
126 ])],
127 AC_MSG_RESULT(no),[
128 if test "x$GCC" != "xyes"; then
129 AC_MSG_ERROR(
130 [Forcing back to C89 is required but the flags are only known for GCC])
131 fi
132 AC_MSG_RESULT(yes)
133 CFLAGS="$CFLAGS -std=c89"
Dagobert Michelsen12e63e92016-03-14 16:21:06 +0100134])
135
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600136# Checks for header files.
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600137AC_HEADER_STDC
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600138
139# Checks for typedefs, structures, and compiler characteristics.
140AC_C_CONST
141AC_TYPE_SIZE_T
142AC_STRUCT_TM
John Bowlerfc45f682011-11-04 21:03:39 -0500143AC_C_RESTRICT
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600144
145# Checks for library functions.
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600146AC_FUNC_STRTOD
John Bowler1eb2c482012-01-25 08:07:29 -0600147AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
Glenn Randers-Pehrsond6e5a722016-05-17 18:35:59 -0500148
149# Some later POSIX 1003.1 functions are required for test programs, failure here
150# is soft (the corresponding test program is not built).
151AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])])
152AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
153
Glenn Randers-Pehrson977f6eb2011-01-04 09:07:45 -0600154AC_ARG_WITH(zlib-prefix,
John Bowler1eb2c482012-01-25 08:07:29 -0600155 AS_HELP_STRING([[[--with-zlib-prefix]]],
156 [prefix that may have been used in installed zlib]),
157 [ZPREFIX=${withval}],
158 [ZPREFIX='z_'])
Glenn Randers-Pehrson571db952010-12-09 06:03:03 -0600159AC_CHECK_LIB(z, zlibVersion, ,
John Bowler1eb2c482012-01-25 08:07:29 -0600160 AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed)))
Glenn Randers-Pehrson571db952010-12-09 06:03:03 -0600161
John Bowlerfc45f682011-11-04 21:03:39 -0500162# The following is for pngvalid, to ensure it catches FP errors even on
163# platforms that don't enable FP exceptions, the function appears in the math
164# library (typically), it's not an error if it is not found.
165AC_CHECK_LIB([m], [feenableexcept])
166AC_CHECK_FUNCS([feenableexcept])
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600167
Glenn Randers-Pehrson83bd94f2011-09-01 14:06:49 -0500168AC_MSG_CHECKING([if using Solaris linker])
169SLD=`$LD --version 2>&1 | grep Solaris`
170if test "$SLD"; then
171 have_solaris_ld=yes
172 AC_MSG_RESULT(yes)
173else
174 have_solaris_ld=no
175 AC_MSG_RESULT(no)
176fi
177AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
178
Gilles Espinassef87ef8b2011-12-26 13:10:01 -0600179AC_MSG_CHECKING([if libraries can be versioned])
Glenn Randers-Pehrsonccff3832011-09-09 07:55:25 -0500180# Special case for PE/COFF platforms: ld reports
181# support for version-script, but doesn't actually
182# DO anything with it.
183case $host in
184*cygwin* | *mingw32* | *interix* )
185 have_ld_version_script=no
186 AC_MSG_RESULT(no)
187;;
188* )
189
Glenn Randers-Pehrson83bd94f2011-09-01 14:06:49 -0500190if test "$have_solaris_ld" = "yes"; then
191 GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
192else
193 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
194fi
195
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600196if test "$GLD"; then
197 have_ld_version_script=yes
198 AC_MSG_RESULT(yes)
199else
200 have_ld_version_script=no
201 AC_MSG_RESULT(no)
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500202 AC_MSG_WARN(*** You have not enabled versioned symbols.)
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600203fi
Glenn Randers-Pehrson9f650592010-08-11 08:06:11 -0500204;;
205esac
206
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600207AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600208
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500209if test "$have_ld_version_script" = "yes"; then
210 AC_MSG_CHECKING([for symbol prefix])
211 SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
Glenn Randers-Pehrson871b1d02013-03-02 14:58:22 -0600212 | ${CPP-${CC-gcc} -E} - 2>&1 \
213 | ${EGREP-grep} "^PREFIX=" \
214 | ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500215 AC_SUBST(SYMBOL_PREFIX)
216 AC_MSG_RESULT($SYMBOL_PREFIX)
217fi
218
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600219# Substitutions for .in files
220AC_SUBST(PNGLIB_VERSION)
221AC_SUBST(PNGLIB_MAJOR)
222AC_SUBST(PNGLIB_MINOR)
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500223AC_SUBST(PNGLIB_RELEASE)
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600224
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600225# Additional arguments (and substitutions)
226# Allow the pkg-config directory to be set
227AC_ARG_WITH(pkgconfigdir,
John Bowler1eb2c482012-01-25 08:07:29 -0600228 AS_HELP_STRING([[[--with-pkgconfigdir]]],
229 [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
230 [pkgconfigdir=${withval}],
231 [pkgconfigdir='${libdir}/pkgconfig'])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600232
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600233AC_SUBST([pkgconfigdir])
John Bowler1eb2c482012-01-25 08:07:29 -0600234AC_MSG_NOTICE([[pkgconfig directory is ${pkgconfigdir}]])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600235
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600236# Make the *-config binary config scripts optional
237AC_ARG_WITH(binconfigs,
John Bowler1eb2c482012-01-25 08:07:29 -0600238 AS_HELP_STRING([[[--with-binconfigs]]],
239 [Generate shell libpng-config scripts as well as pkg-config data]
240 [@<:@default=yes@:>@]),
241 [if test "${withval}" = no; then
242 binconfigs=
243 AC_MSG_NOTICE([[libpng-config scripts will not be built]])
244 else
245 binconfigs='${binconfigs}'
246 fi],
247 [binconfigs='${binconfigs}'])
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600248AC_SUBST([binconfigs])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600249
John Bowler42369cc2012-01-31 07:28:13 -0600250# Support for prefixes to the API function names; this will generate defines
251# at the start of the build to rename exported library functions
252AC_ARG_WITH(libpng-prefix,
253 AS_HELP_STRING([[[--with-libpng-prefix]]],
254 [prefix libpng exported function (API) names with the given value]),
255 [if test "${withval:-no}" != "no"; then
256 AC_SUBST([PNG_PREFIX], [${withval}])
257 fi])
John Bowler516c9c92012-02-01 07:14:24 -0600258AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"])
John Bowler42369cc2012-01-31 07:28:13 -0600259
John Bowlerd0479d22013-12-29 19:31:56 -0600260# Control over what links are made for installed files. Versioned files are
261# always installed, when the following options are turned on corresponding
262# unversioned links are also created (normally as symbolic links):
263AC_ARG_ENABLE([unversioned-links],
264 AS_HELP_STRING([[[--enable-unversioned-links]]],
265 [Installed libpng header files are placed in a versioned subdirectory]
266 [and installed libpng library (including DLL) files are versioned.]
267 [If this option is enabled unversioned links will be created pointing to]
268 [the corresponding installed files. If you use libpng.pc or]
269 [libpng-config for all builds you do not need these links, but if you]
270 [compile programs directly they will typically #include <png.h> and]
271 [link with -lpng; in that case you need the links.]
272 [The links can be installed manually using 'make install-header-links']
273 [and 'make install-library-links' and can be removed using the]
274 [corresponding uninstall- targets. If you do enable this option every]
275 [libpng 'make install' will recreate the links to point to the just]
276 [installed version of libpng. The default is to create the links;]
277 [use --disable-unversioned-links to change this]))
278
279# The AM_CONDITIONAL test is written so that the default is enabled;
280# --disable-unversioned-links must be given to turn the option off.
281AM_CONDITIONAL([DO_INSTALL_LINKS],[test "$enable_unversioned_links" != "no"])
282
283AC_ARG_ENABLE([unversioned-libpng-pc],
284 AS_HELP_STRING([[[--enable-unversioned-libpng-pc]]],
285 [Install the configuration file 'libpng.pc' as a link to the versioned]
286 [version. This is done by default - use --disable-unversioned-libpng-pc]
287 [to change this.]))
288AM_CONDITIONAL([DO_INSTALL_LIBPNG_PC],
289 [test "$enable_unversioned_libpng_pc" != "no"])
290
291AC_ARG_ENABLE([unversioned-libpng-config],
292 AS_HELP_STRING([[[--enable-unversioned-libpng-config]]],
293 [Install the configuration file 'libpng-config' as a link to the]
294 [versioned version. This is done by default - use]
295 [--disable-unversioned-libpng-config to change this.]))
296AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
297 [test "$enable_unversioned_libpng_config" != "no"])
298
John Bowler7b1da522013-04-25 10:03:42 -0500299# HOST SPECIFIC OPTIONS
300# =====================
301#
Glenn Randers-Pehrson50b6df52017-07-08 12:59:23 -0500302# DEFAULT
303# =======
304#
305AC_ARG_ENABLE([hardware-optimizations],
306 AS_HELP_STRING([[[--enable-hardware-optimizations]]],
307 [Enable hardware optimizations: =no/off, yes/on:]),
308 [case "$enableval" in
309 no|off)
310 # disable hardware optimization on all systems:
311 enable_arm_neon=no
312 AC_DEFINE([PNG_ARM_NEON_OPT], [0],
313 [Disable ARM_NEON optimizations])
314 enable_mips_msa=no
315 AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
316 [Disable MIPS_MSA optimizations])
317 enable_powerpc_vsx=no
318 AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
319 [Disable POWERPC VSX optimizations])
320 enable_intel_sse=no
321 AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
322 [Disable INTEL_SSE optimizations])
Glenn Randers-Pehrsonbd5a8262017-07-08 12:56:14 -0500323 ;;
Glenn Randers-Pehrson50b6df52017-07-08 12:59:23 -0500324 *)
325 # allow enabling hardware optimization on any system:
326 case "$host_cpu" in
327 arm*|aarch64*)
328 enable_arm_neon=yes
329 AC_DEFINE([PNG_ARM_NEON_OPT], [0],
330 [Enable ARM_NEON optimizations])
331 ;;
332 mipsel*|mips64el*)
333 enable_mips_msa=yes
334 AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
335 [Enable MIPS_MSA optimizations])
336 ;;
337 i?86|x86_64)
338 enable_intel_sse=yes
339 AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
340 [Enable Intel SSE optimizations])
341 ;;
342 powerpc*|ppc64*)
343 enable_powerpc_vsx=yes
344 AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
345 [Enable POWERPC VSX optimizations])
346 ;;
347 esac
348 ;;
349 esac])
350
John Bowler7b1da522013-04-25 10:03:42 -0500351# ARM
352# ===
353#
354# ARM NEON (SIMD) support.
355
Glenn Randers-Pehrson6d7705e2011-11-03 00:42:58 -0500356AC_ARG_ENABLE([arm-neon],
Glenn Randers-Pehrson871b1d02013-03-02 14:58:22 -0600357 AS_HELP_STRING([[[--enable-arm-neon]]],
John Bowler7b1da522013-04-25 10:03:42 -0500358 [Enable ARM NEON optimizations: =no/off, check, api, yes/on:]
359 [no/off: disable the optimizations; check: use internal checking code]
John Bowlerf3728102013-03-04 16:26:31 -0600360 [(deprecated and poorly supported); api: disable by default, enable by]
John Bowleraa224422013-06-06 12:49:53 -0500361 [a call to png_set_option; yes/on: turn on unconditionally.]
362 [If not specified: determined by the compiler.]),
John Bowlerf3728102013-03-04 16:26:31 -0600363 [case "$enableval" in
John Bowler7b1da522013-04-25 10:03:42 -0500364 no|off)
365 # disable the default enabling on __ARM_NEON__ systems:
John Bowler18dd07e2013-06-08 13:07:13 -0500366 AC_DEFINE([PNG_ARM_NEON_OPT], [0],
John Bowler7b1da522013-04-25 10:03:42 -0500367 [Disable ARM Neon optimizations])
368 # Prevent inclusion of the assembler files below:
369 enable_arm_neon=no;;
John Bowler83a841a2013-10-15 21:19:56 -0500370 check)
John Bowlerf3728102013-03-04 16:26:31 -0600371 AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
372 [Check for ARM Neon support at run-time]);;
John Bowler83a841a2013-10-15 21:19:56 -0500373 api)
John Bowlerf3728102013-03-04 16:26:31 -0600374 AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [],
375 [Turn on ARM Neon optimizations at run-time]);;
John Bowler83a841a2013-10-15 21:19:56 -0500376 yes|on)
John Bowler18dd07e2013-06-08 13:07:13 -0500377 AC_DEFINE([PNG_ARM_NEON_OPT], [2],
378 [Enable ARM Neon optimizations])
379 AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if]
380 [you want the optimizations unconditionally pass -mfpu=neon]
381 [to the compiler.]);;
John Bowlerf3728102013-03-04 16:26:31 -0600382 *)
John Bowler7b1da522013-04-25 10:03:42 -0500383 AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value])
John Bowlerf3728102013-03-04 16:26:31 -0600384 esac])
John Bowler7b1da522013-04-25 10:03:42 -0500385
John Bowlerac09cd02013-04-25 23:13:08 -0500386# Add ARM specific files to all builds where the host_cpu is arm ('arm*') or
387# where ARM optimizations were explicitly requested (this allows a fallback if a
388# future host CPU does not match 'arm*')
John Bowler7b1da522013-04-25 10:03:42 -0500389
390AM_CONDITIONAL([PNG_ARM_NEON],
391 [test "$enable_arm_neon" != 'no' &&
John Bowlerac09cd02013-04-25 23:13:08 -0500392 case "$host_cpu" in
John Bowler445475a2014-11-03 19:44:39 -0600393 arm*|aarch64*) :;;
John Bowlerac09cd02013-04-25 23:13:08 -0500394 *) test "$enable_arm_neon" != '';;
395 esac])
Glenn Randers-Pehrson6d7705e2011-11-03 00:42:58 -0500396
Mandar Sahastrabuddheee5e3982016-08-29 19:07:25 +0530397# MIPS
398# ===
399#
400# MIPS MSA (SIMD) support.
401
402AC_ARG_ENABLE([mips-msa],
403 AS_HELP_STRING([[[--enable-mips-msa]]],
404 [Enable MIPS MSA optimizations: =no/off, check, api, yes/on:]
405 [no/off: disable the optimizations; check: use internal checking code]
406 [(deprecated and poorly supported); api: disable by default, enable by]
407 [a call to png_set_option; yes/on: turn on unconditionally.]
408 [If not specified: determined by the compiler.]),
409 [case "$enableval" in
410 no|off)
411 # disable the default enabling on __mips_msa systems:
412 AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
413 [Disable MIPS MSA optimizations])
414 # Prevent inclusion of the assembler files below:
415 enable_mips_msa=no;;
416 check)
417 AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
418 [Check for MIPS MSA support at run-time]);;
419 api)
420 AC_DEFINE([PNG_MIPS_MSA_API_SUPPORTED], [],
421 [Turn on MIPS MSA optimizations at run-time]);;
422 yes|on)
423 AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
424 [Enable MIPS MSA optimizations])
425 AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if]
426 [you want the optimizations unconditionally pass '-mmsa -mfp64']
427 [to the compiler.]);;
428 *)
429 AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
430 esac])
431
432# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
433# where MIPS optimizations were explicitly requested (this allows a fallback if a
434# future host CPU does not match 'mips*')
435
436AM_CONDITIONAL([PNG_MIPS_MSA],
437 [test "$enable_mips_msa" != 'no' &&
438 case "$host_cpu" in
439 mipsel*|mips64el*) :;;
440 esac])
441
Glenn Randers-Pehrson8c6c9e62017-01-05 18:11:59 -0600442# INTEL
443# =====
444#
445# INTEL SSE (SIMD) support.
446
447AC_ARG_ENABLE([intel-sse],
448 AS_HELP_STRING([[[--enable-intel-sse]]],
449 [Enable Intel SSE optimizations: =no/off, yes/on:]
450 [no/off: disable the optimizations;]
451 [yes/on: enable the optimizations.]
452 [If not specified: determined by the compiler.]),
453 [case "$enableval" in
454 no|off)
455 # disable the default enabling:
456 AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
457 [Disable Intel SSE optimizations])
458 # Prevent inclusion of the assembler files below:
459 enable_intel_sse=no;;
460 yes|on)
461 AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
462 [Enable Intel SSE optimizations]);;
463 *)
464 AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
465 esac])
466
467# Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
468# or where Intel optimizations were explicitly requested (this allows a
469# fallback if a future host CPU does not match 'x86*')
470AM_CONDITIONAL([PNG_INTEL_SSE],
471 [test "$enable_intel_sse" != 'no' &&
472 case "$host_cpu" in
473 i?86|x86_64) :;;
474 *) test "$enable_intel_sse" != '';;
475 esac])
476
Vadim Barkov2b6e59d2017-01-14 16:05:33 +0300477# PowerPC
478# ===
479#
480# PowerPC VSX (SIMD) support.
481
482AC_ARG_ENABLE([powerpc-vsx],
483AS_HELP_STRING([[[--enable-powerpc-vsx]]],
484 [Enable POWERPC VSX optimizations: =no/off, check, api, yes/on:]
485 [no/off: disable the optimizations; check: use internal checking code]
Vadim Barkov2cc569e2017-01-31 12:00:02 +0000486 [api: disable by default, enable by a call to png_set_option]
487 [yes/on: turn on unconditionally.]
Vadim Barkov2b6e59d2017-01-14 16:05:33 +0300488 [If not specified: determined by the compiler.]),
489 [case "$enableval" in
490 no|off)
491 # disable the default enabling on __ppc64__ systems:
492 AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
493 [Disable POWERPC VSX optimizations])
494 # Prevent inclusion of the platform specific files below:
495 enable_powerpc_vsx=no;;
496 check)
497 AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [],
Vadim Barkov8a242662017-02-01 14:26:02 +0000498 [Check for POWERPC VSX support at run-time])
499 AC_MSG_WARN([--enable-powerpc-vsx Please check contrib/powerpc/README file]
500 [for the list of supported OSes.]);;
Vadim Barkov2b6e59d2017-01-14 16:05:33 +0300501 api)
502 AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [],
503 [Turn on POWERPC VSX optimizations at run-time]);;
504 yes|on)
505 AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
506 [Enable POWERPC VSX optimizations])
507 AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api', if]
Vadim Barkov565d4be2017-01-29 19:07:12 +0300508 [you want the optimizations unconditionally pass '-maltivec -mvsx']
root6ff408d2017-01-14 18:35:36 +0300509 [or '-mcpu=power8'to the compiler.]);;
Vadim Barkov2b6e59d2017-01-14 16:05:33 +0300510 *)
511 AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value])
512 esac])
513
514# Add PowerPC specific files to all builds where the host_cpu is powerpc('powerpc*') or
515# where POWERPC optimizations were explicitly requested (this allows a fallback if a
516# future host CPU does not match 'powerpc*')
517
518AM_CONDITIONAL([PNG_POWERPC_VSX],
519 [test "$enable_powerpc_vsx" != 'no' &&
520 case "$host_cpu" in
debian3907feb2017-01-31 03:50:45 +0000521 powerpc*|ppc64*) :;;
Vadim Barkov2b6e59d2017-01-14 16:05:33 +0300522 esac])
523
Glenn Randers-Pehrsonf6d358f2017-02-21 20:45:49 -0600524
John Bowler1eb2c482012-01-25 08:07:29 -0600525AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
526
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600527# Config files, substituting as above
Glenn Randers-Pehrsona687af12009-12-25 16:17:30 -0600528AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
Glenn Randers-Pehrson28d4aae2009-11-13 16:29:45 -0600529AC_CONFIG_FILES([libpng-config:libpng-config.in],
John Bowler1eb2c482012-01-25 08:07:29 -0600530 [chmod +x libpng-config])
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600531
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600532AC_OUTPUT