I'm using a libjpeg-turbo port for Android. It's not much different from the base jpeg-turbo in terms of source code: http://git.linaro.org/gitweb?p=people/tomgall/libjpeg-turbo/libjpeg-turbo.git;a=shortlog;h=refs/heads/android
There is a module (static library) consisting of 2 cpu features-dependent files: jsimd_arm_neon.S and jsimd_arm.c. I want to compile jpeg-turbo with NEON support, I must define __ARM_HAVE_NEON
and compile this module with -march=armv7-a -mfpu=neon
. I want the library to run on older hardware with no Neon support (like Tegra 2), I should remove neon compiler flag and undef __ARM_HAVE_NEON
.
My question is: how to compile it so that neon or non-neon path can be selected at runtime without SIGILL
on non-neon hardware? I know how to check for NEON at runtime, but I don't know how to modify libjpeg-turbo and organize libraries.