From ea216228f31a3ecf1da41c55c8cf0861576cf7a1 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Thu, 6 Jun 2013 14:46:38 -0500 Subject: [PATCH] [libpng15] Make ARM NEON support work at compile time (not just configure time). This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when using a compiler that compiles for multiple architectures at one time. --- ANNOUNCE | 7 +++++-- CHANGES | 5 ++++- configure.ac | 5 +++-- pngconf.h | 26 +++++++++++++++++++++++++- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index ed0f7d88a..196c2777a 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.5.17beta01 - June 5, 2013 +Libpng 1.5.17beta01 - June 6, 2013 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -26,10 +26,13 @@ Other information: Changes since the last public release (1.5.16): -Version 1.5.17beta01 [June 5, 2013] +Version 1.5.17beta01 [June 6, 2013] Removed a redundant test from png_set_IHDR(). Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt (Andrew Hundt) Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt + Make ARM NEON support work at compile time (not just configure time). + This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when + using a compiler that compiles for multiple architectures at one time. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 2feee6cef..09c556052 100644 --- a/CHANGES +++ b/CHANGES @@ -4113,10 +4113,13 @@ Version 1.5.16rc01 [May 16, 2013] Version 1.5.16 [May 23, 2013] No changes. -Version 1.5.17beta01 [June 5, 2013] +Version 1.5.17beta01 [June 6, 2013] Removed a redundant test from png_set_IHDR(). Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt (Andrew Hundt) Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt + Make ARM NEON support work at compile time (not just configure time). + This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when + using a compiler that compiles for multiple architectures at one time. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/configure.ac b/configure.ac index 01ae724eb..35f25dd24 100644 --- a/configure.ac +++ b/configure.ac @@ -179,11 +179,12 @@ AC_ARG_ENABLE([arm-neon], [Enable ARM NEON optimizations: =no/off, check, api, yes/on:] [no/off: disable the optimizations; check: use internal checking code] [(deprecated and poorly supported); api: disable by default, enable by] - [a call to png_set_option; yes/on: turn on unconditionally.]), + [a call to png_set_option; yes/on: turn on unconditionally.] + [If not specified: determined by the compiler.]), [case "$enableval" in no|off) # disable the default enabling on __ARM_NEON__ systems: - AC_DEFINE([PNG_NO_ARM_NEON], [], + AC_DEFINE([PNG_ARM_NEON_NOT_SUPPORTED], [], [Disable ARM Neon optimizations]) # Prevent inclusion of the assembler files below: enable_arm_neon=no;; diff --git a/pngconf.h b/pngconf.h index 324afe7db..155870e11 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.5.17beta01 - May 23, 2013 + * libpng version 1.5.17beta01 - June 6, 2013 * * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -173,6 +173,30 @@ * PNG_USE_DLL is set. */ +/* Compile time options. + * ===================== + * In a multi-arch build the compiler may compile the code several times for the + * same object module, producing different codes for different architectures. + * When this happens configure-time setting of the target host options cannot be + * done and this interferes with the handling of the ARM NEON optimizations, and + * possibly other similiar optimizations. Put additional tests here; in general + * this is needed when the same option can be changed at both compile time and + * run time depending on the target OS (i.e. iOS vs Android.) + */ +#ifdef __ARM_NEON__ + /* If the default below causes problems set PNG_ARM_NEON_NOT_SUPPORTED either + * by passing --enable-arm-neon=no to configure or setting it in some other + * way when pnglibconf.h is built. + */ +# if (!defined PNG_ARM_NEON_SUPPORTED) && (!defined PNG_ARM_NEON_NOT_SUPPORTED) +# define PNG_ARM_NEON_SUPPORTED +# endif +#endif + +#if (defined PNG_ARM_NEON_SUPPORTED) && (defined PNG_ARM_NEON_NOT_SUPPORTED) +# error configuration: ARM_NEON cannot both be supported and disabled +#endif + /* System specific discovery. * ========================== * This code is used at build time to find PNG_IMPEXP, the API settings