]> git.donarmstrong.com Git - samtools.git/commitdiff
* samtools-0.1.5-8 (r404)
authorHeng Li <lh3@live.co.uk>
Thu, 16 Jul 2009 22:23:52 +0000 (22:23 +0000)
committerHeng Li <lh3@live.co.uk>
Thu, 16 Jul 2009 22:23:52 +0000 (22:23 +0000)
 * compatible with PDCurses

Makefile
bam_tview.c
bamtk.c

index 7bb44694e0ab26f8266bdadddb25075159b8b365..450b3abbb83876089fbf1da30df600431a272a6e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,6 @@
 CC=                    gcc
-CXX=           g++
 CFLAGS=                -g -Wall -O2 #-m64 #-arch ppc
-CXXFLAGS=      $(CFLAGS)
-DFLAGS=                -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE #-D_NO_CURSES
+DFLAGS=                -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1
 LOBJS=         bgzf.o kstring.o bam_aux.o bam.o bam_import.o sam.o bam_index.o \
                        bam_pileup.o bam_lpileup.o bam_md.o glf.o razf.o faidx.o knetfile.o     \
                        bam_sort.o
@@ -10,9 +8,10 @@ AOBJS=                bam_tview.o bam_maqcns.o bam_plcmd.o sam_view.o \
                        bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o     \
                        bamtk.o
 PROG=          samtools
-INCLUDES=      
+INCLUDES=
 SUBDIRS=       . misc
-LIBPATH=       
+LIBPATH=
+LIBCURSES=     -lcurses # -lXCurses
 
 .SUFFIXES:.c .o
 
@@ -36,9 +35,8 @@ lib:libbam.a
 libbam.a:$(LOBJS)
                $(AR) -cru $@ $(LOBJS)
 
-### For the curses library: comment out `-lcurses' if you do not have curses installed
 samtools:lib $(AOBJS)
-               $(CC) $(CFLAGS) -o $@ $(AOBJS) $(LIBPATH) -lm -lcurses -lz -L. -lbam
+               $(CC) $(CFLAGS) -o $@ $(AOBJS) -lm $(LIBPATH) $(LIBCURSES) -lz -L. -lbam
 
 razip:razip.o razf.o
                $(CC) $(CFLAGS) -o $@ razf.o razip.o -lz
index fd7c09813428d67d042f25a397a3f92ce517c4e5..2442994d3708912daf0823c1114eb0368d6961de 100644 (file)
@@ -1,6 +1,21 @@
-#ifndef _NO_CURSES
+#undef _HAVE_CURSES
+
+#if _CURSES_LIB == 0
+#elif _CURSES_LIB == 1
 #include <curses.h>
-#ifdef NCURSES_VERSION
+#ifndef NCURSES_VERSION
+#warning "_CURSES_LIB=1 but NCURSES_VERSION not defined; tview is NOT compiled"
+#else
+#define _HAVE_CURSES
+#endif
+#elif _CURSES_LIB == 2
+#include <xcurses.h>
+#define _HAVE_CURSES
+#else
+#warning "_CURSES_LIB is not 0, 1 or 2; tview is NOT compiled"
+#endif
+
+#ifdef _HAVE_CURSES
 #include <ctype.h>
 #include <assert.h>
 #include <string.h>
@@ -348,9 +363,7 @@ void tv_loop(tview_t *tv)
                        case 'k': ++tv->row_shift; break;
                        case KEY_BACKSPACE:
                        case '\177': pos -= tv->mcol; break;
-#ifdef KEY_RESIZE
                        case KEY_RESIZE: getmaxyx(stdscr, tv->mrow, tv->mcol); break;
-#endif
                        default: continue;
                }
                if (pos < 0) pos = 0;
@@ -381,5 +394,4 @@ int bam_tview_main(int argc, char *argv[])
        fprintf(stderr, "[bam_tview_main] The ncurses library is unavailable; tview is not compiled.\n");
        return 1;
 }
-#endif
-#endif // #ifndef _NO_CURSES
+#endif // #ifdef _HAVE_CURSES
diff --git a/bamtk.c b/bamtk.c
index f77f69aa2fa80f5c07a1253ea0667c532c194adb..970927c5aa8a6c8a03b84bc4c3614b4334bf662a 100644 (file)
--- a/bamtk.c
+++ b/bamtk.c
@@ -4,7 +4,7 @@
 #include "bam.h"
 
 #ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.5-7 (r403)"
+#define PACKAGE_VERSION "0.1.5-8 (r404)"
 #endif
 
 int bam_taf2baf(int argc, char *argv[]);
@@ -77,7 +77,7 @@ static int usage()
        fprintf(stderr, "         merge       merge multiple sorted alignment files\n");
        fprintf(stderr, "         pileup      generate pileup output\n");
        fprintf(stderr, "         faidx       index/extract FASTA\n");
-#ifndef _NO_CURSES
+#if _CURSES_LIB != 0
        fprintf(stderr, "         tview       text alignment viewer\n");
 #endif
        fprintf(stderr, "         index       index alignment\n");
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
        else if (strcmp(argv[1], "flagstat") == 0) return bam_flagstat(argc-1, argv+1);
        else if (strcmp(argv[1], "tagview") == 0) return bam_tagview(argc-1, argv+1);
        else if (strcmp(argv[1], "fillmd") == 0) return bam_fillmd(argc-1, argv+1);
-#ifndef _NO_CURSES
+#if _CURSES_LIB != 0
        else if (strcmp(argv[1], "tview") == 0) return bam_tview_main(argc-1, argv+1);
 #endif
        else {