1 | # |
---|
2 | # SYNOPSIS |
---|
3 | # |
---|
4 | # AX_LIB_TBB |
---|
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_LIB) |
---|
14 | # AC_SUBST(TBB_LDFLAGS) |
---|
15 | # AC_SUBST(TBB_CPPFLAGS) |
---|
16 | # |
---|
17 | # And sets: |
---|
18 | # |
---|
19 | # HAVE_TBB |
---|
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], |
---|
32 | [ |
---|
33 | AH_TEMPLATE([HAVE_TBB], [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], |
---|
37 | [AC_HELP_STRING([--with-tbb@<:@=ARG@:>@], |
---|
38 | [use TBB 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="no" |
---|
45 | elif test "$withval" = "yes"; then |
---|
46 | want_tbb="yes" |
---|
47 | else |
---|
48 | want_tbb="yes" |
---|
49 | ax_tbb_path="$withval" |
---|
50 | fi |
---|
51 | ],[want_tbb="yes"]) |
---|
52 | |
---|
53 | TBB_LIB= |
---|
54 | TBB_CPPFLAGS= |
---|
55 | TBB_LDFLAGS= |
---|
56 | |
---|
57 | if test "$ax_tbb_path" != ""; then |
---|
58 | TBB_CPPFLAGS="-I$ax_tbb_path/include" |
---|
59 | TBB_LDFLAGS="-L$ax_tbb_path/lib" |
---|
60 | fi |
---|
61 | |
---|
62 | if test "$want_tbb" = "yes"; then |
---|
63 | saved_CPPFLAGS="$CPPFLAGS" |
---|
64 | saved_LDFLAGS="$LDFLAGS" |
---|
65 | CPPFLAGS="$CPPFLAGS $TBB_CPPFLAGS" |
---|
66 | LDFLAGS="$LDFLAGS $TBB_LDFLAGS" |
---|
67 | |
---|
68 | AC_CHECK_HEADER([tbb/tbb.h],[ |
---|
69 | if test x"$enable_debug" = x"yes"; then |
---|
70 | AC_CHECK_LIB([tbb_debug], [main], [ |
---|
71 | TBB_LIB=-ltbb_debug |
---|
72 | AC_DEFINE([TBB_USE_DEBUG]) |
---|
73 | ]) |
---|
74 | fi |
---|
75 | if test -z "$TBB_LIB"; then |
---|
76 | AC_CHECK_LIB([tbb], [main], [ |
---|
77 | TBB_LIB=-ltbb |
---|
78 | ]) |
---|
79 | fi |
---|
80 | ]) |
---|
81 | fi |
---|
82 | |
---|
83 | if test -n "$TBB_LIB"; then |
---|
84 | AC_DEFINE([HAVE_TBB]) |
---|
85 | fi |
---|
86 | |
---|
87 | AC_SUBST([TBB_LIB]) |
---|
88 | AC_SUBST([TBB_LDFLAGS]) |
---|
89 | AC_SUBST([TBB_CFLAGS]) |
---|
90 | ]) |
---|