Commit b08df53f authored by Marek Vavrusa's avatar Marek Vavrusa

Removed configure checking for instruction extensions.

This is a problem with packaging, when the binary is compiled on
a machine supporting newer SSE extensions than the box where the
package is installed. Moreover, CFLAGS decisions should be up to
maintainer or the one building the software.
parent 46b032fc
......@@ -13,10 +13,6 @@ AC_USE_SYSTEM_EXTENSIONS([_GNU_SOURCE])
release_date=`doc/mdate-sh configure.ac`
AC_SUBST([RELEASE_DATE], $release_date)
# Check SSE, SSE2 and SSE3 support
AX_EXT
CFLAGS="$CFLAGS $SIMD_FLAGS"
# Set compiler compatibility flags
AC_PROG_CC_C99
AM_PROG_CC_C_O
......
# ===========================================================================
# http://autoconf-archive.cryp.to/ax_ext.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_EXT
#
# DESCRIPTION
#
# Find supported SIMD extensions by requesting cpuid. When an SIMD
# extension is found, the -m"simdextensionname" is added to SIMD_FLAGS
# (only if compilator support it) (ie : if "sse2" is available "-msse2" is
# added to SIMD_FLAGS)
#
# This macro calls:
#
# AC_SUBST(SIMD_FLAGS)
#
# And defines:
#
# HAVE_MMX / HAVE_SSE / HAVE_SSE2 / HAVE_SSE3 / HAVE_SSSE3
#
# LAST MODIFICATION
#
# 2008-04-12
# 2009-04-23 Mark Asbach <markasbach@users.sourceforge.net<
# Renamed cache variables so they adhere naming convention
# Corrected M4 quoting for AX_CHECK_COMPILER_FLAGS
#
# COPYLEFT
#
# Copyright (c) 2008 Christophe Tournayre <turn3r@users.sourceforge.net>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved.
AC_DEFUN([AX_EXT],
[
AC_REQUIRE([AX_GCC_X86_CPUID])
AX_GCC_X86_CPUID([0x00000001])
if test "$ax_cv_gcc_x86_cpuid_0x00000001" != "unknown"; then
ecx=`echo $ax_cv_gcc_x86_cpuid_0x00000001 | cut -d ":" -f 3`
edx=`echo $ax_cv_gcc_x86_cpuid_0x00000001 | cut -d ":" -f 4`
fi
AC_CACHE_CHECK([whether mmx is supported], [ax_cv_have_mmx_ext],
[
ax_cv_have_mmx_ext=no
if test "$ax_cv_gcc_x86_cpuid_0x00000001" != "unknown"; then
if test "$((0x$edx>>23&0x01))" = 1; then
ax_cv_have_mmx_ext=yes
fi
fi
])
AC_CACHE_CHECK([whether sse is supported], [ax_cv_have_sse_ext],
[
ax_cv_have_sse_ext=no
if test "$ax_cv_gcc_x86_cpuid_0x00000001" != "unknown"; then
if test "$((0x$edx>>25&0x01))" = 1; then
ax_cv_have_sse_ext=yes
fi
fi
])
AC_CACHE_CHECK([whether sse2 is supported], [ax_cv_have_sse2_ext],
[
ax_cv_have_sse2_ext=no
if test "$ax_cv_gcc_x86_cpuid_0x00000001" != "unknown"; then
if test "$((0x$edx>>26&0x01))" = 1; then
ax_cv_have_sse2_ext=yes
fi
fi
])
AC_CACHE_CHECK([whether sse3 is supported], [ax_cv_have_sse3_ext],
[
ax_cv_have_sse3_ext=no
if test "$ax_cv_gcc_x86_cpuid_0x00000001" != "unknown"; then
if test "$((0x$ecx&0x01))" = 1; then
ax_cv_have_sse3_ext=yes
fi
fi
])
AC_CACHE_CHECK([whether ssse3 is supported], [ax_cv_have_ssse3_ext],
[
ax_cv_have_ssse3_ext=no
if test "$ax_cv_gcc_x86_cpuid_0x00000001" != "unknown"; then
if test "$((0x$ecx>>9&0x01))" = 1; then
ax_cv_have_ssse3_ext=yes
fi
fi
])
if test "$ax_cv_have_mmx_ext" = yes; then
AC_DEFINE(HAVE_MMX,,[Support mmx instructions])
AX_CHECK_COMPILE_FLAG([-mmmx], [SIMD_FLAGS="$SIMD_FLAGS -mmmx"], [])
fi
if test "$ax_cv_have_sse_ext" = yes; then
AC_DEFINE(HAVE_SSE,,[Support SSE (Streaming SIMD Extensions) instructions])
AX_CHECK_COMPILE_FLAG([-msse], [SIMD_FLAGS="$SIMD_FLAGS -msse"], [])
fi
if test "$ax_cv_have_sse2_ext" = yes; then
AC_DEFINE(HAVE_SSE2,,[Support SSE2 (Streaming SIMD Extensions 2) instructions])
AX_CHECK_COMPILE_FLAG([-msse2], [SIMD_FLAGS="$SIMD_FLAGS -msse2"], [])
fi
if test "$ax_cv_have_sse3_ext" = yes; then
AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions])
AX_CHECK_COMPILE_FLAG([-msse3], [SIMD_FLAGS="$SIMD_FLAGS -msse3"], [])
fi
if test "$ax_cv_have_ssse3_ext" = yes; then
AC_DEFINE(HAVE_SSSE3,,[Support SSSE3 (Supplemental Streaming SIMD Extensions 3) instructions])
fi
AC_SUBST(SIMD_FLAGS)
])
dnl @synopsis AX_GCC_X86_CPUID(OP)
dnl @summary run x86 cpuid instruction OP using gcc inline assembler
dnl @category Misc
dnl
dnl On Pentium and later x86 processors, with gcc or a compiler that
dnl has a compatible syntax for inline assembly instructions, run
dnl a small program that executes the cpuid instruction with
dnl input OP. This can be used to detect the CPU type.
dnl
dnl On output, the values of the eax, ebx, ecx, and edx registers
dnl are stored as hexadecimal strings as "eax:ebx:ecx:edx" in
dnl the cache variable ax_cv_gcc_x86_cpuid_OP.
dnl
dnl If the cpuid instruction fails (because you are running a cross-compiler,
dnl or because you are not using gcc, or because you are on a processor
dnl that doesn't have this instruction), ax_cv_gcc_x86_cpuid_OP is set
dnl to the string "unknown".
dnl
dnl This macro mainly exists to be used in AX_GCC_ARCHFLAG.
dnl
dnl @version 2008-12-06
dnl @license GPLWithACException
dnl @author Steven G. Johnson <stevenj@alum.mit.edu> and Matteo Frigo.
AC_DEFUN([AX_GCC_X86_CPUID],
[AC_REQUIRE([AC_PROG_CC])
AC_LANG_PUSH([C])
AC_CACHE_CHECK([for x86 cpuid $1 output], [ax_cv_gcc_x86_cpuid_$1],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [
int op = $1, eax, ebx, ecx, edx;
FILE *f;
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
__asm__("push %%rbx\n\t"
"cpuid\n\t"
"pop %%rbx"
: "=a" (eax), "=c" (ecx), "=d" (edx)
: "a" (op));
__asm__("push %%rbx\n\t"
"cpuid\n\t"
"mov %%rbx, %%rax\n\t"
"pop %%rbx"
: "=a" (ebx), "=c" (ecx), "=d" (edx)
: "a" (op));
#else
__asm__("push %%ebx\n\t"
"cpuid\n\t"
"pop %%ebx"
: "=a" (eax), "=c" (ecx), "=d" (edx)
: "a" (op));
__asm__("push %%ebx\n\t"
"cpuid\n\t"
"mov %%ebx, %%eax\n\t"
"pop %%ebx"
: "=a" (ebx), "=c" (ecx), "=d" (edx)
: "a" (op));
#endif
f = fopen("conftest_cpuid", "w"); if (!f) return 1;
fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx);
fclose(f);
return 0;
])],
[ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid],
[ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid],
[ax_cv_gcc_x86_cpuid_$1=unknown])])
AC_LANG_POP([C])
])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment