* Modernise Autoconf code
* Use pkg-config for finding GSL
* Use latest archvie macros to find Boost
* Compile tests only when running make check

--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,6 @@
 AC_INIT(blossoc, 1.4.0, mailund@birc.au.dk)
 AM_INIT_AUTOMAKE
-AM_CONFIG_HEADER(config.hh)
+AC_CONFIG_HEADERS([config.hh])
 
 AC_PROG_CXX
 AC_PROG_INSTALL
@@ -12,74 +12,16 @@
 fi
 AC_DEFINE_UNQUOTED(PREFIX, "$thePREFIX", [Installation prefix])
 
-AC_CHECK_LIB(m, sin, dnl FOUND, DO NOTHING
-, dnl NOT FOUND
-AC_ERROR([[
-************************************************************************
-************************************************************************
-Didn't find the math library (-lm) -- I won't even guess about what is
-wrong on this machine...
-************************************************************************
-************************************************************************
-]])
-)
-
-AX_BOOST([1.33.1],,
-AC_ERROR([[
-************************************************************************
-************************************************************************
-The Boost library was not found on this system.  We use this library
-extensively, and cannot proceed without it.  You can obtain it from
-<http://www.boost.org>.
-************************************************************************
-************************************************************************
-]])
-)
-
-
-AC_CHECK_LIB(gslcblas, cblas_dsdot, dnl FOUND, DO NOTHING
-, dnl NOT FOUND
-AC_ERROR([[
-************************************************************************
-************************************************************************
-The GNU Scientific Library (GSL) was not found.  This library is
-needed for some of the numerical calculations used for scoring the
-significance of local genealogies and can be obtained at
-<http://www.gnu.org/software/gsl/>.
-************************************************************************
-************************************************************************
-]])
-)
-
-AC_CHECK_LIB(gsl, gsl_cdf_chisq_Q, dnl FOUND, DO NOTHING
-, dnl NOT FOUND
-AC_ERROR([[
-************************************************************************
-************************************************************************
-The GNU Scientific Library (GSL) was not found.  This library is
-needed for some of the numerical calculations used for scoring the
-significance of local genealogies and can be obtained at
-<http://www.gnu.org/software/gsl/>.
-************************************************************************
-************************************************************************
-]])
-)
-
-AC_CHECK_LIB(snpfile, main, dnl main isn't there, but this avoids namespaces
-dnl FOUND
-,
-dnl NOT FOUND
-AC_ERROR([[
-************************************************************************
-************************************************************************
-The SNPFile library was not found.  This library is needed for data
-representation and can be obtained at
-<http://www.birc.au.dk/~mailund/SNPFile/>.
-************************************************************************
-************************************************************************
-]])
-)
-
+AC_SEARCH_LIBS([sin], [m], [], [
+	AC_MSG_ERROR([unable to find the sin() function])
+])
+
+PKG_CHECK_MODULES([GSL], [gsl])
+
+AX_BOOST_BASE([1.33.1])
+AX_BOOST_PROGRAM_OPTIONS
+AX_BOOST_SERIALIZATION
+AX_BOOST_SIGNALS
 
 AC_OUTPUT([
 	Makefile
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,9 +3,6 @@
 AM_CXXFLAGS += -Wall
 AM_CXXFLAGS += $(BOOST_CPPFLAGS)
 
-# for testing
-AM_CXXFLAGS += -g -O0 #-lefence
-
 # for coverage testing
 #AM_CXXFLAGS += -O3 -fexpensive-optimizations -g -fprofile-arcs -ftest-coverage
 
@@ -15,11 +12,11 @@
 # for production
 #AM_CXXFLAGS += -O3 -fexpensive-optimizations -DNDEBUG
 
-noinst_PROGRAMS = 
+check_PROGRAMS =
+noinst_PROGRAMS =
 TESTS = 
 EXTRA_DIST =
 
-TESTS += first_test.sh
 EXTRA_DIST += first_test.sh
 
 man_MANS = blossoc.1 snpfile_blossoc.1 blossoc_regions.1 blossoc_trees.1
@@ -37,20 +34,20 @@
 noinst_PROGRAMS     += snpfile_iblossoc #ditto
 noinst_PROGRAMS     += fast_snpfile_iblossoc
 
-noinst_PROGRAMS += matrix_test
-TESTS +=           matrix_test
-noinst_PROGRAMS += incompatibility_test tree_test tree_builder_test
-TESTS +=           incompatibility_test tree_test tree_builder_test
+check_PROGRAMS += matrix_test
+TESTS +=          matrix_test
+check_PROGRAMS += incompatibility_test tree_test tree_builder_test
+TESTS +=          incompatibility_test tree_test tree_builder_test
 EXTRA_DIST += testdata/CF/cf-positions.txt
 EXTRA_DIST += testdata/CF/cf-haplotypes.txt
 EXTRA_DIST += testdata/interaction/positions.txt
 EXTRA_DIST += testdata/interaction/haplotypes.txt
-noinst_PROGRAMS += score_test io_test 
-TESTS +=           score_test io_test 
-noinst_PROGRAMS += incompatible_regress_test
-TESTS +=           incompatible_regress_test
-noinst_PROGRAMS += genotype_score_test
-TESTS +=           genotype_score_test.sh
+check_PROGRAMS += score_test io_test 
+TESTS +=          score_test io_test 
+check_PROGRAMS += incompatible_regress_test
+TESTS +=          incompatible_regress_test
+check_PROGRAMS += genotype_score_test
+TESTS +=          genotype_score_test.sh
 EXTRA_DIST += genotype_score_test.sh
 EXTRA_DIST += genotype_score_test.expected
 TESTS +=           interactions_regression_test.sh
@@ -120,6 +117,7 @@
 
 
 blossoc_regions_LDADD  =
+blossoc_regions_LDADD += -lsnpfile
 blossoc_regions_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB)
 blossoc_regions_SOURCES  =
 blossoc_regions_SOURCES += incompatibility.hh incompatibility.cc
@@ -129,6 +127,7 @@
 blossoc_regions_SOURCES += regions.cc
 
 blossoc_trees_LDADD  =
+blossoc_trees_LDADD += -lsnpfile
 blossoc_trees_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB)
 blossoc_trees_SOURCES  =
 blossoc_trees_SOURCES += matrix_utils.hh matrix_utils.cc 
