@cryptotaxi247 / netdata-1 / commits / 7b74c9aad

check main libraries before lto

Costa Tsaousis (ktsaou) committed Mar 12, 2017 at 00:23 UTC 7b74c9aad41793211f2aefd0e33bdaaa5ac1bcf3
1 file changed +63 -63
configure.ac
+63 -63
@@ -180,69 +180,6 @@ CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
180 CC="${PTHREAD_CC}"
181
182
183 -# -----------------------------------------------------------------------------
184 -# compiler options
185 -
186 -AC_ARG_VAR([SSE_CANDIDATE], [C compiler flags for SSE])
187 -AS_CASE([$host_cpu],
188 - [i?86], [SSE_CANDIDATE="yes"]
189 -)
190 -AC_SUBST([SSE_CANDIDATE])
191 -if test "${SSE_CANDIDATE}" = "yes" -a "${enable_x86_sse}" = "yes"; then
192 - opt="-msse2 -mfpmath=sse"
193 - AX_CHECK_COMPILE_FLAG(${opt}, [CFLAGS="${CFLAGS} ${opt}"], [])
194 -fi
195 -
196 -if test "${enable_lto}" != "no"; then
197 - opt="-flto"
198 - AX_CHECK_COMPILE_FLAG(${opt}, [have_lto=yes], [have_lto=no])
199 -fi
200 -test "${enable_lto}" = "yes" -a "${have_lto}" != "yes" && \
201 - AC_MSG_ERROR([LTO is required but is not available.])
202 -AC_MSG_CHECKING([if LTO should be enabled])
203 -if test "${enable_lto}" != "no" -a "${have_lto}" = "yes"; then
204 - enable_lto="yes"
205 - CFLAGS="${CFLAGS} -flto"
206 -else
207 - enable_lto="no"
208 -fi
209 -AC_MSG_RESULT([${enable_lto}])
210 -
211 -if test "${GCC}" = "yes"; then
212 - AC_DEFINE_UNQUOTED([likely(x)], [__builtin_expect(!!(x), 1)], [gcc branch optimization])
213 - AC_DEFINE_UNQUOTED([unlikely(x)], [__builtin_expect(!!(x), 0)], [gcc branch optimization])
214 -else
215 - AC_DEFINE_UNQUOTED([likely(x)], [(x)], [gcc branch optimization])
216 - AC_DEFINE_UNQUOTED([unlikely(x)], [(x)], [gcc branch optimization])
217 -fi
218 -
219 -if test "${enable_pedantic}" = "yes"; then
220 - enable_strict="yes"
221 - CFLAGS="${CFLAGS} -pedantic -Wall -Wextra -Wno-long-long"
222 -fi
223 -
224 -
225 -# -----------------------------------------------------------------------------
226 -# memory allocation library
227 -
228 -AC_MSG_CHECKING([for memory allocator])
229 -TS_CHECK_JEMALLOC
230 -if test "$has_jemalloc" = "1"; then
231 - AC_DEFINE([ENABLE_JEMALLOC], [1], [compile and link with jemalloc])
232 - AC_MSG_RESULT([jemalloc])
233 -else
234 - TS_CHECK_TCMALLOC
235 - if test "$has_tcmalloc" = "1"; then
236 - AC_DEFINE([ENABLE_TCMALLOC], [1], [compile and link with tcmalloc])
237 - AC_MSG_RESULT([tcmalloc])
238 - else
239 - AC_MSG_RESULT([system])
240 - AC_C_MALLOPT
241 - AC_C_MALLINFO
242 - fi
243 -fi
244 -
245 -
183 # -----------------------------------------------------------------------------
184 # libm
185
@@ -306,6 +243,69 @@ OPTIONAL_UUID_CLFAGS="${UUID_CFLAGS}"
243 OPTIONAL_UUID_LIBS="${UUID_LIBS}"
244
245
246 +# -----------------------------------------------------------------------------
247 +# compiler options
248 +
249 +AC_ARG_VAR([SSE_CANDIDATE], [C compiler flags for SSE])
250 +AS_CASE([$host_cpu],
251 + [i?86], [SSE_CANDIDATE="yes"]
252 +)
253 +AC_SUBST([SSE_CANDIDATE])
254 +if test "${SSE_CANDIDATE}" = "yes" -a "${enable_x86_sse}" = "yes"; then
255 + opt="-msse2 -mfpmath=sse"
256 + AX_CHECK_COMPILE_FLAG(${opt}, [CFLAGS="${CFLAGS} ${opt}"], [])
257 +fi
258 +
259 +if test "${enable_lto}" != "no"; then
260 + opt="-flto"
261 + AX_CHECK_COMPILE_FLAG(${opt}, [have_lto=yes], [have_lto=no])
262 +fi
263 +test "${enable_lto}" = "yes" -a "${have_lto}" != "yes" && \
264 + AC_MSG_ERROR([LTO is required but is not available.])
265 +AC_MSG_CHECKING([if LTO should be enabled])
266 +if test "${enable_lto}" != "no" -a "${have_lto}" = "yes"; then
267 + enable_lto="yes"
268 + CFLAGS="${CFLAGS} -flto"
269 +else
270 + enable_lto="no"
271 +fi
272 +AC_MSG_RESULT([${enable_lto}])
273 +
274 +if test "${GCC}" = "yes"; then
275 + AC_DEFINE_UNQUOTED([likely(x)], [__builtin_expect(!!(x), 1)], [gcc branch optimization])
276 + AC_DEFINE_UNQUOTED([unlikely(x)], [__builtin_expect(!!(x), 0)], [gcc branch optimization])
277 +else
278 + AC_DEFINE_UNQUOTED([likely(x)], [(x)], [gcc branch optimization])
279 + AC_DEFINE_UNQUOTED([unlikely(x)], [(x)], [gcc branch optimization])
280 +fi
281 +
282 +if test "${enable_pedantic}" = "yes"; then
283 + enable_strict="yes"
284 + CFLAGS="${CFLAGS} -pedantic -Wall -Wextra -Wno-long-long"
285 +fi
286 +
287 +
288 +# -----------------------------------------------------------------------------
289 +# memory allocation library
290 +
291 +AC_MSG_CHECKING([for memory allocator])
292 +TS_CHECK_JEMALLOC
293 +if test "$has_jemalloc" = "1"; then
294 + AC_DEFINE([ENABLE_JEMALLOC], [1], [compile and link with jemalloc])
295 + AC_MSG_RESULT([jemalloc])
296 +else
297 + TS_CHECK_TCMALLOC
298 + if test "$has_tcmalloc" = "1"; then
299 + AC_DEFINE([ENABLE_TCMALLOC], [1], [compile and link with tcmalloc])
300 + AC_MSG_RESULT([tcmalloc])
301 + else
302 + AC_MSG_RESULT([system])
303 + AC_C_MALLOPT
304 + AC_C_MALLINFO
305 + fi
306 +fi
307 +
308 +
309 # -----------------------------------------------------------------------------
310 # libcap
311