On 3/6/06, <b class="gmail_sendername"><a href="mailto:strk@refractions.net">strk@refractions.net</a></b> <<a href="mailto:strk@refractions.net">strk@refractions.net</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Does anybody have an m4 file that can be used<br>to detect availability of boost ?<br><br>I've found some online, but they don't seem to be checking<br>for the UTF library.</blockquote></div><br>Here're some of mine that I use; feel free to hack to fit:
<br><br>------------------------------->8 snip 8<-----------------------------------------<br><br>dnl<br>dnl Look for the Boost C++ class template header files<br>dnl<br><br>AC_ARG_WITH( [boost], <br> AC_HELP_STRING([--with-boost=path],[path to Boost C++ class library headers]),
<br> BOOST_PATH="$withval" )<br><br>if ! test -z "$BOOST_PATH" ; then<br> CPPFLAGS="$CPPFLAGS -I${BOOST_PATH}"<br>fi<br><br><br>AC_CHECK_HEADERS([boost/smart_ptr.hpp],,<br> AC_MSG_ERROR([No Boost C++ library -- get from
<a href="http://www.boost.org/])">http://www.boost.org/])</a>)<br><br><br>dnl<br>dnl NOw look for Boost binaries, such as the boost date/time stuff<br>dnl<br><br>AC_ARG_WITH( [boost-lib], <br> AC_HELP_STRING([--with-boost-lib=path],
<br> [path to Boost C++ class library librarys]),<br> [BOOST_LDPATH="$withval"] )<br><br>if test ! -z "$BOOST_LDPATH" ; then<br> LIBS="$LIBS -L$BOOST_LDPATH"<br>fi
<br><br>dnl find Boost library names<br>dnl AC_SEARCH_LIBS( [_init],<br>dnl [libboost_date_time, libboost_date_time-gcc],<br>dnl [],<br>dnl AC_MSG_ERROR([Unable to find Boost date library]) )<br><br>
<br>dnl AC_SEARCH_LIBS( [boost::c_regex_traits<char>::init()],<br>dnl [libboost_regex libboost_regex-gcc],<br>dnl [],<br>dnl AC_MSG_ERROR([Unable to find Boost regex library]) )<br><br><br><br>
AC_LIB_HAVE_LINKFLAGS( boost_date_time,,<br>[<br>#include <boost/date_time/gregorian/gregorian.hpp><br>#include <boost/date_time/date_parsing.hpp><br>#include <iostream><br>#include <string><br>],<br>
[boost::gregorian::date d(boost::gregorian::from_string("2001-10-9"));] )<br><br>dnl failing the previous, try the common name variant<br>if test x${HAVE_LIBBOOST_DATE_TIME} = "xno"; then<br><br>AC_LIB_HAVE_LINKFLAGS( boost_date_time-gcc,,
<br>[<br>#include <boost/date_time/gregorian/gregorian.hpp><br>#include <boost/date_time/date_parsing.hpp><br>#include <iostream><br>#include <string><br>],<br>[boost::gregorian::date d(boost::gregorian::from_string("2001-10-9"));] )
<br><br>dnl substitute back canonical name (i.e., without gcc suffix)<br>LIBBOOST_DATE_TIME=${LIBBOOST_DATE_TIME_GCC}<br>LTLIBBOOST_DATE_TIME=${LTLIBBOOST_DATE_TIME_GCC}<br>HAVE_LIBBOOST_DATE_TIME=${HAVE_LIBBOOST_DATE_TIME_GCC}
<br><br>dnl note that these will be 'no' or blank if even the "-gcc" suffix failed<br><br>fi<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_test_exec_monitor, ,<br>[<br> #include <boost/test/test_tools.hpp><br> int test_main( int, char* [] )
<br> {<br> int i = 2;<br> int j = 1;<br> BOOST_CHECK_EQUAL( i, j );<br><br> return 0;<br> }<br>],<br>[] )<br><br><br>dnl failing the previous, try the common name variant<br>if test x${HAVE_LIBBOOST_TEST_EXEC_MONITOR} = "xno"; then
<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_test_exec_monitor-gcc, ,<br>[<br> #include <boost/test/test_tools.hpp><br> int test_main( int, char* [] ) <br> {<br> int i = 2;<br> int j = 1;<br> BOOST_CHECK_EQUAL( i, j );
<br><br> return 0;<br> }<br>],<br>[] )<br><br>dnl substitute back canonical name (i.e., without gcc suffix)<br>LIBBOOST_TEST_EXEC_MONITOR=$LIBBOOST_TEST_EXEC_MONITOR_GCC<br>LTLIBBOOST_TEST_EXEC_MONITOR=$LTLIBBOOST_TEST_EXEC_MONITOR_GCC
<br>HAVE_LIBBOOST_TEST_EXEC_MONITOR=$HAVE_LIBBOOST_TEST_EXEC_MONITOR_GCC<br><br>dnl note that these will be 'no' or blank if even the "-gcc" suffix failed<br><br><br>fi<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_filesystem, ,
<br>[<br> #include <boost/filesystem/path.hpp><br>],<br>[boost::filesystem::path myPath("somedir/file.txt");] )<br><br><br>dnl failing the previous, try the common name variant<br>if test x${HAVE_LIBBOOST_FILESYSTEM} = "xno"; then
<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_filesystem-gcc, ,<br>[<br> #include <boost/filesystem/path.hpp><br>],<br>[boost::filesystem::path myPath("somedir/file.txt");] )<br><br>dnl substitute back canonical name (
i.e., without gcc suffix)<br>LIBBOOST_FILESYSTEM=${LIBBOOST_FILESYSTEM_GCC}<br>LTLIBBOOST_FILESYSTEM=${LTLIBBOOST_FILESYSTEM_GCC}<br>HAVE_LIBBOOST_FILESYSTEM=${HAVE_LIBBOOST_FILESYSTEM_GCC}<br><br>dnl note that these will be 'no' or blank if even the "-gcc" suffix failed
<br><br><br>fi<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_regex,,<br>[<br>#include <boost/regex.hpp><br>#include <string><br>],<br>[static const boost::regex e("(\\d{4}[- ]){3}\\d{4}");] )<br><br>dnl failing the previous, try the common name variant
<br>if test x${HAVE_LIBBOOST_REGEX} = "xno"; then<br><br>AC_LIB_HAVE_LINKFLAGS( boost_regex-gcc,,<br>[<br>#include <boost/regex.hpp><br>#include <string><br>],<br>[static const boost::regex e("(\\d{4}[- ]){3}\\d{4}");] )
<br><br>dnl substitute back canonical name (i.e., without gcc suffix)<br>LIBBOOST_REGEX=${LIBBOOST_REGEX_GCC}<br>LTLIBBOOST_REGEX=${LTLIBBOOST_REGEX_GCC}<br>HAVE_LIBBOOST_REGEX=${HAVE_LIBBOOST_REGEX_GCC}<br><br>dnl note that these will be 'no' or blank if even the "-gcc" suffix failed
<br><br>fi<br>------------------------------->8 snip 8<-----------------------------------------<br>
<br>Admittedly these check for other boost items, so you may want to snip out all but the unit test stuff. Note, too, that BOOST_PATH and BOOST_LDPATH are set after a successful invocation of the configure script. So I have things like this in my
<a href="http://Makefile.am">Makefile.am</a> files:<br><br><br>INCLUDES = -I.. -I$(top_srcdir)/featurelib -I$(includedir) -I$(BOOST_PATH) $(GDAL_CFLAGS)<br><br>schema_type_t_SOURCES = schema_type_t.cpp<br>schema_type_t_LDADD = ../featurelib/SchemaType.o $(LIBBOOST_TEST_EXEC_MONITOR)
<br><br><br><br>Hope this helps!<br><br>Cheers,<br><br>Mark<br>-- <br>I'm taking reality in small doses to build immunity.<br>