Skip to content

Commit

Permalink
configure: Remove architecture-specific checks for hardware optimization
Browse files Browse the repository at this point in the history
This mirrors the CMakeLists.txt improvements in configure.ac and
Makefile.am.

The complex compiler check is removed from Loongarch so that it is done
the same way as everything else along with the curious use of a library
in Makefile.am (never done in CMakeLists.txt)

The hard-disable of the Intel SSE optimizations done in libpng1.6 to
ensure that the configure options did not change mid-version is now
removed so the SSE optimizations are on by default (change already made
in 1.6 CMakeLists.txt but not configure.)

Signed-off-by: John Bowler <jbowler@acm.org>
  • Loading branch information
jbowler committed Oct 9, 2024
1 parent 25dc847 commit 82f43f7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 384 deletions.
9 changes: 1 addition & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,16 @@ set(libpng_mips_sources
set(libpng_loongarch_sources
loongarch/loongarch_lsx_init.c
loongarch/filter_lsx_intrinsics.c)
include(CheckCCompilerFlag)
check_c_compiler_flag("-mlsx" COMPILER_SUPPORTS_LSX)
if(COMPILER_SUPPORTS_LSX)
set_source_files_properties(${libpng_loongarch_sources}
PROPERTIES
COMPILE_FLAGS "-mlsx")
endif()

else(PNG_HARDWARE_OPTIMIZATIONS)

# Disable opt for all arches
add_definitions(
-DPNG_ARM_NEON_OPT=0
-DPNG_ARM_NEON_OPT=0
-DPNG_POWERPC_VSX_OPT=0
-DPNG_INTEL_SSE_OPT=0
-DPNG_MIPS_MSA_OPT=0
-DPNG_MIPS_MMI_OPT=0
-DPNG_LOONGARCH_LSX_OPT=0
)

Expand Down
50 changes: 8 additions & 42 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -104,44 +104,14 @@ lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
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_intrinsics.c \
arm/palette_neon_intrinsics.c
endif

if PNG_MIPS_MSA
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
mips/filter_msa_intrinsics.c
endif

if PNG_MIPS_MMI
if !PNG_MIPS_MSA
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c
endif
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/filter_mmi_inline_assembly.c
endif

if PNG_INTEL_SSE
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += intel/intel_init.c\
intel/filter_sse2_intrinsics.c
endif

if PNG_POWERPC_VSX
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += powerpc/powerpc_init.c\
powerpc/filter_vsx_intrinsics.c
endif

if PNG_LOONGARCH_LSX
noinst_LTLIBRARIES= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_SOURCES = loongarch/loongarch_lsx_init.c\
loongarch/filter_lsx_intrinsics.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS = -mlsx
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
# libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
endif
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa\
arm/arm_init.c arm/filter_neon_intrinsics.c\
arm/palette_neon_intrinsics.c\
intel/intel_init.c intel/filter_sse2_intrinsics.c\
loongarch/loongarch_lsx_init.c loongarch/filter_lsx_intrinsics.c\
mips/mips_init.c mips/filter_msa_intrinsics.c\
mips/filter_mmi_inline_assembly.c\
powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c

nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h

Expand All @@ -163,10 +133,6 @@ else
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
endif

if PNG_LOONGARCH_LSX
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES += libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
endif

#distribute headers in /usr/include/libpng/*
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
pkginclude_HEADERS= png.h pngconf.h
Expand Down
Loading

0 comments on commit 82f43f7

Please sign in to comment.