1 | # |
---|
2 | # SYNOPSIS |
---|
3 | # |
---|
4 | # AX_LIB_TBB_MALLOC |
---|
5 | # |
---|
6 | # DESCRIPTION |
---|
7 | # |
---|
8 | # Test for Intel Threaded Building Blocks libraries. |
---|
9 | # Tries to use _debug libs if $enable_debug=yes |
---|
10 | # |
---|
11 | # This macro calls: |
---|
12 | # |
---|
13 | # AC_SUBST(TBB_MALLOC_LIB) |
---|
14 | # AC_SUBST(TBB_MALLOC_LDFLAGS) |
---|
15 | # AC_SUBST(TBB_MALLOC_CPPFLAGS) |
---|
16 | # |
---|
17 | # And sets: |
---|
18 | # |
---|
19 | # HAVE_TBB_MALLOC |
---|
20 | # TBB_USE_DEBUG |
---|
21 | # |
---|
22 | # LICENSE |
---|
23 | # |
---|
24 | # Copyright (c) 2017 Elmar Pruesse <elmar@pruesse.net> |
---|
25 | # |
---|
26 | # Copying and distribution of this file, with or without modification, are |
---|
27 | # permitted in any medium without royalty provided the copyright notice |
---|
28 | # and this notice are preserved. This file is offered as-is, without any |
---|
29 | # warranty. |
---|
30 | |
---|
31 | AC_DEFUN([AX_LIB_TBB_MALLOC], |
---|
32 | [ |
---|
33 | AH_TEMPLATE([HAVE_TBB_MALLOC], [Define to 1 if you have (and want to use) Intel TBB]) |
---|
34 | AH_TEMPLATE([TBB_USE_DEBUG], [Define to 1 to use TBB debugging]) |
---|
35 | |
---|
36 | AC_ARG_WITH([tbb-malloc], |
---|
37 | [AC_HELP_STRING([--with-tbb-malloc@<:@=ARG@:>@], |
---|
38 | [use TBB Malloc library from standard location (ARG=yes), |
---|
39 | from the specified location (ARG=<path>), |
---|
40 | or disable it (ARG=no) |
---|
41 | @<:@ARG=yes@: >@ ])], |
---|
42 | [ |
---|
43 | if test "$withval" = "no"; then |
---|
44 | want_tbb_malloc="no" |
---|
45 | elif test "$withval" = "yes"; then |
---|
46 | want_tbb_malloc="yes" |
---|
47 | else |
---|
48 | want_tbb_malloc="yes" |
---|
49 | ax_tbb_malloc_path="$withval" |
---|
50 | fi |
---|
51 | ],[want_tbb_malloc="yes"]) |
---|
52 | |
---|
53 | TBB_MALLOC_LIB= |
---|
54 | TBB_MALLOC_CPPFLAGS= |
---|
55 | TBB_MALLOC_LDFLAGS= |
---|
56 | |
---|
57 | if test "$ax_tbb_malloc_path" != ""; then |
---|
58 | TBB_MALLOC_CPPFLAGS="-I$ax_tbb_malloc_path/include" |
---|
59 | TBB_MALLOC_LDFLAGS="-L$ax_tbb_malloc_path/lib" |
---|
60 | fi |
---|
61 | |
---|
62 | if test "$want_tbb_malloc" = "yes"; then |
---|
63 | saved_CPPFLAGS="$CPPFLAGS" |
---|
64 | saved_LDFLAGS="$LDFLAGS" |
---|
65 | CPPFLAGS="$CPPFLAGS $TBB_MALLOC_CPPFLAGS" |
---|
66 | LDFLAGS="$LDFLAGS $TBB_MALLOC_LDFLAGS" |
---|
67 | |
---|
68 | AC_CHECK_HEADER([tbb/tbb.h],[ |
---|
69 | if test x"$enable_debug" = x"yes"; then |
---|
70 | AC_CHECK_LIB([tbbmalloc_debug], [main], [ |
---|
71 | TBB_MALLOC_LIB=-ltbbmalloc_debug |
---|
72 | AC_DEFINE([TBB_USE_DEBUG]) |
---|
73 | ]) |
---|
74 | fi |
---|
75 | if test -z "$TBB_MALLOC_LIB"; then |
---|
76 | AC_CHECK_LIB([tbbmalloc], [main], [ |
---|
77 | TBB_MALLOC_LIB=-ltbbmalloc |
---|
78 | ]) |
---|
79 | fi |
---|
80 | ]) |
---|
81 | fi |
---|
82 | |
---|
83 | if test -n "$TBB_MALLOC_LIB"; then |
---|
84 | AC_DEFINE([HAVE_TBB_MALLOC]) |
---|
85 | fi |
---|
86 | |
---|
87 | AC_SUBST([TBB_MALLOC_LIB]) |
---|
88 | AC_SUBST([TBB_MALLOC_LDFLAGS]) |
---|
89 | AC_SUBST([TBB_MALLOC_CFLAGS]) |
---|
90 | ]) |
---|