Changeset: 1cc79f6baa83 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1cc79f6baa83 Modified Files: configure.ag sql/backends/monet5/bamloader/bam_loader.c Branch: bamloader Log Message:
Made sure the bam loader actually compiles. Next step: create stripped version of bam loader that only has core functionality. diffs (81 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -2311,6 +2311,45 @@ AC_SUBST(MSEED_CFLAGS, $MSEED_CFLAGS) AC_SUBST(MSEED_LIBS, $MSEED_LIBS) AM_CONDITIONAL(HAVE_MSEED, test x"$have_mseed" != xno) +# samtools, only used by sql +have_samtools="auto" +AC_ARG_WITH(samtools, + AS_HELP_STRING([--with-samtools=DIR],[samtools (providing bam library) are installed in DIR]), + [have_samtools="$withval"], [have_samtools="auto"]) +if test "x$have_samtools" != xno; then + + case "$have_samtools" in + auto|yes) + ;; + *) + SAMTOOLS_CFLAGS="-I$have_samtools/include" + SAMTOOLS_LIBS="-L$have_samtools/lib -lbam" + ;; + esac + + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $SAMTOOLS_CFLAGS" + LDFLAGS="$LDFLAGS $SAMTOOLS_LIBS" + AC_CHECK_HEADER(bam.h, + AC_CHECK_HEADER(bgzf.h, + AC_CHECK_LIB(bam, bam_header_read, + AC_DEFINE(HAVE_SAMTOOLS, 1, [Define if you have the samtools (providing the bam library)]), + [ if test "x$have_samtoouls" != xauto; then AC_MSG_ERROR([-lbam library not found]); fi; have_samtools=no ], + [-lpthread -lz]), + [ if test "x$have_samtools" != xauto; then AC_MSG_ERROR([bgzf.h header not found]); fi; have_samtools=no ]), + [ if test "x$have_samtools" != xauto; then AC_MSG_ERROR([bam.h header not found]); fi; have_samtools=no ]) + LDFLAGS="$save_LDFLAGS" + CPPFLAGS="$save_CPPFLAGS" + if test "x$have_samtools" = "xyes" -o "x$have_samtools" = "xauto"; then + SAMTOOLS_CFLAGS= + SAMTOOLS_LIBS="-lbam" + fi +fi +AC_SUBST(SAMTOOLS_CFLAGS, $SAMTOOLS_CFLAGS) +AC_SUBST(SAMTOOLS_LIBS, $SAMTOOLS_LIBS) +AM_CONDITIONAL(HAVE_SAMTOOLS, test x"$have_samtools" != xno) + # geos, only used in geom module org_have_geos=auto have_geos=$org_have_geos diff --git a/sql/backends/monet5/bamloader/bam_loader.c b/sql/backends/monet5/bamloader/bam_loader.c --- a/sql/backends/monet5/bamloader/bam_loader.c +++ b/sql/backends/monet5/bamloader/bam_loader.c @@ -1842,10 +1842,7 @@ bam_loader_repos(Client cntxt, MalBlkPtr } else { - _threads_data d = { - .max_nr_threads = nr_threads, - .thread_available = (bit *)GDKmalloc(nr_threads * sizeof(bit)) - }; + _threads_data d; pthread_t *threads = (pthread_t *)GDKzalloc(nr_threads * sizeof(pthread_t)); _reader_thread_data *data = (_reader_thread_data *)GDKmalloc(nr_threads * sizeof(_reader_thread_data)); @@ -1855,6 +1852,7 @@ bam_loader_repos(Client cntxt, MalBlkPtr void **ret = GDKmalloc(MIN(nr_threads, nr_file_paths) * sizeof(str)); int i; + if(threads == NULL || d.thread_available == NULL || data == NULL || ret == NULL) throw(MAL, "bam_loader_repos", MAL_MALLOC_FAIL); @@ -1862,6 +1860,8 @@ bam_loader_repos(Client cntxt, MalBlkPtr if(pthread_mutex_init(¤t_file_lock, NULL) != 0 || pthread_mutex_init(&client_lock, NULL) != 0 || pthread_mutex_init(&d.threads_data_lock, NULL) != 0) throw(MAL, "bam_loader_repos", "Error on initializing mutex\n"); + d.max_nr_threads = nr_threads; + d.thread_available = (bit *)GDKmalloc(nr_threads * sizeof(bit)); for(i=0; i<nr_threads; ++i) d.thread_available[i] = TRUE; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list