source: filezilla/trunk/fuentes/m4/check_libc++.m4 @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 3 years ago

First release to xenial

File size: 975 bytes
Line 
1dnl Checks whether we need to pass -std=libc++ to CXXFLAGS. Sadly this is needed on OS X \
2dnl which for some insane reason defaults to an ancient stdlibc++ :(
3dnl To check for this, we try to use std::forward from <utility>
4
5AC_DEFUN([CHECK_LIBCXX], [
6
7  AC_LANG_PUSH(C++)
8
9  AC_MSG_CHECKING([for whether we need -stdlib=libc++])
10
11  AC_COMPILE_IFELSE([
12    AC_LANG_PROGRAM([[
13      #include <utility>
14    ]], [[
15      int x = 23;
16      int y = std::forward<int>(x);
17      return x == y ? 0 : 1;
18    ]])
19  ], [
20    AC_MSG_RESULT([no])
21  ], [
22    CXXFLAGS="$CXXFLAGS -stdlib=libc++"
23    LDFLAGS="$LDFLAGS -stdlib=libc++"
24
25    AC_COMPILE_IFELSE([
26      AC_LANG_PROGRAM([[
27        #include <utility>
28      ]], [[
29        int x = 23;
30        int y = std::forward<int>(x);
31        return x == y ? 0 : 1;
32      ]])
33    ], [
34      AC_MSG_RESULT([yes])
35    ], [
36      AC_MSG_FAILURE([std::forward in <utility> is not available or seems unusable.])
37    ])
38  ])
39
40  AC_LANG_POP(C++)
41])
Note: See TracBrowser for help on using the repository browser.