Author: Michael R. Crusoe <crusoe@debian.org>
Description: Increase portability by using SIMD Everywhere library
Forwarded: https://github.com/vgteam/vg/pull/2867

--- vg.orig/deps/sdsl-lite/CMakeLists.txt
+++ vg/deps/sdsl-lite/CMakeLists.txt
@@ -82,19 +82,6 @@
   endif()
 endif()
 
-include(CheckSSE4_2)
-if( BUILTIN_POPCNT )
-  if( CMAKE_COMPILER_IS_GNUCXX )
-    append_cxx_compiler_flags("-msse4.2 -march=native" "GCC" CMAKE_CXX_OPT_FLAGS)
-  endif()
-  if( CMAKE_COMPILER_IS_GNUCXX )
-    append_cxx_compiler_flags("-msse4.2 -march=native" "CLANG" CMAKE_CXX_OPT_FLAGS)
-  endif()
-  if( CMAKE_COMPILER_IS_INTEL )
-    append_cxx_compiler_flags("-msse4.2 -march=native" "INTEL" CMAKE_CXX_FLAGS)
-  endif()
-endif()
-
 # check for demangle support to get pretty C++ class names
 include(FindCxaDemangle)
 if( HAVE_CXA_DEMANGLE )
--- vg.orig/Makefile
+++ vg/Makefile
@@ -17,7 +17,8 @@
 CXX ?= g++
 PKG_CONFIG ?= pkg-config
 
-EXE:=vg
+SFX :=
+EXE:=vg$(SFX)
 
 all: $(BIN_DIR)/$(EXE)
 
@@ -678,7 +679,6 @@
 	$(RM) -f $(INC_DIR)/vg_system_version.hpp
 
 clean:
-	$(RM) -r $(BIN_DIR)
 	$(RM) -r $(LIB_DIR)
 	$(RM) -r $(UNITTEST_OBJ_DIR)
 	$(RM) -r $(SUBCOMMAND_OBJ_DIR)
--- vg.orig/src/preflight.cpp
+++ vg/src/preflight.cpp
@@ -1,32 +1,11 @@
 #include "preflight.hpp"
 
-#include <iostream>
-#include <cstdlib>
-#include <cpuid.h>
-
 namespace vg {
 
 using namespace std;
 
 void preflight_check() {
     
-    // We assume we are on x86_64 on POSIX (and not Windows).
-    // We use the method of dlib's dlib/simd/simd_check.h
-    
-    // Define a place to put the cpuid info
-    unsigned int cpuid_info[4];
-    
-    // Call cpuid function 1 (which reports SSE4.2, and other stuff up to original AVX)
-    __cpuid(1, cpuid_info[0], cpuid_info[1], cpuid_info[2], cpuid_info[3]);
-    
-    // Bit 20 of result 2 is the SSE 4.2 flag.
-    bool have_sse4_2 = cpuid_info[2] & (1 << 20);
-    
-    if (!have_sse4_2) {
-        cerr << "error[vg::preflight_check]: The CPU does not support SSE4.2 instructions. VG cannot run here. "
-            << "Please use a system with SSE4.2 support." << endl;
-        exit(1);
-    }
     
 }
 
--- vg.orig/src/preflight.hpp
+++ vg/src/preflight.hpp
@@ -14,11 +14,7 @@
 /// Define a macro to tell things to be built for every architecture, if possible.
 /// This *doesn't* work on Mac with GNU GCC and Apple libc++, because functions
 /// for x86-64 can't use std::endl, so we exclude that combination.
-#if (!defined(__GNUC__) || !defined(_LIBCPP_VERSION) || !defined(__APPLE__))
-    #define VG_PREFLIGHT_EVERYWHERE __attribute__((__target__("arch=x86-64")))
-#else
-    #define VG_PREFLIGHT_EVERYWHERE
-#endif
+#define VG_PREFLIGHT_EVERYWHERE
 
 /// Run a preflight check to make sure that the system is usable for this build of vg.
 /// Aborts with a helpful message if this is not the case.
--- vg.orig/src/crash.cpp
+++ vg/src/crash.cpp
@@ -168,7 +168,7 @@
         *out << "Caught signal " << signalNumber << " raised at address " << ip << endl;
         // Do our own tracing because backtrace doesn't really work on all platforms.
         stacktrace_manually(*out, signalNumber, ip, bp);
-    #else
+    #elif __x86_64__
         // Linux 64 bit does it this way
         ip = (void*)context->uc_mcontext.gregs[REG_RIP];
         bp = (void**)context->uc_mcontext.gregs[REG_RBP];