@@ -142,6 +141,8 @@
 
 
 blossoc_LDADD  =
+blossoc_LDADD += -lsnpfile
+blossoc_LDADD += $(GSL_LIBS)
 blossoc_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB)
 blossoc_SOURCES  =
 blossoc_SOURCES += tree.hh tree.cc
@@ -158,6 +159,8 @@
 blossoc_SOURCES += blossoc.cc
 
 snpfile_blossoc_LDADD  =
+snpfile_blossoc_LDADD += -lsnpfile
+snpfile_blossoc_LDADD += $(GSL_LIBS)
 snpfile_blossoc_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB)
 snpfile_blossoc_LDADD += $(BOOST_SERIALIZATION_LIB)
 snpfile_blossoc_LDADD += $(BOOST_SIGNALS_LIB)
@@ -176,6 +179,8 @@
 snpfile_blossoc_SOURCES += snpfile_blossoc.cc
 
 iblossoc_LDADD  =
+iblossoc_LDADD += -lsnpfile
+iblossoc_LDADD += $(GSL_LIBS)
 iblossoc_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB)
 iblossoc_SOURCES  =
 iblossoc_SOURCES += tree.hh tree.cc
@@ -191,6 +196,8 @@
 iblossoc_SOURCES += interactions.cc
 
 low_mem_iblossoc_LDADD  =
+low_mem_iblossoc_LDADD += -lsnpfile
+low_mem_iblossoc_LDADD += $(GSL_LIBS)
 low_mem_iblossoc_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB)
 low_mem_iblossoc_SOURCES  =
 low_mem_iblossoc_SOURCES += tree.hh tree.cc
@@ -206,6 +213,8 @@
 low_mem_iblossoc_SOURCES += low_mem_interactions.cc
 
 snpfile_iblossoc_LDADD  =
+snpfile_iblossoc_LDADD += -lsnpfile
+snpfile_iblossoc_LDADD += $(GSL_LIBS)
 snpfile_iblossoc_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB)
 snpfile_iblossoc_LDADD += $(BOOST_SERIALIZATION_LIB)
 snpfile_iblossoc_LDADD += $(BOOST_SIGNALS_LIB)
@@ -223,6 +232,8 @@
 snpfile_iblossoc_SOURCES += snpfile_interactions.cc
 
 fast_snpfile_iblossoc_LDADD  =
+fast_snpfile_iblossoc_LDADD += -lsnpfile
+fast_snpfile_iblossoc_LDADD += $(GSL_LIBS)
 fast_snpfile_iblossoc_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB)
 fast_snpfile_iblossoc_LDADD += $(BOOST_SERIALIZATION_LIB)
 fast_snpfile_iblossoc_LDADD += $(BOOST_SIGNALS_LIB)
@@ -239,6 +250,28 @@
 fast_snpfile_iblossoc_SOURCES += io.hh io.cc
 fast_snpfile_iblossoc_SOURCES += fast_snpfile_interactions.cc
 
+matrix_test_LDADD  =
+matrix_test_LDADD += -lsnpfile
+
+incompatibility_test_LDADD  =
+incompatibility_test_LDADD += -lsnpfile
+
+tree_builder_test_LDADD  =
+tree_builder_test_LDADD += -lsnpfile
+
+score_test_LDADD  =
+score_test_LDADD += -lsnpfile
+score_test_LDADD += $(GSL_LIBS)
+
+io_test_LDADD  =
+io_test_LDADD += -lsnpfile
+
+incompatible_regress_test_LDADD  =
+incompatible_regress_test_LDADD += -lsnpfile
+
+genotype_score_test_LDADD  =
+genotype_score_test_LDADD += -lsnpfile
+genotype_score_test_LDADD += $(GSL_LIBS)
 
 
 # include GUI in source distributions...
