aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-03-22 14:18:29 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-03-22 14:18:29 +0200
commit03e0e8a0d7228b6ff1f0af39e2c040a4e425973d (patch)
treea4387a886060ee6b27c70d05ca5cb1406fdd00ac
parentUpdate a comment to use the variable name rep_len_decoder. (diff)
downloadxz-03e0e8a0d7228b6ff1f0af39e2c040a4e425973d.tar.xz
Added autoconf check to detect if we can use arithmetic
right shift for optimizations.
-rw-r--r--configure.ac1
-rw-r--r--m4/ax_c_arithmetic_rshift.m436
2 files changed, 37 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index dbafd73c..472a7d16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -407,6 +407,7 @@ AC_CHECK_HEADERS([assert.h errno.h byteswap.h sys/param.h sys/sysctl.h],
AC_C_INLINE
AC_C_RESTRICT
+AX_C_ARITHMETIC_RSHIFT
AC_HEADER_STDBOOL
diff --git a/m4/ax_c_arithmetic_rshift.m4 b/m4/ax_c_arithmetic_rshift.m4
new file mode 100644
index 00000000..3c183445
--- /dev/null
+++ b/m4/ax_c_arithmetic_rshift.m4
@@ -0,0 +1,36 @@
+##### http://autoconf-archive.cryp.to/ax_c_arithmetic_rshift.html
+#
+# SYNOPSIS
+#
+# AX_C_ARITHMETIC_RSHIFT
+#
+# DESCRIPTION
+#
+# Checks if the right shift operation is arithmetic.
+#
+# This macro uses compile-time detection and so is cross-compile
+# ready.
+#
+# LAST MODIFICATION
+#
+# 2006-12-12
+#
+# COPYLEFT
+#
+# Copyright (c) 2006 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
+#
+# 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_C_ARITHMETIC_RSHIFT], [
+ AC_CACHE_CHECK([whether right shift operation is arithmetic],
+ [ax_cv_c_arithmetic_rshift],
+ [AC_COMPILE_IFELSE([[int dummy[((-1 >> 1) < 0) ? 1 : -1];]],
+ [ax_cv_c_arithmetic_rshift=yes],
+ [ax_cv_c_arithmetic_rshift=no])])
+ if test "x$ax_cv_c_arithmetic_rshift" = xyes; then
+ AC_DEFINE([HAVE_ARITHMETIC_RSHIFT], [1],
+ [Define to 1 if the right shift operation is arithmetic.])
+ fi
+])