[med-svn] [gmap] 01/03: Imported Upstream version 2014-10-15

Alex Mestiashvili malex-guest at moszumanska.debian.org
Fri Oct 17 15:56:01 UTC 2014


This is an automated email from the git hooks/post-receive script.

malex-guest pushed a commit to branch master
in repository gmap.

commit 888c9bbbc2f2aea40c7a8d4f621fa4d96c313e49
Author: Alexandre Mestiashvili <alex at biotec.tu-dresden.de>
Date:   Thu Oct 16 15:16:20 2014 +0200

    Imported Upstream version 2014-10-15
---
 ChangeLog                                  |  32 +++
 Makefile.in                                |   4 +-
 VERSION                                    |   2 +-
 acinclude.m4                               |   2 +-
 config/ax_ext.m4                           |  54 ++---
 config/{builtin.m4 => builtin-popcount.m4} |  32 ++-
 configure                                  | 304 +++++++++++++++++++++--------
 configure.ac                               |  12 +-
 src/Makefile.am                            |  20 +-
 src/Makefile.in                            |  24 +--
 src/outbuffer.c                            |  23 ++-
 src/shortread.c                            |  62 ++++--
 tests/Makefile.in                          |   4 +-
 util/Makefile.in                           |   4 +-
 14 files changed, 412 insertions(+), 167 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b790bcf..e24d61d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,37 @@
+2014-10-15  twu
+
+    * VERSION, config.site.rescomp.prd, config.site.rescomp.tst, index.html:
+      Updated version number
+
+    * outbuffer.c: Added gff3 header for GMAP gff3 output to stdout.  Added HD
+      and PG headers for GMAP sam output to --split-output files.
+
 2014-10-14  twu
 
+    * Makefile.gsnaptoo.am: Changed variable name to SIMD_CFLAGS
+
+    * configure.ac: Changed variable name to SIMD_CFLAGS.  Setting -mpopcnt
+      based only on acx_mpopcnt_ok, and not on individual builtin functions.
+
+    * builtin-popcount.m4: Setting CFLAGS instead of LIBS.  Checking for builtin
+      functions regardless of whether -mpopcnt works.
+
+    * ax_ext.m4: Setting CFLAGS instead of LIBS.  Changed variable name to
+      SIMD_CFLAGS
+
+    * builtin-popcount.m4, configure.ac: Changed macro name to
+      ACX_BUILTIN_POPCOUNT
+
+    * acinclude.m4: Renamed program to builtin-popcount.m4
+
+    * builtin-popcount.m4, builtin.m4: Renamed program to builtin-popcount.m4
+
+    * popcnt.m4: Added comment
+
+    * builtin.m4: Added check from popcnt.m4
+
+    * shortread.c: Made input procedures robust to incomplete entries
+
     * indexdb.c: Fixed bug where munmap was called twice on positions_high for
       GSNAPL and GMAPL.
 
diff --git a/Makefile.in b/Makefile.in
index 3134fab..3e7cc85 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -52,7 +52,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
 	$(top_srcdir)/config/acx_mmap_fixed.m4 \
 	$(top_srcdir)/config/acx_mmap_variable.m4 \
 	$(top_srcdir)/config/acx_pthread.m4 \
-	$(top_srcdir)/config/builtin.m4 \
+	$(top_srcdir)/config/builtin-popcount.m4 \
 	$(top_srcdir)/config/struct-stat64.m4 \
 	$(top_srcdir)/config/expand.m4 $(top_srcdir)/config/perl.m4 \
 	$(top_srcdir)/config/fopen.m4 $(top_srcdir)/config/asm-bsr.m4 \
@@ -191,7 +191,7 @@ RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
-SIMD_FLAGS = @SIMD_FLAGS@
+SIMD_CFLAGS = @SIMD_CFLAGS@
 STRIP = @STRIP@
 VERSION = @VERSION@
 ZLIB_LIBS = @ZLIB_LIBS@
diff --git a/VERSION b/VERSION
index f787a1f..9594e69 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2014-10-14
\ No newline at end of file
+2014-10-15
\ No newline at end of file
diff --git a/acinclude.m4 b/acinclude.m4
index dec57af..a3fe8b2 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -8,7 +8,7 @@ m4_include([config/mmap-flags.m4])
 m4_include([config/acx_mmap_fixed.m4])
 m4_include([config/acx_mmap_variable.m4])
 m4_include([config/acx_pthread.m4])
-m4_include([config/builtin.m4])
+m4_include([config/builtin-popcount.m4])
 m4_include([config/struct-stat64.m4])
 m4_include([config/expand.m4])
 m4_include([config/perl.m4])
diff --git a/config/ax_ext.m4 b/config/ax_ext.m4
index 65c7a42..170a8c7 100644
--- a/config/ax_ext.m4
+++ b/config/ax_ext.m4
@@ -9,13 +9,13 @@
 # DESCRIPTION
 #
 #   Find supported SIMD extensions by requesting cpuid. When an SIMD
-#   extension is found, the -m"simdextensionname" is added to SIMD_FLAGS if
+#   extension is found, the -m"simdextensionname" is added to SIMD_CFLAGS if
 #   compiler supports it. For example, if "sse2" is available, then "-msse2"
-#   is added to SIMD_FLAGS.
+#   is added to SIMD_CFLAGS.
 #
 #   This macro calls:
 #
-#     AC_SUBST(SIMD_FLAGS)
+#     AC_SUBST(SIMD_CFLAGS)
 #
 #   And defines:
 #
@@ -37,7 +37,7 @@ AC_DEFUN([AX_EXT],
 [
   AC_REQUIRE([AC_CANONICAL_HOST])
 
-  LIBS_ORIG=$LIBS
+  CFLAGS_ORIG=$CFLAGS
 
   case $host_cpu in
     powerpc*)
@@ -52,7 +52,7 @@ AC_DEFUN([AX_EXT],
 
           if test "$ax_cv_cpu_have_altivec_ext" = yes; then
             AC_DEFINE(HAVE_ALTIVEC,1,[Define to 1 if you support Altivec instructions])
-            AX_CHECK_COMPILE_FLAG(-faltivec, SIMD_FLAGS="$SIMD_FLAGS -faltivec", [])
+            AX_CHECK_COMPILE_FLAG(-faltivec, SIMD_CFLAGS="$SIMD_CFLAGS -faltivec", [])
           fi
     ;;
 
@@ -236,7 +236,7 @@ AC_DEFUN([AX_EXT],
           AC_MSG_WARN([Your CPU supports MMX instructions but not your compiler.  Can you try another compiler or update yours?])
         else
           AC_MSG_CHECKING(for mmintrin.h header file)
-          LIBS=-mmmx
+          CFLAGS=-mmmx
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <mmintrin.h>])],
                          [ax_cv_link_mmintrin_h=yes],
   		         [ax_cv_ext_linker_problem=yes])
@@ -245,7 +245,7 @@ AC_DEFUN([AX_EXT],
             AC_MSG_WARN([Your compiler supports MMX instructions but not your linker.])
           else
             AC_MSG_RESULT([yes])
-            SIMD_FLAGS="$SIMD_FLAGS -mmmx"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mmmx"
             AC_DEFINE(HAVE_MMX,1,[Define to 1 if you support MMX instructions])
           fi            
         fi
@@ -258,7 +258,7 @@ AC_DEFUN([AX_EXT],
           AC_MSG_WARN([Your CPU supports SSE instructions but not your compiler.  Can you try another compiler or update yours?])
         else
           AC_MSG_CHECKING(for xmmintrin.h header file)
-          LIBS=-msse
+          CFLAGS=-msse
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <xmmintrin.h>])],
                          [ax_cv_link_xmmintrin_h=yes],
 		         [ax_cv_ext_linker_problem=yes])
@@ -267,7 +267,7 @@ AC_DEFUN([AX_EXT],
             AC_MSG_WARN([Your compiler supports SSE instructions but not your linker.])
           else
             AC_MSG_RESULT([yes])
-            SIMD_FLAGS="$SIMD_FLAGS -msse"
+            SIMD_CFLAGS="$SIMD_CFLAGS -msse"
             AC_DEFINE(HAVE_SSE,1,[Define to 1 if you support SSE (Streaming SIMD Extensions) instructions])
           fi            
         fi
@@ -280,7 +280,7 @@ AC_DEFUN([AX_EXT],
 	  AC_MSG_WARN([Your CPU supports SSE2 instructions but not your compiler.  Can you try another compiler or update yours?])
 	else
           AC_MSG_CHECKING(for emmintrin.h header file)
-          LIBS=-msse2
+          CFLAGS=-msse2
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <emmintrin.h>])],
                          [ax_cv_link_emmintrin_h=yes],
 		         [ax_cv_ext_linker_problem=yes])
