Two phase test for libboost-test-dev
[metaproxy-moved-to-github.git] / configure.ac
index c74582f..fff4af9 100644 (file)
@@ -1,21 +1,22 @@
 ## -*- Autoconf -*-
 ## Process this file with autoconf to produce a configure script.
 
+# Autoconf and automake setup
 AC_PREREQ(2.57)
 AC_INIT(yp2, 0.0.1, marc@indexdata.dk)
-AM_CONFIG_HEADER(src/config.hpp)
 
+AC_CONFIG_HEADERS(src/config.hpp)
 
 AC_CONFIG_SRCDIR(configure.ac) 
 AC_CONFIG_AUX_DIR(config)
 AC_CANONICAL_SYSTEM
 ##AC_PREFIX_DEFAULT(`pwd`/install) 
 
-AM_INIT_AUTOMAKE
-
+AM_INIT_AUTOMAKE(1.8)
 
 # Checks for programs.
 AC_PROG_CXX
+AC_PROG_CXXCPP
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
@@ -26,8 +27,46 @@ AM_PROG_LIBTOOL
 AC_LANG(C++)
 
 # Checks for libraries.
-##AC_CHECK_LIB(ibrary, main)
-AC_CHECK_LIB(boost_thread, main)
+AC_CHECK_LIB(boost_thread, main, [],[
+       AC_MSG_NOTICE([boost thread library not found.])
+       AC_MSG_ERROR([Install libboost-thread-dev (or similar)])
+])
+
+AC_CHECK_LIB(boost_date_time, main, [],[
+       AC_MSG_NOTICE([boost date_time library not found.])
+       AC_MSG_ERROR([Install libboost-date-time-dev (or similar)])
+])
+
+AC_CHECK_LIB(boost_program_options, main, [],[
+       AC_MSG_NOTICE([boost program options library not found.])
+       AC_MSG_ERROR([Install libboost-program-options-dev (or similar)])
+])
+
+AC_CHECK_HEADER(boost/test/auto_unit_test.hpp,,[
+       AC_MSG_NOTICE([boost test unit header not found.])
+       AC_MSG_ERROR([Install libboost-test-dev (or similar)])
+])
+
+AC_MSG_CHECKING([whether boost_unit_test_framework works])
+OLIBS=$LIBS
+LIBS="$LIBS -lboost_unit_test_framework"
+AC_TRY_LINK([
+#define BOOST_AUTO_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp> 
+BOOST_AUTO_TEST_CASE( test )
+{
+ BOOST_CHECK(true);
+}
+],[],
+[
+       AC_MSG_RESULT([yes])
+       LIBS=$OLIBS
+],
+[
+       AC_MSG_RESULT([no])
+       AC_MSG_NOTICE([Boost unit test framework does not appear to work])
+       AC_MSG_ERROR([Consult config.log for details])
+])
 
 ## YAZPP checks
 YAZPP_INIT(threads,1.0)
@@ -69,12 +108,12 @@ fi
 
 # Checks for header files.
 ##AC_HEADER_STDC
-##AC_HEADER_STDCXX
 ##AC_HEADER_SYS_WAIT
 ##AC_HEADER_TIME 
-AC_CHECK_HEADERS(boost/thread/mutex.hpp)
-
-
+AC_CHECK_HEADERS(sys/select.h sys/socket.h iostream list vector stdexcept)
+AC_CHECK_HEADERS(boost/thread/mutex.hpp \ 
+                 boost/date_time/posix_time/posix_time.hpp \
+                 boost/test/auto_unit_test.hpp)
 
 # Checks for typedefs, structures, and compiler characteristics.
 ##AC_TYPE_SIZE_T 
@@ -88,6 +127,7 @@ AC_CONFIG_FILES([
         Doxyfile
        Makefile
        src/Makefile
+       src/Jamfile
 ])
 
 AC_OUTPUT
@@ -107,5 +147,6 @@ Configuration:
   Linked libs:                ${LIBS}
   Host System Type:           ${host}
   Install path:               ${prefix}
+  Automake:                   ${AUTOMAKE}
 
 ------------------------------------------------------------------------"