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

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

Update new version: 3.15.02

File size: 1.3 KB
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
5dnl Copyright (c) 2015-2016 Tim Kosse <tim.kosse@filezilla-project.org>
6
7dnl Copying and distribution of this file, with or without modification, are
8dnl permitted in any medium without royalty provided the copyright notice
9dnl and this notice are preserved. This file is offered as-is, without any
10dnl warranty.
11
12AC_DEFUN([CHECK_LIBCXX], [
13
14  AC_LANG_PUSH(C++)
15
16  AC_MSG_CHECKING([for whether we need -stdlib=libc++])
17
18  AC_COMPILE_IFELSE([
19    AC_LANG_PROGRAM([[
20      #include <utility>
21    ]], [[
22      int x = 23;
23      int y = std::forward<int>(x);
24      return x == y ? 0 : 1;
25    ]])
26  ], [
27    AC_MSG_RESULT([no])
28  ], [
29    CXXFLAGS="$CXXFLAGS -stdlib=libc++"
30    LDFLAGS="$LDFLAGS -stdlib=libc++"
31
32    AC_COMPILE_IFELSE([
33      AC_LANG_PROGRAM([[
34        #include <utility>
35      ]], [[
36        int x = 23;
37        int y = std::forward<int>(x);
38        return x == y ? 0 : 1;
39      ]])
40    ], [
41      AC_MSG_RESULT([yes])
42    ], [
43      AC_MSG_FAILURE([std::forward in <utility> is not available or seems unusable.])
44    ])
45  ])
46
47  AC_LANG_POP(C++)
48])
Note: See TracBrowser for help on using the repository browser.