summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorsnappy.mirrorbot@gmail.com <snappy.mirrorbot@gmail.com@03e5f5b5-db94-4691-08a0-1a8bf15f6143>2011-03-18 17:14:15 +0000
committersnappy.mirrorbot@gmail.com <snappy.mirrorbot@gmail.com@03e5f5b5-db94-4691-08a0-1a8bf15f6143>2011-03-18 17:14:15 +0000
commitbecaa2a43d4732a03edf70e950bda011c456e96f (patch)
tree672080042c9a66a34e5c9c26dcb8b640c659300f /configure.ac
parent9b8332e3a91cc2fe89de0287a82cea325aaccf84 (diff)
downloadsnappy-becaa2a43d4732a03edf70e950bda011c456e96f.tar.gz
Revision created by MOE tool push_codebase.
MOE_MIGRATION= git-svn-id: http://snappy.googlecode.com/svn/trunk@2 03e5f5b5-db94-4691-08a0-1a8bf15f6143
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac99
1 files changed, 99 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..b6fa77a
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,99 @@
+m4_define(snappy_major, [1])
+m4_define(snappy_minor, [0])
+m4_define(snappy_patchlevel, [0])
+
+# Libtool shared library interface versions (current:revision:age)
+# Update this value for every release! (A:B:C will map to foo.so.(A-C).C.B)
+# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+m4_define(snappy_version, [1:0:0])
+
+AC_INIT([snappy], [snappy_major.snappy_minor.snappy_patchlevel])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE
+LT_INIT
+AC_PROG_CXX
+AC_LANG([C++])
+AC_C_BIGENDIAN
+AC_CHECK_HEADERS(stdint.h stddef.h)
+
+# Don't use AC_FUNC_MMAP, as it checks for mappings of already-mapped memory,
+# which we don't need (and does not exist on Windows).
+AC_CHECK_FUNC(mmap)
+
+GTEST_LIB_CHECK([], [true], [true # Ignore; we can live without it.])
+PKG_CHECK_MODULES([gflags], [libgflags],
+ [AC_DEFINE([HAVE_GFLAGS], [1], [Use the gflags package for command-line parsing.])],
+ [true # Ignore; we can live without it.]
+)
+
+# See if we have __builtin_expect.
+# TODO: Use AC_CACHE.
+AC_MSG_CHECKING([if the compiler supports __builtin_expect])
+
+AC_TRY_COMPILE(, [
+ return __builtin_expect(1, 1) ? 1 : 0
+], [
+ ac_have_builtin_expect=yes
+ AC_MSG_RESULT([yes])
+], [
+ ac_have_builtin_expect=no
+ AC_MSG_RESULT([no])
+])
+if test x$ac_have_builtin_expect = xyes ; then
+ AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if the compiler supports __builtin_expect.])
+fi
+
+# See if we have working count-trailing-zeros intrinsics.
+# TODO: Use AC_CACHE.
+AC_MSG_CHECKING([if the compiler supports __builtin_ctzll])
+
+AC_TRY_COMPILE(, [
+ return (__builtin_ctzll(0x100000000LL) == 32) ? 1 : 0
+], [
+ ac_have_builtin_ctz=yes
+ AC_MSG_RESULT([yes])
+], [
+ ac_have_builtin_ctz=no
+ AC_MSG_RESULT([no])
+])
+if test x$ac_have_builtin_ctz = xyes ; then
+ AC_DEFINE(HAVE_BUILTIN_CTZ, 1, [Define to 1 if the compiler supports __builtin_ctz and friends.])
+fi
+
+# Other compression libraries; the unit test can use these for comparison
+# if they are available. If they are not found, just ignore.
+AC_CHECK_LIB([z], [zlibVersion],, [true])
+AC_CHECK_LIB([lzo2], [lzo1x_1_15_compress],, [true])
+AC_CHECK_LIB([lzf], [lzf_compress],, [true])
+AC_CHECK_LIB([fastlz], [fastlz_compress],, [true])
+AC_CHECK_LIB([quicklz], [qlz_compress],, [true])
+
+# These are used by snappy-stubs-public.h.in.
+if test "$ac_cv_header_stdint_h" = "yes"; then
+ AC_SUBST(ac_cv_have_stdint_h, 1)
+else
+ AC_SUBST(ac_cv_have_stdint_h, 0)
+fi
+if test "$ac_cv_header_stddef_h" = "yes"; then
+ AC_SUBST(ac_cv_have_stddef_h, 1)
+else
+ AC_SUBST(ac_cv_have_stddef_h, 0)
+fi
+
+# Export the version to snappy-stubs-public.h.
+SNAPPY_MAJOR="snappy_major"
+SNAPPY_MINOR="snappy_minor"
+SNAPPY_PATCHLEVEL="snappy_patchlevel"
+
+AC_SUBST(SNAPPY_MAJOR)
+AC_SUBST(SNAPPY_MINOR)
+AC_SUBST(SNAPPY_PATCHLEVEL)
+
+# Set the libtool version for the library.
+# (Note: snappy_version is an m4 macro, defined above.)
+EXTRA_LIBSNAPPY_LDFLAGS="$EXTRA_LIBSNAPPY_LDFLAGS -version-info snappy_version"
+AC_SUBST(EXTRA_LIBSNAPPY_LDFLAGS)
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile snappy-stubs-public.h])
+AC_OUTPUT