Allow to disable inline assembly from configure

This is required for the -fsanitize options that don't
support inline assembly statements.
This commit is contained in:
Andrea Mazzoleni 2016-01-08 22:43:04 +01:00
parent 56a27b394f
commit 9430106c71
3 changed files with 46 additions and 23 deletions

View file

@ -15,21 +15,6 @@
#ifndef __RAID_INTERNAL_H
#define __RAID_INTERNAL_H
/*
* Supported architecture.
*
* Detect the target architecture directly from the compiler.
*/
#if defined(__i386__)
#define CONFIG_X86 1
#define CONFIG_X86_32 1
#endif
#if defined(__x86_64__)
#define CONFIG_X86 1
#define CONFIG_X86_64 1
#endif
/*
* Supported instruction sets.
*
@ -45,19 +30,44 @@
/* Includes the project configuration for HAVE_* defines */
#include "config.h"
#if HAVE_SSE2 /* Enables SSE2 only if the assembler supports it */
/* If the compiler supports assembly */
#if HAVE_ASSEMBLY
/* Autodetect from the compiler */
#if defined(__i386__)
#define CONFIG_X86 1
#define CONFIG_X86_32 1
#endif
#if defined(__x86_64__)
#define CONFIG_X86 1
#define CONFIG_X86_64 1
#endif
#endif
/* Enables SSE2, SSSE3, AVX2 only if the assembler supports it */
#if HAVE_SSE2
#define CONFIG_SSE2 1
#endif
#if HAVE_SSSE3 /* Enables SSSE3 only if the assembler supports it */
#if HAVE_SSSE3
#define CONFIG_SSSE3 1
#endif
#if HAVE_AVX2 /* Enables AVX2 only if the assembler supports it */
#if HAVE_AVX2
#define CONFIG_AVX2 1
#endif
#else
/* If no config file, assumes the assembler supports everything in x86 */
#else /* if HAVE_CONFIG_H is not defined */
/* Assume that assembly is always supported */
#if defined(__i386__)
#define CONFIG_X86 1
#define CONFIG_X86_32 1
#endif
#if defined(__x86_64__)
#define CONFIG_X86 1
#define CONFIG_X86_64 1
#endif
/* Assumes that the assembler supports everything */
#ifdef CONFIG_X86
#define CONFIG_SSE2 1
#define CONFIG_SSSE3 1