@@ -289,7 +289,7 @@ AC_DEFUN([AX_EXT],
             AC_MSG_WARN([Your compiler supports SSE2 instructions but not your linker.])
           else
             AC_MSG_RESULT([yes])
-  	    SIMD_FLAGS="$SIMD_FLAGS -msse2"
+  	    SIMD_CFLAGS="$SIMD_CFLAGS -msse2"
   	    AC_DEFINE(HAVE_SSE2,1,[Define to 1 if you support SSE2 (Streaming SIMD Extensions 2) instructions])
           fi            
 	fi
@@ -302,7 +302,7 @@ AC_DEFUN([AX_EXT],
           AC_MSG_WARN([Your CPU supports SSE3 instructions but not your compiler.  Can you try another compiler or update yours?])
         else
           AC_MSG_CHECKING(for pmmintrin.h header file)
-          LIBS=-msse3
+          CFLAGS=-msse3
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pmmintrin.h>])],
                          [ax_cv_link_pmmintrin_h=yes],
 		         [ax_cv_ext_linker_problem=yes])
@@ -311,7 +311,7 @@ AC_DEFUN([AX_EXT],
             AC_MSG_WARN([Your compiler supports SSE3 instructions but not your linker.])
           else
             AC_MSG_RESULT([yes])
-            SIMD_FLAGS="$SIMD_FLAGS -msse3"
+            SIMD_CFLAGS="$SIMD_CFLAGS -msse3"
             AC_DEFINE(HAVE_SSE3,1,[Define to 1 if you support SSE3 (Streaming SIMD Extensions 3) instructions])
           fi            
         fi
@@ -324,7 +324,7 @@ AC_DEFUN([AX_EXT],
           AC_MSG_WARN([Your CPU supports SSSE3 instructions but not your compiler.  Can you try another compiler or update yours?])
         else
           AC_MSG_CHECKING(for tmmintrin.h header file)
-          LIBS=-mssse3
+          CFLAGS=-mssse3
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <tmmintrin.h>])],
                          [ax_cv_link_tmmintrin_h=yes],
 		         [ax_cv_ext_linker_problem=yes])
@@ -333,7 +333,7 @@ AC_DEFUN([AX_EXT],
             AC_MSG_WARN([Your compiler supports SSSE3 instructions but not your linker.])
           else
             AC_MSG_RESULT([yes])
-            SIMD_FLAGS="$SIMD_FLAGS -mssse3"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mssse3"
             AC_DEFINE(HAVE_SSSE3,1,[Define to 1 if you support SSSE3 (Supplemental Streaming SIMD Extensions 3) instructions])
           fi            
         fi
@@ -346,7 +346,7 @@ AC_DEFUN([AX_EXT],
 	  AC_MSG_WARN([Your CPU supports SSE4.1 instructions but not your compiler.  Can you try another compiler or update yours?])
 	else
           AC_MSG_CHECKING(for smmintrin.h header file)
-          LIBS=-msse4.1
+          CFLAGS=-msse4.1
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <smmintrin.h>])],
                          [ax_cv_link_smmintrin_h=yes],
 		         [ax_cv_ext_linker_problem=yes])
@@ -355,7 +355,7 @@ AC_DEFUN([AX_EXT],
             AC_MSG_WARN([Your compiler supports SSE4.1 instructions but not your linker.])
           else
             AC_MSG_RESULT([yes])
-  	    SIMD_FLAGS="$SIMD_FLAGS -msse4.1"
+  	    SIMD_CFLAGS="$SIMD_CFLAGS -msse4.1"
   	    AC_DEFINE(HAVE_SSE4_1,1,[Define to 1 if you support SSE4.1 (Streaming SIMD Extensions 4.1) instructions])
           fi            
 	fi
@@ -368,7 +368,7 @@ AC_DEFUN([AX_EXT],
           AC_MSG_WARN([Your CPU supports SSE4.2 instructions but not your compiler.  Can you try another compiler or update yours?])
         else
           AC_MSG_CHECKING(for nmmintrin.h header file)
-          LIBS=-msse4.2
+          CFLAGS=-msse4.2
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <nmmintrin.h>])],
                          [ax_cv_link_nmmintrin_h=yes],
 		         [ax_cv_ext_linker_problem=yes])
@@ -377,7 +377,7 @@ AC_DEFUN([AX_EXT],
             AC_MSG_WARN([Your compiler supports SSE4.2 instructions but not your linker.])
           else
             AC_MSG_RESULT([yes])
-            SIMD_FLAGS="$SIMD_FLAGS -msse4.2"
+            SIMD_CFLAGS="$SIMD_CFLAGS -msse4.2"
             AC_DEFINE(HAVE_SSE4_2,1,[Define to 1 if you support SSE4.2 (Streaming SIMD Extensions 4.2) instructions])
 
             if test "$ax_cv_cpu_have_popcnt_ext" = yes; then
@@ -400,7 +400,7 @@ AC_DEFUN([AX_EXT],
           AC_MSG_WARN([Your CPU supports AVX instructions but not your compiler.  Can you try another compiler or update yours?])
         else
           AC_MSG_CHECKING(for immintrin.h header file)
-          LIBS=-mavx
+          CFLAGS=-mavx
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <immintrin.h>])],
                          [ax_cv_link_immintrin_h=yes],
 		         [ax_cv_ext_linker_problem=yes])
@@ -409,7 +409,7 @@ AC_DEFUN([AX_EXT],
             AC_MSG_WARN([Your compiler supports AVX instructions but not your linker.])
           else
             AC_MSG_RESULT([yes])
-            SIMD_FLAGS="$SIMD_FLAGS -mavx"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mavx"
             AC_DEFINE(HAVE_AVX,1,[Define to 1 if you support AVX (Advanced Vector Extensions) instructions])
 
             if test "$ax_cv_cpu_have_popcnt_ext" = yes; then
@@ -433,12 +433,12 @@ AC_DEFUN([AX_EXT],
             fi
 
             if test "$ax_cv_cpu_have_bmi1_ext" = yes; then
-              SIMD_FLAGS="$SIMD_FLAGS -mbmi"
+              SIMD_CFLAGS="$SIMD_CFLAGS -mbmi"
               AC_DEFINE(HAVE_BMI1,1,[Define to 1 if you support BMI1 (Bit Manipulation Instruction set 1)])
             fi
 
             if test "$ax_cv_cpu_have_bmi2_ext" = yes; then
-              SIMD_FLAGS="$SIMD_FLAGS -mbmi2"
+              SIMD_CFLAGS="$SIMD_CFLAGS -mbmi2"
               AC_DEFINE(HAVE_BMI2,1,[Define to 1 if you support BMI2 (Bit Manipulation Instruction set 2)])
             fi
 
@@ -453,7 +453,7 @@ AC_DEFUN([AX_EXT],
           AC_MSG_WARN([Your CPU supports AVX2 instructions but not your compiler.  Can you try another compiler or update yours?])
         else
           AC_MSG_CHECKING(for immintrin.h header file)
-          LIBS=-mavx2
+          CFLAGS=-mavx2
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <immintrin.h>])],
                          [ax_cv_link_immintrin_h=yes],
 		         [ax_cv_ext_linker_problem=yes])
@@ -462,7 +462,7 @@ AC_DEFUN([AX_EXT],
             AC_MSG_WARN([Your compiler supports AVX2 instructions but not your linker.])
           else
             AC_MSG_RESULT([yes])
-            SIMD_FLAGS="$SIMD_FLAGS -mavx2"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mavx2"
             AC_DEFINE(HAVE_AVX2,1,[Define to 1 if you support AVX2 (Advanced Vector Extensions 2) instructions])
 
           fi            
@@ -472,7 +472,7 @@ AC_DEFUN([AX_EXT],
   ;;
   esac
 
-  LIBS=$LIBS_ORIG
+  CFLAGS=$CFLAGS_ORIG
 
-  AC_SUBST(SIMD_FLAGS)
+  AC_SUBST(SIMD_CFLAGS)
 ])
diff --git a/config/builtin.m4 b/config/builtin-popcount.m4
similarity index 57%
rename from config/builtin.m4
rename to config/builtin-popcount.m4
index dae2650..b0e1825 100644
--- a/config/builtin.m4
+++ b/config/builtin-popcount.m4
@@ -1,17 +1,36 @@
 
