|
1 | 1 | # ===========================================================================
|
2 |
| -# http://www.gnu.org/software/autoconf-archive/ax_boost_thread.html |
| 2 | +# https://www.gnu.org/software/autoconf-archive/ax_boost_thread.html |
3 | 3 | # ===========================================================================
|
4 | 4 | #
|
5 | 5 | # SYNOPSIS
|
|
30 | 30 | # and this notice are preserved. This file is offered as-is, without any
|
31 | 31 | # warranty.
|
32 | 32 |
|
33 |
| -#serial 27 |
| 33 | +#serial 32 |
34 | 34 |
|
35 | 35 | AC_DEFUN([AX_BOOST_THREAD],
|
36 | 36 | [
|
37 |
| - AC_ARG_WITH([boost-thread], |
38 |
| - AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@], |
39 |
| - [use the Thread library from boost - it is possible to specify a certain library for the linker |
40 |
| - e.g. --with-boost-thread=boost_thread-gcc-mt ]), |
| 37 | + AC_ARG_WITH([boost-thread], |
| 38 | + AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@], |
| 39 | + [use the Thread library from boost - |
| 40 | + it is possible to specify a certain library for the linker |
| 41 | + e.g. --with-boost-thread=boost_thread-gcc-mt ]), |
41 | 42 | [
|
42 |
| - if test "$withval" = "no"; then |
43 |
| - want_boost="no" |
44 |
| - elif test "$withval" = "yes"; then |
| 43 | + if test "$withval" = "yes"; then |
45 | 44 | want_boost="yes"
|
46 | 45 | ax_boost_user_thread_lib=""
|
47 | 46 | else
|
48 |
| - want_boost="yes" |
49 |
| - ax_boost_user_thread_lib="$withval" |
50 |
| - fi |
| 47 | + want_boost="yes" |
| 48 | + ax_boost_user_thread_lib="$withval" |
| 49 | + fi |
51 | 50 | ],
|
52 | 51 | [want_boost="yes"]
|
53 |
| - ) |
| 52 | + ) |
54 | 53 |
|
55 |
| - if test "x$want_boost" = "xyes"; then |
| 54 | + if test "x$want_boost" = "xyes"; then |
56 | 55 | AC_REQUIRE([AC_PROG_CC])
|
57 | 56 | AC_REQUIRE([AC_CANONICAL_BUILD])
|
58 |
| - CPPFLAGS_SAVED="$CPPFLAGS" |
59 |
| - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" |
60 |
| - export CPPFLAGS |
| 57 | + CPPFLAGS_SAVED="$CPPFLAGS" |
| 58 | + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" |
| 59 | + export CPPFLAGS |
61 | 60 |
|
62 |
| - LDFLAGS_SAVED="$LDFLAGS" |
63 |
| - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" |
64 |
| - export LDFLAGS |
| 61 | + LDFLAGS_SAVED="$LDFLAGS" |
| 62 | + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" |
| 63 | + export LDFLAGS |
65 | 64 |
|
66 | 65 | AC_CACHE_CHECK(whether the Boost::Thread library is available,
|
67 |
| - ax_cv_boost_thread, |
| 66 | + ax_cv_boost_thread, |
68 | 67 | [AC_LANG_PUSH([C++])
|
69 |
| - CXXFLAGS_SAVE=$CXXFLAGS |
| 68 | + CXXFLAGS_SAVE=$CXXFLAGS |
70 | 69 |
|
71 |
| - if test "x$host_os" = "xsolaris" ; then |
72 |
| - CXXFLAGS="-pthreads $CXXFLAGS" |
73 |
| - elif test "x$host_os" = "xmingw32" ; then |
74 |
| - CXXFLAGS="-mthreads $CXXFLAGS" |
75 |
| - else |
76 |
| - CXXFLAGS="-pthread $CXXFLAGS" |
77 |
| - fi |
78 |
| - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]], |
79 |
| - [[boost::thread_group thrds; |
80 |
| - return 0;]])], |
81 |
| - ax_cv_boost_thread=yes, ax_cv_boost_thread=no) |
82 |
| - CXXFLAGS=$CXXFLAGS_SAVE |
| 70 | + if test "x$host_os" = "xsolaris" ; then |
| 71 | + CXXFLAGS="-pthreads $CXXFLAGS" |
| 72 | + elif test "x$host_os" = "xmingw32" ; then |
| 73 | + CXXFLAGS="-mthreads $CXXFLAGS" |
| 74 | + else |
| 75 | + CXXFLAGS="-pthread $CXXFLAGS" |
| 76 | + fi |
| 77 | + AC_COMPILE_IFELSE([ |
| 78 | + AC_LANG_PROGRAM( |
| 79 | + [[@%:@include <boost/thread/thread.hpp>]], |
| 80 | + [[boost::thread_group thrds; |
| 81 | + return 0;]])], |
| 82 | + ax_cv_boost_thread=yes, ax_cv_boost_thread=no) |
| 83 | + CXXFLAGS=$CXXFLAGS_SAVE |
83 | 84 | AC_LANG_POP([C++])
|
84 |
| - ]) |
85 |
| - if test "x$ax_cv_boost_thread" = "xyes"; then |
| 85 | + ]) |
| 86 | + if test "x$ax_cv_boost_thread" = "xyes"; then |
86 | 87 | if test "x$host_os" = "xsolaris" ; then
|
87 |
| - BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS" |
88 |
| - elif test "x$host_os" = "xmingw32" ; then |
89 |
| - BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS" |
90 |
| - else |
91 |
| - BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS" |
92 |
| - fi |
| 88 | + BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS" |
| 89 | + elif test "x$host_os" = "xmingw32" ; then |
| 90 | + BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS" |
| 91 | + else |
| 92 | + BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS" |
| 93 | + fi |
93 | 94 |
|
94 |
| - AC_SUBST(BOOST_CPPFLAGS) |
| 95 | + AC_SUBST(BOOST_CPPFLAGS) |
95 | 96 |
|
96 |
| - AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Thread library is available]) |
| 97 | + AC_DEFINE(HAVE_BOOST_THREAD,, |
| 98 | + [define if the Boost::Thread library is available]) |
97 | 99 | BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
98 | 100 |
|
99 |
| - LDFLAGS_SAVE=$LDFLAGS |
| 101 | + LDFLAGS_SAVE=$LDFLAGS |
100 | 102 | case "x$host_os" in
|
101 | 103 | *bsd* )
|
102 | 104 | LDFLAGS="-pthread $LDFLAGS"
|
103 | 105 | break;
|
104 | 106 | ;;
|
105 | 107 | esac
|
106 | 108 | if test "x$ax_boost_user_thread_lib" = "x"; then
|
107 |
| - ax_lib= |
108 | 109 | for libextension in `ls -r $BOOSTLIBDIR/libboost_thread* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'`; do
|
109 | 110 | ax_lib=${libextension}
|
110 |
| - AC_CHECK_LIB($ax_lib, exit, |
111 |
| - [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], |
| 111 | + AC_CHECK_LIB($ax_lib, exit, |
| 112 | + [link_thread="yes"; break], |
112 | 113 | [link_thread="no"])
|
113 |
| - done |
| 114 | + done |
114 | 115 | if test "x$link_thread" != "xyes"; then
|
115 | 116 | for libextension in `ls -r $BOOSTLIBDIR/boost_thread* 2>/dev/null | sed 's,.*/,,' | sed 's,\..*,,'`; do
|
116 | 117 | ax_lib=${libextension}
|
117 |
| - AC_CHECK_LIB($ax_lib, exit, |
118 |
| - [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], |
| 118 | + AC_CHECK_LIB($ax_lib, exit, |
| 119 | + [link_thread="yes"; break], |
119 | 120 | [link_thread="no"])
|
120 |
| - done |
| 121 | + done |
121 | 122 | fi
|
122 | 123 |
|
123 | 124 | else
|
124 | 125 | for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do
|
125 |
| - AC_CHECK_LIB($ax_lib, exit, |
126 |
| - [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], |
| 126 | + AC_CHECK_LIB($ax_lib, exit, |
| 127 | + [link_thread="yes"; break], |
127 | 128 | [link_thread="no"])
|
128 | 129 | done
|
129 | 130 |
|
130 | 131 | fi
|
131 | 132 | if test "x$ax_lib" = "x"; then
|
132 |
| - AC_MSG_ERROR(Could not find a version of the boost_thread library!) |
| 133 | + AC_MSG_ERROR(Could not find a version of the Boost::Thread library!) |
133 | 134 | fi
|
134 |
| - if test "x$link_thread" = "xno"; then |
135 |
| - AC_MSG_ERROR(Could not link against $ax_lib !) |
136 |
| - else |
137 |
| - case "x$host_os" in |
138 |
| - *bsd* ) |
139 |
| - BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS" |
140 |
| - break; |
141 |
| - ;; |
142 |
| - esac |
143 |
| -
|
144 |
| - fi |
145 |
| - fi |
| 135 | + if test "x$link_thread" = "xno"; then |
| 136 | + AC_MSG_ERROR(Could not link against $ax_lib !) |
| 137 | + else |
| 138 | + BOOST_THREAD_LIB="-l$ax_lib" |
| 139 | + case "x$host_os" in |
| 140 | + *bsd* ) |
| 141 | + BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS" |
| 142 | + break; |
| 143 | + ;; |
| 144 | + xsolaris ) |
| 145 | + BOOST_THREAD_LIB="$BOOST_THREAD_LIB -lpthread" |
| 146 | + break; |
| 147 | + ;; |
| 148 | + xmingw32 ) |
| 149 | + break; |
| 150 | + ;; |
| 151 | + * ) |
| 152 | + BOOST_THREAD_LIB="$BOOST_THREAD_LIB -lpthread" |
| 153 | + break; |
| 154 | + ;; |
| 155 | + esac |
| 156 | + AC_SUBST(BOOST_THREAD_LIB) |
| 157 | + fi |
| 158 | + fi |
146 | 159 |
|
147 |
| - CPPFLAGS="$CPPFLAGS_SAVED" |
148 |
| - LDFLAGS="$LDFLAGS_SAVED" |
149 |
| - fi |
| 160 | + CPPFLAGS="$CPPFLAGS_SAVED" |
| 161 | + LDFLAGS="$LDFLAGS_SAVED" |
| 162 | + fi |
150 | 163 | ])
|
0 commit comments