From 29936b9a2901a0e0231dc0cb77dd43d80b911c87 Mon Sep 17 00:00:00 2001 From: andrewjpage Date: Wed, 9 Dec 2015 15:42:40 +0000 Subject: [PATCH 1/2] Allow space for EOF --- tests/helper_methods.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/helper_methods.c b/tests/helper_methods.c index 914dc844..258d7310 100644 --- a/tests/helper_methods.c +++ b/tests/helper_methods.c @@ -23,14 +23,14 @@ int compare_files(char expected_output_filename[],char actual_output_filename[] fseek(expected_output_fh, 0L, SEEK_END); numbytes = ftell(expected_output_fh); fseek(expected_output_fh, 0L, SEEK_SET); - expected_buffer = (char*)calloc(numbytes, sizeof(char)); + expected_buffer = (char*)calloc(numbytes +1, sizeof(char)); fread(expected_buffer, sizeof(char), numbytes, expected_output_fh); fclose(expected_output_fh); fseek(actual_output_fh, 0L, SEEK_END); numbytes = ftell(actual_output_fh); fseek(actual_output_fh, 0L, SEEK_SET); - actual_buffer = (char*)calloc(numbytes, sizeof(char)); + actual_buffer = (char*)calloc(numbytes +1, sizeof(char)); fread(actual_buffer, sizeof(char), numbytes, actual_output_fh); fclose(actual_output_fh); @@ -137,4 +137,4 @@ int cp(const char *to, const char *from) errno = saved_errno; return -1; -} \ No newline at end of file +} From 336f824da8fffc34f8041c3b5e59d2c42e506785 Mon Sep 17 00:00:00 2001 From: andrewjpage Date: Wed, 9 Dec 2015 15:43:56 +0000 Subject: [PATCH 2/2] linux only library --- VERSION | 2 +- configure.ac | 17 ++++++++++++++--- src/Makefile.am | 8 +++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 428b770e..1c99cf0e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.3 +1.4.4 diff --git a/configure.ac b/configure.ac index eff27a56..673f5a71 100644 --- a/configure.ac +++ b/configure.ac @@ -1,12 +1,22 @@ -AC_INIT([gubbins], m4_esyscmd([tr -d '\n' < VERSION]), [aidan@ontologyengineering.org], [$(PACKAGE_NAME)$(AC_PACKAGE_VERSION)], [https://github.com/sanger-pathogens/gubbins]) +AC_INIT([gubbins], m4_esyscmd([tr -d '\n' < VERSION]), [gubbins@sanger.ac.uk], [$(PACKAGE_NAME)$(AC_PACKAGE_VERSION)], [https://github.com/sanger-pathogens/gubbins]) -AM_INIT_AUTOMAKE([foreign tar-pax]) +AM_INIT_AUTOMAKE([foreign tar-pax subdir-objects]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_HEADERS([config.h]) # Add our own macro dir, so we can check for PTHREAD AC_CONFIG_MACRO_DIR([m4]) +AC_CANONICAL_HOST + +case $host_os in + *linux*) + HOST_OS=linux + ;; + *) ;; +esac +AM_CONDITIONAL([HOST_LINUX],[test x$HOST_OS = xlinux]) + AC_PROG_LIBTOOL AC_PROG_CC AC_PROG_CXX @@ -16,6 +26,7 @@ AX_PTHREAD # Ensure zlib is available PKG_CHECK_MODULES([zlib], [zlib]) +AC_CHECK_HEADERS([zlib.h math.h]) # Check for Python AM_PATH_PYTHON([3.0], @@ -28,4 +39,4 @@ AM_PATH_PYTHON([3.0], AC_CONFIG_FILES([Makefile src/Makefile release/Makefile python/Makefile]) AC_OUTPUT -AC_CHECK_HEADERS([zlib.h math.h]) + diff --git a/src/Makefile.am b/src/Makefile.am index 9982933c..31002369 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,3 @@ - # ship these headers in the "make dist" target EXTRA_DIST = Newickform.h alignment_file.h block_tab_file.h string_cat.h branch_sequences.h fasta_of_snp_sites.h gff_file.h gubbins.h kseq.h parse_phylip.h parse_vcf.h phylip_of_snp_sites.h seqUtil.h snp_searching.h snp_sites.h tree_statistics.h tree_scaling.h vcf.h @@ -18,7 +17,6 @@ libgubbins_la_LIBADD = -lm #libPyGubbins_la_CPPFLAGS = $(PYTHON_CPPFLAGS) #libPyGubbins_la_LIBADD = $(PYTHON_LDFLAGS) -lboost_python libgubbins.la -lz -lm - # "make check" target TESTS = $(check_PROGRAMS) check_PROGRAMS = run_all_tests @@ -32,4 +30,8 @@ run_all_tests_SOURCES = \ ../tests/helper_methods.c \ ../tests/run_all_tests.c run_all_tests_CFLAGS = -I../tests $(PTHREAD_CFLAGS) -run_all_tests_LDADD = -lcheck libgubbins.la -lz -lm $(PTHREAD_LDFLAGS) -lrt +run_all_tests_LDADD = -lcheck libgubbins.la -lz -lm $(PTHREAD_LDFLAGS) + +if HOST_LINUX +run_all_tests_LDADD += -lrt +endif