Update folly OSS build to use 1y
authorElliott Clark <elliott@fb.com>
Thu, 2 Jun 2016 22:37:35 +0000 (15:37 -0700)
committerFacebook Github Bot 0 <facebook-github-bot-0-bot@fb.com>
Thu, 2 Jun 2016 22:38:23 +0000 (15:38 -0700)
Summary: use std=c++1y for compiling since we use c+=14 feautures but don't want to require a recent gcc.

Reviewed By: bhamiltoncx

Differential Revision: D3380287

fbshipit-source-id: 8ece6007cf613d307bafe692f1af70f5359df95a

folly/configure.ac
folly/m4/ac_cxx_compile_stdcxx_0x.m4 [deleted file]
folly/m4/ac_cxx_compile_stdcxx_1y.m4 [new file with mode: 0644]

index c2670fd00e1c106e6a13ba6075bdf734696be135..e3981b2c1618803aa95183ab513e3464a828f674 100644 (file)
@@ -36,18 +36,19 @@ AC_LANG([C++])
 # Checks for programs.
 AC_PROG_CXX
 AC_PROG_CC
-AC_CXX_COMPILE_STDCXX_0X
+
+AC_CXX_COMPILE_STDCXX_1Y
 
 # Be sure to add any -std option to CXXFLAGS before we invoke any
 # AC_COMPILE_IFELSE() or similar macros. Any such macros that are invoked
 # before we update CXXFLAGS will not be run with the same options that we use
 # during the real build.
 STD=""
-if test "x$ac_cv_cxx_compile_cxx0x_cxx" = xyes; then
-   STD="-std=c++0x"
+if test "x$ac_cv_cxx_compile_cxx1y_cxx" = xyes; then
+   STD="-std=c++1y"
 fi
-if test "x$ac_cv_cxx_compile_cxx0x_gxx" = xyes; then
-   STD="-std=gnu++0x"
+if test "x$ac_cv_cxx_compile_cxx1y_gxx" = xyes; then
+   STD="-std=gnu++1y"
 fi
 
 CXXFLAGS="$STD $CXXFLAGS"
diff --git a/folly/m4/ac_cxx_compile_stdcxx_0x.m4 b/folly/m4/ac_cxx_compile_stdcxx_0x.m4
deleted file mode 100644 (file)
index 5c1a3bd..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-# ===========================================================================
-#        http://autoconf-archive.cryp.to/ac_cxx_compile_stdcxx_0x.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AC_CXX_COMPILE_STDCXX_0X
-#
-# DESCRIPTION
-#
-#   Check for baseline language coverage in the compiler for the C++0x
-#   standard.
-#
-# LAST MODIFICATION
-#
-#   2008-04-17
-#
-# COPYLEFT
-#
-#   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
-#
-#   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([AC_CXX_COMPILE_STDCXX_0X], [
-  AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
-  ac_cv_cxx_compile_cxx0x_native,
-  [AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
-  AC_TRY_COMPILE([
-  template <typename T>
-    struct check
-    {
-      static_assert(sizeof(int) <= sizeof(T), "not big enough");
-    };
-
-    typedef check<check<bool>> right_angle_brackets;
-
-    int a;
-    decltype(a) b;
-
-    typedef check<int> check_type;
-    check_type c;
-    check_type&& cr = static_cast<check_type&&>(c);],,
-  ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
-  AC_LANG_RESTORE
-  ])
-
-  AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
-  ac_cv_cxx_compile_cxx0x_cxx,
-  [AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
-  ac_save_CXXFLAGS="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS -std=c++0x"
-  AC_TRY_COMPILE([
-  template <typename T>
-    struct check
-    {
-      static_assert(sizeof(int) <= sizeof(T), "not big enough");
-    };
-
-    typedef check<check<bool>> right_angle_brackets;
-
-    int a;
-    decltype(a) b;
-
-    typedef check<int> check_type;
-    check_type c;
-    check_type&& cr = static_cast<check_type&&>(c);],,
-  ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
-  CXXFLAGS="$ac_save_CXXFLAGS"
-  AC_LANG_RESTORE
-  ])
-
-  AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
-  ac_cv_cxx_compile_cxx0x_gxx,
-  [AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
-  ac_save_CXXFLAGS="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
-  AC_TRY_COMPILE([
-  template <typename T>
-    struct check
-    {
-      static_assert(sizeof(int) <= sizeof(T), "not big enough");
-    };
-
-    typedef check<check<bool>> right_angle_brackets;
-
-    int a;
-    decltype(a) b;
-
-    typedef check<int> check_type;
-    check_type c;
-    check_type&& cr = static_cast<check_type&&>(c);],,
-  ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
-  CXXFLAGS="$ac_save_CXXFLAGS"
-  AC_LANG_RESTORE
-  ])
-
-  if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
-     test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
-     test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
-    AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
-  else
-    AC_MSG_ERROR([Could not find cxx0x support in g++])                                
-  fi
-])
\ No newline at end of file
diff --git a/folly/m4/ac_cxx_compile_stdcxx_1y.m4 b/folly/m4/ac_cxx_compile_stdcxx_1y.m4
new file mode 100644 (file)
index 0000000..18a5a73
--- /dev/null
@@ -0,0 +1,122 @@
+# ===========================================================================
+#        http://autoconf-archive.cryp.to/ac_cxx_compile_stdcxx_0x.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AC_CXX_COMPILE_STDCXX_1Y
+#
+# DESCRIPTION
+#
+#   Check for baseline language coverage in the compiler for the C++1y
+#   standard.
+#
+# LAST MODIFICATION
+#
+#   2008-04-17
+#
+# COPYLEFT
+#
+#   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
+#
+#   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([AC_CXX_COMPILE_STDCXX_1Y], [
+  AC_CACHE_CHECK(if g++ supports C++1y features without additional flags,
+  ac_cv_cxx_compile_cxx1y_native,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+    auto f() {
+      int x = 0b01001;
+      return x;
+    }
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);],,
+  ac_cv_cxx_compile_cxx1y_native=yes, ac_cv_cxx_compile_cxx1y_native=no)
+  AC_LANG_RESTORE
+  ])
+
+  AC_CACHE_CHECK(if g++ supports C++1y features with -std=c++1y,
+  ac_cv_cxx_compile_cxx1y_cxx,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=c++1y"
+  AC_TRY_COMPILE([
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+    auto f() {
+      int x = 0b01001;
+      return x;
+    }
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);],,
+  ac_cv_cxx_compile_cxx1y_cxx=yes, ac_cv_cxx_compile_cxx1y_cxx=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+
+  AC_CACHE_CHECK(if g++ supports C++1y features with -std=gnu++1y,
+  ac_cv_cxx_compile_cxx1y_gxx,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=gnu++1y"
+  AC_TRY_COMPILE([
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+    auto f() {
+      int x = 0b01001;
+      return x;
+    }
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);],,
+  ac_cv_cxx_compile_cxx1y_gxx=yes, ac_cv_cxx_compile_cxx1y_gxx=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+
+  if test "$ac_cv_cxx_compile_cxx1y_native" = yes ||
+     test "$ac_cv_cxx_compile_cxx1y_cxx" = yes ||
+     test "$ac_cv_cxx_compile_cxx1y_gxx" = yes; then
+    AC_DEFINE(HAVE_STDCXX_1Y,,[Define if g++ supports C++1y features. ])
+  else
+    AC_MSG_ERROR([Could not find cxx1y support in g++])                                
+  fi
+])