knik0 / faac

Freeware Advanced Audio Coder faac mirror
https://sourceforge.net/projects/faac/
Other
179 stars 60 forks source link

Don't use -msse2 for arches others than i386 or amd64 #6

Closed marillat closed 6 years ago

marillat commented 6 years ago

Hi, Faac 1.29.7.8 fail to build because you build with -msse2 without checking the architecture in configure. Here is the output of gcc in armhf machine.

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../include -Wdate-time -D_FORTIFY_SOURCE=2 -fvisibility=hidden -msse2 -DDRM -g -O2 -fdebug-prefix-map=/home/marillat/faac-dmo-1.29.7.8=. -fstack-protector-strong -Wformat -Werror=format-security -DDRM -c blockswitch.c  -fPIC -DPIC -o .libs/libfaac_drm_la-blockswitch.o
gcc: error: unrecognized command line option ‘-msse2’
knik0 commented 6 years ago

Does it compile when you remove that option?

knik0 commented 6 years ago

I think it's fixed in git.

marillat commented 6 years ago

No, you also need to reuse the previous code without ssse2 optimization. Here is what I've added to configure.ac to add #define USE_SSE2 1 in config.h Should be easy to use to ifdef the see2 code. tell me if you need tests for arches like ARM or MIPS.

AC_MSG_CHECKING(whether we can compile SSE2 code)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[asm ("punpckhwd %xmm0,%xmm1");])],
  AC_DEFINE(USE_SSE2, 1, [Define to 1 if SSE2 assembly is available.])
  AM_CONDITIONAL(USE_SSE2, true)
  AC_MSG_RESULT(yes)
,
  AC_MSG_RESULT(no)
    AM_CONDITIONAL(USE_SSE2, false)
  AC_MSG_WARN([The assembler does not support the SSE2 command set.])
)
marillat commented 6 years ago

And for amd64 with host_cpu='x86_64' ?

knik0 commented 6 years ago

OK, I think it tests for both i686 and x86_64 now.

marillat commented 6 years ago

Perfect. Tested on amd64, i386, armel and armhf architectures.