Patchwork [3/4] build: Add x86 architecture type detection

login
register
mail settings
Submitter Thomas Tsou
Date April 29, 2014, 4:13 a.m.
Message ID <20140429041311.GA5175@phenom.hsd1.va.comcast.net>
Download mbox | patch
Permalink /patch/343658/
State New
Headers show

Comments

Thomas Tsou - April 29, 2014, 4:13 a.m.
Detect x86 SSE availability for architecture specific convolutional
decoding. Use the GNU autoconf macro AX_EXT to provide built time
detection and set the following definitions.

http://www.gnu.org/software/autoconf-archive/ax_ext.html

HAVE_SSE3
HAVE_SSE4_1

AX_EXT is generally packaged with autoconf-archive and requires the
following macro files.

ax_check_compile_flag.m4
ax_ext.m4
ax_gcc_x86_avx_xgetbv.m4
ax_gcc_x86_cpuid.m4

Set -march=native for automatic compile flag setting. Combined, this
allows automatic detection on x86 and pass-through support for non-x86
platforms (e.g. ARM).

Signed-off-by: Thomas Tsou <tom@tsou.cc>
---
 configure.ac    | 1 +
 src/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/configure.ac b/configure.ac
index eaaab50..4b0c572 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,6 +179,7 @@  then
 	AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
 fi
 
+AX_EXT
 
 AC_OUTPUT(
 	libosmocore.pc
diff --git a/src/Makefile.am b/src/Makefile.am
index 0ecf4b0..c0b78a8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,7 +2,7 @@ 
 # Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification
 LIBVERSION=4:0:0
 
-AM_CFLAGS = -Wall $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CFLAGS = -Wall $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include -march=native
 
 lib_LTLIBRARIES = libosmocore.la