diff --git a/configure.ac b/configure.ac --- a/configure.ac 2016-02-22 17:24:25.000000000 -0600 +++ b/configure.ac 2016-02-22 17:30:36.949159871 -0600 @@ -1,10 +1,13 @@ # configure.ac +# Copyright (c) 2016 Google, Inc. +# Written by Mike Klein and Matt Sarett +# Derived from the ARM supporting code in libpng/configure.ac, which was # Copyright (c) 2004-2015 Glenn Randers-Pehrson # Last changed in libpng 1.6.22 [(PENDING RELEASE)] # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer # and license in png.h dnl Process this file with autoconf to produce a configure script. @@ -316,16 +319,50 @@ AC_ARG_ENABLE([arm-neon], AM_CONDITIONAL([PNG_ARM_NEON], [test "$enable_arm_neon" != 'no' && case "$host_cpu" in arm*|aarch64*) :;; *) test "$enable_arm_neon" != '';; esac]) +# INTEL +# ===== +# +# INTEL SSE (SIMD) support. + +AC_ARG_ENABLE([intel-sse], + AS_HELP_STRING([[[--enable-intel-sse]]], + [Enable Intel SSE optimizations: =no/off, yes/on:] + [no/off: disable the optimizations;] + [yes/on: enable the optimizations.] + [If not specified: determined by the compiler.]), + [case "$enableval" in + no|off) + # disable the default enabling: + AC_DEFINE([PNG_INTEL_SSE_OPT], [0], + [Disable Intel SSE optimizations]) + # Prevent inclusion of the assembler files below: + enable_intel_sse=no;; + yes|on) + AC_DEFINE([PNG_INTEL_SSE_OPT], [1], + [Enable Intel SSE optimizations]);; + *) + AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value]) + esac]) + +# Add Intel specific files to all builds where the host_cpu is Intel ('x86*') +# or where Intel optimizations were explicitly requested (this allows a +# fallback if a future host CPU does not match 'x86*') +AM_CONDITIONAL([PNG_INTEL_SSE], + [test "$enable_intel_sse" != 'no' && + case "$host_cpu" in + i?86|x86_64) :;; + *) test "$enable_intel_sse" != '';; + esac]) AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]]) # Config files, substituting as above AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in]) AC_CONFIG_FILES([libpng-config:libpng-config.in], [chmod +x libpng-config]) AC_OUTPUT diff --git a/Makefile.am b/Makefile.am --- a/Makefile.am 2016-02-22 17:24:24.000000000 -0600 +++ b/Makefile.am 2016-02-22 17:32:18.387223996 -0600 @@ -1,10 +1,13 @@ # Makefile.am, the source file for Makefile.in (and hence Makefile), is # +# Copyright (c) 2016 Google, Inc. +# Written by Mike Klein and Matt Sarett +# Derived from the ARM supporting code in libpng/configure.ac, which was # Copyright (c) 2004-2016 Glenn Randers-Pehrson # Last changed in libpng 1.6.22 [(PENDING RELEASE)] # # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer # and license in png.h PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @@ -83,16 +86,20 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SO pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\ png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa if PNG_ARM_NEON libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\ arm/filter_neon.S arm/filter_neon_intrinsics.c endif +if PNG_INTEL_SSE +libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += contrib/intel/intel_init.c\ + contrib/intel/filter_sse2_intrinsics.c +endif nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \ -version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0 if HAVE_LD_VERSION_SCRIPT # Versioned symbols and restricted exports if HAVE_SOLARIS_LD