├── autogen.sh ├── Makefile.am ├── .gitignore ├── configure.ac ├── .github └── workflows │ └── unit-test.yml ├── LICENSE ├── tests └── test-subprocess.cpp ├── README.md ├── include └── subprocess.hpp └── m4 └── boost.m4 /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | autoreconf --force --install -I m4 4 | 5 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | ACLOCAL_AMFLAGS = -I m4 3 | 4 | bin_PROGRAMS = test-subprocess 5 | 6 | test_subprocess_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_CPPFLAGS) -I include 7 | test_subprocess_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) 8 | test_subprocess_SOURCES = tests/test-subprocess.cpp 9 | 10 | test: test-subprocess 11 | ./test-subprocess --catch_system_errors=no 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | 2 | AC_INIT(subprocess, 0.0.0) 3 | 4 | AC_CONFIG_MACRO_DIR(m4) 5 | 6 | AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability foreign subdir-objects]) 7 | 8 | AC_PROG_CXX 9 | AC_PROG_LIBTOOL 10 | 11 | AC_SUBST(AM_CXXFLAGS) 12 | AC_SUBST(AM_LDFLAGS) 13 | 14 | # https://github.com/tsuna/boost.m4 15 | BOOST_REQUIRE 16 | BOOST_TEST 17 | 18 | BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_ALL_DYN_LINK" 19 | 20 | AM_CXXFLAGS="$AM_CXXFLAGS -Wall -Wextra -std=c++11" 21 | AM_LDFLAGS="$AM_LDFLAGS -rdynamic" 22 | 23 | AC_CONFIG_FILES([Makefile]) 24 | AC_OUTPUT 25 | -------------------------------------------------------------------------------- /.github/workflows/unit-test.yml: -------------------------------------------------------------------------------- 1 | name: unit-test 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | compiler: [g++, clang++] 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Install dependencies 18 | run: sudo apt-get install -y libboost-all-dev 19 | - name: Build 20 | run: | 21 | ./autogen.sh 22 | ./configure CXX=${{ matrix.compiler }} 23 | make 24 | - name: Test 25 | run: make test 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Tero Saarni 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /tests/test-subprocess.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #define BOOST_TEST_MODULE test_subprocess 4 | 5 | #include 6 | 7 | #include "subprocess.hpp" 8 | 9 | 10 | BOOST_AUTO_TEST_CASE(arguments) 11 | { 12 | subprocess::popen cmd("echo", {"foo", "bar", "baz"}); 13 | 14 | std::string buf; 15 | std::getline(cmd.out(), buf); 16 | 17 | BOOST_CHECK_EQUAL(buf, "foo bar baz"); 18 | BOOST_CHECK_EQUAL(cmd.wait(), 0); 19 | } 20 | 21 | BOOST_AUTO_TEST_CASE(stdio_forwarding) 22 | { 23 | subprocess::popen cmd("cat", {}); 24 | 25 | cmd.in() << "Hello world!" << std::endl; 26 | cmd.close(); 27 | 28 | std::string buf; 29 | std::getline(cmd.out(), buf); 30 | 31 | BOOST_CHECK_EQUAL(buf, "Hello world!"); 32 | BOOST_CHECK_EQUAL(cmd.wait(), 0); 33 | } 34 | 35 | BOOST_AUTO_TEST_CASE(return_values) 36 | { 37 | subprocess::popen true_cmd("true", {}); 38 | BOOST_CHECK_EQUAL(true_cmd.wait(), 0); 39 | 40 | subprocess::popen false_cmd("false", {}); 41 | BOOST_CHECK_EQUAL(false_cmd.wait(), 1); 42 | } 43 | 44 | BOOST_AUTO_TEST_CASE(bad_command) 45 | { 46 | subprocess::popen cmd("/non-existing-comand", {}); 47 | 48 | BOOST_CHECK(cmd.wait() != 0); 49 | } 50 | 51 | BOOST_AUTO_TEST_CASE(pipes) 52 | { 53 | subprocess::popen sort_cmd("sort", {"-r"}); 54 | subprocess::popen cat_cmd("cat", {}, sort_cmd.in()); 55 | 56 | cat_cmd.in() << "a" << std::endl; 57 | cat_cmd.in() << "b" << std::endl; 58 | cat_cmd.in() << "c" << std::endl; 59 | cat_cmd.close(); 60 | 61 | std::string line; 62 | std::getline(sort_cmd.out(), line); 63 | BOOST_CHECK_EQUAL(line, "c"); 64 | std::getline(sort_cmd.out(), line); 65 | BOOST_CHECK_EQUAL(line, "b"); 66 | std::getline(sort_cmd.out(), line); 67 | BOOST_CHECK_EQUAL(line, "a"); 68 | 69 | BOOST_CHECK(cat_cmd.wait() == 0); 70 | BOOST_CHECK(sort_cmd.wait() == 0); 71 | } 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # cpp-subprocess 3 | 4 | [![Build Status](https://travis-ci.org/tsaarni/cpp-subprocess.svg?branch=master)](https://travis-ci.org/tsaarni/cpp-subprocess) 5 | 6 | *subprocess* is a small header-only library that provides convenient 7 | C++ API to execute shell commands. It is similar to `popen()`, as it 8 | creates a new process and executes the command by invoking shell. The 9 | difference compared to `popen()` is that stdin, stdout and stderr of 10 | the child process are associated to iostream objects which can be 11 | accessed by the parent process. 12 | 13 | The library uses GNU extension `__gnu_cxx::stdio_filebuf` to construct 14 | iostream objects from file descriptors. It works on gcc and it can 15 | work also with clang as long as GNU's C++ standard library is used. 16 | 17 | 18 | ### Tutorial 19 | 20 | The first example executes `ls` and print the directory listing of 21 | the current working directory into standard out. 22 | 23 | ```C++ 24 | #include "subprocess.hpp" 25 | 26 | int 27 | main(int argc, char *argv[]) 28 | { 29 | subprocess::popen cmd("ls", {}); 30 | std::cout << cmd.out().rdbuf(); 31 | 32 | return 0; 33 | } 34 | ``` 35 | 36 | The second example executes `sort -r` and write the contents of 37 | `inputfile.txt` to the standard input of the executed command. It 38 | will then read the standard output of the command and print it. The 39 | resulting output is the reverse sorted contents of the 40 | `inputfile.txt`. 41 | 42 | 43 | ```C++ 44 | #include 45 | #include "subprocess.hpp" 46 | 47 | int 48 | main(int argc, char *argv[]) 49 | { 50 | subprocess::popen cmd("sort", {"-r"}); 51 | 52 | std::ifstream file("inputfile.txt"); 53 | std::string line; 54 | 55 | while (std::getline(file, line)) 56 | { 57 | cmd.in() << line << std::endl; 58 | } 59 | cmd.close(); 60 | 61 | std::cout << cmd.out().rdbuf(); 62 | 63 | return 0; 64 | } 65 | ``` 66 | 67 | Shell-like pipes can be constructed between output and input of two 68 | commands. Following example executes equivalent of `cat | sort -r` 69 | for input containing three lines: "a", "b" and "c". The result read 70 | from the output stream contains the input in reversed order. 71 | 72 | ```C++ 73 | #include 74 | #include "subprocess.hpp" 75 | 76 | int 77 | main(int argc, char *argv[]) 78 | { 79 | subprocess::popen sort_cmd("sort", {"-r"}); 80 | subprocess::popen cat_cmd("cat", {}, sort_cmd.in()); 81 | 82 | cat_cmd.in() << "a" << std::endl; 83 | cat_cmd.in() << "b" << std::endl; 84 | cat_cmd.in() << "c" << std::endl; 85 | cat_cmd.close(); 86 | 87 | std::cout << sort_cmd.out().rdbuf(); 88 | 89 | return 0; 90 | } 91 | ``` 92 | 93 | To write to and read from a subprocess for multiple times, use 94 | `std::getline()` or some other way to read without blocking: 95 | 96 | ```C++ 97 | #include 98 | #include "subprocess.hpp" 99 | 100 | int 101 | main(int argc, char *argv[]) 102 | { 103 | std::string buf; 104 | 105 | subprocess::popen cat_cmd("cat", {}); 106 | 107 | cat_cmd.in() << "a" << std::endl; 108 | std::getline(cat_cmd.out(), buf); 109 | std::cout << buf << std::endl; 110 | 111 | cat_cmd.in() << "b" << std::endl; 112 | std::getline(cat_cmd.out(), buf); 113 | std::cout << buf << std::endl; 114 | 115 | cat_cmd.in() << "c" << std::endl; 116 | std::getline(cat_cmd.out(), buf); 117 | std::cout << buf << std::endl; 118 | 119 | return 0; 120 | } 121 | ``` 122 | 123 | ### Installation 124 | 125 | The library consists of single file `include/subprocess.hpp`. Copy 126 | the file into your own project or e.g. into `/usr/local/include/`. 127 | 128 | Use `-std=c++11` when compiling the code. 129 | 130 | Unit test suite depends on Boost Test Library. 131 | -------------------------------------------------------------------------------- /include/subprocess.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // subprocess C++ library - https://github.com/tsaarni/cpp-subprocess 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Copyright (c) 2015 Tero Saarni 7 | // 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | namespace subprocess 23 | { 24 | 25 | class popen 26 | { 27 | public: 28 | 29 | popen(const std::string& cmd, std::vector argv) 30 | : in_filebuf(nullptr), out_filebuf(nullptr), err_filebuf(nullptr), in_stream(nullptr), out_stream(nullptr), err_stream(nullptr) 31 | { 32 | if (pipe(in_pipe) == -1 || 33 | pipe(out_pipe) == -1 || 34 | pipe(err_pipe) == -1 ) 35 | { 36 | throw std::system_error(errno, std::system_category()); 37 | } 38 | 39 | run(cmd, argv); 40 | } 41 | 42 | popen(const std::string& cmd, std::vector argv, std::ostream& pipe_stdout) 43 | : in_filebuf(nullptr), out_filebuf(nullptr), err_filebuf(nullptr), in_stream(nullptr), out_stream(nullptr), err_stream(nullptr) 44 | { 45 | auto filebuf = dynamic_cast<__gnu_cxx::stdio_filebuf*>(pipe_stdout.rdbuf()); 46 | out_pipe[READ] = -1; 47 | out_pipe[WRITE] = filebuf->fd(); 48 | 49 | if (pipe(in_pipe) == -1 || 50 | pipe(err_pipe) == -1 ) 51 | { 52 | throw std::system_error(errno, std::system_category()); 53 | } 54 | 55 | run(cmd, argv); 56 | } 57 | 58 | ~popen() 59 | { 60 | delete in_filebuf; 61 | delete in_stream; 62 | if (out_filebuf != nullptr) delete out_filebuf; 63 | if (out_stream != nullptr) delete out_stream; 64 | delete err_filebuf; 65 | delete err_stream; 66 | } 67 | 68 | std::ostream& in() { return *in_stream; }; 69 | 70 | std::istream& out() 71 | { 72 | if (out_stream == nullptr) throw std::system_error(EBADF, std::system_category()); 73 | return *out_stream; 74 | }; 75 | 76 | std::istream& err() { return *err_stream; }; 77 | 78 | int wait() 79 | { 80 | int status = 0; 81 | waitpid(pid, &status, 0); 82 | return WEXITSTATUS(status); 83 | }; 84 | 85 | void close() 86 | { 87 | in_filebuf->close(); 88 | } 89 | 90 | 91 | private: 92 | 93 | enum ends_of_pipe { READ = 0, WRITE = 1 }; 94 | 95 | struct raii_char_str 96 | { 97 | raii_char_str(std::string s) : buf(s.c_str(), s.c_str() + s.size() + 1) { }; 98 | operator char*() const { return &buf[0]; }; 99 | mutable std::vector buf; 100 | }; 101 | 102 | void run(const std::string& cmd, std::vector argv) 103 | { 104 | argv.insert(argv.begin(), cmd); 105 | 106 | pid = ::fork(); 107 | 108 | if (pid == 0) child(argv); 109 | 110 | ::close(in_pipe[READ]); 111 | ::close(out_pipe[WRITE]); 112 | ::close(err_pipe[WRITE]); 113 | 114 | in_filebuf = new __gnu_cxx::stdio_filebuf(in_pipe[WRITE], std::ios_base::out, 1); 115 | in_stream = new std::ostream(in_filebuf); 116 | 117 | if (out_pipe[READ] != -1) 118 | { 119 | out_filebuf = new __gnu_cxx::stdio_filebuf(out_pipe[READ], std::ios_base::in, 1); 120 | out_stream = new std::istream(out_filebuf); 121 | } 122 | 123 | err_filebuf = new __gnu_cxx::stdio_filebuf(err_pipe[READ], std::ios_base::in, 1); 124 | err_stream = new std::istream(err_filebuf); 125 | } 126 | 127 | void child(const std::vector& argv) 128 | { 129 | if (dup2(in_pipe[READ], STDIN_FILENO) == -1 || 130 | dup2(out_pipe[WRITE], STDOUT_FILENO) == -1 || 131 | dup2(err_pipe[WRITE], STDERR_FILENO) == -1 ) 132 | { 133 | std::perror("subprocess: dup2() failed"); 134 | return; 135 | } 136 | 137 | ::close(in_pipe[READ]); 138 | ::close(in_pipe[WRITE]); 139 | if (out_pipe[READ] != -1) ::close(out_pipe[READ]); 140 | ::close(out_pipe[WRITE]); 141 | ::close(err_pipe[READ]); 142 | ::close(err_pipe[WRITE]); 143 | 144 | std::vector real_args(argv.begin(), argv.end()); 145 | std::vector cargs(real_args.begin(), real_args.end()); 146 | cargs.push_back(nullptr); 147 | 148 | if (execvp(cargs[0], &cargs[0]) == -1) 149 | { 150 | std::perror("subprocess: execvp() failed"); 151 | return; 152 | } 153 | } 154 | 155 | pid_t pid; 156 | 157 | int in_pipe[2]; 158 | int out_pipe[2]; 159 | int err_pipe[2]; 160 | 161 | __gnu_cxx::stdio_filebuf* in_filebuf; 162 | __gnu_cxx::stdio_filebuf* out_filebuf; 163 | __gnu_cxx::stdio_filebuf* err_filebuf; 164 | 165 | std::ostream* in_stream; 166 | std::istream* out_stream; 167 | std::istream* err_stream; 168 | }; 169 | 170 | } // namespace: subprocess 171 | -------------------------------------------------------------------------------- /m4/boost.m4: -------------------------------------------------------------------------------- 1 | # boost.m4: Locate Boost headers and libraries for autoconf-based projects. 2 | # Copyright (C) 2007-2011, 2014 Benoit Sigoure 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # Additional permission under section 7 of the GNU General Public 10 | # License, version 3 ("GPLv3"): 11 | # 12 | # If you convey this file as part of a work that contains a 13 | # configuration script generated by Autoconf, you may do so under 14 | # terms of your choice. 15 | # 16 | # This program is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | # GNU General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU General Public License 22 | # along with this program. If not, see . 23 | 24 | m4_define([_BOOST_SERIAL], [m4_translit([ 25 | # serial 25 26 | ], [# 27 | ], [])]) 28 | 29 | # Original sources can be found at http://github.com/tsuna/boost.m4 30 | # You can fetch the latest version of the script by doing: 31 | # wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4 32 | 33 | # ------ # 34 | # README # 35 | # ------ # 36 | 37 | # This file provides several macros to use the various Boost libraries. 38 | # The first macro is BOOST_REQUIRE. It will simply check if it's possible to 39 | # find the Boost headers of a given (optional) minimum version and it will 40 | # define BOOST_CPPFLAGS accordingly. It will add an option --with-boost to 41 | # your configure so that users can specify non standard locations. 42 | # If the user's environment contains BOOST_ROOT and --with-boost was not 43 | # specified, --with-boost=$BOOST_ROOT is implicitly used. 44 | # For more README and documentation, go to http://github.com/tsuna/boost.m4 45 | # Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL. If you don't, don't worry, 46 | # simply read the README, it will show you what to do step by step. 47 | 48 | m4_pattern_forbid([^_?(BOOST|Boost)_]) 49 | 50 | 51 | # _BOOST_SED_CPP(SED-PROGRAM, PROGRAM, 52 | # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 53 | # -------------------------------------------------------- 54 | # Same as AC_EGREP_CPP, but leave the result in conftest.i. 55 | # 56 | # SED-PROGRAM is *not* overquoted, as in AC_EGREP_CPP. It is expanded 57 | # in double-quotes, so escape your double quotes. 58 | # 59 | # It could be useful to turn this into a macro which extracts the 60 | # value of any macro. 61 | m4_define([_BOOST_SED_CPP], 62 | [AC_LANG_PUSH([C++])dnl 63 | AC_LANG_PREPROC_REQUIRE()dnl 64 | AC_REQUIRE([AC_PROG_SED])dnl 65 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])]) 66 | AS_IF([dnl eval is necessary to expand ac_cpp. 67 | dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. 68 | dnl Beware of Windows end-of-lines, for instance if we are running 69 | dnl some Windows programs under Wine. In that case, boost/version.hpp 70 | dnl is certainly using "\r\n", but the regular Unix shell will only 71 | dnl strip `\n' with backquotes, not the `\r'. This results in 72 | dnl boost_cv_lib_version='1_37\r' for instance, which breaks 73 | dnl everything else. 74 | dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK 75 | dnl 76 | dnl Beware that GCC 5, when expanding macros, may embed # line directives 77 | dnl a within single line: 78 | dnl 79 | dnl # 1 "conftest.cc" 80 | dnl # 1 "" 81 | dnl # 1 "" 82 | dnl # 1 "conftest.cc" 83 | dnl # 1 "/opt/local/include/boost/version.hpp" 1 3 84 | dnl # 2 "conftest.cc" 2 85 | dnl boost-lib-version = 86 | dnl # 2 "conftest.cc" 3 87 | dnl "1_56" 88 | dnl 89 | dnl So get rid of the # lines, and glue the remaining ones together. 90 | (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | 91 | grep -v '#' | 92 | tr -d '\r' | 93 | tr -s '\n' ' ' | 94 | $SED -n -e "$1" >conftest.i 2>&1], 95 | [$3], 96 | [$4]) 97 | rm -rf conftest* 98 | AC_LANG_POP([C++])dnl 99 | ])# _BOOST_SED_CPP 100 | 101 | 102 | 103 | # BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND]) 104 | # ----------------------------------------------- 105 | # Look for Boost. If version is given, it must either be a literal of the form 106 | # "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a 107 | # variable "$var". 108 | # Defines the value BOOST_CPPFLAGS. This macro only checks for headers with 109 | # the required version, it does not check for any of the Boost libraries. 110 | # On # success, defines HAVE_BOOST. On failure, calls the optional 111 | # ACTION-IF-NOT-FOUND action if one was supplied. 112 | # Otherwise aborts with an error message. 113 | AC_DEFUN_ONCE([BOOST_REQUIRE], 114 | [AC_REQUIRE([AC_PROG_CXX])dnl 115 | AC_REQUIRE([AC_PROG_GREP])dnl 116 | echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD 117 | boost_save_IFS=$IFS 118 | boost_version_req=$1 119 | IFS=. 120 | set x $boost_version_req 0 0 0 121 | IFS=$boost_save_IFS 122 | shift 123 | boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"` 124 | boost_version_req_string=$[1].$[2].$[3] 125 | AC_ARG_WITH([boost], 126 | [AS_HELP_STRING([--with-boost=DIR], 127 | [prefix of Boost $1 @<:@guess@:>@])])dnl 128 | AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl 129 | # If BOOST_ROOT is set and the user has not provided a value to 130 | # --with-boost, then treat BOOST_ROOT as if it the user supplied it. 131 | if test x"$BOOST_ROOT" != x; then 132 | if test x"$with_boost" = x; then 133 | AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT]) 134 | with_boost=$BOOST_ROOT 135 | else 136 | AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost]) 137 | fi 138 | fi 139 | AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], 140 | ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])dnl 141 | boost_save_CPPFLAGS=$CPPFLAGS 142 | AC_CACHE_CHECK([for Boost headers version >= $boost_version_req_string], 143 | [boost_cv_inc_path], 144 | [boost_cv_inc_path=no 145 | AC_LANG_PUSH([C++])dnl 146 | m4_pattern_allow([^BOOST_VERSION$])dnl 147 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include 148 | #if !defined BOOST_VERSION 149 | # error BOOST_VERSION is not defined 150 | #elif BOOST_VERSION < $boost_version_req 151 | # error Boost headers version < $boost_version_req 152 | #endif 153 | ]])]) 154 | # If the user provided a value to --with-boost, use it and only it. 155 | case $with_boost in #( 156 | ''|yes) set x '' /opt/local/include /usr/local/include /opt/include \ 157 | /usr/include C:/Boost/include;; #( 158 | *) set x "$with_boost/include" "$with_boost";; 159 | esac 160 | shift 161 | for boost_dir 162 | do 163 | # Without --layout=system, Boost (or at least some versions) installs 164 | # itself in /include/boost-. This inner loop helps to 165 | # find headers in such directories. 166 | # 167 | # Any ${boost_dir}/boost-x_xx directories are searched in reverse version 168 | # order followed by ${boost_dir}. The final '.' is a sentinel for 169 | # searching $boost_dir" itself. Entries are whitespace separated. 170 | # 171 | # I didn't indent this loop on purpose (to avoid over-indented code) 172 | boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \ 173 | && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \ 174 | && echo .` 175 | for boost_inc in $boost_layout_system_search_list 176 | do 177 | if test x"$boost_inc" != x.; then 178 | boost_inc="$boost_dir/$boost_inc" 179 | else 180 | boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list 181 | fi 182 | if test x"$boost_inc" != x; then 183 | # We are going to check whether the version of Boost installed 184 | # in $boost_inc is usable by running a compilation that 185 | # #includes it. But if we pass a -I/some/path in which Boost 186 | # is not installed, the compiler will just skip this -I and 187 | # use other locations (either from CPPFLAGS, or from its list 188 | # of system include directories). As a result we would use 189 | # header installed on the machine instead of the /some/path 190 | # specified by the user. So in that precise case (trying 191 | # $boost_inc), make sure the version.hpp exists. 192 | # 193 | # Use test -e as there can be symlinks. 194 | test -e "$boost_inc/boost/version.hpp" || continue 195 | CPPFLAGS="$CPPFLAGS -I$boost_inc" 196 | fi 197 | AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no]) 198 | if test x"$boost_cv_inc_path" = xyes; then 199 | if test x"$boost_inc" != x; then 200 | boost_cv_inc_path=$boost_inc 201 | fi 202 | break 2 203 | fi 204 | done 205 | done 206 | AC_LANG_POP([C++])dnl 207 | ]) 208 | case $boost_cv_inc_path in #( 209 | no) 210 | boost_errmsg="cannot find Boost headers version >= $boost_version_req_string" 211 | m4_if([$2], [], [AC_MSG_ERROR([$boost_errmsg])], 212 | [AC_MSG_NOTICE([$boost_errmsg])]) 213 | $2 214 | ;;#( 215 | yes) 216 | BOOST_CPPFLAGS= 217 | ;;#( 218 | *) 219 | AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"])dnl 220 | ;; 221 | esac 222 | if test x"$boost_cv_inc_path" != xno; then 223 | AC_DEFINE([HAVE_BOOST], [1], 224 | [Defined if the requested minimum BOOST version is satisfied]) 225 | AC_CACHE_CHECK([for Boost's header version], 226 | [boost_cv_lib_version], 227 | [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl 228 | _BOOST_SED_CPP([[/^boost-lib-version = /{s///;s/[\" ]//g;p;q;}]], 229 | [#include 230 | boost-lib-version = BOOST_LIB_VERSION], 231 | [boost_cv_lib_version=`cat conftest.i`])]) 232 | # e.g. "134" for 1_34_1 or "135" for 1_35 233 | boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'` 234 | case $boost_major_version in #( 235 | '' | *[[!0-9]]*) 236 | AC_MSG_ERROR([invalid value: boost_major_version='$boost_major_version']) 237 | ;; 238 | esac 239 | fi 240 | CPPFLAGS=$boost_save_CPPFLAGS 241 | ])# BOOST_REQUIRE 242 | 243 | 244 | # BOOST_STATIC() 245 | # -------------- 246 | # Add the "--enable-static-boost" configure argument. If this argument is given 247 | # on the command line, static versions of the libraries will be looked up. 248 | AC_DEFUN([BOOST_STATIC], 249 | [AC_ARG_ENABLE([static-boost], 250 | [AS_HELP_STRING([--enable-static-boost], 251 | [Prefer the static boost libraries over the shared ones [no]])], 252 | [enable_static_boost=yes], 253 | [enable_static_boost=no])])# BOOST_STATIC 254 | 255 | 256 | # BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND]) 257 | # -------------------------------------------------------------------------- 258 | # Wrapper around AC_CHECK_HEADER for Boost headers. Useful to check for 259 | # some parts of the Boost library which are only made of headers and don't 260 | # require linking (such as Boost.Foreach). 261 | # 262 | # Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be 263 | # found in the first place, in which case by default a notice is issued to the 264 | # user. Presumably if we haven't died already it's because it's OK to not have 265 | # Boost, which is why only a notice is issued instead of a hard error. 266 | # 267 | # Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_ in 268 | # case of success # (where HEADER-NAME is written LIKE_THIS, e.g., 269 | # HAVE_BOOST_FOREACH_HPP). 270 | AC_DEFUN([BOOST_FIND_HEADER], 271 | [AC_REQUIRE([BOOST_REQUIRE])dnl 272 | if test x"$boost_cv_inc_path" = xno; then 273 | m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])]) 274 | else 275 | AC_LANG_PUSH([C++])dnl 276 | boost_save_CPPFLAGS=$CPPFLAGS 277 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 278 | AC_CHECK_HEADER([$1], 279 | [m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1], 280 | [Define to 1 if you have <$1>])])], 281 | [m4_default([$2], [AC_MSG_ERROR([cannot find $1])])]) 282 | CPPFLAGS=$boost_save_CPPFLAGS 283 | AC_LANG_POP([C++])dnl 284 | fi 285 | ])# BOOST_FIND_HEADER 286 | 287 | 288 | # BOOST_FIND_LIBS([COMPONENT-NAME], [CANDIDATE-LIB-NAMES], 289 | # [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST], 290 | # [CXX-PROLOGUE]) 291 | # -------------------------------------------------------------- 292 | # Look for the Boost library COMPONENT-NAME (e.g., `thread', for 293 | # libboost_thread) under the possible CANDIDATE-LIB-NAMES (e.g., 294 | # "thread_win32 thread"). Check that HEADER-NAME works and check that 295 | # libboost_LIB-NAME can link with the code CXX-TEST. The optional 296 | # argument CXX-PROLOGUE can be used to include some C++ code before 297 | # the `main' function. 298 | # 299 | # Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above). 300 | # 301 | # Boost libraries typically come compiled with several flavors (with different 302 | # runtime options) so PREFERRED-RT-OPT is the preferred suffix. A suffix is one 303 | # or more of the following letters: sgdpn (in that order). s = static 304 | # runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build, 305 | # n = (unsure) STLPort build without iostreams from STLPort (it looks like `n' 306 | # must always be used along with `p'). Additionally, PREFERRED-RT-OPT can 307 | # start with `mt-' to indicate that there is a preference for multi-thread 308 | # builds. Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp 309 | # ... If you want to make sure you have a specific version of Boost 310 | # (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro. 311 | AC_DEFUN([BOOST_FIND_LIBS], 312 | [AC_REQUIRE([BOOST_REQUIRE])dnl 313 | AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl 314 | AC_REQUIRE([BOOST_STATIC])dnl 315 | AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl 316 | if test x"$boost_cv_inc_path" = xno; then 317 | AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library]) 318 | else 319 | dnl The else branch is huge and wasn't intended on purpose. 320 | AC_LANG_PUSH([C++])dnl 321 | AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl 322 | AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl 323 | AS_VAR_PUSHDEF([Boost_lib_LDPATH], [boost_cv_lib_$1_LDPATH])dnl 324 | AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl 325 | BOOST_FIND_HEADER([$4]) 326 | boost_save_CPPFLAGS=$CPPFLAGS 327 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 328 | AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib], 329 | [_BOOST_FIND_LIBS($@)]) 330 | case $Boost_lib in #( 331 | (no) _AC_MSG_LOG_CONFTEST 332 | AC_MSG_ERROR([cannot find the flags to link with Boost $1]) 333 | ;; 334 | esac 335 | AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl 336 | AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl 337 | AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl 338 | AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl 339 | CPPFLAGS=$boost_save_CPPFLAGS 340 | AS_VAR_POPDEF([Boost_lib])dnl 341 | AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl 342 | AS_VAR_POPDEF([Boost_lib_LDPATH])dnl 343 | AS_VAR_POPDEF([Boost_lib_LIBS])dnl 344 | AC_LANG_POP([C++])dnl 345 | fi 346 | ]) 347 | 348 | 349 | # BOOST_FIND_LIB([LIB-NAME], 350 | # [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST], 351 | # [CXX-PROLOGUE]) 352 | # -------------------------------------------------------------- 353 | # Backward compatibility wrapper for BOOST_FIND_LIBS. 354 | AC_DEFUN([BOOST_FIND_LIB], 355 | [BOOST_FIND_LIBS([$1], $@)]) 356 | 357 | 358 | # _BOOST_FIND_LIBS([LIB-NAME], [CANDIDATE-LIB-NAMES], 359 | # [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST], 360 | # [CXX-PROLOGUE]) 361 | # -------------------------------------------------------------- 362 | # Real implementation of BOOST_FIND_LIBS: rely on these local macros: 363 | # Boost_lib, Boost_lib_LDFLAGS, Boost_lib_LDPATH, Boost_lib_LIBS 364 | # 365 | # The algorithm is as follows: first look for a given library name 366 | # according to the user's PREFERRED-RT-OPT. For each library name, we 367 | # prefer to use the ones that carry the tag (toolset name). Each 368 | # library is searched through the various standard paths were Boost is 369 | # usually installed. If we can't find the standard variants, we try 370 | # to enforce -mt (for instance on MacOSX, libboost_thread.dylib 371 | # doesn't exist but there's -obviously- libboost_thread-mt.dylib). 372 | AC_DEFUN([_BOOST_FIND_LIBS], 373 | [Boost_lib=no 374 | case "$3" in #( 375 | (mt | mt-) boost_mt=-mt; boost_rtopt=;; #( 376 | (mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$3" : 'Xmt-*\(.*\)'`;; #( 377 | (*) boost_mt=; boost_rtopt=$3;; 378 | esac 379 | if test $enable_static_boost = yes; then 380 | boost_rtopt="s$boost_rtopt" 381 | fi 382 | # Find the proper debug variant depending on what we've been asked to find. 383 | case $boost_rtopt in #( 384 | (*d*) boost_rt_d=$boost_rtopt;; #( 385 | (*[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn') 386 | boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #( 387 | (*) boost_rt_d='-d';; 388 | esac 389 | # If the PREFERRED-RT-OPT are not empty, prepend a `-'. 390 | test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt" 391 | $boost_guess_use_mt && boost_mt=-mt 392 | # Look for the abs path the static archive. 393 | # $libext is computed by Libtool but let's make sure it's non empty. 394 | test -z "$libext" && 395 | AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?]) 396 | boost_save_ac_objext=$ac_objext 397 | # Generate the test file. 398 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$4> 399 | $6], [$5])]) 400 | dnl Optimization hacks: compiling C++ is slow, especially with Boost. What 401 | dnl we're trying to do here is guess the right combination of link flags 402 | dnl (LIBS / LDFLAGS) to use a given library. This can take several 403 | dnl iterations before it succeeds and is thus *very* slow. So what we do 404 | dnl instead is that we compile the code first (and thus get an object file, 405 | dnl typically conftest.o). Then we try various combinations of link flags 406 | dnl until we succeed to link conftest.o in an executable. The problem is 407 | dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always 408 | dnl remove all the temporary files including conftest.o. So the trick here 409 | dnl is to temporarily change the value of ac_objext so that conftest.o is 410 | dnl preserved accross tests. This is obviously fragile and I will burn in 411 | dnl hell for not respecting Autoconf's documented interfaces, but in the 412 | dnl mean time, it optimizes the macro by a factor of 5 to 30. 413 | dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left 414 | dnl empty because the test file is generated only once above (before we 415 | dnl start the for loops). 416 | AC_COMPILE_IFELSE([], 417 | [ac_objext=do_not_rm_me_plz], 418 | [AC_MSG_ERROR([cannot compile a test that uses Boost $1])]) 419 | ac_objext=$boost_save_ac_objext 420 | boost_failed_libs= 421 | # Don't bother to ident the following nested for loops, only the 2 422 | # innermost ones matter. 423 | for boost_lib_ in $2; do 424 | for boost_tag_ in -$boost_cv_lib_tag ''; do 425 | for boost_ver_ in -$boost_cv_lib_version ''; do 426 | for boost_mt_ in $boost_mt -mt ''; do 427 | for boost_rtopt_ in $boost_rtopt '' -d; do 428 | for boost_lib in \ 429 | boost_$boost_lib_$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \ 430 | boost_$boost_lib_$boost_tag_$boost_rtopt_$boost_ver_ \ 431 | boost_$boost_lib_$boost_tag_$boost_mt_$boost_ver_ \ 432 | boost_$boost_lib_$boost_tag_$boost_ver_ 433 | do 434 | # Avoid testing twice the same lib 435 | case $boost_failed_libs in #( 436 | (*@$boost_lib@*) continue;; 437 | esac 438 | # If with_boost is empty, we'll search in /lib first, which is not quite 439 | # right so instead we'll try to a location based on where the headers are. 440 | boost_tmp_lib=$with_boost 441 | test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include} 442 | for boost_ldpath in "$boost_tmp_lib/lib" '' \ 443 | /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \ 444 | "$with_boost" C:/Boost/lib /lib* 445 | do 446 | # Don't waste time with directories that don't exist. 447 | if test x"$boost_ldpath" != x && test ! -e "$boost_ldpath"; then 448 | continue 449 | fi 450 | boost_save_LDFLAGS=$LDFLAGS 451 | # Are we looking for a static library? 452 | case $boost_ldpath:$boost_rtopt_ in #( 453 | (*?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt) 454 | Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext" 455 | test -e "$Boost_lib_LIBS" || continue;; #( 456 | (*) # No: use -lboost_foo to find the shared library. 457 | Boost_lib_LIBS="-l$boost_lib";; 458 | esac 459 | boost_save_LIBS=$LIBS 460 | LIBS="$Boost_lib_LIBS $LIBS" 461 | test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath" 462 | dnl First argument of AC_LINK_IFELSE left empty because the test file is 463 | dnl generated only once above (before we start the for loops). 464 | _BOOST_AC_LINK_IFELSE([], 465 | [Boost_lib=yes], [Boost_lib=no]) 466 | ac_objext=$boost_save_ac_objext 467 | LDFLAGS=$boost_save_LDFLAGS 468 | LIBS=$boost_save_LIBS 469 | if test x"$Boost_lib" = xyes; then 470 | # Check or used cached result of whether or not using -R or 471 | # -rpath makes sense. Some implementations of ld, such as for 472 | # Mac OSX, require -rpath but -R is the flag known to work on 473 | # other systems. https://github.com/tsuna/boost.m4/issues/19 474 | AC_CACHE_VAL([boost_cv_rpath_link_ldflag], 475 | [case $boost_ldpath in 476 | '') # Nothing to do. 477 | boost_cv_rpath_link_ldflag= 478 | boost_rpath_link_ldflag_found=yes;; 479 | *) 480 | for boost_cv_rpath_link_ldflag in -Wl,-R, -Wl,-rpath,; do 481 | LDFLAGS="$boost_save_LDFLAGS -L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath" 482 | LIBS="$boost_save_LIBS $Boost_lib_LIBS" 483 | _BOOST_AC_LINK_IFELSE([], 484 | [boost_rpath_link_ldflag_found=yes 485 | break], 486 | [boost_rpath_link_ldflag_found=no]) 487 | done 488 | ;; 489 | esac 490 | AS_IF([test "x$boost_rpath_link_ldflag_found" != "xyes"], 491 | [AC_MSG_ERROR([Unable to determine whether to use -R or -rpath])]) 492 | LDFLAGS=$boost_save_LDFLAGS 493 | LIBS=$boost_save_LIBS 494 | ]) 495 | test x"$boost_ldpath" != x && 496 | Boost_lib_LDFLAGS="-L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath" 497 | Boost_lib_LDPATH="$boost_ldpath" 498 | break 7 499 | else 500 | boost_failed_libs="$boost_failed_libs@$boost_lib@" 501 | fi 502 | done 503 | done 504 | done 505 | done 506 | done 507 | done 508 | done # boost_lib_ 509 | rm -f conftest.$ac_objext 510 | ]) 511 | 512 | 513 | 514 | # --------------------------------------- # 515 | # Checks for the various Boost libraries. # 516 | # --------------------------------------- # 517 | 518 | # List of boost libraries: http://www.boost.org/libs/libraries.htm 519 | # The page http://beta.boost.org/doc/libs is useful: it gives the first release 520 | # version of each library (among other things). 521 | 522 | # BOOST_DEFUN(LIBRARY, CODE) 523 | # -------------------------- 524 | # Define BOOST_ as a macro that runs CODE. 525 | # 526 | # Use indir to avoid the warning on underquoted macro name given to AC_DEFUN. 527 | m4_define([BOOST_DEFUN], 528 | [m4_indir([AC_DEFUN], 529 | m4_toupper([BOOST_$1]), 530 | [m4_pushdef([BOOST_Library], [$1])dnl 531 | $2 532 | m4_popdef([BOOST_Library])dnl 533 | ]) 534 | ]) 535 | 536 | # BOOST_ARRAY() 537 | # ------------- 538 | # Look for Boost.Array 539 | BOOST_DEFUN([Array], 540 | [BOOST_FIND_HEADER([boost/array.hpp])]) 541 | 542 | 543 | # BOOST_ASIO() 544 | # ------------ 545 | # Look for Boost.Asio (new in Boost 1.35). 546 | BOOST_DEFUN([Asio], 547 | [AC_REQUIRE([BOOST_SYSTEM])dnl 548 | BOOST_FIND_HEADER([boost/asio.hpp])]) 549 | 550 | 551 | # BOOST_BIND() 552 | # ------------ 553 | # Look for Boost.Bind. 554 | BOOST_DEFUN([Bind], 555 | [BOOST_FIND_HEADER([boost/bind.hpp])]) 556 | 557 | 558 | # BOOST_CHRONO() 559 | # -------------- 560 | # Look for Boost.Chrono. 561 | BOOST_DEFUN([Chrono], 562 | [# Do we have to check for Boost.System? This link-time dependency was 563 | # added as of 1.35.0. If we have a version <1.35, we must not attempt to 564 | # find Boost.System as it didn't exist by then. 565 | if test $boost_major_version -ge 135; then 566 | BOOST_SYSTEM([$1]) 567 | fi # end of the Boost.System check. 568 | boost_filesystem_save_LIBS=$LIBS 569 | boost_filesystem_save_LDFLAGS=$LDFLAGS 570 | m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl 571 | LIBS="$LIBS $BOOST_SYSTEM_LIBS" 572 | LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" 573 | BOOST_FIND_LIB([chrono], [$1], 574 | [boost/chrono.hpp], 575 | [boost::chrono::thread_clock d;]) 576 | if test $enable_static_boost = yes && test $boost_major_version -ge 135; then 577 | BOOST_CHRONO_LIBS="$BOOST_CHRONO_LIBS $BOOST_SYSTEM_LIBS" 578 | fi 579 | LIBS=$boost_filesystem_save_LIBS 580 | LDFLAGS=$boost_filesystem_save_LDFLAGS 581 | ])# BOOST_CHRONO 582 | 583 | 584 | # BOOST_CONTEXT([PREFERRED-RT-OPT]) 585 | # ----------------------------------- 586 | # Look for Boost.Context. For the documentation of PREFERRED-RT-OPT, see the 587 | # documentation of BOOST_FIND_LIB above. 588 | # 589 | # * This library was introduced in Boost 1.51.0 590 | # * The signatures of make_fcontext() and jump_fcontext were changed in 1.56.0 591 | # * A dependency on boost_thread appears in 1.57.0 592 | BOOST_DEFUN([Context], 593 | [boost_context_save_LIBS=$LIBS 594 | boost_context_save_LDFLAGS=$LDFLAGS 595 | if test $boost_major_version -ge 157; then 596 | BOOST_THREAD([$1]) 597 | m4_pattern_allow([^BOOST_THREAD_(LIBS|LDFLAGS)$])dnl 598 | LIBS="$LIBS $BOOST_THREAD_LIBS" 599 | LDFLAGS="$LDFLAGS $BOOST_THREAD_LDFLAGS" 600 | fi 601 | BOOST_FIND_LIB([context], [$1], 602 | [boost/context/all.hpp],[[ 603 | 604 | // creates a stack 605 | void * stack_pointer = new void*[4096]; 606 | std::size_t const size = sizeof(void*[4096]); 607 | 608 | #if BOOST_VERSION <= 105100 609 | ctx::make_fcontext(&fc, f); 610 | return ctx::jump_fcontext(&fcm, &fc, 3) == 6; 611 | 612 | #else 613 | 614 | fc = ctx::make_fcontext(stack_pointer, size, f); 615 | return ctx::jump_fcontext(&fcm, fc, 3) == 6; 616 | 617 | #endif 618 | 619 | 620 | ]],[dnl 621 | 622 | #include 623 | #if BOOST_VERSION <= 105100 624 | 625 | namespace ctx = boost::ctx; 626 | 627 | static ctx::fcontext_t fcm, fc; 628 | 629 | static void f(intptr_t i) { 630 | ctx::jump_fcontext(&fc, &fcm, i * 2); 631 | } 632 | 633 | #elif BOOST_VERSION <= 105500 634 | 635 | namespace ctx = boost::context; 636 | 637 | // context 638 | static ctx::fcontext_t fcm, *fc; 639 | 640 | // context-function 641 | static void f(intptr_t i) { 642 | ctx::jump_fcontext(fc, &fcm, i * 2); 643 | } 644 | 645 | #else 646 | 647 | namespace ctx = boost::context; 648 | 649 | // context 650 | static ctx::fcontext_t fcm, fc; 651 | 652 | // context-function 653 | static void f(intptr_t i) { 654 | ctx::jump_fcontext(&fc, fcm, i * 2); 655 | } 656 | #endif 657 | ]) 658 | LIBS=$boost_context_save_LIBS 659 | LDFLAGS=$boost_context_save_LDFLAGS 660 | ])# BOOST_CONTEXT 661 | 662 | 663 | # BOOST_CONVERSION() 664 | # ------------------ 665 | # Look for Boost.Conversion (cast / lexical_cast) 666 | BOOST_DEFUN([Conversion], 667 | [BOOST_FIND_HEADER([boost/cast.hpp]) 668 | BOOST_FIND_HEADER([boost/lexical_cast.hpp]) 669 | ])# BOOST_CONVERSION 670 | 671 | 672 | # BOOST_COROUTINE([PREFERRED-RT-OPT]) 673 | # ----------------------------------- 674 | # Look for Boost.Coroutine. For the documentation of PREFERRED-RT-OPT, see the 675 | # documentation of BOOST_FIND_LIB above. This library was introduced in Boost 676 | # 1.53.0 677 | BOOST_DEFUN([Coroutine], 678 | [ 679 | boost_coroutine_save_LIBS=$LIBS 680 | boost_coroutine_save_LDFLAGS=$LDFLAGS 681 | # Link-time dependency from coroutine to context 682 | BOOST_CONTEXT([$1]) 683 | # Starting from Boost 1.55 a dependency on Boost.System is added 684 | if test $boost_major_version -ge 155; then 685 | BOOST_SYSTEM([$1]) 686 | fi 687 | m4_pattern_allow([^BOOST_(CONTEXT|SYSTEM)_(LIBS|LDFLAGS)]) 688 | LIBS="$LIBS $BOOST_CONTEXT_LIBS $BOOST_SYSTEM_LIBS" 689 | LDFLAGS="$LDFLAGS $BOOST_CONTEXT_LDFLAGS" 690 | 691 | # in 1.53 coroutine was a header only library 692 | if test $boost_major_version -eq 153; then 693 | BOOST_FIND_HEADER([boost/coroutine/coroutine.hpp]) 694 | else 695 | BOOST_FIND_LIB([coroutine], [$1], 696 | [boost/coroutine/coroutine.hpp], 697 | [ 698 | #include 699 | #if BOOST_VERSION <= 105500 700 | boost::coroutines::coroutine coro; coro.get(); 701 | #else 702 | boost::coroutines::asymmetric_coroutine::pull_type coro; coro.get(); 703 | #endif 704 | ]) 705 | fi 706 | # Link-time dependency from coroutine to context, existed only in 1.53, in 1.54 707 | # coroutine doesn't use context from its headers but from its library. 708 | if test $boost_major_version -eq 153 || test $enable_static_boost = yes && test $boost_major_version -ge 154; then 709 | BOOST_COROUTINE_LIBS="$BOOST_COROUTINE_LIBS $BOOST_CONTEXT_LIBS" 710 | BOOST_COROUTINE_LDFLAGS="$BOOST_COROUTINE_LDFLAGS $BOOST_CONTEXT_LDFLAGS" 711 | fi 712 | if test $enable_static_boost = yes && test $boost_major_version -ge 155; then 713 | BOOST_COROUTINE_LIBS="$BOOST_COROUTINE_LIBS $BOOST_SYSTEM_LIBS" 714 | BOOST_COROUTINE_LDFLAGS="$BOOST_COROUTINE_LDFLAGS $BOOST_SYSTEM_LDFLAGS" 715 | fi 716 | LIBS=$boost_coroutine_save_LIBS 717 | LDFLAGS=$boost_coroutine_save_LDFLAGS 718 | ])# BOOST_COROUTINE 719 | 720 | 721 | # BOOST_CRC() 722 | # ----------- 723 | # Look for Boost.CRC 724 | BOOST_DEFUN([CRC], 725 | [BOOST_FIND_HEADER([boost/crc.hpp]) 726 | ])# BOOST_CRC 727 | 728 | 729 | # BOOST_DATE_TIME([PREFERRED-RT-OPT]) 730 | # ----------------------------------- 731 | # Look for Boost.Date_Time. For the documentation of PREFERRED-RT-OPT, see the 732 | # documentation of BOOST_FIND_LIB above. 733 | BOOST_DEFUN([Date_Time], 734 | [BOOST_FIND_LIB([date_time], [$1], 735 | [boost/date_time/posix_time/posix_time.hpp], 736 | [boost::posix_time::ptime t;]) 737 | ])# BOOST_DATE_TIME 738 | 739 | 740 | # BOOST_FILESYSTEM([PREFERRED-RT-OPT]) 741 | # ------------------------------------ 742 | # Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see 743 | # the documentation of BOOST_FIND_LIB above. 744 | # Do not check for boost/filesystem.hpp because this file was introduced in 745 | # 1.34. 746 | BOOST_DEFUN([Filesystem], 747 | [# Do we have to check for Boost.System? This link-time dependency was 748 | # added as of 1.35.0. If we have a version <1.35, we must not attempt to 749 | # find Boost.System as it didn't exist by then. 750 | if test $boost_major_version -ge 135; then 751 | BOOST_SYSTEM([$1]) 752 | fi # end of the Boost.System check. 753 | boost_filesystem_save_LIBS=$LIBS 754 | boost_filesystem_save_LDFLAGS=$LDFLAGS 755 | m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl 756 | LIBS="$LIBS $BOOST_SYSTEM_LIBS" 757 | LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" 758 | BOOST_FIND_LIB([filesystem], [$1], 759 | [boost/filesystem/path.hpp], [boost::filesystem::path p;]) 760 | if test $enable_static_boost = yes && test $boost_major_version -ge 135; then 761 | BOOST_FILESYSTEM_LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS" 762 | fi 763 | LIBS=$boost_filesystem_save_LIBS 764 | LDFLAGS=$boost_filesystem_save_LDFLAGS 765 | ])# BOOST_FILESYSTEM 766 | 767 | 768 | # BOOST_FLYWEIGHT() 769 | # ----------------- 770 | # Look for Boost.Flyweight. 771 | BOOST_DEFUN([Flyweight], 772 | [dnl There's a hidden dependency on pthreads. 773 | AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl 774 | BOOST_FIND_HEADER([boost/flyweight.hpp]) 775 | AC_SUBST([BOOST_FLYWEIGHT_LIBS], [$boost_cv_pthread_flag]) 776 | ]) 777 | 778 | 779 | # BOOST_FOREACH() 780 | # --------------- 781 | # Look for Boost.Foreach. 782 | BOOST_DEFUN([Foreach], 783 | [BOOST_FIND_HEADER([boost/foreach.hpp])]) 784 | 785 | 786 | # BOOST_FORMAT() 787 | # -------------- 788 | # Look for Boost.Format. 789 | # Note: we can't check for boost/format/format_fwd.hpp because the header isn't 790 | # standalone. It can't be compiled because it triggers the following error: 791 | # boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std' 792 | # does not name a type 793 | BOOST_DEFUN([Format], 794 | [BOOST_FIND_HEADER([boost/format.hpp])]) 795 | 796 | 797 | # BOOST_FUNCTION() 798 | # ---------------- 799 | # Look for Boost.Function 800 | BOOST_DEFUN([Function], 801 | [BOOST_FIND_HEADER([boost/function.hpp])]) 802 | 803 | 804 | # BOOST_GEOMETRY() 805 | # ---------------- 806 | # Look for Boost.Geometry (new since 1.47.0). 807 | BOOST_DEFUN([Geometry], 808 | [BOOST_FIND_HEADER([boost/geometry.hpp]) 809 | ])# BOOST_GEOMETRY 810 | 811 | 812 | # BOOST_GRAPH([PREFERRED-RT-OPT]) 813 | # ------------------------------- 814 | # Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the 815 | # documentation of BOOST_FIND_LIB above. 816 | BOOST_DEFUN([Graph], 817 | [boost_graph_save_LIBS=$LIBS 818 | boost_graph_save_LDFLAGS=$LDFLAGS 819 | # Link-time dependency from graph to regex was added as of 1.40.0. 820 | if test $boost_major_version -ge 140; then 821 | BOOST_REGEX([$1]) 822 | m4_pattern_allow([^BOOST_REGEX_(LIBS|LDFLAGS)$])dnl 823 | LIBS="$LIBS $BOOST_REGEX_LIBS" 824 | LDFLAGS="$LDFLAGS $BOOST_REGEX_LDFLAGS" 825 | fi 826 | BOOST_FIND_LIB([graph], [$1], 827 | [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;]) 828 | LIBS=$boost_graph_save_LIBS 829 | LDFLAGS=$boost_graph_save_LDFLAGS 830 | ])# BOOST_GRAPH 831 | 832 | 833 | # BOOST_IOSTREAMS([PREFERRED-RT-OPT]) 834 | # ----------------------------------- 835 | # Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the 836 | # documentation of BOOST_FIND_LIB above. 837 | BOOST_DEFUN([IOStreams], 838 | [BOOST_FIND_LIB([iostreams], [$1], 839 | [boost/iostreams/device/file_descriptor.hpp], 840 | [boost::iostreams::file_descriptor fd; fd.close();]) 841 | ])# BOOST_IOSTREAMS 842 | 843 | 844 | # BOOST_HASH() 845 | # ------------ 846 | # Look for Boost.Functional/Hash 847 | BOOST_DEFUN([Hash], 848 | [BOOST_FIND_HEADER([boost/functional/hash.hpp])]) 849 | 850 | 851 | # BOOST_LAMBDA() 852 | # -------------- 853 | # Look for Boost.Lambda 854 | BOOST_DEFUN([Lambda], 855 | [BOOST_FIND_HEADER([boost/lambda/lambda.hpp])]) 856 | 857 | 858 | # BOOST_LOCALE() 859 | # -------------- 860 | # Look for Boost.Locale 861 | BOOST_DEFUN([Locale], 862 | [ 863 | boost_locale_save_LIBS=$LIBS 864 | boost_locale_save_LDFLAGS=$LDFLAGS 865 | # require SYSTEM for boost-1.50.0 and up 866 | if test $boost_major_version -ge 150; then 867 | BOOST_SYSTEM([$1]) 868 | m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl 869 | LIBS="$LIBS $BOOST_SYSTEM_LIBS" 870 | LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" 871 | fi # end of the Boost.System check. 872 | BOOST_FIND_LIB([locale], [$1], 873 | [boost/locale.hpp], 874 | [[boost::locale::generator gen; std::locale::global(gen(""));]]) 875 | LIBS=$boost_locale_save_LIBS 876 | LDFLAGS=$boost_locale_save_LDFLAGS 877 | ])# BOOST_LOCALE 878 | 879 | # BOOST_LOG([PREFERRED-RT-OPT]) 880 | # ----------------------------- 881 | # Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the 882 | # documentation of BOOST_FIND_LIB above. 883 | BOOST_DEFUN([Log], 884 | [boost_log_save_LIBS=$LIBS 885 | boost_log_save_LDFLAGS=$LDFLAGS 886 | BOOST_SYSTEM([$1]) 887 | BOOST_FILESYSTEM([$1]) 888 | BOOST_DATE_TIME([$1]) 889 | m4_pattern_allow([^BOOST_(SYSTEM|FILESYSTEM|DATE_TIME)_(LIBS|LDFLAGS)$])dnl 890 | LIBS="$LIBS $BOOST_DATE_TIME_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS" 891 | LDFLAGS="$LDFLAGS $BOOST_DATE_TIME_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS $BOOST_SYSTEM_LDFLAGS" 892 | BOOST_FIND_LIB([log], [$1], 893 | [boost/log/core/core.hpp], 894 | [boost::log::attribute a; a.get_value();]) 895 | LIBS=$boost_log_save_LIBS 896 | LDFLAGS=$boost_log_save_LDFLAGS 897 | ])# BOOST_LOG 898 | 899 | 900 | # BOOST_LOG_SETUP([PREFERRED-RT-OPT]) 901 | # ----------------------------------- 902 | # Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the 903 | # documentation of BOOST_FIND_LIB above. 904 | BOOST_DEFUN([Log_Setup], 905 | [boost_log_setup_save_LIBS=$LIBS 906 | boost_log_setup_save_LDFLAGS=$LDFLAGS 907 | BOOST_LOG([$1]) 908 | m4_pattern_allow([^BOOST_LOG_(LIBS|LDFLAGS)$])dnl 909 | LIBS="$LIBS $BOOST_LOG_LIBS" 910 | LDFLAGS="$LDFLAGS $BOOST_LOG_LDFLAGS" 911 | BOOST_FIND_LIB([log_setup], [$1], 912 | [boost/log/utility/setup/from_settings.hpp], 913 | [boost::log::basic_settings bs; bs.empty();]) 914 | LIBS=$boost_log_setup_save_LIBS 915 | LDFLAGS=$boost_log_setup_save_LDFLAGS 916 | ])# BOOST_LOG_SETUP 917 | 918 | 919 | # BOOST_MATH() 920 | # ------------ 921 | # Look for Boost.Math 922 | # TODO: This library isn't header-only but it comes in multiple different 923 | # flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99, 924 | # libboost_math_c99f, libboost_math_c99l, libboost_math_tr1, 925 | # libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the 926 | # right thing anyway. 927 | BOOST_DEFUN([Math], 928 | [BOOST_FIND_HEADER([boost/math/special_functions.hpp])]) 929 | 930 | 931 | # BOOST_MPI([PREFERRED-RT-OPT]) 932 | # ------------------------------- 933 | # Look for Boost MPI. For the documentation of PREFERRED-RT-OPT, see the 934 | # documentation of BOOST_FIND_LIB above. Uses MPICXX variable if it is 935 | # set, otherwise tries CXX 936 | # 937 | BOOST_DEFUN([MPI], 938 | [boost_save_CXX=${CXX} 939 | boost_save_CXXCPP=${CXXCPP} 940 | if test x"${MPICXX}" != x; then 941 | CXX=${MPICXX} 942 | CXXCPP="${MPICXX} -E" 943 | fi 944 | BOOST_FIND_LIB([mpi], [$1], 945 | [boost/mpi.hpp], 946 | [int argc = 0; 947 | char **argv = 0; 948 | boost::mpi::environment env(argc,argv);]) 949 | CXX=${boost_save_CXX} 950 | CXXCPP=${boost_save_CXXCPP} 951 | ])# BOOST_MPI 952 | 953 | 954 | # BOOST_MULTIARRAY() 955 | # ------------------ 956 | # Look for Boost.MultiArray 957 | BOOST_DEFUN([MultiArray], 958 | [BOOST_FIND_HEADER([boost/multi_array.hpp])]) 959 | 960 | 961 | # BOOST_NUMERIC_UBLAS() 962 | # -------------------------- 963 | # Look for Boost.NumericUblas (Basic Linear Algebra) 964 | BOOST_DEFUN([Numeric_Ublas], 965 | [BOOST_FIND_HEADER([boost/numeric/ublas/vector.hpp]) 966 | ])# BOOST_NUMERIC_UBLAS 967 | 968 | 969 | # BOOST_NUMERIC_CONVERSION() 970 | # -------------------------- 971 | # Look for Boost.NumericConversion (policy-based numeric conversion) 972 | BOOST_DEFUN([Numeric_Conversion], 973 | [BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp]) 974 | ])# BOOST_NUMERIC_CONVERSION 975 | 976 | 977 | # BOOST_OPTIONAL() 978 | # ---------------- 979 | # Look for Boost.Optional 980 | BOOST_DEFUN([Optional], 981 | [BOOST_FIND_HEADER([boost/optional.hpp])]) 982 | 983 | 984 | # BOOST_PREPROCESSOR() 985 | # -------------------- 986 | # Look for Boost.Preprocessor 987 | BOOST_DEFUN([Preprocessor], 988 | [BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])]) 989 | 990 | 991 | # BOOST_RANGE() 992 | # -------------------- 993 | # Look for Boost.Range 994 | BOOST_DEFUN([Range], 995 | [BOOST_FIND_HEADER([boost/range/adaptors.hpp])]) 996 | 997 | # BOOST_UNORDERED() 998 | # ----------------- 999 | # Look for Boost.Unordered 1000 | BOOST_DEFUN([Unordered], 1001 | [BOOST_FIND_HEADER([boost/unordered_map.hpp])]) 1002 | 1003 | 1004 | # BOOST_UUID() 1005 | # ------------ 1006 | # Look for Boost.Uuid 1007 | BOOST_DEFUN([Uuid], 1008 | [BOOST_FIND_HEADER([boost/uuid/uuid.hpp])]) 1009 | 1010 | 1011 | # BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT]) 1012 | # ----------------------------------------- 1013 | # Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT, 1014 | # see the documentation of BOOST_FIND_LIB above. 1015 | BOOST_DEFUN([Program_Options], 1016 | [BOOST_FIND_LIB([program_options], [$1], 1017 | [boost/program_options.hpp], 1018 | [boost::program_options::options_description d("test");]) 1019 | ])# BOOST_PROGRAM_OPTIONS 1020 | 1021 | 1022 | 1023 | # _BOOST_PYTHON_CONFIG(VARIABLE, FLAG) 1024 | # ------------------------------------ 1025 | # Save VARIABLE, and define it via `python-config --FLAG`. 1026 | # Substitute BOOST_PYTHON_VARIABLE. 1027 | m4_define([_BOOST_PYTHON_CONFIG], 1028 | [AC_SUBST([BOOST_PYTHON_$1], 1029 | [`python-config --$2 2>/dev/null`])dnl 1030 | boost_python_save_$1=$$1 1031 | $1="$$1 $BOOST_PYTHON_$1"]) 1032 | 1033 | 1034 | # BOOST_PYTHON([PREFERRED-RT-OPT]) 1035 | # -------------------------------- 1036 | # Look for Boost.Python. For the documentation of PREFERRED-RT-OPT, 1037 | # see the documentation of BOOST_FIND_LIB above. 1038 | BOOST_DEFUN([Python], 1039 | [_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes]) 1040 | _BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags]) 1041 | _BOOST_PYTHON_CONFIG([LIBS], [libs]) 1042 | m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl 1043 | BOOST_FIND_LIBS([python], [python python3], [$1], 1044 | [boost/python.hpp], 1045 | [], [BOOST_PYTHON_MODULE(empty) {}]) 1046 | CPPFLAGS=$boost_python_save_CPPFLAGS 1047 | LDFLAGS=$boost_python_save_LDFLAGS 1048 | LIBS=$boost_python_save_LIBS 1049 | ])# BOOST_PYTHON 1050 | 1051 | 1052 | # BOOST_REF() 1053 | # ----------- 1054 | # Look for Boost.Ref 1055 | BOOST_DEFUN([Ref], 1056 | [BOOST_FIND_HEADER([boost/ref.hpp])]) 1057 | 1058 | 1059 | # BOOST_REGEX([PREFERRED-RT-OPT]) 1060 | # ------------------------------- 1061 | # Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the 1062 | # documentation of BOOST_FIND_LIB above. 1063 | BOOST_DEFUN([Regex], 1064 | [BOOST_FIND_LIB([regex], [$1], 1065 | [boost/regex.hpp], 1066 | [boost::regex exp("*"); boost::regex_match("foo", exp);]) 1067 | ])# BOOST_REGEX 1068 | 1069 | 1070 | # BOOST_SERIALIZATION([PREFERRED-RT-OPT]) 1071 | # --------------------------------------- 1072 | # Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see 1073 | # the documentation of BOOST_FIND_LIB above. 1074 | BOOST_DEFUN([Serialization], 1075 | [BOOST_FIND_LIB([serialization], [$1], 1076 | [boost/archive/text_oarchive.hpp], 1077 | [std::ostream* o = 0; // Cheap way to get an ostream... 1078 | boost::archive::text_oarchive t(*o);]) 1079 | ])# BOOST_SERIALIZATION 1080 | 1081 | 1082 | # BOOST_SIGNALS([PREFERRED-RT-OPT]) 1083 | # --------------------------------- 1084 | # Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the 1085 | # documentation of BOOST_FIND_LIB above. 1086 | BOOST_DEFUN([Signals], 1087 | [BOOST_FIND_LIB([signals], [$1], 1088 | [boost/signal.hpp], 1089 | [boost::signal s;]) 1090 | ])# BOOST_SIGNALS 1091 | 1092 | 1093 | # BOOST_SIGNALS2() 1094 | # ---------------- 1095 | # Look for Boost.Signals2 (new since 1.39.0). 1096 | BOOST_DEFUN([Signals2], 1097 | [BOOST_FIND_HEADER([boost/signals2.hpp]) 1098 | ])# BOOST_SIGNALS2 1099 | 1100 | 1101 | # BOOST_SMART_PTR() 1102 | # ----------------- 1103 | # Look for Boost.SmartPtr 1104 | BOOST_DEFUN([Smart_Ptr], 1105 | [BOOST_FIND_HEADER([boost/scoped_ptr.hpp]) 1106 | BOOST_FIND_HEADER([boost/shared_ptr.hpp]) 1107 | ]) 1108 | 1109 | 1110 | # BOOST_STATICASSERT() 1111 | # -------------------- 1112 | # Look for Boost.StaticAssert 1113 | BOOST_DEFUN([StaticAssert], 1114 | [BOOST_FIND_HEADER([boost/static_assert.hpp])]) 1115 | 1116 | 1117 | # BOOST_STRING_ALGO() 1118 | # ------------------- 1119 | # Look for Boost.StringAlgo 1120 | BOOST_DEFUN([String_Algo], 1121 | [BOOST_FIND_HEADER([boost/algorithm/string.hpp]) 1122 | ]) 1123 | 1124 | 1125 | # BOOST_SYSTEM([PREFERRED-RT-OPT]) 1126 | # -------------------------------- 1127 | # Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the 1128 | # documentation of BOOST_FIND_LIB above. This library was introduced in Boost 1129 | # 1.35.0. 1130 | BOOST_DEFUN([System], 1131 | [BOOST_FIND_LIB([system], [$1], 1132 | [boost/system/error_code.hpp], 1133 | [boost::system::error_code e; e.clear();]) 1134 | ])# BOOST_SYSTEM 1135 | 1136 | 1137 | # BOOST_TEST([PREFERRED-RT-OPT]) 1138 | # ------------------------------ 1139 | # Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the 1140 | # documentation of BOOST_FIND_LIB above. 1141 | BOOST_DEFUN([Test], 1142 | [m4_pattern_allow([^BOOST_CHECK$])dnl 1143 | BOOST_FIND_LIB([unit_test_framework], [$1], 1144 | [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);], 1145 | [using boost::unit_test::test_suite; 1146 | test_suite* init_unit_test_suite(int argc, char ** argv) 1147 | { return NULL; }]) 1148 | ])# BOOST_TEST 1149 | 1150 | 1151 | # BOOST_THREAD([PREFERRED-RT-OPT]) 1152 | # --------------------------------- 1153 | # Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the 1154 | # documentation of BOOST_FIND_LIB above. 1155 | BOOST_DEFUN([Thread], 1156 | [dnl Having the pthread flag is required at least on GCC3 where 1157 | dnl boost/thread.hpp would complain if we try to compile without 1158 | dnl -pthread on GNU/Linux. 1159 | AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl 1160 | boost_thread_save_LIBS=$LIBS 1161 | boost_thread_save_LDFLAGS=$LDFLAGS 1162 | boost_thread_save_CPPFLAGS=$CPPFLAGS 1163 | # Link-time dependency from thread to system was added as of 1.49.0. 1164 | if test $boost_major_version -ge 149; then 1165 | BOOST_SYSTEM([$1]) 1166 | fi # end of the Boost.System check. 1167 | m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl 1168 | LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag" 1169 | LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" 1170 | CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag" 1171 | 1172 | # When compiling for the Windows platform, the threads library is named 1173 | # differently. This suffix doesn't exist in new versions of Boost, or 1174 | # possibly new versions of GCC on mingw I am assuming it's Boost's change for 1175 | # now and I am setting version to 1.48, for lack of knowledge as to when this 1176 | # change occurred. 1177 | if test $boost_major_version -lt 148; then 1178 | case $host_os in 1179 | (*mingw*) boost_thread_lib_ext=_win32;; 1180 | esac 1181 | fi 1182 | BOOST_FIND_LIBS([thread], [thread$boost_thread_lib_ext], 1183 | [$1], 1184 | [boost/thread.hpp], [boost::thread t; boost::mutex m;]) 1185 | 1186 | case $host_os in 1187 | (*mingw*) boost_thread_w32_socket_link=-lws2_32;; 1188 | esac 1189 | 1190 | BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag $boost_thread_w32_socket_link" 1191 | BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS" 1192 | BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag" 1193 | LIBS=$boost_thread_save_LIBS 1194 | LDFLAGS=$boost_thread_save_LDFLAGS 1195 | CPPFLAGS=$boost_thread_save_CPPFLAGS 1196 | ])# BOOST_THREAD 1197 | 1198 | AU_ALIAS([BOOST_THREADS], [BOOST_THREAD]) 1199 | 1200 | 1201 | # BOOST_TOKENIZER() 1202 | # ----------------- 1203 | # Look for Boost.Tokenizer 1204 | BOOST_DEFUN([Tokenizer], 1205 | [BOOST_FIND_HEADER([boost/tokenizer.hpp])]) 1206 | 1207 | 1208 | # BOOST_TRIBOOL() 1209 | # --------------- 1210 | # Look for Boost.Tribool 1211 | BOOST_DEFUN([Tribool], 1212 | [BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp]) 1213 | BOOST_FIND_HEADER([boost/logic/tribool.hpp]) 1214 | ]) 1215 | 1216 | 1217 | # BOOST_TUPLE() 1218 | # ------------- 1219 | # Look for Boost.Tuple 1220 | BOOST_DEFUN([Tuple], 1221 | [BOOST_FIND_HEADER([boost/tuple/tuple.hpp])]) 1222 | 1223 | 1224 | # BOOST_TYPETRAITS() 1225 | # -------------------- 1226 | # Look for Boost.TypeTraits 1227 | BOOST_DEFUN([TypeTraits], 1228 | [BOOST_FIND_HEADER([boost/type_traits.hpp])]) 1229 | 1230 | 1231 | # BOOST_UTILITY() 1232 | # --------------- 1233 | # Look for Boost.Utility (noncopyable, result_of, base-from-member idiom, 1234 | # etc.) 1235 | BOOST_DEFUN([Utility], 1236 | [BOOST_FIND_HEADER([boost/utility.hpp])]) 1237 | 1238 | 1239 | # BOOST_VARIANT() 1240 | # --------------- 1241 | # Look for Boost.Variant. 1242 | BOOST_DEFUN([Variant], 1243 | [BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp]) 1244 | BOOST_FIND_HEADER([boost/variant.hpp])]) 1245 | 1246 | 1247 | # BOOST_POINTER_CONTAINER() 1248 | # ------------------------ 1249 | # Look for Boost.PointerContainer 1250 | BOOST_DEFUN([Pointer_Container], 1251 | [BOOST_FIND_HEADER([boost/ptr_container/ptr_deque.hpp]) 1252 | BOOST_FIND_HEADER([boost/ptr_container/ptr_list.hpp]) 1253 | BOOST_FIND_HEADER([boost/ptr_container/ptr_vector.hpp]) 1254 | BOOST_FIND_HEADER([boost/ptr_container/ptr_array.hpp]) 1255 | BOOST_FIND_HEADER([boost/ptr_container/ptr_set.hpp]) 1256 | BOOST_FIND_HEADER([boost/ptr_container/ptr_map.hpp]) 1257 | ])# BOOST_POINTER_CONTAINER 1258 | 1259 | 1260 | # BOOST_WAVE([PREFERRED-RT-OPT]) 1261 | # ------------------------------ 1262 | # NOTE: If you intend to use Wave/Spirit with thread support, make sure you 1263 | # call BOOST_THREAD first. 1264 | # Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the 1265 | # documentation of BOOST_FIND_LIB above. 1266 | BOOST_DEFUN([Wave], 1267 | [AC_REQUIRE([BOOST_FILESYSTEM])dnl 1268 | AC_REQUIRE([BOOST_DATE_TIME])dnl 1269 | boost_wave_save_LIBS=$LIBS 1270 | boost_wave_save_LDFLAGS=$LDFLAGS 1271 | m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl 1272 | LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS \ 1273 | $BOOST_THREAD_LIBS" 1274 | LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS \ 1275 | $BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS" 1276 | BOOST_FIND_LIB([wave], [$1], 1277 | [boost/wave.hpp], 1278 | [boost::wave::token_id id; get_token_name(id);]) 1279 | LIBS=$boost_wave_save_LIBS 1280 | LDFLAGS=$boost_wave_save_LDFLAGS 1281 | ])# BOOST_WAVE 1282 | 1283 | 1284 | # BOOST_XPRESSIVE() 1285 | # ----------------- 1286 | # Look for Boost.Xpressive (new since 1.36.0). 1287 | BOOST_DEFUN([Xpressive], 1288 | [BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])]) 1289 | 1290 | 1291 | # ----------------- # 1292 | # Internal helpers. # 1293 | # ----------------- # 1294 | 1295 | 1296 | # _BOOST_PTHREAD_FLAG() 1297 | # --------------------- 1298 | # Internal helper for BOOST_THREAD. Computes boost_cv_pthread_flag 1299 | # which must be used in CPPFLAGS and LIBS. 1300 | # 1301 | # Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3, 1302 | # boost/thread.hpp will trigger a #error if -pthread isn't used: 1303 | # boost/config/requires_threads.hpp:47:5: #error "Compiler threading support 1304 | # is not turned on. Please set the correct command line options for 1305 | # threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" 1306 | # 1307 | # Based on ACX_PTHREAD: http://autoconf-archive.cryp.to/acx_pthread.html 1308 | AC_DEFUN([_BOOST_PTHREAD_FLAG], 1309 | [AC_REQUIRE([AC_PROG_CXX])dnl 1310 | AC_REQUIRE([AC_CANONICAL_HOST])dnl 1311 | AC_LANG_PUSH([C++])dnl 1312 | AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag], 1313 | [ boost_cv_pthread_flag= 1314 | # The ordering *is* (sometimes) important. Some notes on the 1315 | # individual items follow: 1316 | # (none): in case threads are in libc; should be tried before -Kthread and 1317 | # other compiler flags to prevent continual compiler warnings 1318 | # -lpthreads: AIX (must check this before -lpthread) 1319 | # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) 1320 | # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) 1321 | # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread) 1322 | # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads) 1323 | # -pthreads: Solaris/GCC 1324 | # -mthreads: MinGW32/GCC, Lynx/GCC 1325 | # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it 1326 | # doesn't hurt to check since this sometimes defines pthreads too; 1327 | # also defines -D_REENTRANT) 1328 | # ... -mt is also the pthreads flag for HP/aCC 1329 | # -lpthread: GNU Linux, etc. 1330 | # --thread-safe: KAI C++ 1331 | case $host_os in #( 1332 | *solaris*) 1333 | # On Solaris (at least, for some versions), libc contains stubbed 1334 | # (non-functional) versions of the pthreads routines, so link-based 1335 | # tests will erroneously succeed. (We need to link with -pthreads/-mt/ 1336 | # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather 1337 | # a function called by this macro, so we could check for that, but 1338 | # who knows whether they'll stub that too in a future libc.) So, 1339 | # we'll just look for -pthreads and -lpthread first: 1340 | boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #( 1341 | *) 1342 | boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \ 1343 | -pthreads -mthreads -lpthread --thread-safe -mt";; 1344 | esac 1345 | # Generate the test file. 1346 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include ], 1347 | [pthread_t th; pthread_join(th, 0); 1348 | pthread_attr_init(0); pthread_cleanup_push(0, 0); 1349 | pthread_create(0,0,0,0); pthread_cleanup_pop(0);])]) 1350 | for boost_pthread_flag in '' $boost_pthread_flags; do 1351 | boost_pthread_ok=false 1352 | dnl Re-use the test file already generated. 1353 | boost_pthreads__save_LIBS=$LIBS 1354 | LIBS="$LIBS $boost_pthread_flag" 1355 | AC_LINK_IFELSE([], 1356 | [if grep ".*$boost_pthread_flag" conftest.err; then 1357 | echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD 1358 | else 1359 | boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag 1360 | fi]) 1361 | LIBS=$boost_pthreads__save_LIBS 1362 | $boost_pthread_ok && break 1363 | done 1364 | ]) 1365 | AC_LANG_POP([C++])dnl 1366 | ])# _BOOST_PTHREAD_FLAG 1367 | 1368 | 1369 | # _BOOST_gcc_test(MAJOR, MINOR) 1370 | # ----------------------------- 1371 | # Internal helper for _BOOST_FIND_COMPILER_TAG. 1372 | m4_define([_BOOST_gcc_test], 1373 | ["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl 1374 | 1375 | # _BOOST_mingw_test(MAJOR, MINOR) 1376 | # ----------------------------- 1377 | # Internal helper for _BOOST_FIND_COMPILER_TAG. 1378 | m4_define([_BOOST_mingw_test], 1379 | ["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC && \ 1380 | (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \ 1381 | || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw$1$2"])dnl 1382 | 1383 | 1384 | # _BOOST_FIND_COMPILER_TAG() 1385 | # -------------------------- 1386 | # Internal. When Boost is installed without --layout=system, each library 1387 | # filename will hold a suffix that encodes the compiler used during the 1388 | # build. The Boost build system seems to call this a `tag'. 1389 | AC_DEFUN([_BOOST_FIND_COMPILER_TAG], 1390 | [AC_REQUIRE([AC_PROG_CXX])dnl 1391 | AC_REQUIRE([AC_CANONICAL_HOST])dnl 1392 | AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], 1393 | [boost_cv_lib_tag], 1394 | [boost_cv_lib_tag=unknown 1395 | if test x$boost_cv_inc_path != xno; then 1396 | AC_LANG_PUSH([C++])dnl 1397 | # The following tests are mostly inspired by boost/config/auto_link.hpp 1398 | # The list is sorted to most recent/common to oldest compiler (in order 1399 | # to increase the likelihood of finding the right compiler with the 1400 | # least number of compilation attempt). 1401 | # Beware that some tests are sensible to the order (for instance, we must 1402 | # look for MinGW before looking for GCC3). 1403 | # I used one compilation test per compiler with a #error to recognize 1404 | # each compiler so that it works even when cross-compiling (let me know 1405 | # if you know a better approach). 1406 | # Known missing tags (known from Boost's tools/build/v2/tools/common.jam): 1407 | # como, edg, kcc, bck, mp, sw, tru, xlc 1408 | # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines 1409 | # the same defines as GCC's). 1410 | for i in \ 1411 | _BOOST_mingw_test(5, 3) \ 1412 | _BOOST_gcc_test(5, 3) \ 1413 | _BOOST_mingw_test(5, 2) \ 1414 | _BOOST_gcc_test(5, 2) \ 1415 | _BOOST_mingw_test(5, 1) \ 1416 | _BOOST_gcc_test(5, 1) \ 1417 | _BOOST_mingw_test(5, 0) \ 1418 | _BOOST_gcc_test(5, 0) \ 1419 | _BOOST_mingw_test(4, 10) \ 1420 | _BOOST_gcc_test(4, 10) \ 1421 | _BOOST_mingw_test(4, 9) \ 1422 | _BOOST_gcc_test(4, 9) \ 1423 | _BOOST_mingw_test(4, 8) \ 1424 | _BOOST_gcc_test(4, 8) \ 1425 | _BOOST_mingw_test(4, 7) \ 1426 | _BOOST_gcc_test(4, 7) \ 1427 | _BOOST_mingw_test(4, 6) \ 1428 | _BOOST_gcc_test(4, 6) \ 1429 | _BOOST_mingw_test(4, 5) \ 1430 | _BOOST_gcc_test(4, 5) \ 1431 | _BOOST_mingw_test(4, 4) \ 1432 | _BOOST_gcc_test(4, 4) \ 1433 | _BOOST_mingw_test(4, 3) \ 1434 | _BOOST_gcc_test(4, 3) \ 1435 | _BOOST_mingw_test(4, 2) \ 1436 | _BOOST_gcc_test(4, 2) \ 1437 | _BOOST_mingw_test(4, 1) \ 1438 | _BOOST_gcc_test(4, 1) \ 1439 | _BOOST_mingw_test(4, 0) \ 1440 | _BOOST_gcc_test(4, 0) \ 1441 | "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \ 1442 | && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \ 1443 | || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \ 1444 | _BOOST_gcc_test(3, 4) \ 1445 | _BOOST_gcc_test(3, 3) \ 1446 | "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \ 1447 | "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \ 1448 | _BOOST_gcc_test(3, 2) \ 1449 | "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \ 1450 | _BOOST_gcc_test(3, 1) \ 1451 | _BOOST_gcc_test(3, 0) \ 1452 | "defined __BORLANDC__ @ bcb" \ 1453 | "defined __ICC && (defined __unix || defined __unix__) @ il" \ 1454 | "defined __ICL @ iw" \ 1455 | "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \ 1456 | _BOOST_gcc_test(2, 95) \ 1457 | "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \ 1458 | "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \ 1459 | "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \ 1460 | "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8" 1461 | do 1462 | boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '` 1463 | boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'` 1464 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1465 | #if $boost_tag_test 1466 | /* OK */ 1467 | #else 1468 | # error $boost_tag_test 1469 | #endif 1470 | ]])], [boost_cv_lib_tag=$boost_tag; break], []) 1471 | done 1472 | AC_LANG_POP([C++])dnl 1473 | case $boost_cv_lib_tag in #( 1474 | # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed 1475 | # to "gcc41" for instance. 1476 | *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there. 1477 | gcc*) 1478 | boost_tag_x= 1479 | case $host_os in #( 1480 | darwin*) 1481 | if test $boost_major_version -ge 136; then 1482 | # The `x' added in r46793 of Boost. 1483 | boost_tag_x=x 1484 | fi;; 1485 | esac 1486 | # We can specify multiple tags in this variable because it's used by 1487 | # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ... 1488 | boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc" 1489 | ;; #( 1490 | unknown) 1491 | AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]]) 1492 | boost_cv_lib_tag= 1493 | ;; 1494 | esac 1495 | fi])dnl end of AC_CACHE_CHECK 1496 | ])# _BOOST_FIND_COMPILER_TAG 1497 | 1498 | 1499 | # _BOOST_GUESS_WHETHER_TO_USE_MT() 1500 | # -------------------------------- 1501 | # Compile a small test to try to guess whether we should favor MT (Multi 1502 | # Thread) flavors of Boost. Sets boost_guess_use_mt accordingly. 1503 | AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT], 1504 | [# Check whether we do better use `mt' even though we weren't ask to. 1505 | AC_LANG_PUSH([C++])dnl 1506 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1507 | #if defined _REENTRANT || defined _MT || defined __MT__ 1508 | /* use -mt */ 1509 | #else 1510 | # error MT not needed 1511 | #endif 1512 | ]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false]) 1513 | AC_LANG_POP([C++])dnl 1514 | ]) 1515 | 1516 | # _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) 1517 | # ------------------------------------------------------------------- 1518 | # Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile, 1519 | # will break when Autoconf changes its internals. Requires that you manually 1520 | # rm -f conftest.$ac_objext in between to really different tests, otherwise 1521 | # you will try to link a conftest.o left behind by a previous test. 1522 | # Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this 1523 | # macro). 1524 | # 1525 | # Don't use "break" in the actions, as it would short-circuit some code 1526 | # this macro runs after the actions. 1527 | m4_define([_BOOST_AC_LINK_IFELSE], 1528 | [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl 1529 | rm -f conftest$ac_exeext 1530 | boost_save_ac_ext=$ac_ext 1531 | boost_use_source=: 1532 | # If we already have a .o, re-use it. We change $ac_ext so that $ac_link 1533 | # tries to link the existing object file instead of compiling from source. 1534 | test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false && 1535 | _AS_ECHO_LOG([re-using the existing conftest.$ac_objext]) 1536 | AS_IF([_AC_DO_STDERR($ac_link) && { 1537 | test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || 1538 | test ! -s conftest.err 1539 | } && test -s conftest$ac_exeext && { 1540 | test "$cross_compiling" = yes || 1541 | $as_executable_p conftest$ac_exeext 1542 | dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough. 1543 | }], 1544 | [$2], 1545 | [if $boost_use_source; then 1546 | _AC_MSG_LOG_CONFTEST 1547 | fi 1548 | $3]) 1549 | ac_objext=$boost_save_ac_objext 1550 | ac_ext=$boost_save_ac_ext 1551 | dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization) 1552 | dnl information created by the PGI compiler (conftest_ipa8_conftest.oo), 1553 | dnl as it would interfere with the next link command. 1554 | rm -f core conftest.err conftest_ipa8_conftest.oo \ 1555 | conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl 1556 | ])# _BOOST_AC_LINK_IFELSE 1557 | 1558 | # Local Variables: 1559 | # mode: autoconf 1560 | # End: 1561 | --------------------------------------------------------------------------------