-AC_DEFUN([ACX_BUILTIN], [
+AC_DEFUN([ACX_BUILTIN_POPCOUNT], [
+AC_REQUIRE([AC_CANONICAL_HOST])
 AC_LANG_SAVE
 AC_LANG(C)
 
-LIBS_ORIG=$LIBS
-LIBS=-mpopcnt
+CFLAGS_ORIG=$CFLAGS
+CFLAGS="$CFLAGS -mpopcnt"
 
+AC_MSG_CHECKING(whether -mpopcnt compiler flag works)
+AC_RUN_IFELSE(
+  [AC_LANG_PROGRAM([[#include <stdio.h>
+#include <stdlib.h>]],
+                   [[unsigned int x = rand();
+printf("%08X ",x);
+printf("clz=%d ",__builtin_clz(x));
+printf("ctz=%d ",__builtin_ctz(x));
+printf("popcount=%d ",__builtin_popcount(x));
+]])],
+  [AC_MSG_RESULT(yes)
+   acx_mpopcnt_ok=yes],
+  [AC_MSG_RESULT(no)])
+
+if test "x$acx_mpopcnt_ok" != xyes; then
+  CFLAGS=$CFLAGS_ORIG
+fi
+
+# Test for __builtin functions with or without the -mpopcnt compiler flag
 AC_MSG_CHECKING(for __builtin_popcount)
 AC_RUN_IFELSE(
   [AC_LANG_PROGRAM([[]],
                    [[return (__builtin_popcount(0xffffffffu) == 32) ? 0 : 9;]])],
   [AC_MSG_RESULT(yes)
-   ax_cv_compile_builtin_ext=yes
    AC_DEFINE([HAVE_BUILTIN_POPCOUNT],[1],[Define to 1 if __builtin_popcount works.])],
   [AC_MSG_RESULT(no)])
 
@@ -20,7 +39,6 @@ AC_RUN_IFELSE(
   [AC_LANG_PROGRAM([[]],
                    [[return (__builtin_clz(0x1u) == 31) ? 0 : 9;]])],
   [AC_MSG_RESULT(yes)
-   ax_cv_compile_builtin_ext=yes
    AC_DEFINE([HAVE_BUILTIN_CLZ],[1],[Define to 1 if __builtin_clz works.])],
   [AC_MSG_RESULT(no)])
 
@@ -29,12 +47,10 @@ AC_RUN_IFELSE(
   [AC_LANG_PROGRAM([[]],
                    [[return (__builtin_ctz(0x80000000u) == 31) ? 0 : 9;]])],
   [AC_MSG_RESULT(yes)
-   ax_cv_compile_builtin_ext=yes
    AC_DEFINE([HAVE_BUILTIN_CTZ],[1],[Define to 1 if __builtin_ctz works.])],
   [AC_MSG_RESULT(no)])
 
-
-LIBS=$LIBS_ORIG
+CFLAGS=$CFLAGS_ORIG
 
 AC_LANG_RESTORE
 ])
diff --git a/configure b/configure
index d885180..b77f154 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for gmap 2014-10-14.
+# Generated by GNU Autoconf 2.63 for gmap 2014-10-15.
 #
 # Report bugs to <Thomas Wu <twu at gene.com>>.
 #
@@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='gmap'
 PACKAGE_TARNAME='gmap'
-PACKAGE_VERSION='2014-10-14'
-PACKAGE_STRING='gmap 2014-10-14'
+PACKAGE_VERSION='2014-10-15'
+PACKAGE_STRING='gmap 2014-10-15'
 PACKAGE_BUGREPORT='Thomas Wu <twu at gene.com>'
 
 ac_unique_file="src/gmap.c"
@@ -797,7 +797,7 @@ BZLIB_LIBS
 ZLIB_LIBS
 MAX_READLENGTH
 GMAPDB
-SIMD_FLAGS
+SIMD_CFLAGS
 POPCNT_CFLAGS
 ALLOCA
 PTHREAD_CFLAGS
@@ -1508,7 +1508,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures gmap 2014-10-14 to adapt to many kinds of systems.
+\`configure' configures gmap 2014-10-15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1579,7 +1579,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of gmap 2014-10-14:";;
+     short | recursive ) echo "Configuration of gmap 2014-10-15:";;
    esac
   cat <<\_ACEOF
 
@@ -1711,7 +1711,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-gmap configure 2014-10-14
+gmap configure 2014-10-15
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1725,7 +1725,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by gmap $as_me 2014-10-14, which was
+It was created by gmap $as_me 2014-10-15, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -2095,8 +2095,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 { $as_echo "$as_me:$LINENO: checking package version" >&5
 $as_echo_n "checking package version... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: 2014-10-14" >&5
-$as_echo "2014-10-14" >&6; }
+{ $as_echo "$as_me:$LINENO: result: 2014-10-15" >&5
+$as_echo "2014-10-15" >&6; }
 
 
 ### Read defaults
@@ -4147,7 +4147,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=gmap
- VERSION=2014-10-14
+ VERSION=2014-10-15
 
 
 cat >>confdefs.h <<_ACEOF
@@ -18825,6 +18825,7 @@ case x"$answer" in
 $as_echo "enabled" >&6; }
 
 
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -18832,9 +18833,86 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-LIBS_ORIG=$LIBS
-LIBS=-mpopcnt
+CFLAGS_ORIG=$CFLAGS
+CFLAGS="$CFLAGS -mpopcnt"
+
+{ $as_echo "$as_me:$LINENO: checking whether -mpopcnt compiler flag works" >&5
+$as_echo_n "checking whether -mpopcnt compiler flag works... " >&6; }
+if test "$cross_compiling" = yes; then
+  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+unsigned int x = rand();
+printf("%08X ",x);
+printf("clz=%d ",__builtin_clz(x));
+printf("ctz=%d ",__builtin_ctz(x));
+printf("popcount=%d ",__builtin_popcount(x));
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+   acx_mpopcnt_ok=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
 
+
+if test "x$acx_mpopcnt_ok" != xyes; then
+  CFLAGS=$CFLAGS_ORIG
+fi
+
+# Test for __builtin functions with or without the -mpopcnt compiler flag
 { $as_echo "$as_me:$LINENO: checking for __builtin_popcount" >&5
 $as_echo_n "checking for __builtin_popcount... " >&6; }
 if test "$cross_compiling" = yes; then
@@ -18885,7 +18963,6 @@ $as_echo "$ac_try_echo") >&5
   (exit $ac_status); }; }; then
   { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-   ax_cv_compile_builtin_ext=yes
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BUILTIN_POPCOUNT 1
@@ -18956,7 +19033,6 @@ $as_echo "$ac_try_echo") >&5
   (exit $ac_status); }; }; then
   { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-   ax_cv_compile_builtin_ext=yes
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BUILTIN_CLZ 1
@@ -19027,7 +19103,6 @@ $as_echo "$ac_try_echo") >&5
   (exit $ac_status); }; }; then
   { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-   ax_cv_compile_builtin_ext=yes
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BUILTIN_CTZ 1
@@ -19048,8 +19123,7 @@ fi
 
 
 
-
-LIBS=$LIBS_ORIG
+CFLAGS=$CFLAGS_ORIG
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -19070,6 +19144,7 @@ $as_echo "disabled" >&6; }
 $as_echo "not specified so enabled by default" >&6; }
 
 
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -19077,9 +19152,86 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-LIBS_ORIG=$LIBS
-LIBS=-mpopcnt
+CFLAGS_ORIG=$CFLAGS
+CFLAGS="$CFLAGS -mpopcnt"
+
+{ $as_echo "$as_me:$LINENO: checking whether -mpopcnt compiler flag works" >&5
+$as_echo_n "checking whether -mpopcnt compiler flag works... " >&6; }
+if test "$cross_compiling" = yes; then
+  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+unsigned int x = rand();
+printf("%08X ",x);
+printf("clz=%d ",__builtin_clz(x));
+printf("ctz=%d ",__builtin_ctz(x));
+printf("popcount=%d ",__builtin_popcount(x));
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+   acx_mpopcnt_ok=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
 
+
+if test "x$acx_mpopcnt_ok" != xyes; then
+  CFLAGS=$CFLAGS_ORIG
+fi
+
+# Test for __builtin functions with or without the -mpopcnt compiler flag
 { $as_echo "$as_me:$LINENO: checking for __builtin_popcount" >&5
 $as_echo_n "checking for __builtin_popcount... " >&6; }
 if test "$cross_compiling" = yes; then
@@ -19130,7 +19282,6 @@ $as_echo "$ac_try_echo") >&5
   (exit $ac_status); }; }; then
   { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-   ax_cv_compile_builtin_ext=yes
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BUILTIN_POPCOUNT 1
@@ -19201,7 +19352,6 @@ $as_echo "$ac_try_echo") >&5
   (exit $ac_status); }; }; then
   { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-   ax_cv_compile_builtin_ext=yes
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BUILTIN_CLZ 1
@@ -19272,7 +19422,6 @@ $as_echo "$ac_try_echo") >&5
   (exit $ac_status); }; }; then
   { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-   ax_cv_compile_builtin_ext=yes
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BUILTIN_CTZ 1
@@ -19293,8 +19442,7 @@ fi
 
 
 
-
-LIBS=$LIBS_ORIG
+CFLAGS=$CFLAGS_ORIG
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -19305,7 +19453,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 	;;
 esac
-if test x"$ax_cv_compile_builtin_ext" = x"yes"; then
+if test x"$acx_mpopcnt_ok" = x"yes"; then
   POPCNT_CFLAGS="$POPCNT_CFLAGS -mpopcnt"
 fi
 
@@ -19824,7 +19972,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-  LIBS_ORIG=$LIBS
+  CFLAGS_ORIG=$CFLAGS
 
   case $host_cpu in
     powerpc*)
@@ -19905,7 +20053,7 @@ fi
 { $as_echo "$as_me:$LINENO: result: $ax_cv_check_cflags___faltivec" >&5
 $as_echo "$ax_cv_check_cflags___faltivec" >&6; }
 if test x"$ax_cv_check_cflags___faltivec" = xyes; then
-  SIMD_FLAGS="$SIMD_FLAGS -faltivec"
+  SIMD_CFLAGS="$SIMD_CFLAGS -faltivec"
 else
   :
 fi
@@ -20596,7 +20744,7 @@ $as_echo "$as_me: WARNING: Your CPU supports MMX instructions but not your compi
         else
           { $as_echo "$as_me:$LINENO: checking for mmintrin.h header file" >&5
 $as_echo_n "checking for mmintrin.h header file... " >&6; }
-          LIBS=-mmmx
+          CFLAGS=-mmmx
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -20652,7 +20800,7 @@ $as_echo "$as_me: WARNING: Your compiler supports MMX instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -mmmx"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mmmx"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_MMX 1
@@ -20731,7 +20879,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE instructions but not your compi
         else
           { $as_echo "$as_me:$LINENO: checking for xmmintrin.h header file" >&5
 $as_echo_n "checking for xmmintrin.h header file... " >&6; }
-          LIBS=-msse
+          CFLAGS=-msse
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -20787,7 +20935,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -msse"
+            SIMD_CFLAGS="$SIMD_CFLAGS -msse"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE 1
@@ -20866,7 +21014,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE2 instructions but not your comp
 	else
           { $as_echo "$as_me:$LINENO: checking for emmintrin.h header file" >&5
 $as_echo_n "checking for emmintrin.h header file... " >&6; }
-          LIBS=-msse2
+          CFLAGS=-msse2
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -20922,7 +21070,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE2 instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-  	    SIMD_FLAGS="$SIMD_FLAGS -msse2"
+  	    SIMD_CFLAGS="$SIMD_CFLAGS -msse2"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE2 1
@@ -21001,7 +21149,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE3 instructions but not your comp
         else
           { $as_echo "$as_me:$LINENO: checking for pmmintrin.h header file" >&5
 $as_echo_n "checking for pmmintrin.h header file... " >&6; }
-          LIBS=-msse3
+          CFLAGS=-msse3
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21057,7 +21205,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE3 instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -msse3"
+            SIMD_CFLAGS="$SIMD_CFLAGS -msse3"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE3 1
@@ -21136,7 +21284,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSSE3 instructions but not your com
         else
           { $as_echo "$as_me:$LINENO: checking for tmmintrin.h header file" >&5
 $as_echo_n "checking for tmmintrin.h header file... " >&6; }
-          LIBS=-mssse3
+          CFLAGS=-mssse3
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21192,7 +21340,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSSE3 instructions but not you
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -mssse3"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mssse3"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSSE3 1
@@ -21271,7 +21419,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE4.1 instructions but not your co
 	else
           { $as_echo "$as_me:$LINENO: checking for smmintrin.h header file" >&5
 $as_echo_n "checking for smmintrin.h header file... " >&6; }
-          LIBS=-msse4.1
+          CFLAGS=-msse4.1
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21327,7 +21475,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE4.1 instructions but not yo
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-  	    SIMD_FLAGS="$SIMD_FLAGS -msse4.1"
+  	    SIMD_CFLAGS="$SIMD_CFLAGS -msse4.1"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE4_1 1
@@ -21406,7 +21554,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE4.2 instructions but not your co
         else
           { $as_echo "$as_me:$LINENO: checking for nmmintrin.h header file" >&5
 $as_echo_n "checking for nmmintrin.h header file... " >&6; }
-          LIBS=-msse4.2
+          CFLAGS=-msse4.2
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21462,7 +21610,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE4.2 instructions but not yo
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -msse4.2"
+            SIMD_CFLAGS="$SIMD_CFLAGS -msse4.2"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE4_2 1
@@ -21609,7 +21757,7 @@ $as_echo "$as_me: WARNING: Your CPU supports AVX instructions but not your compi
         else
           { $as_echo "$as_me:$LINENO: checking for immintrin.h header file" >&5
 $as_echo_n "checking for immintrin.h header file... " >&6; }
-          LIBS=-mavx
+          CFLAGS=-mavx
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21665,7 +21813,7 @@ $as_echo "$as_me: WARNING: Your compiler supports AVX instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -mavx"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mavx"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_AVX 1
@@ -21809,7 +21957,7 @@ _ACEOF
             fi
 
             if test "$ax_cv_cpu_have_bmi1_ext" = yes; then
-              SIMD_FLAGS="$SIMD_FLAGS -mbmi"
+              SIMD_CFLAGS="$SIMD_CFLAGS -mbmi"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BMI1 1
@@ -21818,7 +21966,7 @@ _ACEOF
             fi
 
             if test "$ax_cv_cpu_have_bmi2_ext" = yes; then
-              SIMD_FLAGS="$SIMD_FLAGS -mbmi2"
+              SIMD_CFLAGS="$SIMD_CFLAGS -mbmi2"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BMI2 1
@@ -21899,7 +22047,7 @@ $as_echo "$as_me: WARNING: Your CPU supports AVX2 instructions but not your comp
         else
           { $as_echo "$as_me:$LINENO: checking for immintrin.h header file" >&5
 $as_echo_n "checking for immintrin.h header file... " >&6; }
-          LIBS=-mavx2
+          CFLAGS=-mavx2
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21955,7 +22103,7 @@ $as_echo "$as_me: WARNING: Your compiler supports AVX2 instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -mavx2"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mavx2"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_AVX2 1
@@ -21969,10 +22117,10 @@ _ACEOF
   ;;
   esac
 
-  LIBS=$LIBS_ORIG
+  CFLAGS=$CFLAGS_ORIG
 
 
-   # Sets SIMD_FLAGS, and HAVE_ALTIVEC,HAVE_MMX,HAVE_SSE,HAVE_SSE2,HAVE_SSE3,HAVE_SSSE3,HAVE_SSE4_1,HAVE_SSE4_2,HAVE_AVX
+   # Sets SIMD_CFLAGS, and HAVE_ALTIVEC,HAVE_MMX,HAVE_SSE,HAVE_SSE2,HAVE_SSE3,HAVE_SSSE3,HAVE_SSE4_1,HAVE_SSE4_2,HAVE_AVX
      ;;
 
      xno)
@@ -21986,7 +22134,7 @@ $as_echo "not specified so enabled by default" >&6; }
 
 
 
-  LIBS_ORIG=$LIBS
+  CFLAGS_ORIG=$CFLAGS
 
   case $host_cpu in
     powerpc*)
@@ -22067,7 +22215,7 @@ fi
 { $as_echo "$as_me:$LINENO: result: $ax_cv_check_cflags___faltivec" >&5
 $as_echo "$ax_cv_check_cflags___faltivec" >&6; }
 if test x"$ax_cv_check_cflags___faltivec" = xyes; then
-  SIMD_FLAGS="$SIMD_FLAGS -faltivec"
+  SIMD_CFLAGS="$SIMD_CFLAGS -faltivec"
 else
   :
 fi
@@ -22758,7 +22906,7 @@ $as_echo "$as_me: WARNING: Your CPU supports MMX instructions but not your compi
         else
           { $as_echo "$as_me:$LINENO: checking for mmintrin.h header file" >&5
 $as_echo_n "checking for mmintrin.h header file... " >&6; }
-          LIBS=-mmmx
+          CFLAGS=-mmmx
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -22814,7 +22962,7 @@ $as_echo "$as_me: WARNING: Your compiler supports MMX instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -mmmx"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mmmx"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_MMX 1
@@ -22893,7 +23041,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE instructions but not your compi
         else
           { $as_echo "$as_me:$LINENO: checking for xmmintrin.h header file" >&5
 $as_echo_n "checking for xmmintrin.h header file... " >&6; }
-          LIBS=-msse
+          CFLAGS=-msse
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -22949,7 +23097,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -msse"
+            SIMD_CFLAGS="$SIMD_CFLAGS -msse"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE 1
@@ -23028,7 +23176,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE2 instructions but not your comp
 	else
           { $as_echo "$as_me:$LINENO: checking for emmintrin.h header file" >&5
 $as_echo_n "checking for emmintrin.h header file... " >&6; }
-          LIBS=-msse2
+          CFLAGS=-msse2
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23084,7 +23232,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE2 instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-  	    SIMD_FLAGS="$SIMD_FLAGS -msse2"
+  	    SIMD_CFLAGS="$SIMD_CFLAGS -msse2"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE2 1
@@ -23163,7 +23311,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE3 instructions but not your comp
         else
           { $as_echo "$as_me:$LINENO: checking for pmmintrin.h header file" >&5
 $as_echo_n "checking for pmmintrin.h header file... " >&6; }
-          LIBS=-msse3
+          CFLAGS=-msse3
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23219,7 +23367,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE3 instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -msse3"
+            SIMD_CFLAGS="$SIMD_CFLAGS -msse3"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE3 1
@@ -23298,7 +23446,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSSE3 instructions but not your com
         else
           { $as_echo "$as_me:$LINENO: checking for tmmintrin.h header file" >&5
 $as_echo_n "checking for tmmintrin.h header file... " >&6; }
-          LIBS=-mssse3
+          CFLAGS=-mssse3
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23354,7 +23502,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSSE3 instructions but not you
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -mssse3"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mssse3"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSSE3 1
@@ -23433,7 +23581,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE4.1 instructions but not your co
 	else
           { $as_echo "$as_me:$LINENO: checking for smmintrin.h header file" >&5
 $as_echo_n "checking for smmintrin.h header file... " >&6; }
-          LIBS=-msse4.1
+          CFLAGS=-msse4.1
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23489,7 +23637,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE4.1 instructions but not yo
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-  	    SIMD_FLAGS="$SIMD_FLAGS -msse4.1"
+  	    SIMD_CFLAGS="$SIMD_CFLAGS -msse4.1"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE4_1 1
@@ -23568,7 +23716,7 @@ $as_echo "$as_me: WARNING: Your CPU supports SSE4.2 instructions but not your co
         else
           { $as_echo "$as_me:$LINENO: checking for nmmintrin.h header file" >&5
 $as_echo_n "checking for nmmintrin.h header file... " >&6; }
-          LIBS=-msse4.2
+          CFLAGS=-msse4.2
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23624,7 +23772,7 @@ $as_echo "$as_me: WARNING: Your compiler supports SSE4.2 instructions but not yo
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -msse4.2"
+            SIMD_CFLAGS="$SIMD_CFLAGS -msse4.2"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_SSE4_2 1
@@ -23771,7 +23919,7 @@ $as_echo "$as_me: WARNING: Your CPU supports AVX instructions but not your compi
         else
           { $as_echo "$as_me:$LINENO: checking for immintrin.h header file" >&5
 $as_echo_n "checking for immintrin.h header file... " >&6; }
-          LIBS=-mavx
+          CFLAGS=-mavx
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23827,7 +23975,7 @@ $as_echo "$as_me: WARNING: Your compiler supports AVX instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -mavx"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mavx"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_AVX 1
@@ -23971,7 +24119,7 @@ _ACEOF
             fi
 
             if test "$ax_cv_cpu_have_bmi1_ext" = yes; then
-              SIMD_FLAGS="$SIMD_FLAGS -mbmi"
+              SIMD_CFLAGS="$SIMD_CFLAGS -mbmi"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BMI1 1
@@ -23980,7 +24128,7 @@ _ACEOF
             fi
 
             if test "$ax_cv_cpu_have_bmi2_ext" = yes; then
-              SIMD_FLAGS="$SIMD_FLAGS -mbmi2"
+              SIMD_CFLAGS="$SIMD_CFLAGS -mbmi2"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_BMI2 1
@@ -24061,7 +24209,7 @@ $as_echo "$as_me: WARNING: Your CPU supports AVX2 instructions but not your comp
         else
           { $as_echo "$as_me:$LINENO: checking for immintrin.h header file" >&5
 $as_echo_n "checking for immintrin.h header file... " >&6; }
-          LIBS=-mavx2
+          CFLAGS=-mavx2
           cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -24117,7 +24265,7 @@ $as_echo "$as_me: WARNING: Your compiler supports AVX2 instructions but not your
           else
             { $as_echo "$as_me:$LINENO: result: yes" >&5
 $as_echo "yes" >&6; }
-            SIMD_FLAGS="$SIMD_FLAGS -mavx2"
+            SIMD_CFLAGS="$SIMD_CFLAGS -mavx2"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_AVX2 1
@@ -24131,10 +24279,10 @@ _ACEOF
   ;;
   esac
 
-  LIBS=$LIBS_ORIG
+  CFLAGS=$CFLAGS_ORIG
 
 
-   # Sets SIMD_FLAGS, and HAVE_ALTIVEC,HAVE_MMX,HAVE_SSE,HAVE_SSE2,HAVE_SSE3,HAVE_SSSE3,HAVE_SSE4_1,HAVE_SSE4_2,HAVE_AVX
+   # Sets SIMD_CFLAGS, and HAVE_ALTIVEC,HAVE_MMX,HAVE_SSE,HAVE_SSE2,HAVE_SSE3,HAVE_SSSE3,HAVE_SSE4_1,HAVE_SSE4_2,HAVE_AVX
      ;;
 esac
 
@@ -25797,7 +25945,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by gmap $as_me 2014-10-14, which was
+This file was extended by gmap $as_me 2014-10-15, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -25860,7 +26008,7 @@ Report bugs to <bug-autoconf at gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-gmap config.status 2014-10-14
+gmap config.status 2014-10-15
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -27881,6 +28029,6 @@ $as_echo_n "checking SIMD features available on computer... " >&6; }
 $as_echo "$ax_cv_cpu_features" >&6; }
 { $as_echo "$as_me:$LINENO: checking SIMD compiler flags to be used" >&5
 $as_echo_n "checking SIMD compiler flags to be used... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $SIMD_FLAGS" >&5
-$as_echo "$SIMD_FLAGS" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $SIMD_CFLAGS" >&5
+$as_echo "$SIMD_CFLAGS" >&6; }
 
diff --git a/configure.ac b/configure.ac
index 2276d4e..12da643 100644
--- a/configure.ac
+++ b/configure.ac
@@ -277,7 +277,7 @@ AC_ARG_ENABLE([builtin-popcount],
 case x"$answer" in
 	xyes)
         AC_MSG_RESULT(enabled)
-	ACX_BUILTIN
+	ACX_BUILTIN_POPCOUNT
 	;;
 	
 	xno)
@@ -286,10 +286,10 @@ case x"$answer" in
 
 	x)
 	AC_MSG_RESULT([not specified so enabled by default])
-	ACX_BUILTIN
+	ACX_BUILTIN_POPCOUNT
 	;;
 esac	
-if test x"$ax_cv_compile_builtin_ext" = x"yes"; then
+if test x"$acx_mpopcnt_ok" = x"yes"; then
   POPCNT_CFLAGS="$POPCNT_CFLAGS -mpopcnt"
 fi
 AC_SUBST(POPCNT_CFLAGS)
@@ -451,7 +451,7 @@ AC_ARG_ENABLE([simd],
 case x"$answer" in
      xyes)
      AC_MSG_RESULT(enabled)
-     AX_EXT   # Sets SIMD_FLAGS, and HAVE_ALTIVEC,HAVE_MMX,HAVE_SSE,HAVE_SSE2,HAVE_SSE3,HAVE_SSSE3,HAVE_SSE4_1,HAVE_SSE4_2,HAVE_AVX
+     AX_EXT   # Sets SIMD_CFLAGS, and HAVE_ALTIVEC,HAVE_MMX,HAVE_SSE,HAVE_SSE2,HAVE_SSE3,HAVE_SSSE3,HAVE_SSE4_1,HAVE_SSE4_2,HAVE_AVX
      ;;
 
      xno)
@@ -460,7 +460,7 @@ case x"$answer" in
 
      x)
      AC_MSG_RESULT([not specified so enabled by default])
-     AX_EXT   # Sets SIMD_FLAGS, and HAVE_ALTIVEC,HAVE_MMX,HAVE_SSE,HAVE_SSE2,HAVE_SSE3,HAVE_SSSE3,HAVE_SSE4_1,HAVE_SSE4_2,HAVE_AVX
+     AX_EXT   # Sets SIMD_CFLAGS, and HAVE_ALTIVEC,HAVE_MMX,HAVE_SSE,HAVE_SSE2,HAVE_SSE3,HAVE_SSSE3,HAVE_SSE4_1,HAVE_SSE4_2,HAVE_AVX
      ;;
 esac	
 
@@ -717,5 +717,5 @@ AC_MSG_RESULT($POPCNT_CFLAGS)
 AC_MSG_CHECKING(SIMD features available on computer)
 AC_MSG_RESULT($ax_cv_cpu_features)
 AC_MSG_CHECKING(SIMD compiler flags to be used)
-AC_MSG_RESULT($SIMD_FLAGS)
+AC_MSG_RESULT($SIMD_CFLAGS)
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 8c22b11..83264f5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,7 +51,7 @@ GMAP_FILES = fopen.h bool.h types.h separator.h comp.h \
 # Note: dist_ commands get read by bootstrap, and don't follow the flags
 
 gmap_CC = $(PTHREAD_CC)
-gmap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\"
+gmap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\"
 gmap_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 gmap_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 
@@ -98,7 +98,7 @@ GMAPL_FILES = fopen.h bool.h types.h separator.h comp.h \
 # Note: dist_ commands get read by bootstrap, and don't follow the flags
 
 gmapl_CC = $(PTHREAD_CC)
-gmapl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DLARGE_GENOMES=1
+gmapl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DLARGE_GENOMES=1
 gmapl_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 gmapl_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 
@@ -148,7 +148,7 @@ GSNAP_FILES = fopen.h bool.h types.h separator.h comp.h \
 # Note: dist_ commands get read by bootstrap, and don't follow the flags
 
 gsnap_CC = $(PTHREAD_CC)
-gsnap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) $(GOBY_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1
+gsnap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) $(GOBY_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1
 gsnap_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG) $(GOBY_LDFLAGS)
 gsnap_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS) $(GOBY_LIBS)
 
@@ -196,7 +196,7 @@ GSNAPL_FILES = fopen.h bool.h types.h separator.h comp.h \
 # Note: dist_ commands get read by bootstrap, and don't follow the flags
 
 gsnapl_CC = $(PTHREAD_CC)
-gsnapl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) $(GOBY_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1 -DLARGE_GENOMES=1
+gsnapl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) $(GOBY_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1 -DLARGE_GENOMES=1
 gsnapl_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG) $(GOBY_LDFLAGS)
 gsnapl_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS) $(GOBY_LIBS)
 
@@ -238,7 +238,7 @@ UNIQSCAN_FILES = fopen.h bool.h types.h separator.h comp.h \
  getopt.c getopt1.c getopt.h uniqscan.c
 
 uniqscan_CC = $(PTHREAD_CC)
-uniqscan_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1
+uniqscan_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1
 uniqscan_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 uniqscan_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 
@@ -279,7 +279,7 @@ UNIQSCANL_FILES = fopen.h bool.h types.h separator.h comp.h \
  getopt.c getopt1.c getopt.h uniqscan.c
 
 uniqscanl_CC = $(PTHREAD_CC)
-uniqscanl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1 -DLARGE_GENOMES=1
+uniqscanl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1 -DLARGE_GENOMES=1
 uniqscanl_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 uniqscanl_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 
@@ -306,7 +306,7 @@ GMAPINDEX_FILES = fopen.h bool.h types.h \
  gmapindex.c
 
 gmapindex_CC = $(PTHREAD_CC)
-gmapindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DUTILITYP=1
+gmapindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DUTILITYP=1
 gmapindex_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 gmapindex_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_gmapindex_SOURCES = $(GMAPINDEX_FILES)
@@ -329,7 +329,7 @@ SNPINDEX_FILES = fopen.h bool.h types.h \
  getopt.c getopt1.c getopt.h snpindex.c
 
 snpindex_CC = $(PTHREAD_CC)
-snpindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
+snpindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
 snpindex_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 snpindex_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_snpindex_SOURCES = $(SNPINDEX_FILES)
@@ -354,7 +354,7 @@ CMETINDEX_FILES = fopen.h bool.h types.h \
  getopt.c getopt1.c getopt.h cmetindex.c
 
 cmetindex_CC = $(PTHREAD_CC)
-cmetindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
+cmetindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
 cmetindex_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 cmetindex_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_cmetindex_SOURCES = $(CMETINDEX_FILES)
@@ -379,7 +379,7 @@ ATOIINDEX_FILES = fopen.h bool.h types.h \
  getopt.c getopt1.c getopt.h atoiindex.c
 
 atoiindex_CC = $(PTHREAD_CC)
-atoiindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
+atoiindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
 atoiindex_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 atoiindex_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_atoiindex_SOURCES = $(ATOIINDEX_FILES)
diff --git a/src/Makefile.in b/src/Makefile.in
index dff151a..8d5bc43 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -55,7 +55,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
 	$(top_srcdir)/config/acx_mmap_fixed.m4 \
 	$(top_srcdir)/config/acx_mmap_variable.m4 \
 	$(top_srcdir)/config/acx_pthread.m4 \
-	$(top_srcdir)/config/builtin.m4 \
+	$(top_srcdir)/config/builtin-popcount.m4 \
 	$(top_srcdir)/config/struct-stat64.m4 \
 	$(top_srcdir)/config/expand.m4 $(top_srcdir)/config/perl.m4 \
 	$(top_srcdir)/config/fopen.m4 $(top_srcdir)/config/asm-bsr.m4 \
@@ -670,7 +670,7 @@ RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
-SIMD_FLAGS = @SIMD_FLAGS@
+SIMD_CFLAGS = @SIMD_CFLAGS@
 STRIP = @STRIP@
 VERSION = @VERSION@
 ZLIB_LIBS = @ZLIB_LIBS@
@@ -773,7 +773,7 @@ GMAP_FILES = fopen.h bool.h types.h separator.h comp.h \
 
 # Note: dist_ commands get read by bootstrap, and don't follow the flags
 gmap_CC = $(PTHREAD_CC)
-gmap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\"
+gmap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\"
 gmap_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 gmap_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_gmap_SOURCES = $(GMAP_FILES)
@@ -816,7 +816,7 @@ GMAPL_FILES = fopen.h bool.h types.h separator.h comp.h \
 
 # Note: dist_ commands get read by bootstrap, and don't follow the flags
 gmapl_CC = $(PTHREAD_CC)
-gmapl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DLARGE_GENOMES=1
+gmapl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DLARGE_GENOMES=1
 gmapl_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 gmapl_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_gmapl_SOURCES = $(GMAPL_FILES)
@@ -861,7 +861,7 @@ GSNAP_FILES = fopen.h bool.h types.h separator.h comp.h \
 
 # Note: dist_ commands get read by bootstrap, and don't follow the flags
 gsnap_CC = $(PTHREAD_CC)
-gsnap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) $(GOBY_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1
+gsnap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) $(GOBY_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1
 gsnap_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG) $(GOBY_LDFLAGS)
 gsnap_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS) $(GOBY_LIBS)
 dist_gsnap_SOURCES = $(GSNAP_FILES)
@@ -905,7 +905,7 @@ GSNAPL_FILES = fopen.h bool.h types.h separator.h comp.h \
 
 # Note: dist_ commands get read by bootstrap, and don't follow the flags
 gsnapl_CC = $(PTHREAD_CC)
-gsnapl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) $(GOBY_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1 -DLARGE_GENOMES=1
+gsnapl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) $(GOBY_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1 -DLARGE_GENOMES=1
 gsnapl_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG) $(GOBY_LDFLAGS)
 gsnapl_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS) $(GOBY_LIBS)
 dist_gsnapl_SOURCES = $(GSNAPL_FILES)
@@ -944,7 +944,7 @@ UNIQSCAN_FILES = fopen.h bool.h types.h separator.h comp.h \
  getopt.c getopt1.c getopt.h uniqscan.c
 
 uniqscan_CC = $(PTHREAD_CC)
-uniqscan_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1
+uniqscan_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1
 uniqscan_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 uniqscan_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_uniqscan_SOURCES = $(UNIQSCAN_FILES)
@@ -982,7 +982,7 @@ UNIQSCANL_FILES = fopen.h bool.h types.h separator.h comp.h \
  getopt.c getopt1.c getopt.h uniqscan.c
 
 uniqscanl_CC = $(PTHREAD_CC)
-uniqscanl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1 -DLARGE_GENOMES=1
+uniqscanl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DTARGET=\"$(target)\" -DGMAPDB=\"$(GMAPDB)\" -DMAX_READLENGTH=$(MAX_READLENGTH) -DGSNAP=1 -DLARGE_GENOMES=1
 uniqscanl_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 uniqscanl_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_uniqscanl_SOURCES = $(UNIQSCANL_FILES)
@@ -1006,7 +1006,7 @@ GMAPINDEX_FILES = fopen.h bool.h types.h \
  gmapindex.c
 
 gmapindex_CC = $(PTHREAD_CC)
-gmapindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DUTILITYP=1
+gmapindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DUTILITYP=1
 gmapindex_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 gmapindex_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_gmapindex_SOURCES = $(GMAPINDEX_FILES)
@@ -1027,7 +1027,7 @@ SNPINDEX_FILES = fopen.h bool.h types.h \
  getopt.c getopt1.c getopt.h snpindex.c
 
 snpindex_CC = $(PTHREAD_CC)
-snpindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
+snpindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
 snpindex_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 snpindex_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_snpindex_SOURCES = $(SNPINDEX_FILES)
@@ -1050,7 +1050,7 @@ CMETINDEX_FILES = fopen.h bool.h types.h \
  getopt.c getopt1.c getopt.h cmetindex.c
 
 cmetindex_CC = $(PTHREAD_CC)
-cmetindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
+cmetindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
 cmetindex_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 cmetindex_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_cmetindex_SOURCES = $(CMETINDEX_FILES)
@@ -1073,7 +1073,7 @@ ATOIINDEX_FILES = fopen.h bool.h types.h \
  getopt.c getopt1.c getopt.h atoiindex.c
 
 atoiindex_CC = $(PTHREAD_CC)
-atoiindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_FLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
+atoiindex_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(POPCNT_CFLAGS) $(SIMD_CFLAGS) -DGMAPDB=\"$(GMAPDB)\" -DUTILITYP=1
 atoiindex_LDFLAGS = $(AM_LDFLAGS) $(STATIC_LDFLAG)
 atoiindex_LDADD = $(PTHREAD_LIBS) $(ZLIB_LIBS) $(BZLIB_LIBS)
 dist_atoiindex_SOURCES = $(ATOIINDEX_FILES)
diff --git a/src/outbuffer.c b/src/outbuffer.c
index e6aa0ff..74ee684 100644
--- a/src/outbuffer.c
+++ b/src/outbuffer.c
@@ -1,4 +1,4 @@
-static char rcsid[] = "$Id: outbuffer.c 149571 2014-10-01 19:22:17Z twu $";
+static char rcsid[] = "$Id: outbuffer.c 150878 2014-10-15 18:18:56Z twu $";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -980,7 +980,7 @@ failedinput_open (T this) {
 
 
 static void
-sevenway_open (T this, int argc, char **argv, int optind) {
+sevenway_open (T this, int nworkers, bool orderedp, int argc, char **argv, int optind) {
   char *filename;
   char *write_mode;
 
@@ -1075,19 +1075,29 @@ sevenway_open (T this, int argc, char **argv, int optind) {
       }
 
     } else {
+      SAM_header_print_HD(this->fp_nomapping,nworkers,orderedp);
+      SAM_header_print_PG(this->fp_nomapping,argc,argv,optind);
       Univ_IIT_dump_sam(this->fp_nomapping,this->chromosome_iit,
 			this->sam_read_group_id,this->sam_read_group_name,
 			this->sam_read_group_library,this->sam_read_group_platform);
+      SAM_header_print_HD(this->fp_uniq,nworkers,orderedp);
+      SAM_header_print_PG(this->fp_uniq,argc,argv,optind);
       Univ_IIT_dump_sam(this->fp_uniq,this->chromosome_iit,
 			this->sam_read_group_id,this->sam_read_group_name,
 			this->sam_read_group_library,this->sam_read_group_platform);
+      SAM_header_print_HD(this->fp_circular,nworkers,orderedp);
+      SAM_header_print_PG(this->fp_circular,argc,argv,optind);
       Univ_IIT_dump_sam(this->fp_circular,this->chromosome_iit,
 			this->sam_read_group_id,this->sam_read_group_name,
 			this->sam_read_group_library,this->sam_read_group_platform);
+      SAM_header_print_HD(this->fp_mult,nworkers,orderedp);
+      SAM_header_print_PG(this->fp_mult,argc,argv,optind);
       Univ_IIT_dump_sam(this->fp_mult,this->chromosome_iit,
 			this->sam_read_group_id,this->sam_read_group_name,
 			this->sam_read_group_library,this->sam_read_group_platform);
       if (this->quiet_if_excessive_p == true) {
+	SAM_header_print_HD(this->fp_mult_xs,nworkers,orderedp);
+	SAM_header_print_PG(this->fp_mult_xs,argc,argv,optind);
 	Univ_IIT_dump_sam(this->fp_mult_xs,this->chromosome_iit,
 			  this->sam_read_group_id,this->sam_read_group_name,
 			  this->sam_read_group_library,this->sam_read_group_platform);
@@ -1477,7 +1487,7 @@ Outbuffer_new (unsigned int output_buffer_size, unsigned int nread, char *sevenw
   }
 
   if (sevenway_root != NULL) {
-    sevenway_open(new,argc,argv,optind);
+    sevenway_open(new,nworkers,orderedp,argc,argv,optind);
 
   } else {
     new->fp_nomapping = stdout;
@@ -1487,8 +1497,11 @@ Outbuffer_new (unsigned int output_buffer_size, unsigned int nread, char *sevenw
     new->fp_mult = stdout;
     new->fp_mult_xs = stdout;
 
+    if (printtype == GFF3_GENE || printtype == GFF3_MATCH_CDNA || printtype == GFF3_MATCH_EST) {
+      print_gff_header(stdout,argc,argv,optind);
+      
 #ifndef PMAP
-    if (printtype == SAM && sam_headers_p == true) {
+    } else if (printtype == SAM && sam_headers_p == true) {
       if (usersegment != NULL) {
 	dump_sam_usersegment(stdout,usersegment,sam_read_group_id,sam_read_group_name,
 			     sam_read_group_library,sam_read_group_platform);
@@ -1498,9 +1511,9 @@ Outbuffer_new (unsigned int output_buffer_size, unsigned int nread, char *sevenw
 	Univ_IIT_dump_sam(stdout,chromosome_iit,sam_read_group_id,sam_read_group_name,
 			  sam_read_group_library,sam_read_group_platform);
       }
-    }
 #endif
 
+    }
   }
 
   return new;
diff --git a/src/shortread.c b/src/shortread.c
index 73d6b0c..110996a 100644
--- a/src/shortread.c
+++ b/src/shortread.c
@@ -1,4 +1,4 @@
-static char rcsid[] = "$Id: shortread.c 149319 2014-09-30 02:15:42Z twu $";
+static char rcsid[] = "$Id: shortread.c 150681 2014-10-14 01:47:18Z twu $";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -2127,6 +2127,7 @@ Shortread_read_fasta_shortreads (int *nextchar, T *queryseq2, FILE **input1, FIL
   bool filterp;
 
   while (1) {
+    queryseq1 = *queryseq2 = (T) NULL;
     if (*input1 == NULL || feof(*input1)) {
       if (*input1 != NULL) {
 	fclose(*input1);
@@ -2175,7 +2176,7 @@ Shortread_read_fasta_shortreads (int *nextchar, T *queryseq2, FILE **input1, FIL
     if (*nextchar == '\0') {
       if ((*nextchar = Shortread_input_init(*input1)) == EOF) {
 	*nextchar = EOF;
-	return NULL;
+	return (T) NULL;
       }
     }
 
@@ -2340,7 +2341,9 @@ Shortread_read_fasta_shortreads (int *nextchar, T *queryseq2, FILE **input1, FIL
 
       debug(printf("Returning queryseq with contents %s\n",queryseq1->contents));
 
-      return queryseq1;
+      if (queryseq1 != NULL && queryseq1->acc != NULL && queryseq1->fulllength > 0) {
+	return queryseq1;
+      }
     }
   }
 }
@@ -2361,6 +2364,7 @@ Shortread_read_fasta_shortreads_gzip (int *nextchar, T *queryseq2, gzFile *input
   bool filterp;
 
   while (1) {
+    queryseq1 = *queryseq2 = (T) NULL;
     if (*input1 == NULL || gzeof(*input1)) {
       if (*input1 != NULL) {
 	gzclose(*input1);
@@ -2412,7 +2416,7 @@ Shortread_read_fasta_shortreads_gzip (int *nextchar, T *queryseq2, gzFile *input
     if (*nextchar == '\0') {
       if ((*nextchar = Shortread_input_init_gzip(*input1)) == EOF) {
 	*nextchar = EOF;
-	return NULL;
+	return (T) NULL;
       }
     }
 
@@ -2494,7 +2498,9 @@ Shortread_read_fasta_shortreads_gzip (int *nextchar, T *queryseq2, gzFile *input
 
       debug(printf("Returning queryseq with contents %s\n",queryseq1->contents));
 
-      return queryseq1;
+      if (queryseq1 != NULL && queryseq1->acc != NULL && queryseq1->fulllength > 0) {
+	return queryseq1;
+      }
     }
 
   }
@@ -2515,6 +2521,7 @@ Shortread_read_fasta_shortreads_bzip2 (int *nextchar, T *queryseq2, Bzip2_T *inp
   bool filterp;
 
   while (1) {
+    queryseq1 = *queryseq2 = (T) NULL;
     if (*input1 == NULL || bzeof(*input1)) {
       if (*input1 != NULL) {
 	Bzip2_free(&(*input1));
@@ -2563,7 +2570,7 @@ Shortread_read_fasta_shortreads_bzip2 (int *nextchar, T *queryseq2, Bzip2_T *inp
     if (*nextchar == '\0') {
       if ((*nextchar = Shortread_input_init_bzip2(*input1)) == EOF) {
 	*nextchar = EOF;
-	return NULL;
+	return (T) NULL;
       }
     }
 
@@ -2641,7 +2648,9 @@ Shortread_read_fasta_shortreads_bzip2 (int *nextchar, T *queryseq2, Bzip2_T *inp
 
       debug(printf("Returning queryseq with contents %s\n",queryseq1->contents));
 
-      return queryseq1;
+      if (queryseq1 != NULL && queryseq1->acc != NULL && queryseq1->fulllength > 0) {
+	return queryseq1;
+      }
     }
 
   }
@@ -2661,6 +2670,7 @@ Shortread_read_fastq_shortreads (int *nextchar, T *queryseq2, FILE **input1, FIL
   bool filterp;
 
   while (1) {
+    queryseq1 = *queryseq2 = (T) NULL;
     if (*input1 == NULL || feof(*input1)) {
       if (*input1 != NULL) {
 	fclose(*input1);
@@ -2718,6 +2728,8 @@ Shortread_read_fastq_shortreads (int *nextchar, T *queryseq2, FILE **input1, FIL
       *nextchar = fgetc(*input1);
       if ((fulllength = input_oneline(&(*nextchar),&long_read_1,&(Read1[0]),*input1,acc,
 				      /*possible_fasta_header_p*/true)) == 0) {
+	FREE_IN(acc);
+	FREE_IN(restofheader);
 	/* fprintf(stderr,"length is zero\n"); */
 	/* No sequence1.  Don't process, but loop again */
 	/* *nextchar = EOF; */
@@ -2745,7 +2757,9 @@ Shortread_read_fastq_shortreads (int *nextchar, T *queryseq2, FILE **input1, FIL
       }
     }
 
-    if (*input2 == NULL) {
+    if (acc == NULL || fulllength == 0) {
+      /* Skip */
+    } else if (*input2 == NULL) {
       *queryseq2 = (T) NULL;
     } else {
       if ((acc = input_header_fastq(&filterp,&restofheader,*input2,skipp)) == NULL) {
@@ -2772,6 +2786,8 @@ Shortread_read_fastq_shortreads (int *nextchar, T *queryseq2, FILE **input1, FIL
 	nextchar2 = fgetc(*input2);
 	if ((fulllength = input_oneline(&nextchar2,&long_read_2,&(Read2[0]),*input2,acc,
 					/*possible_fasta_header_p*/true)) == 0) {
+	  FREE_IN(acc);
+	  FREE_IN(restofheader);
 	  /* fprintf(stderr,"length is zero\n"); */
 	  /* No sequence2.  Don't process, but loop again */
 	  /* *nextchar = EOF; */
@@ -2801,7 +2817,9 @@ Shortread_read_fastq_shortreads (int *nextchar, T *queryseq2, FILE **input1, FIL
       }
     }
 
-    return queryseq1;
+    if (queryseq1 != NULL && queryseq1->acc != NULL && queryseq1->fulllength > 0) {
+      return queryseq1;
+    }
   }
 }
 
@@ -2819,6 +2837,7 @@ Shortread_read_fastq_shortreads_gzip (int *nextchar, T *queryseq2, gzFile *input
   bool filterp;
 
   while (1) {
+    queryseq1 = *queryseq2 = (T) NULL;
     if (*input1 == NULL || gzeof(*input1)) {
       if (*input1 != NULL) {
 	gzclose(*input1);
@@ -2881,6 +2900,8 @@ Shortread_read_fastq_shortreads_gzip (int *nextchar, T *queryseq2, gzFile *input
       *nextchar = gzgetc(*input1);
       if ((fulllength = input_oneline_gzip(&(*nextchar),&long_read_1,&(Read1[0]),*input1,acc,
 					   /*possible_fasta_header_p*/true)) == 0) {
+	FREE_IN(acc);
+	FREE_IN(restofheader);
 	/* fprintf(stderr,"length is zero\n"); */
 	/* No sequence1.  Don't process, but loop again */
 	/* *nextchar = EOF; */
@@ -2908,7 +2929,9 @@ Shortread_read_fastq_shortreads_gzip (int *nextchar, T *queryseq2, gzFile *input
       }
     }
 
-    if (*input2 == NULL) {
+    if (acc == NULL || fulllength == 0) {
+      /* Skip */
+    } else if (*input2 == NULL) {
       *queryseq2 = (T) NULL;
     } else {
       if ((acc = input_header_fastq_gzip(&filterp,&restofheader,*input2,skipp)) == NULL) {
@@ -2935,6 +2958,8 @@ Shortread_read_fastq_shortreads_gzip (int *nextchar, T *queryseq2, gzFile *input
 	nextchar2 = gzgetc(*input2);
 	if ((fulllength = input_oneline_gzip(&nextchar2,&long_read_2,&(Read2[0]),*input2,acc,
 					     /*possible_fasta_header_p*/true)) == 0) {
+	  FREE_IN(acc);
+	  FREE_IN(restofheader);
 	  /* fprintf(stderr,"length is zero\n"); */
 	  /* No sequence2.  Don't process, but loop again */
 	  /* *nextchar = EOF; */
@@ -2963,7 +2988,9 @@ Shortread_read_fastq_shortreads_gzip (int *nextchar, T *queryseq2, gzFile *input
       }
     }
 
-    return queryseq1;
+    if (queryseq1 != NULL && queryseq1->acc != NULL && queryseq1->fulllength > 0) {
+      return queryseq1;
+    }
   }
 }
 #endif
@@ -2982,6 +3009,7 @@ Shortread_read_fastq_shortreads_bzip2 (int *nextchar, T *queryseq2, Bzip2_T *inp
   bool filterp;
 
   while (1) {
+    queryseq1 = *queryseq2 = (T) NULL;
     if (*input1 == NULL || bzeof(*input1)) {
       if (*input1 != NULL) {
 	Bzip2_free(&(*input1));
@@ -3032,6 +3060,8 @@ Shortread_read_fastq_shortreads_bzip2 (int *nextchar, T *queryseq2, Bzip2_T *inp
       *nextchar = bzgetc(*input1);
       if ((fulllength = input_oneline_bzip2(&(*nextchar),&long_read_1,&(Read1[0]),*input1,acc,
 					    /*possible_fasta_header_p*/true)) == 0) {
+	FREE_IN(acc);
+	FREE_IN(restofheader);
 	/* fprintf(stderr,"length is zero\n"); */
 	/* No sequence1.  Don't process, but loop again */
 	/* *nextchar = EOF; */
@@ -3059,7 +3089,9 @@ Shortread_read_fastq_shortreads_bzip2 (int *nextchar, T *queryseq2, Bzip2_T *inp
       }
     }
 
-    if (*input2 == NULL) {
+    if (acc == NULL || fulllength == 0) {
+      /* Skip */
+    } else if (*input2 == NULL) {
       *queryseq2 = (T) NULL;
     } else {
       if ((acc = input_header_fastq_bzip2(&filterp,&restofheader,*input2,skipp)) == NULL) {
@@ -3086,6 +3118,8 @@ Shortread_read_fastq_shortreads_bzip2 (int *nextchar, T *queryseq2, Bzip2_T *inp
 	nextchar2 = bzgetc(*input2);
 	if ((fulllength = input_oneline_bzip2(&nextchar2,&long_read_2,&(Read2[0]),*input2,acc,
 					      /*possible_fasta_header_p*/true)) == 0) {
+	  FREE_IN(acc);
+	  FREE_IN(restofheader);
 	  /* fprintf(stderr,"length is zero\n"); */
 	  /* No sequence2.  Don't process, but loop again */
 	  /* *nextchar = EOF; */
@@ -3114,7 +3148,9 @@ Shortread_read_fastq_shortreads_bzip2 (int *nextchar, T *queryseq2, Bzip2_T *inp
       }
     }
 
-    return queryseq1;
+    if (queryseq1 != NULL && queryseq1->acc != NULL && queryseq1->fulllength > 0) {
+      return queryseq1;
+    }
   }
 }
 #endif
diff --git a/tests/Makefile.in b/tests/Makefile.in
index fd7d3b0..5306c8e 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -50,7 +50,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
 	$(top_srcdir)/config/acx_mmap_fixed.m4 \
 	$(top_srcdir)/config/acx_mmap_variable.m4 \
 	$(top_srcdir)/config/acx_pthread.m4 \
-	$(top_srcdir)/config/builtin.m4 \
+	$(top_srcdir)/config/builtin-popcount.m4 \
 	$(top_srcdir)/config/struct-stat64.m4 \
 	$(top_srcdir)/config/expand.m4 $(top_srcdir)/config/perl.m4 \
 	$(top_srcdir)/config/fopen.m4 $(top_srcdir)/config/asm-bsr.m4 \
@@ -139,7 +139,7 @@ RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
-SIMD_FLAGS = @SIMD_FLAGS@
+SIMD_CFLAGS = @SIMD_CFLAGS@
 STRIP = @STRIP@
 VERSION = @VERSION@
 ZLIB_LIBS = @ZLIB_LIBS@
diff --git a/util/Makefile.in b/util/Makefile.in
index b4d37cd..190fe80 100644
--- a/util/Makefile.in
+++ b/util/Makefile.in
@@ -59,7 +59,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
 	$(top_srcdir)/config/acx_mmap_fixed.m4 \
 	$(top_srcdir)/config/acx_mmap_variable.m4 \
 	$(top_srcdir)/config/acx_pthread.m4 \
-	$(top_srcdir)/config/builtin.m4 \
+	$(top_srcdir)/config/builtin-popcount.m4 \
 	$(top_srcdir)/config/struct-stat64.m4 \
 	$(top_srcdir)/config/expand.m4 $(top_srcdir)/config/perl.m4 \
 	$(top_srcdir)/config/fopen.m4 $(top_srcdir)/config/asm-bsr.m4 \
@@ -174,7 +174,7 @@ RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
-SIMD_FLAGS = @SIMD_FLAGS@
+SIMD_CFLAGS = @SIMD_CFLAGS@
 STRIP = @STRIP@
 VERSION = @VERSION@
 ZLIB_LIBS = @ZLIB_LIBS@

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/gmap.git



More information about the debian-med-commit mailing list