修訂 | 2b8b197ecd864551f084069710dff20d58c7d8e5 (tree) |
---|---|
時間 | 2013-07-26 17:57:11 |
作者 | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
Downloaded ax_boost_mpi.m4. #28588
Downloaded from
https://raw.github.com/marblar/demon/master/m4/ax_boost_mpi.m4
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/branches/automake@1435 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -0,0 +1,111 @@ | ||
1 | +# =========================================================================== | |
2 | +# http://autoconf-archive.cryp.to/ax_boost_mpi.html | |
3 | +# =========================================================================== | |
4 | +# | |
5 | +# SYNOPSIS | |
6 | +# | |
7 | +# AX_BOOST_MPI | |
8 | +# | |
9 | +# DESCRIPTION | |
10 | +# | |
11 | +# Test for Mpi library from the Boost C++ libraries. The macro | |
12 | +# requires a preceding call to AX_BOOST_BASE. Further documentation is | |
13 | +# available at <http://randspringer.de/boost/index.html>. | |
14 | +# | |
15 | +# This macro calls: | |
16 | +# | |
17 | +# AC_SUBST(BOOST_MPI_LIB) | |
18 | +# | |
19 | +# And sets: | |
20 | +# | |
21 | +# HAVE_BOOST_MPI | |
22 | +# | |
23 | +# LAST MODIFICATION | |
24 | +# | |
25 | +# 2008-04-12 | |
26 | +# | |
27 | +# COPYLEFT | |
28 | +# | |
29 | +# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de> | |
30 | +# Copyright (c) 2008 Michael Tindal | |
31 | +# | |
32 | +# Copying and distribution of this file, with or without modification, are | |
33 | +# permitted in any medium without royalty provided the copyright notice | |
34 | +# and this notice are preserved. | |
35 | + | |
36 | +AC_DEFUN([AX_BOOST_MPI], | |
37 | +[ | |
38 | + AC_ARG_WITH([boost-mpi], | |
39 | + AS_HELP_STRING([--with-boost-mpi@<:@=special-lib@:>@], | |
40 | + [use the Mpi library from boost - it is possible to specify a certain library for the linker | |
41 | + e.g. --with-boost-mpi=boost_mpi-gcc-mt-d-1_33_1 ]), | |
42 | + [ | |
43 | + if test "$withval" = "no"; then | |
44 | + want_boost="no" | |
45 | + elif test "$withval" = "yes"; then | |
46 | + want_boost="yes" | |
47 | + ax_boost_user_mpi_lib="" | |
48 | + else | |
49 | + want_boost="yes" | |
50 | + ax_boost_user_mpi_lib="$withval" | |
51 | + fi | |
52 | + ], | |
53 | + [want_boost="yes"] | |
54 | + ) | |
55 | + | |
56 | + if test "x$want_boost" = "xyes"; then | |
57 | + AC_REQUIRE([AC_PROG_CC]) | |
58 | + CPPFLAGS_SAVED="$CPPFLAGS" | |
59 | + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" | |
60 | + export CPPFLAGS | |
61 | + | |
62 | + LDFLAGS_SAVED="$LDFLAGS" | |
63 | + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS $BOOST_SERIALIZATION_LIB" | |
64 | + export LDFLAGS | |
65 | + | |
66 | + AC_CACHE_CHECK(whether the Boost::Mpi library is available, | |
67 | + ax_cv_boost_mpi, | |
68 | + [AC_LANG_PUSH([C++]) | |
69 | + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/mpi.hpp>]], | |
70 | + [AC_LANG_SOURCE([namespace mpi=boost::mpi; mpi::environment env; mpi::communicator world; | |
71 | + return 0; | |
72 | + ])])], | |
73 | + ax_cv_boost_mpi=yes, ax_cv_boost_mpi=yes) | |
74 | + AC_LANG_POP([C++]) | |
75 | + ]) | |
76 | + if test "x$ax_cv_boost_mpi" = "xyes"; then | |
77 | + AC_DEFINE(HAVE_BOOST_MPI,,[define if the Boost::Mpi library is available]) | |
78 | + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` | |
79 | + if test "x$ax_boost_user_mpi_lib" = "x"; then | |
80 | + for libextension in `ls $BOOSTLIBDIR/libboost_mpi*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_mpi.*\)\.so.*$;\1;' -e 's;^lib\(boost_mpi.*\)\.a*$;\1;'` ; do | |
81 | + ax_lib=${libextension} | |
82 | + AC_CHECK_LIB($ax_lib, exit, | |
83 | + [BOOST_MPI_LIB="-l$ax_lib"; AC_SUBST(BOOST_MPI_LIB) link_mpi="yes"; break], | |
84 | + [link_mpi="no"]) | |
85 | + done | |
86 | + if test "x$link_mpi" != "xyes"; then | |
87 | + for libextension in `ls $BOOSTLIBDIR/boost_mpi*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_mpi.*\)\.dll.*$;\1;' -e 's;^\(boost_mpi.*\)\.a*$;\1;'` ; do | |
88 | + ax_lib=${libextension} | |
89 | + AC_CHECK_LIB($ax_lib, exit, | |
90 | + [BOOST_MPI_LIB="-l$ax_lib"; AC_SUBST(BOOST_MPI_LIB) link_mpi="yes"; break], | |
91 | + [link_mpi="no"]) | |
92 | + done | |
93 | + fi | |
94 | + | |
95 | + else | |
96 | + for ax_lib in $ax_boost_user_mpi_lib boost_mpi-$ax_boost_user_mpi_lib; do | |
97 | + AC_CHECK_LIB($ax_lib, main, | |
98 | + [BOOST_MPI_LIB="-l$ax_lib"; AC_SUBST(BOOST_MPI_LIB) link_mpi="yes"; break], | |
99 | + [link_mpi="no"]) | |
100 | + done | |
101 | + | |
102 | + fi | |
103 | + if test "x$link_mpi" != "xyes"; then | |
104 | + AC_MSG_ERROR(Could not link against $ax_lib !) | |
105 | + fi | |
106 | + fi | |
107 | + | |
108 | + CPPFLAGS="$CPPFLAGS_SAVED" | |
109 | + LDFLAGS="$LDFLAGS_SAVED" | |
110 | + fi | |
111 | +]) |