[med-svn] [tophat] 02/04: Imported Upstream version 2.1.0+dfsg
Andreas Tille
tille at debian.org
Mon Jul 20 09:28:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository tophat.
commit edb0104ccce39f6fb0b81008b567f97a6b8c770f
Author: Andreas Tille <tille at debian.org>
Date: Sat Jul 18 17:41:12 2015 +0200
Imported Upstream version 2.1.0+dfsg
---
Makefile.in | 3 +-
README | 7 +-
config.guess | 544 ++++++++++++++++++--------------
config.sub | 390 +++++++++++++++++------
configure | 24 +-
configure.ac | 2 +-
depcomp | 409 +++++++++++++++++++-----
install-sh | 538 ++++++++++++++++++++++----------
missing | 234 ++++++--------
src/GBase.cpp | 87 +++++-
src/GBase.h | 19 +-
src/GHash.hh | 6 +-
src/GList.hh | 7 +-
src/GVec.hh | 21 +-
src/align_status.cpp | 0
src/align_status.h | 0
src/common.cpp | 2 +-
src/common.h | 1 +
src/deletions.cpp | 0
src/deletions.h | 0
src/fusions.cpp | 2 +-
src/fusions.h | 0
src/gff.cpp | 824 +++++++++++++++++++++++++------------------------
src/gff.h | 144 +++++----
src/insertions.cpp | 0
src/insertions.h | 0
src/tophat-fusion-post | 347 ++++++++++++++++++---
src/tophat.py | 8 +-
src/tophat_reports.cpp | 5 +-
29 files changed, 2379 insertions(+), 1245 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 3195b2b..067e05d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -53,8 +53,7 @@ subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
- THANKS ar-lib config.guess config.sub depcomp install-sh \
- missing
+ THANKS ar-lib config.guess config.sub install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/ax_boost_base.m4 \
$(top_srcdir)/ax_boost_thread.m4 $(top_srcdir)/configure.ac
diff --git a/README b/README
index 58a8e9f..ad86bb4 100644
--- a/README
+++ b/README
@@ -1,12 +1,11 @@
+
TopHat is a fast splice junction mapper for RNA-Seq reads. It aligns RNA-Seq
reads to mammalian-sized genomes using the ultra high-throughput short read
aligner Bowtie, and then analyzes the mapping results to identify splice
junctions between exons.
-TopHat is a collaborative effort between the Institute of Genetic Medicine at
-Johns Hopkins University, the Department of Mathematics at the University of
-California, Berkeley, and the Department of Stem Cell and Regenerative Biology
-at Harvard University.
+TopHat2 (the current release) is a collaborative effort between the Center for Computational Biology at
+Johns Hopkins University and the Genome Sciences Department at the University of Washington.
Please see http://ccb.jhu.edu/software/tophat for more information.
diff --git a/config.guess b/config.guess
index 917bbc5..872b96a 100755
--- a/config.guess
+++ b/config.guess
@@ -1,9 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
-timestamp='2005-07-08'
+timestamp='2012-09-25'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -16,9 +17,7 @@ timestamp='2005-07-08'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -26,16 +25,16 @@ timestamp='2005-07-08'
# the same distribution terms that you use for the rest of that program.
-# Originally written by Per Bothner <per at bothner.com>.
-# Please send patches to <config-patches at gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner. Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -55,7 +54,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -106,7 +106,7 @@ set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
@@ -143,7 +143,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@@ -160,6 +160,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
@@ -168,7 +169,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
+ | grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -178,7 +179,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
fi
;;
*)
- os=netbsd
+ os=netbsd
;;
esac
# The OS release
@@ -199,6 +200,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -206,8 +211,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
macppc:MirBSD:*:*)
- echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
@@ -218,7 +226,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -264,7 +272,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit ;;
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ exitcode=$?
+ trap '' 0
+ exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@@ -290,12 +301,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
- echo powerpc-ibm-os400
+ echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -319,14 +330,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@@ -370,23 +400,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
+ exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
@@ -456,8 +486,8 @@ EOF
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -470,7 +500,7 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
- exit ;;
+ exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
@@ -527,7 +557,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
- *:AIX:*:[45])
+ *:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@@ -570,52 +600,52 @@ EOF
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
+ esac ;;
+ esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ sed 's/^ //' << EOF >$dummy.c
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -635,7 +665,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
+ grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
@@ -706,22 +736,22 @@ EOF
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
- exit ;;
+ exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit ;;
+ exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
- exit ;;
+ exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
- exit ;;
+ exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
- exit ;;
+ exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
@@ -745,14 +775,14 @@ EOF
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -764,27 +794,51 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case ${UNAME_PROCESSOR} in
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
- i*:MINGW*:*)
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
+ *:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
+ i*:MSYS*:*)
+ echo ${UNAME_MACHINE}-pc-msys
+ exit ;;
i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
- x86:Interix*:[34]*)
- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
- exit ;;
+ *:Interix*:*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ authenticamd | genuineintel | EM64T)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -794,7 +848,7 @@ EOF
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
- amd64:CYGWIN*:*:*)
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
@@ -814,17 +868,68 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ else
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ fi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
- echo cris-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
frv:Linux:*:*)
- echo frv-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ LIBC=gnu
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -835,63 +940,33 @@ EOF
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- mips:Linux:*:*)
+ mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
- #undef mips
- #undef mipsel
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
+ CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
+ CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
- mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips64
- #undef mips64el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
+ or32:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-gnu
exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
@@ -901,14 +976,17 @@ EOF
*) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -916,68 +994,18 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
+ tile*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit ;;
- coff-i386)
- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #ifdef __INTEL_COMPILER
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
@@ -985,11 +1013,11 @@ EOF
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
+ # Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
@@ -1006,7 +1034,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1021,7 +1049,7 @@ EOF
fi
exit ;;
i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
@@ -1049,10 +1077,13 @@ EOF
exit ;;
pc:*:*:*)
# Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit ;;
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
+ exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
@@ -1087,8 +1118,18 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@@ -1101,7 +1142,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
@@ -1121,10 +1162,10 @@ EOF
echo ns32k-sni-sysv
fi
exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel at ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel at ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes at openmarket.com>.
# How about differentiating between stratus architectures? -djm
@@ -1150,11 +1191,11 @@ EOF
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
+ echo mips-nec-sysv${UNAME_RELEASE}
else
- echo mips-unknown-sysv${UNAME_RELEASE}
+ echo mips-unknown-sysv${UNAME_RELEASE}
fi
- exit ;;
+ exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
@@ -1164,6 +1205,12 @@ EOF
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1173,6 +1220,15 @@ EOF
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
@@ -1182,7 +1238,16 @@ EOF
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
- *86) UNAME_PROCESSOR=i686 ;;
+ i386)
+ eval $set_cc_for_build
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ UNAME_PROCESSOR="x86_64"
+ fi
+ fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1198,7 +1263,10 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NEO-?:NONSTOP_KERNEL:*:*)
+ echo neo-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1243,13 +1311,13 @@ EOF
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
+ echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
@@ -1261,11 +1329,17 @@ EOF
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
esac
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
@@ -1283,11 +1357,11 @@ main ()
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
- "4"
+ "4"
#else
- ""
+ ""
#endif
- ); exit (0);
+ ); exit (0);
#endif
#endif
@@ -1421,9 +1495,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
diff --git a/config.sub b/config.sub
index 1c366df..8df5511 100755
--- a/config.sub
+++ b/config.sub
@@ -1,9 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
-timestamp='2005-07-08'
+timestamp='2012-12-06'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -20,9 +21,7 @@ timestamp='2005-07-08'
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -31,13 +30,16 @@ timestamp='2005-07-08'
# Please send patches to <config-patches at gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
@@ -71,7 +73,8 @@ Report bugs and patches to <config-patches at gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -119,11 +122,18 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
- kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@@ -146,10 +156,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray)
+ -apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
+ -bluegene*)
+ os=-cnk
+ ;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@@ -164,13 +177,17 @@ case $os in
os=-chorusos
basic_machine=$1
;;
- -chorusrdb)
- os=-chorusrdb
+ -chorusrdb)
+ os=-chorusrdb
basic_machine=$1
- ;;
+ ;;
-hiux*)
os=-hiuxwe2
;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -187,6 +204,10 @@ case $os in
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -204,6 +225,12 @@ case $os in
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
-lynx*)
os=-lynxos
;;
@@ -228,23 +255,34 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
+ | aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | arc \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
- | fr30 | frv \
+ | epiphany \
+ | fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
- | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+ | le32 | le64 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
- | mips64vr | mips64vrel \
+ | mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
@@ -257,35 +295,65 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
- | ms1 \
+ | moxie \
+ | mt \
| msp430 \
+ | nds32 | nds32le | nds32be \
+ | nios | nios2 \
| ns16k | ns32k \
+ | open8 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | rl78 | rx \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b \
- | strongarm \
- | tahoe | thumb | tic4x | tic80 | tron \
- | v850 | v850e \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu \
+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+ | ubicom32 \
+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \
- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k)
+ | x86 | xc16x | xstormy16 | xtensa \
+ | z8k | z80)
basic_machine=$basic_machine-unknown
;;
- m32c)
- basic_machine=$basic_machine-unknown
+ c54x)
+ basic_machine=tic54x-unknown
+ ;;
+ c55x)
+ basic_machine=tic55x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
+ c6x)
+ basic_machine=tic6x-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ strongarm | thumb | xscale)
+ basic_machine=arm-unknown
+ ;;
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ xscaleeb)
+ basic_machine=armeb-unknown
+ ;;
+
+ xscaleel)
+ basic_machine=armel-unknown
+ ;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
@@ -301,29 +369,37 @@ case $basic_machine in
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
+ | aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* \
+ | avr-* | avr32-* \
+ | be32-* | be64-* \
| bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
- | m32r-* | m32rle-* \
+ | le32-* | le64-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
- | mips64vr-* | mips64vrel-* \
+ | mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
@@ -336,30 +412,38 @@ case $basic_machine in
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
- | ms1-* \
+ | mt-* \
| msp430-* \
+ | nds32-* | nds32le-* | nds32be-* \
+ | nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
+ | open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
- | romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | rl78-* | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
- | tahoe-* | thumb-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+ | tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tile*-* \
| tron-* \
- | v850-* | v850e-* | vax-* \
+ | ubicom32-* \
+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+ | vax-* \
| we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
- | xstormy16-* | xtensa-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* \
+ | xstormy16-* | xtensa*-* \
| ymp-* \
- | z8k-*)
+ | z8k-* | z80-*)
;;
- m32c-*)
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
@@ -377,7 +461,7 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
- abacus)
+ abacus)
basic_machine=abacus-unknown
;;
adobe68k)
@@ -423,6 +507,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -431,10 +519,35 @@ case $basic_machine in
basic_machine=ns32k-sequent
os=-dynix
;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
+ c54x-*)
+ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c55x-*)
+ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c6x-*)
+ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
c90)
basic_machine=c90-cray
os=-unicos
;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@@ -463,8 +576,8 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
- cr16c)
- basic_machine=cr16c-unknown
+ cr16 | cr16-*)
+ basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
@@ -502,6 +615,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
@@ -617,7 +734,6 @@ case $basic_machine in
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
@@ -656,6 +772,14 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
m88k-omron*)
basic_machine=m88k-omron
;;
@@ -667,10 +791,21 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
+ microblaze*)
+ basic_machine=microblaze-xilinx
+ ;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
mingw32)
basic_machine=i386-pc
os=-mingw32
;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
miniframe)
basic_machine=m68000-convergent
;;
@@ -696,10 +831,21 @@ case $basic_machine in
basic_machine=i386-pc
os=-msdos
;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ msys)
+ basic_machine=i386-pc
+ os=-msys
+ ;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
+ nacl)
+ basic_machine=le32-unknown
+ os=-nacl
+ ;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
@@ -764,6 +910,12 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -794,6 +946,14 @@ case $basic_machine in
basic_machine=i860-intel
os=-osf
;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
pbd)
basic_machine=sparc-tti
;;
@@ -803,6 +963,12 @@ case $basic_machine in
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
@@ -832,9 +998,10 @@ case $basic_machine in
;;
power) basic_machine=power-ibm
;;
- ppc) basic_machine=powerpc-unknown
+ ppc | ppcbe) basic_machine=powerpc-unknown
;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ppc-* | ppcbe-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
@@ -859,6 +1026,14 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
@@ -885,6 +1060,10 @@ case $basic_machine in
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
sei)
basic_machine=mips-sei
os=-seiux
@@ -896,6 +1075,9 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
sh64)
basic_machine=sh64-unknown
;;
@@ -917,6 +1099,9 @@ case $basic_machine in
basic_machine=i860-stratus
os=-sysv4
;;
+ strongarm-* | thumb-*)
+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
sun2)
basic_machine=m68000-sun
;;
@@ -973,17 +1158,9 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
- tic54x | c54x*)
- basic_machine=tic54x-unknown
- os=-coff
- ;;
- tic55x | c55x*)
- basic_machine=tic55x-unknown
- os=-coff
- ;;
- tic6x | c6x*)
- basic_machine=tic6x-unknown
- os=-coff
+ tile*)
+ basic_machine=$basic_machine-unknown
+ os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
@@ -1052,6 +1229,9 @@ case $basic_machine in
xps | xps100)
basic_machine=xps100-honeywell
;;
+ xscale-* | xscalee[bl]-*)
+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+ ;;
ymp)
basic_machine=ymp-cray
os=-unicos
@@ -1060,6 +1240,10 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
none)
basic_machine=none-none
os=-none
@@ -1098,10 +1282,10 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
- sparc | sparcv8 | sparcv9 | sparcv9b)
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun
;;
cydra)
@@ -1145,9 +1329,12 @@ esac
if [ x"$os" != x"" ]
then
case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
+ # First match some system type aliases
+ # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
@@ -1168,27 +1355,31 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
+ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1227,7 +1418,7 @@ case $os in
-opened*)
os=-openedition
;;
- -os400*)
+ -os400*)
os=-os400
;;
-wince*)
@@ -1276,7 +1467,7 @@ case $os in
-sinix*)
os=-sysv4
;;
- -tpf*)
+ -tpf*)
os=-tpf
;;
-triton*)
@@ -1318,6 +1509,11 @@ case $os in
-zvmoe)
os=-zvmoe
;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -nacl*)
+ ;;
-none)
;;
*)
@@ -1340,6 +1536,12 @@ else
# system, and we'll never get to this point.
case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
*-acorn)
os=-riscix1.2
;;
@@ -1349,9 +1551,21 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ hexagon-*)
+ os=-elf
+ ;;
+ tic54x-*)
+ os=-coff
+ ;;
+ tic55x-*)
+ os=-coff
+ ;;
+ tic6x-*)
+ os=-coff
+ ;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
@@ -1370,13 +1584,13 @@ case $basic_machine in
;;
m68000-sun)
os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
;;
m68*-cisco)
os=-aout
;;
+ mep-*)
+ os=-elf
+ ;;
mips*-cisco)
os=-elf
;;
@@ -1401,7 +1615,7 @@ case $basic_machine in
*-ibm)
os=-aix
;;
- *-knuth)
+ *-knuth)
os=-mmixware
;;
*-wec)
@@ -1506,7 +1720,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
- -aix*)
+ -cnk*|-aix*)
vendor=ibm
;;
-beos*)
diff --git a/configure b/configure
index 15df28d..8bdcd01 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.69 for tophat 2.0.14.
+# Generated by GNU Autoconf 2.69 for tophat 2.1.0.
#
# Report bugs to <tophat.cufflinks at gmail.com>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='tophat'
PACKAGE_TARNAME='tophat'
-PACKAGE_VERSION='2.0.14'
-PACKAGE_STRING='tophat 2.0.14'
+PACKAGE_VERSION='2.1.0'
+PACKAGE_STRING='tophat 2.1.0'
PACKAGE_BUGREPORT='tophat.cufflinks at gmail.com'
PACKAGE_URL=''
@@ -1304,7 +1304,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 tophat 2.0.14 to adapt to many kinds of systems.
+\`configure' configures tophat 2.1.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1374,7 +1374,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tophat 2.0.14:";;
+ short | recursive ) echo "Configuration of tophat 2.1.0:";;
esac
cat <<\_ACEOF
@@ -1484,7 +1484,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tophat configure 2.0.14
+tophat configure 2.1.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1945,7 +1945,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 tophat $as_me 2.0.14, which was
+It was created by tophat $as_me 2.1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2294,7 +2294,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-$as_echo "#define SVN_REVISION \"4318\"" >>confdefs.h
+$as_echo "#define SVN_REVISION \"exported\"" >>confdefs.h
@@ -2777,7 +2777,7 @@ fi
# Define the identity of the package.
PACKAGE='tophat'
- VERSION='2.0.14'
+ VERSION='2.1.0'
cat >>confdefs.h <<_ACEOF
@@ -6925,7 +6925,7 @@ fi
# Define the identity of the package.
PACKAGE='tophat'
- VERSION='2.0.14'
+ VERSION='2.1.0'
cat >>confdefs.h <<_ACEOF
@@ -7868,7 +7868,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by tophat $as_me 2.0.14, which was
+This file was extended by tophat $as_me 2.1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7934,7 +7934,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-tophat config.status 2.0.14
+tophat config.status 2.1.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index d61ff2d..00a673c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
define([svnversion], esyscmd([sh -c "svnversion|tr -d '\n'"]))dnl
-AC_INIT([tophat],[2.0.14],[tophat.cufflinks at gmail.com])
+AC_INIT([tophat],[2.1.0],[tophat.cufflinks at gmail.com])
AC_DEFINE(SVN_REVISION, "svnversion", [SVN Revision])
AC_CONFIG_SRCDIR([config.h.in])
diff --git a/depcomp b/depcomp
index 04701da..e1f51f4 100755
--- a/depcomp
+++ b/depcomp
@@ -1,9 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2005-07-09.11
+scriptversion=2012-07-12.20; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,9 +16,7 @@ scriptversion=2005-07-09.11
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -29,7 +27,7 @@ scriptversion=2005-07-09.11
case $1 in
'')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
@@ -41,11 +39,11 @@ as side-effects.
Environment variables:
depmode Dependency tracking mode.
- source Source file read by `PROGRAMS ARGS'.
- object Object file output by `PROGRAMS ARGS'.
+ source Source file read by 'PROGRAMS ARGS'.
+ object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
- tmpdepfile Temporary file to use when outputing dependencies.
+ tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake at gnu.org>.
@@ -58,6 +56,12 @@ EOF
;;
esac
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
@@ -70,6 +74,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
@@ -86,12 +93,48 @@ if test "$depmode" = dashXmstdout; then
depmode=dashmstdout
fi
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
+fi
+
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
- "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
stat=$?
if test $stat -eq 0; then :
else
@@ -102,13 +145,17 @@ gcc3)
;;
gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-## -MM, not -M (despite what the docs say).
+## -MM, not -M (despite what the docs say). Also, it might not be
+## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
@@ -127,20 +174,21 @@ gcc)
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
+## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
- tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'. On the theory
+ tr ' ' "$nl" < "$tmpdepfile" |
+## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
-## well.
+## well. hp depmode also adds that space, but also prefixes the VPATH
+## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -172,20 +220,17 @@ sgi)
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
- # the IRIX cc adds comments like `#:fec' to the end of the
+ # the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
- tr ' ' '
-' < "$tmpdepfile" \
+ tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
- tr '
-' ' ' >> $depfile
- echo >> $depfile
+ tr "$nl" ' ' >> "$depfile"
+ echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
- tr ' ' '
-' < "$tmpdepfile" \
+ tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
- >> $depfile
+ >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -195,40 +240,51 @@ sgi)
rm -f "$tmpdepfile"
;;
+xlc)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
- # current directory. Also, the AIX compiler puts `$object:' at the
+ # current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
- stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
- tmpdepfile="$stripped.u"
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
- if test -f "$tmpdepfile"; then :
- else
- stripped=`echo "$stripped" | sed 's,^.*/,,'`
- tmpdepfile="$stripped.u"
- fi
-
if test $stat -eq 0; then :
else
- rm -f "$tmpdepfile"
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
if test -f "$tmpdepfile"; then
- outname="$stripped.o"
- # Each line is of the form `foo.o: dependent.h'.
+ # Each line is of the form 'foo.o: dependent.h'.
# Do two passes, one to just change these to
- # `$object: dependent.h' and one to simply `dependent.h:'.
- sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
- sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -239,23 +295,26 @@ aix)
;;
icc)
- # Intel's C compiler understands `-MD -MF file'. However on
- # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
+ # However on
+ # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
- # which is wrong. We want:
+ # which is wrong. We want
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
- # and will wrap long lines using \ :
+ # and will wrap long lines using '\':
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
-
+ # tcc 0.9.26 (FIXME still under development at the moment of writing)
+ # will emit a similar output, but also prepend the continuation lines
+ # with horizontal tabulation characters.
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
@@ -264,6 +323,85 @@ icc)
exit $stat
fi
rm -f "$depfile"
+ # Each line is of the form 'foo.o: dependent.h',
+ # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
+ < "$tmpdepfile" > "$depfile"
+ sed '
+ s/[ '"$tab"'][ '"$tab"']*/ /g
+ s/^ *//
+ s/ *\\*$//
+ s/^[^:]*: *//
+ /^$/d
+ /:$/d
+ s/$/ :/
+ ' < "$tmpdepfile" >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file. A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+ # Portland's C compiler understands '-MD'.
+ # Will always output deps to 'file.d' where file is the root name of the
+ # source file under compilation, even if file resides in a subdirectory.
+ # The object file name does not affect the name of the '.d' file.
+ # pgcc 10.2 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using '\' :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ # Use the source, not the object, to determine the base name, since
+ # that's sadly what pgcc will do too.
+ base=`echo "$source" | sed -e 's|^.*/||' -e 's/\.[-_a-zA-Z0-9]*$//'`
+ tmpdepfile="$base.d"
+
+ # For projects that build the same source file twice into different object
+ # files, the pgcc approach of using the *source* file root name can cause
+ # problems in parallel builds. Use a locking strategy to avoid stomping on
+ # the same $tmpdepfile.
+ lockdir="$base.d-lock"
+ trap "echo '$0: caught signal, cleaning up...' >&2; rm -rf $lockdir" 1 2 13 15
+ numtries=100
+ i=$numtries
+ while test $i -gt 0 ; do
+ # mkdir is a portable test-and-set.
+ if mkdir $lockdir 2>/dev/null; then
+ # This process acquired the lock.
+ "$@" -MD
+ stat=$?
+ # Release the lock.
+ rm -rf $lockdir
+ break
+ else
+ ## the lock is being held by a different process,
+ ## wait until the winning process is done or we timeout
+ while test -d $lockdir && test $i -gt 0; do
+ sleep 1
+ i=`expr $i - 1`
+ done
+ fi
+ i=`expr $i - 1`
+ done
+ trap - 1 2 13 15
+ if test $i -le 0; then
+ echo "$0: failed to acquire lock after $numtries attempts" >&2
+ echo "$0: check lockdir '$lockdir'" >&2
+ exit 1
+ fi
+
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
@@ -276,11 +414,56 @@ icc)
rm -f "$tmpdepfile"
;;
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add 'dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
- # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
- # dependencies in `foo.d' instead, so we check for that too.
+ # dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
@@ -288,13 +471,13 @@ tru64)
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
- # static library. This mecanism is used in libtool 1.4 series to
+ # static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
- # compilations output dependencies in in $dir.libs/$base.o.d and
+ # compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
@@ -326,14 +509,59 @@ tru64)
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- # That's a tab and a space in the [].
- sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test "$stat" = 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/'"$tab"'/
+ G
+ p
+}' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
@@ -345,13 +573,13 @@ dashmstdout)
# Remove the call to Libtool.
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
- # Remove `-o $object'.
+ # Remove '-o $object'.
IFS=" "
for arg
do
@@ -371,15 +599,14 @@ dashmstdout)
done
test -z "$dashmflag" && dashmflag=-M
- # Require at least two characters before searching for `:'
+ # Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
- # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
- sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
- tr ' ' '
-' < "$tmpdepfile" | \
+ tr ' ' "$nl" < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -396,38 +623,46 @@ makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
- cleared=no
- for arg in "$@"; do
+ cleared=no eat=no
+ for arg
+ do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
- obj_suffix="`echo $object | sed 's/^.*\././'`"
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
- cat < "$tmpdepfile" > "$depfile"
- sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
+ # makedepend may prepend the VPATH from the source file name to the object.
+ # No need to regex-escape $object, excess matching of '.' is harmless.
+ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -441,13 +676,13 @@ cpp)
# Remove the call to Libtool.
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
- # Remove `-o $object'.
+ # Remove '-o $object'.
IFS=" "
for arg
do
@@ -479,13 +714,27 @@ cpp)
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
- # always write the preprocessed file to stdout, regardless of -o,
- # because we must use -o when running libtool.
+ # always write the preprocessed file to stdout.
"$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
IFS=" "
for arg
do
case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
@@ -498,16 +747,23 @@ msvisualcpp)
;;
esac
done
- "$@" -E |
- sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
- echo " " >> "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+ echo "$tab" >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
none)
exec "$@"
;;
@@ -526,5 +782,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/install-sh b/install-sh
index 4d4a951..377bb86 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2005-05-14.22
+scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,42 +35,72 @@ scriptversion=2005-05-14.22
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
-# put in absolute paths if you don't have them in your path; or use env. vars.
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
-chmodcmd="$chmodprog 0755"
-chowncmd=
chgrpcmd=
-stripcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
rmcmd="$rmprog -f"
-mvcmd="$mvprog"
+stripcmd=
+
src=
dst=
dir_arg=
-dstarg=
+dst_arg=
+
+copy_on_change=false
no_target_directory=
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
@@ -80,108 +110,148 @@ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--c (ignored)
--d create directories instead of installing files.
--g GROUP $chgrpprog installed files to GROUP.
--m MODE $chmodprog installed files to MODE.
--o USER $chownprog installed files to USER.
--s $stripprog installed files.
--t DIRECTORY install into DIRECTORY.
--T report an error if DSTFILE is a directory.
---help display this help and exit.
---version display version info and exit.
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
Environment variables override the default commands:
- CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
"
-while test -n "$1"; do
+while test $# -ne 0; do
case $1 in
- -c) shift
- continue;;
+ -c) ;;
+
+ -C) copy_on_change=true;;
- -d) dir_arg=true
- shift
- continue;;
+ -d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
+ shift;;
--help) echo "$usage"; exit $?;;
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
-o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
+ shift;;
- -s) stripcmd=$stripprog
- shift
- continue;;
+ -s) stripcmd=$stripprog;;
- -t) dstarg=$2
- shift
- shift
- continue;;
+ -t) dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
- -T) no_target_directory=true
- shift
- continue;;
+ -T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
- *) # When -d is used, all remaining arguments are directories to create.
- # When -t is used, the destination is already specified.
- test -n "$dir_arg$dstarg" && break
- # Otherwise, the last argument is the destination. Remove it from $@.
- for arg
- do
- if test -n "$dstarg"; then
- # $@ is not empty: it contains at least $arg.
- set fnord "$@" "$dstarg"
- shift # fnord
- fi
- shift # arg
- dstarg=$arg
- done
+ --) shift
break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
esac
+ shift
done
-if test -z "$1"; then
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
+
+if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
- # It's OK to call `install-sh -d' without argument.
+ # It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
for src
do
- # Protect names starting with `-'.
+ # Protect names problematic for 'test' and other utilities.
case $src in
- -*) src=./$src ;;
+ -* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
- src=
-
- if test -d "$dst"; then
- mkdircmd=:
- chmodcmd=
- else
- mkdircmd=$mkdirprog
- fi
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
else
+
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
@@ -190,71 +260,194 @@ do
exit 1
fi
- if test -z "$dstarg"; then
+ if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
-
- dst=$dstarg
- # Protect names starting with `-'.
- case $dst in
- -*) dst=./$dst ;;
- esac
+ dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
- echo "$0: $dstarg: Is a directory" >&2
+ echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
- dst=$dst/`basename "$src"`
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
fi
fi
- # This sed command emulates the dirname command.
- dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
- # Make sure that the destination directory exists.
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
- # Skip lots of stat calls in the usual case.
- if test ! -d "$dstdir"; then
- defaultIFS='
- '
- IFS="${IFS-$defaultIFS}"
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
- oIFS=$IFS
- # Some sh's can't handle IFS=/ for some reason.
- IFS='%'
- set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
- shift
- IFS=$oIFS
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
- pathcomp=
+ eval "$initialize_posix_glob"
- while test $# -ne 0 ; do
- pathcomp=$pathcomp$1
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
shift
- if test ! -d "$pathcomp"; then
- $mkdirprog "$pathcomp"
- # mkdir can fail with a `File exist' error in case several
- # install-sh are creating the directory concurrently. This
- # is OK.
- test -d "$pathcomp" || exit
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
fi
- pathcomp=$pathcomp/
- done
+ fi
fi
if test -n "$dir_arg"; then
- $doit $mkdircmd "$dst" \
- && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
- && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
- && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
- && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
-
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
- dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
@@ -262,10 +455,9 @@ do
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
- trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
- $doit $cpprog "$src" "$dsttmp" &&
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
@@ -273,51 +465,63 @@ do
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
- { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
- && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
- && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
- && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
-
- # Now rename the file to the real destination.
- { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
- || {
- # The rename failed, perhaps because mv can't rename something else
- # to itself, or perhaps because mv is so ancient that it does not
- # support -f.
-
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- if test -f "$dstdir/$dstfile"; then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
- || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
- || {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit 1
- }
- else
- :
- fi
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
- }
- }
- fi || { (exit 1); exit 1; }
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
done
-# The final little trick to "correctly" pass the exit status to the exit trap.
-{
- (exit 0); exit 0
-}
-
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/missing b/missing
index 894e786..9a55648 100755
--- a/missing
+++ b/missing
@@ -1,10 +1,9 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2005-06-08.21
+scriptversion=2012-01-06.18; # UTC
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -18,9 +17,7 @@ scriptversion=2005-06-08.21
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -28,13 +25,15 @@ scriptversion=2005-06-08.21
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-# In the cases where this matters, `missing' is being run in the
+# In the cases where this matters, 'missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
@@ -44,7 +43,7 @@ fi
msg="missing on your system"
-case "$1" in
+case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
@@ -65,7 +64,7 @@ case "$1" in
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
@@ -74,17 +73,20 @@ Options:
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- automake touch all \`Makefile.in' files
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
- flex create \`lex.yy.c', if possible, from existing .c
+ aclocal touch file 'aclocal.m4'
+ autoconf touch file 'configure'
+ autoheader touch file 'config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all 'Makefile.in' files
+ bison create 'y.tab.[ch]', if possible, from existing .[ch]
+ flex create 'lex.yy.c', if possible, from existing .c
help2man touch the output file
- lex create \`lex.yy.c', if possible, from existing .c
+ lex create 'lex.yy.c', if possible, from existing .c
makeinfo touch the output file
- tar try tar, gnutar, gtar, then tar without non-portable flags
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+ yacc create 'y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
Send bug reports to <bug-automake at gnu.org>."
exit $?
@@ -96,37 +98,35 @@ Send bug reports to <bug-automake at gnu.org>."
;;
-*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "$0: Unknown '$1' option"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
-# the program).
-case "$1" in
- lex|yacc)
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
- tar)
- if test -n "$run"; then
- echo 1>&2 "ERROR: \`tar' requires --run"
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- exit 1
- fi
- ;;
-
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
- # running `$TOOL --version' or `$TOOL --help' to check whether
+ # running '$TOOL --version' or '$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
@@ -135,36 +135,36 @@ esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
-case "$1" in
+case $program in
aclocal*)
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acinclude.m4' or \`${configure_ac}'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
+WARNING: '$1' is $msg. You should only need it if
+ you modified 'acinclude.m4' or '${configure_ac}'. You might want
+ to install the Automake and Perl packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
- autoconf)
+ autoconf*)
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`${configure_ac}'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+WARNING: '$1' is $msg. You should only need it if
+ you modified '${configure_ac}'. You might want to install the
+ Autoconf and GNU m4 packages. Grab them from any GNU
archive site."
touch configure
;;
- autoheader)
+ autoheader*)
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acconfig.h' or \`${configure_ac}'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
+WARNING: '$1' is $msg. You should only need it if
+ you modified 'acconfig.h' or '${configure_ac}'. You might want
+ to install the Autoconf and GNU m4 packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
- case "$f" in
+ case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
@@ -175,25 +175,25 @@ WARNING: \`$1' is $msg. You should only need it if
automake*)
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
- You might want to install the \`Automake' and \`Perl' packages.
+WARNING: '$1' is $msg. You should only need it if
+ you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'.
+ You might want to install the Automake and Perl packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
- autom4te)
+ autom4te*)
echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
+WARNING: '$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
- You can get \`$1' as part of \`Autoconf' from any GNU
+ You can get '$1' as part of Autoconf from any GNU
archive site."
- file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
- test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
@@ -207,93 +207,97 @@ WARNING: \`$1' is needed, but is $msg.
fi
;;
- bison|yacc)
+ bison*|yacc*)
echo 1>&2 "\
-WARNING: \`$1' $msg. You should only need it if
- you modified a \`.y' file. You may need the \`Bison' package
+WARNING: '$1' $msg. You should only need it if
+ you modified a '.y' file. You may need the Bison package
in order for those modifications to take effect. You can get
- \`Bison' from any GNU archive site."
+ Bison from any GNU archive site."
rm -f y.tab.c y.tab.h
- if [ $# -ne 1 ]; then
- eval LASTARG="\${$#}"
- case "$LASTARG" in
+ if test $# -ne 1; then
+ eval LASTARG=\${$#}
+ case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if [ -f "$SRCFILE" ]; then
+ if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if [ -f "$SRCFILE" ]; then
+ if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
- if [ ! -f y.tab.h ]; then
+ if test ! -f y.tab.h; then
echo >y.tab.h
fi
- if [ ! -f y.tab.c ]; then
+ if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
- lex|flex)
+ lex*|flex*)
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.l' file. You may need the \`Flex' package
+WARNING: '$1' is $msg. You should only need it if
+ you modified a '.l' file. You may need the Flex package
in order for those modifications to take effect. You can get
- \`Flex' from any GNU archive site."
+ Flex from any GNU archive site."
rm -f lex.yy.c
- if [ $# -ne 1 ]; then
- eval LASTARG="\${$#}"
- case "$LASTARG" in
+ if test $# -ne 1; then
+ eval LASTARG=\${$#}
+ case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if [ -f "$SRCFILE" ]; then
+ if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
- if [ ! -f lex.yy.c ]; then
+ if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
- help2man)
+ help2man*)
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
+WARNING: '$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
- \`Help2man' package in order for those modifications to take
- effect. You can get \`Help2man' from any GNU archive site."
+ Help2man package in order for those modifications to take
+ effect. You can get Help2man from any GNU archive site."
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
- fi
- if [ -f "$file" ]; then
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
- exit 1
+ exit $?
fi
;;
- makeinfo)
+ makeinfo*)
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.texi' or \`.texinfo' file, or any other file
+WARNING: '$1' is $msg. You should only need it if
+ you modified a '.texi' or '.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
+ call might also be the consequence of using a buggy 'make' (AIX,
+ DU, IRIX). You might want to install the Texinfo package or
+ the GNU make package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
@@ -303,49 +307,14 @@ WARNING: \`$1' is $msg. You should only need it if
touch $file
;;
- tar)
- shift
-
- # We have already tried tar in the generic part.
- # Look for gnutar/gtar before invocation to avoid ugly error
- # messages.
- if (gnutar --version > /dev/null 2>&1); then
- gnutar "$@" && exit 0
- fi
- if (gtar --version > /dev/null 2>&1); then
- gtar "$@" && exit 0
- fi
- firstarg="$1"
- if shift; then
- case "$firstarg" in
- *o*)
- firstarg=`echo "$firstarg" | sed s/o//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- case "$firstarg" in
- *h*)
- firstarg=`echo "$firstarg" | sed s/h//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- fi
-
- echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
- You may want to install GNU tar or Free paxutils, or check the
- command line arguments."
- exit 1
- ;;
-
*)
echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
+WARNING: '$1' is needed, and is $msg.
You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
+ proper tools for further handling them. Check the 'README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
+ some other package would contain this missing '$1' program."
exit 1
;;
esac
@@ -356,5 +325,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/src/GBase.cpp b/src/GBase.cpp
index 4af86ff..4671e42 100644
--- a/src/GBase.cpp
+++ b/src/GBase.cpp
@@ -1,7 +1,6 @@
#include "GBase.h"
#include <stdarg.h>
#include <ctype.h>
-#include <sys/stat.h>
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
@@ -56,8 +55,13 @@ void GAssert(const char* expression, const char* filename, unsigned int lineno){
char msg[4096];
sprintf(msg,"%s(%d): ASSERT(%s) failed.\n",filename,lineno,expression);
fprintf(stderr,"%s",msg);
- //abort();
- }
+ #ifdef DEBUG
+ // modify here if you [don't] want a core dump
+ abort();
+ #endif
+ exit(1);
+}
+
// Error routine (prints error message and exits!)
void GError(const char* format,...){
#ifdef __WIN32__
@@ -166,7 +170,7 @@ char* newEmptyStr() {
char* Gstrdup(const char* sfrom, const char* sto) {
if (sfrom==NULL || sto==NULL) return NULL;
char *copy=NULL;
- if (sfrom[0]==0) return newEmptyStr();
+ if (sfrom[0]==0 || sto<sfrom) return newEmptyStr();
GMALLOC(copy, sto-sfrom+2);
strncpy(copy, sfrom, sto-sfrom+1);
copy[sto-sfrom+1]=0;
@@ -184,6 +188,69 @@ int Gstrcmp(const char* a, const char* b, int n) {
}
+int G_mkdir(const char* path, int perms=0775) {
+ #ifdef __WIN32__
+ return _mkdir(path);
+ #else
+ //#if _POSIX_C_SOURCE
+ // return ::mkdir(path);
+ //#else
+ return mkdir(path, perms); // not sure if this works on mac
+ //#endif
+ #endif
+}
+
+
+int Gmkdir(const char *path, bool recursive, int perms) {
+ if (path==NULL || path[0]==0) return -1;
+ if (!recursive) return G_mkdir(path, perms);
+ int plen=strlen(path);
+ char* gpath=NULL;
+ //make sure gpath ends with /
+ if (path[plen-1]=='/') {
+ gpath=Gstrdup(path);
+ }
+ else {
+ GMALLOC(gpath, plen+2);
+ strcpy(gpath,path);
+ gpath[plen]='/';
+ gpath[plen+1]=0;
+ }
+ char* ss=gpath;
+ char* psep = NULL;
+ while (*ss!=0 && (psep=strchr(ss, '/'))!=NULL) {
+ *psep=0; //now gpath is the path up to this /
+ ss=psep; ++ss; //ss repositioned just after the /
+ // create current level
+ if (fileExists(gpath)!=1 && G_mkdir(gpath, perms)!=0) {
+ GFREE(gpath);
+ return -1;
+ }
+ *psep='/';
+ }
+ GFREE(gpath);
+ return 0;
+}
+
+bool GstrEq(const char* a, const char* b) {
+ if (a==NULL || b==NULL) return false;
+ register int i=0;
+ while (a[i]==b[i]) {
+ if (a[i]==0) return true;
+ ++i;
+ }
+ return false;
+}
+
+bool GstriEq(const char* a, const char* b) {
+ if (a==NULL || b==NULL) return false;
+ register int i=0;
+ while (tolower((unsigned char)a[i])==tolower((unsigned char)b[i])) {
+ if (a[i]==0) return true;
+ }
+ return false;
+}
+
int Gstricmp(const char* a, const char* b, int n) {
if (a==NULL || b==NULL) return a==NULL ? -1 : 1;
register int ua, ub;
@@ -492,7 +559,7 @@ char* strifind(const char* str, const char* substr) {
char* p=(char*)str;
while (p<=smax) {
for (i=0; i<l && tolower(*(p+i))==tolower(*(substr+i)); i++) ;
- if (i==l) return p; //found!
+ if (i==l) return p;
p++;
}
return NULL;
@@ -508,6 +575,14 @@ bool startsWith(const char* s, const char* prefix) {
return (prefix[i]=='\0');
}
+bool startsiWith(const char* s, const char* prefix) {
+ if (prefix==NULL || s==NULL) return false;
+ int i=0;
+ while (prefix[i]!='\0' && tolower(prefix[i])==tolower(s[i])) i++;
+ return (prefix[i]=='\0');
+ }
+
+
// tests if string s ends with given suffix
bool endsWith(const char* s, const char* suffix) {
if (suffix==NULL || s==NULL) return false;
@@ -773,5 +848,5 @@ char* commaprintnum(uint64 n) {
n /= 10;
i++;
} while(n != 0);
- return p;
+ return Gstrdup(p);
}
diff --git a/src/GBase.h b/src/GBase.h
index aaf06fd..ec50000 100644
--- a/src/GBase.h
+++ b/src/GBase.h
@@ -21,6 +21,7 @@
#define __WIN32__
#endif
#include <windows.h>
+ #include <direct.h>
#include <io.h>
#define CHPATHSEP '\\'
#undef off_t
@@ -43,10 +44,6 @@
#ifdef _ftelli64
#define ftello(stream) _ftelli64(stream)
#else
- /*
- #define _DEFINE_WIN32_FTELLO
- off_t ftello(FILE *stream);
- */
#define ftello ftell
#endif
#endif
@@ -64,6 +61,8 @@
#ifdef DEBUG
#undef NDEBUG
+#define _DEBUG 1
+#define _DEBUG_ 1
#endif
typedef int32_t int32;
@@ -172,6 +171,9 @@ inline int iround(double x) {
return (int)floor(x + 0.5);
}
+int Gmkdir(const char *path, bool recursive=true, int perms=0775);
+
+
/****************************************************************************/
inline int Gintcmp(int a, int b) {
@@ -183,6 +185,8 @@ int Gstrcmp(const char* a, const char* b, int n=-1);
//same as strcmp but doesn't crash on NULL pointers
int Gstricmp(const char* a, const char* b, int n=-1);
+bool GstrEq(const char* a, const char* b);
+bool GstriEq(const char* a, const char* b);
//basic swap template function
template<class T> void Gswap(T& lhs, T& rhs) {
@@ -257,14 +261,17 @@ char* rstrstr(const char* rstart, const char *lend, const char* substr);
a pointer to the last (right) matching character in str */
char* strifind(const char* str, const char* substr);
-// the case insensitive version of strstr -- finding a string within a strin
-
+// case insensitive version of strstr -- finding a string within another string
+// returns NULL if not found
//Determines if a string begins with a given prefix
//(returns false when any of the params is NULL,
// but true when prefix is '' (empty string)!)
bool startsWith(const char* s, const char* prefix);
+bool startsiWith(const char* s, const char* prefix); //case insensitive
+
+
bool endsWith(const char* s, const char* suffix);
//Note: returns true if suffix is empty string, but false if it's NULL
diff --git a/src/GHash.hh b/src/GHash.hh
index 5122e1d..41ef229 100644
--- a/src/GHash.hh
+++ b/src/GHash.hh
@@ -326,6 +326,7 @@ template <class OBJ> OBJ* GHash<OBJ>::Replace(const char* ky,const OBJ* pdata,
template <class OBJ> OBJ* GHash<OBJ>::Remove(const char* ky){
register int p,x,h,n;
if(!ky){ GError("GHash::remove: NULL key argument.\n"); }
+ OBJ* removed=NULL;
if(0<fCount){
h=strhash(ky);
GASSERT(0<=h);
@@ -342,18 +343,19 @@ template <class OBJ> OBJ* GHash<OBJ>::Remove(const char* ky){
hash[p].mark=false;
if (hash[p].keyalloc) GFREE((hash[p].key));
if (FREEDATA) (*fFreeProc)(hash[p].data);
+ else removed=(OBJ*)hash[p].data;
hash[p].key=NULL;
hash[p].data=NULL;
fCount--;
if((100*fCount)<=(MIN_LOAD*fCapacity)) Resize(fCount);
GASSERT(fCount<fCapacity);
- return NULL;
+ return removed;
}
p=(p+x)%fCapacity;
n--;
}
}
- return NULL;
+ return removed;
}
diff --git a/src/GList.hh b/src/GList.hh
index 13e0729..886b930 100644
--- a/src/GList.hh
+++ b/src/GList.hh
@@ -86,7 +86,8 @@ template <class OBJ> class GList:public GPVec<OBJ> {
else return 0;
}
public:
- void sortInsert(int idx, OBJ* item);
+ void sortInsert(int idx, OBJ* item); //special insert in sorted lists
+ //WARNING: the caller must know the insert index such that the sort order is preserved!
GList(GCompareProc* compareProc=NULL); //free by default
GList(GCompareProc* compareProc, //unsorted by default
GFreeProc *freeProc,
@@ -110,7 +111,7 @@ template <class OBJ> class GList:public GPVec<OBJ> {
}
else fCompareProc=NULL;
}
- int Add(OBJ* item); //-- specific implementation if sorted
+ int Add(OBJ* item); //-- specific implementation if sorted - may become an Insert()
void Add(GList<OBJ>& list); //add all pointers from another list
OBJ* AddIfNew(OBJ* item, bool deleteIfFound=true, int* fidx=NULL);
@@ -588,7 +589,7 @@ template <class OBJ> bool GList<OBJ>::Found(OBJ* item, int& idx) {
template <class OBJ> void GList<OBJ>::sortInsert(int idx, OBJ* item) {
//idx must be the new position this new item must have
//so the allowed range is [0..fCount]
- //the old idx item all the above will be shifted to idx+1
+ //the current fList[idx] and all the above will be shifted +1
if (idx<0 || idx>this->fCount) GError(GVEC_INDEX_ERR, idx);
if (this->fCount==this->fCapacity) {
GPVec<OBJ>::Grow(idx, item);
diff --git a/src/GVec.hh b/src/GVec.hh
index 25b095c..7b9800b 100644
--- a/src/GVec.hh
+++ b/src/GVec.hh
@@ -29,6 +29,7 @@ template<class T> struct IsPrimitiveType {
template<> struct IsPrimitiveType<bool> { enum { VAL = 1 }; };
template<> struct IsPrimitiveType<void*> { enum { VAL = 1 }; };
+template<> struct IsPrimitiveType<char*> { enum { VAL = 1 }; };
template<> struct IsPrimitiveType<float> { enum { VAL = 1 }; };
template<> struct IsPrimitiveType<double> { enum { VAL = 1 }; };
@@ -73,7 +74,8 @@ template <class OBJ> class GVec {
public:
GVec(int init_capacity=2);
GVec(int init_count, const OBJ init_val);
- GVec(GVec<OBJ>& array); //copy constructor
+ GVec(int init_count, OBJ* init_val, bool delete_initval=true); //convenience constructor for complex vectors
+ GVec(const GVec<OBJ>& array); //copy constructor
const GVec<OBJ>& operator=(GVec<OBJ>& array); //copy operator
virtual ~GVec();
void Insert(int idx, OBJ item) { Insert(idx, &item); }
@@ -206,6 +208,7 @@ template <class OBJ> GVec<OBJ>::GVec(int init_capacity) {
fCapacity=0;
fArray=NULL;
setCapacity(init_capacity);
+ //if (set_count) fCount = init_capacity;
}
@@ -219,8 +222,19 @@ template <class OBJ> GVec<OBJ>::GVec(int init_count, const OBJ init_val) {
fArray[i]=init_val;
}
+template <class OBJ> GVec<OBJ>::GVec(int init_count, OBJ* init_val, bool delete_initval) {
+ fCount=0;
+ fCapacity=0;
+ fArray=NULL;
+ setCapacity(init_count);
+ fCount = init_count;
+ for (int i=0;i<fCount;i++)
+ fArray[i]=*init_val;
+ if (delete_initval) { delete init_val; }
+}
+
-template <class OBJ> GVec<OBJ>::GVec(GVec<OBJ>& array) { //copy constructor
+template <class OBJ> GVec<OBJ>::GVec(const GVec<OBJ>& array) { //copy constructor
this->fCount=array.fCount;
this->fCapacity=array.fCapacity;
this->fArray=NULL;
@@ -232,7 +246,7 @@ template <class OBJ> GVec<OBJ>::GVec(GVec<OBJ>& array) { //copy constructor
else {
fArray=new OBJ[this->fCapacity]; //]()
// uses OBJ operator=
- for (int i=0;i<this->fCount;i++) fArray[i]=array[i];
+ for (int i=0;i<this->fCount;i++) fArray[i]=array.fArray[i];
}
}
this->fCount=array.fCount;
@@ -741,7 +755,6 @@ template <class OBJ> void GPVec<OBJ>::Grow(int idx, OBJ* newitem) {
}
template <class OBJ> int GPVec<OBJ>::IndexOf(pointer item) {
- int result=-1;
for (int i=0;i<fCount;i++) {
if (item==(pointer)fList[i]) return i;
}
diff --git a/src/align_status.cpp b/src/align_status.cpp
old mode 100755
new mode 100644
diff --git a/src/align_status.h b/src/align_status.h
old mode 100755
new mode 100644
diff --git a/src/common.cpp b/src/common.cpp
index acb1fea..750e8cb 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -672,7 +672,7 @@ int parse_options(int argc, char** argv, void (*print_usage)())
fusion_multireads = parseIntOpt(1, "--fusion-multireads must be at least 1", print_usage);
break;
case OPT_FUSION_MULTIPAIRS:
- fusion_multipairs = parseIntOpt(1, "--fusion-multipairs must be at least 0", print_usage);
+ fusion_multipairs = parseIntOpt(1, "--fusion-multipairs must be at least 1", print_usage);
break;
case OPT_FUSION_IGNORE_CHROMOSOMES:
tokenize(optarg, ",", fusion_ignore_chromosomes);
diff --git a/src/common.h b/src/common.h
index 5e601e1..6f92ec0 100644
--- a/src/common.h
+++ b/src/common.h
@@ -9,6 +9,7 @@
*
*/
#include <stdint.h>
+#include <unistd.h>
#include <cassert>
#include <cstring>
#include <cstdlib>
diff --git a/src/deletions.cpp b/src/deletions.cpp
old mode 100755
new mode 100644
diff --git a/src/deletions.h b/src/deletions.h
old mode 100755
new mode 100644
diff --git a/src/fusions.cpp b/src/fusions.cpp
old mode 100755
new mode 100644
index ec61d01..839d9da
--- a/src/fusions.cpp
+++ b/src/fusions.cpp
@@ -555,7 +555,7 @@ void pair_support(const vector<pair<BowtieHit, BowtieHit> >& best_hits, FusionSe
// int inner_dist = max_report_intron_length * 2;
- const int range = min((int)fusion_min_dist, 10000);
+ const int range = min((int)fusion_min_dist, (1<<16));
int inner_dist = range;
int outer_dist = range * 2;
int max_dist = range * 2;
diff --git a/src/fusions.h b/src/fusions.h
old mode 100755
new mode 100644
diff --git a/src/gff.cpp b/src/gff.cpp
index eed6bb5..d485aae 100644
--- a/src/gff.cpp
+++ b/src/gff.cpp
@@ -1,6 +1,5 @@
#include "gff.h"
-//GffNames* GffReader::names=NULL;
GffNames* GffObj::names=NULL;
//global set of feature names, attribute names etc.
// -- common for all GffObjs in current application!
@@ -130,40 +129,25 @@ char* GffLine::extractAttr(const char* attr, bool caseStrict, bool enforce_GTF2)
return r;
}
-static char fnamelc[128];
-GffLine::GffLine(GffReader* reader, const char* l) {
+
+GffLine::GffLine(GffReader* reader, const char* l):_parents(NULL), _parents_len(0),
+ dupline(NULL), line(NULL), llen(0), gseqname(NULL), track(NULL),
+ ftype(NULL), info(NULL), fstart(0), fend(0), qstart(0), qend(0), qlen(0),
+ score(0), strand(0), flags(0), exontype(0), phase(0),
+ gene_name(NULL), gene_id(NULL),
+ parents(NULL), num_parents(0), ID(NULL) {
llen=strlen(l);
GMALLOC(line,llen+1);
memcpy(line, l, llen+1);
GMALLOC(dupline, llen+1);
memcpy(dupline, l, llen+1);
- skip=true;
- gseqname=NULL;
- track=NULL;
- ftype=NULL;
- info=NULL;
- _parents=NULL;
- _parents_len=0;
- num_parents=0;
- parents=NULL;
- is_gff3=false;
- is_cds=false;
- is_transcript=false;
- is_exon=false;
- is_gene=false;
- exontype=0;
- gene_id=NULL;
- gene_name=NULL;
- qstart=0;
- qend=0;
- qlen=0;
- ID=NULL;
+ skipLine=1; //reset only if it reaches the end of this function
char* t[9];
int i=0;
int tidx=1;
t[0]=line;
-
+ char fnamelc[128];
while (line[i]!=0) {
if (line[i]=='\t') {
line[i]=0;
@@ -206,239 +190,243 @@ GffLine::GffLine(GffReader* reader, const char* l) {
if (strand!='+' && strand!='-' && strand!='.')
GError("Error parsing strand (%c) from GFF line:\n%s\n",strand,l);
phase=*t[7]; // must be '.', '0', '1' or '2'
- ID=NULL;
// exon/CDS/mrna filter
strncpy(fnamelc, ftype, 127);
fnamelc[127]=0;
strlower(fnamelc); //convert to lower case
bool is_t_data=false;
if (strstr(fnamelc, "utr")!=NULL) {
- exontype=exgffUTR;
- is_exon=true;
- is_t_data=true;
- }
- else if (endsWith(fnamelc, "exon")) {
- exontype=exgffExon;
- is_exon=true;
- is_t_data=true;
- }
- else if (strstr(fnamelc, "stop") &&
- (strstr(fnamelc, "codon") || strstr(fnamelc, "cds"))){
- exontype=exgffStop;
- is_cds=true; //though some place it outside the last CDS segment
- is_t_data=true;
- }
- else if (strstr(fnamelc, "start") &&
- ((strstr(fnamelc, "codon")!=NULL) || strstr(fnamelc, "cds")!=NULL)){
- exontype=exgffStart;
- is_cds=true;
- is_t_data=true;
- }
+ exontype=exgffUTR;
+ is_exon=true;
+ is_t_data=true;
+ }
+ else if (endsWith(fnamelc, "exon")) {
+ exontype=exgffExon;
+ is_exon=true;
+ is_t_data=true;
+ }
+ else if (strstr(fnamelc, "stop") &&
+ (strstr(fnamelc, "codon") || strstr(fnamelc, "cds"))){
+ exontype=exgffStop;
+ is_cds=true; //though some place it outside the last CDS segment
+ is_t_data=true;
+ }
+ else if (strstr(fnamelc, "start") &&
+ ((strstr(fnamelc, "codon")!=NULL) || strstr(fnamelc, "cds")!=NULL)){
+ exontype=exgffStart;
+ is_cds=true;
+ is_t_data=true;
+ }
else if (strcmp(fnamelc, "cds")==0) {
- exontype=exgffCDS;
- is_cds=true;
- is_t_data=true;
- }
+ exontype=exgffCDS;
+ is_cds=true;
+ is_t_data=true;
+ }
else if (startsWith(fnamelc, "intron") || endsWith(fnamelc, "intron")) {
exontype=exgffIntron;
}
+ else if (endsWith(fnamelc,"rna") || endsWith(fnamelc,"transcript")) { // || startsWith(fnamelc+1, "rna")) {
+ is_transcript=true;
+ is_t_data=true;
+ }
else if (endsWith(fnamelc, "gene") || startsWith(fnamelc, "gene")) {
- is_gene=true;
- is_t_data=true; //because its name will be attached to parented transcripts
- }
- else if (endsWith(fnamelc,"rna") || endsWith(fnamelc,"transcript")) {
- is_transcript=true;
- is_t_data=true;
- }
+ is_gene=true;
+ is_t_data=true; //because its name will be attached to parented transcripts
+ }
-if (reader->transcriptsOnly && !is_t_data) {
- char* id=extractAttr("ID=");
- if (id==NULL) id=extractAttr("transcript_id");
- //GMessage("Discarding non-transcript line:\n%s\n",l);
- if (id!=NULL) {
- reader->discarded_ids.Add(id, new int(1));
- GFREE(id);
- }
- return; //skip this line, unwanted feature name
- }
ID=extractAttr("ID=",true);
+ if (reader->transcriptsOnly && !is_t_data) {
+ //can_discard=1;
+ if (ID!=NULL) {
+ //ban GFF3 parent if not recognized as transcript
+ reader->discarded_ids.Add(ID, new int(1));
+ GFREE(ID);
+ }
+ //skip non-transcript recognized features
+ return;
+ }
char* Parent=extractAttr("Parent=",true);
is_gff3=(ID!=NULL || Parent!=NULL);
if (is_gff3) {
- //parse as GFF3
- if (ID!=NULL) {
- //has ID attr so it's likely to be a parent feature
- //look for explicit gene name
- gene_name=extractAttr("gene_name=");
- if (gene_name==NULL) {
- gene_name=extractAttr("geneName=");
- if (gene_name==NULL) {
- gene_name=extractAttr("gene_sym=");
- if (gene_name==NULL) {
- gene_name=extractAttr("gene=");
- }
- }
- }
- gene_id=extractAttr("geneID=");
- if (gene_id==NULL) {
- gene_id=extractAttr("gene_id=");
- }
- if (is_gene) {
- //special case: keep the Name and ID attributes of the gene feature
- if (gene_name==NULL)
- gene_name=extractAttr("Name=");
- if (gene_id==NULL) //the ID is also gene_id in this case
- gene_id=Gstrdup(ID);
- //skip=false;
- //return;
- GFREE(Parent); //TMI, we really don't care about gene Parents?
- } //gene feature
- }// has GFF3 ID
- if (Parent!=NULL) {
- //keep Parent attr
- //parse multiple parents
- num_parents=1;
- p=Parent;
- int last_delim_pos=-1;
- while (*p!=';' && *p!=0) {
- if (*p==',' && *(p+1)!=0 && *(p+1)!=';') {
- num_parents++;
- last_delim_pos=(p-Parent);
- }
- p++;
- }
- _parents_len=p-Parent+1;
- _parents=Parent;
- GMALLOC(parents, num_parents*sizeof(char*));
- parents[0]=_parents;
- int i=1;
- if (last_delim_pos>0) {
- for (p=_parents+1;p<=_parents+last_delim_pos;p++) {
- if (*p==',') {
- char* ep=p-1;
- while (*ep==' ' && ep>_parents) ep--;
- *(ep+1)=0; //end the string there
- parents[i]=p+1;
- i++;
- }
- }
- }
- } //has Parent field
- } //GFF3
- else { // GTF-like expected
- Parent=extractAttr("transcript_id",true);
- if (Parent!=NULL) { //GTF2 format detected
- if (is_transcript) {
- // atypical GTF with a parent transcript line declared
- ID=Parent;
- Parent=NULL;
- }
- gene_id=extractAttr("gene_id"); // for GTF this is the only attribute accepted as geneID
- if (gene_id==NULL)
- gene_id=extractAttr("geneid");
- gene_name=extractAttr("gene_name");
- if (gene_name==NULL) {
-
- gene_name=extractAttr("gene_sym");
- if (gene_name==NULL) {
- gene_name=extractAttr("gene");
- if (gene_name==NULL)
- gene_name=extractAttr("genesymbol");
- }
- }
- //prepare for parseAttr by adding '=' character instead of spaces for all attributes
- //after the attribute name
- p=info;
- bool noed=true; //not edited after the last delim
- bool nsp=false; //non-space found after last delim
- while (*p!=0) {
- if (*p==' ') {
- if (nsp && noed) {
- *p='=';
- noed=false;
- p++;
- continue;
- }
- }
- else nsp=true; //non-space
- if (*p==';') { noed=true; nsp=false; }
- p++;
- }
- } //GTF2 detected (no parent line)
- else {// Parent is NULL, check for jigsaw format or other pre-GTF2 format
- //char* fexon=strstr(fnamelc, "exon");
- //if (fexon!=NULL) {
- if (exontype==exgffExon) {
- if (startsWith(track,"jigsaw")) {
- is_cds=true;
- strcpy(track,"jigsaw");
- p=strchr(info,';');
- if (p==NULL) { Parent=Gstrdup(info); info=NULL; }
- else { Parent=Gstrdup(info,p-1);
- info=p+1;
- }
- }
- } //exon feature?
- if (Parent==NULL && exontype>=exgffCDS &&
- (i=strcspn(info,"; \t\n\r"))<=(int)(strlen(info)+1)) {
- //one word ID ? really desperate attempt to parse it here
- Parent=Gstrdup(info,info+i-1);
- info=NULL; //discard anything else on the line
- }
- }
- if (Parent!=NULL) { //GTF transcript_id for exon/CDS feature
- _parents=Parent;
- GMALLOC(parents,sizeof(char*));
- num_parents=1;
- parents[0]=_parents;
- }
- } //GTF-like
+ //parse as GFF3
+ if (ID!=NULL) {
+ //has ID attr so it's likely to be a parent feature
+ //look for explicit gene name
+ gene_name=extractAttr("gene_name=");
+ if (gene_name==NULL) {
+ gene_name=extractAttr("geneName=");
+ if (gene_name==NULL) {
+ gene_name=extractAttr("gene_sym=");
+ if (gene_name==NULL) {
+ gene_name=extractAttr("gene=");
+ }
+ }
+ }
+ gene_id=extractAttr("geneID=");
+ if (gene_id==NULL) {
+ gene_id=extractAttr("gene_id=");
+ }
+ if (is_gene) { //WARNING: this might be mislabeled (e.g. TAIR: "mRNA_TE_gene")
+ //special case: keep the Name and ID attributes of the gene feature
+ if (gene_name==NULL)
+ gene_name=extractAttr("Name=");
+ if (gene_id==NULL) //the ID is also gene_id in this case
+ gene_id=Gstrdup(ID);
+ //skip=false;
+ //return;
+ //-- we don't care about gene parents.. unless it's a mislabeled "gene" feature
+ //GFREE(Parent);
+ } //gene feature (probably)
+ }// has GFF3 ID
+ if (Parent!=NULL) {
+ //keep Parent attr
+ //parse multiple parents
+ num_parents=1;
+ p=Parent;
+ int last_delim_pos=-1;
+ while (*p!=';' && *p!=0) {
+ if (*p==',' && *(p+1)!=0 && *(p+1)!=';') {
+ num_parents++;
+ last_delim_pos=(p-Parent);
+ }
+ p++;
+ }
+ _parents_len=p-Parent+1;
+ _parents=Parent;
+ GMALLOC(parents, num_parents*sizeof(char*));
+ parents[0]=_parents;
+ int i=1;
+ if (last_delim_pos>0) {
+ for (p=_parents+1;p<=_parents+last_delim_pos;p++) {
+ if (*p==',') {
+ char* ep=p-1;
+ while (*ep==' ' && ep>_parents) ep--;
+ *(ep+1)=0; //end the string there
+ parents[i]=p+1;
+ i++;
+ }
+ }
+ }
+ } //has Parent field
+ } //GFF3
+ else { // GTF-like expected
+ if (reader->transcriptsOnly && !is_t_data) {
+ return; //skipping unrecognized non-transcript feature
+ }
+ Parent=extractAttr("transcript_id",true);
+ if (Parent!=NULL) { //GTF2 format detected
+ if (is_transcript) {
+ // atypical GTF with a parent transcript line declared
+ ID=Parent;
+ Parent=NULL;
+ }
+ gene_id=extractAttr("gene_id"); // for GTF this is the only attribute accepted as geneID
+ if (gene_id==NULL)
+ gene_id=extractAttr("geneid");
+ gene_name=extractAttr("gene_name");
+ if (gene_name==NULL) {
+ gene_name=extractAttr("gene_sym");
+ if (gene_name==NULL) {
+ gene_name=extractAttr("gene");
+ if (gene_name==NULL)
+ gene_name=extractAttr("genesymbol");
+ }
+ }
+ //prepare for parseAttr by adding '=' character instead of spaces for all attributes
+ //after the attribute name
+ p=info;
+ bool noed=true; //not edited after the last delim
+ bool nsp=false; //non-space found after last delim
+ while (*p!=0) {
+ if (*p==' ') {
+ if (nsp && noed) {
+ *p='=';
+ noed=false;
+ p++;
+ continue;
+ }
+ }
+ else nsp=true; //non-space
+ if (*p==';') { noed=true; nsp=false; }
+ p++;
+ }
+ } //GTF2 detected (no parent line)
+ else {// Parent is NULL, check for jigsaw format or other pre-GTF2 format
+ //char* fexon=strstr(fnamelc, "exon");
+ //if (fexon!=NULL) {
+ if (exontype==exgffExon) {
+ if (startsWith(track,"jigsaw")) {
+ is_cds=true;
+ strcpy(track,"jigsaw");
+ p=strchr(info,';');
+ if (p==NULL) { Parent=Gstrdup(info); info=NULL; }
+ else { Parent=Gstrdup(info,p-1);
+ info=p+1;
+ }
+ }
+ } //exon feature?
+ if (Parent==NULL) {
+ //something is very wrong here, cannot parse the GTF ID
+ if (is_transcript || exontype)
+ GMessage("Warning: invalid GTF record, transcript_id not found:\n%s\n",
+ l);
+ else return; //skip unrecognized GTF line (from GTF we only care about transcripts for now)
+
+ }
+ } //Parent was NULL, attempted to find it
+ if (Parent!=NULL) { //GTF transcript_id for exon/CDS feature
+ _parents=Parent;
+ GMALLOC(parents,sizeof(char*));
+ num_parents=1;
+ parents[0]=_parents;
+ }
+ } //GTF-like
//parse other potentially useful features
if (is_gff3) {
- if ((p=strstr(info,"Target="))!=NULL) { //has Target attr
- p+=7;
- while (*p!=';' && *p!=0 && *p!=' ') p++;
- if (*p!=' ') {
- GError("Error parsing target coordinates from GFF line:\n%s\n",l);
- }
- if (!parseUInt(p,qstart))
- GError("Error parsing target start coordinate from GFF line:\n%s\n",l);
- if (*p!=' ') {
- GError("Error parsing next target coordinate from GFF line:\n%s\n",l);
- }
- p++;
- if (!parseUInt(p,qend))
- GError("Error parsing target end coordinate from GFF line:\n%s\n",l);
- }
- if ((p=strifind(info,"Qreg="))!=NULL) { //has Qreg attr
- p+=5;
- if (!parseUInt(p,qstart))
- GError("Error parsing target start coordinate from GFF line:\n%s\n",l);
- if (*p!='-') {
- GError("Error parsing next target coordinate from GFF line:\n%s\n",l);
- }
- p++;
- if (!parseUInt(p,qend))
- GError("Error parsing target end coordinate from GFF line:\n%s\n",l);
- if (*p=='|' || *p==':') {
- p++;
- if (!parseUInt(p,qlen))
- GError("Error parsing target length from GFF Qreg|: \n%s\n",l);
- }
- }//has Qreg attr
- if (qlen==0 && (p=strifind(info,"Qlen="))!=NULL) {
- p+=5;
- if (!parseUInt(p,qlen))
- GError("Error parsing target length from GFF Qlen:\n%s\n",l);
- }
- }//parsing some useful attributes in GFF3 records
+ if ((p=strstr(info,"Target="))!=NULL) { //has Target attr
+ p+=7;
+ while (*p!=';' && *p!=0 && *p!=' ') p++;
+ if (*p!=' ') {
+ GError("Error parsing target coordinates from GFF line:\n%s\n",l);
+ }
+ if (!parseUInt(p,qstart))
+ GError("Error parsing target start coordinate from GFF line:\n%s\n",l);
+ if (*p!=' ') {
+ GError("Error parsing next target coordinate from GFF line:\n%s\n",l);
+ }
+ p++;
+ if (!parseUInt(p,qend))
+ GError("Error parsing target end coordinate from GFF line:\n%s\n",l);
+ }
+ if ((p=strifind(info,"Qreg="))!=NULL) { //has Qreg attr
+ p+=5;
+ if (!parseUInt(p,qstart))
+ GError("Error parsing target start coordinate from GFF line:\n%s\n",l);
+ if (*p!='-') {
+ GError("Error parsing next target coordinate from GFF line:\n%s\n",l);
+ }
+ p++;
+ if (!parseUInt(p,qend))
+ GError("Error parsing target end coordinate from GFF line:\n%s\n",l);
+ if (*p=='|' || *p==':') {
+ p++;
+ if (!parseUInt(p,qlen))
+ GError("Error parsing target length from GFF Qreg|: \n%s\n",l);
+ }
+ }//has Qreg attr
+ if (qlen==0 && (p=strifind(info,"Qlen="))!=NULL) {
+ p+=5;
+ if (!parseUInt(p,qlen))
+ GError("Error parsing target length from GFF Qlen:\n%s\n",l);
+ }
+ }//parsing some useful attributes in GFF3 records
if (ID==NULL && parents==NULL) {
- if (reader->gff_warns)
- GMessage("Warning: could not parse ID or Parent from GFF line:\n%s\n",dupline);
- return; //skip
- }
- skip=false;
+ if (reader->gff_warns)
+ GMessage("Warning: could not parse ID or Parent from GFF line:\n%s\n",dupline);
+ return; //skip
+ }
+ skipLine=0;
}
@@ -626,9 +614,10 @@ int GffObj::addExon(uint segstart, uint segend, double sc, char fr, int qs, int
*/
if ((ovlen>2 || ovlen==0) || exons[oi]->exontype!=exgffCDS || exontype!=exgffCDS) {
- if (gff_show_warnings)
+ /*if (gff_show_warnings)
GMessage("GFF Warning: merging overlapping/adjacent feature segment %s (%d-%d) with %s (%d-%d) for GFF ID %s on %s\n",
strExonType(exontype), segstart, segend, strExonType(exons[oi]->exontype), exons[oi]->start, exons[oi]->end, gffID, getGSeqName());
+ */
expandExon(oi, segstart, segend, exontype, sc, fr, qs, qe);
return oi;
}
@@ -882,11 +871,14 @@ GffLine* GffReader::nextGffLine() {
if (l==NULL) {
return NULL; //end of file
}
+#ifdef CUFFLINKS
+ _crc_result.process_bytes( linebuf, llen );
+#endif
int ns=0; //first nonspace position
while (l[ns]!=0 && isspace(l[ns])) ns++;
if (l[ns]=='#' || llen<10) continue;
gffline=new GffLine(this, l);
- if (gffline->skip) {
+ if (gffline->skipLine) {
delete gffline;
gffline=NULL;
continue;
@@ -936,30 +928,40 @@ GffObj* GffReader::gfoAdd(GPVec<GffObj>& glst, GffObj* gfo) {
return glst[i];
}
-GffObj* GffReader::gfoFind(const char* id, const char* ctg,
- GPVec<GffObj>** glst, char strand, uint start, uint end) {
- GPVec<GffObj>* gl=phash.Find(id);
- GffObj* gh=NULL;
- if (gl) {
- for (int i=0;i<gl->Count();i++) {
- GffObj& gfo = *(gl->Get(i));
- if (ctg!=NULL && strcmp(ctg, gfo.getGSeqName())!=0)
- continue;
- if (strand && gfo.strand!='.' && strand != gfo.strand)
- continue;
- if (start>0) {
- if (abs((int)start-(int)gfo.start)> (int)GFF_MAX_LOCUS)
- continue;
- if (end>0 && (gfo.start>end || gfo.end<start))
- continue;
- }
- //must be the same transcript, according to given comparison criteria
- gh=&gfo;
- break;
- }
- }
- if (glst) *glst=gl;
- return gh;
+bool GffReader::pFind(const char* id, GPVec<GffObj>*& glst) {
+ glst = phash.Find(id);
+ return (glst!=NULL);
+}
+
+GffObj* GffReader::gfoFind(const char* id, GPVec<GffObj>*& glst,
+ const char* ctg, char strand, uint start, uint end) {
+ GPVec<GffObj>* gl=NULL;
+ if (glst) {
+ gl=glst;
+ } else {
+ gl = phash.Find(id);
+ }
+ GffObj* gh=NULL;
+ if (gl) {
+ for (int i=0;i<gl->Count();i++) {
+ GffObj& gfo = *(gl->Get(i));
+ if (ctg!=NULL && strcmp(ctg, gfo.getGSeqName())!=0)
+ continue;
+ if (strand && gfo.strand!='.' && strand != gfo.strand)
+ continue;
+ if (start>0) {
+ if (abs((int)start-(int)gfo.start)> (int)GFF_MAX_LOCUS)
+ continue;
+ if (end>0 && (gfo.start>end || gfo.end<start))
+ continue;
+ }
+ //must be the same transcript, according to given comparison criteria
+ gh=&gfo;
+ break;
+ }
+ }
+ if (!glst) glst=gl;
+ return gh;
}
/*
GffObj* GffReader::replaceGffRec(GffLine* gffline, bool keepAttr, bool noExonAttr, int replaceidx) {
@@ -1107,150 +1109,166 @@ GffObj* GffReader::promoteFeature(CNonExon* subp, char*& subp_name, GHash<CNonEx
// *** BUT (exception): proximal xRNA features with the same ID, on the same strand, will be merged
// and the segments will be treated like exons (e.g. TRNAR15 (rna1940) in RefSeq)
void GffReader::readAll(bool keepAttr, bool mergeCloseExons, bool noExonAttr) {
- bool validation_errors = false;
- //loc_debug=false;
- GHash<CNonExon> pex; //keep track of any "exon"-like features that have an ID
- //and thus could become promoted to parent features
- while (nextGffLine()!=NULL) {
- GffObj* prevseen=NULL;
- GPVec<GffObj>* prevgflst=NULL;
- if (gffline->ID && gffline->exontype==0) {
- //>> for a parent-like IDed feature (mRNA, gene, etc.)
- //look for same ID on the same chromosome/strand/locus
- prevseen=gfoFind(gffline->ID, gffline->gseqname, &prevgflst, gffline->strand, gffline->fstart);
- if (prevseen!=NULL) {
+ bool validation_errors = false;
+ //loc_debug=false;
+ GHash<CNonExon> pex; //keep track of any "exon"-like features that have an ID
+ //and thus could become promoted to parent features
+ while (nextGffLine()!=NULL) {
+ GffObj* prevseen=NULL;
+ GPVec<GffObj>* prevgflst=NULL;
+ if (gffline->ID && gffline->exontype==0) {
+ //>> for a parent-like IDed feature (mRNA, gene, etc.)
+ //look for same ID on the same chromosome/strand/locus
+ prevseen=gfoFind(gffline->ID, prevgflst, gffline->gseqname, gffline->strand, gffline->fstart);
+ if (prevseen!=NULL) {
//same ID/chromosome combo encountered before
if (prevseen->createdByExon()) {
- if (gff_show_warnings && (prevseen->start<gffline->fstart ||
- prevseen->end>gffline->fend))
- GMessage("GFF Warning: invalid coordinates for %s parent feature (ID=%s)\n", gffline->ftype, gffline->ID);
+ if (gff_show_warnings && (prevseen->start<gffline->fstart ||
+ prevseen->end>gffline->fend))
+ GMessage("GFF Warning: invalid coordinates for %s parent feature (ID=%s)\n", gffline->ftype, gffline->ID);
//an exon of this ID was given before
//this line has the main attributes for this ID
- updateGffRec(prevseen, gffline, keepAttr);
- }
- else {
+ updateGffRec(prevseen, gffline, keepAttr);
+ }
+ else {
//- duplicate ID -- this must be a discontinuous feature according to GFF3 specs
- // e.g. a trans-spliced transcript
- if (prevseen->overlap(gffline->fstart, gffline->fend)) {
- //overlapping with same ID not allowed
- GMessage("GFF Error: duplicate/invalid '%s' feature ID=%s\n", gffline->ftype, gffline->ID);
- //validation_errors = true;
- if (gff_warns) {
- delete gffline;
- gffline=NULL;
- continue;
- }
- else exit(1);
- }
- //create a new entry with the same ID
- int distance=INT_MAX;
- if (prevseen->isTranscript() && prevseen->strand==gffline->strand) {
- if (prevseen->start>=gffline->fstart)
- distance=prevseen->start-gffline->fend;
- else
- distance=gffline->fstart-prevseen->end;
- }
- if (distance<1000) {//FIXME: arbitrary proximity threshold (yuck)
- //exception: make this an exon of previous ID
- //addExonFeature(prevseen, gffline, pex, noExonAttr);
- prevseen->addExon(this, gffline, false, true);
- }
- else { //create a separate entry (true discontinuous feature)
- prevseen=newGffRec(gffline, keepAttr, noExonAttr,
- prevseen->parent, NULL, prevgflst);
- }
- } //duplicate ID on the same chromosome
- } //prevseeen != NULL
- } //parent-like ID feature
- if (gffline->parents==NULL) {//start GFF3-like record with no parent (mRNA, gene)
- if (!prevseen) newGffRec(gffline, keepAttr, noExonAttr, NULL, NULL, prevgflst);
- }
- else { //--- it's a child feature (exon/CDS but could still be a mRNA with gene(s) as parent)
- //updates all the declared parents with this child
- bool found_parent=false;
- GffObj* newgfo=prevseen;
- GPVec<GffObj>* newgflst=NULL;
- for (int i=0;i<gffline->num_parents;i++) {
- if (transcriptsOnly && discarded_ids.Find(gffline->parents[i])!=NULL)
- continue; //skipping discarded parent feature
- GffObj* parentgfo=NULL;
- if (gffline->is_transcript || gffline->exontype==0) {//possibly a transcript
- parentgfo=gfoFind(gffline->parents[i], gffline->gseqname,
- &newgflst, gffline->strand, gffline->fstart, gffline->fend);
- }
- else {
- //for exon-like entities we only need a parent to be in locus distance,
- //on the same strand
- parentgfo=gfoFind(gffline->parents[i], gffline->gseqname,
- &newgflst, gffline->strand, gffline->fstart);
- }
- if (parentgfo!=NULL) { //parent GffObj parsed earlier
- found_parent=true;
- if (parentgfo->isGene() && gffline->is_transcript
- && gffline->exontype==0) {
- //not an exon, but a transcript parented by a gene
- if (newgfo) {
- updateParent(newgfo, parentgfo);
- }
- else {
- newgfo=newGffRec(gffline, keepAttr, noExonAttr, parentgfo);
- }
- }
- else { //potential exon subfeature?
- //always discards dummy "intron" features
- if (!(gffline->exontype==exgffIntron && (parentgfo->isTranscript() || parentgfo->exons.Count()>0))) {
- if (!addExonFeature(parentgfo, gffline, pex, noExonAttr))
- validation_errors=true;
- }
- }
- } //overlapping parent feature found
- } //for each parsed parent Id
- if (!found_parent) { //new GTF-like record starting here with a subfeature directly
- //or it could be some chado GFF3 barf with exons coming BEFORE their parent :(
- //check if this feature isn't parented by a previously stored "exon" subfeature
- char* subp_name=NULL;
- CNonExon* subp=subfPoolCheck(gffline, pex, subp_name);
- if (subp!=NULL) { //found a subfeature that is the parent of this gffline
- //promote that subfeature to a full GffObj
- GffObj* gfoh=promoteFeature(subp, subp_name, pex, keepAttr, noExonAttr);
- //add current gffline as an exon of the newly promoted subfeature
- if (!addExonFeature(gfoh, gffline, pex, noExonAttr))
- validation_errors=true;
- }
- else { //no parent seen before,
- //loc_debug=true;
- GffObj* ngfo=prevseen;
- if (ngfo==NULL) {
- //if it's an exon type, create directly the parent with this exon
- //but if it's recognized as a transcript, the object itself is created
- ngfo=newGffRec(gffline, keepAttr, noExonAttr, NULL, NULL, newgflst);
- }
- if (!ngfo->isTranscript() &&
- gffline->ID!=NULL && gffline->exontype==0)
- subfPoolAdd(pex, ngfo);
- //even those with errors will be added here!
- }
- GFREE(subp_name);
- } //no previous parent found
- } //parented feature
- //--
- delete gffline;
- gffline=NULL;
- }//while gff lines
- if (gflst.Count()>0) {
- gflst.finalize(this, mergeCloseExons, keepAttr, noExonAttr); //force sorting by locus if so constructed
- gseqStats.setCount(gseqstats.Last()->gseqid+1);
- for (int gi=0;gi<gseqstats.Count();gi++) {
- gseqStats.Put(gseqstats[gi]->gseqid, gseqstats[gi]); //copy the pointer only
- }
- }
- // all gff records are now loaded in GList gflst
- // so we can free the hash
- phash.Clear();
- //tids.Clear();
- if (validation_errors) {
- exit(1);
- }
+ // e.g. a trans-spliced transcript
+ if (prevseen->overlap(gffline->fstart, gffline->fend)) {
+ //overlapping with same ID not allowed
+ GMessage("GFF Error: duplicate/invalid '%s' feature ID=%s\n", gffline->ftype, gffline->ID);
+ //validation_errors = true;
+ if (gff_warns) {
+ delete gffline;
+ gffline=NULL;
+ continue;
+ }
+ else exit(1);
+ }
+ //create a new entry with the same ID
+ int distance=INT_MAX;
+ if (prevseen->isTranscript() && prevseen->strand==gffline->strand) {
+ if (prevseen->start>=gffline->fstart)
+ distance=prevseen->start-gffline->fend;
+ else
+ distance=gffline->fstart-prevseen->end;
+ }
+ if (distance<1000) {//FIXME: arbitrary proximity threshold (yuck)
+ //exception: make this an exon of previous ID
+ //addExonFeature(prevseen, gffline, pex, noExonAttr);
+ prevseen->addExon(this, gffline, false, true);
+ }
+ else { //create a separate entry (true discontinuous feature)
+ prevseen=newGffRec(gffline, keepAttr, noExonAttr,
+ prevseen->parent, NULL, prevgflst);
+ }
+ } //duplicate ID on the same chromosome
+ } //prevseeen != NULL
+ } //parent-like ID feature
+ if (gffline->parents==NULL) {//start GFF3-like record with no parent (mRNA, gene)
+ if (!prevseen) newGffRec(gffline, keepAttr, noExonAttr, NULL, NULL, prevgflst);
+ }
+ else { //--- it's a child feature (exon/CDS but could still be a mRNA with gene(s) as parent)
+ //updates all the declared parents with this child
+ bool found_parent=false;
+ GffObj* newgfo=prevseen;
+ GPVec<GffObj>* newgflst=NULL;
+ GVec<int> kparents; //kept parents (non-discarded)
+ GVec< GPVec<GffObj>* > kgflst(false);
+ GPVec<GffObj>* gflst0=NULL;
+ for (int i=0;i<gffline->num_parents;i++) {
+ newgflst=NULL;
+ if (transcriptsOnly && (discarded_ids.Find(gffline->parents[i])!=NULL ||
+ !pFind(gffline->parents[i], newgflst)))
+ continue; //skipping discarded parent feature
+ kparents.Add(i);
+ if (i==0) gflst0=newgflst;
+ kgflst.Add(newgflst);
+ }
+ if (gffline->num_parents>0 && kparents.Count()==0) {
+ kparents.cAdd(0);
+ kgflst.Add(gflst0);
+ }
+ for (int k=0;k<kparents.Count();k++) {
+ int i=kparents[k];
+ newgflst=kgflst[k];
+ GffObj* parentgfo=NULL;
+ if (gffline->is_transcript || gffline->exontype==0) {//possibly a transcript
+ parentgfo=gfoFind(gffline->parents[i], newgflst, gffline->gseqname,
+ gffline->strand, gffline->fstart, gffline->fend);
+ }
+ else {
+ //for exon-like entities we only need a parent to be in locus distance,
+ //on the same strand
+ parentgfo=gfoFind(gffline->parents[i], newgflst, gffline->gseqname,
+ gffline->strand, gffline->fstart);
+ }
+ if (parentgfo!=NULL) { //parent GffObj parsed earlier
+ found_parent=true;
+ if (parentgfo->isGene() && gffline->is_transcript
+ && gffline->exontype==0) {
+ //not an exon, but a transcript parented by a gene
+ if (newgfo) {
+ updateParent(newgfo, parentgfo);
+ }
+ else {
+ newgfo=newGffRec(gffline, keepAttr, noExonAttr, parentgfo);
+ }
+ }
+ else { //potential exon subfeature?
+ //always discards dummy "intron" features
+ if (!(gffline->exontype==exgffIntron && (parentgfo->isTranscript() || parentgfo->exons.Count()>0))) {
+ if (!addExonFeature(parentgfo, gffline, pex, noExonAttr))
+ validation_errors=true;
+ }
+ }
+ } //overlapping parent feature found
+ } //for each parsed parent Id
+ if (!found_parent) { //new GTF-like record starting here with a subfeature directly
+ //or it could be some chado GFF3 barf with exons coming BEFORE their parent :(
+ //check if this feature isn't parented by a previously stored "exon" subfeature
+ char* subp_name=NULL;
+ CNonExon* subp=subfPoolCheck(gffline, pex, subp_name);
+ if (subp!=NULL) { //found a subfeature that is the parent of this gffline
+ //promote that subfeature to a full GffObj
+ GffObj* gfoh=promoteFeature(subp, subp_name, pex, keepAttr, noExonAttr);
+ //add current gffline as an exon of the newly promoted subfeature
+ if (!addExonFeature(gfoh, gffline, pex, noExonAttr))
+ validation_errors=true;
+ }
+ else { //no parent seen before,
+ //loc_debug=true;
+ GffObj* ngfo=prevseen;
+ if (ngfo==NULL) {
+ //if it's an exon type, create directly the parent with this exon
+ //but if it's recognized as a transcript, the object itself is created
+ ngfo=newGffRec(gffline, keepAttr, noExonAttr, NULL, NULL, newgflst);
+ }
+ if (!ngfo->isTranscript() &&
+ gffline->ID!=NULL && gffline->exontype==0)
+ subfPoolAdd(pex, ngfo);
+ //even those with errors will be added here!
+ }
+ GFREE(subp_name);
+ } //no previous parent found
+ } //parented feature
+ //--
+ delete gffline;
+ gffline=NULL;
+ }//while gff lines
+ if (gflst.Count()>0) {
+ gflst.finalize(this, mergeCloseExons, keepAttr, noExonAttr); //force sorting by locus if so constructed
+ gseqStats.setCount(gseqstats.Last()->gseqid+1);
+ for (int gi=0;gi<gseqstats.Count();gi++) {
+ gseqStats.Put(gseqstats[gi]->gseqid, gseqstats[gi]); //copy the pointer only
+ }
+ }
+ // all gff records are now loaded in GList gflst
+ // so we can free the hash
+ phash.Clear();
+ //tids.Clear();
+ if (validation_errors) {
+ exit(1);
+ }
}
void GfList::finalize(GffReader* gfr, bool mergeCloseExons,
diff --git a/src/gff.h b/src/gff.h
index 9522e40..edf2b69 100644
--- a/src/gff.h
+++ b/src/gff.h
@@ -1,6 +1,9 @@
#ifndef GFF_H
#define GFF_H
+//#define CUFFLINKS 1
+
+
#include "GBase.h"
#include "gdna.h"
#include "codons.h"
@@ -8,6 +11,10 @@
#include "GList.hh"
#include "GHash.hh"
+#ifdef CUFFLINKS
+#include <boost/crc.hpp> // for boost::crc_32_type
+#endif
+
/*
const byte exMskMajSpliceL = 0x01;
const byte exMskMajSpliceR = 0x02;
@@ -78,13 +85,22 @@ class GffLine {
uint qlen; //query len, if given
double score;
char strand;
- bool skip;
- bool is_gff3; //if the line appears to be in GFF3 format
- bool is_cds; //"cds" and "stop_codon" features
- bool is_exon; //"exon" and "utr" features
+ union {
+ uint8_t flags;
+ struct {
+ bool is_exonlike:2;
+ };
+ struct {
+ bool is_cds:1; //"cds" or "start/stop_codon" features
+ bool is_exon:1; //"exon" and "utr" features
+ bool is_transcript:1; //if current feature is *RNA or *transcript
+ bool is_gene:1; //if current feature is *gene
+ bool is_gff3:1; //if the line appears to be in GFF3 format
+ bool can_discard:1; //flag unwanted/unrecognized parent features
+ bool skipLine:1;
+ };
+ };
char exontype; // gffExonType
- bool is_transcript; //if current feature is *RNA or *transcript
- bool is_gene; //if current feature is *gene
char phase; // '.' , '0', '1' or '2'
// -- allocated strings:
char* gene_name; //value of gene_name attribute (GTF) if present or Name attribute of a gene feature (GFF3)
@@ -95,66 +111,64 @@ class GffLine {
char* ID; // if a ID=.. attribute was parsed, or a GTF with 'transcript' line (transcript_id)
GffLine(GffReader* reader, const char* l); //parse the line accordingly
void discardParent() {
- GFREE(_parents);
- _parents_len=0;
- num_parents=0;
- parents=NULL;
- }
+ GFREE(_parents);
+ _parents_len=0;
+ num_parents=0;
+ parents=NULL;
+ }
char* extractAttr(const char* pre, bool caseStrict=false, bool enforce_GTF2=false);
GffLine(GffLine* l):_parents(NULL), _parents_len(0),
- dupline(NULL), line(NULL), llen(0), gseqname(NULL), track(NULL),
- ftype(NULL), info(NULL), fstart(0), fend(0), qstart(0), qend(0), qlen(0),
- score(0), strand(0), skip(true), is_gff3(false), is_cds(false), is_exon(false),
- exontype(0), is_transcript(false), is_gene(false), phase(0),
- gene_name(NULL), gene_id(NULL),
- parents(NULL), num_parents(0), ID(NULL) { //a copy constructor
+ dupline(NULL), line(NULL), llen(0), gseqname(NULL), track(NULL),
+ ftype(NULL), info(NULL), fstart(0), fend(0), qstart(0), qend(0), qlen(0),
+ score(0), strand(0), flags(0), exontype(0), phase(0),
+ gene_name(NULL), gene_id(NULL),
+ parents(NULL), num_parents(0), ID(NULL) { //a copy constructor
if (l==NULL || l->line==NULL)
GError("Error: invalid GffLine(l)\n");
- memcpy((void*)this, (void*)l, sizeof(GffLine));
- GMALLOC(line, llen+1);
- memcpy(line, l->line, llen+1);
- GMALLOC(dupline, llen+1);
- memcpy(dupline, l->dupline, llen+1);
- //--offsets within line[]
- gseqname=line+(l->gseqname-l->line);
- track=line+(l->track-l->line);
- ftype=line+(l->ftype-l->line);
- info=line+(l->info-l->line);
- if (num_parents>0 && parents) {
- parents=NULL; //re-init, just copied earlier
- GMALLOC(parents, num_parents*sizeof(char*));
- //_parents_len=l->_parents_len; copied above
- _parents=NULL; //re-init, forget pointer copy
- GMALLOC(_parents, _parents_len);
- memcpy(_parents, l->_parents, _parents_len);
- for (int i=0;i<num_parents;i++) {
- parents[i]=_parents+(l->parents[i] - l->_parents);
- }
- }
- //-- allocated string copies:
- ID=Gstrdup(l->ID);
- if (l->gene_name!=NULL)
- gene_name=Gstrdup(l->gene_name);
- if (l->gene_id!=NULL)
- gene_id=Gstrdup(l->gene_id);
- }
+ memcpy((void*)this, (void*)l, sizeof(GffLine));
+ GMALLOC(line, llen+1);
+ memcpy(line, l->line, llen+1);
+ GMALLOC(dupline, llen+1);
+ memcpy(dupline, l->dupline, llen+1);
+ //--offsets within line[]
+ gseqname=line+(l->gseqname-l->line);
+ track=line+(l->track-l->line);
+ ftype=line+(l->ftype-l->line);
+ info=line+(l->info-l->line);
+ if (num_parents>0 && parents) {
+ parents=NULL; //re-init, just copied earlier
+ GMALLOC(parents, num_parents*sizeof(char*));
+ //_parents_len=l->_parents_len; copied above
+ _parents=NULL; //re-init, forget pointer copy
+ GMALLOC(_parents, _parents_len);
+ memcpy(_parents, l->_parents, _parents_len);
+ for (int i=0;i<num_parents;i++) {
+ parents[i]=_parents+(l->parents[i] - l->_parents);
+ }
+ }
+ //-- allocated string copies:
+ ID=Gstrdup(l->ID);
+ if (l->gene_name!=NULL)
+ gene_name=Gstrdup(l->gene_name);
+ if (l->gene_id!=NULL)
+ gene_id=Gstrdup(l->gene_id);
+ }
GffLine():_parents(NULL), _parents_len(0),
- dupline(NULL), line(NULL), llen(0), gseqname(NULL), track(NULL),
- ftype(NULL), info(NULL), fstart(0), fend(0), qstart(0), qend(0), qlen(0),
- score(0), strand(0), skip(true), is_gff3(false), is_cds(false), is_exon(false),
- exontype(0), is_transcript(false), is_gene(false), phase(0),
- gene_name(NULL), gene_id(NULL),
- parents(NULL), num_parents(0), ID(NULL) {
- }
+ dupline(NULL), line(NULL), llen(0), gseqname(NULL), track(NULL),
+ ftype(NULL), info(NULL), fstart(0), fend(0), qstart(0), qend(0), qlen(0),
+ score(0), strand(0), flags(0), exontype(0), phase(0),
+ gene_name(NULL), gene_id(NULL),
+ parents(NULL), num_parents(0), ID(NULL) {
+ }
~GffLine() {
- GFREE(dupline);
- GFREE(line);
- GFREE(_parents);
- GFREE(parents);
- GFREE(ID);
- GFREE(gene_name);
- GFREE(gene_id);
- }
+ GFREE(dupline);
+ GFREE(line);
+ GFREE(_parents);
+ GFREE(parents);
+ GFREE(ID);
+ GFREE(gene_name);
+ GFREE(gene_id);
+ }
};
class GffAttr {
@@ -1003,13 +1017,17 @@ class GffReader {
GffObj* gfoAdd(GffObj* gfo);
GffObj* gfoAdd(GPVec<GffObj>& glst, GffObj* gfo);
// const char* id, const char* ctg, char strand, GVec<GfoHolder>** glst, uint start, uint end
- GffObj* gfoFind(const char* id, const char* ctg=NULL, GPVec<GffObj>** glst=NULL,
+ bool pFind(const char* id, GPVec<GffObj>*& glst);
+ GffObj* gfoFind(const char* id, GPVec<GffObj>* & glst, const char* ctg=NULL,
char strand=0, uint start=0, uint end=0);
CNonExon* subfPoolCheck(GffLine* gffline, GHash<CNonExon>& pex, char*& subp_name);
void subfPoolAdd(GHash<CNonExon>& pex, GffObj* newgfo);
GffObj* promoteFeature(CNonExon* subp, char*& subp_name, GHash<CNonExon>& pex,
bool keepAttr, bool noExonAttr);
GList<GSeqStat> gseqstats; //list of all genomic sequences seen by this reader, accumulates stats
+#ifdef CUFFLINKS
+ boost::crc_32_type _crc_result;
+#endif
public:
GffNames* names; //just a pointer to the global static Gff names repository in GffObj
GfList gflst; //accumulate GffObjs being read
@@ -1076,7 +1094,9 @@ class GffReader {
// load all subfeatures, re-group them:
void readAll(bool keepAttr=false, bool mergeCloseExons=false, bool noExonAttr=true);
-
+#ifdef CUFFLINKS
+ boost::crc_32_type current_crc_result() const { return _crc_result; }
+#endif
}; // end of GffReader
#endif
diff --git a/src/insertions.cpp b/src/insertions.cpp
old mode 100755
new mode 100644
diff --git a/src/insertions.h b/src/insertions.h
old mode 100755
new mode 100644
diff --git a/src/tophat-fusion-post b/src/tophat-fusion-post
index 6580178..64fb53d 100755
--- a/src/tophat-fusion-post
+++ b/src/tophat-fusion-post
@@ -15,6 +15,8 @@ import string, re
import random
from datetime import datetime, date, time
import math
+from collections import defaultdict
+from intervaltree import Interval, IntervalTree
use_message = '''
TopHat-Fusion
@@ -25,10 +27,10 @@ Usage:
Options:
-v/--version
-o/--output-dir <string> [ default: ./tophatfusion_out ]
- --num_fusion_reads <int> [ default: 3 ]
- --num_fusion_pairs <int> [ default: 2 ]
- --num_fusion_both <int> [ default: 5 ]
-
+ --num-fusion-reads <int> [ default: 3 ]
+ --num-fusion-pairs <int> [ default: 2 ]
+ --num-fusion-both <int> [ default: 5 ]
+ --max-num-fusions <int> [ default: 500 ]
--fusion-read-mismatches <int> [ default: 2 ]
--fusion-multireads <int> [ default: 2 ]
--non-human
@@ -44,6 +46,8 @@ Options:
--skip-html
--tex-table
+
+ --fusion-pair-dist <int> [ default: 250 ]
'''
@@ -64,6 +68,7 @@ class TopHatFusionParams:
self.num_fusion_reads = 3
self.num_fusion_pairs = 2
self.num_fusion_both = 0
+ self.max_num_fusions = 500
self.fusion_read_mismatches = 2
self.fusion_multireads = 2
@@ -81,6 +86,8 @@ class TopHatFusionParams:
self.skip_html = False
self.tex_table = False
+
+ self.fusion_pair_dist = 250
def check(self):
if False:
@@ -95,6 +102,7 @@ class TopHatFusionParams:
"num-fusion-reads=",
"num-fusion-pairs=",
"num-fusion-both=",
+ "max-num-fusions=",
"fusion-read-mismatches=",
"fusion-multireads=",
"non-human",
@@ -105,7 +113,9 @@ class TopHatFusionParams:
"skip-blast",
"skip-read-dist",
"skip-html",
- "tex-table"])
+ "tex-table",
+ "gtf-file=",
+ "fusion-pair-dist="])
except getopt.error, msg:
raise Usage(msg)
@@ -121,6 +131,8 @@ class TopHatFusionParams:
self.num_fusion_pairs = int(value)
if option == "--num-fusion-both":
self.num_fusion_both = int(value)
+ if option == "--max-num-fusions":
+ self.max_num_fusions = int(value)
if option == "--fusion-read-mismatches":
self.fusion_read_mismatches = int(value)
if option == "--fusion-multireads":
@@ -148,6 +160,10 @@ class TopHatFusionParams:
self.skip_html = True
if option == "--tex-table":
self.tex_table = True
+ if option == "--gtf-file":
+ self.GTF_file = value
+ if option == "--fusion-pair-dist":
+ self.fusion_pair_dist = int(value)
if len(args) < 1:
raise Usage(use_message)
@@ -334,7 +350,256 @@ def filter_fusion(bwt_idx_prefix, params):
for chr in chrs:
chr_order[chr] = len(chr_order)
- def filter_fusion_impl(fusion, refGene_list, ensGene_list, seq_chr_dic, fusion_gene_list):
+ ### Compute number of paired reads ###
+ # Helper classes
+ class GeneEntry(object):
+ fields = [('bin', int),
+ ('name', str),
+ ('chrom', str),
+ ('strand', str),
+ ('txStart', int),
+ ('txEnd', int),
+ ('cdsStart', int),
+ ('cdsEnd', int),
+ ('exonCount', int),
+ ('exonStarts', lambda x: [int(y) for y in list(x.split(',')[:-1])]),
+ ('exonEnds', lambda x: [int(y) for y in list(x.split(',')[:-1])]),
+ ('score', int),
+ ('name2', str),
+ ('cdsStartStat', str),
+ ('cdsEndStat', str),
+ ('exonFrames', lambda x: [int(y) for y in list(x.split(',')[:-1])])]
+
+ '''Representation of one line in the refGene.txt file.'''
+ def __init__(self, entry_string):
+ tokens = entry_string.split('\t') # Assumes tab delimited.
+ for (field, type_), token in zip(self.fields, tokens):
+ setattr(self, field, type_(token))
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return str(self)
+
+ class Fusion(object):
+ def __init__(self, info, pairs):
+ # args should be info[:4] from the fusions.out entry
+ # Parse the chromosome string
+ self.chrL, self.chrR = info[0].rstrip().split('-')
+
+ # Fusion positions
+ self.posL = int(info[1])
+ self.posR = int(info[2])
+
+ # Strand
+ self.strandL = info[3][0]
+ self.strandR = info[3][1]
+
+ # Pairs
+ pairs = pairs.rstrip()
+ if pairs:
+ self.pairs = [pair.split(':') for pair in pairs.split(' ')]
+ self.pairs = [(int(p1), int(p2)) for (p1, p2) in self.pairs]
+ else:
+ self.pairs = []
+
+ def get_sign(self, which):
+ switch = which == 'R'
+ strand = self.strandL if which == 'L' else self.strandR
+ if strand == 'r':
+ return -1 if not switch else 1
+ else:
+ return 1 if not switch else -1
+
+ class TransMaps(object):
+ def __init__(self, fusion, juncs):
+ self.fusion = fusion
+ self.chroms = (fusion.chrL, fusion.chrR)
+ self.maps = {}
+ self.starts = {}
+ self.juncs = juncs
+
+ def add_map(self, chrom, start, stop, strand, fusion_pos):
+ self.maps[chrom, strand] = self.compute_transcript_map(chrom, start, stop, strand, fusion_pos)
+ self.starts[chrom, strand] = start
+
+ def map(self, chrom, pos, strand):
+ pos2 = pos - self.starts[chrom,strand]
+ the_map = self.maps[chrom,strand]
+ if pos2 < 0 or pos2 >= len(the_map):
+ # out of bounds - return distance to boundary
+ if pos2 < 0:
+ return the_map[0] - pos2
+ else:
+ return the_map[-1] + (pos2 - len(the_map) + 1)
+ else:
+ # position in the map
+ return the_map[pos2]
+
+ def compute_transcript_map(self, chrom, start, stop, strand, fusion_pos):
+ #return list(range(0, stop-start+1))
+
+ chrom = self.chroms[chrom]
+ w = stop - start + 1
+
+ # Find junctions within the interval
+ # strict=True means that only intervals entirely contained are returned
+ # The junction dict contains both {end: start} and {start: end}
+ junctions = defaultdict(set)
+ for junc in self.juncs[chrom].search(start, stop, strict=True):
+ if junc[2][0] == strand:
+ junctions[junc[1]-start].add(junc[0]-start)
+ junctions[junc[0]-start].add(junc[1]-start)
+
+ # Initialize distance vector
+ distance = [abs(ii-fusion_pos) for ii in range(start, stop+1)]
+
+ # Working out from fusion position, follow junctions
+ # First, get positions in the right order
+ fusii = fusion_pos - start
+ N = len(distance)
+ positions = [fusii]
+ up = 1
+ down = 1
+ while len(positions) < len(distance):
+ if fusii - down >= 0:
+ positions.append(fusii-down)
+ down += 1
+ if fusii + up < N:
+ positions.append(fusii+up)
+ up += 1
+
+ # Second, compute the transcript distance at each position
+ # Skip the first position, which is the fusion break (distance=0)
+ for ii in positions[1:]:
+ ii_ = ii + (1 if fusii-ii >= 0 else -1)
+ if ii in junctions:
+ # If ends of junction are further away, ignore them.
+ # If ends of junction are closer to fusion, shorten distance
+ distance[ii] = min( [distance[ii_]] + [distance[jj] for jj in junctions[ii]
+ if abs(jj-fusii) < abs(ii-fusii)] ) + 1
+ else:
+ distance[ii] = distance[ii_] + 1
+
+ # Re-sign the distances
+ # Users downstream will need to work out fusion arm orientation
+ distance[:fusii] *= -1
+ return distance
+
+ # Helper functions
+ def load_junctions(refgene_file, ensgene_file, juncs_file):
+ def _load(gene_file, _junctions):
+ for line in open(gene_file):
+ entry = GeneEntry(line)
+ # Iterate over introns
+ for start, stop in zip(entry.exonEnds[:-1], entry.exonStarts[1:]):
+ _junctions[entry.chrom].addi(start, stop+1, (entry.strand, 'intron'))
+
+ # junctions are Interval(start, stop, (strand, ...))
+ _junctions = defaultdict(IntervalTree)
+
+ # Load exons from refGene.txt and ensGene.txt
+ if refgene_file is not None:
+ _load(refgene_file, _junctions)
+
+ if ensgene_file is not None:
+ _load(ensgene_file, _junctions)
+
+ # Load junctions from junctions.bed
+ if juncs_file is not None:
+ for line in open(juncs_file):
+ if line[:5] == 'track':
+ continue
+ chrom, start, stop, _, _, strand, _, _, _, _, overhangs, _ = line.split('\t')
+ a,b = overhangs.split(',')
+ _junctions[chrom].addi( int(start)+int(a), int(stop)-int(b)+2, (strand, 'intron') )
+
+ return _junctions
+
+ def get_transcript_maps(fusion, junctions):
+ # Find left side range
+ p1s = [p1 for p1, _ in fusion.pairs]
+ dL = max([0, max(p1s)])
+ dL2 = min([0, min(p1s)])
+
+ s = fusion.get_sign('L')
+ startL = fusion.posL - s*dL
+ endL = fusion.posL - s*dL2
+ if startL > endL:
+ startL, endL = endL, startL
+
+ # Find right side range
+ p2s = [p2 for _, p2 in fusion.pairs]
+ dR = max([0, max(p2s)])
+ dR2 = min([0, min(p2s)])
+
+ s = fusion.get_sign('R')
+ startR = fusion.posR - s*dR
+ endR = fusion.posR - s*dR2
+ if startR > endR:
+ startR, endR = endR, startR
+
+ # Make maps
+ tmaps = TransMaps(fusion, junctions)
+ tmaps.add_map(0, startL, endL, '-', fusion.posL)
+ tmaps.add_map(0, startL, endL, '+', fusion.posL)
+ tmaps.add_map(1, startR, endR, '-', fusion.posR)
+ tmaps.add_map(1, startR, endR, '+', fusion.posR)
+
+ for m in tmaps.maps.values():
+ if len(m)==0:
+ raise Exception()
+
+ return tmaps
+
+ def pick_short(a, b):
+ return a if abs(a) < abs(b) else b
+
+ def convert_pair_distances(fusion, junctions):
+ # Define transcript maps
+ # These map genomic coordinates to transcript coordinates.
+ tmaps = get_transcript_maps(fusion, junctions)
+
+ # Compute inner distances
+ # Because we don't know which strand, we'll take the min of the
+ # transcript distances on each strand.
+ pairs = []
+ for p1, p2 in fusion.pairs:
+ s1 = fusion.get_sign('L')
+ p1 = p1 * s1
+ d1 = s1* pick_short( tmaps.map(0, fusion.posL, '-') - tmaps.map(0, fusion.posL - p1, '-'),
+ tmaps.map(0, fusion.posL, '+') - tmaps.map(0, fusion.posL - p1, '+') )
+
+ s2 = fusion.get_sign('R')
+ p2 = p2 * s2
+ d2 = s2* pick_short( tmaps.map(1, fusion.posR, '-') - tmaps.map(1, fusion.posR - p2, '-'),
+ tmaps.map(1, fusion.posR, '+') - tmaps.map(1, fusion.posR - p2, '+') )
+
+ pairs.append((d1,d2))
+
+ return pairs
+
+ def get_valid_pairs(info, pairs, junctions):
+ # This method converts the distances from spanning pairs to the fusion
+ # from genomic to transcript coordinates - i.e. how far are the pairs
+ # in the processed transcript.
+ # Parse fusion
+ fusion = Fusion(info, pairs)
+
+ if len(fusion.pairs) == 0:
+ return []
+
+ # Convert pairs to transcript coordinates
+ tpairs = convert_pair_distances(fusion, junctions)
+
+ # Return pairs with inner distance less than the threshold
+
+ pairs = [(a,b) for (a,b) in tpairs if abs(a)+abs(b) <= params.fusion_pair_dist]
+ return pairs
+
+ ## Filter fusion implementation ##
+ def filter_fusion_impl(fusion, junctions, refGene_list, ensGene_list, seq_chr_dic, fusion_gene_list):
def gene_exists(gene_list, chr, coord, dir, is_left):
min = 0
max = len(gene_list) - 1
@@ -441,6 +706,7 @@ def filter_fusion(bwt_idx_prefix, params):
fusion_file = open(fusion, 'r')
fusion_file.readline()
for line in fusion_file:
+ # Parse the fusion entry
info, sim, left_seq_org, right_seq_org, left_dist, right_dist, pair_list = line[:-1].split('\t@\t')[:7]
info = info.split('\t')
if sim.strip() == "":
@@ -450,10 +716,18 @@ def filter_fusion(bwt_idx_prefix, params):
right_seq = right_seq_org.replace(' ', '')
num_reads = int(info[4])
- num_pair_ends = int(info[5])
+
+ # Correct the number of spanning pairs by filtering on the inner distance
+ # based on transcript coordinates instead of genomic coordinates
+ pairs = get_valid_pairs(info[:4], pair_list, junctions)
+ num_pair_ends = len(pairs)
+
+ # Format pairs for usage downstream
+ pairs = ['{0}:{1}'.format(a,b) for (a,b) in pairs]
+
num_pair_ends_fusion = int(info[6])
num_pair_ends_both = int(num_pair_ends + num_pair_ends_fusion * 0.5)
- num_unsupport_reads = int(info[7])
+ num_contracting_reads = int(info[7])
left_ext = int(info[8])
right_ext = int(info[9])
sym = float(info[10])
@@ -468,6 +742,7 @@ def filter_fusion(bwt_idx_prefix, params):
else:
single = False
+ # Begin fusion filters
if left_ext < 16 or right_ext < 16:
continue
@@ -483,29 +758,19 @@ def filter_fusion(bwt_idx_prefix, params):
continue
"""
- if (chr1 != chr2 and num_unsupport_reads > num_reads) or \
- (chr1 == chr2 and num_unsupport_reads > all + num_pair_ends + 5):
+ if (chr1 != chr2 and num_contracting_reads > num_reads) or \
+ (chr1 == chr2 and num_contracting_reads > all + num_pair_ends + 5):
continue
"""
- pairs = []
- if num_pair_ends >= 1:
- pairs = pair_list.strip().split()
-
- left, right = pairs[0].split(':')
- if abs(int(left)) + abs(int(right)) > 2000:
- continue
-
- pairs = pairs[:200]
-
# are the sequences around the breakpoint different enough?
if int(sim[0]) < 8:
continue
- # is the reads distributed symmetrically?
+ # are the reads distributed symmetrically?
if sym >= 22 + max(0, 6 - num_reads):
continue
-
+
max_intron_len = 100000
if chr1 == chr2 and dir == "ff":
coord_dif = coord2 - coord1
@@ -616,6 +881,7 @@ def filter_fusion(bwt_idx_prefix, params):
None
fusion_gene = []
+ info[5] = str(num_pair_ends)
fusion_gene.append(sample_name + ' ' + ' '.join(info[:10]))
fusion_gene.append(left_seq_org)
fusion_gene.append(right_seq_org)
@@ -625,7 +891,7 @@ def filter_fusion(bwt_idx_prefix, params):
fusion_gene.append(" ".join(pairs))
fusion_gene_list.append(fusion_gene)
-
+
fusion_file.close()
print >> sys.stderr, "[%s] Filtering fusions" % right_now()
@@ -707,17 +973,35 @@ def filter_fusion(bwt_idx_prefix, params):
if not os.path.exists(fusion_file):
continue
+ juncs_file = file + '/junctions.bed'
+ if not os.path.exists(juncs_file):
+ juncs_file = None
+ print >> sys.stderr, 'Warning: could not find juctions.bed (%s).' % (juncs_file)
+
+ ref_file = "refGene.txt"
+ if not os.path.exists(ref_file):
+ ref_file = None
+
+ ens_file = "ensGene.txt"
+ if not os.path.exists(ens_file):
+ ens_file = None
+
+ if juncs_file is None and ref_file is None and ens_file is None:
+ print >> sys.stderr, 'Warning: neither junctions.bed nor ref/ensGene.txt found.'
+
+ junctions = load_junctions(ref_file, ens_file, juncs_file)
+
print >> sys.stderr, "\tProcessing:", fusion_file
- filter_fusion_impl(fusion_file, refGene_list, ensGene_list, seq_chr_dic, fusion_gene_list)
+ filter_fusion_impl(fusion_file, junctions, refGene_list, ensGene_list, seq_chr_dic, fusion_gene_list)
fusion_out_file = output_dir + "potential_fusion.txt"
- print >> sys.stderr, '\t%d fusions are output in %s' % (len(fusion_gene_list), fusion_out_file)
output_file = open(fusion_out_file, 'w')
for fusion_gene in fusion_gene_list:
for line in fusion_gene:
print >> output_file, line
-
output_file.close()
+ print >> sys.stderr, '\t%d fusions are output in %s' % (len(fusion_gene_list), fusion_out_file)
+
def parallel_work(pids, work):
@@ -1897,8 +2181,7 @@ def generate_html(params):
cluster_temp_list = sorted(cluster_temp_list2, cmp=cmp)
- max_num_fusions = 500
- for i in range(min(max_num_fusions, len(cluster_temp_list))):
+ for i in range(min(params.max_num_fusions, len(cluster_temp_list))):
do_not_add = False
indices = cluster_temp_list[i]["index"]
if not do_not_add:
@@ -2574,12 +2857,6 @@ def which(program):
return None
-def die(msg=None):
- if msg is not None:
- print >> sys.stderr, msg
- sys.exit(1)
-
-
def prog_path(program):
progpath = which(program)
if progpath == None:
@@ -2588,7 +2865,7 @@ def prog_path(program):
def get_version():
- return "2.0.14"
+ return "2.1.0"
def main(argv=None):
diff --git a/src/tophat.py b/src/tophat.py
index 2f4baa9..66eb89e 100755
--- a/src/tophat.py
+++ b/src/tophat.py
@@ -23,7 +23,7 @@ import warnings
import re
import glob
import signal
-from datetime import datetime, date, time
+from datetime import datetime
from shutil import copy, rmtree, move
import logging
@@ -100,7 +100,7 @@ Advanced Options:
--max-segment-intron <int> [ default: 500000 ]
--no-sort-bam (Output BAM is not coordinate-sorted)
--no-convert-bam (Do not output bam format.
- Output is <output_dir>/accepted_hit.sam)
+ Output is <output_dir>/accepted_hits.sam)
--keep-fasta-order
--allow-partial-mapping
@@ -288,8 +288,8 @@ def init_logger(log_fname):
tophat_logger.addHandler(logfh)
tophat_log=logfh.stream
-# TopHatParams captures all of the runtime paramaters used by TopHat, and many
-# of these are passed as command line options to exectubles run by the pipeline
+# TopHatParams captures all of the runtime parameters used by TopHat, and many
+# of these are passed as command line options to executables run by the pipeline
# This class and its nested classes also do options parsing through parse_options()
# and option validation via the member function check()
diff --git a/src/tophat_reports.cpp b/src/tophat_reports.cpp
index 5a0afff..99dddd0 100644
--- a/src/tophat_reports.cpp
+++ b/src/tophat_reports.cpp
@@ -468,7 +468,10 @@ if (lh.insert_id() == 10790262)
}//for j in right mate hits
} //for i in left mate hits
- std::sort(best_hits.begin(), best_hits.end(), cmp_pair_less());
+ {
+ cmp_pair_alignment cmp(final_report ? junctions : gtf_junctions);
+ sort(best_hits.begin(), best_hits.end(), cmp);
+ }
// daehwan - for debugging purposes
#if 0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/tophat.git
More information about the debian-med-commit
mailing list