aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ.W <jakwings@gmail.com>2017-06-01 17:00:48 +0800
committerJ.W <jakwings@gmail.com>2017-06-01 17:00:48 +0800
commit4a23d6da82fc1e0c13cde5a65ea0821fac6c511e (patch)
treefc7a83b24290974b9195b93554e9eef6d59aace7
parentd93f1b67f3aaa2d56bf20089c0ce9ef216da6cb7 (diff)
downloadmarisa-trie-4a23d6da82fc1e0c13cde5a65ea0821fac6c511e.tar.gz
Add configure option --enable-native-code
This option also enables all available SSE instructions.
-rw-r--r--configure.ac21
1 files changed, 21 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index a306972..81cf19a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,27 @@ yes
#endif
], [enable_popcnt="yes"], [enable_popcnt="no"])])
+# Enable native cpu instructions.
+AC_MSG_CHECKING([whether to enable optimization for native cpu])
+AC_ARG_ENABLE([native-code],
+ [AS_HELP_STRING([--enable-native-code],
+ [generate instructions for native cpu [default=no]])],
+ [],
+ [enable_native_code="no"])
+AS_IF([test "x${enable_native_code}" != "xno"], [
+ CFLAGS="$CPPFLAGS -march=native"
+ CPPFLAGS="$CPPFLAGS -march=native"
+ CXXFLAGS="$CXXFLAGS -march=native"
+ MARISA_ENABLE_SSE2
+ MARISA_ENABLE_SSE3
+ MARISA_ENABLE_SSE4_1
+ MARISA_ENABLE_SSE4_2
+ MARISA_ENABLE_SSE4
+ MARISA_ENABLE_SSE4A
+ MARISA_ENABLE_POPCNT
+])
+AC_MSG_RESULT([${enable_native_code}])
+
# Checks for SSE availability.
AC_MSG_CHECKING([whether to use SSE2])
AC_ARG_ENABLE([sse2],