2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011, 2012 Free Software Foundation, Inc.
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 dnl Boost modules are:
19 dnl date-time, filesystem. graph. iostreams, program options, system, chrono
20 dnl regex, serialization, signals, unit test, thead, and wave.
22 AC_DEFUN([GNASH_PATH_BOOST],
24 dnl start variables with a known value
29 missing_plugin_libs=""
30 missing_cygnal_libs=""
34 dnl this is a list of *required* headers. If any of these are missing, this
35 dnl test will return a failure, and Gnash won't build.
36 boost_headers="multi_index_container.hpp multi_index/key_extractors.hpp program_options/options_description.hpp iostreams/stream.hpp"
37 dnl this is a list of *required* libraries. If any of these are missing, this
38 dnl test will return a failure, and Gnash won't build.
39 boost_libs="program_options"
40 boost_plugin_libs="iostreams"
42 dnl this is a list of *recommended* libraries. If any of these are missing,
43 dnl this test will return a warning, and Gnash will build, but testing
45 boost_cygnal_libs="serialization date_time"
47 dnl this is the default list for paths to search. This gets
48 dnl redefined if --with-boost-incl= is specified.
51 dnl Look for the header
52 AC_ARG_WITH(boost_incl, AC_HELP_STRING([--with-boost-incl], [directory where boost headers are]), with_boost_incl=${withval})
53 if test x"${with_boost_incl}" != x ; then
54 gnash_boost_topdir="`(cd ${with_boost_incl}; pwd)`"
55 newlist=${gnash_boost_topdir}
58 dnl munge the GCC version number, which Boost uses to label it's libraries.
59 if test x"${GXX}" = xyes; then
60 gcc_version="`${CXX} --version | head -1 | cut -d ' ' -f 3 | cut -d '.' -f 1-2 | tr -d '.'`"
63 AC_MSG_CHECKING([for boost header])
65 gnash_boost_topdir=/usr/include/boost
66 dirs="`ls -dr $i/boost* 2>/dev/null | xargs`"
68 if test -n "$u" -a -d "$u" -a x"$u" != x"/usr/include/boost"; then
69 gnash_boost_topdir="`(cd $u; pwd)`"
70 gnash_boost_subdir="`dirname ${gnash_boost_topdir}`"
71 dnl Fix for packaging systems not adding extra fluff to the path-name.
72 for k in ${boost_headers}; do
73 if test ! -f ${gnash_boost_topdir}/boost/$k; then
74 if test ! -f ${gnash_boost_subdir}/boost/$k; then
75 missing_headers="${missing_headers} $k"
77 gnash_boost_topdir=${gnash_boost_subdir}
81 if test x"${missing_headers}" = x ; then
82 ac_cv_path_boost_incl="-I${gnash_boost_topdir}"
83 AC_MSG_RESULT(${ac_cv_path_boost_incl})
86 AC_MSG_RESULT([headers missing])
87 AC_MSG_WARN([You need to install ${missing_headers}])
93 dnl this is the default list for paths to search. This gets
94 dnl redefined if --with-boost-lib= is specified.
97 dnl Look for the library
98 AC_ARG_WITH(boost_lib, AC_HELP_STRING([--with-boost-lib], [directory where boost libraries are]), with_boost_lib=${withval})
99 if test x"${with_boost_lib}" != x ; then
100 gnash_boost_libdir="`(cd ${with_boost_lib}; pwd)`"
101 newlist="${gnash_boost_libdir}"
104 dnl Specify the list of probable names. Boost creates 8 identical
105 dnl libraries with different names. The prefered order is to always
106 dnl use the one with -mt on it, because it's the thread safe
107 dnl version. Then look for the version with -gcc in it, as it's the
108 dnl version compiled with GCC instead of the native
109 dnl compiler. Finally look for the library without any qualitfying
111 if test x${ac_cv_path_boost_lib} = x; then
112 AC_MSG_CHECKING([for Boost libraries])
113 for i in $newlist; do
114 if test x"${ac_cv_path_boost_lib}" != x; then
119 for j in ${boost_libs}; do
120 dirs="`ls -dr $i/libboost_${j}*.${shlibext} $i/libboost_${j}*.a 2>/dev/null`"
121 if test -n "${dirs}"; then
122 libname="`echo ${dirs} | sed -e 's:^.*/lib::' -e "s:\.${shlibext}::" -e "s:\.a::"`"
123 if test x$dirname = x; then
124 dirname="`echo ${dirs} | sed -e 's:/libboost.*$::'`"
125 if test x"${dirname}" != "x/usr/lib"; then
126 ac_cv_path_boost_lib="-L${dirname}"
129 ac_cv_path_boost_lib="${ac_cv_path_boost_lib} -l${libname}"
131 missing_libs="${missing_libs} $j"
135 for j in ${boost_plugin_libs}; do
136 dirs="`ls -dr ${dirname}/libboost_${j}*.${shlibext} ${dirname}/libboost_${j}*.a 2>/dev/null`"
137 if test -n "${dirs}"; then
138 libname="`echo ${dirs} | sed -e 's:^.*/lib::' -e "s:\.${shlibext}::" -e "s:\.a::"`"
139 ac_cv_path_boost_plugin_lib="${ac_cv_path_boost_plugin_lib} -l${libname}"
141 missing_plugin_libs="${missing_plugin_libs} $j"
144 for j in ${boost_cygnal_libs}; do
145 dirs="`ls -dr ${dirname}/libboost_${j}*.${shlibext} ${dirname}/libboost_${j}*.a 2>/dev/null`"
146 if test -n "${dirs}"; then
147 libname="`echo ${dirs} | sed -e 's:^.*/lib::' -e "s:\.${shlibext}::" -e "s:\.a::"`"
148 ac_cv_path_boost_cygnal_lib="${ac_cv_path_boost_cygnal_lib} -l${libname}"
150 missing_cygnal_libs="${missing_cygnal_libs} $j"
155 if test x"${missing_libs}" != x -o x"${missing_plugin_libs}" != x -o x"${missing_cygnal_libs}" != x; then
156 AC_MSG_WARN([Libraries ${missing_libs} ${missing_plugin_libs} ${missing_cygnal_libs} aren't installed ])
158 AC_MSG_RESULT(${ac_cv_path_boost_lib})
160 if test x"${ac_cv_path_boost_incl}" != x; then
161 BOOST_CFLAGS="$ac_cv_path_boost_incl"
164 if test x"${ac_cv_path_boost_lib}" != x; then
165 BOOST_LIBS="$ac_cv_path_boost_lib"
168 if test x"${ac_cv_path_boost_plugin_lib}" != x; then
169 BOOST_PLUGIN_LIBS="$ac_cv_path_boost_plugin_lib"
172 if test x"${ac_cv_path_boost_cygnal_lib}" != x; then
173 BOOST_CYGNAL_LIBS="$ac_cv_path_boost_cygnal_lib"
176 dnl ------------------------------------------------------------------
177 dnl Set HAVE_BOOST conditional, BOOST_CFLAGS and BOOST_LIBS variables
178 dnl ------------------------------------------------------------------
180 AC_SUBST(BOOST_CFLAGS)
182 AC_SUBST(BOOST_PLUGIN_LIBS)
183 AC_SUBST(BOOST_CYGNAL_LIBS)
185 dnl This isn't right: you don't need boot date-time installed unless u build
186 dnl cygnal, and it is sometimes a separate package from Boost core and thread.
187 dnl TODO: why is this needed, lack of boost being a fatal error?
188 AM_CONDITIONAL(HAVE_BOOST, [test -n "${BOOST_LIBS}"])
194 # indent-tabs-mode: nil