-
Notifications
You must be signed in to change notification settings - Fork 0
/
acinclude.m4
64 lines (58 loc) · 1.81 KB
/
acinclude.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
dnl ----------------------------------------------------------------------
dnl Helper macros for Byfl's configure.ac script
dnl By Scott Pakin <pakin@lanl.gov>
dnl ----------------------------------------------------------------------
dnl @synopsis AX_CHECK_CXX11 ([COMPILER-VAR])
dnl
dnl Determine if the C++ compiler, named by COMPILER-VAR (default: CXX),
dnl supports C++11 language extensions. If so, set
dnl ax_cv_cxx11_[COMPILER-VAR] to "yes", otherwise to "no".
AC_DEFUN([AX_CHECK_CXX11],
[AC_REQUIRE([AC_PROG_CXX])
m4_define([ax_cxx_name], [m4_ifval([$1], [ax_cv_cxx11_$1], [ax_cv_cxx11_CXX])])
m4_ifval([$1], [ax_CXX_orig="$CXX" ; CXX="[$]$1"])
AC_CACHE_CHECK([if $CXX provides C++11 support],
[ax_cxx_name],
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <string>
using namespace std;
string::const_iterator check_cxx11 (string mystring)
{
return mystring.cbegin();
}
])],
[eval ax_cxx_name=yes],
[eval ax_cxx_name=no])
AC_LANG_POP([C++])])
m4_ifval([$1], [CXX="$ax_CXX_orig"])
])
dnl @synopsis AX_CHECK_WEAK_ALIASES
dnl
dnl Determine if the system can handle weak function aliases. (At the
dnl time of this writing, OS X cannot.) If so, define HAVE_WEAK_ALIASES.
AC_DEFUN([AX_CHECK_WEAK_ALIASES],
[AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([if weak function aliases are supported],
[ax_cv_have_weak_aliases],
[AC_LANG_PUSH([C])
AC_LINK_IFELSE(
[AC_LANG_SOURCE([
int my_function_impl (void)
{
return 0;
}
int my_function (void) __attribute__((weak, alias("my_function_impl")));
int main (void)
{
return my_function();
}
])],
[ax_cv_have_weak_aliases=yes],
[ax_cv_have_weak_aliases=no])])
if test "x$ax_cv_have_weak_aliases" = xyes ; then
AC_DEFINE([HAVE_WEAK_ALIASES], [1],
[Define if the compiler and linker support weak function aliases.])
fi
])