Make it build on Ubuntu 16.04
authorMeng Zhang <jammy.linux@gmail.com>
Tue, 23 Aug 2016 22:17:52 +0000 (15:17 -0700)
committerFacebook Github Bot 2 <facebook-github-bot-2-bot@fb.com>
Tue, 23 Aug 2016 22:23:28 +0000 (15:23 -0700)
Summary:
include linux/membarrier.h if it is available.
Closes https://github.com/facebook/folly/pull/455

Reviewed By: lukenels

Differential Revision: D3714952

Pulled By: Orvid

fbshipit-source-id: 8c85756af2cb132152b2182816becfea138f0149

folly/configure.ac
folly/portability/SysMembarrier.cpp

index 115764f..6e2ad59 100644 (file)
@@ -524,7 +524,8 @@ AC_CHECK_HEADER([snappy.h], AC_CHECK_LIB([snappy], [main]))
 AC_CHECK_HEADER([zlib.h], AC_CHECK_LIB([z], [main]))
 AC_CHECK_HEADER([lzma.h], AC_CHECK_LIB([lzma], [main]))
 AC_CHECK_HEADER([zstd.h], AC_CHECK_LIB([zstd], [main]))
-
+AC_CHECK_HEADER([linux/membarrier.h], AC_DEFINE([HAVE_LINUX_MEMBARRIER_H], [1], [Define to 1 if membarrier.h is available]))
 AC_ARG_ENABLE([follytestmain],
    AS_HELP_STRING([--enable-follytestmain], [enables using main function from folly for tests]),
    [follytestmain=${enableval}], [follytestmain=no])
index 9a3d307..a0d0d90 100644 (file)
@@ -28,6 +28,8 @@
 #define __NR_membarrier 324
 #define MEMBARRIER_CMD_QUERY 0
 #define MEMBARRIER_CMD_SHARED 1
+#elif FOLLY_HAVE_LINUX_MEMBARRIER_H
+#include <linux/membarrier.h>
 #endif
 #endif