forked from buildgear/buildgear
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
158 lines (131 loc) · 4.28 KB
/
configure.ac
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Build Gear autoconfigure script
#
# Process this file with autoconf to produce the configure script.
#
AC_PREREQ([2.68])
AC_INIT([Build Gear], [1.0.3], [], [buildgear], [http://buildgear.io])
AC_CONFIG_HEADERS([src/include/config.h])
AM_INIT_AUTOMAKE([1.11 foreign dist-xz no-dist-gzip -Wall -Werror])
AM_SILENT_RULES([yes])
# Check for programs
AC_PROG_CXX
AC_LANG([C++])
# Check for C++11 compliance
AC_DEFUN([AC_COMPILE_STDCXX_11], [
AC_CACHE_CHECK(if g++ supports C++11 features without additional flags,
ac_cv_cxx_compile_cxx11_native,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template <typename T>
struct check final
{
static constexpr T value{ __cplusplus };
};
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);
static_assert(check_type::value == 201103L, "C++11 compiler");],,
ac_cv_cxx_compile_cxx11_native=yes, ac_cv_cxx_compile_cxx11_native=no)
AC_LANG_RESTORE
])
AC_CACHE_CHECK(if g++ supports C++11 features with -std=c++11,
ac_cv_cxx_compile_cxx11_cxx,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -std=c++11"
AC_TRY_COMPILE([
template <typename T>
struct check final
{
static constexpr T value{ __cplusplus };
};
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);
static_assert(check_type::value == 201103L, "C++11 compiler");],,
ac_cv_cxx_compile_cxx11_cxx=yes, ac_cv_cxx_compile_cxx11_cxx=no)
CXXFLAGS="$ac_save_CXXFLAGS"
AC_LANG_RESTORE
])
AC_CACHE_CHECK(if g++ supports C++11 features with -std=gnu++11,
ac_cv_cxx_compile_cxx11_gxx,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -std=gnu++11"
AC_TRY_COMPILE([
template <typename T>
struct check final
{
static constexpr T value{ __cplusplus };
};
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);
static_assert(check_type::value == 201103L, "C++11 compiler");],,
ac_cv_cxx_compile_cxx11_gxx=yes, ac_cv_cxx_compile_cxx11_gxx=no)
CXXFLAGS="$ac_save_CXXFLAGS"
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_compile_cxx11_native" = yes ||
test "$ac_cv_cxx_compile_cxx11_cxx" = yes ||
test "$ac_cv_cxx_compile_cxx11_gxx" = yes; then
AC_DEFINE(HAVE_STDCXX_11,,[Define if g++ supports C++11 features. ])
fi
])
cpp11=1
AC_COMPILE_STDCXX_11
m4_include([m4/ax_check_compile_flag.m4])
AX_CHECK_COMPILE_FLAG([-std=c++11], [CXXFLAGS="$CXXFLAGS -std=c++11"], [cpp11=0])
if test $cpp11 == 0
then
AC_MSG_ERROR([c++11 compiler support not found])
fi
# Check for libraries and their interfaces
AC_CHECK_LIB([rt], [clock_gettime], , AC_MSG_ERROR([required library rt not found]))
AC_CHECK_FUNCS([clock_gettime getcwd strerror])
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
curl=1
AC_SEARCH_LIBS([curl_global_init], [curl curl-gnutls], , [curl=0])
AC_CHECK_FUNC([curl_easy_init], , [curl=0])
AC_CHECK_FUNC([curl_easy_setopt], , [curl=0])
AC_CHECK_FUNC([curl_easy_perform], , [curl=0])
AC_CHECK_FUNC([curl_easy_cleanup], , [curl=0])
AC_CHECK_FUNC([curl_global_cleanup], , [curl=0])
AC_CHECK_FUNC([curl_easy_strerror], , [curl=0])
AC_CHECK_HEADERS([curl/curl.h], , [curl=0])
if test $curl == 0
then
AC_MSG_ERROR([required library curl not found])
fi
termcap=1
AC_SEARCH_LIBS([tgetent], [termcap curses ncurses], , [termcap=0])
AC_CHECK_FUNC([tgetnum], , [termcap=0])
AC_CHECK_FUNC([tgetstr], , [termcap=0])
AC_CHECK_FUNC([putp], , [termcap=0])
AC_CHECK_FUNC([tparm], , [termcap=0])
AC_CHECK_HEADERS([term.h], , [termcap=0])
AC_CHECK_HEADERS([curses.h], , [termcap=0])
if test $termcap == 0
then
AC_MSG_ERROR([required library termcap not found])
fi
AC_CHECK_LIB([pthread], [pthread_create], , AC_MSG_ERROR([required library pthread not found]))
# Check for typedefs, structures, and compiler characteristics
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
AC_FUNC_ERROR_AT_LINE
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile doc/Makefile])
AC_OUTPUT