On 3/6/06, <b class="gmail_sendername"><a href="mailto:strk@refractions.net">strk@refractions.net</a></b> &lt;<a href="mailto:strk@refractions.net">strk@refractions.net</a>&gt; 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>-------------------------------&gt;8 snip 8&lt;-----------------------------------------<br><br>dnl<br>dnl Look for the Boost C++ class template header files<br>dnl<br><br>AC_ARG_WITH( [boost], <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AC_HELP_STRING([--with-boost=path],[path to Boost C++ class library headers]),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BOOST_PATH=&quot;$withval&quot; )<br><br>if ! test -z &quot;$BOOST_PATH&quot; ; then<br>&nbsp; CPPFLAGS=&quot;$CPPFLAGS -I${BOOST_PATH}&quot;<br>fi<br><br><br>AC_CHECK_HEADERS([boost/smart_ptr.hpp],,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AC_HELP_STRING([--with-boost-lib=path],
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [path to Boost C++ class library librarys]),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [BOOST_LDPATH=&quot;$withval&quot;] )<br><br>if test ! -z &quot;$BOOST_LDPATH&quot; ; then<br>&nbsp; LIBS=&quot;$LIBS -L$BOOST_LDPATH&quot;<br>fi
<br><br>dnl find Boost library names<br>dnl AC_SEARCH_LIBS( [_init],<br>dnl &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [libboost_date_time, libboost_date_time-gcc],<br>dnl &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [],<br>dnl &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AC_MSG_ERROR([Unable to find Boost date library]) )<br><br>
<br>dnl AC_SEARCH_LIBS( [boost::c_regex_traits&lt;char&gt;::init()],<br>dnl &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [libboost_regex libboost_regex-gcc],<br>dnl &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [],<br>dnl &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AC_MSG_ERROR([Unable to find Boost regex library]) )<br><br><br><br>
AC_LIB_HAVE_LINKFLAGS( boost_date_time,,<br>[<br>#include &lt;boost/date_time/gregorian/gregorian.hpp&gt;<br>#include &lt;boost/date_time/date_parsing.hpp&gt;<br>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br>],<br>
[boost::gregorian::date d(boost::gregorian::from_string(&quot;2001-10-9&quot;));] )<br><br>dnl failing the previous, try the common name variant<br>if test x${HAVE_LIBBOOST_DATE_TIME} = &quot;xno&quot;; then<br><br>AC_LIB_HAVE_LINKFLAGS( boost_date_time-gcc,,
<br>[<br>#include &lt;boost/date_time/gregorian/gregorian.hpp&gt;<br>#include &lt;boost/date_time/date_parsing.hpp&gt;<br>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br>],<br>[boost::gregorian::date d(boost::gregorian::from_string(&quot;2001-10-9&quot;));] )
<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 &quot;-gcc&quot; suffix failed<br><br>fi<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_test_exec_monitor, ,<br>[<br>&nbsp; #include &lt;boost/test/test_tools.hpp&gt;<br>&nbsp; int test_main( int, char* [] ) 
<br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; int i = 2;<br>&nbsp;&nbsp;&nbsp; int j = 1;<br>&nbsp;&nbsp;&nbsp; BOOST_CHECK_EQUAL( i, j );<br><br>&nbsp;&nbsp;&nbsp; return 0;<br>&nbsp; }<br>],<br>[] )<br><br><br>dnl failing the previous, try the common name variant<br>if test x${HAVE_LIBBOOST_TEST_EXEC_MONITOR} = &quot;xno&quot;; then
<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_test_exec_monitor-gcc, ,<br>[<br>&nbsp; #include &lt;boost/test/test_tools.hpp&gt;<br>&nbsp; int test_main( int, char* [] ) <br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; int i = 2;<br>&nbsp;&nbsp;&nbsp; int j = 1;<br>&nbsp;&nbsp;&nbsp; BOOST_CHECK_EQUAL( i, j );
<br><br>&nbsp;&nbsp;&nbsp; return 0;<br>&nbsp; }<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 &quot;-gcc&quot; suffix failed<br><br><br>fi<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_filesystem, ,
<br>[<br>&nbsp; #include &lt;boost/filesystem/path.hpp&gt;<br>],<br>[boost::filesystem::path myPath(&quot;somedir/file.txt&quot;);] )<br><br><br>dnl failing the previous, try the common name variant<br>if test x${HAVE_LIBBOOST_FILESYSTEM} = &quot;xno&quot;; then
<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_filesystem-gcc, ,<br>[<br>&nbsp; #include &lt;boost/filesystem/path.hpp&gt;<br>],<br>[boost::filesystem::path myPath(&quot;somedir/file.txt&quot;);] )<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 &quot;-gcc&quot; suffix failed
<br><br><br>fi<br><br><br>AC_LIB_HAVE_LINKFLAGS( boost_regex,,<br>[<br>#include &lt;boost/regex.hpp&gt;<br>#include &lt;string&gt;<br>],<br>[static const boost::regex e(&quot;(\\d{4}[- ]){3}\\d{4}&quot;);] )<br><br>dnl failing the previous, try the common name variant
<br>if test x${HAVE_LIBBOOST_REGEX} = &quot;xno&quot;; then<br><br>AC_LIB_HAVE_LINKFLAGS( boost_regex-gcc,,<br>[<br>#include &lt;boost/regex.hpp&gt;<br>#include &lt;string&gt;<br>],<br>[static const boost::regex e(&quot;(\\d{4}[- ]){3}\\d{4}&quot;);] )
<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 &quot;-gcc&quot; suffix failed
<br><br>fi<br>-------------------------------&gt;8 snip 8&lt;-----------------------------------------<br>
<br>Admittedly these check for other boost items, so you may want to snip out all but the unit test stuff.&nbsp; Note, too, that BOOST_PATH and BOOST_LDPATH are set after a successful invocation of the configure script.&nbsp; 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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = schema_type_t.cpp<br>schema_type_t_LDADD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = ../featurelib/SchemaType.o&nbsp; $(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>