Browse code

First initial commit of the stats gathering feature

Conflicts:
libclamav/Makefile.am
libclamav/Makefile.in
libclamav/others.c
libclamav/others.h
unit_tests/Makefile.in

Shawn Webb authored on 2013/10/25 23:17:22
Showing 35 changed files
... ...
@@ -1,14 +1,12 @@
1 1
 #! /bin/sh
2 2
 # Attempt to guess a canonical system name.
3
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5
-#   Free Software Foundation, Inc.
3
+#   Copyright 1992-2013 Free Software Foundation, Inc.
6 4
 
7
-timestamp='2009-12-30'
5
+timestamp='2013-05-16'
8 6
 
9 7
 # This file is free software; you can redistribute it and/or modify it
10 8
 # under the terms of the GNU General Public License as published by
11
-# the Free Software Foundation; either version 2 of the License, or
9
+# the Free Software Foundation; either version 3 of the License, or
12 10
 # (at your option) any later version.
13 11
 #
14 12
 # This program is distributed in the hope that it will be useful, but
... ...
@@ -17,26 +15,22 @@ timestamp='2009-12-30'
17 17
 # General Public License for more details.
18 18
 #
19 19
 # You should have received a copy of the GNU General Public License
20
-# along with this program; if not, write to the Free Software
21
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
22
-# 02110-1301, USA.
20
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
23 21
 #
24 22
 # As a special exception to the GNU General Public License, if you
25 23
 # distribute this file as part of a program that contains a
26 24
 # configuration script generated by Autoconf, you may include it under
27
-# the same distribution terms that you use for the rest of that program.
28
-
29
-
30
-# Originally written by Per Bothner.  Please send patches (context
31
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
32
-# entry.
25
+# the same distribution terms that you use for the rest of that
26
+# program.  This Exception is an additional permission under section 7
27
+# of the GNU General Public License, version 3 ("GPLv3").
33 28
 #
34
-# This script attempts to guess a canonical system name similar to
35
-# config.sub.  If it succeeds, it prints the system name on stdout, and
36
-# exits with 0.  Otherwise, it exits with 1.
29
+# Originally written by Per Bothner.
37 30
 #
38 31
 # You can get the latest version of this script from:
39 32
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
33
+#
34
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
35
+
40 36
 
41 37
 me=`echo "$0" | sed -e 's,.*/,,'`
42 38
 
... ...
@@ -56,9 +50,7 @@ version="\
56 56
 GNU config.guess ($timestamp)
57 57
 
58 58
 Originally written by Per Bothner.
59
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
60
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
61
-Software Foundation, Inc.
59
+Copyright 1992-2013 Free Software Foundation, Inc.
62 60
 
63 61
 This is free software; see the source for copying conditions.  There is NO
64 62
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
... ...
@@ -140,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
140 140
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
141 141
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
142 142
 
143
+case "${UNAME_SYSTEM}" in
144
+Linux|GNU|GNU/*)
145
+	# If the system lacks a compiler, then just pick glibc.
146
+	# We could probably try harder.
147
+	LIBC=gnu
148
+
149
+	eval $set_cc_for_build
150
+	cat <<-EOF > $dummy.c
151
+	#include <features.h>
152
+	#if defined(__UCLIBC__)
153
+	LIBC=uclibc
154
+	#elif defined(__dietlibc__)
155
+	LIBC=dietlibc
156
+	#else
157
+	LIBC=gnu
158
+	#endif
159
+	EOF
160
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
161
+	;;
162
+esac
163
+
143 164
 # Note: order is significant - the case branches are not exclusive.
144 165
 
145 166
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
146 167
     *:NetBSD:*:*)
147 168
 	# NetBSD (nbsd) targets should (where applicable) match one or
148
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
169
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
149 170
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
150 171
 	# switched to ELF, *-*-netbsd* would select the old
151 172
 	# object file format.  This provides both forward
... ...
@@ -181,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
181 181
 		fi
182 182
 		;;
183 183
 	    *)
184
-	        os=netbsd
184
+		os=netbsd
185 185
 		;;
186 186
 	esac
187 187
 	# The OS release
... ...
@@ -202,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
202 202
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
203 203
 	echo "${machine}-${os}${release}"
204 204
 	exit ;;
205
+    *:Bitrig:*:*)
206
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
207
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
208
+	exit ;;
205 209
     *:OpenBSD:*:*)
206 210
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
207 211
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
... ...
@@ -224,7 +241,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
224 224
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
225 225
 		;;
226 226
 	*5.*)
227
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
227
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
228 228
 		;;
229 229
 	esac
230 230
 	# According to Compaq, /usr/sbin/psrinfo has been available on
... ...
@@ -270,7 +287,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
270 270
 	# A Xn.n version is an unreleased experimental baselevel.
271 271
 	# 1.2 uses "1.2" for uname -r.
272 272
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
273
-	exit ;;
273
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
274
+	exitcode=$?
275
+	trap '' 0
276
+	exit $exitcode ;;
274 277
     Alpha\ *:Windows_NT*:*)
275 278
 	# How do we know it's Interix rather than the generic POSIX subsystem?
276 279
 	# Should we change UNAME_MACHINE based on the output of uname instead
... ...
@@ -296,12 +316,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
296 296
 	echo s390-ibm-zvmoe
297 297
 	exit ;;
298 298
     *:OS400:*:*)
299
-        echo powerpc-ibm-os400
299
+	echo powerpc-ibm-os400
300 300
 	exit ;;
301 301
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
302 302
 	echo arm-acorn-riscix${UNAME_RELEASE}
303 303
 	exit ;;
304
-    arm:riscos:*:*|arm:RISCOS:*:*)
304
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
305 305
 	echo arm-unknown-riscos
306 306
 	exit ;;
307 307
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
... ...
@@ -395,23 +415,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
395 395
     # MiNT.  But MiNT is downward compatible to TOS, so this should
396 396
     # be no problem.
397 397
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
398
-        echo m68k-atari-mint${UNAME_RELEASE}
398
+	echo m68k-atari-mint${UNAME_RELEASE}
399 399
 	exit ;;
400 400
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
401 401
 	echo m68k-atari-mint${UNAME_RELEASE}
402
-        exit ;;
402
+	exit ;;
403 403
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
404
-        echo m68k-atari-mint${UNAME_RELEASE}
404
+	echo m68k-atari-mint${UNAME_RELEASE}
405 405
 	exit ;;
406 406
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
407
-        echo m68k-milan-mint${UNAME_RELEASE}
408
-        exit ;;
407
+	echo m68k-milan-mint${UNAME_RELEASE}
408
+	exit ;;
409 409
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
410
-        echo m68k-hades-mint${UNAME_RELEASE}
411
-        exit ;;
410
+	echo m68k-hades-mint${UNAME_RELEASE}
411
+	exit ;;
412 412
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
413
-        echo m68k-unknown-mint${UNAME_RELEASE}
414
-        exit ;;
413
+	echo m68k-unknown-mint${UNAME_RELEASE}
414
+	exit ;;
415 415
     m68k:machten:*:*)
416 416
 	echo m68k-apple-machten${UNAME_RELEASE}
417 417
 	exit ;;
... ...
@@ -481,8 +501,8 @@ EOF
481 481
 	echo m88k-motorola-sysv3
482 482
 	exit ;;
483 483
     AViiON:dgux:*:*)
484
-        # DG/UX returns AViiON for all architectures
485
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
484
+	# DG/UX returns AViiON for all architectures
485
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
486 486
 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
487 487
 	then
488 488
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
... ...
@@ -495,7 +515,7 @@ EOF
495 495
 	else
496 496
 	    echo i586-dg-dgux${UNAME_RELEASE}
497 497
 	fi
498
- 	exit ;;
498
+	exit ;;
499 499
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
500 500
 	echo m88k-dolphin-sysv3
501 501
 	exit ;;
... ...
@@ -552,7 +572,7 @@ EOF
552 552
 		echo rs6000-ibm-aix3.2
553 553
 	fi
554 554
 	exit ;;
555
-    *:AIX:*:[456])
555
+    *:AIX:*:[4567])
556 556
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
557 557
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
558 558
 		IBM_ARCH=rs6000
... ...
@@ -595,52 +615,52 @@ EOF
595 595
 	    9000/[678][0-9][0-9])
596 596
 		if [ -x /usr/bin/getconf ]; then
597 597
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
598
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
599
-                    case "${sc_cpu_version}" in
600
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
601
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
602
-                      532)                      # CPU_PA_RISC2_0
603
-                        case "${sc_kernel_bits}" in
604
-                          32) HP_ARCH="hppa2.0n" ;;
605
-                          64) HP_ARCH="hppa2.0w" ;;
598
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
599
+		    case "${sc_cpu_version}" in
600
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
601
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
602
+		      532)                      # CPU_PA_RISC2_0
603
+			case "${sc_kernel_bits}" in
604
+			  32) HP_ARCH="hppa2.0n" ;;
605
+			  64) HP_ARCH="hppa2.0w" ;;
606 606
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
607
-                        esac ;;
608
-                    esac
607
+			esac ;;
608
+		    esac
609 609
 		fi
610 610
 		if [ "${HP_ARCH}" = "" ]; then
611 611
 		    eval $set_cc_for_build
612
-		    sed 's/^              //' << EOF >$dummy.c
612
+		    sed 's/^		//' << EOF >$dummy.c
613 613
 
614
-              #define _HPUX_SOURCE
615
-              #include <stdlib.h>
616
-              #include <unistd.h>
614
+		#define _HPUX_SOURCE
615
+		#include <stdlib.h>
616
+		#include <unistd.h>
617 617
 
618
-              int main ()
619
-              {
620
-              #if defined(_SC_KERNEL_BITS)
621
-                  long bits = sysconf(_SC_KERNEL_BITS);
622
-              #endif
623
-                  long cpu  = sysconf (_SC_CPU_VERSION);
618
+		int main ()
619
+		{
620
+		#if defined(_SC_KERNEL_BITS)
621
+		    long bits = sysconf(_SC_KERNEL_BITS);
622
+		#endif
623
+		    long cpu  = sysconf (_SC_CPU_VERSION);
624 624
 
625
-                  switch (cpu)
626
-              	{
627
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
628
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
629
-              	case CPU_PA_RISC2_0:
630
-              #if defined(_SC_KERNEL_BITS)
631
-              	    switch (bits)
632
-              		{
633
-              		case 64: puts ("hppa2.0w"); break;
634
-              		case 32: puts ("hppa2.0n"); break;
635
-              		default: puts ("hppa2.0"); break;
636
-              		} break;
637
-              #else  /* !defined(_SC_KERNEL_BITS) */
638
-              	    puts ("hppa2.0"); break;
639
-              #endif
640
-              	default: puts ("hppa1.0"); break;
641
-              	}
642
-                  exit (0);
643
-              }
625
+		    switch (cpu)
626
+			{
627
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
628
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
629
+			case CPU_PA_RISC2_0:
630
+		#if defined(_SC_KERNEL_BITS)
631
+			    switch (bits)
632
+				{
633
+				case 64: puts ("hppa2.0w"); break;
634
+				case 32: puts ("hppa2.0n"); break;
635
+				default: puts ("hppa2.0"); break;
636
+				} break;
637
+		#else  /* !defined(_SC_KERNEL_BITS) */
638
+			    puts ("hppa2.0"); break;
639
+		#endif
640
+			default: puts ("hppa1.0"); break;
641
+			}
642
+		    exit (0);
643
+		}
644 644
 EOF
645 645
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
646 646
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
... ...
@@ -731,22 +751,22 @@ EOF
731 731
 	exit ;;
732 732
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
733 733
 	echo c1-convex-bsd
734
-        exit ;;
734
+	exit ;;
735 735
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
736 736
 	if getsysinfo -f scalar_acc
737 737
 	then echo c32-convex-bsd
738 738
 	else echo c2-convex-bsd
739 739
 	fi
740
-        exit ;;
740
+	exit ;;
741 741
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
742 742
 	echo c34-convex-bsd
743
-        exit ;;
743
+	exit ;;
744 744
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
745 745
 	echo c38-convex-bsd
746
-        exit ;;
746
+	exit ;;
747 747
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
748 748
 	echo c4-convex-bsd
749
-        exit ;;
749
+	exit ;;
750 750
     CRAY*Y-MP:*:*:*)
751 751
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
752 752
 	exit ;;
... ...
@@ -770,14 +790,14 @@ EOF
770 770
 	exit ;;
771 771
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
772 772
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
773
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
774
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
775
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
776
-        exit ;;
773
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
774
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
775
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
776
+	exit ;;
777 777
     5000:UNIX_System_V:4.*:*)
778
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
779
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
780
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
778
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
779
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
780
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
781 781
 	exit ;;
782 782
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
783 783
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
... ...
@@ -789,30 +809,30 @@ EOF
789 789
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
790 790
 	exit ;;
791 791
     *:FreeBSD:*:*)
792
-	case ${UNAME_MACHINE} in
793
-	    pc98)
794
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
795
-	    amd64)
796
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
797
-	    *)
798
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
799
-	esac
792
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
793
+	echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
800 794
 	exit ;;
801 795
     i*:CYGWIN*:*)
802 796
 	echo ${UNAME_MACHINE}-pc-cygwin
803 797
 	exit ;;
798
+    *:MINGW64*:*)
799
+	echo ${UNAME_MACHINE}-pc-mingw64
800
+	exit ;;
804 801
     *:MINGW*:*)
805 802
 	echo ${UNAME_MACHINE}-pc-mingw32
806 803
 	exit ;;
804
+    i*:MSYS*:*)
805
+	echo ${UNAME_MACHINE}-pc-msys
806
+	exit ;;
807 807
     i*:windows32*:*)
808
-    	# uname -m includes "-pc" on this system.
809
-    	echo ${UNAME_MACHINE}-mingw32
808
+	# uname -m includes "-pc" on this system.
809
+	echo ${UNAME_MACHINE}-mingw32
810 810
 	exit ;;
811 811
     i*:PW*:*)
812 812
 	echo ${UNAME_MACHINE}-pc-pw32
813 813
 	exit ;;
814 814
     *:Interix*:*)
815
-    	case ${UNAME_MACHINE} in
815
+	case ${UNAME_MACHINE} in
816 816
 	    x86)
817 817
 		echo i586-pc-interix${UNAME_RELEASE}
818 818
 		exit ;;
... ...
@@ -849,15 +869,22 @@ EOF
849 849
 	exit ;;
850 850
     *:GNU:*:*)
851 851
 	# the GNU system
852
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
852
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
853 853
 	exit ;;
854 854
     *:GNU/*:*:*)
855 855
 	# other systems with GNU libc and userland
856
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
856
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
857 857
 	exit ;;
858 858
     i*86:Minix:*:*)
859 859
 	echo ${UNAME_MACHINE}-pc-minix
860 860
 	exit ;;
861
+    aarch64:Linux:*:*)
862
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
863
+	exit ;;
864
+    aarch64_be:Linux:*:*)
865
+	UNAME_MACHINE=aarch64_be
866
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
867
+	exit ;;
861 868
     alpha:Linux:*:*)
862 869
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
863 870
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
... ...
@@ -867,52 +894,56 @@ EOF
867 867
 	  EV6)   UNAME_MACHINE=alphaev6 ;;
868 868
 	  EV67)  UNAME_MACHINE=alphaev67 ;;
869 869
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
870
-        esac
870
+	esac
871 871
 	objdump --private-headers /bin/sh | grep -q ld.so.1
872
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
873
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
872
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
873
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
874
+	exit ;;
875
+    arc:Linux:*:* | arceb:Linux:*:*)
876
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
874 877
 	exit ;;
875 878
     arm*:Linux:*:*)
876 879
 	eval $set_cc_for_build
877 880
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
878 881
 	    | grep -q __ARM_EABI__
879 882
 	then
880
-	    echo ${UNAME_MACHINE}-unknown-linux-gnu
883
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
881 884
 	else
882
-	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
885
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
886
+		| grep -q __ARM_PCS_VFP
887
+	    then
888
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
889
+	    else
890
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
891
+	    fi
883 892
 	fi
884 893
 	exit ;;
885 894
     avr32*:Linux:*:*)
886
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
895
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
887 896
 	exit ;;
888 897
     cris:Linux:*:*)
889
-	echo cris-axis-linux-gnu
898
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
890 899
 	exit ;;
891 900
     crisv32:Linux:*:*)
892
-	echo crisv32-axis-linux-gnu
901
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
893 902
 	exit ;;
894 903
     frv:Linux:*:*)
895
-    	echo frv-unknown-linux-gnu
904
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
905
+	exit ;;
906
+    hexagon:Linux:*:*)
907
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
896 908
 	exit ;;
897 909
     i*86:Linux:*:*)
898
-	LIBC=gnu
899
-	eval $set_cc_for_build
900
-	sed 's/^	//' << EOF >$dummy.c
901
-	#ifdef __dietlibc__
902
-	LIBC=dietlibc
903
-	#endif
904
-EOF
905
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
906
-	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
910
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
907 911
 	exit ;;
908 912
     ia64:Linux:*:*)
909
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
913
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
910 914
 	exit ;;
911 915
     m32r*:Linux:*:*)
912
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
916
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
913 917
 	exit ;;
914 918
     m68*:Linux:*:*)
915
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
919
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
916 920
 	exit ;;
917 921
     mips:Linux:*:* | mips64:Linux:*:*)
918 922
 	eval $set_cc_for_build
... ...
@@ -931,51 +962,57 @@ EOF
931 931
 	#endif
932 932
 EOF
933 933
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
934
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
934
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
935 935
 	;;
936
+    or1k:Linux:*:*)
937
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
938
+	exit ;;
936 939
     or32:Linux:*:*)
937
-	echo or32-unknown-linux-gnu
940
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
938 941
 	exit ;;
939 942
     padre:Linux:*:*)
940
-	echo sparc-unknown-linux-gnu
943
+	echo sparc-unknown-linux-${LIBC}
941 944
 	exit ;;
942 945
     parisc64:Linux:*:* | hppa64:Linux:*:*)
943
-	echo hppa64-unknown-linux-gnu
946
+	echo hppa64-unknown-linux-${LIBC}
944 947
 	exit ;;
945 948
     parisc:Linux:*:* | hppa:Linux:*:*)
946 949
 	# Look for CPU level
947 950
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
948
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
949
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
950
-	  *)    echo hppa-unknown-linux-gnu ;;
951
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
952
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
953
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
951 954
 	esac
952 955
 	exit ;;
953 956
     ppc64:Linux:*:*)
954
-	echo powerpc64-unknown-linux-gnu
957
+	echo powerpc64-unknown-linux-${LIBC}
955 958
 	exit ;;
956 959
     ppc:Linux:*:*)
957
-	echo powerpc-unknown-linux-gnu
960
+	echo powerpc-unknown-linux-${LIBC}
958 961
 	exit ;;
959 962
     s390:Linux:*:* | s390x:Linux:*:*)
960
-	echo ${UNAME_MACHINE}-ibm-linux
963
+	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
961 964
 	exit ;;
962 965
     sh64*:Linux:*:*)
963
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
966
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
964 967
 	exit ;;
965 968
     sh*:Linux:*:*)
966
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
969
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
967 970
 	exit ;;
968 971
     sparc:Linux:*:* | sparc64:Linux:*:*)
969
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
972
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
973
+	exit ;;
974
+    tile*:Linux:*:*)
975
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
970 976
 	exit ;;
971 977
     vax:Linux:*:*)
972
-	echo ${UNAME_MACHINE}-dec-linux-gnu
978
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
973 979
 	exit ;;
974 980
     x86_64:Linux:*:*)
975
-	echo x86_64-unknown-linux-gnu
981
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
976 982
 	exit ;;
977 983
     xtensa*:Linux:*:*)
978
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
984
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
979 985
 	exit ;;
980 986
     i*86:DYNIX/ptx:4*:*)
981 987
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
... ...
@@ -984,11 +1021,11 @@ EOF
984 984
 	echo i386-sequent-sysv4
985 985
 	exit ;;
986 986
     i*86:UNIX_SV:4.2MP:2.*)
987
-        # Unixware is an offshoot of SVR4, but it has its own version
988
-        # number series starting with 2...
989
-        # I am not positive that other SVR4 systems won't match this,
987
+	# Unixware is an offshoot of SVR4, but it has its own version
988
+	# number series starting with 2...
989
+	# I am not positive that other SVR4 systems won't match this,
990 990
 	# I just have to hope.  -- rms.
991
-        # Use sysv4.2uw... so that sysv4* matches it.
991
+	# Use sysv4.2uw... so that sysv4* matches it.
992 992
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
993 993
 	exit ;;
994 994
     i*86:OS/2:*:*)
... ...
@@ -1020,7 +1057,7 @@ EOF
1020 1020
 	fi
1021 1021
 	exit ;;
1022 1022
     i*86:*:5:[678]*)
1023
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1023
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1024 1024
 	case `/bin/uname -X | grep "^Machine"` in
1025 1025
 	    *486*)	     UNAME_MACHINE=i486 ;;
1026 1026
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
... ...
@@ -1048,13 +1085,13 @@ EOF
1048 1048
 	exit ;;
1049 1049
     pc:*:*:*)
1050 1050
 	# Left here for compatibility:
1051
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1052
-        # the processor, so we play safe by assuming i586.
1051
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1052
+	# the processor, so we play safe by assuming i586.
1053 1053
 	# Note: whatever this is, it MUST be the same as what config.sub
1054 1054
 	# prints for the "djgpp" host, or else GDB configury will decide that
1055 1055
 	# this is a cross-build.
1056 1056
 	echo i586-pc-msdosdjgpp
1057
-        exit ;;
1057
+	exit ;;
1058 1058
     Intel:Mach:3*:*)
1059 1059
 	echo i386-pc-mach3
1060 1060
 	exit ;;
... ...
@@ -1089,8 +1126,8 @@ EOF
1089 1089
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1090 1090
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1091 1091
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1092
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1093
-          && { echo i486-ncr-sysv4; exit; } ;;
1092
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1093
+	  && { echo i486-ncr-sysv4; exit; } ;;
1094 1094
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1095 1095
 	OS_REL='.3'
1096 1096
 	test -r /etc/.relid \
... ...
@@ -1133,10 +1170,10 @@ EOF
1133 1133
 		echo ns32k-sni-sysv
1134 1134
 	fi
1135 1135
 	exit ;;
1136
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1137
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
1138
-        echo i586-unisys-sysv4
1139
-        exit ;;
1136
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1137
+			# says <Richard.M.Bartel@ccMail.Census.GOV>
1138
+	echo i586-unisys-sysv4
1139
+	exit ;;
1140 1140
     *:UNIX_System_V:4*:FTX*)
1141 1141
 	# From Gerald Hewes <hewes@openmarket.com>.
1142 1142
 	# How about differentiating between stratus architectures? -djm
... ...
@@ -1162,11 +1199,11 @@ EOF
1162 1162
 	exit ;;
1163 1163
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1164 1164
 	if [ -d /usr/nec ]; then
1165
-	        echo mips-nec-sysv${UNAME_RELEASE}
1165
+		echo mips-nec-sysv${UNAME_RELEASE}
1166 1166
 	else
1167
-	        echo mips-unknown-sysv${UNAME_RELEASE}
1167
+		echo mips-unknown-sysv${UNAME_RELEASE}
1168 1168
 	fi
1169
-        exit ;;
1169
+	exit ;;
1170 1170
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1171 1171
 	echo powerpc-be-beos
1172 1172
 	exit ;;
... ...
@@ -1179,6 +1216,9 @@ EOF
1179 1179
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1180 1180
 	echo i586-pc-haiku
1181 1181
 	exit ;;
1182
+    x86_64:Haiku:*:*)
1183
+	echo x86_64-unknown-haiku
1184
+	exit ;;
1182 1185
     SX-4:SUPER-UX:*:*)
1183 1186
 	echo sx4-nec-superux${UNAME_RELEASE}
1184 1187
 	exit ;;
... ...
@@ -1205,19 +1245,21 @@ EOF
1205 1205
 	exit ;;
1206 1206
     *:Darwin:*:*)
1207 1207
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1208
-	case $UNAME_PROCESSOR in
1209
-	    i386)
1210
-		eval $set_cc_for_build
1211
-		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1212
-		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1213
-		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1214
-		      grep IS_64BIT_ARCH >/dev/null
1215
-		  then
1216
-		      UNAME_PROCESSOR="x86_64"
1217
-		  fi
1218
-		fi ;;
1219
-	    unknown) UNAME_PROCESSOR=powerpc ;;
1220
-	esac
1208
+	eval $set_cc_for_build
1209
+	if test "$UNAME_PROCESSOR" = unknown ; then
1210
+	    UNAME_PROCESSOR=powerpc
1211
+	fi
1212
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1213
+	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1214
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1215
+		grep IS_64BIT_ARCH >/dev/null
1216
+	    then
1217
+		case $UNAME_PROCESSOR in
1218
+		    i386) UNAME_PROCESSOR=x86_64 ;;
1219
+		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1220
+		esac
1221
+	    fi
1222
+	fi
1221 1223
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1222 1224
 	exit ;;
1223 1225
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
... ...
@@ -1231,7 +1273,10 @@ EOF
1231 1231
     *:QNX:*:4*)
1232 1232
 	echo i386-pc-qnx
1233 1233
 	exit ;;
1234
-    NSE-?:NONSTOP_KERNEL:*:*)
1234
+    NEO-?:NONSTOP_KERNEL:*:*)
1235
+	echo neo-tandem-nsk${UNAME_RELEASE}
1236
+	exit ;;
1237
+    NSE-*:NONSTOP_KERNEL:*:*)
1235 1238
 	echo nse-tandem-nsk${UNAME_RELEASE}
1236 1239
 	exit ;;
1237 1240
     NSR-?:NONSTOP_KERNEL:*:*)
... ...
@@ -1276,13 +1321,13 @@ EOF
1276 1276
 	echo pdp10-unknown-its
1277 1277
 	exit ;;
1278 1278
     SEI:*:*:SEIUX)
1279
-        echo mips-sei-seiux${UNAME_RELEASE}
1279
+	echo mips-sei-seiux${UNAME_RELEASE}
1280 1280
 	exit ;;
1281 1281
     *:DragonFly:*:*)
1282 1282
 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1283 1283
 	exit ;;
1284 1284
     *:*VMS:*:*)
1285
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1285
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1286 1286
 	case "${UNAME_MACHINE}" in
1287 1287
 	    A*) echo alpha-dec-vms ; exit ;;
1288 1288
 	    I*) echo ia64-dec-vms ; exit ;;
... ...
@@ -1300,11 +1345,11 @@ EOF
1300 1300
     i*86:AROS:*:*)
1301 1301
 	echo ${UNAME_MACHINE}-pc-aros
1302 1302
 	exit ;;
1303
+    x86_64:VMkernel:*:*)
1304
+	echo ${UNAME_MACHINE}-unknown-esx
1305
+	exit ;;
1303 1306
 esac
1304 1307
 
1305
-#echo '(No uname command or uname output not recognized.)' 1>&2
1306
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1307
-
1308 1308
 eval $set_cc_for_build
1309 1309
 cat >$dummy.c <<EOF
1310 1310
 #ifdef _SEQUENT_
... ...
@@ -1322,11 +1367,11 @@ main ()
1322 1322
 #include <sys/param.h>
1323 1323
   printf ("m68k-sony-newsos%s\n",
1324 1324
 #ifdef NEWSOS4
1325
-          "4"
1325
+	"4"
1326 1326
 #else
1327
-	  ""
1327
+	""
1328 1328
 #endif
1329
-         ); exit (0);
1329
+	); exit (0);
1330 1330
 #endif
1331 1331
 #endif
1332 1332
 
... ...
@@ -1,38 +1,31 @@
1 1
 #! /bin/sh
2 2
 # Configuration validation subroutine script.
3
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5
-#   Free Software Foundation, Inc.
3
+#   Copyright 1992-2013 Free Software Foundation, Inc.
6 4
 
7
-timestamp='2010-01-22'
5
+timestamp='2013-04-24'
8 6
 
9
-# This file is (in principle) common to ALL GNU software.
10
-# The presence of a machine in this file suggests that SOME GNU software
11
-# can handle that machine.  It does not imply ALL GNU software can.
12
-#
13
-# This file is free software; you can redistribute it and/or modify
14
-# it under the terms of the GNU General Public License as published by
15
-# the Free Software Foundation; either version 2 of the License, or
7
+# This file is free software; you can redistribute it and/or modify it
8
+# under the terms of the GNU General Public License as published by
9
+# the Free Software Foundation; either version 3 of the License, or
16 10
 # (at your option) any later version.
17 11
 #
18
-# This program is distributed in the hope that it will be useful,
19
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
-# GNU General Public License for more details.
12
+# This program is distributed in the hope that it will be useful, but
13
+# WITHOUT ANY WARRANTY; without even the implied warranty of
14
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+# General Public License for more details.
22 16
 #
23 17
 # You should have received a copy of the GNU General Public License
24
-# along with this program; if not, write to the Free Software
25
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
26
-# 02110-1301, USA.
18
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
27 19
 #
28 20
 # As a special exception to the GNU General Public License, if you
29 21
 # distribute this file as part of a program that contains a
30 22
 # configuration script generated by Autoconf, you may include it under
31
-# the same distribution terms that you use for the rest of that program.
23
+# the same distribution terms that you use for the rest of that
24
+# program.  This Exception is an additional permission under section 7
25
+# of the GNU General Public License, version 3 ("GPLv3").
32 26
 
33 27
 
34
-# Please send patches to <config-patches@gnu.org>.  Submit a context
35
-# diff and a properly formatted GNU ChangeLog entry.
28
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
36 29
 #
37 30
 # Configuration subroutine to validate and canonicalize a configuration type.
38 31
 # Supply the specified configuration type as an argument.
... ...
@@ -75,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
75 75
 version="\
76 76
 GNU config.sub ($timestamp)
77 77
 
78
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
79
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
80
-Software Foundation, Inc.
78
+Copyright 1992-2013 Free Software Foundation, Inc.
81 79
 
82 80
 This is free software; see the source for copying conditions.  There is NO
83 81
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
... ...
@@ -124,13 +115,18 @@ esac
124 124
 # Here we must recognize all the valid KERNEL-OS combinations.
125 125
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
126 126
 case $maybe_os in
127
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
128
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
127
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
128
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
129
+  knetbsd*-gnu* | netbsd*-gnu* | \
129 130
   kopensolaris*-gnu* | \
130 131
   storm-chaos* | os2-emx* | rtmk-nova*)
131 132
     os=-$maybe_os
132 133
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
133 134
     ;;
135
+  android-linux)
136
+    os=-linux-android
137
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
138
+    ;;
134 139
   *)
135 140
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
136 141
     if [ $basic_machine != $1 ]
... ...
@@ -153,12 +149,12 @@ case $os in
153 153
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
154 154
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
155 155
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
156
-	-apple | -axis | -knuth | -cray | -microblaze)
156
+	-apple | -axis | -knuth | -cray | -microblaze*)
157 157
 		os=
158 158
 		basic_machine=$1
159 159
 		;;
160
-        -bluegene*)
161
-	        os=-cnk
160
+	-bluegene*)
161
+		os=-cnk
162 162
 		;;
163 163
 	-sim | -cisco | -oki | -wec | -winbond)
164 164
 		os=
... ...
@@ -174,10 +170,10 @@ case $os in
174 174
 		os=-chorusos
175 175
 		basic_machine=$1
176 176
 		;;
177
- 	-chorusrdb)
178
- 		os=-chorusrdb
177
+	-chorusrdb)
178
+		os=-chorusrdb
179 179
 		basic_machine=$1
180
- 		;;
180
+		;;
181 181
 	-hiux*)
182 182
 		os=-hiuxwe2
183 183
 		;;
... ...
@@ -222,6 +218,12 @@ case $os in
222 222
 	-isc*)
223 223
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
224 224
 		;;
225
+	-lynx*178)
226
+		os=-lynxos178
227
+		;;
228
+	-lynx*5)
229
+		os=-lynxos5
230
+		;;
225 231
 	-lynx*)
226 232
 		os=-lynxos
227 233
 		;;
... ...
@@ -246,20 +248,27 @@ case $basic_machine in
246 246
 	# Some are omitted here because they have special meanings below.
247 247
 	1750a | 580 \
248 248
 	| a29k \
249
+	| aarch64 | aarch64_be \
249 250
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
250 251
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
251 252
 	| am33_2.0 \
252
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
253
+	| arc | arceb \
254
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
255
+	| avr | avr32 \
256
+	| be32 | be64 \
253 257
 	| bfin \
254 258
 	| c4x | clipper \
255 259
 	| d10v | d30v | dlx | dsp16xx \
260
+	| epiphany \
256 261
 	| fido | fr30 | frv \
257 262
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
263
+	| hexagon \
258 264
 	| i370 | i860 | i960 | ia64 \
259 265
 	| ip2k | iq2000 \
266
+	| le32 | le64 \
260 267
 	| lm32 \
261 268
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
262
-	| maxq | mb | microblaze | mcore | mep | metag \
269
+	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
263 270
 	| mips | mipsbe | mipseb | mipsel | mipsle \
264 271
 	| mips16 \
265 272
 	| mips64 | mips64el \
... ...
@@ -277,34 +286,45 @@ case $basic_machine in
277 277
 	| mipsisa64r2 | mipsisa64r2el \
278 278
 	| mipsisa64sb1 | mipsisa64sb1el \
279 279
 	| mipsisa64sr71k | mipsisa64sr71kel \
280
+	| mipsr5900 | mipsr5900el \
280 281
 	| mipstx39 | mipstx39el \
281 282
 	| mn10200 | mn10300 \
282 283
 	| moxie \
283 284
 	| mt \
284 285
 	| msp430 \
285
-	| nios | nios2 \
286
+	| nds32 | nds32le | nds32be \
287
+	| nios | nios2 | nios2eb | nios2el \
286 288
 	| ns16k | ns32k \
287
-	| or32 \
289
+	| open8 \
290
+	| or1k | or32 \
288 291
 	| pdp10 | pdp11 | pj | pjl \
289
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
292
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
290 293
 	| pyramid \
291
-	| rx \
294
+	| rl78 | rx \
292 295
 	| score \
293 296
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
294 297
 	| sh64 | sh64le \
295 298
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
296 299
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
297
-	| spu | strongarm \
298
-	| tahoe | thumb | tic4x | tic80 | tron \
300
+	| spu \
301
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
299 302
 	| ubicom32 \
300
-	| v850 | v850e \
303
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
301 304
 	| we32k \
302
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
305
+	| x86 | xc16x | xstormy16 | xtensa \
303 306
 	| z8k | z80)
304 307
 		basic_machine=$basic_machine-unknown
305 308
 		;;
306
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
307
-		# Motorola 68HC11/12.
309
+	c54x)
310
+		basic_machine=tic54x-unknown
311
+		;;
312
+	c55x)
313
+		basic_machine=tic55x-unknown
314
+		;;
315
+	c6x)
316
+		basic_machine=tic6x-unknown
317
+		;;
318
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
308 319
 		basic_machine=$basic_machine-unknown
309 320
 		os=-none
310 321
 		;;
... ...
@@ -314,6 +334,21 @@ case $basic_machine in
314 314
 		basic_machine=mt-unknown
315 315
 		;;
316 316
 
317
+	strongarm | thumb | xscale)
318
+		basic_machine=arm-unknown
319
+		;;
320
+	xgate)
321
+		basic_machine=$basic_machine-unknown
322
+		os=-none
323
+		;;
324
+	xscaleeb)
325
+		basic_machine=armeb-unknown
326
+		;;
327
+
328
+	xscaleel)
329
+		basic_machine=armel-unknown
330
+		;;
331
+
317 332
 	# We use `pc' rather than `unknown'
318 333
 	# because (1) that's what they normally are, and
319 334
 	# (2) the word "unknown" tends to confuse beginning users.
... ...
@@ -328,25 +363,30 @@ case $basic_machine in
328 328
 	# Recognize the basic CPU types with company name.
329 329
 	580-* \
330 330
 	| a29k-* \
331
+	| aarch64-* | aarch64_be-* \
331 332
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
332 333
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
333
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
334
+	| alphapca5[67]-* | alpha64pca5[67]-* | amd64-* | arc-* | arceb-* \
334 335
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
335 336
 	| avr-* | avr32-* \
337
+	| be32-* | be64-* \
336 338
 	| bfin-* | bs2000-* \
337
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
339
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
338 340
 	| clipper-* | craynv-* | cydra-* \
339 341
 	| d10v-* | d30v-* | dlx-* \
340 342
 	| elxsi-* \
341 343
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
342 344
 	| h8300-* | h8500-* \
343 345
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
346
+	| hexagon-* \
344 347
 	| i*86-* | i860-* | i960-* | ia64-* \
345 348
 	| ip2k-* | iq2000-* \
349
+	| le32-* | le64-* \
346 350
 	| lm32-* \
347 351
 	| m32c-* | m32r-* | m32rle-* \
348 352
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
349
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
353
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
354
+	| microblaze-* | microblazeel-* \
350 355
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
351 356
 	| mips16-* \
352 357
 	| mips64-* | mips64el-* \
... ...
@@ -364,30 +404,34 @@ case $basic_machine in
364 364
 	| mipsisa64r2-* | mipsisa64r2el-* \
365 365
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
366 366
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
367
+	| mipsr5900-* | mipsr5900el-* \
367 368
 	| mipstx39-* | mipstx39el-* \
368 369
 	| mmix-* \
369 370
 	| mt-* \
370 371
 	| msp430-* \
371
-	| nios-* | nios2-* \
372
+	| nds32-* | nds32le-* | nds32be-* \
373
+	| nios-* | nios2-* | nios2eb-* | nios2el-* \
372 374
 	| none-* | np1-* | ns16k-* | ns32k-* \
375
+	| open8-* \
373 376
 	| orion-* \
374 377
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
375
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
378
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
376 379
 	| pyramid-* \
377
-	| romp-* | rs6000-* | rx-* \
380
+	| rl78-* | romp-* | rs6000-* | rx-* \
378 381
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
379 382
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
380 383
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
381 384
 	| sparclite-* \
382
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
383
-	| tahoe-* | thumb-* \
385
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
386
+	| tahoe-* \
384 387
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
385
-	| tile-* | tilegx-* \
388
+	| tile*-* \
386 389
 	| tron-* \
387 390
 	| ubicom32-* \
388
-	| v850-* | v850e-* | vax-* \
391
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
392
+	| vax-* \
389 393
 	| we32k-* \
390
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
394
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
391 395
 	| xstormy16-* | xtensa*-* \
392 396
 	| ymp-* \
393 397
 	| z8k-* | z80-*)
... ...
@@ -412,7 +456,7 @@ case $basic_machine in
412 412
 		basic_machine=a29k-amd
413 413
 		os=-udi
414 414
 		;;
415
-    	abacus)
415
+	abacus)
416 416
 		basic_machine=abacus-unknown
417 417
 		;;
418 418
 	adobe68k)
... ...
@@ -429,12 +473,6 @@ case $basic_machine in
429 429
 		basic_machine=a29k-none
430 430
 		os=-bsd
431 431
 		;;
432
-	amd64)
433
-		basic_machine=x86_64-pc
434
-		;;
435
-	amd64-*)
436
-		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
437
-		;;
438 432
 	amdahl)
439 433
 		basic_machine=580-amdahl
440 434
 		os=-sysv
... ...
@@ -482,11 +520,20 @@ case $basic_machine in
482 482
 		basic_machine=powerpc-ibm
483 483
 		os=-cnk
484 484
 		;;
485
+	c54x-*)
486
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
487
+		;;
488
+	c55x-*)
489
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
490
+		;;
491
+	c6x-*)
492
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
493
+		;;
485 494
 	c90)
486 495
 		basic_machine=c90-cray
487 496
 		os=-unicos
488 497
 		;;
489
-        cegcc)
498
+	cegcc)
490 499
 		basic_machine=arm-unknown
491 500
 		os=-cegcc
492 501
 		;;
... ...
@@ -518,7 +565,7 @@ case $basic_machine in
518 518
 		basic_machine=craynv-cray
519 519
 		os=-unicosmp
520 520
 		;;
521
-	cr16)
521
+	cr16 | cr16-*)
522 522
 		basic_machine=cr16-unknown
523 523
 		os=-elf
524 524
 		;;
... ...
@@ -676,7 +723,6 @@ case $basic_machine in
676 676
 	i370-ibm* | ibm*)
677 677
 		basic_machine=i370-ibm
678 678
 		;;
679
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
680 679
 	i*86v32)
681 680
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
682 681
 		os=-sysv32
... ...
@@ -734,9 +780,13 @@ case $basic_machine in
734 734
 		basic_machine=ns32k-utek
735 735
 		os=-sysv
736 736
 		;;
737
-        microblaze)
737
+	microblaze*)
738 738
 		basic_machine=microblaze-xilinx
739 739
 		;;
740
+	mingw64)
741
+		basic_machine=x86_64-pc
742
+		os=-mingw64
743
+		;;
740 744
 	mingw32)
741 745
 		basic_machine=i386-pc
742 746
 		os=-mingw32
... ...
@@ -773,10 +823,18 @@ case $basic_machine in
773 773
 	ms1-*)
774 774
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
775 775
 		;;
776
+	msys)
777
+		basic_machine=i386-pc
778
+		os=-msys
779
+		;;
776 780
 	mvs)
777 781
 		basic_machine=i370-ibm
778 782
 		os=-mvs
779 783
 		;;
784
+	nacl)
785
+		basic_machine=le32-unknown
786
+		os=-nacl
787
+		;;
780 788
 	ncr3000)
781 789
 		basic_machine=i486-ncr
782 790
 		os=-sysv4
... ...
@@ -841,6 +899,12 @@ case $basic_machine in
841 841
 	np1)
842 842
 		basic_machine=np1-gould
843 843
 		;;
844
+	neo-tandem)
845
+		basic_machine=neo-tandem
846
+		;;
847
+	nse-tandem)
848
+		basic_machine=nse-tandem
849
+		;;
844 850
 	nsr-tandem)
845 851
 		basic_machine=nsr-tandem
846 852
 		;;
... ...
@@ -923,9 +987,10 @@ case $basic_machine in
923 923
 		;;
924 924
 	power)	basic_machine=power-ibm
925 925
 		;;
926
-	ppc)	basic_machine=powerpc-unknown
926
+	ppc | ppcbe)	basic_machine=powerpc-unknown
927 927
 		;;
928
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
928
+	ppc-* | ppcbe-*)
929
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
929 930
 		;;
930 931
 	ppcle | powerpclittle | ppc-le | powerpc-little)
931 932
 		basic_machine=powerpcle-unknown
... ...
@@ -950,7 +1015,11 @@ case $basic_machine in
950 950
 		basic_machine=i586-unknown
951 951
 		os=-pw32
952 952
 		;;
953
-	rdos)
953
+	rdos | rdos64)
954
+		basic_machine=x86_64-pc
955
+		os=-rdos
956
+		;;
957
+	rdos32)
954 958
 		basic_machine=i386-pc
955 959
 		os=-rdos
956 960
 		;;
... ...
@@ -1019,6 +1088,9 @@ case $basic_machine in
1019 1019
 		basic_machine=i860-stratus
1020 1020
 		os=-sysv4
1021 1021
 		;;
1022
+	strongarm-* | thumb-*)
1023
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
1024
+		;;
1022 1025
 	sun2)
1023 1026
 		basic_machine=m68000-sun
1024 1027
 		;;
... ...
@@ -1075,25 +1147,8 @@ case $basic_machine in
1075 1075
 		basic_machine=t90-cray
1076 1076
 		os=-unicos
1077 1077
 		;;
1078
-	tic54x | c54x*)
1079
-		basic_machine=tic54x-unknown
1080
-		os=-coff
1081
-		;;
1082
-	tic55x | c55x*)
1083
-		basic_machine=tic55x-unknown
1084
-		os=-coff
1085
-		;;
1086
-	tic6x | c6x*)
1087
-		basic_machine=tic6x-unknown
1088
-		os=-coff
1089
-		;;
1090
-        # This must be matched before tile*.
1091
-        tilegx*)
1092
-		basic_machine=tilegx-unknown
1093
-		os=-linux-gnu
1094
-		;;
1095 1078
 	tile*)
1096
-		basic_machine=tile-unknown
1079
+		basic_machine=$basic_machine-unknown
1097 1080
 		os=-linux-gnu
1098 1081
 		;;
1099 1082
 	tx39)
... ...
@@ -1163,6 +1218,9 @@ case $basic_machine in
1163 1163
 	xps | xps100)
1164 1164
 		basic_machine=xps100-honeywell
1165 1165
 		;;
1166
+	xscale-* | xscalee[bl]-*)
1167
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
1168
+		;;
1166 1169
 	ymp)
1167 1170
 		basic_machine=ymp-cray
1168 1171
 		os=-unicos
... ...
@@ -1260,11 +1318,11 @@ esac
1260 1260
 if [ x"$os" != x"" ]
1261 1261
 then
1262 1262
 case $os in
1263
-        # First match some system type aliases
1264
-        # that might get confused with valid system types.
1263
+	# First match some system type aliases
1264
+	# that might get confused with valid system types.
1265 1265
 	# -solaris* is a basic system type, with this one exception.
1266
-        -auroraux)
1267
-	        os=-auroraux
1266
+	-auroraux)
1267
+		os=-auroraux
1268 1268
 		;;
1269 1269
 	-solaris1 | -solaris1.*)
1270 1270
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
... ...
@@ -1288,20 +1346,21 @@ case $os in
1288 1288
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1289 1289
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
1290 1290
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
1291
-	      | -sym* | -kopensolaris* \
1291
+	      | -sym* | -kopensolaris* | -plan9* \
1292 1292
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1293 1293
 	      | -aos* | -aros* \
1294 1294
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1295 1295
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1296 1296
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1297
-	      | -openbsd* | -solidbsd* \
1297
+	      | -bitrig* | -openbsd* | -solidbsd* \
1298 1298
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1299 1299
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1300 1300
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1301 1301
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1302 1302
 	      | -chorusos* | -chorusrdb* | -cegcc* \
1303
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1304
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
1303
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1304
+	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
1305
+	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
1305 1306
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
1306 1307
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1307 1308
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
... ...
@@ -1348,7 +1407,7 @@ case $os in
1348 1348
 	-opened*)
1349 1349
 		os=-openedition
1350 1350
 		;;
1351
-        -os400*)
1351
+	-os400*)
1352 1352
 		os=-os400
1353 1353
 		;;
1354 1354
 	-wince*)
... ...
@@ -1397,7 +1456,7 @@ case $os in
1397 1397
 	-sinix*)
1398 1398
 		os=-sysv4
1399 1399
 		;;
1400
-        -tpf*)
1400
+	-tpf*)
1401 1401
 		os=-tpf
1402 1402
 		;;
1403 1403
 	-triton*)
... ...
@@ -1433,17 +1492,14 @@ case $os in
1433 1433
 	-aros*)
1434 1434
 		os=-aros
1435 1435
 		;;
1436
-	-kaos*)
1437
-		os=-kaos
1438
-		;;
1439 1436
 	-zvmoe)
1440 1437
 		os=-zvmoe
1441 1438
 		;;
1442 1439
 	-dicos*)
1443 1440
 		os=-dicos
1444 1441
 		;;
1445
-        -nacl*)
1446
-	        ;;
1442
+	-nacl*)
1443
+		;;
1447 1444
 	-none)
1448 1445
 		;;
1449 1446
 	*)
... ...
@@ -1466,10 +1522,10 @@ else
1466 1466
 # system, and we'll never get to this point.
1467 1467
 
1468 1468
 case $basic_machine in
1469
-        score-*)
1469
+	score-*)
1470 1470
 		os=-elf
1471 1471
 		;;
1472
-        spu-*)
1472
+	spu-*)
1473 1473
 		os=-elf
1474 1474
 		;;
1475 1475
 	*-acorn)
... ...
@@ -1481,8 +1537,20 @@ case $basic_machine in
1481 1481
 	arm*-semi)
1482 1482
 		os=-aout
1483 1483
 		;;
1484
-        c4x-* | tic4x-*)
1485
-        	os=-coff
1484
+	c4x-* | tic4x-*)
1485
+		os=-coff
1486
+		;;
1487
+	hexagon-*)
1488
+		os=-elf
1489
+		;;
1490
+	tic54x-*)
1491
+		os=-coff
1492
+		;;
1493
+	tic55x-*)
1494
+		os=-coff
1495
+		;;
1496
+	tic6x-*)
1497
+		os=-coff
1486 1498
 		;;
1487 1499
 	# This must come before the *-dec entry.
1488 1500
 	pdp10-*)
... ...
@@ -1502,14 +1570,11 @@ case $basic_machine in
1502 1502
 		;;
1503 1503
 	m68000-sun)
1504 1504
 		os=-sunos3
1505
-		# This also exists in the configure program, but was not the
1506
-		# default.
1507
-		# os=-sunos4
1508 1505
 		;;
1509 1506
 	m68*-cisco)
1510 1507
 		os=-aout
1511 1508
 		;;
1512
-        mep-*)
1509
+	mep-*)
1513 1510
 		os=-elf
1514 1511
 		;;
1515 1512
 	mips*-cisco)
... ...
@@ -1518,6 +1583,9 @@ case $basic_machine in
1518 1518
 	mips*-*)
1519 1519
 		os=-elf
1520 1520
 		;;
1521
+	or1k-*)
1522
+		os=-elf
1523
+		;;
1521 1524
 	or32-*)
1522 1525
 		os=-coff
1523 1526
 		;;
... ...
@@ -1536,7 +1604,7 @@ case $basic_machine in
1536 1536
 	*-ibm)
1537 1537
 		os=-aix
1538 1538
 		;;
1539
-    	*-knuth)
1539
+	*-knuth)
1540 1540
 		os=-mmixware
1541 1541
 		;;
1542 1542
 	*-wec)
... ...
@@ -1,10 +1,9 @@
1 1
 #! /bin/sh
2 2
 # depcomp - compile a program generating dependencies as side-effects
3 3
 
4
-scriptversion=2009-04-28.21; # UTC
4
+scriptversion=2013-05-30.07; # UTC
5 5
 
6
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
7
-# Software Foundation, Inc.
6
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
8 7
 
9 8
 # This program is free software; you can redistribute it and/or modify
10 9
 # it under the terms of the GNU General Public License as published by
... ...
@@ -28,9 +27,9 @@ scriptversion=2009-04-28.21; # UTC
28 28
 
29 29
 case $1 in
30 30
   '')
31
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
32
-     exit 1;
33
-     ;;
31
+    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
32
+    exit 1;
33
+    ;;
34 34
   -h | --h*)
35 35
     cat <<\EOF
36 36
 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
... ...
@@ -40,11 +39,11 @@ as side-effects.
40 40
 
41 41
 Environment variables:
42 42
   depmode     Dependency tracking mode.
43
-  source      Source file read by `PROGRAMS ARGS'.
44
-  object      Object file output by `PROGRAMS ARGS'.
43
+  source      Source file read by 'PROGRAMS ARGS'.
44
+  object      Object file output by 'PROGRAMS ARGS'.
45 45
   DEPDIR      directory where to store dependencies.
46 46
   depfile     Dependency file to output.
47
-  tmpdepfile  Temporary file to use when outputing dependencies.
47
+  tmpdepfile  Temporary file to use when outputting dependencies.
48 48
   libtool     Whether libtool is used (yes/no).
49 49
 
50 50
 Report bugs to <bug-automake@gnu.org>.
... ...
@@ -57,6 +56,66 @@ EOF
57 57
     ;;
58 58
 esac
59 59
 
60
+# Get the directory component of the given path, and save it in the
61
+# global variables '$dir'.  Note that this directory component will
62
+# be either empty or ending with a '/' character.  This is deliberate.
63
+set_dir_from ()
64
+{
65
+  case $1 in
66
+    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
67
+      *) dir=;;
68
+  esac
69
+}
70
+
71
+# Get the suffix-stripped basename of the given path, and save it the
72
+# global variable '$base'.
73
+set_base_from ()
74
+{
75
+  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
76
+}
77
+
78
+# If no dependency file was actually created by the compiler invocation,
79
+# we still have to create a dummy depfile, to avoid errors with the
80
+# Makefile "include basename.Plo" scheme.
81
+make_dummy_depfile ()
82
+{
83
+  echo "#dummy" > "$depfile"
84
+}
85
+
86
+# Factor out some common post-processing of the generated depfile.
87
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
88
+aix_post_process_depfile ()
89
+{
90
+  # If the compiler actually managed to produce a dependency file,
91
+  # post-process it.
92
+  if test -f "$tmpdepfile"; then
93
+    # Each line is of the form 'foo.o: dependency.h'.
94
+    # Do two passes, one to just change these to
95
+    #   $object: dependency.h
96
+    # and one to simply output
97
+    #   dependency.h:
98
+    # which is needed to avoid the deleted-header problem.
99
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
100
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
101
+    } > "$depfile"
102
+    rm -f "$tmpdepfile"
103
+  else
104
+    make_dummy_depfile
105
+  fi
106
+}
107
+
108
+# A tabulation character.
109
+tab='	'
110
+# A newline character.
111
+nl='
112
+'
113
+# Character ranges might be problematic outside the C locale.
114
+# These definitions help.
115
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
116
+lower=abcdefghijklmnopqrstuvwxyz
117
+digits=0123456789
118
+alpha=${upper}${lower}
119
+
60 120
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
61 121
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
62 122
   exit 1
... ...
@@ -69,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
69 69
 
70 70
 rm -f "$tmpdepfile"
71 71
 
72
+# Avoid interferences from the environment.
73
+gccflag= dashmflag=
74
+
72 75
 # Some modes work just like other modes, but use different flags.  We
73 76
 # parameterize here, but still list the modes in the big case below,
74 77
 # to make depend.m4 easier to write.  Note that we *cannot* use a case
... ...
@@ -80,18 +142,32 @@ if test "$depmode" = hp; then
80 80
 fi
81 81
 
82 82
 if test "$depmode" = dashXmstdout; then
83
-   # This is just like dashmstdout with a different argument.
84
-   dashmflag=-xM
85
-   depmode=dashmstdout
83
+  # This is just like dashmstdout with a different argument.
84
+  dashmflag=-xM
85
+  depmode=dashmstdout
86 86
 fi
87 87
 
88 88
 cygpath_u="cygpath -u -f -"
89 89
 if test "$depmode" = msvcmsys; then
90
-   # This is just like msvisualcpp but w/o cygpath translation.
91
-   # Just convert the backslash-escaped backslashes to single forward
92
-   # slashes to satisfy depend.m4
93
-   cygpath_u="sed s,\\\\\\\\,/,g"
94
-   depmode=msvisualcpp
90
+  # This is just like msvisualcpp but w/o cygpath translation.
91
+  # Just convert the backslash-escaped backslashes to single forward
92
+  # slashes to satisfy depend.m4
93
+  cygpath_u='sed s,\\\\,/,g'
94
+  depmode=msvisualcpp
95
+fi
96
+
97
+if test "$depmode" = msvc7msys; then
98
+  # This is just like msvc7 but w/o cygpath translation.
99
+  # Just convert the backslash-escaped backslashes to single forward
100
+  # slashes to satisfy depend.m4
101
+  cygpath_u='sed s,\\\\,/,g'
102
+  depmode=msvc7
103
+fi
104
+
105
+if test "$depmode" = xlc; then
106
+  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
107
+  gccflag=-qmakedep=gcc,-MF
108
+  depmode=gcc
95 109
 fi
96 110
 
97 111
 case "$depmode" in
... ...
@@ -114,8 +190,7 @@ gcc3)
114 114
   done
115 115
   "$@"
116 116
   stat=$?
117
-  if test $stat -eq 0; then :
118
-  else
117
+  if test $stat -ne 0; then
119 118
     rm -f "$tmpdepfile"
120 119
     exit $stat
121 120
   fi
... ...
@@ -123,13 +198,17 @@ gcc3)
123 123
   ;;
124 124
 
125 125
 gcc)
126
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
127
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
128
+## (see the conditional assignment to $gccflag above).
126 129
 ## There are various ways to get dependency output from gcc.  Here's
127 130
 ## why we pick this rather obscure method:
128 131
 ## - Don't want to use -MD because we'd like the dependencies to end
129 132
 ##   up in a subdir.  Having to rename by hand is ugly.
130 133
 ##   (We might end up doing this anyway to support other compilers.)
131 134
 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
132
-##   -MM, not -M (despite what the docs say).
135
+##   -MM, not -M (despite what the docs say).  Also, it might not be
136
+##   supported by the other compilers which use the 'gcc' depmode.
133 137
 ## - Using -M directly means running the compiler twice (even worse
134 138
 ##   than renaming).
135 139
   if test -z "$gccflag"; then
... ...
@@ -137,31 +216,31 @@ gcc)
137 137
   fi
138 138
   "$@" -Wp,"$gccflag$tmpdepfile"
139 139
   stat=$?
140
-  if test $stat -eq 0; then :
141
-  else
140
+  if test $stat -ne 0; then
142 141
     rm -f "$tmpdepfile"
143 142
     exit $stat
144 143
   fi
145 144
   rm -f "$depfile"
146 145
   echo "$object : \\" > "$depfile"
147
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
148
-## The second -e expression handles DOS-style file names with drive letters.
146
+  # The second -e expression handles DOS-style file names with drive
147
+  # letters.
149 148
   sed -e 's/^[^:]*: / /' \
150 149
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
151
-## This next piece of magic avoids the `deleted header file' problem.
150
+## This next piece of magic avoids the "deleted header file" problem.
152 151
 ## The problem is that when a header file which appears in a .P file
153 152
 ## is deleted, the dependency causes make to die (because there is
154 153
 ## typically no way to rebuild the header).  We avoid this by adding
155 154
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
156 155
 ## this for us directly.
157
-  tr ' ' '
158
-' < "$tmpdepfile" |
159
-## Some versions of gcc put a space before the `:'.  On the theory
156
+## Some versions of gcc put a space before the ':'.  On the theory
160 157
 ## that the space means something, we add a space to the output as
161
-## well.
158
+## well.  hp depmode also adds that space, but also prefixes the VPATH
159
+## to the object.  Take care to not repeat it in the output.
162 160
 ## Some versions of the HPUX 10.20 sed can't process this invocation
163 161
 ## correctly.  Breaking it into two sed invocations is a workaround.
164
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
162
+  tr ' ' "$nl" < "$tmpdepfile" \
163
+    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
164
+    | sed -e 's/$/ :/' >> "$depfile"
165 165
   rm -f "$tmpdepfile"
166 166
   ;;
167 167
 
... ...
@@ -179,8 +258,7 @@ sgi)
179 179
     "$@" -MDupdate "$tmpdepfile"
180 180
   fi
181 181
   stat=$?
182
-  if test $stat -eq 0; then :
183
-  else
182
+  if test $stat -ne 0; then
184 183
     rm -f "$tmpdepfile"
185 184
     exit $stat
186 185
   fi
... ...
@@ -188,43 +266,41 @@ sgi)
188 188
 
189 189
   if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
190 190
     echo "$object : \\" > "$depfile"
191
-
192 191
     # Clip off the initial element (the dependent).  Don't try to be
193 192
     # clever and replace this with sed code, as IRIX sed won't handle
194 193
     # lines with more than a fixed number of characters (4096 in
195 194
     # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
196
-    # the IRIX cc adds comments like `#:fec' to the end of the
195
+    # the IRIX cc adds comments like '#:fec' to the end of the
197 196
     # dependency line.
198
-    tr ' ' '
199
-' < "$tmpdepfile" \
200
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
201
-    tr '
202
-' ' ' >> "$depfile"
197
+    tr ' ' "$nl" < "$tmpdepfile" \
198
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
199
+      | tr "$nl" ' ' >> "$depfile"
203 200
     echo >> "$depfile"
204
-
205 201
     # The second pass generates a dummy entry for each header file.
206
-    tr ' ' '
207
-' < "$tmpdepfile" \
208
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
209
-   >> "$depfile"
202
+    tr ' ' "$nl" < "$tmpdepfile" \
203
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
204
+      >> "$depfile"
210 205
   else
211
-    # The sourcefile does not contain any dependencies, so just
212
-    # store a dummy comment line, to avoid errors with the Makefile
213
-    # "include basename.Plo" scheme.
214
-    echo "#dummy" > "$depfile"
206
+    make_dummy_depfile
215 207
   fi
216 208
   rm -f "$tmpdepfile"
217 209
   ;;
218 210
 
211
+xlc)
212
+  # This case exists only to let depend.m4 do its work.  It works by
213
+  # looking at the text of this script.  This case will never be run,
214
+  # since it is checked for above.
215
+  exit 1
216
+  ;;
217
+
219 218
 aix)
220 219
   # The C for AIX Compiler uses -M and outputs the dependencies
221 220
   # in a .u file.  In older versions, this file always lives in the
222
-  # current directory.  Also, the AIX compiler puts `$object:' at the
221
+  # current directory.  Also, the AIX compiler puts '$object:' at the
223 222
   # start of each line; $object doesn't have directory information.
224 223
   # Version 6 uses the directory in both cases.
225
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
226
-  test "x$dir" = "x$object" && dir=
227
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
224
+  set_dir_from "$object"
225
+  set_base_from "$object"
228 226
   if test "$libtool" = yes; then
229 227
     tmpdepfile1=$dir$base.u
230 228
     tmpdepfile2=$base.u
... ...
@@ -237,9 +313,7 @@ aix)
237 237
     "$@" -M
238 238
   fi
239 239
   stat=$?
240
-
241
-  if test $stat -eq 0; then :
242
-  else
240
+  if test $stat -ne 0; then
243 241
     rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
244 242
     exit $stat
245 243
   fi
... ...
@@ -248,44 +322,100 @@ aix)
248 248
   do
249 249
     test -f "$tmpdepfile" && break
250 250
   done
251
-  if test -f "$tmpdepfile"; then
252
-    # Each line is of the form `foo.o: dependent.h'.
253
-    # Do two passes, one to just change these to
254
-    # `$object: dependent.h' and one to simply `dependent.h:'.
255
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
256
-    # That's a tab and a space in the [].
257
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
258
-  else
259
-    # The sourcefile does not contain any dependencies, so just
260
-    # store a dummy comment line, to avoid errors with the Makefile
261
-    # "include basename.Plo" scheme.
262
-    echo "#dummy" > "$depfile"
251
+  aix_post_process_depfile
252
+  ;;
253
+
254
+tcc)
255
+  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
256
+  # FIXME: That version still under development at the moment of writing.
257
+  #        Make that this statement remains true also for stable, released
258
+  #        versions.
259
+  # It will wrap lines (doesn't matter whether long or short) with a
260
+  # trailing '\', as in:
261
+  #
262
+  #   foo.o : \
263
+  #    foo.c \
264
+  #    foo.h \
265
+  #
266
+  # It will put a trailing '\' even on the last line, and will use leading
267
+  # spaces rather than leading tabs (at least since its commit 0394caf7
268
+  # "Emit spaces for -MD").
269
+  "$@" -MD -MF "$tmpdepfile"
270
+  stat=$?
271
+  if test $stat -ne 0; then
272
+    rm -f "$tmpdepfile"
273
+    exit $stat
263 274
   fi
275
+  rm -f "$depfile"
276
+  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
277
+  # We have to change lines of the first kind to '$object: \'.
278
+  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
279
+  # And for each line of the second kind, we have to emit a 'dep.h:'
280
+  # dummy dependency, to avoid the deleted-header problem.
281
+  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
264 282
   rm -f "$tmpdepfile"
265 283
   ;;
266 284
 
267
-icc)
268
-  # Intel's C compiler understands `-MD -MF file'.  However on
269
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
270
-  # ICC 7.0 will fill foo.d with something like
271
-  #    foo.o: sub/foo.c
272
-  #    foo.o: sub/foo.h
273
-  # which is wrong.  We want:
274
-  #    sub/foo.o: sub/foo.c
275
-  #    sub/foo.o: sub/foo.h
276
-  #    sub/foo.c:
277
-  #    sub/foo.h:
278
-  # ICC 7.1 will output
285
+## The order of this option in the case statement is important, since the
286
+## shell code in configure will try each of these formats in the order
287
+## listed in this file.  A plain '-MD' option would be understood by many
288
+## compilers, so we must ensure this comes after the gcc and icc options.
289
+pgcc)
290
+  # Portland's C compiler understands '-MD'.
291
+  # Will always output deps to 'file.d' where file is the root name of the
292
+  # source file under compilation, even if file resides in a subdirectory.
293
+  # The object file name does not affect the name of the '.d' file.
294
+  # pgcc 10.2 will output
279 295
   #    foo.o: sub/foo.c sub/foo.h
280
-  # and will wrap long lines using \ :
296
+  # and will wrap long lines using '\' :
281 297
   #    foo.o: sub/foo.c ... \
282 298
   #     sub/foo.h ... \
283 299
   #     ...
300
+  set_dir_from "$object"
301
+  # Use the source, not the object, to determine the base name, since
302
+  # that's sadly what pgcc will do too.
303
+  set_base_from "$source"
304
+  tmpdepfile=$base.d
305
+
306
+  # For projects that build the same source file twice into different object
307
+  # files, the pgcc approach of using the *source* file root name can cause
308
+  # problems in parallel builds.  Use a locking strategy to avoid stomping on
309
+  # the same $tmpdepfile.
310
+  lockdir=$base.d-lock
311
+  trap "
312
+    echo '$0: caught signal, cleaning up...' >&2
313
+    rmdir '$lockdir'
314
+    exit 1
315
+  " 1 2 13 15
316
+  numtries=100
317
+  i=$numtries
318
+  while test $i -gt 0; do
319
+    # mkdir is a portable test-and-set.
320
+    if mkdir "$lockdir" 2>/dev/null; then
321
+      # This process acquired the lock.
322
+      "$@" -MD
323
+      stat=$?
324
+      # Release the lock.
325
+      rmdir "$lockdir"
326
+      break
327
+    else
328
+      # If the lock is being held by a different process, wait
329
+      # until the winning process is done or we timeout.
330
+      while test -d "$lockdir" && test $i -gt 0; do
331
+        sleep 1
332
+        i=`expr $i - 1`
333
+      done
334
+    fi
335
+    i=`expr $i - 1`
336
+  done
337
+  trap - 1 2 13 15
338
+  if test $i -le 0; then
339
+    echo "$0: failed to acquire lock after $numtries attempts" >&2
340
+    echo "$0: check lockdir '$lockdir'" >&2
341
+    exit 1
342
+  fi
284 343
 
285
-  "$@" -MD -MF "$tmpdepfile"
286
-  stat=$?
287
-  if test $stat -eq 0; then :
288
-  else
344
+  if test $stat -ne 0; then
289 345
     rm -f "$tmpdepfile"
290 346
     exit $stat
291 347
   fi
... ...
@@ -297,8 +427,8 @@ icc)
297 297
   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
298 298
   # Some versions of the HPUX 10.20 sed can't process this invocation
299 299
   # correctly.  Breaking it into two sed invocations is a workaround.
300
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
301
-    sed -e 's/$/ :/' >> "$depfile"
300
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
301
+    | sed -e 's/$/ :/' >> "$depfile"
302 302
   rm -f "$tmpdepfile"
303 303
   ;;
304 304
 
... ...
@@ -309,9 +439,8 @@ hp2)
309 309
   # 'foo.d', which lands next to the object file, wherever that
310 310
   # happens to be.
311 311
   # Much of this is similar to the tru64 case; see comments there.
312
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
313
-  test "x$dir" = "x$object" && dir=
314
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
312
+  set_dir_from  "$object"
313
+  set_base_from "$object"
315 314
   if test "$libtool" = yes; then
316 315
     tmpdepfile1=$dir$base.d
317 316
     tmpdepfile2=$dir.libs/$base.d
... ...
@@ -322,8 +451,7 @@ hp2)
322 322
     "$@" +Maked
323 323
   fi
324 324
   stat=$?
325
-  if test $stat -eq 0; then :
326
-  else
325
+  if test $stat -ne 0; then
327 326
      rm -f "$tmpdepfile1" "$tmpdepfile2"
328 327
      exit $stat
329 328
   fi
... ...
@@ -333,77 +461,107 @@ hp2)
333 333
     test -f "$tmpdepfile" && break
334 334
   done
335 335
   if test -f "$tmpdepfile"; then
336
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
337
-    # Add `dependent.h:' lines.
336
+    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
337
+    # Add 'dependent.h:' lines.
338 338
     sed -ne '2,${
339
-	       s/^ *//
340
-	       s/ \\*$//
341
-	       s/$/:/
342
-	       p
343
-	     }' "$tmpdepfile" >> "$depfile"
339
+               s/^ *//
340
+               s/ \\*$//
341
+               s/$/:/
342
+               p
343
+             }' "$tmpdepfile" >> "$depfile"
344 344
   else
345
-    echo "#dummy" > "$depfile"
345
+    make_dummy_depfile
346 346
   fi
347 347
   rm -f "$tmpdepfile" "$tmpdepfile2"
348 348
   ;;
349 349
 
350 350
 tru64)
351
-   # The Tru64 compiler uses -MD to generate dependencies as a side
352
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
353
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
354
-   # dependencies in `foo.d' instead, so we check for that too.
355
-   # Subdirectories are respected.
356
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
357
-   test "x$dir" = "x$object" && dir=
358
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
359
-
360
-   if test "$libtool" = yes; then
361
-      # With Tru64 cc, shared objects can also be used to make a
362
-      # static library.  This mechanism is used in libtool 1.4 series to
363
-      # handle both shared and static libraries in a single compilation.
364
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
365
-      #
366
-      # With libtool 1.5 this exception was removed, and libtool now
367
-      # generates 2 separate objects for the 2 libraries.  These two
368
-      # compilations output dependencies in $dir.libs/$base.o.d and
369
-      # in $dir$base.o.d.  We have to check for both files, because
370
-      # one of the two compilations can be disabled.  We should prefer
371
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
372
-      # automatically cleaned when .libs/ is deleted, while ignoring
373
-      # the former would cause a distcleancheck panic.
374
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
375
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
376
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
377
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
378
-      "$@" -Wc,-MD
379
-   else
380
-      tmpdepfile1=$dir$base.o.d
381
-      tmpdepfile2=$dir$base.d
382
-      tmpdepfile3=$dir$base.d
383
-      tmpdepfile4=$dir$base.d
384
-      "$@" -MD
385
-   fi
386
-
387
-   stat=$?
388
-   if test $stat -eq 0; then :
389
-   else
390
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
391
-      exit $stat
392
-   fi
393
-
394
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
395
-   do
396
-     test -f "$tmpdepfile" && break
397
-   done
398
-   if test -f "$tmpdepfile"; then
399
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
400
-      # That's a tab and a space in the [].
401
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
402
-   else
403
-      echo "#dummy" > "$depfile"
404
-   fi
405
-   rm -f "$tmpdepfile"
406
-   ;;
351
+  # The Tru64 compiler uses -MD to generate dependencies as a side
352
+  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
353
+  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
354
+  # dependencies in 'foo.d' instead, so we check for that too.
355
+  # Subdirectories are respected.
356
+  set_dir_from  "$object"
357
+  set_base_from "$object"
358
+
359
+  if test "$libtool" = yes; then
360
+    # Libtool generates 2 separate objects for the 2 libraries.  These
361
+    # two compilations output dependencies in $dir.libs/$base.o.d and
362
+    # in $dir$base.o.d.  We have to check for both files, because
363
+    # one of the two compilations can be disabled.  We should prefer
364
+    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
365
+    # automatically cleaned when .libs/ is deleted, while ignoring
366
+    # the former would cause a distcleancheck panic.
367
+    tmpdepfile1=$dir$base.o.d          # libtool 1.5
368
+    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
369
+    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
370
+    "$@" -Wc,-MD
371
+  else
372
+    tmpdepfile1=$dir$base.d
373
+    tmpdepfile2=$dir$base.d
374
+    tmpdepfile3=$dir$base.d
375
+    "$@" -MD
376
+  fi
377
+
378
+  stat=$?
379
+  if test $stat -ne 0; then
380
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
381
+    exit $stat
382
+  fi
383
+
384
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
385
+  do
386
+    test -f "$tmpdepfile" && break
387
+  done
388
+  # Same post-processing that is required for AIX mode.
389
+  aix_post_process_depfile
390
+  ;;
391
+
392
+msvc7)
393
+  if test "$libtool" = yes; then
394
+    showIncludes=-Wc,-showIncludes
395
+  else
396
+    showIncludes=-showIncludes
397
+  fi
398
+  "$@" $showIncludes > "$tmpdepfile"
399
+  stat=$?
400
+  grep -v '^Note: including file: ' "$tmpdepfile"
401
+  if test $stat -ne 0; then
402
+    rm -f "$tmpdepfile"
403
+    exit $stat
404
+  fi
405
+  rm -f "$depfile"
406
+  echo "$object : \\" > "$depfile"
407
+  # The first sed program below extracts the file names and escapes
408
+  # backslashes for cygpath.  The second sed program outputs the file
409
+  # name when reading, but also accumulates all include files in the
410
+  # hold buffer in order to output them again at the end.  This only
411
+  # works with sed implementations that can handle large buffers.
412
+  sed < "$tmpdepfile" -n '
413
+/^Note: including file:  *\(.*\)/ {
414
+  s//\1/
415
+  s/\\/\\\\/g
416
+  p
417
+}' | $cygpath_u | sort -u | sed -n '
418
+s/ /\\ /g
419
+s/\(.*\)/'"$tab"'\1 \\/p
420
+s/.\(.*\) \\/\1:/
421
+H
422
+$ {
423
+  s/.*/'"$tab"'/
424
+  G
425
+  p
426
+}' >> "$depfile"
427
+  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
428
+  rm -f "$tmpdepfile"
429
+  ;;
430
+
431
+msvc7msys)
432
+  # This case exists only to let depend.m4 do its work.  It works by
433
+  # looking at the text of this script.  This case will never be run,
434
+  # since it is checked for above.
435
+  exit 1
436
+  ;;
407 437
 
408 438
 #nosideeffect)
409 439
   # This comment above is used by automake to tell side-effect
... ...
@@ -422,7 +580,7 @@ dashmstdout)
422 422
     shift
423 423
   fi
424 424
 
425
-  # Remove `-o $object'.
425
+  # Remove '-o $object'.
426 426
   IFS=" "
427 427
   for arg
428 428
   do
... ...
@@ -442,18 +600,18 @@ dashmstdout)
442 442
   done
443 443
 
444 444
   test -z "$dashmflag" && dashmflag=-M
445
-  # Require at least two characters before searching for `:'
445
+  # Require at least two characters before searching for ':'
446 446
   # in the target name.  This is to cope with DOS-style filenames:
447
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
447
+  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
448 448
   "$@" $dashmflag |
449
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
449
+    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
450 450
   rm -f "$depfile"
451 451
   cat < "$tmpdepfile" > "$depfile"
452
-  tr ' ' '
453
-' < "$tmpdepfile" | \
454
-## Some versions of the HPUX 10.20 sed can't process this invocation
455
-## correctly.  Breaking it into two sed invocations is a workaround.
456
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
452
+  # Some versions of the HPUX 10.20 sed can't process this sed invocation
453
+  # correctly.  Breaking it into two sed invocations is a workaround.
454
+  tr ' ' "$nl" < "$tmpdepfile" \
455
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
456
+    | sed -e 's/$/ :/' >> "$depfile"
457 457
   rm -f "$tmpdepfile"
458 458
   ;;
459 459
 
... ...
@@ -503,12 +661,15 @@ makedepend)
503 503
   touch "$tmpdepfile"
504 504
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
505 505
   rm -f "$depfile"
506
-  cat < "$tmpdepfile" > "$depfile"
507
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
508
-' | \
509
-## Some versions of the HPUX 10.20 sed can't process this invocation
510
-## correctly.  Breaking it into two sed invocations is a workaround.
511
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
506
+  # makedepend may prepend the VPATH from the source file name to the object.
507
+  # No need to regex-escape $object, excess matching of '.' is harmless.
508
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
509
+  # Some versions of the HPUX 10.20 sed can't process the last invocation
510
+  # correctly.  Breaking it into two sed invocations is a workaround.
511
+  sed '1,2d' "$tmpdepfile" \
512
+    | tr ' ' "$nl" \
513
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
514
+    | sed -e 's/$/ :/' >> "$depfile"
512 515
   rm -f "$tmpdepfile" "$tmpdepfile".bak
513 516
   ;;
514 517
 
... ...
@@ -525,7 +686,7 @@ cpp)
525 525
     shift
526 526
   fi
527 527
 
528
-  # Remove `-o $object'.
528
+  # Remove '-o $object'.
529 529
   IFS=" "
530 530
   for arg
531 531
   do
... ...
@@ -544,10 +705,10 @@ cpp)
544 544
     esac
545 545
   done
546 546
 
547
-  "$@" -E |
548
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
549
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
550
-    sed '$ s: \\$::' > "$tmpdepfile"
547
+  "$@" -E \
548
+    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
549
+             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
550
+    | sed '$ s: \\$::' > "$tmpdepfile"
551 551
   rm -f "$depfile"
552 552
   echo "$object : \\" > "$depfile"
553 553
   cat < "$tmpdepfile" >> "$depfile"
... ...
@@ -579,23 +740,23 @@ msvisualcpp)
579 579
       shift
580 580
       ;;
581 581
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
582
-	set fnord "$@"
583
-	shift
584
-	shift
585
-	;;
582
+        set fnord "$@"
583
+        shift
584
+        shift
585
+        ;;
586 586
     *)
587
-	set fnord "$@" "$arg"
588
-	shift
589
-	shift
590
-	;;
587
+        set fnord "$@" "$arg"
588
+        shift
589
+        shift
590
+        ;;
591 591
     esac
592 592
   done
593 593
   "$@" -E 2>/dev/null |
594 594
   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
595 595
   rm -f "$depfile"
596 596
   echo "$object : \\" > "$depfile"
597
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
598
-  echo "	" >> "$depfile"
597
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
598
+  echo "$tab" >> "$depfile"
599 599
   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
600 600
   rm -f "$tmpdepfile"
601 601
   ;;
... ...
@@ -1,7 +1,7 @@
1 1
 #!/bin/sh
2 2
 # install - install a program, script, or datafile
3 3
 
4
-scriptversion=2009-04-28.21; # UTC
4
+scriptversion=2011-11-20.07; # UTC
5 5
 
6 6
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
7 7
 # later released in X11R6 (xc/config/util/install.sh) with the
... ...
@@ -35,7 +35,7 @@ scriptversion=2009-04-28.21; # UTC
35 35
 # FSF changes to this file are in the public domain.
36 36
 #
37 37
 # Calling this script install-sh is preferred over install.sh, to prevent
38
-# `make' implicit rules from creating a file called install from it
38
+# 'make' implicit rules from creating a file called install from it
39 39
 # when there is no Makefile.
40 40
 #
41 41
 # This script is compatible with the BSD install script, but was written
... ...
@@ -156,6 +156,10 @@ while test $# -ne 0; do
156 156
     -s) stripcmd=$stripprog;;
157 157
 
158 158
     -t) dst_arg=$2
159
+	# Protect names problematic for 'test' and other utilities.
160
+	case $dst_arg in
161
+	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
162
+	esac
159 163
 	shift;;
160 164
 
161 165
     -T) no_target_directory=true;;
... ...
@@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
186 186
     fi
187 187
     shift # arg
188 188
     dst_arg=$arg
189
+    # Protect names problematic for 'test' and other utilities.
190
+    case $dst_arg in
191
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
192
+    esac
189 193
   done
190 194
 fi
191 195
 
... ...
@@ -194,13 +202,17 @@ if test $# -eq 0; then
194 194
     echo "$0: no input file specified." >&2
195 195
     exit 1
196 196
   fi
197
-  # It's OK to call `install-sh -d' without argument.
197
+  # It's OK to call 'install-sh -d' without argument.
198 198
   # This can happen when creating conditional directories.
199 199
   exit 0
200 200
 fi
201 201
 
202 202
 if test -z "$dir_arg"; then
203
-  trap '(exit $?); exit' 1 2 13 15
203
+  do_exit='(exit $ret); exit $ret'
204
+  trap "ret=129; $do_exit" 1
205
+  trap "ret=130; $do_exit" 2
206
+  trap "ret=141; $do_exit" 13
207
+  trap "ret=143; $do_exit" 15
204 208
 
205 209
   # Set umask so as not to create temps with too-generous modes.
206 210
   # However, 'strip' requires both read and write access to temps.
... ...
@@ -228,9 +240,9 @@ fi
228 228
 
229 229
 for src
230 230
 do
231
-  # Protect names starting with `-'.
231
+  # Protect names problematic for 'test' and other utilities.
232 232
   case $src in
233
-    -*) src=./$src;;
233
+    -* | [=\(\)!]) src=./$src;;
234 234
   esac
235 235
 
236 236
   if test -n "$dir_arg"; then
... ...
@@ -252,12 +264,7 @@ do
252 252
       echo "$0: no destination specified." >&2
253 253
       exit 1
254 254
     fi
255
-
256 255
     dst=$dst_arg
257
-    # Protect names starting with `-'.
258
-    case $dst in
259
-      -*) dst=./$dst;;
260
-    esac
261 256
 
262 257
     # If destination is a directory, append the input filename; won't work
263 258
     # if double slashes aren't ignored.
... ...
@@ -347,7 +354,7 @@ do
347 347
 	      if test -z "$dir_arg" || {
348 348
 		   # Check for POSIX incompatibilities with -m.
349 349
 		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
350
-		   # other-writeable bit of parent directory when it shouldn't.
350
+		   # other-writable bit of parent directory when it shouldn't.
351 351
 		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
352 352
 		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
353 353
 		   case $ls_ld_tmpdir in
... ...
@@ -385,7 +392,7 @@ do
385 385
 
386 386
       case $dstdir in
387 387
 	/*) prefix='/';;
388
-	-*) prefix='./';;
388
+	[-=\(\)!]*) prefix='./';;
389 389
 	*)  prefix='';;
390 390
       esac
391 391
 
... ...
@@ -403,7 +410,7 @@ do
403 403
 
404 404
       for d
405 405
       do
406
-	test -z "$d" && continue
406
+	test X"$d" = X && continue
407 407
 
408 408
 	prefix=$prefix$d
409 409
 	if test -d "$prefix"; then
... ...
@@ -70,7 +70,7 @@
70 70
 #         compiler:		$LTCC
71 71
 #         compiler flags:		$LTCFLAGS
72 72
 #         linker:		$LD (gnu? $with_gnu_ld)
73
-#         $progname:	(GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1
73
+#         $progname:	(GNU libtool) 2.4.2
74 74
 #         automake:	$automake_version
75 75
 #         autoconf:	$autoconf_version
76 76
 #
... ...
@@ -80,7 +80,7 @@
80 80
 
81 81
 PROGRAM=libtool
82 82
 PACKAGE=libtool
83
-VERSION="2.4.2 Debian-2.4.2-1ubuntu1"
83
+VERSION=2.4.2
84 84
 TIMESTAMP=""
85 85
 package_revision=1.3337
86 86
 
... ...
@@ -1375,6 +1375,21 @@ func_replace_sysroot ()
1375 1375
 func_infer_tag ()
1376 1376
 {
1377 1377
     $opt_debug
1378
+
1379
+    # FreeBSD-specific: where we install compilers with non-standard names
1380
+    tag_compilers_CC="*cc cc* *gcc gcc* clang*"
1381
+    tag_compilers_CXX="*c++ c++* *g++ g++* clang++*"
1382
+    base_compiler=`set -- "$@"; echo $1`
1383
+
1384
+    # If $tagname isn't set, then try to infer if the default "CC" tag applies
1385
+    if test -z "$tagname"; then
1386
+      for zp in $tag_compilers_CC; do
1387
+        case $base_compiler in
1388
+	 $zp) tagname="CC"; break;;
1389
+	esac
1390
+      done
1391
+    fi
1392
+
1378 1393
     if test -n "$available_tags" && test -z "$tagname"; then
1379 1394
       CC_quoted=
1380 1395
       for arg in $CC; do
... ...
@@ -1411,7 +1426,22 @@ func_infer_tag ()
1411 1411
 	      break
1412 1412
 	      ;;
1413 1413
 	    esac
1414
-	  fi
1414
+
1415
+	    # FreeBSD-specific: try compilers based on inferred tag
1416
+	    if test -z "$tagname"; then
1417
+	      eval "tag_compilers=\$tag_compilers_${z}"
1418
+	      if test -n "$tag_compilers"; then
1419
+		for zp in $tag_compilers; do
1420
+		  case $base_compiler in   
1421
+		    $zp) tagname=$z; break;;
1422
+		  esac
1423
+		done
1424
+		if test -n "$tagname"; then
1425
+		  break
1426
+		fi
1427
+	      fi
1428
+            fi
1429
+          fi
1415 1430
 	done
1416 1431
 	# If $tagname still isn't set, then no tagged configuration
1417 1432
 	# was found and let the user know that the "--tag" command
... ...
@@ -3517,6 +3547,9 @@ static const void *lt_preloaded_setup() {
3517 3517
 	  ;;
3518 3518
 	esac
3519 3519
 	;;
3520
+      *-*-freebsd*)
3521
+	# FreeBSD doesn't need this...
3522
+	;;
3520 3523
       *)
3521 3524
 	func_fatal_error "unknown suffix for \`$my_dlsyms'"
3522 3525
 	;;
... ...
@@ -5595,6 +5628,7 @@ func_mode_link ()
5595 5595
 	  esac
5596 5596
 	  ;;
5597 5597
 	esac
5598
+	deplibs="$deplibs $arg"
5598 5599
 	continue
5599 5600
 	;;
5600 5601
 
... ...
@@ -6124,10 +6158,7 @@ func_mode_link ()
6124 6124
 	case $pass in
6125 6125
 	dlopen) libs="$dlfiles" ;;
6126 6126
 	dlpreopen) libs="$dlprefiles" ;;
6127
-	link)
6128
-	  libs="$deplibs %DEPLIBS%"
6129
-	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
6130
-	  ;;
6127
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6131 6128
 	esac
6132 6129
       fi
6133 6130
       if test "$linkmode,$pass" = "lib,dlpreopen"; then
... ...
@@ -6170,13 +6201,30 @@ func_mode_link ()
6170 6170
 	    finalize_deplibs="$deplib $finalize_deplibs"
6171 6171
 	  else
6172 6172
 	    func_append compiler_flags " $deplib"
6173
-	    if test "$linkmode" = lib ; then
6174
-		case "$new_inherited_linker_flags " in
6175
-		    *" $deplib "*) ;;
6176
-		    * ) func_append new_inherited_linker_flags " $deplib" ;;
6177
-		esac
6178
-	    fi
6179 6173
 	  fi
6174
+
6175
+	  case $linkmode in
6176
+	  lib)
6177
+	    deplibs="$deplib $deplibs"
6178
+	    test "$pass" = conv && continue
6179
+	    newdependency_libs="$deplib $newdependency_libs"
6180
+	    ;;
6181
+	  prog)
6182
+	    if test "$pass" = conv; then
6183
+	      deplibs="$deplib $deplibs"
6184
+	      continue
6185
+	    fi
6186
+	    if test "$pass" = scan; then
6187
+	      deplibs="$deplib $deplibs"
6188
+	    else
6189
+	      compile_deplibs="$deplib $compile_deplibs"
6190
+	      finalize_deplibs="$deplib $finalize_deplibs"
6191
+	    fi
6192
+	    ;;
6193
+	  *)
6194
+	    ;;
6195
+	  esac # linkmode
6196
+
6180 6197
 	  continue
6181 6198
 	  ;;
6182 6199
 	-l*)
... ...
@@ -6447,19 +6495,19 @@ func_mode_link ()
6447 6447
 	    # It is a libtool convenience library, so add in its objects.
6448 6448
 	    func_append convenience " $ladir/$objdir/$old_library"
6449 6449
 	    func_append old_convenience " $ladir/$objdir/$old_library"
6450
-	    tmp_libs=
6451
-	    for deplib in $dependency_libs; do
6452
-	      deplibs="$deplib $deplibs"
6453
-	      if $opt_preserve_dup_deps ; then
6454
-		case "$tmp_libs " in
6455
-		*" $deplib "*) func_append specialdeplibs " $deplib" ;;
6456
-		esac
6457
-	      fi
6458
-	      func_append tmp_libs " $deplib"
6459
-	    done
6460 6450
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
6461 6451
 	    func_fatal_error "\`$lib' is not a convenience library"
6462 6452
 	  fi
6453
+	  tmp_libs=
6454
+	  for deplib in $dependency_libs; do
6455
+	    deplibs="$deplib $deplibs"
6456
+	    if $opt_preserve_dup_deps ; then
6457
+	      case "$tmp_libs " in
6458
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6459
+	      esac
6460
+	    fi
6461
+	    func_append tmp_libs " $deplib"
6462
+	  done
6463 6463
 	  continue
6464 6464
 	fi # $pass = conv
6465 6465
 
... ...
@@ -7352,9 +7400,6 @@ func_mode_link ()
7352 7352
 	    revision="$number_minor"
7353 7353
 	    lt_irix_increment=no
7354 7354
 	    ;;
7355
-	  *)
7356
-	    func_fatal_configuration "$modename: unknown library version type \`$version_type'"
7357
-	    ;;
7358 7355
 	  esac
7359 7356
 	  ;;
7360 7357
 	no)
... ...
@@ -1,11 +1,10 @@
1 1
 #! /bin/sh
2
-# Common stub for a few missing GNU programs while installing.
2
+# Common wrapper for a few potentially missing GNU programs.
3 3
 
4
-scriptversion=2009-04-28.21; # UTC
4
+scriptversion=2012-06-26.16; # UTC
5 5
 
6
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
7
-# 2008, 2009 Free Software Foundation, Inc.
8
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
6
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
7
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
9 8
 
10 9
 # This program is free software; you can redistribute it and/or modify
11 10
 # it under the terms of the GNU General Public License as published by
... ...
@@ -26,69 +25,40 @@ scriptversion=2009-04-28.21; # UTC
26 26
 # the same distribution terms that you use for the rest of that program.
27 27
 
28 28
 if test $# -eq 0; then
29
-  echo 1>&2 "Try \`$0 --help' for more information"
29
+  echo 1>&2 "Try '$0 --help' for more information"
30 30
   exit 1
31 31
 fi
32 32
 
33
-run=:
34
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
35
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
36
-
37
-# In the cases where this matters, `missing' is being run in the
38
-# srcdir already.
39
-if test -f configure.ac; then
40
-  configure_ac=configure.ac
41
-else
42
-  configure_ac=configure.in
43
-fi
33
+case $1 in
44 34
 
45
-msg="missing on your system"
35
+  --is-lightweight)
36
+    # Used by our autoconf macros to check whether the available missing
37
+    # script is modern enough.
38
+    exit 0
39
+    ;;
46 40
 
47
-case $1 in
48
-  # Try to run requested program, and just exit if it succeeds.
49
-  run=
50
-  shift
51
-  "$@" && exit 0
52
-  # Exit code 63 means version mismatch.  This often happens
53
-  # when the user try to use an ancient version of a tool on
54
-  # a file that requires a minimum version.  In this case we
55
-  # we should proceed has if the program had been absent, or
56
-  # if --run hadn't been passed.
57
-  if test $? = 63; then
58
-    run=:
59
-    msg="probably too old"
60
-  fi
61
-  ;;
41
+  --run)
42
+    # Back-compat with the calling convention used by older automake.
43
+    shift
44
+    ;;
62 45
 
63 46
   -h|--h|--he|--hel|--help)
64 47
     echo "\
65 48
 $0 [OPTION]... PROGRAM [ARGUMENT]...
66 49
 
67
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
68
-error status if there is no known handling for PROGRAM.
50
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
51
+to PROGRAM being missing or too old.
69 52
 
70 53
 Options:
71 54
   -h, --help      display this help and exit
72 55
   -v, --version   output version information and exit
73
-  --run           try to run the given command, and emulate it if it fails
74 56
 
75 57
 Supported PROGRAM values:
76
-  aclocal      touch file \`aclocal.m4'
77
-  autoconf     touch file \`configure'
78
-  autoheader   touch file \`config.h.in'
79
-  autom4te     touch the output file, or create a stub one
80
-  automake     touch all \`Makefile.in' files
81
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
82
-  flex         create \`lex.yy.c', if possible, from existing .c
83
-  help2man     touch the output file
84
-  lex          create \`lex.yy.c', if possible, from existing .c
85
-  makeinfo     touch the output file
86
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
87
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
58
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
59
+  bison     yacc      flex         lex       help2man
88 60
 
89
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
90
-\`g' are ignored when checking the name.
61
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
62
+'g' are ignored when checking the name.
91 63
 
92 64
 Send bug reports to <bug-automake@gnu.org>."
93 65
     exit $?
... ...
@@ -100,272 +70,141 @@ Send bug reports to <bug-automake@gnu.org>."
100 100
     ;;
101 101
 
102 102
   -*)
103
-    echo 1>&2 "$0: Unknown \`$1' option"
104
-    echo 1>&2 "Try \`$0 --help' for more information"
103
+    echo 1>&2 "$0: unknown '$1' option"
104
+    echo 1>&2 "Try '$0 --help' for more information"
105 105
     exit 1
106 106
     ;;
107 107
 
108 108
 esac
109 109
 
110
-# normalize program name to check for.
111
-program=`echo "$1" | sed '
112
-  s/^gnu-//; t
113
-  s/^gnu//; t
114
-  s/^g//; t'`
115
-
116
-# Now exit if we have it, but it failed.  Also exit now if we
117
-# don't have it and --version was passed (most likely to detect
118
-# the program).  This is about non-GNU programs, so use $1 not
119
-# $program.
120
-case $1 in
121
-  lex*|yacc*)
122
-    # Not GNU programs, they don't have --version.
123
-    ;;
124
-
125
-  tar*)
126
-    if test -n "$run"; then
127
-       echo 1>&2 "ERROR: \`tar' requires --run"
128
-       exit 1
129
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
130
-       exit 1
131
-    fi
132
-    ;;
133
-
134
-  *)
135
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
136
-       # We have it, but it failed.
137
-       exit 1
138
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
139
-       # Could not run --version or --help.  This is probably someone
140
-       # running `$TOOL --version' or `$TOOL --help' to check whether
141
-       # $TOOL exists and not knowing $TOOL uses missing.
142
-       exit 1
143
-    fi
144
-    ;;
145
-esac
146
-
147
-# If it does not exist, or fails to run (possibly an outdated version),
148
-# try to emulate it.
149
-case $program in
150
-  aclocal*)
151
-    echo 1>&2 "\
152
-WARNING: \`$1' is $msg.  You should only need it if
153
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
154
-         to install the \`Automake' and \`Perl' packages.  Grab them from
155
-         any GNU archive site."
156
-    touch aclocal.m4
157
-    ;;
158
-
159
-  autoconf*)
160
-    echo 1>&2 "\
161
-WARNING: \`$1' is $msg.  You should only need it if
162
-         you modified \`${configure_ac}'.  You might want to install the
163
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
164
-         archive site."
165
-    touch configure
166
-    ;;
167
-
168
-  autoheader*)
169
-    echo 1>&2 "\
170
-WARNING: \`$1' is $msg.  You should only need it if
171
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
172
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
173
-         from any GNU archive site."
174
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
175
-    test -z "$files" && files="config.h"
176
-    touch_files=
177
-    for f in $files; do
178
-      case $f in
179
-      *:*) touch_files="$touch_files "`echo "$f" |
180
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
181
-      *) touch_files="$touch_files $f.in";;
182
-      esac
183
-    done
184
-    touch $touch_files
185
-    ;;
186
-
187
-  automake*)
188
-    echo 1>&2 "\
189
-WARNING: \`$1' is $msg.  You should only need it if
190
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
191
-         You might want to install the \`Automake' and \`Perl' packages.
192
-         Grab them from any GNU archive site."
193
-    find . -type f -name Makefile.am -print |
194
-	   sed 's/\.am$/.in/' |
195
-	   while read f; do touch "$f"; done
196
-    ;;
197
-
198
-  autom4te*)
199
-    echo 1>&2 "\
200
-WARNING: \`$1' is needed, but is $msg.
201
-         You might have modified some files without having the
202
-         proper tools for further handling them.
203
-         You can get \`$1' as part of \`Autoconf' from any GNU
204
-         archive site."
205
-
206
-    file=`echo "$*" | sed -n "$sed_output"`
207
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
208
-    if test -f "$file"; then
209
-	touch $file
210
-    else
211
-	test -z "$file" || exec >$file
212
-	echo "#! /bin/sh"
213
-	echo "# Created by GNU Automake missing as a replacement of"
214
-	echo "#  $ $@"
215
-	echo "exit 0"
216
-	chmod +x $file
217
-	exit 1
218
-    fi
219
-    ;;
220
-
221
-  bison*|yacc*)
222
-    echo 1>&2 "\
223
-WARNING: \`$1' $msg.  You should only need it if
224
-         you modified a \`.y' file.  You may need the \`Bison' package
225
-         in order for those modifications to take effect.  You can get
226
-         \`Bison' from any GNU archive site."
227
-    rm -f y.tab.c y.tab.h
228
-    if test $# -ne 1; then
229
-        eval LASTARG="\${$#}"
230
-	case $LASTARG in
231
-	*.y)
232
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
233
-	    if test -f "$SRCFILE"; then
234
-	         cp "$SRCFILE" y.tab.c
235
-	    fi
236
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
237
-	    if test -f "$SRCFILE"; then
238
-	         cp "$SRCFILE" y.tab.h
239
-	    fi
240
-	  ;;
241
-	esac
242
-    fi
243
-    if test ! -f y.tab.h; then
244
-	echo >y.tab.h
245
-    fi
246
-    if test ! -f y.tab.c; then
247
-	echo 'main() { return 0; }' >y.tab.c
248
-    fi
249
-    ;;
250
-
251
-  lex*|flex*)
252
-    echo 1>&2 "\
253
-WARNING: \`$1' is $msg.  You should only need it if
254
-         you modified a \`.l' file.  You may need the \`Flex' package
255
-         in order for those modifications to take effect.  You can get
256
-         \`Flex' from any GNU archive site."
257
-    rm -f lex.yy.c
258
-    if test $# -ne 1; then
259
-        eval LASTARG="\${$#}"
260
-	case $LASTARG in
261
-	*.l)
262
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
263
-	    if test -f "$SRCFILE"; then
264
-	         cp "$SRCFILE" lex.yy.c
265
-	    fi
266
-	  ;;
267
-	esac
268
-    fi
269
-    if test ! -f lex.yy.c; then
270
-	echo 'main() { return 0; }' >lex.yy.c
271
-    fi
272
-    ;;
273
-
274
-  help2man*)
275
-    echo 1>&2 "\
276
-WARNING: \`$1' is $msg.  You should only need it if
277
-	 you modified a dependency of a manual page.  You may need the
278
-	 \`Help2man' package in order for those modifications to take
279
-	 effect.  You can get \`Help2man' from any GNU archive site."
280
-
281
-    file=`echo "$*" | sed -n "$sed_output"`
282
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
283
-    if test -f "$file"; then
284
-	touch $file
285
-    else
286
-	test -z "$file" || exec >$file
287
-	echo ".ab help2man is required to generate this page"
288
-	exit $?
289
-    fi
290
-    ;;
291
-
292
-  makeinfo*)
293
-    echo 1>&2 "\
294
-WARNING: \`$1' is $msg.  You should only need it if
295
-         you modified a \`.texi' or \`.texinfo' file, or any other file
296
-         indirectly affecting the aspect of the manual.  The spurious
297
-         call might also be the consequence of using a buggy \`make' (AIX,
298
-         DU, IRIX).  You might want to install the \`Texinfo' package or
299
-         the \`GNU make' package.  Grab either from any GNU archive site."
300
-    # The file to touch is that specified with -o ...
301
-    file=`echo "$*" | sed -n "$sed_output"`
302
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
303
-    if test -z "$file"; then
304
-      # ... or it is the one specified with @setfilename ...
305
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
306
-      file=`sed -n '
307
-	/^@setfilename/{
308
-	  s/.* \([^ ]*\) *$/\1/
309
-	  p
310
-	  q
311
-	}' $infile`
312
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
313
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
314
-    fi
315
-    # If the file does not exist, the user really needs makeinfo;
316
-    # let's fail without touching anything.
317
-    test -f $file || exit 1
318
-    touch $file
319
-    ;;
320
-
321
-  tar*)
322
-    shift
323
-
324
-    # We have already tried tar in the generic part.
325
-    # Look for gnutar/gtar before invocation to avoid ugly error
326
-    # messages.
327
-    if (gnutar --version > /dev/null 2>&1); then
328
-       gnutar "$@" && exit 0
329
-    fi
330
-    if (gtar --version > /dev/null 2>&1); then
331
-       gtar "$@" && exit 0
332
-    fi
333
-    firstarg="$1"
334
-    if shift; then
335
-	case $firstarg in
336
-	*o*)
337
-	    firstarg=`echo "$firstarg" | sed s/o//`
338
-	    tar "$firstarg" "$@" && exit 0
339
-	    ;;
340
-	esac
341
-	case $firstarg in
342
-	*h*)
343
-	    firstarg=`echo "$firstarg" | sed s/h//`
344
-	    tar "$firstarg" "$@" && exit 0
345
-	    ;;
346
-	esac
347
-    fi
348
-
349
-    echo 1>&2 "\
350
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
351
-         You may want to install GNU tar or Free paxutils, or check the
352
-         command line arguments."
353
-    exit 1
354
-    ;;
355
-
356
-  *)
357
-    echo 1>&2 "\
358
-WARNING: \`$1' is needed, and is $msg.
359
-         You might have modified some files without having the
360
-         proper tools for further handling them.  Check the \`README' file,
361
-         it often tells you about the needed prerequisites for installing
362
-         this package.  You may also peek at any GNU archive site, in case
363
-         some other package would contain this missing \`$1' program."
364
-    exit 1
365
-    ;;
366
-esac
110
+# Run the given program, remember its exit status.
111
+"$@"; st=$?
112
+
113
+# If it succeeded, we are done.
114
+test $st -eq 0 && exit 0
115
+
116
+# Also exit now if we it failed (or wasn't found), and '--version' was
117
+# passed; such an option is passed most likely to detect whether the
118
+# program is present and works.
119
+case $2 in --version|--help) exit $st;; esac
120
+
121
+# Exit code 63 means version mismatch.  This often happens when the user
122
+# tries to use an ancient version of a tool on a file that requires a
123
+# minimum version.
124
+if test $st -eq 63; then
125
+  msg="probably too old"
126
+elif test $st -eq 127; then
127
+  # Program was missing.
128
+  msg="missing on your system"
129
+else
130
+  # Program was found and executed, but failed.  Give up.
131
+  exit $st
132
+fi
367 133
 
368
-exit 0
134
+perl_URL=http://www.perl.org/
135
+flex_URL=http://flex.sourceforge.net/
136
+gnu_software_URL=http://www.gnu.org/software
137
+
138
+program_details ()
139
+{
140
+  case $1 in
141
+    aclocal|automake)
142
+      echo "The '$1' program is part of the GNU Automake package:"
143
+      echo "<$gnu_software_URL/automake>"
144
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
145
+      echo "<$gnu_software_URL/autoconf>"
146
+      echo "<$gnu_software_URL/m4/>"
147
+      echo "<$perl_URL>"
148
+      ;;
149
+    autoconf|autom4te|autoheader)
150
+      echo "The '$1' program is part of the GNU Autoconf package:"
151
+      echo "<$gnu_software_URL/autoconf/>"
152
+      echo "It also requires GNU m4 and Perl in order to run:"
153
+      echo "<$gnu_software_URL/m4/>"
154
+      echo "<$perl_URL>"
155
+      ;;
156
+  esac
157
+}
158
+
159
+give_advice ()
160
+{
161
+  # Normalize program name to check for.
162
+  normalized_program=`echo "$1" | sed '
163
+    s/^gnu-//; t
164
+    s/^gnu//; t
165
+    s/^g//; t'`
166
+
167
+  printf '%s\n' "'$1' is $msg."
168
+
169
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
170
+  case $normalized_program in
171
+    autoconf*)
172
+      echo "You should only need it if you modified 'configure.ac',"
173
+      echo "or m4 files included by it."
174
+      program_details 'autoconf'
175
+      ;;
176
+    autoheader*)
177
+      echo "You should only need it if you modified 'acconfig.h' or"
178
+      echo "$configure_deps."
179
+      program_details 'autoheader'
180
+      ;;
181
+    automake*)
182
+      echo "You should only need it if you modified 'Makefile.am' or"
183
+      echo "$configure_deps."
184
+      program_details 'automake'
185
+      ;;
186
+    aclocal*)
187
+      echo "You should only need it if you modified 'acinclude.m4' or"
188
+      echo "$configure_deps."
189
+      program_details 'aclocal'
190
+      ;;
191
+   autom4te*)
192
+      echo "You might have modified some maintainer files that require"
193
+      echo "the 'automa4te' program to be rebuilt."
194
+      program_details 'autom4te'
195
+      ;;
196
+    bison*|yacc*)
197
+      echo "You should only need it if you modified a '.y' file."
198
+      echo "You may want to install the GNU Bison package:"
199
+      echo "<$gnu_software_URL/bison/>"
200
+      ;;
201
+    lex*|flex*)
202
+      echo "You should only need it if you modified a '.l' file."
203
+      echo "You may want to install the Fast Lexical Analyzer package:"
204
+      echo "<$flex_URL>"
205
+      ;;
206
+    help2man*)
207
+      echo "You should only need it if you modified a dependency" \
208
+           "of a man page."
209
+      echo "You may want to install the GNU Help2man package:"
210
+      echo "<$gnu_software_URL/help2man/>"
211
+    ;;
212
+    makeinfo*)
213
+      echo "You should only need it if you modified a '.texi' file, or"
214
+      echo "any other file indirectly affecting the aspect of the manual."
215
+      echo "You might want to install the Texinfo package:"
216
+      echo "<$gnu_software_URL/texinfo/>"
217
+      echo "The spurious makeinfo call might also be the consequence of"
218
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
219
+      echo "want to install GNU make:"
220
+      echo "<$gnu_software_URL/make/>"
221
+      ;;
222
+    *)
223
+      echo "You might have modified some files without having the proper"
224
+      echo "tools for further handling them.  Check the 'README' file, it"
225
+      echo "often tells you about the needed prerequisites for installing"
226
+      echo "this package.  You may also peek at any GNU archive site, in"
227
+      echo "case some other package contains this missing '$1' program."
228
+      ;;
229
+  esac
230
+}
231
+
232
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
233
+                       -e '2,$s/^/         /' >&2
234
+
235
+# Propagate the correct exit status (expected to be 127 for a program
236
+# not found, 63 for a program that failed due to version mismatch).
237
+exit $st
369 238
 
370 239
 # Local variables:
371 240
 # eval: (add-hook 'write-file-hooks 'time-stamp)
... ...
@@ -5745,7 +5745,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
5745 5745
   lt_cv_deplibs_check_method=pass_all
5746 5746
   ;;
5747 5747
 
5748
-netbsd* | netbsdelf*-gnu)
5748
+netbsd*)
5749 5749
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
5750 5750
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
5751 5751
   else
... ...
@@ -9144,9 +9144,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
9144 9144
   openbsd*)
9145 9145
     with_gnu_ld=no
9146 9146
     ;;
9147
-  linux* | k*bsd*-gnu | gnu*)
9148
-    link_all_deplibs=no
9149
-    ;;
9150 9147
   esac
9151 9148
 
9152 9149
   ld_shlibs=yes
... ...
@@ -9368,7 +9365,7 @@ _LT_EOF
9368 9368
       fi
9369 9369
       ;;
9370 9370
 
9371
-    netbsd* | netbsdelf*-gnu)
9371
+    netbsd*)
9372 9372
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
9373 9373
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
9374 9374
 	wlarc=
... ...
@@ -9545,7 +9542,6 @@ _LT_EOF
9545 9545
 	if test "$aix_use_runtimelinking" = yes; then
9546 9546
 	  shared_flag="$shared_flag "'${wl}-G'
9547 9547
 	fi
9548
-	link_all_deplibs=no
9549 9548
       else
9550 9549
 	# not using gcc
9551 9550
 	if test "$host_cpu" = ia64; then
... ...
@@ -9999,7 +9995,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
9999 9999
       link_all_deplibs=yes
10000 10000
       ;;
10001 10001
 
10002
-    netbsd* | netbsdelf*-gnu)
10002
+    netbsd*)
10003 10003
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
10004 10004
 	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
10005 10005
       else
... ...
@@ -11027,18 +11023,6 @@ fi
11027 11027
   dynamic_linker='GNU/Linux ld.so'
11028 11028
   ;;
11029 11029
 
11030
-netbsdelf*-gnu)
11031
-  version_type=linux
11032
-  need_lib_prefix=no
11033
-  need_version=no
11034
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
11035
-  soname_spec='${libname}${release}${shared_ext}$major'
11036
-  shlibpath_var=LD_LIBRARY_PATH
11037
-  shlibpath_overrides_runpath=no
11038
-  hardcode_into_libs=yes
11039
-  dynamic_linker='NetBSD ld.elf_so'
11040
-  ;;
11041
-
11042 11030
 netbsd*)
11043 11031
   version_type=sunos
11044 11032
   need_lib_prefix=no
... ...
@@ -12619,7 +12603,7 @@ else
12619 12619
     # at 6.2 and later dlopen does load deplibs.
12620 12620
     lt_cv_sys_dlopen_deplibs=yes
12621 12621
     ;;
12622
-  netbsd* | netbsdelf*-gnu)
12622
+  netbsd*)
12623 12623
     lt_cv_sys_dlopen_deplibs=yes
12624 12624
     ;;
12625 12625
   openbsd*)
... ...
@@ -34,7 +34,7 @@ AC_CREATE_TARGET_H([target.h])
34 34
 
35 35
 dnl -Wall and -Werror here are NOT CFLAGS, they refer to automake warnings
36 36
 dnl enable stealth builds and psychedelic tests
37
-AM_INIT_AUTOMAKE([1.11 -Wall -Wportability -Wno-override -Werror std-options foreign dist-bzip2 no-define color-tests parallel-tests tar-ustar])
37
+AM_INIT_AUTOMAKE([1.11 -Wall -Wportability -Wno-override std-options foreign dist-bzip2 no-define color-tests parallel-tests tar-ustar])
38 38
 AM_SILENT_RULES([yes])
39 39
 
40 40
 dnl we told automake to not define these, since we want to include
... ...
@@ -418,6 +418,12 @@ libclamav_la_SOURCES = \
418 418
 	asn1.h \
419 419
 	fpu.c \
420 420
 	fpu.h
421
+	stats.c \
422
+	stats.h \
423
+	www.c \
424
+	www.h \
425
+	json.c \
426
+	json.h
421 427
 
422 428
 libclamav_la_SOURCES += bignum.h\
423 429
 	bignum_fast.h\
... ...
@@ -3162,6 +3162,12 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
3162 3162
 @ENABLE_LLVM_FALSE@c++/Makefile: c++/Makefile.nollvm.in
3163 3163
 @ENABLE_LLVM_FALSE@	$(AM_V_at) cp $< $@
3164 3164
 @ENABLE_LLVM_FALSE@distclean-recursive distdir maintainer-clean-recursive: c++/Makefile
3165
+	stats.c \
3166
+	stats.h \
3167
+	www.c \
3168
+	www.h \
3169
+	json.c \
3170
+	json.h
3165 3171
 
3166 3172
 .PHONY: version.h.tmp
3167 3173
 version.c: version.h
... ...
@@ -1,14 +1,12 @@
1 1
 #! /bin/sh
2 2
 # Attempt to guess a canonical system name.
3
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5
-#   Free Software Foundation, Inc.
3
+#   Copyright 1992-2013 Free Software Foundation, Inc.
6 4
 
7
-timestamp='2009-12-30'
5
+timestamp='2013-05-16'
8 6
 
9 7
 # This file is free software; you can redistribute it and/or modify it
10 8
 # under the terms of the GNU General Public License as published by
11
-# the Free Software Foundation; either version 2 of the License, or
9
+# the Free Software Foundation; either version 3 of the License, or
12 10
 # (at your option) any later version.
13 11
 #
14 12
 # This program is distributed in the hope that it will be useful, but
... ...
@@ -17,26 +15,22 @@ timestamp='2009-12-30'
17 17
 # General Public License for more details.
18 18
 #
19 19
 # You should have received a copy of the GNU General Public License
20
-# along with this program; if not, write to the Free Software
21
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
22
-# 02110-1301, USA.
20
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
23 21
 #
24 22
 # As a special exception to the GNU General Public License, if you
25 23
 # distribute this file as part of a program that contains a
26 24
 # configuration script generated by Autoconf, you may include it under
27
-# the same distribution terms that you use for the rest of that program.
28
-
29
-
30
-# Originally written by Per Bothner.  Please send patches (context
31
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
32
-# entry.
25
+# the same distribution terms that you use for the rest of that
26
+# program.  This Exception is an additional permission under section 7
27
+# of the GNU General Public License, version 3 ("GPLv3").
33 28
 #
34
-# This script attempts to guess a canonical system name similar to
35
-# config.sub.  If it succeeds, it prints the system name on stdout, and
36
-# exits with 0.  Otherwise, it exits with 1.
29
+# Originally written by Per Bothner.
37 30
 #
38 31
 # You can get the latest version of this script from:
39 32
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
33
+#
34
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
35
+
40 36
 
41 37
 me=`echo "$0" | sed -e 's,.*/,,'`
42 38
 
... ...
@@ -56,9 +50,7 @@ version="\
56 56
 GNU config.guess ($timestamp)
57 57
 
58 58
 Originally written by Per Bothner.
59
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
60
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
61
-Software Foundation, Inc.
59
+Copyright 1992-2013 Free Software Foundation, Inc.
62 60
 
63 61
 This is free software; see the source for copying conditions.  There is NO
64 62
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
... ...
@@ -140,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
140 140
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
141 141
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
142 142
 
143
+case "${UNAME_SYSTEM}" in
144
+Linux|GNU|GNU/*)
145
+	# If the system lacks a compiler, then just pick glibc.
146
+	# We could probably try harder.
147
+	LIBC=gnu
148
+
149
+	eval $set_cc_for_build
150
+	cat <<-EOF > $dummy.c
151
+	#include <features.h>
152
+	#if defined(__UCLIBC__)
153
+	LIBC=uclibc
154
+	#elif defined(__dietlibc__)
155
+	LIBC=dietlibc
156
+	#else
157
+	LIBC=gnu
158
+	#endif
159
+	EOF
160
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
161
+	;;
162
+esac
163
+
143 164
 # Note: order is significant - the case branches are not exclusive.
144 165
 
145 166
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
146 167
     *:NetBSD:*:*)
147 168
 	# NetBSD (nbsd) targets should (where applicable) match one or
148
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
169
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
149 170
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
150 171
 	# switched to ELF, *-*-netbsd* would select the old
151 172
 	# object file format.  This provides both forward
... ...
@@ -181,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
181 181
 		fi
182 182
 		;;
183 183
 	    *)
184
-	        os=netbsd
184
+		os=netbsd
185 185
 		;;
186 186
 	esac
187 187
 	# The OS release
... ...
@@ -202,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
202 202
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
203 203
 	echo "${machine}-${os}${release}"
204 204
 	exit ;;
205
+    *:Bitrig:*:*)
206
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
207
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
208
+	exit ;;
205 209
     *:OpenBSD:*:*)
206 210
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
207 211
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
... ...
@@ -224,7 +241,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
224 224
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
225 225
 		;;
226 226
 	*5.*)
227
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
227
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
228 228
 		;;
229 229
 	esac
230 230
 	# According to Compaq, /usr/sbin/psrinfo has been available on
... ...
@@ -270,7 +287,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
270 270
 	# A Xn.n version is an unreleased experimental baselevel.
271 271
 	# 1.2 uses "1.2" for uname -r.
272 272
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
273
-	exit ;;
273
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
274
+	exitcode=$?
275
+	trap '' 0
276
+	exit $exitcode ;;
274 277
     Alpha\ *:Windows_NT*:*)
275 278
 	# How do we know it's Interix rather than the generic POSIX subsystem?
276 279
 	# Should we change UNAME_MACHINE based on the output of uname instead
... ...
@@ -296,12 +316,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
296 296
 	echo s390-ibm-zvmoe
297 297
 	exit ;;
298 298
     *:OS400:*:*)
299
-        echo powerpc-ibm-os400
299
+	echo powerpc-ibm-os400
300 300
 	exit ;;
301 301
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
302 302
 	echo arm-acorn-riscix${UNAME_RELEASE}
303 303
 	exit ;;
304
-    arm:riscos:*:*|arm:RISCOS:*:*)
304
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
305 305
 	echo arm-unknown-riscos
306 306
 	exit ;;
307 307
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
... ...
@@ -395,23 +415,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
395 395
     # MiNT.  But MiNT is downward compatible to TOS, so this should
396 396
     # be no problem.
397 397
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
398
-        echo m68k-atari-mint${UNAME_RELEASE}
398
+	echo m68k-atari-mint${UNAME_RELEASE}
399 399
 	exit ;;
400 400
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
401 401
 	echo m68k-atari-mint${UNAME_RELEASE}
402
-        exit ;;
402
+	exit ;;
403 403
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
404
-        echo m68k-atari-mint${UNAME_RELEASE}
404
+	echo m68k-atari-mint${UNAME_RELEASE}
405 405
 	exit ;;
406 406
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
407
-        echo m68k-milan-mint${UNAME_RELEASE}
408
-        exit ;;
407
+	echo m68k-milan-mint${UNAME_RELEASE}
408
+	exit ;;
409 409
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
410
-        echo m68k-hades-mint${UNAME_RELEASE}
411
-        exit ;;
410
+	echo m68k-hades-mint${UNAME_RELEASE}
411
+	exit ;;
412 412
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
413
-        echo m68k-unknown-mint${UNAME_RELEASE}
414
-        exit ;;
413
+	echo m68k-unknown-mint${UNAME_RELEASE}
414
+	exit ;;
415 415
     m68k:machten:*:*)
416 416
 	echo m68k-apple-machten${UNAME_RELEASE}
417 417
 	exit ;;
... ...
@@ -481,8 +501,8 @@ EOF
481 481
 	echo m88k-motorola-sysv3
482 482
 	exit ;;
483 483
     AViiON:dgux:*:*)
484
-        # DG/UX returns AViiON for all architectures
485
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
484
+	# DG/UX returns AViiON for all architectures
485
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
486 486
 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
487 487
 	then
488 488
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
... ...
@@ -495,7 +515,7 @@ EOF
495 495
 	else
496 496
 	    echo i586-dg-dgux${UNAME_RELEASE}
497 497
 	fi
498
- 	exit ;;
498
+	exit ;;
499 499
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
500 500
 	echo m88k-dolphin-sysv3
501 501
 	exit ;;
... ...
@@ -552,7 +572,7 @@ EOF
552 552
 		echo rs6000-ibm-aix3.2
553 553
 	fi
554 554
 	exit ;;
555
-    *:AIX:*:[456])
555
+    *:AIX:*:[4567])
556 556
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
557 557
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
558 558
 		IBM_ARCH=rs6000
... ...
@@ -595,52 +615,52 @@ EOF
595 595
 	    9000/[678][0-9][0-9])
596 596
 		if [ -x /usr/bin/getconf ]; then
597 597
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
598
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
599
-                    case "${sc_cpu_version}" in
600
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
601
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
602
-                      532)                      # CPU_PA_RISC2_0
603
-                        case "${sc_kernel_bits}" in
604
-                          32) HP_ARCH="hppa2.0n" ;;
605
-                          64) HP_ARCH="hppa2.0w" ;;
598
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
599
+		    case "${sc_cpu_version}" in
600
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
601
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
602
+		      532)                      # CPU_PA_RISC2_0
603
+			case "${sc_kernel_bits}" in
604
+			  32) HP_ARCH="hppa2.0n" ;;
605
+			  64) HP_ARCH="hppa2.0w" ;;
606 606
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
607
-                        esac ;;
608
-                    esac
607
+			esac ;;
608
+		    esac
609 609
 		fi
610 610
 		if [ "${HP_ARCH}" = "" ]; then
611 611
 		    eval $set_cc_for_build
612
-		    sed 's/^              //' << EOF >$dummy.c
612
+		    sed 's/^		//' << EOF >$dummy.c
613 613
 
614
-              #define _HPUX_SOURCE
615
-              #include <stdlib.h>
616
-              #include <unistd.h>
614
+		#define _HPUX_SOURCE
615
+		#include <stdlib.h>
616
+		#include <unistd.h>
617 617
 
618
-              int main ()
619
-              {
620
-              #if defined(_SC_KERNEL_BITS)
621
-                  long bits = sysconf(_SC_KERNEL_BITS);
622
-              #endif
623
-                  long cpu  = sysconf (_SC_CPU_VERSION);
618
+		int main ()
619
+		{
620
+		#if defined(_SC_KERNEL_BITS)
621
+		    long bits = sysconf(_SC_KERNEL_BITS);
622
+		#endif
623
+		    long cpu  = sysconf (_SC_CPU_VERSION);
624 624
 
625
-                  switch (cpu)
626
-              	{
627
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
628
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
629
-              	case CPU_PA_RISC2_0:
630
-              #if defined(_SC_KERNEL_BITS)
631
-              	    switch (bits)
632
-              		{
633
-              		case 64: puts ("hppa2.0w"); break;
634
-              		case 32: puts ("hppa2.0n"); break;
635
-              		default: puts ("hppa2.0"); break;
636
-              		} break;
637
-              #else  /* !defined(_SC_KERNEL_BITS) */
638
-              	    puts ("hppa2.0"); break;
639
-              #endif
640
-              	default: puts ("hppa1.0"); break;
641
-              	}
642
-                  exit (0);
643
-              }
625
+		    switch (cpu)
626
+			{
627
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
628
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
629
+			case CPU_PA_RISC2_0:
630
+		#if defined(_SC_KERNEL_BITS)
631
+			    switch (bits)
632
+				{
633
+				case 64: puts ("hppa2.0w"); break;
634
+				case 32: puts ("hppa2.0n"); break;
635
+				default: puts ("hppa2.0"); break;
636
+				} break;
637
+		#else  /* !defined(_SC_KERNEL_BITS) */
638
+			    puts ("hppa2.0"); break;
639
+		#endif
640
+			default: puts ("hppa1.0"); break;
641
+			}
642
+		    exit (0);
643
+		}
644 644
 EOF
645 645
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
646 646
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
... ...
@@ -731,22 +751,22 @@ EOF
731 731
 	exit ;;
732 732
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
733 733
 	echo c1-convex-bsd
734
-        exit ;;
734
+	exit ;;
735 735
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
736 736
 	if getsysinfo -f scalar_acc
737 737
 	then echo c32-convex-bsd
738 738
 	else echo c2-convex-bsd
739 739
 	fi
740
-        exit ;;
740
+	exit ;;
741 741
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
742 742
 	echo c34-convex-bsd
743
-        exit ;;
743
+	exit ;;
744 744
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
745 745
 	echo c38-convex-bsd
746
-        exit ;;
746
+	exit ;;
747 747
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
748 748
 	echo c4-convex-bsd
749
-        exit ;;
749
+	exit ;;
750 750
     CRAY*Y-MP:*:*:*)
751 751
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
752 752
 	exit ;;
... ...
@@ -770,14 +790,14 @@ EOF
770 770
 	exit ;;
771 771
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
772 772
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
773
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
774
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
775
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
776
-        exit ;;
773
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
774
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
775
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
776
+	exit ;;
777 777
     5000:UNIX_System_V:4.*:*)
778
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
779
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
780
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
778
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
779
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
780
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
781 781
 	exit ;;
782 782
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
783 783
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
... ...
@@ -789,30 +809,30 @@ EOF
789 789
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
790 790
 	exit ;;
791 791
     *:FreeBSD:*:*)
792
-	case ${UNAME_MACHINE} in
793
-	    pc98)
794
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
795
-	    amd64)
796
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
797
-	    *)
798
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
799
-	esac
792
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
793
+	echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
800 794
 	exit ;;
801 795
     i*:CYGWIN*:*)
802 796
 	echo ${UNAME_MACHINE}-pc-cygwin
803 797
 	exit ;;
798
+    *:MINGW64*:*)
799
+	echo ${UNAME_MACHINE}-pc-mingw64
800
+	exit ;;
804 801
     *:MINGW*:*)
805 802
 	echo ${UNAME_MACHINE}-pc-mingw32
806 803
 	exit ;;
804
+    i*:MSYS*:*)
805
+	echo ${UNAME_MACHINE}-pc-msys
806
+	exit ;;
807 807
     i*:windows32*:*)
808
-    	# uname -m includes "-pc" on this system.
809
-    	echo ${UNAME_MACHINE}-mingw32
808
+	# uname -m includes "-pc" on this system.
809
+	echo ${UNAME_MACHINE}-mingw32
810 810
 	exit ;;
811 811
     i*:PW*:*)
812 812
 	echo ${UNAME_MACHINE}-pc-pw32
813 813
 	exit ;;
814 814
     *:Interix*:*)
815
-    	case ${UNAME_MACHINE} in
815
+	case ${UNAME_MACHINE} in
816 816
 	    x86)
817 817
 		echo i586-pc-interix${UNAME_RELEASE}
818 818
 		exit ;;
... ...
@@ -849,15 +869,22 @@ EOF
849 849
 	exit ;;
850 850
     *:GNU:*:*)
851 851
 	# the GNU system
852
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
852
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
853 853
 	exit ;;
854 854
     *:GNU/*:*:*)
855 855
 	# other systems with GNU libc and userland
856
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
856
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
857 857
 	exit ;;
858 858
     i*86:Minix:*:*)
859 859
 	echo ${UNAME_MACHINE}-pc-minix
860 860
 	exit ;;
861
+    aarch64:Linux:*:*)
862
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
863
+	exit ;;
864
+    aarch64_be:Linux:*:*)
865
+	UNAME_MACHINE=aarch64_be
866
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
867
+	exit ;;
861 868
     alpha:Linux:*:*)
862 869
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
863 870
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
... ...
@@ -867,52 +894,56 @@ EOF
867 867
 	  EV6)   UNAME_MACHINE=alphaev6 ;;
868 868
 	  EV67)  UNAME_MACHINE=alphaev67 ;;
869 869
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
870
-        esac
870
+	esac
871 871
 	objdump --private-headers /bin/sh | grep -q ld.so.1
872
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
873
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
872
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
873
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
874
+	exit ;;
875
+    arc:Linux:*:* | arceb:Linux:*:*)
876
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
874 877
 	exit ;;
875 878
     arm*:Linux:*:*)
876 879
 	eval $set_cc_for_build
877 880
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
878 881
 	    | grep -q __ARM_EABI__
879 882
 	then
880
-	    echo ${UNAME_MACHINE}-unknown-linux-gnu
883
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
881 884
 	else
882
-	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
885
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
886
+		| grep -q __ARM_PCS_VFP
887
+	    then
888
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
889
+	    else
890
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
891
+	    fi
883 892
 	fi
884 893
 	exit ;;
885 894
     avr32*:Linux:*:*)
886
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
895
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
887 896
 	exit ;;
888 897
     cris:Linux:*:*)
889
-	echo cris-axis-linux-gnu
898
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
890 899
 	exit ;;
891 900
     crisv32:Linux:*:*)
892
-	echo crisv32-axis-linux-gnu
901
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
893 902
 	exit ;;
894 903
     frv:Linux:*:*)
895
-    	echo frv-unknown-linux-gnu
904
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
905
+	exit ;;
906
+    hexagon:Linux:*:*)
907
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
896 908
 	exit ;;
897 909
     i*86:Linux:*:*)
898
-	LIBC=gnu
899
-	eval $set_cc_for_build
900
-	sed 's/^	//' << EOF >$dummy.c
901
-	#ifdef __dietlibc__
902
-	LIBC=dietlibc
903
-	#endif
904
-EOF
905
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
906
-	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
910
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
907 911
 	exit ;;
908 912
     ia64:Linux:*:*)
909
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
913
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
910 914
 	exit ;;
911 915
     m32r*:Linux:*:*)
912
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
916
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
913 917
 	exit ;;
914 918
     m68*:Linux:*:*)
915
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
919
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
916 920
 	exit ;;
917 921
     mips:Linux:*:* | mips64:Linux:*:*)
918 922
 	eval $set_cc_for_build
... ...
@@ -931,51 +962,57 @@ EOF
931 931
 	#endif
932 932
 EOF
933 933
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
934
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
934
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
935 935
 	;;
936
+    or1k:Linux:*:*)
937
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
938
+	exit ;;
936 939
     or32:Linux:*:*)
937
-	echo or32-unknown-linux-gnu
940
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
938 941
 	exit ;;
939 942
     padre:Linux:*:*)
940
-	echo sparc-unknown-linux-gnu
943
+	echo sparc-unknown-linux-${LIBC}
941 944
 	exit ;;
942 945
     parisc64:Linux:*:* | hppa64:Linux:*:*)
943
-	echo hppa64-unknown-linux-gnu
946
+	echo hppa64-unknown-linux-${LIBC}
944 947
 	exit ;;
945 948
     parisc:Linux:*:* | hppa:Linux:*:*)
946 949
 	# Look for CPU level
947 950
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
948
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
949
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
950
-	  *)    echo hppa-unknown-linux-gnu ;;
951
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
952
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
953
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
951 954
 	esac
952 955
 	exit ;;
953 956
     ppc64:Linux:*:*)
954
-	echo powerpc64-unknown-linux-gnu
957
+	echo powerpc64-unknown-linux-${LIBC}
955 958
 	exit ;;
956 959
     ppc:Linux:*:*)
957
-	echo powerpc-unknown-linux-gnu
960
+	echo powerpc-unknown-linux-${LIBC}
958 961
 	exit ;;
959 962
     s390:Linux:*:* | s390x:Linux:*:*)
960
-	echo ${UNAME_MACHINE}-ibm-linux
963
+	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
961 964
 	exit ;;
962 965
     sh64*:Linux:*:*)
963
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
966
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
964 967
 	exit ;;
965 968
     sh*:Linux:*:*)
966
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
969
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
967 970
 	exit ;;
968 971
     sparc:Linux:*:* | sparc64:Linux:*:*)
969
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
972
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
973
+	exit ;;
974
+    tile*:Linux:*:*)
975
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
970 976
 	exit ;;
971 977
     vax:Linux:*:*)
972
-	echo ${UNAME_MACHINE}-dec-linux-gnu
978
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
973 979
 	exit ;;
974 980
     x86_64:Linux:*:*)
975
-	echo x86_64-unknown-linux-gnu
981
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
976 982
 	exit ;;
977 983
     xtensa*:Linux:*:*)
978
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
984
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
979 985
 	exit ;;
980 986
     i*86:DYNIX/ptx:4*:*)
981 987
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
... ...
@@ -984,11 +1021,11 @@ EOF
984 984
 	echo i386-sequent-sysv4
985 985
 	exit ;;
986 986
     i*86:UNIX_SV:4.2MP:2.*)
987
-        # Unixware is an offshoot of SVR4, but it has its own version
988
-        # number series starting with 2...
989
-        # I am not positive that other SVR4 systems won't match this,
987
+	# Unixware is an offshoot of SVR4, but it has its own version
988
+	# number series starting with 2...
989
+	# I am not positive that other SVR4 systems won't match this,
990 990
 	# I just have to hope.  -- rms.
991
-        # Use sysv4.2uw... so that sysv4* matches it.
991
+	# Use sysv4.2uw... so that sysv4* matches it.
992 992
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
993 993
 	exit ;;
994 994
     i*86:OS/2:*:*)
... ...
@@ -1020,7 +1057,7 @@ EOF
1020 1020
 	fi
1021 1021
 	exit ;;
1022 1022
     i*86:*:5:[678]*)
1023
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1023
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1024 1024
 	case `/bin/uname -X | grep "^Machine"` in
1025 1025
 	    *486*)	     UNAME_MACHINE=i486 ;;
1026 1026
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
... ...
@@ -1048,13 +1085,13 @@ EOF
1048 1048
 	exit ;;
1049 1049
     pc:*:*:*)
1050 1050
 	# Left here for compatibility:
1051
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1052
-        # the processor, so we play safe by assuming i586.
1051
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1052
+	# the processor, so we play safe by assuming i586.
1053 1053
 	# Note: whatever this is, it MUST be the same as what config.sub
1054 1054
 	# prints for the "djgpp" host, or else GDB configury will decide that
1055 1055
 	# this is a cross-build.
1056 1056
 	echo i586-pc-msdosdjgpp
1057
-        exit ;;
1057
+	exit ;;
1058 1058
     Intel:Mach:3*:*)
1059 1059
 	echo i386-pc-mach3
1060 1060
 	exit ;;
... ...
@@ -1089,8 +1126,8 @@ EOF
1089 1089
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1090 1090
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1091 1091
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1092
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1093
-          && { echo i486-ncr-sysv4; exit; } ;;
1092
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1093
+	  && { echo i486-ncr-sysv4; exit; } ;;
1094 1094
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1095 1095
 	OS_REL='.3'
1096 1096
 	test -r /etc/.relid \
... ...
@@ -1133,10 +1170,10 @@ EOF
1133 1133
 		echo ns32k-sni-sysv
1134 1134
 	fi
1135 1135
 	exit ;;
1136
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1137
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
1138
-        echo i586-unisys-sysv4
1139
-        exit ;;
1136
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1137
+			# says <Richard.M.Bartel@ccMail.Census.GOV>
1138
+	echo i586-unisys-sysv4
1139
+	exit ;;
1140 1140
     *:UNIX_System_V:4*:FTX*)
1141 1141
 	# From Gerald Hewes <hewes@openmarket.com>.
1142 1142
 	# How about differentiating between stratus architectures? -djm
... ...
@@ -1162,11 +1199,11 @@ EOF
1162 1162
 	exit ;;
1163 1163
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1164 1164
 	if [ -d /usr/nec ]; then
1165
-	        echo mips-nec-sysv${UNAME_RELEASE}
1165
+		echo mips-nec-sysv${UNAME_RELEASE}
1166 1166
 	else
1167
-	        echo mips-unknown-sysv${UNAME_RELEASE}
1167
+		echo mips-unknown-sysv${UNAME_RELEASE}
1168 1168
 	fi
1169
-        exit ;;
1169
+	exit ;;
1170 1170
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1171 1171
 	echo powerpc-be-beos
1172 1172
 	exit ;;
... ...
@@ -1179,6 +1216,9 @@ EOF
1179 1179
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1180 1180
 	echo i586-pc-haiku
1181 1181
 	exit ;;
1182
+    x86_64:Haiku:*:*)
1183
+	echo x86_64-unknown-haiku
1184
+	exit ;;
1182 1185
     SX-4:SUPER-UX:*:*)
1183 1186
 	echo sx4-nec-superux${UNAME_RELEASE}
1184 1187
 	exit ;;
... ...
@@ -1205,19 +1245,21 @@ EOF
1205 1205
 	exit ;;
1206 1206
     *:Darwin:*:*)
1207 1207
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1208
-	case $UNAME_PROCESSOR in
1209
-	    i386)
1210
-		eval $set_cc_for_build
1211
-		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1212
-		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1213
-		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1214
-		      grep IS_64BIT_ARCH >/dev/null
1215
-		  then
1216
-		      UNAME_PROCESSOR="x86_64"
1217
-		  fi
1218
-		fi ;;
1219
-	    unknown) UNAME_PROCESSOR=powerpc ;;
1220
-	esac
1208
+	eval $set_cc_for_build
1209
+	if test "$UNAME_PROCESSOR" = unknown ; then
1210
+	    UNAME_PROCESSOR=powerpc
1211
+	fi
1212
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1213
+	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1214
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1215
+		grep IS_64BIT_ARCH >/dev/null
1216
+	    then
1217
+		case $UNAME_PROCESSOR in
1218
+		    i386) UNAME_PROCESSOR=x86_64 ;;
1219
+		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1220
+		esac
1221
+	    fi
1222
+	fi
1221 1223
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1222 1224
 	exit ;;
1223 1225
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
... ...
@@ -1231,7 +1273,10 @@ EOF
1231 1231
     *:QNX:*:4*)
1232 1232
 	echo i386-pc-qnx
1233 1233
 	exit ;;
1234
-    NSE-?:NONSTOP_KERNEL:*:*)
1234
+    NEO-?:NONSTOP_KERNEL:*:*)
1235
+	echo neo-tandem-nsk${UNAME_RELEASE}
1236
+	exit ;;
1237
+    NSE-*:NONSTOP_KERNEL:*:*)
1235 1238
 	echo nse-tandem-nsk${UNAME_RELEASE}
1236 1239
 	exit ;;
1237 1240
     NSR-?:NONSTOP_KERNEL:*:*)
... ...
@@ -1276,13 +1321,13 @@ EOF
1276 1276
 	echo pdp10-unknown-its
1277 1277
 	exit ;;
1278 1278
     SEI:*:*:SEIUX)
1279
-        echo mips-sei-seiux${UNAME_RELEASE}
1279
+	echo mips-sei-seiux${UNAME_RELEASE}
1280 1280
 	exit ;;
1281 1281
     *:DragonFly:*:*)
1282 1282
 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1283 1283
 	exit ;;
1284 1284
     *:*VMS:*:*)
1285
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1285
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1286 1286
 	case "${UNAME_MACHINE}" in
1287 1287
 	    A*) echo alpha-dec-vms ; exit ;;
1288 1288
 	    I*) echo ia64-dec-vms ; exit ;;
... ...
@@ -1300,11 +1345,11 @@ EOF
1300 1300
     i*86:AROS:*:*)
1301 1301
 	echo ${UNAME_MACHINE}-pc-aros
1302 1302
 	exit ;;
1303
+    x86_64:VMkernel:*:*)
1304
+	echo ${UNAME_MACHINE}-unknown-esx
1305
+	exit ;;
1303 1306
 esac
1304 1307
 
1305
-#echo '(No uname command or uname output not recognized.)' 1>&2
1306
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1307
-
1308 1308
 eval $set_cc_for_build
1309 1309
 cat >$dummy.c <<EOF
1310 1310
 #ifdef _SEQUENT_
... ...
@@ -1322,11 +1367,11 @@ main ()
1322 1322
 #include <sys/param.h>
1323 1323
   printf ("m68k-sony-newsos%s\n",
1324 1324
 #ifdef NEWSOS4
1325
-          "4"
1325
+	"4"
1326 1326
 #else
1327
-	  ""
1327
+	""
1328 1328
 #endif
1329
-         ); exit (0);
1329
+	); exit (0);
1330 1330
 #endif
1331 1331
 #endif
1332 1332
 
... ...
@@ -1,38 +1,31 @@
1 1
 #! /bin/sh
2 2
 # Configuration validation subroutine script.
3
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5
-#   Free Software Foundation, Inc.
3
+#   Copyright 1992-2013 Free Software Foundation, Inc.
6 4
 
7
-timestamp='2010-01-22'
5
+timestamp='2013-04-24'
8 6
 
9
-# This file is (in principle) common to ALL GNU software.
10
-# The presence of a machine in this file suggests that SOME GNU software
11
-# can handle that machine.  It does not imply ALL GNU software can.
12
-#
13
-# This file is free software; you can redistribute it and/or modify
14
-# it under the terms of the GNU General Public License as published by
15
-# the Free Software Foundation; either version 2 of the License, or
7
+# This file is free software; you can redistribute it and/or modify it
8
+# under the terms of the GNU General Public License as published by
9
+# the Free Software Foundation; either version 3 of the License, or
16 10
 # (at your option) any later version.
17 11
 #
18
-# This program is distributed in the hope that it will be useful,
19
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
-# GNU General Public License for more details.
12
+# This program is distributed in the hope that it will be useful, but
13
+# WITHOUT ANY WARRANTY; without even the implied warranty of
14
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+# General Public License for more details.
22 16
 #
23 17
 # You should have received a copy of the GNU General Public License
24
-# along with this program; if not, write to the Free Software
25
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
26
-# 02110-1301, USA.
18
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
27 19
 #
28 20
 # As a special exception to the GNU General Public License, if you
29 21
 # distribute this file as part of a program that contains a
30 22
 # configuration script generated by Autoconf, you may include it under
31
-# the same distribution terms that you use for the rest of that program.
23
+# the same distribution terms that you use for the rest of that
24
+# program.  This Exception is an additional permission under section 7
25
+# of the GNU General Public License, version 3 ("GPLv3").
32 26
 
33 27
 
34
-# Please send patches to <config-patches@gnu.org>.  Submit a context
35
-# diff and a properly formatted GNU ChangeLog entry.
28
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
36 29
 #
37 30
 # Configuration subroutine to validate and canonicalize a configuration type.
38 31
 # Supply the specified configuration type as an argument.
... ...
@@ -75,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
75 75
 version="\
76 76
 GNU config.sub ($timestamp)
77 77
 
78
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
79
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
80
-Software Foundation, Inc.
78
+Copyright 1992-2013 Free Software Foundation, Inc.
81 79
 
82 80
 This is free software; see the source for copying conditions.  There is NO
83 81
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
... ...
@@ -124,13 +115,18 @@ esac
124 124
 # Here we must recognize all the valid KERNEL-OS combinations.
125 125
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
126 126
 case $maybe_os in
127
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
128
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
127
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
128
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
129
+  knetbsd*-gnu* | netbsd*-gnu* | \
129 130
   kopensolaris*-gnu* | \
130 131
   storm-chaos* | os2-emx* | rtmk-nova*)
131 132
     os=-$maybe_os
132 133
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
133 134
     ;;
135
+  android-linux)
136
+    os=-linux-android
137
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
138
+    ;;
134 139
   *)
135 140
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
136 141
     if [ $basic_machine != $1 ]
... ...
@@ -153,12 +149,12 @@ case $os in
153 153
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
154 154
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
155 155
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
156
-	-apple | -axis | -knuth | -cray | -microblaze)
156
+	-apple | -axis | -knuth | -cray | -microblaze*)
157 157
 		os=
158 158
 		basic_machine=$1
159 159
 		;;
160
-        -bluegene*)
161
-	        os=-cnk
160
+	-bluegene*)
161
+		os=-cnk
162 162
 		;;
163 163
 	-sim | -cisco | -oki | -wec | -winbond)
164 164
 		os=
... ...
@@ -174,10 +170,10 @@ case $os in
174 174
 		os=-chorusos
175 175
 		basic_machine=$1
176 176
 		;;
177
- 	-chorusrdb)
178
- 		os=-chorusrdb
177
+	-chorusrdb)
178
+		os=-chorusrdb
179 179
 		basic_machine=$1
180
- 		;;
180
+		;;
181 181
 	-hiux*)
182 182
 		os=-hiuxwe2
183 183
 		;;
... ...
@@ -222,6 +218,12 @@ case $os in
222 222
 	-isc*)
223 223
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
224 224
 		;;
225
+	-lynx*178)
226
+		os=-lynxos178
227
+		;;
228
+	-lynx*5)
229
+		os=-lynxos5
230
+		;;
225 231
 	-lynx*)
226 232
 		os=-lynxos
227 233
 		;;
... ...
@@ -246,20 +248,27 @@ case $basic_machine in
246 246
 	# Some are omitted here because they have special meanings below.
247 247
 	1750a | 580 \
248 248
 	| a29k \
249
+	| aarch64 | aarch64_be \
249 250
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
250 251
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
251 252
 	| am33_2.0 \
252
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
253
+	| arc | arceb \
254
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
255
+	| avr | avr32 \
256
+	| be32 | be64 \
253 257
 	| bfin \
254 258
 	| c4x | clipper \
255 259
 	| d10v | d30v | dlx | dsp16xx \
260
+	| epiphany \
256 261
 	| fido | fr30 | frv \
257 262
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
263
+	| hexagon \
258 264
 	| i370 | i860 | i960 | ia64 \
259 265
 	| ip2k | iq2000 \
266
+	| le32 | le64 \
260 267
 	| lm32 \
261 268
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
262
-	| maxq | mb | microblaze | mcore | mep | metag \
269
+	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
263 270
 	| mips | mipsbe | mipseb | mipsel | mipsle \
264 271
 	| mips16 \
265 272
 	| mips64 | mips64el \
... ...
@@ -277,34 +286,45 @@ case $basic_machine in
277 277
 	| mipsisa64r2 | mipsisa64r2el \
278 278
 	| mipsisa64sb1 | mipsisa64sb1el \
279 279
 	| mipsisa64sr71k | mipsisa64sr71kel \
280
+	| mipsr5900 | mipsr5900el \
280 281
 	| mipstx39 | mipstx39el \
281 282
 	| mn10200 | mn10300 \
282 283
 	| moxie \
283 284
 	| mt \
284 285
 	| msp430 \
285
-	| nios | nios2 \
286
+	| nds32 | nds32le | nds32be \
287
+	| nios | nios2 | nios2eb | nios2el \
286 288
 	| ns16k | ns32k \
287
-	| or32 \
289
+	| open8 \
290
+	| or1k | or32 \
288 291
 	| pdp10 | pdp11 | pj | pjl \
289
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
292
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
290 293
 	| pyramid \
291
-	| rx \
294
+	| rl78 | rx \
292 295
 	| score \
293 296
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
294 297
 	| sh64 | sh64le \
295 298
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
296 299
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
297
-	| spu | strongarm \
298
-	| tahoe | thumb | tic4x | tic80 | tron \
300
+	| spu \
301
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
299 302
 	| ubicom32 \
300
-	| v850 | v850e \
303
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
301 304
 	| we32k \
302
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
305
+	| x86 | xc16x | xstormy16 | xtensa \
303 306
 	| z8k | z80)
304 307
 		basic_machine=$basic_machine-unknown
305 308
 		;;
306
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
307
-		# Motorola 68HC11/12.
309
+	c54x)
310
+		basic_machine=tic54x-unknown
311
+		;;
312
+	c55x)
313
+		basic_machine=tic55x-unknown
314
+		;;
315
+	c6x)
316
+		basic_machine=tic6x-unknown
317
+		;;
318
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
308 319
 		basic_machine=$basic_machine-unknown
309 320
 		os=-none
310 321
 		;;
... ...
@@ -314,6 +334,21 @@ case $basic_machine in
314 314
 		basic_machine=mt-unknown
315 315
 		;;
316 316
 
317
+	strongarm | thumb | xscale)
318
+		basic_machine=arm-unknown
319
+		;;
320
+	xgate)
321
+		basic_machine=$basic_machine-unknown
322
+		os=-none
323
+		;;
324
+	xscaleeb)
325
+		basic_machine=armeb-unknown
326
+		;;
327
+
328
+	xscaleel)
329
+		basic_machine=armel-unknown
330
+		;;
331
+
317 332
 	# We use `pc' rather than `unknown'
318 333
 	# because (1) that's what they normally are, and
319 334
 	# (2) the word "unknown" tends to confuse beginning users.
... ...
@@ -328,25 +363,30 @@ case $basic_machine in
328 328
 	# Recognize the basic CPU types with company name.
329 329
 	580-* \
330 330
 	| a29k-* \
331
+	| aarch64-* | aarch64_be-* \
331 332
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
332 333
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
333
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
334
+	| alphapca5[67]-* | alpha64pca5[67]-* | amd64-* | arc-* | arceb-* \
334 335
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
335 336
 	| avr-* | avr32-* \
337
+	| be32-* | be64-* \
336 338
 	| bfin-* | bs2000-* \
337
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
339
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
338 340
 	| clipper-* | craynv-* | cydra-* \
339 341
 	| d10v-* | d30v-* | dlx-* \
340 342
 	| elxsi-* \
341 343
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
342 344
 	| h8300-* | h8500-* \
343 345
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
346
+	| hexagon-* \
344 347
 	| i*86-* | i860-* | i960-* | ia64-* \
345 348
 	| ip2k-* | iq2000-* \
349
+	| le32-* | le64-* \
346 350
 	| lm32-* \
347 351
 	| m32c-* | m32r-* | m32rle-* \
348 352
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
349
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
353
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
354
+	| microblaze-* | microblazeel-* \
350 355
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
351 356
 	| mips16-* \
352 357
 	| mips64-* | mips64el-* \
... ...
@@ -364,30 +404,34 @@ case $basic_machine in
364 364
 	| mipsisa64r2-* | mipsisa64r2el-* \
365 365
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
366 366
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
367
+	| mipsr5900-* | mipsr5900el-* \
367 368
 	| mipstx39-* | mipstx39el-* \
368 369
 	| mmix-* \
369 370
 	| mt-* \
370 371
 	| msp430-* \
371
-	| nios-* | nios2-* \
372
+	| nds32-* | nds32le-* | nds32be-* \
373
+	| nios-* | nios2-* | nios2eb-* | nios2el-* \
372 374
 	| none-* | np1-* | ns16k-* | ns32k-* \
375
+	| open8-* \
373 376
 	| orion-* \
374 377
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
375
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
378
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
376 379
 	| pyramid-* \
377
-	| romp-* | rs6000-* | rx-* \
380
+	| rl78-* | romp-* | rs6000-* | rx-* \
378 381
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
379 382
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
380 383
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
381 384
 	| sparclite-* \
382
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
383
-	| tahoe-* | thumb-* \
385
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
386
+	| tahoe-* \
384 387
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
385
-	| tile-* | tilegx-* \
388
+	| tile*-* \
386 389
 	| tron-* \
387 390
 	| ubicom32-* \
388
-	| v850-* | v850e-* | vax-* \
391
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
392
+	| vax-* \
389 393
 	| we32k-* \
390
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
394
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
391 395
 	| xstormy16-* | xtensa*-* \
392 396
 	| ymp-* \
393 397
 	| z8k-* | z80-*)
... ...
@@ -412,7 +456,7 @@ case $basic_machine in
412 412
 		basic_machine=a29k-amd
413 413
 		os=-udi
414 414
 		;;
415
-    	abacus)
415
+	abacus)
416 416
 		basic_machine=abacus-unknown
417 417
 		;;
418 418
 	adobe68k)
... ...
@@ -429,12 +473,6 @@ case $basic_machine in
429 429
 		basic_machine=a29k-none
430 430
 		os=-bsd
431 431
 		;;
432
-	amd64)
433
-		basic_machine=x86_64-pc
434
-		;;
435
-	amd64-*)
436
-		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
437
-		;;
438 432
 	amdahl)
439 433
 		basic_machine=580-amdahl
440 434
 		os=-sysv
... ...
@@ -482,11 +520,20 @@ case $basic_machine in
482 482
 		basic_machine=powerpc-ibm
483 483
 		os=-cnk
484 484
 		;;
485
+	c54x-*)
486
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
487
+		;;
488
+	c55x-*)
489
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
490
+		;;
491
+	c6x-*)
492
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
493
+		;;
485 494
 	c90)
486 495
 		basic_machine=c90-cray
487 496
 		os=-unicos
488 497
 		;;
489
-        cegcc)
498
+	cegcc)
490 499
 		basic_machine=arm-unknown
491 500
 		os=-cegcc
492 501
 		;;
... ...
@@ -518,7 +565,7 @@ case $basic_machine in
518 518
 		basic_machine=craynv-cray
519 519
 		os=-unicosmp
520 520
 		;;
521
-	cr16)
521
+	cr16 | cr16-*)
522 522
 		basic_machine=cr16-unknown
523 523
 		os=-elf
524 524
 		;;
... ...
@@ -676,7 +723,6 @@ case $basic_machine in
676 676
 	i370-ibm* | ibm*)
677 677
 		basic_machine=i370-ibm
678 678
 		;;
679
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
680 679
 	i*86v32)
681 680
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
682 681
 		os=-sysv32
... ...
@@ -734,9 +780,13 @@ case $basic_machine in
734 734
 		basic_machine=ns32k-utek
735 735
 		os=-sysv
736 736
 		;;
737
-        microblaze)
737
+	microblaze*)
738 738
 		basic_machine=microblaze-xilinx
739 739
 		;;
740
+	mingw64)
741
+		basic_machine=x86_64-pc
742
+		os=-mingw64
743
+		;;
740 744
 	mingw32)
741 745
 		basic_machine=i386-pc
742 746
 		os=-mingw32
... ...
@@ -773,10 +823,18 @@ case $basic_machine in
773 773
 	ms1-*)
774 774
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
775 775
 		;;
776
+	msys)
777
+		basic_machine=i386-pc
778
+		os=-msys
779
+		;;
776 780
 	mvs)
777 781
 		basic_machine=i370-ibm
778 782
 		os=-mvs
779 783
 		;;
784
+	nacl)
785
+		basic_machine=le32-unknown
786
+		os=-nacl
787
+		;;
780 788
 	ncr3000)
781 789
 		basic_machine=i486-ncr
782 790
 		os=-sysv4
... ...
@@ -841,6 +899,12 @@ case $basic_machine in
841 841
 	np1)
842 842
 		basic_machine=np1-gould
843 843
 		;;
844
+	neo-tandem)
845
+		basic_machine=neo-tandem
846
+		;;
847
+	nse-tandem)
848
+		basic_machine=nse-tandem
849
+		;;
844 850
 	nsr-tandem)
845 851
 		basic_machine=nsr-tandem
846 852
 		;;
... ...
@@ -923,9 +987,10 @@ case $basic_machine in
923 923
 		;;
924 924
 	power)	basic_machine=power-ibm
925 925
 		;;
926
-	ppc)	basic_machine=powerpc-unknown
926
+	ppc | ppcbe)	basic_machine=powerpc-unknown
927 927
 		;;
928
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
928
+	ppc-* | ppcbe-*)
929
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
929 930
 		;;
930 931
 	ppcle | powerpclittle | ppc-le | powerpc-little)
931 932
 		basic_machine=powerpcle-unknown
... ...
@@ -950,7 +1015,11 @@ case $basic_machine in
950 950
 		basic_machine=i586-unknown
951 951
 		os=-pw32
952 952
 		;;
953
-	rdos)
953
+	rdos | rdos64)
954
+		basic_machine=x86_64-pc
955
+		os=-rdos
956
+		;;
957
+	rdos32)
954 958
 		basic_machine=i386-pc
955 959
 		os=-rdos
956 960
 		;;
... ...
@@ -1019,6 +1088,9 @@ case $basic_machine in
1019 1019
 		basic_machine=i860-stratus
1020 1020
 		os=-sysv4
1021 1021
 		;;
1022
+	strongarm-* | thumb-*)
1023
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
1024
+		;;
1022 1025
 	sun2)
1023 1026
 		basic_machine=m68000-sun
1024 1027
 		;;
... ...
@@ -1075,25 +1147,8 @@ case $basic_machine in
1075 1075
 		basic_machine=t90-cray
1076 1076
 		os=-unicos
1077 1077
 		;;
1078
-	tic54x | c54x*)
1079
-		basic_machine=tic54x-unknown
1080
-		os=-coff
1081
-		;;
1082
-	tic55x | c55x*)
1083
-		basic_machine=tic55x-unknown
1084
-		os=-coff
1085
-		;;
1086
-	tic6x | c6x*)
1087
-		basic_machine=tic6x-unknown
1088
-		os=-coff
1089
-		;;
1090
-        # This must be matched before tile*.
1091
-        tilegx*)
1092
-		basic_machine=tilegx-unknown
1093
-		os=-linux-gnu
1094
-		;;
1095 1078
 	tile*)
1096
-		basic_machine=tile-unknown
1079
+		basic_machine=$basic_machine-unknown
1097 1080
 		os=-linux-gnu
1098 1081
 		;;
1099 1082
 	tx39)
... ...
@@ -1163,6 +1218,9 @@ case $basic_machine in
1163 1163
 	xps | xps100)
1164 1164
 		basic_machine=xps100-honeywell
1165 1165
 		;;
1166
+	xscale-* | xscalee[bl]-*)
1167
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
1168
+		;;
1166 1169
 	ymp)
1167 1170
 		basic_machine=ymp-cray
1168 1171
 		os=-unicos
... ...
@@ -1260,11 +1318,11 @@ esac
1260 1260
 if [ x"$os" != x"" ]
1261 1261
 then
1262 1262
 case $os in
1263
-        # First match some system type aliases
1264
-        # that might get confused with valid system types.
1263
+	# First match some system type aliases
1264
+	# that might get confused with valid system types.
1265 1265
 	# -solaris* is a basic system type, with this one exception.
1266
-        -auroraux)
1267
-	        os=-auroraux
1266
+	-auroraux)
1267
+		os=-auroraux
1268 1268
 		;;
1269 1269
 	-solaris1 | -solaris1.*)
1270 1270
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
... ...
@@ -1288,20 +1346,21 @@ case $os in
1288 1288
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1289 1289
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
1290 1290
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
1291
-	      | -sym* | -kopensolaris* \
1291
+	      | -sym* | -kopensolaris* | -plan9* \
1292 1292
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1293 1293
 	      | -aos* | -aros* \
1294 1294
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1295 1295
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1296 1296
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1297
-	      | -openbsd* | -solidbsd* \
1297
+	      | -bitrig* | -openbsd* | -solidbsd* \
1298 1298
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1299 1299
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1300 1300
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1301 1301
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1302 1302
 	      | -chorusos* | -chorusrdb* | -cegcc* \
1303
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1304
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
1303
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1304
+	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
1305
+	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
1305 1306
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
1306 1307
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1307 1308
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
... ...
@@ -1348,7 +1407,7 @@ case $os in
1348 1348
 	-opened*)
1349 1349
 		os=-openedition
1350 1350
 		;;
1351
-        -os400*)
1351
+	-os400*)
1352 1352
 		os=-os400
1353 1353
 		;;
1354 1354
 	-wince*)
... ...
@@ -1397,7 +1456,7 @@ case $os in
1397 1397
 	-sinix*)
1398 1398
 		os=-sysv4
1399 1399
 		;;
1400
-        -tpf*)
1400
+	-tpf*)
1401 1401
 		os=-tpf
1402 1402
 		;;
1403 1403
 	-triton*)
... ...
@@ -1433,17 +1492,14 @@ case $os in
1433 1433
 	-aros*)
1434 1434
 		os=-aros
1435 1435
 		;;
1436
-	-kaos*)
1437
-		os=-kaos
1438
-		;;
1439 1436
 	-zvmoe)
1440 1437
 		os=-zvmoe
1441 1438
 		;;
1442 1439
 	-dicos*)
1443 1440
 		os=-dicos
1444 1441
 		;;
1445
-        -nacl*)
1446
-	        ;;
1442
+	-nacl*)
1443
+		;;
1447 1444
 	-none)
1448 1445
 		;;
1449 1446
 	*)
... ...
@@ -1466,10 +1522,10 @@ else
1466 1466
 # system, and we'll never get to this point.
1467 1467
 
1468 1468
 case $basic_machine in
1469
-        score-*)
1469
+	score-*)
1470 1470
 		os=-elf
1471 1471
 		;;
1472
-        spu-*)
1472
+	spu-*)
1473 1473
 		os=-elf
1474 1474
 		;;
1475 1475
 	*-acorn)
... ...
@@ -1481,8 +1537,20 @@ case $basic_machine in
1481 1481
 	arm*-semi)
1482 1482
 		os=-aout
1483 1483
 		;;
1484
-        c4x-* | tic4x-*)
1485
-        	os=-coff
1484
+	c4x-* | tic4x-*)
1485
+		os=-coff
1486
+		;;
1487
+	hexagon-*)
1488
+		os=-elf
1489
+		;;
1490
+	tic54x-*)
1491
+		os=-coff
1492
+		;;
1493
+	tic55x-*)
1494
+		os=-coff
1495
+		;;
1496
+	tic6x-*)
1497
+		os=-coff
1486 1498
 		;;
1487 1499
 	# This must come before the *-dec entry.
1488 1500
 	pdp10-*)
... ...
@@ -1502,14 +1570,11 @@ case $basic_machine in
1502 1502
 		;;
1503 1503
 	m68000-sun)
1504 1504
 		os=-sunos3
1505
-		# This also exists in the configure program, but was not the
1506
-		# default.
1507
-		# os=-sunos4
1508 1505
 		;;
1509 1506
 	m68*-cisco)
1510 1507
 		os=-aout
1511 1508
 		;;
1512
-        mep-*)
1509
+	mep-*)
1513 1510
 		os=-elf
1514 1511
 		;;
1515 1512
 	mips*-cisco)
... ...
@@ -1518,6 +1583,9 @@ case $basic_machine in
1518 1518
 	mips*-*)
1519 1519
 		os=-elf
1520 1520
 		;;
1521
+	or1k-*)
1522
+		os=-elf
1523
+		;;
1521 1524
 	or32-*)
1522 1525
 		os=-coff
1523 1526
 		;;
... ...
@@ -1536,7 +1604,7 @@ case $basic_machine in
1536 1536
 	*-ibm)
1537 1537
 		os=-aix
1538 1538
 		;;
1539
-    	*-knuth)
1539
+	*-knuth)
1540 1540
 		os=-mmixware
1541 1541
 		;;
1542 1542
 	*-wec)
... ...
@@ -1,10 +1,9 @@
1 1
 #! /bin/sh
2 2
 # depcomp - compile a program generating dependencies as side-effects
3 3
 
4
-scriptversion=2009-04-28.21; # UTC
4
+scriptversion=2013-05-30.07; # UTC
5 5
 
6
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
7
-# Software Foundation, Inc.
6
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
8 7
 
9 8
 # This program is free software; you can redistribute it and/or modify
10 9
 # it under the terms of the GNU General Public License as published by
... ...
@@ -28,9 +27,9 @@ scriptversion=2009-04-28.21; # UTC
28 28
 
29 29
 case $1 in
30 30
   '')
31
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
32
-     exit 1;
33
-     ;;
31
+    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
32
+    exit 1;
33
+    ;;
34 34
   -h | --h*)
35 35
     cat <<\EOF
36 36
 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
... ...
@@ -40,11 +39,11 @@ as side-effects.
40 40
 
41 41
 Environment variables:
42 42
   depmode     Dependency tracking mode.
43
-  source      Source file read by `PROGRAMS ARGS'.
44
-  object      Object file output by `PROGRAMS ARGS'.
43
+  source      Source file read by 'PROGRAMS ARGS'.
44
+  object      Object file output by 'PROGRAMS ARGS'.
45 45
   DEPDIR      directory where to store dependencies.
46 46
   depfile     Dependency file to output.
47
-  tmpdepfile  Temporary file to use when outputing dependencies.
47
+  tmpdepfile  Temporary file to use when outputting dependencies.
48 48
   libtool     Whether libtool is used (yes/no).
49 49
 
50 50
 Report bugs to <bug-automake@gnu.org>.
... ...
@@ -57,6 +56,66 @@ EOF
57 57
     ;;
58 58
 esac
59 59
 
60
+# Get the directory component of the given path, and save it in the
61
+# global variables '$dir'.  Note that this directory component will
62
+# be either empty or ending with a '/' character.  This is deliberate.
63
+set_dir_from ()
64
+{
65
+  case $1 in
66
+    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
67
+      *) dir=;;
68
+  esac
69
+}
70
+
71
+# Get the suffix-stripped basename of the given path, and save it the
72
+# global variable '$base'.
73
+set_base_from ()
74
+{
75
+  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
76
+}
77
+
78
+# If no dependency file was actually created by the compiler invocation,
79
+# we still have to create a dummy depfile, to avoid errors with the
80
+# Makefile "include basename.Plo" scheme.
81
+make_dummy_depfile ()
82
+{
83
+  echo "#dummy" > "$depfile"
84
+}
85
+
86
+# Factor out some common post-processing of the generated depfile.
87
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
88
+aix_post_process_depfile ()
89
+{
90
+  # If the compiler actually managed to produce a dependency file,
91
+  # post-process it.
92
+  if test -f "$tmpdepfile"; then
93
+    # Each line is of the form 'foo.o: dependency.h'.
94
+    # Do two passes, one to just change these to
95
+    #   $object: dependency.h
96
+    # and one to simply output
97
+    #   dependency.h:
98
+    # which is needed to avoid the deleted-header problem.
99
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
100
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
101
+    } > "$depfile"
102
+    rm -f "$tmpdepfile"
103
+  else
104
+    make_dummy_depfile
105
+  fi
106
+}
107
+
108
+# A tabulation character.
109
+tab='	'
110
+# A newline character.
111
+nl='
112
+'
113
+# Character ranges might be problematic outside the C locale.
114
+# These definitions help.
115
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
116
+lower=abcdefghijklmnopqrstuvwxyz
117
+digits=0123456789
118
+alpha=${upper}${lower}
119
+
60 120
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
61 121
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
62 122
   exit 1
... ...
@@ -69,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
69 69
 
70 70
 rm -f "$tmpdepfile"
71 71
 
72
+# Avoid interferences from the environment.
73
+gccflag= dashmflag=
74
+
72 75
 # Some modes work just like other modes, but use different flags.  We
73 76
 # parameterize here, but still list the modes in the big case below,
74 77
 # to make depend.m4 easier to write.  Note that we *cannot* use a case
... ...
@@ -80,18 +142,32 @@ if test "$depmode" = hp; then
80 80
 fi
81 81
 
82 82
 if test "$depmode" = dashXmstdout; then
83
-   # This is just like dashmstdout with a different argument.
84
-   dashmflag=-xM
85
-   depmode=dashmstdout
83
+  # This is just like dashmstdout with a different argument.
84
+  dashmflag=-xM
85
+  depmode=dashmstdout
86 86
 fi
87 87
 
88 88
 cygpath_u="cygpath -u -f -"
89 89
 if test "$depmode" = msvcmsys; then
90
-   # This is just like msvisualcpp but w/o cygpath translation.
91
-   # Just convert the backslash-escaped backslashes to single forward
92
-   # slashes to satisfy depend.m4
93
-   cygpath_u="sed s,\\\\\\\\,/,g"
94
-   depmode=msvisualcpp
90
+  # This is just like msvisualcpp but w/o cygpath translation.
91
+  # Just convert the backslash-escaped backslashes to single forward
92
+  # slashes to satisfy depend.m4
93
+  cygpath_u='sed s,\\\\,/,g'
94
+  depmode=msvisualcpp
95
+fi
96
+
97
+if test "$depmode" = msvc7msys; then
98
+  # This is just like msvc7 but w/o cygpath translation.
99
+  # Just convert the backslash-escaped backslashes to single forward
100
+  # slashes to satisfy depend.m4
101
+  cygpath_u='sed s,\\\\,/,g'
102
+  depmode=msvc7
103
+fi
104
+
105
+if test "$depmode" = xlc; then
106
+  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
107
+  gccflag=-qmakedep=gcc,-MF
108
+  depmode=gcc
95 109
 fi
96 110
 
97 111
 case "$depmode" in
... ...
@@ -114,8 +190,7 @@ gcc3)
114 114
   done
115 115
   "$@"
116 116
   stat=$?
117
-  if test $stat -eq 0; then :
118
-  else
117
+  if test $stat -ne 0; then
119 118
     rm -f "$tmpdepfile"
120 119
     exit $stat
121 120
   fi
... ...
@@ -123,13 +198,17 @@ gcc3)
123 123
   ;;
124 124
 
125 125
 gcc)
126
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
127
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
128
+## (see the conditional assignment to $gccflag above).
126 129
 ## There are various ways to get dependency output from gcc.  Here's
127 130
 ## why we pick this rather obscure method:
128 131
 ## - Don't want to use -MD because we'd like the dependencies to end
129 132
 ##   up in a subdir.  Having to rename by hand is ugly.
130 133
 ##   (We might end up doing this anyway to support other compilers.)
131 134
 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
132
-##   -MM, not -M (despite what the docs say).
135
+##   -MM, not -M (despite what the docs say).  Also, it might not be
136
+##   supported by the other compilers which use the 'gcc' depmode.
133 137
 ## - Using -M directly means running the compiler twice (even worse
134 138
 ##   than renaming).
135 139
   if test -z "$gccflag"; then
... ...
@@ -137,31 +216,31 @@ gcc)
137 137
   fi
138 138
   "$@" -Wp,"$gccflag$tmpdepfile"
139 139
   stat=$?
140
-  if test $stat -eq 0; then :
141
-  else
140
+  if test $stat -ne 0; then
142 141
     rm -f "$tmpdepfile"
143 142
     exit $stat
144 143
   fi
145 144
   rm -f "$depfile"
146 145
   echo "$object : \\" > "$depfile"
147
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
148
-## The second -e expression handles DOS-style file names with drive letters.
146
+  # The second -e expression handles DOS-style file names with drive
147
+  # letters.
149 148
   sed -e 's/^[^:]*: / /' \
150 149
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
151
-## This next piece of magic avoids the `deleted header file' problem.
150
+## This next piece of magic avoids the "deleted header file" problem.
152 151
 ## The problem is that when a header file which appears in a .P file
153 152
 ## is deleted, the dependency causes make to die (because there is
154 153
 ## typically no way to rebuild the header).  We avoid this by adding
155 154
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
156 155
 ## this for us directly.
157
-  tr ' ' '
158
-' < "$tmpdepfile" |
159
-## Some versions of gcc put a space before the `:'.  On the theory
156
+## Some versions of gcc put a space before the ':'.  On the theory
160 157
 ## that the space means something, we add a space to the output as
161
-## well.
158
+## well.  hp depmode also adds that space, but also prefixes the VPATH
159
+## to the object.  Take care to not repeat it in the output.
162 160
 ## Some versions of the HPUX 10.20 sed can't process this invocation
163 161
 ## correctly.  Breaking it into two sed invocations is a workaround.
164
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
162
+  tr ' ' "$nl" < "$tmpdepfile" \
163
+    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
164
+    | sed -e 's/$/ :/' >> "$depfile"
165 165
   rm -f "$tmpdepfile"
166 166
   ;;
167 167
 
... ...
@@ -179,8 +258,7 @@ sgi)
179 179
     "$@" -MDupdate "$tmpdepfile"
180 180
   fi
181 181
   stat=$?
182
-  if test $stat -eq 0; then :
183
-  else
182
+  if test $stat -ne 0; then
184 183
     rm -f "$tmpdepfile"
185 184
     exit $stat
186 185
   fi
... ...
@@ -188,43 +266,41 @@ sgi)
188 188
 
189 189
   if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
190 190
     echo "$object : \\" > "$depfile"
191
-
192 191
     # Clip off the initial element (the dependent).  Don't try to be
193 192
     # clever and replace this with sed code, as IRIX sed won't handle
194 193
     # lines with more than a fixed number of characters (4096 in
195 194
     # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
196
-    # the IRIX cc adds comments like `#:fec' to the end of the
195
+    # the IRIX cc adds comments like '#:fec' to the end of the
197 196
     # dependency line.
198
-    tr ' ' '
199
-' < "$tmpdepfile" \
200
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
201
-    tr '
202
-' ' ' >> "$depfile"
197
+    tr ' ' "$nl" < "$tmpdepfile" \
198
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
199
+      | tr "$nl" ' ' >> "$depfile"
203 200
     echo >> "$depfile"
204
-
205 201
     # The second pass generates a dummy entry for each header file.
206
-    tr ' ' '
207
-' < "$tmpdepfile" \
208
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
209
-   >> "$depfile"
202
+    tr ' ' "$nl" < "$tmpdepfile" \
203
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
204
+      >> "$depfile"
210 205
   else
211
-    # The sourcefile does not contain any dependencies, so just
212
-    # store a dummy comment line, to avoid errors with the Makefile
213
-    # "include basename.Plo" scheme.
214
-    echo "#dummy" > "$depfile"
206
+    make_dummy_depfile
215 207
   fi
216 208
   rm -f "$tmpdepfile"
217 209
   ;;
218 210
 
211
+xlc)
212
+  # This case exists only to let depend.m4 do its work.  It works by
213
+  # looking at the text of this script.  This case will never be run,
214
+  # since it is checked for above.
215
+  exit 1
216
+  ;;
217
+
219 218
 aix)
220 219
   # The C for AIX Compiler uses -M and outputs the dependencies
221 220
   # in a .u file.  In older versions, this file always lives in the
222
-  # current directory.  Also, the AIX compiler puts `$object:' at the
221
+  # current directory.  Also, the AIX compiler puts '$object:' at the
223 222
   # start of each line; $object doesn't have directory information.
224 223
   # Version 6 uses the directory in both cases.
225
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
226
-  test "x$dir" = "x$object" && dir=
227
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
224
+  set_dir_from "$object"
225
+  set_base_from "$object"
228 226
   if test "$libtool" = yes; then
229 227
     tmpdepfile1=$dir$base.u
230 228
     tmpdepfile2=$base.u
... ...
@@ -237,9 +313,7 @@ aix)
237 237
     "$@" -M
238 238
   fi
239 239
   stat=$?
240
-
241
-  if test $stat -eq 0; then :
242
-  else
240
+  if test $stat -ne 0; then
243 241
     rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
244 242
     exit $stat
245 243
   fi
... ...
@@ -248,44 +322,100 @@ aix)
248 248
   do
249 249
     test -f "$tmpdepfile" && break
250 250
   done
251
-  if test -f "$tmpdepfile"; then
252
-    # Each line is of the form `foo.o: dependent.h'.
253
-    # Do two passes, one to just change these to
254
-    # `$object: dependent.h' and one to simply `dependent.h:'.
255
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
256
-    # That's a tab and a space in the [].
257
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
258
-  else
259
-    # The sourcefile does not contain any dependencies, so just
260
-    # store a dummy comment line, to avoid errors with the Makefile
261
-    # "include basename.Plo" scheme.
262
-    echo "#dummy" > "$depfile"
251
+  aix_post_process_depfile
252
+  ;;
253
+
254
+tcc)
255
+  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
256
+  # FIXME: That version still under development at the moment of writing.
257
+  #        Make that this statement remains true also for stable, released
258
+  #        versions.
259
+  # It will wrap lines (doesn't matter whether long or short) with a
260
+  # trailing '\', as in:
261
+  #
262
+  #   foo.o : \
263
+  #    foo.c \
264
+  #    foo.h \
265
+  #
266
+  # It will put a trailing '\' even on the last line, and will use leading
267
+  # spaces rather than leading tabs (at least since its commit 0394caf7
268
+  # "Emit spaces for -MD").
269
+  "$@" -MD -MF "$tmpdepfile"
270
+  stat=$?
271
+  if test $stat -ne 0; then
272
+    rm -f "$tmpdepfile"
273
+    exit $stat
263 274
   fi
275
+  rm -f "$depfile"
276
+  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
277
+  # We have to change lines of the first kind to '$object: \'.
278
+  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
279
+  # And for each line of the second kind, we have to emit a 'dep.h:'
280
+  # dummy dependency, to avoid the deleted-header problem.
281
+  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
264 282
   rm -f "$tmpdepfile"
265 283
   ;;
266 284
 
267
-icc)
268
-  # Intel's C compiler understands `-MD -MF file'.  However on
269
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
270
-  # ICC 7.0 will fill foo.d with something like
271
-  #    foo.o: sub/foo.c
272
-  #    foo.o: sub/foo.h
273
-  # which is wrong.  We want:
274
-  #    sub/foo.o: sub/foo.c
275
-  #    sub/foo.o: sub/foo.h
276
-  #    sub/foo.c:
277
-  #    sub/foo.h:
278
-  # ICC 7.1 will output
285
+## The order of this option in the case statement is important, since the
286
+## shell code in configure will try each of these formats in the order
287
+## listed in this file.  A plain '-MD' option would be understood by many
288
+## compilers, so we must ensure this comes after the gcc and icc options.
289
+pgcc)
290
+  # Portland's C compiler understands '-MD'.
291
+  # Will always output deps to 'file.d' where file is the root name of the
292
+  # source file under compilation, even if file resides in a subdirectory.
293
+  # The object file name does not affect the name of the '.d' file.
294
+  # pgcc 10.2 will output
279 295
   #    foo.o: sub/foo.c sub/foo.h
280
-  # and will wrap long lines using \ :
296
+  # and will wrap long lines using '\' :
281 297
   #    foo.o: sub/foo.c ... \
282 298
   #     sub/foo.h ... \
283 299
   #     ...
300
+  set_dir_from "$object"
301
+  # Use the source, not the object, to determine the base name, since
302
+  # that's sadly what pgcc will do too.
303
+  set_base_from "$source"
304
+  tmpdepfile=$base.d
305
+
306
+  # For projects that build the same source file twice into different object
307
+  # files, the pgcc approach of using the *source* file root name can cause
308
+  # problems in parallel builds.  Use a locking strategy to avoid stomping on
309
+  # the same $tmpdepfile.
310
+  lockdir=$base.d-lock
311
+  trap "
312
+    echo '$0: caught signal, cleaning up...' >&2
313
+    rmdir '$lockdir'
314
+    exit 1
315
+  " 1 2 13 15
316
+  numtries=100
317
+  i=$numtries
318
+  while test $i -gt 0; do
319
+    # mkdir is a portable test-and-set.
320
+    if mkdir "$lockdir" 2>/dev/null; then
321
+      # This process acquired the lock.
322
+      "$@" -MD
323
+      stat=$?
324
+      # Release the lock.
325
+      rmdir "$lockdir"
326
+      break
327
+    else
328
+      # If the lock is being held by a different process, wait
329
+      # until the winning process is done or we timeout.
330
+      while test -d "$lockdir" && test $i -gt 0; do
331
+        sleep 1
332
+        i=`expr $i - 1`
333
+      done
334
+    fi
335
+    i=`expr $i - 1`
336
+  done
337
+  trap - 1 2 13 15
338
+  if test $i -le 0; then
339
+    echo "$0: failed to acquire lock after $numtries attempts" >&2
340
+    echo "$0: check lockdir '$lockdir'" >&2
341
+    exit 1
342
+  fi
284 343
 
285
-  "$@" -MD -MF "$tmpdepfile"
286
-  stat=$?
287
-  if test $stat -eq 0; then :
288
-  else
344
+  if test $stat -ne 0; then
289 345
     rm -f "$tmpdepfile"
290 346
     exit $stat
291 347
   fi
... ...
@@ -297,8 +427,8 @@ icc)
297 297
   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
298 298
   # Some versions of the HPUX 10.20 sed can't process this invocation
299 299
   # correctly.  Breaking it into two sed invocations is a workaround.
300
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
301
-    sed -e 's/$/ :/' >> "$depfile"
300
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
301
+    | sed -e 's/$/ :/' >> "$depfile"
302 302
   rm -f "$tmpdepfile"
303 303
   ;;
304 304
 
... ...
@@ -309,9 +439,8 @@ hp2)
309 309
   # 'foo.d', which lands next to the object file, wherever that
310 310
   # happens to be.
311 311
   # Much of this is similar to the tru64 case; see comments there.
312
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
313
-  test "x$dir" = "x$object" && dir=
314
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
312
+  set_dir_from  "$object"
313
+  set_base_from "$object"
315 314
   if test "$libtool" = yes; then
316 315
     tmpdepfile1=$dir$base.d
317 316
     tmpdepfile2=$dir.libs/$base.d
... ...
@@ -322,8 +451,7 @@ hp2)
322 322
     "$@" +Maked
323 323
   fi
324 324
   stat=$?
325
-  if test $stat -eq 0; then :
326
-  else
325
+  if test $stat -ne 0; then
327 326
      rm -f "$tmpdepfile1" "$tmpdepfile2"
328 327
      exit $stat
329 328
   fi
... ...
@@ -333,77 +461,107 @@ hp2)
333 333
     test -f "$tmpdepfile" && break
334 334
   done
335 335
   if test -f "$tmpdepfile"; then
336
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
337
-    # Add `dependent.h:' lines.
336
+    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
337
+    # Add 'dependent.h:' lines.
338 338
     sed -ne '2,${
339
-	       s/^ *//
340
-	       s/ \\*$//
341
-	       s/$/:/
342
-	       p
343
-	     }' "$tmpdepfile" >> "$depfile"
339
+               s/^ *//
340
+               s/ \\*$//
341
+               s/$/:/
342
+               p
343
+             }' "$tmpdepfile" >> "$depfile"
344 344
   else
345
-    echo "#dummy" > "$depfile"
345
+    make_dummy_depfile
346 346
   fi
347 347
   rm -f "$tmpdepfile" "$tmpdepfile2"
348 348
   ;;
349 349
 
350 350
 tru64)
351
-   # The Tru64 compiler uses -MD to generate dependencies as a side
352
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
353
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
354
-   # dependencies in `foo.d' instead, so we check for that too.
355
-   # Subdirectories are respected.
356
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
357
-   test "x$dir" = "x$object" && dir=
358
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
359
-
360
-   if test "$libtool" = yes; then
361
-      # With Tru64 cc, shared objects can also be used to make a
362
-      # static library.  This mechanism is used in libtool 1.4 series to
363
-      # handle both shared and static libraries in a single compilation.
364
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
365
-      #
366
-      # With libtool 1.5 this exception was removed, and libtool now
367
-      # generates 2 separate objects for the 2 libraries.  These two
368
-      # compilations output dependencies in $dir.libs/$base.o.d and
369
-      # in $dir$base.o.d.  We have to check for both files, because
370
-      # one of the two compilations can be disabled.  We should prefer
371
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
372
-      # automatically cleaned when .libs/ is deleted, while ignoring
373
-      # the former would cause a distcleancheck panic.
374
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
375
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
376
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
377
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
378
-      "$@" -Wc,-MD
379
-   else
380
-      tmpdepfile1=$dir$base.o.d
381
-      tmpdepfile2=$dir$base.d
382
-      tmpdepfile3=$dir$base.d
383
-      tmpdepfile4=$dir$base.d
384
-      "$@" -MD
385
-   fi
386
-
387
-   stat=$?
388
-   if test $stat -eq 0; then :
389
-   else
390
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
391
-      exit $stat
392
-   fi
393
-
394
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
395
-   do
396
-     test -f "$tmpdepfile" && break
397
-   done
398
-   if test -f "$tmpdepfile"; then
399
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
400
-      # That's a tab and a space in the [].
401
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
402
-   else
403
-      echo "#dummy" > "$depfile"
404
-   fi
405
-   rm -f "$tmpdepfile"
406
-   ;;
351
+  # The Tru64 compiler uses -MD to generate dependencies as a side
352
+  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
353
+  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
354
+  # dependencies in 'foo.d' instead, so we check for that too.
355
+  # Subdirectories are respected.
356
+  set_dir_from  "$object"
357
+  set_base_from "$object"
358
+
359
+  if test "$libtool" = yes; then
360
+    # Libtool generates 2 separate objects for the 2 libraries.  These
361
+    # two compilations output dependencies in $dir.libs/$base.o.d and
362
+    # in $dir$base.o.d.  We have to check for both files, because
363
+    # one of the two compilations can be disabled.  We should prefer
364
+    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
365
+    # automatically cleaned when .libs/ is deleted, while ignoring
366
+    # the former would cause a distcleancheck panic.
367
+    tmpdepfile1=$dir$base.o.d          # libtool 1.5
368
+    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
369
+    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
370
+    "$@" -Wc,-MD
371
+  else
372
+    tmpdepfile1=$dir$base.d
373
+    tmpdepfile2=$dir$base.d
374
+    tmpdepfile3=$dir$base.d
375
+    "$@" -MD
376
+  fi
377
+
378
+  stat=$?
379
+  if test $stat -ne 0; then
380
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
381
+    exit $stat
382
+  fi
383
+
384
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
385
+  do
386
+    test -f "$tmpdepfile" && break
387
+  done
388
+  # Same post-processing that is required for AIX mode.
389
+  aix_post_process_depfile
390
+  ;;
391
+
392
+msvc7)
393
+  if test "$libtool" = yes; then
394
+    showIncludes=-Wc,-showIncludes
395
+  else
396
+    showIncludes=-showIncludes
397
+  fi
398
+  "$@" $showIncludes > "$tmpdepfile"
399
+  stat=$?
400
+  grep -v '^Note: including file: ' "$tmpdepfile"
401
+  if test $stat -ne 0; then
402
+    rm -f "$tmpdepfile"
403
+    exit $stat
404
+  fi
405
+  rm -f "$depfile"
406
+  echo "$object : \\" > "$depfile"
407
+  # The first sed program below extracts the file names and escapes
408
+  # backslashes for cygpath.  The second sed program outputs the file
409
+  # name when reading, but also accumulates all include files in the
410
+  # hold buffer in order to output them again at the end.  This only
411
+  # works with sed implementations that can handle large buffers.
412
+  sed < "$tmpdepfile" -n '
413
+/^Note: including file:  *\(.*\)/ {
414
+  s//\1/
415
+  s/\\/\\\\/g
416
+  p
417
+}' | $cygpath_u | sort -u | sed -n '
418
+s/ /\\ /g
419
+s/\(.*\)/'"$tab"'\1 \\/p
420
+s/.\(.*\) \\/\1:/
421
+H
422
+$ {
423
+  s/.*/'"$tab"'/
424
+  G
425
+  p
426
+}' >> "$depfile"
427
+  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
428
+  rm -f "$tmpdepfile"
429
+  ;;
430
+
431
+msvc7msys)
432
+  # This case exists only to let depend.m4 do its work.  It works by
433
+  # looking at the text of this script.  This case will never be run,
434
+  # since it is checked for above.
435
+  exit 1
436
+  ;;
407 437
 
408 438
 #nosideeffect)
409 439
   # This comment above is used by automake to tell side-effect
... ...
@@ -422,7 +580,7 @@ dashmstdout)
422 422
     shift
423 423
   fi
424 424
 
425
-  # Remove `-o $object'.
425
+  # Remove '-o $object'.
426 426
   IFS=" "
427 427
   for arg
428 428
   do
... ...
@@ -442,18 +600,18 @@ dashmstdout)
442 442
   done
443 443
 
444 444
   test -z "$dashmflag" && dashmflag=-M
445
-  # Require at least two characters before searching for `:'
445
+  # Require at least two characters before searching for ':'
446 446
   # in the target name.  This is to cope with DOS-style filenames:
447
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
447
+  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
448 448
   "$@" $dashmflag |
449
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
449
+    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
450 450
   rm -f "$depfile"
451 451
   cat < "$tmpdepfile" > "$depfile"
452
-  tr ' ' '
453
-' < "$tmpdepfile" | \
454
-## Some versions of the HPUX 10.20 sed can't process this invocation
455
-## correctly.  Breaking it into two sed invocations is a workaround.
456
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
452
+  # Some versions of the HPUX 10.20 sed can't process this sed invocation
453
+  # correctly.  Breaking it into two sed invocations is a workaround.
454
+  tr ' ' "$nl" < "$tmpdepfile" \
455
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
456
+    | sed -e 's/$/ :/' >> "$depfile"
457 457
   rm -f "$tmpdepfile"
458 458
   ;;
459 459
 
... ...
@@ -503,12 +661,15 @@ makedepend)
503 503
   touch "$tmpdepfile"
504 504
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
505 505
   rm -f "$depfile"
506
-  cat < "$tmpdepfile" > "$depfile"
507
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
508
-' | \
509
-## Some versions of the HPUX 10.20 sed can't process this invocation
510
-## correctly.  Breaking it into two sed invocations is a workaround.
511
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
506
+  # makedepend may prepend the VPATH from the source file name to the object.
507
+  # No need to regex-escape $object, excess matching of '.' is harmless.
508
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
509
+  # Some versions of the HPUX 10.20 sed can't process the last invocation
510
+  # correctly.  Breaking it into two sed invocations is a workaround.
511
+  sed '1,2d' "$tmpdepfile" \
512
+    | tr ' ' "$nl" \
513
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
514
+    | sed -e 's/$/ :/' >> "$depfile"
512 515
   rm -f "$tmpdepfile" "$tmpdepfile".bak
513 516
   ;;
514 517
 
... ...
@@ -525,7 +686,7 @@ cpp)
525 525
     shift
526 526
   fi
527 527
 
528
-  # Remove `-o $object'.
528
+  # Remove '-o $object'.
529 529
   IFS=" "
530 530
   for arg
531 531
   do
... ...
@@ -544,10 +705,10 @@ cpp)
544 544
     esac
545 545
   done
546 546
 
547
-  "$@" -E |
548
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
549
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
550
-    sed '$ s: \\$::' > "$tmpdepfile"
547
+  "$@" -E \
548
+    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
549
+             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
550
+    | sed '$ s: \\$::' > "$tmpdepfile"
551 551
   rm -f "$depfile"
552 552
   echo "$object : \\" > "$depfile"
553 553
   cat < "$tmpdepfile" >> "$depfile"
... ...
@@ -579,23 +740,23 @@ msvisualcpp)
579 579
       shift
580 580
       ;;
581 581
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
582
-	set fnord "$@"
583
-	shift
584
-	shift
585
-	;;
582
+        set fnord "$@"
583
+        shift
584
+        shift
585
+        ;;
586 586
     *)
587
-	set fnord "$@" "$arg"
588
-	shift
589
-	shift
590
-	;;
587
+        set fnord "$@" "$arg"
588
+        shift
589
+        shift
590
+        ;;
591 591
     esac
592 592
   done
593 593
   "$@" -E 2>/dev/null |
594 594
   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
595 595
   rm -f "$depfile"
596 596
   echo "$object : \\" > "$depfile"
597
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
598
-  echo "	" >> "$depfile"
597
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
598
+  echo "$tab" >> "$depfile"
599 599
   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
600 600
   rm -f "$tmpdepfile"
601 601
   ;;
... ...
@@ -1,7 +1,7 @@
1 1
 #!/bin/sh
2 2
 # install - install a program, script, or datafile
3 3
 
4
-scriptversion=2009-04-28.21; # UTC
4
+scriptversion=2011-11-20.07; # UTC
5 5
 
6 6
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
7 7
 # later released in X11R6 (xc/config/util/install.sh) with the
... ...
@@ -35,7 +35,7 @@ scriptversion=2009-04-28.21; # UTC
35 35
 # FSF changes to this file are in the public domain.
36 36
 #
37 37
 # Calling this script install-sh is preferred over install.sh, to prevent
38
-# `make' implicit rules from creating a file called install from it
38
+# 'make' implicit rules from creating a file called install from it
39 39
 # when there is no Makefile.
40 40
 #
41 41
 # This script is compatible with the BSD install script, but was written
... ...
@@ -156,6 +156,10 @@ while test $# -ne 0; do
156 156
     -s) stripcmd=$stripprog;;
157 157
 
158 158
     -t) dst_arg=$2
159
+	# Protect names problematic for 'test' and other utilities.
160
+	case $dst_arg in
161
+	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
162
+	esac
159 163
 	shift;;
160 164
 
161 165
     -T) no_target_directory=true;;
... ...
@@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
186 186
     fi
187 187
     shift # arg
188 188
     dst_arg=$arg
189
+    # Protect names problematic for 'test' and other utilities.
190
+    case $dst_arg in
191
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
192
+    esac
189 193
   done
190 194
 fi
191 195
 
... ...
@@ -194,13 +202,17 @@ if test $# -eq 0; then
194 194
     echo "$0: no input file specified." >&2
195 195
     exit 1
196 196
   fi
197
-  # It's OK to call `install-sh -d' without argument.
197
+  # It's OK to call 'install-sh -d' without argument.
198 198
   # This can happen when creating conditional directories.
199 199
   exit 0
200 200
 fi
201 201
 
202 202
 if test -z "$dir_arg"; then
203
-  trap '(exit $?); exit' 1 2 13 15
203
+  do_exit='(exit $ret); exit $ret'
204
+  trap "ret=129; $do_exit" 1
205
+  trap "ret=130; $do_exit" 2
206
+  trap "ret=141; $do_exit" 13
207
+  trap "ret=143; $do_exit" 15
204 208
 
205 209
   # Set umask so as not to create temps with too-generous modes.
206 210
   # However, 'strip' requires both read and write access to temps.
... ...
@@ -228,9 +240,9 @@ fi
228 228
 
229 229
 for src
230 230
 do
231
-  # Protect names starting with `-'.
231
+  # Protect names problematic for 'test' and other utilities.
232 232
   case $src in
233
-    -*) src=./$src;;
233
+    -* | [=\(\)!]) src=./$src;;
234 234
   esac
235 235
 
236 236
   if test -n "$dir_arg"; then
... ...
@@ -252,12 +264,7 @@ do
252 252
       echo "$0: no destination specified." >&2
253 253
       exit 1
254 254
     fi
255
-
256 255
     dst=$dst_arg
257
-    # Protect names starting with `-'.
258
-    case $dst in
259
-      -*) dst=./$dst;;
260
-    esac
261 256
 
262 257
     # If destination is a directory, append the input filename; won't work
263 258
     # if double slashes aren't ignored.
... ...
@@ -347,7 +354,7 @@ do
347 347
 	      if test -z "$dir_arg" || {
348 348
 		   # Check for POSIX incompatibilities with -m.
349 349
 		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
350
-		   # other-writeable bit of parent directory when it shouldn't.
350
+		   # other-writable bit of parent directory when it shouldn't.
351 351
 		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
352 352
 		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
353 353
 		   case $ls_ld_tmpdir in
... ...
@@ -385,7 +392,7 @@ do
385 385
 
386 386
       case $dstdir in
387 387
 	/*) prefix='/';;
388
-	-*) prefix='./';;
388
+	[-=\(\)!]*) prefix='./';;
389 389
 	*)  prefix='';;
390 390
       esac
391 391
 
... ...
@@ -403,7 +410,7 @@ do
403 403
 
404 404
       for d
405 405
       do
406
-	test -z "$d" && continue
406
+	test X"$d" = X && continue
407 407
 
408 408
 	prefix=$prefix$d
409 409
 	if test -d "$prefix"; then
... ...
@@ -70,7 +70,7 @@
70 70
 #         compiler:		$LTCC
71 71
 #         compiler flags:		$LTCFLAGS
72 72
 #         linker:		$LD (gnu? $with_gnu_ld)
73
-#         $progname:	(GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1
73
+#         $progname:	(GNU libtool) 2.4.2
74 74
 #         automake:	$automake_version
75 75
 #         autoconf:	$autoconf_version
76 76
 #
... ...
@@ -80,7 +80,7 @@
80 80
 
81 81
 PROGRAM=libtool
82 82
 PACKAGE=libtool
83
-VERSION="2.4.2 Debian-2.4.2-1ubuntu1"
83
+VERSION=2.4.2
84 84
 TIMESTAMP=""
85 85
 package_revision=1.3337
86 86
 
... ...
@@ -1375,6 +1375,21 @@ func_replace_sysroot ()
1375 1375
 func_infer_tag ()
1376 1376
 {
1377 1377
     $opt_debug
1378
+
1379
+    # FreeBSD-specific: where we install compilers with non-standard names
1380
+    tag_compilers_CC="*cc cc* *gcc gcc* clang*"
1381
+    tag_compilers_CXX="*c++ c++* *g++ g++* clang++*"
1382
+    base_compiler=`set -- "$@"; echo $1`
1383
+
1384
+    # If $tagname isn't set, then try to infer if the default "CC" tag applies
1385
+    if test -z "$tagname"; then
1386
+      for zp in $tag_compilers_CC; do
1387
+        case $base_compiler in
1388
+	 $zp) tagname="CC"; break;;
1389
+	esac
1390
+      done
1391
+    fi
1392
+
1378 1393
     if test -n "$available_tags" && test -z "$tagname"; then
1379 1394
       CC_quoted=
1380 1395
       for arg in $CC; do
... ...
@@ -1411,7 +1426,22 @@ func_infer_tag ()
1411 1411
 	      break
1412 1412
 	      ;;
1413 1413
 	    esac
1414
-	  fi
1414
+
1415
+	    # FreeBSD-specific: try compilers based on inferred tag
1416
+	    if test -z "$tagname"; then
1417
+	      eval "tag_compilers=\$tag_compilers_${z}"
1418
+	      if test -n "$tag_compilers"; then
1419
+		for zp in $tag_compilers; do
1420
+		  case $base_compiler in   
1421
+		    $zp) tagname=$z; break;;
1422
+		  esac
1423
+		done
1424
+		if test -n "$tagname"; then
1425
+		  break
1426
+		fi
1427
+	      fi
1428
+            fi
1429
+          fi
1415 1430
 	done
1416 1431
 	# If $tagname still isn't set, then no tagged configuration
1417 1432
 	# was found and let the user know that the "--tag" command
... ...
@@ -3517,6 +3547,9 @@ static const void *lt_preloaded_setup() {
3517 3517
 	  ;;
3518 3518
 	esac
3519 3519
 	;;
3520
+      *-*-freebsd*)
3521
+	# FreeBSD doesn't need this...
3522
+	;;
3520 3523
       *)
3521 3524
 	func_fatal_error "unknown suffix for \`$my_dlsyms'"
3522 3525
 	;;
... ...
@@ -5595,6 +5628,7 @@ func_mode_link ()
5595 5595
 	  esac
5596 5596
 	  ;;
5597 5597
 	esac
5598
+	deplibs="$deplibs $arg"
5598 5599
 	continue
5599 5600
 	;;
5600 5601
 
... ...
@@ -6124,10 +6158,7 @@ func_mode_link ()
6124 6124
 	case $pass in
6125 6125
 	dlopen) libs="$dlfiles" ;;
6126 6126
 	dlpreopen) libs="$dlprefiles" ;;
6127
-	link)
6128
-	  libs="$deplibs %DEPLIBS%"
6129
-	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
6130
-	  ;;
6127
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6131 6128
 	esac
6132 6129
       fi
6133 6130
       if test "$linkmode,$pass" = "lib,dlpreopen"; then
... ...
@@ -6170,13 +6201,30 @@ func_mode_link ()
6170 6170
 	    finalize_deplibs="$deplib $finalize_deplibs"
6171 6171
 	  else
6172 6172
 	    func_append compiler_flags " $deplib"
6173
-	    if test "$linkmode" = lib ; then
6174
-		case "$new_inherited_linker_flags " in
6175
-		    *" $deplib "*) ;;
6176
-		    * ) func_append new_inherited_linker_flags " $deplib" ;;
6177
-		esac
6178
-	    fi
6179 6173
 	  fi
6174
+
6175
+	  case $linkmode in
6176
+	  lib)
6177
+	    deplibs="$deplib $deplibs"
6178
+	    test "$pass" = conv && continue
6179
+	    newdependency_libs="$deplib $newdependency_libs"
6180
+	    ;;
6181
+	  prog)
6182
+	    if test "$pass" = conv; then
6183
+	      deplibs="$deplib $deplibs"
6184
+	      continue
6185
+	    fi
6186
+	    if test "$pass" = scan; then
6187
+	      deplibs="$deplib $deplibs"
6188
+	    else
6189
+	      compile_deplibs="$deplib $compile_deplibs"
6190
+	      finalize_deplibs="$deplib $finalize_deplibs"
6191
+	    fi
6192
+	    ;;
6193
+	  *)
6194
+	    ;;
6195
+	  esac # linkmode
6196
+
6180 6197
 	  continue
6181 6198
 	  ;;
6182 6199
 	-l*)
... ...
@@ -6447,19 +6495,19 @@ func_mode_link ()
6447 6447
 	    # It is a libtool convenience library, so add in its objects.
6448 6448
 	    func_append convenience " $ladir/$objdir/$old_library"
6449 6449
 	    func_append old_convenience " $ladir/$objdir/$old_library"
6450
-	    tmp_libs=
6451
-	    for deplib in $dependency_libs; do
6452
-	      deplibs="$deplib $deplibs"
6453
-	      if $opt_preserve_dup_deps ; then
6454
-		case "$tmp_libs " in
6455
-		*" $deplib "*) func_append specialdeplibs " $deplib" ;;
6456
-		esac
6457
-	      fi
6458
-	      func_append tmp_libs " $deplib"
6459
-	    done
6460 6450
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
6461 6451
 	    func_fatal_error "\`$lib' is not a convenience library"
6462 6452
 	  fi
6453
+	  tmp_libs=
6454
+	  for deplib in $dependency_libs; do
6455
+	    deplibs="$deplib $deplibs"
6456
+	    if $opt_preserve_dup_deps ; then
6457
+	      case "$tmp_libs " in
6458
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6459
+	      esac
6460
+	    fi
6461
+	    func_append tmp_libs " $deplib"
6462
+	  done
6463 6463
 	  continue
6464 6464
 	fi # $pass = conv
6465 6465
 
... ...
@@ -7352,9 +7400,6 @@ func_mode_link ()
7352 7352
 	    revision="$number_minor"
7353 7353
 	    lt_irix_increment=no
7354 7354
 	    ;;
7355
-	  *)
7356
-	    func_fatal_configuration "$modename: unknown library version type \`$version_type'"
7357
-	    ;;
7358 7355
 	  esac
7359 7356
 	  ;;
7360 7357
 	no)
... ...
@@ -1,11 +1,10 @@
1 1
 #! /bin/sh
2
-# Common stub for a few missing GNU programs while installing.
2
+# Common wrapper for a few potentially missing GNU programs.
3 3
 
4
-scriptversion=2009-04-28.21; # UTC
4
+scriptversion=2012-06-26.16; # UTC
5 5
 
6
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
7
-# 2008, 2009 Free Software Foundation, Inc.
8
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
6
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
7
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
9 8
 
10 9
 # This program is free software; you can redistribute it and/or modify
11 10
 # it under the terms of the GNU General Public License as published by
... ...
@@ -26,69 +25,40 @@ scriptversion=2009-04-28.21; # UTC
26 26
 # the same distribution terms that you use for the rest of that program.
27 27
 
28 28
 if test $# -eq 0; then
29
-  echo 1>&2 "Try \`$0 --help' for more information"
29
+  echo 1>&2 "Try '$0 --help' for more information"
30 30
   exit 1
31 31
 fi
32 32
 
33
-run=:
34
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
35
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
36
-
37
-# In the cases where this matters, `missing' is being run in the
38
-# srcdir already.
39
-if test -f configure.ac; then
40
-  configure_ac=configure.ac
41
-else
42
-  configure_ac=configure.in
43
-fi
33
+case $1 in
44 34
 
45
-msg="missing on your system"
35
+  --is-lightweight)
36
+    # Used by our autoconf macros to check whether the available missing
37
+    # script is modern enough.
38
+    exit 0
39
+    ;;
46 40
 
47
-case $1 in
48
-  # Try to run requested program, and just exit if it succeeds.
49
-  run=
50
-  shift
51
-  "$@" && exit 0
52
-  # Exit code 63 means version mismatch.  This often happens
53
-  # when the user try to use an ancient version of a tool on
54
-  # a file that requires a minimum version.  In this case we
55
-  # we should proceed has if the program had been absent, or
56
-  # if --run hadn't been passed.
57
-  if test $? = 63; then
58
-    run=:
59
-    msg="probably too old"
60
-  fi
61
-  ;;
41
+  --run)
42
+    # Back-compat with the calling convention used by older automake.
43
+    shift
44
+    ;;
62 45
 
63 46
   -h|--h|--he|--hel|--help)
64 47
     echo "\
65 48
 $0 [OPTION]... PROGRAM [ARGUMENT]...
66 49
 
67
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
68
-error status if there is no known handling for PROGRAM.
50
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
51
+to PROGRAM being missing or too old.
69 52
 
70 53
 Options:
71 54
   -h, --help      display this help and exit
72 55
   -v, --version   output version information and exit
73
-  --run           try to run the given command, and emulate it if it fails
74 56
 
75 57
 Supported PROGRAM values:
76
-  aclocal      touch file \`aclocal.m4'
77
-  autoconf     touch file \`configure'
78
-  autoheader   touch file \`config.h.in'
79
-  autom4te     touch the output file, or create a stub one
80
-  automake     touch all \`Makefile.in' files
81
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
82
-  flex         create \`lex.yy.c', if possible, from existing .c
83
-  help2man     touch the output file
84
-  lex          create \`lex.yy.c', if possible, from existing .c
85
-  makeinfo     touch the output file
86
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
87
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
58
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
59
+  bison     yacc      flex         lex       help2man
88 60
 
89
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
90
-\`g' are ignored when checking the name.
61
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
62
+'g' are ignored when checking the name.
91 63
 
92 64
 Send bug reports to <bug-automake@gnu.org>."
93 65
     exit $?
... ...
@@ -100,272 +70,141 @@ Send bug reports to <bug-automake@gnu.org>."
100 100
     ;;
101 101
 
102 102
   -*)
103
-    echo 1>&2 "$0: Unknown \`$1' option"
104
-    echo 1>&2 "Try \`$0 --help' for more information"
103
+    echo 1>&2 "$0: unknown '$1' option"
104
+    echo 1>&2 "Try '$0 --help' for more information"
105 105
     exit 1
106 106
     ;;
107 107
 
108 108
 esac
109 109
 
110
-# normalize program name to check for.
111
-program=`echo "$1" | sed '
112
-  s/^gnu-//; t
113
-  s/^gnu//; t
114
-  s/^g//; t'`
115
-
116
-# Now exit if we have it, but it failed.  Also exit now if we
117
-# don't have it and --version was passed (most likely to detect
118
-# the program).  This is about non-GNU programs, so use $1 not
119
-# $program.
120
-case $1 in
121
-  lex*|yacc*)
122
-    # Not GNU programs, they don't have --version.
123
-    ;;
124
-
125
-  tar*)
126
-    if test -n "$run"; then
127
-       echo 1>&2 "ERROR: \`tar' requires --run"
128
-       exit 1
129
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
130
-       exit 1
131
-    fi
132
-    ;;
133
-
134
-  *)
135
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
136
-       # We have it, but it failed.
137
-       exit 1
138
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
139
-       # Could not run --version or --help.  This is probably someone
140
-       # running `$TOOL --version' or `$TOOL --help' to check whether
141
-       # $TOOL exists and not knowing $TOOL uses missing.
142
-       exit 1
143
-    fi
144
-    ;;
145
-esac
146
-
147
-# If it does not exist, or fails to run (possibly an outdated version),
148
-# try to emulate it.
149
-case $program in
150
-  aclocal*)
151
-    echo 1>&2 "\
152
-WARNING: \`$1' is $msg.  You should only need it if
153
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
154
-         to install the \`Automake' and \`Perl' packages.  Grab them from
155
-         any GNU archive site."
156
-    touch aclocal.m4
157
-    ;;
158
-
159
-  autoconf*)
160
-    echo 1>&2 "\
161
-WARNING: \`$1' is $msg.  You should only need it if
162
-         you modified \`${configure_ac}'.  You might want to install the
163
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
164
-         archive site."
165
-    touch configure
166
-    ;;
167
-
168
-  autoheader*)
169
-    echo 1>&2 "\
170
-WARNING: \`$1' is $msg.  You should only need it if
171
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
172
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
173
-         from any GNU archive site."
174
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
175
-    test -z "$files" && files="config.h"
176
-    touch_files=
177
-    for f in $files; do
178
-      case $f in
179
-      *:*) touch_files="$touch_files "`echo "$f" |
180
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
181
-      *) touch_files="$touch_files $f.in";;
182
-      esac
183
-    done
184
-    touch $touch_files
185
-    ;;
186
-
187
-  automake*)
188
-    echo 1>&2 "\
189
-WARNING: \`$1' is $msg.  You should only need it if
190
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
191
-         You might want to install the \`Automake' and \`Perl' packages.
192
-         Grab them from any GNU archive site."
193
-    find . -type f -name Makefile.am -print |
194
-	   sed 's/\.am$/.in/' |
195
-	   while read f; do touch "$f"; done
196
-    ;;
197
-
198
-  autom4te*)
199
-    echo 1>&2 "\
200
-WARNING: \`$1' is needed, but is $msg.
201
-         You might have modified some files without having the
202
-         proper tools for further handling them.
203
-         You can get \`$1' as part of \`Autoconf' from any GNU
204
-         archive site."
205
-
206
-    file=`echo "$*" | sed -n "$sed_output"`
207
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
208
-    if test -f "$file"; then
209
-	touch $file
210
-    else
211
-	test -z "$file" || exec >$file
212
-	echo "#! /bin/sh"
213
-	echo "# Created by GNU Automake missing as a replacement of"
214
-	echo "#  $ $@"
215
-	echo "exit 0"
216
-	chmod +x $file
217
-	exit 1
218
-    fi
219
-    ;;
220
-
221
-  bison*|yacc*)
222
-    echo 1>&2 "\
223
-WARNING: \`$1' $msg.  You should only need it if
224
-         you modified a \`.y' file.  You may need the \`Bison' package
225
-         in order for those modifications to take effect.  You can get
226
-         \`Bison' from any GNU archive site."
227
-    rm -f y.tab.c y.tab.h
228
-    if test $# -ne 1; then
229
-        eval LASTARG="\${$#}"
230
-	case $LASTARG in
231
-	*.y)
232
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
233
-	    if test -f "$SRCFILE"; then
234
-	         cp "$SRCFILE" y.tab.c
235
-	    fi
236
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
237
-	    if test -f "$SRCFILE"; then
238
-	         cp "$SRCFILE" y.tab.h
239
-	    fi
240
-	  ;;
241
-	esac
242
-    fi
243
-    if test ! -f y.tab.h; then
244
-	echo >y.tab.h
245
-    fi
246
-    if test ! -f y.tab.c; then
247
-	echo 'main() { return 0; }' >y.tab.c
248
-    fi
249
-    ;;
250
-
251
-  lex*|flex*)
252
-    echo 1>&2 "\
253
-WARNING: \`$1' is $msg.  You should only need it if
254
-         you modified a \`.l' file.  You may need the \`Flex' package
255
-         in order for those modifications to take effect.  You can get
256
-         \`Flex' from any GNU archive site."
257
-    rm -f lex.yy.c
258
-    if test $# -ne 1; then
259
-        eval LASTARG="\${$#}"
260
-	case $LASTARG in
261
-	*.l)
262
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
263
-	    if test -f "$SRCFILE"; then
264
-	         cp "$SRCFILE" lex.yy.c
265
-	    fi
266
-	  ;;
267
-	esac
268
-    fi
269
-    if test ! -f lex.yy.c; then
270
-	echo 'main() { return 0; }' >lex.yy.c
271
-    fi
272
-    ;;
273
-
274
-  help2man*)
275
-    echo 1>&2 "\
276
-WARNING: \`$1' is $msg.  You should only need it if
277
-	 you modified a dependency of a manual page.  You may need the
278
-	 \`Help2man' package in order for those modifications to take
279
-	 effect.  You can get \`Help2man' from any GNU archive site."
280
-
281
-    file=`echo "$*" | sed -n "$sed_output"`
282
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
283
-    if test -f "$file"; then
284
-	touch $file
285
-    else
286
-	test -z "$file" || exec >$file
287
-	echo ".ab help2man is required to generate this page"
288
-	exit $?
289
-    fi
290
-    ;;
291
-
292
-  makeinfo*)
293
-    echo 1>&2 "\
294
-WARNING: \`$1' is $msg.  You should only need it if
295
-         you modified a \`.texi' or \`.texinfo' file, or any other file
296
-         indirectly affecting the aspect of the manual.  The spurious
297
-         call might also be the consequence of using a buggy \`make' (AIX,
298
-         DU, IRIX).  You might want to install the \`Texinfo' package or
299
-         the \`GNU make' package.  Grab either from any GNU archive site."
300
-    # The file to touch is that specified with -o ...
301
-    file=`echo "$*" | sed -n "$sed_output"`
302
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
303
-    if test -z "$file"; then
304
-      # ... or it is the one specified with @setfilename ...
305
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
306
-      file=`sed -n '
307
-	/^@setfilename/{
308
-	  s/.* \([^ ]*\) *$/\1/
309
-	  p
310
-	  q
311
-	}' $infile`
312
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
313
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
314
-    fi
315
-    # If the file does not exist, the user really needs makeinfo;
316
-    # let's fail without touching anything.
317
-    test -f $file || exit 1
318
-    touch $file
319
-    ;;
320
-
321
-  tar*)
322
-    shift
323
-
324
-    # We have already tried tar in the generic part.
325
-    # Look for gnutar/gtar before invocation to avoid ugly error
326
-    # messages.
327
-    if (gnutar --version > /dev/null 2>&1); then
328
-       gnutar "$@" && exit 0
329
-    fi
330
-    if (gtar --version > /dev/null 2>&1); then
331
-       gtar "$@" && exit 0
332
-    fi
333
-    firstarg="$1"
334
-    if shift; then
335
-	case $firstarg in
336
-	*o*)
337
-	    firstarg=`echo "$firstarg" | sed s/o//`
338
-	    tar "$firstarg" "$@" && exit 0
339
-	    ;;
340
-	esac
341
-	case $firstarg in
342
-	*h*)
343
-	    firstarg=`echo "$firstarg" | sed s/h//`
344
-	    tar "$firstarg" "$@" && exit 0
345
-	    ;;
346
-	esac
347
-    fi
348
-
349
-    echo 1>&2 "\
350
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
351
-         You may want to install GNU tar or Free paxutils, or check the
352
-         command line arguments."
353
-    exit 1
354
-    ;;
355
-
356
-  *)
357
-    echo 1>&2 "\
358
-WARNING: \`$1' is needed, and is $msg.
359
-         You might have modified some files without having the
360
-         proper tools for further handling them.  Check the \`README' file,
361
-         it often tells you about the needed prerequisites for installing
362
-         this package.  You may also peek at any GNU archive site, in case
363
-         some other package would contain this missing \`$1' program."
364
-    exit 1
365
-    ;;
366
-esac
110
+# Run the given program, remember its exit status.
111
+"$@"; st=$?
112
+
113
+# If it succeeded, we are done.
114
+test $st -eq 0 && exit 0
115
+
116
+# Also exit now if we it failed (or wasn't found), and '--version' was
117
+# passed; such an option is passed most likely to detect whether the
118
+# program is present and works.
119
+case $2 in --version|--help) exit $st;; esac
120
+
121
+# Exit code 63 means version mismatch.  This often happens when the user
122
+# tries to use an ancient version of a tool on a file that requires a
123
+# minimum version.
124
+if test $st -eq 63; then
125
+  msg="probably too old"
126
+elif test $st -eq 127; then
127
+  # Program was missing.
128
+  msg="missing on your system"
129
+else
130
+  # Program was found and executed, but failed.  Give up.
131
+  exit $st
132
+fi
367 133
 
368
-exit 0
134
+perl_URL=http://www.perl.org/
135
+flex_URL=http://flex.sourceforge.net/
136
+gnu_software_URL=http://www.gnu.org/software
137
+
138
+program_details ()
139
+{
140
+  case $1 in
141
+    aclocal|automake)
142
+      echo "The '$1' program is part of the GNU Automake package:"
143
+      echo "<$gnu_software_URL/automake>"
144
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
145
+      echo "<$gnu_software_URL/autoconf>"
146
+      echo "<$gnu_software_URL/m4/>"
147
+      echo "<$perl_URL>"
148
+      ;;
149
+    autoconf|autom4te|autoheader)
150
+      echo "The '$1' program is part of the GNU Autoconf package:"
151
+      echo "<$gnu_software_URL/autoconf/>"
152
+      echo "It also requires GNU m4 and Perl in order to run:"
153
+      echo "<$gnu_software_URL/m4/>"
154
+      echo "<$perl_URL>"
155
+      ;;
156
+  esac
157
+}
158
+
159
+give_advice ()
160
+{
161
+  # Normalize program name to check for.
162
+  normalized_program=`echo "$1" | sed '
163
+    s/^gnu-//; t
164
+    s/^gnu//; t
165
+    s/^g//; t'`
166
+
167
+  printf '%s\n' "'$1' is $msg."
168
+
169
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
170
+  case $normalized_program in
171
+    autoconf*)
172
+      echo "You should only need it if you modified 'configure.ac',"
173
+      echo "or m4 files included by it."
174
+      program_details 'autoconf'
175
+      ;;
176
+    autoheader*)
177
+      echo "You should only need it if you modified 'acconfig.h' or"
178
+      echo "$configure_deps."
179
+      program_details 'autoheader'
180
+      ;;
181
+    automake*)
182
+      echo "You should only need it if you modified 'Makefile.am' or"
183
+      echo "$configure_deps."
184
+      program_details 'automake'
185
+      ;;
186
+    aclocal*)
187
+      echo "You should only need it if you modified 'acinclude.m4' or"
188
+      echo "$configure_deps."
189
+      program_details 'aclocal'
190
+      ;;
191
+   autom4te*)
192
+      echo "You might have modified some maintainer files that require"
193
+      echo "the 'automa4te' program to be rebuilt."
194
+      program_details 'autom4te'
195
+      ;;
196
+    bison*|yacc*)
197
+      echo "You should only need it if you modified a '.y' file."
198
+      echo "You may want to install the GNU Bison package:"
199
+      echo "<$gnu_software_URL/bison/>"
200
+      ;;
201
+    lex*|flex*)
202
+      echo "You should only need it if you modified a '.l' file."
203
+      echo "You may want to install the Fast Lexical Analyzer package:"
204
+      echo "<$flex_URL>"
205
+      ;;
206
+    help2man*)
207
+      echo "You should only need it if you modified a dependency" \
208
+           "of a man page."
209
+      echo "You may want to install the GNU Help2man package:"
210
+      echo "<$gnu_software_URL/help2man/>"
211
+    ;;
212
+    makeinfo*)
213
+      echo "You should only need it if you modified a '.texi' file, or"
214
+      echo "any other file indirectly affecting the aspect of the manual."
215
+      echo "You might want to install the Texinfo package:"
216
+      echo "<$gnu_software_URL/texinfo/>"
217
+      echo "The spurious makeinfo call might also be the consequence of"
218
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
219
+      echo "want to install GNU make:"
220
+      echo "<$gnu_software_URL/make/>"
221
+      ;;
222
+    *)
223
+      echo "You might have modified some files without having the proper"
224
+      echo "tools for further handling them.  Check the 'README' file, it"
225
+      echo "often tells you about the needed prerequisites for installing"
226
+      echo "this package.  You may also peek at any GNU archive site, in"
227
+      echo "case some other package contains this missing '$1' program."
228
+      ;;
229
+  esac
230
+}
231
+
232
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
233
+                       -e '2,$s/^/         /' >&2
234
+
235
+# Propagate the correct exit status (expected to be 127 for a program
236
+# not found, 63 for a program that failed due to version mismatch).
237
+exit $st
369 238
 
370 239
 # Local variables:
371 240
 # eval: (add-hook 'write-file-hooks 'time-stamp)
... ...
@@ -6216,7 +6216,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
6216 6216
   lt_cv_deplibs_check_method=pass_all
6217 6217
   ;;
6218 6218
 
6219
-netbsd* | netbsdelf*-gnu)
6219
+netbsd*)
6220 6220
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
6221 6221
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
6222 6222
   else
... ...
@@ -9359,9 +9359,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
9359 9359
   openbsd*)
9360 9360
     with_gnu_ld=no
9361 9361
     ;;
9362
-  linux* | k*bsd*-gnu | gnu*)
9363
-    link_all_deplibs=no
9364
-    ;;
9365 9362
   esac
9366 9363
 
9367 9364
   ld_shlibs=yes
... ...
@@ -9583,7 +9580,7 @@ _LT_EOF
9583 9583
       fi
9584 9584
       ;;
9585 9585
 
9586
-    netbsd* | netbsdelf*-gnu)
9586
+    netbsd*)
9587 9587
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
9588 9588
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
9589 9589
 	wlarc=
... ...
@@ -9760,7 +9757,6 @@ _LT_EOF
9760 9760
 	if test "$aix_use_runtimelinking" = yes; then
9761 9761
 	  shared_flag="$shared_flag "'${wl}-G'
9762 9762
 	fi
9763
-	link_all_deplibs=no
9764 9763
       else
9765 9764
 	# not using gcc
9766 9765
 	if test "$host_cpu" = ia64; then
... ...
@@ -10214,7 +10210,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
10214 10214
       link_all_deplibs=yes
10215 10215
       ;;
10216 10216
 
10217
-    netbsd* | netbsdelf*-gnu)
10217
+    netbsd*)
10218 10218
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
10219 10219
 	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
10220 10220
       else
... ...
@@ -11242,18 +11238,6 @@ fi
11242 11242
   dynamic_linker='GNU/Linux ld.so'
11243 11243
   ;;
11244 11244
 
11245
-netbsdelf*-gnu)
11246
-  version_type=linux
11247
-  need_lib_prefix=no
11248
-  need_version=no
11249
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
11250
-  soname_spec='${libname}${release}${shared_ext}$major'
11251
-  shlibpath_var=LD_LIBRARY_PATH
11252
-  shlibpath_overrides_runpath=no
11253
-  hardcode_into_libs=yes
11254
-  dynamic_linker='NetBSD ld.elf_so'
11255
-  ;;
11256
-
11257 11245
 netbsd*)
11258 11246
   version_type=sunos
11259 11247
   need_lib_prefix=no
... ...
@@ -14089,7 +14073,7 @@ lt_prog_compiler_static_CXX=
14089 14089
 	    ;;
14090 14090
 	esac
14091 14091
 	;;
14092
-      netbsd* | netbsdelf*-gnu)
14092
+      netbsd*)
14093 14093
 	;;
14094 14094
       *qnx* | *nto*)
14095 14095
         # QNX uses GNU C++, but need to define -shared option too, otherwise
... ...
@@ -14460,9 +14444,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
14460 14460
       ;;
14461 14461
     esac
14462 14462
     ;;
14463
-  linux* | k*bsd*-gnu | gnu*)
14464
-    link_all_deplibs_CXX=no
14465
-    ;;
14466 14463
   *)
14467 14464
     export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
14468 14465
     ;;
... ...
@@ -15088,18 +15069,6 @@ fi
15088 15088
   dynamic_linker='GNU/Linux ld.so'
15089 15089
   ;;
15090 15090
 
15091
-netbsdelf*-gnu)
15092
-  version_type=linux
15093
-  need_lib_prefix=no
15094
-  need_version=no
15095
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
15096
-  soname_spec='${libname}${release}${shared_ext}$major'
15097
-  shlibpath_var=LD_LIBRARY_PATH
15098
-  shlibpath_overrides_runpath=no
15099
-  hardcode_into_libs=yes
15100
-  dynamic_linker='NetBSD ld.elf_so'
15101
-  ;;
15102
-
15103 15091
 netbsd*)
15104 15092
   version_type=sunos
15105 15093
   need_lib_prefix=no
... ...
@@ -20,7 +20,7 @@ AC_CONFIG_SRCDIR([llvm/configure])
20 20
 AC_CONFIG_MACRO_DIR([m4])
21 21
 AC_CONFIG_HEADER([clamavcxx-config.h])
22 22
 AC_CANONICAL_TARGET
23
-AM_INIT_AUTOMAKE([1.9 -Wall -Wportability -Werror foreign no-define color-tests tar-pax])
23
+AM_INIT_AUTOMAKE([1.9 -Wall -Wportability foreign no-define color-tests tar-pax])
24 24
 AM_SILENT_RULES([yes])
25 25
 
26 26
 cxxset=${CXXFLAGS+set}
... ...
@@ -2684,18 +2684,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
2684 2684
   dynamic_linker='GNU/Linux ld.so'
2685 2685
   ;;
2686 2686
 
2687
-netbsdelf*-gnu)
2688
-  version_type=linux
2689
-  need_lib_prefix=no
2690
-  need_version=no
2691
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
2692
-  soname_spec='${libname}${release}${shared_ext}$major'
2693
-  shlibpath_var=LD_LIBRARY_PATH
2694
-  shlibpath_overrides_runpath=no
2695
-  hardcode_into_libs=yes
2696
-  dynamic_linker='NetBSD ld.elf_so'
2697
-  ;;
2698
-
2699 2687
 netbsd*)
2700 2688
   version_type=sunos
2701 2689
   need_lib_prefix=no
... ...
@@ -3301,7 +3289,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
3301 3301
   lt_cv_deplibs_check_method=pass_all
3302 3302
   ;;
3303 3303
 
3304
-netbsd* | netbsdelf*-gnu)
3304
+netbsd*)
3305 3305
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
3306 3306
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
3307 3307
   else
... ...
@@ -4113,7 +4101,7 @@ m4_if([$1], [CXX], [
4113 4113
 	    ;;
4114 4114
 	esac
4115 4115
 	;;
4116
-      netbsd* | netbsdelf*-gnu)
4116
+      netbsd*)
4117 4117
 	;;
4118 4118
       *qnx* | *nto*)
4119 4119
         # QNX uses GNU C++, but need to define -shared option too, otherwise
... ...
@@ -4590,9 +4578,6 @@ m4_if([$1], [CXX], [
4590 4590
       ;;
4591 4591
     esac
4592 4592
     ;;
4593
-  linux* | k*bsd*-gnu | gnu*)
4594
-    _LT_TAGVAR(link_all_deplibs, $1)=no
4595
-    ;;
4596 4593
   *)
4597 4594
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
4598 4595
     ;;
... ...
@@ -4655,9 +4640,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
4655 4655
   openbsd*)
4656 4656
     with_gnu_ld=no
4657 4657
     ;;
4658
-  linux* | k*bsd*-gnu | gnu*)
4659
-    _LT_TAGVAR(link_all_deplibs, $1)=no
4660
-    ;;
4661 4658
   esac
4662 4659
 
4663 4660
   _LT_TAGVAR(ld_shlibs, $1)=yes
... ...
@@ -4879,7 +4861,7 @@ _LT_EOF
4879 4879
       fi
4880 4880
       ;;
4881 4881
 
4882
-    netbsd* | netbsdelf*-gnu)
4882
+    netbsd*)
4883 4883
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
4884 4884
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
4885 4885
 	wlarc=
... ...
@@ -5056,7 +5038,6 @@ _LT_EOF
5056 5056
 	if test "$aix_use_runtimelinking" = yes; then
5057 5057
 	  shared_flag="$shared_flag "'${wl}-G'
5058 5058
 	fi
5059
-	_LT_TAGVAR(link_all_deplibs, $1)=no
5060 5059
       else
5061 5060
 	# not using gcc
5062 5061
 	if test "$host_cpu" = ia64; then
... ...
@@ -5361,7 +5342,7 @@ _LT_EOF
5361 5361
       _LT_TAGVAR(link_all_deplibs, $1)=yes
5362 5362
       ;;
5363 5363
 
5364
-    netbsd* | netbsdelf*-gnu)
5364
+    netbsd*)
5365 5365
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
5366 5366
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
5367 5367
       else
... ...
@@ -220,6 +220,8 @@ enum bytecode_mode {
220 220
     CL_BYTECODE_MODE_OFF /* for query only, not settable */
221 221
 };
222 222
 
223
+typedef enum cli_intel_sample_type { WHOLEFILE = 0, PESECTION = 1 } cli_intel_sample_type_t; /* For stats/intel gathering */
224
+
223 225
 extern int cl_engine_set_num(struct cl_engine *engine, enum cl_engine_field field, long long num);
224 226
 
225 227
 extern long long cl_engine_get_num(const struct cl_engine *engine, enum cl_engine_field field, int *err);
... ...
@@ -355,6 +357,33 @@ typedef cl_error_t (*clcb_meta)(const char* container_type, unsigned long fsize_
355 355
 			  unsigned long fsize_real,  int is_encrypted, unsigned int filepos_container, void *context);
356 356
 extern void cl_engine_set_clcb_meta(struct cl_engine *engine, clcb_meta callback);
357 357
 
358
+/* Statistics/intelligence gathering callbacks */
359
+extern void cl_engine_set_stats_set_cbdata(struct cl_engine *engine, void *cbdata);
360
+
361
+typedef void (*clcb_stats_add_sample)(const char *virname, const unsigned char *md5, size_t size, cli_intel_sample_type_t type, void *cbdata);
362
+extern void cl_engine_set_clcb_stats_add_sample(struct cl_engine *engine, clcb_stats_add_sample callback);
363
+
364
+typedef void (*clcb_stats_remove_sample)(const char *virname, const char *md5, size_t size, void *cbdata);
365
+extern void cl_engine_set_clcb_stats_remove_sample(struct cl_engine *engine, clcb_stats_remove_sample callback);
366
+
367
+typedef void (*clcb_stats_decrement_count)(const char *virname, const char *md5, size_t size, void *cbdata);
368
+extern void cl_engine_set_clcb_stats_decrement_count(struct cl_engine *engine, clcb_stats_decrement_count callback);
369
+
370
+typedef void (*clcb_stats_submit)(struct cl_engine *engine, void *cbdata);
371
+extern void cl_engine_set_clcb_stats_submit(struct cl_engine *engine, clcb_stats_submit callback);
372
+
373
+typedef void (*clcb_stats_flush)(struct cl_engine *engine, void *cbdata);
374
+extern void cl_engine_set_clcb_stats_flush(struct cl_engine *engine, clcb_stats_flush callback);
375
+
376
+typedef size_t (*clcb_stats_get_num)(void *cbdata);
377
+extern void cl_engine_set_clcb_stats_get_num(struct cl_engine *engine, clcb_stats_get_num callback);
378
+
379
+typedef size_t (*clcb_stats_get_size)(void *cbdata);
380
+extern void cl_engine_set_clcb_stats_get_size(struct cl_engine *engine, clcb_stats_get_size callback);
381
+
382
+typedef char * (*clcb_stats_get_hostid)(void *cbdata);
383
+extern void cl_engine_set_clcb_stats_get_hostid(struct cl_engine *engine, clcb_stats_get_hostid callback);
384
+
358 385
 struct cl_stat {
359 386
     char *dir;
360 387
     STATBUF *stattab;
361 388
new file mode 100644
... ...
@@ -0,0 +1,150 @@
0
+#include <stdio.h>
1
+#include <stdlib.h>
2
+#include <string.h>
3
+#include <unistd.h>
4
+
5
+#include <sys/types.h>
6
+#include <errno.h>
7
+
8
+#include "libclamav/others.h"
9
+#include "libclamav/clamav.h"
10
+
11
+#define JSON_BUFSZ 512
12
+#define SAMPLE_PREFIX "sample_"
13
+
14
+char *hex_encode(char *buf, char *data, size_t len)
15
+{
16
+    size_t i;
17
+    char *p;
18
+
19
+    p = (buf != NULL) ? buf : calloc(1, (len*2)+1);
20
+    if (!(p))
21
+        return NULL;
22
+
23
+    for (i=0; i<len; i++)
24
+        sprintf(p+(i*2), "%02x", *(int *)(data+i) & 0xff);
25
+
26
+    return p;
27
+}
28
+
29
+const char *get_sample_type(cli_intel_sample_type_t type)
30
+{
31
+    switch (type) {
32
+        case WHOLEFILE:
33
+            return "whole-file";
34
+        case PESECTION:
35
+            return "PE section";
36
+        default:
37
+            return NULL;
38
+    }
39
+}
40
+
41
+char *ensure_bufsize(char *buf, size_t *oldsize, size_t used, size_t additional)
42
+{
43
+    char *p=buf;
44
+
45
+    if (*oldsize - used < additional) {
46
+        p = realloc(buf, *oldsize + JSON_BUFSZ);
47
+        if (!(p)) {
48
+            cli_errmsg("ensure_bufsize: Could not allocate more memory: %s (errno: %d)\n", strerror(errno), errno);
49
+            free(buf);
50
+            return NULL;
51
+        }
52
+
53
+        *oldsize += JSON_BUFSZ;
54
+    }
55
+
56
+    return p;
57
+}
58
+
59
+char *export_stats_to_json(struct cl_engine *engine, cli_intel_t *intel)
60
+{
61
+    char *buf=NULL, *p, *hostid, md5[33];
62
+    const char *type;
63
+    cli_flagged_sample_t *sample;
64
+    size_t bufsz, curused, i;
65
+
66
+    if (!(intel->hostid))
67
+        if ((engine->cb_stats_get_hostid))
68
+            intel->hostid = engine->cb_stats_get_hostid(engine->stats_data);
69
+
70
+    hostid = (intel->hostid != NULL) ? intel->hostid : STATS_ANON_UUID;
71
+
72
+    buf = calloc(1, JSON_BUFSZ);
73
+    if (!(buf))
74
+        return NULL;
75
+
76
+    bufsz = JSON_BUFSZ;
77
+    sprintf(buf, "{\n\t\"hostid\": \"%s\",\n", hostid);
78
+    sprintf(buf+strlen(buf), "\t\"samples\": {\n");
79
+    curused = strlen(buf);
80
+
81
+    for (sample = intel->samples; sample != NULL; sample = sample->next) {
82
+        if (sample->hits == 0)
83
+            continue;
84
+
85
+        memset(md5, 0x00, sizeof(md5));
86
+        hex_encode(md5, sample->md5, sizeof(sample->md5));
87
+
88
+        buf = ensure_bufsize(buf, &bufsz, curused, strlen(md5) + sizeof(SAMPLE_PREFIX) + 45);
89
+        if (!(buf))
90
+            return NULL;
91
+
92
+        snprintf(buf+curused, bufsz-curused, "\t\t\"%s%s\": {\n", SAMPLE_PREFIX, md5);
93
+        curused += strlen(buf+curused);
94
+
95
+        type = get_sample_type(sample->type);
96
+        if (!(type)) {
97
+            free(buf);
98
+            return NULL;
99
+        }
100
+
101
+        buf = ensure_bufsize(buf, &bufsz, curused, sizeof("type") + strlen(type) + 15);
102
+        if (!(buf))
103
+            return NULL;
104
+
105
+        snprintf(buf+curused, bufsz-curused, "\t\t\t\"type\": \"%s\",\n", type);
106
+        curused += strlen(buf+curused);
107
+
108
+        /* Reuse the md5 variable for serializing the number of hits */
109
+        snprintf(md5, sizeof(md5), "%u", sample->hits);
110
+
111
+        buf = ensure_bufsize(buf, &bufsz, curused, strlen(md5) + 20);
112
+        if (!(buf))
113
+            return NULL;
114
+
115
+        snprintf(buf+curused, bufsz-curused, "\t\t\t\"size\": \"%s\",\n", md5);
116
+        curused += strlen(buf+curused);
117
+
118
+        buf = ensure_bufsize(buf, &bufsz, curused, 30);
119
+        if (!(buf))
120
+            return NULL;
121
+
122
+        snprintf(buf+curused, bufsz-curused, "\t\t\t\"virus_names\": [ ");
123
+        curused += strlen(buf+curused);
124
+
125
+        for (i=0; sample->virus_name[i] != NULL; i++) {
126
+            buf = ensure_bufsize(buf, &bufsz, curused, strlen(sample->virus_name[i]) + 5);
127
+            if (!(buf))
128
+                return NULL;
129
+
130
+            snprintf(buf+curused, bufsz-curused, "%s\"%s\"", (i > 0) ? ", " : "", sample->virus_name[i]);
131
+            curused += strlen(buf+curused);
132
+        }
133
+
134
+        buf = ensure_bufsize(buf, &bufsz, curused, 10);
135
+        if (!(buf))
136
+            return NULL;
137
+
138
+        snprintf(buf+curused, bufsz-curused, " ]\n\t\t}%s\n", (sample->next != NULL) ? "," : "");
139
+        curused += strlen(buf+curused);
140
+    }
141
+
142
+    buf = ensure_bufsize(buf, &bufsz, curused, 15);
143
+    if (!(buf))
144
+        return NULL;
145
+
146
+    snprintf(buf+curused, bufsz-curused, "\t}\n}\n");
147
+
148
+    return buf;
149
+}
0 150
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+#if !defined(_LIBCLAMAV_JSON_H)
1
+#define _LIBCLAMAV_JSON_H
2
+
3
+char *export_stats_to_json(struct cl_engine *engine, cli_intel_t *intel);
4
+
5
+#endif
... ...
@@ -42,6 +42,15 @@ CLAMAV_PUBLIC {
42 42
     cl_scanmap_callback;
43 43
     cl_fmap_close;
44 44
     cl_always_gen_section_hash;
45
+    cl_engine_set_stats_set_cbdata;
46
+    cl_engine_set_clcb_stats_add_sample;
47
+    cl_engine_set_clcb_stats_remove_sample;
48
+    cl_engine_set_clcb_stats_decrement_count;
49
+    cl_engine_set_clcb_stats_submit;
50
+    cl_engine_set_clcb_stats_flush;
51
+    cl_engine_set_clcb_stats_get_num;
52
+    cl_engine_set_clcb_stats_get_size;
53
+    cl_engine_set_clcb_stats_get_hostid;
45 54
 };
46 55
 CLAMAV_PRIVATE {
47 56
   global:
... ...
@@ -420,7 +420,7 @@ int cli_checkfp(unsigned char *digest, size_t size, cli_ctx *ctx)
420 420
 {
421 421
 	char md5[33];
422 422
 	unsigned int i;
423
-	const char *virname;
423
+	const char *virname=NULL;
424 424
         SHA1Context sha1;
425 425
         SHA256_CTX sha256;
426 426
         fmap_t *map;
... ...
@@ -531,6 +531,9 @@ int cli_checkfp(unsigned char *digest, size_t size, cli_ctx *ctx)
531 531
     if (ctx->engine->cb_hash)
532 532
 	ctx->engine->cb_hash(fmap_fd(*ctx->fmap), size, md5, cli_get_last_virus(ctx), ctx->cb_ctx);
533 533
 
534
+    if (ctx->engine->cb_stats_add_sample)
535
+        ctx->engine->cb_stats_add_sample(virname, digest, size, WHOLEFILE, ctx->engine->stats_data);
536
+
534 537
     return CL_VIRUS;
535 538
 }
536 539
 
... ...
@@ -52,6 +52,10 @@
52 52
 #include <malloc.h>
53 53
 #endif
54 54
 
55
+#ifdef CL_THREAD_SAFE
56
+#include <pthread.h>
57
+#endif
58
+
55 59
 #if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
56 60
 #include <limits.h>
57 61
 #include <stddef.h>
... ...
@@ -71,6 +75,7 @@
71 71
 #include "bytecode.h"
72 72
 #include "bytecode_api_impl.h"
73 73
 #include "cache.h"
74
+#include "stats.h"
74 75
 
75 76
 int (*cli_unrar_open)(int fd, const char *dirname, unrar_state_t *state);
76 77
 int (*cli_unrar_extract_next_prepare)(unrar_state_t *state, const char *dirname);
... ...
@@ -306,7 +311,7 @@ int cl_init(unsigned int initoptions)
306 306
 struct cl_engine *cl_engine_new(void)
307 307
 {
308 308
 	struct cl_engine *new;
309
-
309
+    cli_intel_t *intel;
310 310
 
311 311
     new = (struct cl_engine *) cli_calloc(1, sizeof(struct cl_engine));
312 312
     if(!new) {
... ...
@@ -378,6 +383,27 @@ struct cl_engine *cl_engine_new(void)
378 378
 	return NULL;
379 379
     }
380 380
 
381
+    /* Set up default stats/intel gathering callbacks */
382
+    intel = cli_calloc(1, sizeof(cli_intel_t));
383
+#ifdef CL_THREAD_SAFE
384
+    if (pthread_mutex_init(&(intel->mutex), NULL)) {
385
+        cli_errmsg("cli_engine_new: Cannot initialize stats gathering mutex\n");
386
+        mpool_free(new->mempool, new->dconf);
387
+        mpool_free(new->mempool, new->root);
388
+#ifdef USE_MPOOL
389
+        mpool_destroy(new->mempool);
390
+#endif
391
+        free(new);
392
+        return NULL;
393
+    }
394
+#endif
395
+    intel->engine = new;
396
+    intel->maxsamples = 10;
397
+    new->stats_data = intel;
398
+    new->cb_stats_add_sample = clamav_stats_add_sample;
399
+    new->cb_stats_submit = clamav_stats_submit;
400
+    new->cb_stats_flush = clamav_stats_flush;
401
+
381 402
     cli_dbgmsg("Initialized %s engine\n", cl_retver());
382 403
     return new;
383 404
 }
... ...
@@ -138,6 +138,31 @@ typedef struct cli_ctx_tag {
138 138
 #endif
139 139
 } cli_ctx;
140 140
 
141
+#define STATS_ANON_UUID "5b585e8f-3be5-11e3-bf0b-18037319526c"
142
+
143
+typedef struct cli_flagged_sample {
144
+    char **virus_name;
145
+    char md5[16];
146
+    cli_intel_sample_type_t type;
147
+    size_t size; /* A size of zero means size is unavailable (why would this ever happen?) */
148
+    uint32_t hits;
149
+
150
+    struct cli_flagged_sample *prev;
151
+    struct cli_flagged_sample *next;
152
+} cli_flagged_sample_t;
153
+
154
+typedef struct cli_clamav_intel {
155
+    char *hostid;
156
+    cli_flagged_sample_t *samples;
157
+    uint32_t nsamples;
158
+    uint32_t maxsamples;
159
+    uint32_t maxmem;
160
+    time_t nextupdate;
161
+    struct cl_engine *engine;
162
+#ifdef CL_THREAD_SAFE
163
+    pthread_mutex_t mutex;
164
+#endif
165
+} cli_intel_t;
141 166
 
142 167
 typedef struct {uint64_t v[2][4];} icon_groupset;
143 168
 
... ...
@@ -284,6 +309,17 @@ struct cl_engine {
284 284
     uint64_t maxhtmlnotags; /* max size for scanning normalized HTML */
285 285
     uint64_t maxscriptnormalize; /* max size to normalize scripts */
286 286
     uint64_t maxziptypercg; /* max size to re-do zip filetype */
287
+
288
+    /* Statistics/intelligence gathering */
289
+    void *stats_data;
290
+    clcb_stats_add_sample cb_stats_add_sample;
291
+    clcb_stats_remove_sample cb_stats_remove_sample;
292
+    clcb_stats_decrement_count cb_stats_decrement_count;
293
+    clcb_stats_submit cb_stats_submit;
294
+    clcb_stats_flush cb_stats_flush;
295
+    clcb_stats_get_num cb_stats_get_num;
296
+    clcb_stats_get_size cb_stats_get_size;
297
+    clcb_stats_get_hostid cb_stats_get_hostid;
287 298
 };
288 299
 
289 300
 struct cl_settings {
... ...
@@ -3237,7 +3237,11 @@ int cl_engine_free(struct cl_engine *engine)
3237 3237
 	return CL_SUCCESS;
3238 3238
     }
3239 3239
 
3240
+    if (engine->cb_stats_submit)
3241
+        engine->cb_stats_submit(engine, engine->stats_data);
3242
+
3240 3243
 #ifdef CL_THREAD_SAFE
3244
+    pthread_mutex_destroy(&(((cli_intel_t *)(engine->stats_data))->mutex));
3241 3245
     pthread_mutex_unlock(&cli_ref_mutex);
3242 3246
 #endif
3243 3247
     if(engine->root) {
3244 3248
new file mode 100644
... ...
@@ -0,0 +1,239 @@
0
+#if HAVE_CONFIG_H
1
+#include "clamav-config.h"
2
+#endif
3
+
4
+#include <stdio.h>
5
+#include <stdlib.h>
6
+#include <string.h>
7
+#include <unistd.h>
8
+
9
+#include <sys/types.h>
10
+
11
+#ifdef CL_THREAD_SAFE
12
+#include <pthread.h>
13
+#endif
14
+
15
+#include "libclamav/others.h"
16
+#include "libclamav/clamav.h"
17
+#include "libclamav/json.h"
18
+
19
+static cli_flagged_sample_t *find_sample(cli_intel_t *intel, const char *virname, const unsigned char *md5, size_t size, cli_intel_sample_type_t type);
20
+void free_sample(cli_flagged_sample_t *sample);
21
+
22
+void clamav_stats_add_sample(const char *virname, const unsigned char *md5, size_t size, cli_intel_sample_type_t type, void *cbdata)
23
+{
24
+    cli_intel_t *intel;
25
+    cli_flagged_sample_t *sample;
26
+    size_t i;
27
+    char **p;
28
+
29
+    if (!(cbdata))
30
+        return;
31
+
32
+    intel = (cli_intel_t *)cbdata;
33
+
34
+    if (intel->nsamples + 1 >= intel->maxsamples) {
35
+        if (!(intel->engine))
36
+            return;
37
+
38
+        if (!(intel->engine->cb_stats_submit)) {
39
+            if ((intel->engine->cb_stats_flush))
40
+                intel->engine->cb_stats_flush(intel->engine, intel);
41
+
42
+            return;
43
+        }
44
+
45
+        intel->engine->cb_stats_submit(intel->engine, cbdata);
46
+    }
47
+
48
+#ifdef CL_THREAD_SAFE
49
+    cli_warnmsg("clamav_stats_add_sample: locking mutex\n");
50
+    if (pthread_mutex_lock(&(intel->mutex))) {
51
+        cli_warnmsg("clamav_stats_add_sample: locking mutex failed\n");
52
+        return;
53
+    }
54
+    cli_warnmsg("clamav_stats_add_sample: locked mutex\n");
55
+#endif
56
+
57
+    sample = find_sample(intel, virname, md5, size, type);
58
+    if (!(sample)) {
59
+        if (!(intel->samples)) {
60
+            sample = intel->samples = calloc(1, sizeof(cli_flagged_sample_t));
61
+            if (!(sample))
62
+                goto end;
63
+        } else {
64
+            sample = calloc(1, sizeof(cli_flagged_sample_t));
65
+            if (!(sample))
66
+                goto end;
67
+
68
+            sample->next = intel->samples;
69
+            intel->samples->prev = sample;
70
+            intel->samples = sample;
71
+        }
72
+
73
+        if ((sample->virus_name)) {
74
+            for (i=0; sample->virus_name[i] != NULL; i++)
75
+                ;
76
+        } else {
77
+            i=0;
78
+            sample->virus_name = calloc(1, sizeof(char **));
79
+            if (!(sample->virus_name)) {
80
+                free(sample);
81
+                if (sample == intel->samples)
82
+                    intel->samples = NULL;
83
+
84
+                goto end;
85
+            }
86
+        }
87
+
88
+        sample->virus_name[i] = strdup((virname != NULL) ? virname : "[unknown]");
89
+        if (!(sample->virus_name[i])) {
90
+            free(sample);
91
+            free(sample->virus_name);
92
+            if (sample == intel->samples)
93
+                intel->samples = NULL;
94
+
95
+            goto end;
96
+        }
97
+
98
+        p = realloc(sample->virus_name, sizeof(char **) * (i+1));
99
+        if (!(p)) {
100
+            free(sample->virus_name);
101
+            free(sample);
102
+            if (sample == intel->samples)
103
+                intel->samples = NULL;
104
+
105
+            goto end;
106
+        }
107
+
108
+        sample->virus_name = p;
109
+        sample->virus_name[i+1] = NULL;
110
+
111
+        memcpy(sample->md5, md5, sizeof(sample->md5));
112
+        sample->type = type;
113
+        sample->size = size;
114
+        intel->nsamples++;
115
+    }
116
+
117
+    cli_warnmsg("Added %s to the stats cache\n", (virname != NULL) ? virname: "[unknown]");
118
+
119
+    sample->hits++;
120
+
121
+end:
122
+#ifdef CL_THREAD_SAFE
123
+    if (pthread_mutex_unlock(&(intel->mutex))) {
124
+        cli_warnmsg("clamav_stats_add_sample: unlcoking mutex failed\n");
125
+    }
126
+    cli_warnmsg("clamav_stats_add_sample: unlocked mutex\n");
127
+#endif
128
+}
129
+
130
+void clamav_stats_flush(struct cl_engine *engine, void *cbdata)
131
+{
132
+    cli_intel_t *intel;
133
+    cli_flagged_sample_t *sample, *next;
134
+
135
+#ifdef CL_THREAD_SAFE
136
+    cli_warnmsg("clamav_stats_flush: locking mutex\n");
137
+    if (pthread_mutex_lock(&(intel->mutex))) {
138
+        cli_warnmsg("clamav_stats_flush: locking mutex failed\n");
139
+        return;
140
+    }
141
+    cli_warnmsg("clamav_stats_flush: locked mutex\n");
142
+#endif
143
+
144
+    for (sample=intel->samples; sample != NULL; sample = next) {
145
+        next = sample->next;
146
+
147
+        free_sample(sample);
148
+        free(sample);
149
+    }
150
+
151
+    intel->samples = NULL;
152
+    intel->nsamples = 0;
153
+
154
+#ifdef CL_THREAD_SAFE
155
+    if (pthread_mutex_unlock(&(intel->mutex)))
156
+        cli_warnmsg("clamav_stats_flush: unlocking mutex failed\n");
157
+    cli_warnmsg("clamav_stats_flush: unlocked mutex\n");
158
+#endif
159
+}
160
+
161
+void free_sample(cli_flagged_sample_t *sample)
162
+{
163
+    size_t i;
164
+
165
+    if ((sample->virus_name)) {
166
+        for (i=0; sample->virus_name[i] != NULL; i++)
167
+            free(sample->virus_name[i]);
168
+
169
+        free(sample->virus_name);
170
+    }
171
+
172
+    free(sample);
173
+}
174
+
175
+void clamav_stats_submit(struct cl_engine *engine, void *cbdata)
176
+{
177
+    char *json;
178
+    cli_intel_t *intel;
179
+
180
+    intel = (cli_intel_t *)cbdata;
181
+
182
+#ifdef CL_THREAD_SAFE
183
+    cli_warnmsg("clamav_stats_submit: locking mutex\n");
184
+    if (pthread_mutex_lock(&(intel->mutex))) {
185
+        cli_warnmsg("clamav_stats_submit: locking mutex failed\n");
186
+
187
+        if ((intel->engine) && (intel->engine->cb_stats_flush))
188
+            intel->engine->cb_stats_flush(intel->engine, cbdata);
189
+
190
+        return;
191
+    }
192
+    cli_warnmsg("clamav_stats_submit: locked mutex\n");
193
+#endif
194
+
195
+    json = export_stats_to_json(engine, (cli_intel_t *)cbdata);
196
+
197
+#ifdef CL_THREAD_SAFE
198
+    if (pthread_mutex_unlock(&(intel->mutex))) {
199
+        cli_warnmsg("clamav_stats_submit: unlocking mutex failed\n");
200
+    }
201
+
202
+    cli_warnmsg("clamav_stats_submit: unlocked mutex\n");
203
+#endif
204
+
205
+    cli_warnmsg("--- JSON ---\n%s\n--- END JSON ---\n", json);
206
+
207
+    if (json)
208
+        free(json);
209
+
210
+    if ((engine->cb_stats_flush))
211
+        engine->cb_stats_flush(engine, cbdata);
212
+}
213
+
214
+static cli_flagged_sample_t *find_sample(cli_intel_t *intel, const char *virname, const unsigned char *md5, size_t size, cli_intel_sample_type_t type)
215
+{
216
+    cli_flagged_sample_t *sample;
217
+    size_t i;
218
+
219
+    for (sample = intel->samples; sample != NULL; sample = sample->next) {
220
+        if (sample->type != type)
221
+            continue;
222
+
223
+        if (sample->size != size)
224
+            continue;
225
+
226
+        if (memcmp(sample->md5, md5, sizeof(sample->md5)))
227
+            continue;
228
+
229
+        if (!(virname))
230
+            return sample;
231
+
232
+        for (i=0; sample->virus_name[i] != NULL; i++)
233
+            if (!strcmp(sample->virus_name[i], virname))
234
+                return sample;
235
+    }
236
+
237
+    return NULL;
238
+}
0 239
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+#if !defined(_LIBCLAMAV_STATS_H)
1
+#define _LIBCLAMAV_STATS_H
2
+
3
+void clamav_stats_add_sample(const char *virname, const unsigned char *md5, uint64_t size, cli_intel_sample_type_t type, void *cbdata);
4
+void clamav_stats_submit(struct cl_engine *engine, void *cbdata);
5
+void clamav_stats_flush(struct cl_engine *engine, void *cbdata);
6
+
7
+#endif
0 8
new file mode 100644
... ...
@@ -0,0 +1,128 @@
0
+#include <stdio.h>
1
+#include <stdlib.h>
2
+#include <unistd.h>
3
+#include <string.h>
4
+
5
+#include <ctype.h>
6
+
7
+#include <sys/types.h>
8
+#include <sys/socket.h>
9
+#include <netinet/in.h>
10
+#include <netdb.h>
11
+
12
+#include "libclamav/others.h"
13
+#include "libclamav/clamav.h"
14
+#include "libclamav/www.h"
15
+
16
+int connect_host(const char *host, const char *port)
17
+{
18
+    int sockfd;
19
+    struct addrinfo hints, *servinfo, *p;
20
+
21
+    memset(&hints, 0x00, sizeof(struct addrinfo));
22
+    hints.ai_family = AF_UNSPEC;
23
+    hints.ai_socktype = SOCK_STREAM;
24
+
25
+    if (getaddrinfo(host, port, &hints, &servinfo))
26
+        return -1;
27
+
28
+    for (p = servinfo; p != NULL; p = p->ai_next) {
29
+        sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
30
+        if (sockfd < 0)
31
+            continue;
32
+
33
+        if (connect(sockfd, p->ai_addr, p->ai_addrlen)) {
34
+            close(sockfd);
35
+            continue;
36
+        }
37
+
38
+        /* Connected to host */
39
+        break;
40
+    }
41
+
42
+    if (!(p)) {
43
+        freeaddrinfo(servinfo);
44
+        close(sockfd);
45
+        return -1;
46
+    }
47
+
48
+    freeaddrinfo(servinfo);
49
+
50
+    return sockfd;
51
+}
52
+
53
+size_t encoded_size(const char *postdata)
54
+{
55
+    const char *p;
56
+    size_t len=0;
57
+
58
+    for (p = postdata; *p != '\0'; p++)
59
+        len += isalnum(*p) ? 1 : 3;
60
+
61
+    return len;
62
+}
63
+
64
+char *encode_data(const char *postdata)
65
+{
66
+    char *buf;
67
+    size_t bufsz, i, j;
68
+
69
+    bufsz = encoded_size(postdata);
70
+    if (bufsz == 0)
71
+        return NULL;
72
+
73
+    buf = cli_calloc(1, bufsz+1);
74
+    if (!(buf))
75
+        return NULL;
76
+
77
+    for (i=0, j=0; postdata[i] != '\0'; i++) {
78
+        if (isalnum(postdata[i])) {
79
+            buf[j++] = postdata[i];
80
+        } else {
81
+            sprintf(buf+j, "%%%02x", postdata[i]);
82
+            j += 3;
83
+        }
84
+    }
85
+
86
+    return buf;
87
+}
88
+
89
+void submit_post(const char *host, const char *port, const char *url, const char *postdata)
90
+{
91
+    int sockfd;
92
+    unsigned int i;
93
+    char *buf, *encoded;
94
+    size_t bufsz;
95
+
96
+    encoded = encode_data(postdata);
97
+    if (!(encoded))
98
+        return;
99
+
100
+    bufsz = sizeof("POST   HTTP/1.1") + 1; /* Yes. Three blank spaces. +1 for the \n */
101
+    bufsz += strlen(url);
102
+    bufsz += sizeof("Host: ");
103
+    bufsz += strlen(host) + 1; /* +1 for the \n */
104
+    bufsz += 2; /* +2 for \n\n */
105
+    bufsz += sizeof("postdata=");
106
+    bufsz += strlen(encoded) + 1;
107
+
108
+    buf = cli_calloc(1, bufsz);
109
+    if (!(buf)) {
110
+        free(encoded);
111
+        return;
112
+    }
113
+
114
+    sprintf(buf, "POST %s HTTP/1.1\nHost: %s\n\npostdata=%s", url, host, encoded);
115
+    free(encoded);
116
+
117
+    sockfd = connect_host(host, port);
118
+    if (sockfd < 0) {
119
+        free(buf);
120
+        return;
121
+    }
122
+
123
+    send(sockfd, buf, strlen(buf), 0);
124
+
125
+    close(sockfd);
126
+    free(buf);
127
+}
0 128
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+#if !defined(_LIBCLAMAV_WWW_H)
1
+#define _LIBCLAMAV_WWW_H
2
+
3
+int connect_host(const char *host, const char *port);
4
+size_t encoded_size(const char *postdata);
5
+char *encode_data(const char *postdata);
6
+void submit_post(const char *host, const char *port, const char *url, const char *postdata);
7
+
8
+#endif
... ...
@@ -137,12 +137,6 @@ CLEANFILES		       += libltdl.la \
137 137
 CLEANFILES	       += $(ltdl_LIBOBJS) $(ltdl_LTLIBOBJS)
138 138
 
139 139
 EXTRA_DIST	       += COPYING.LIB \
140
-			   \
141
-			   \
142
-			   \
143
-			   \
144
-			   \
145
-			   \
146 140
 			  README
147 141
 
148 142
 ## --------------------------- ##
... ...
@@ -157,6 +151,7 @@ EXTRA_DIST	+= argz_.h \
157 157
 # doesn't have one that works with the given compiler.
158 158
 all-local $(lib_OBJECTS): $(ARGZ_H)
159 159
 argz.h: argz_.h
160
+	$(mkinstalldirs) . 
160 161
 	cp $(srcdir)/argz_.h $@-t
161 162
 	mv $@-t $@
162 163
 MOSTLYCLEANFILES += argz.h \
... ...
@@ -981,6 +981,7 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
981 981
 # doesn't have one that works with the given compiler.
982 982
 all-local $(lib_OBJECTS): $(ARGZ_H)
983 983
 argz.h: argz_.h
984
+	$(mkinstalldirs) . 
984 985
 	cp $(srcdir)/argz_.h $@-t
985 986
 	mv $@-t $@
986 987
 
... ...
@@ -2684,18 +2684,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
2684 2684
   dynamic_linker='GNU/Linux ld.so'
2685 2685
   ;;
2686 2686
 
2687
-netbsdelf*-gnu)
2688
-  version_type=linux
2689
-  need_lib_prefix=no
2690
-  need_version=no
2691
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
2692
-  soname_spec='${libname}${release}${shared_ext}$major'
2693
-  shlibpath_var=LD_LIBRARY_PATH
2694
-  shlibpath_overrides_runpath=no
2695
-  hardcode_into_libs=yes
2696
-  dynamic_linker='NetBSD ld.elf_so'
2697
-  ;;
2698
-
2699 2687
 netbsd*)
2700 2688
   version_type=sunos
2701 2689
   need_lib_prefix=no
... ...
@@ -3301,7 +3289,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
3301 3301
   lt_cv_deplibs_check_method=pass_all
3302 3302
   ;;
3303 3303
 
3304
-netbsd* | netbsdelf*-gnu)
3304
+netbsd*)
3305 3305
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
3306 3306
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
3307 3307
   else
... ...
@@ -4113,7 +4101,7 @@ m4_if([$1], [CXX], [
4113 4113
 	    ;;
4114 4114
 	esac
4115 4115
 	;;
4116
-      netbsd* | netbsdelf*-gnu)
4116
+      netbsd*)
4117 4117
 	;;
4118 4118
       *qnx* | *nto*)
4119 4119
         # QNX uses GNU C++, but need to define -shared option too, otherwise
... ...
@@ -4590,9 +4578,6 @@ m4_if([$1], [CXX], [
4590 4590
       ;;
4591 4591
     esac
4592 4592
     ;;
4593
-  linux* | k*bsd*-gnu | gnu*)
4594
-    _LT_TAGVAR(link_all_deplibs, $1)=no
4595
-    ;;
4596 4593
   *)
4597 4594
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
4598 4595
     ;;
... ...
@@ -4655,9 +4640,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
4655 4655
   openbsd*)
4656 4656
     with_gnu_ld=no
4657 4657
     ;;
4658
-  linux* | k*bsd*-gnu | gnu*)
4659
-    _LT_TAGVAR(link_all_deplibs, $1)=no
4660
-    ;;
4661 4658
   esac
4662 4659
 
4663 4660
   _LT_TAGVAR(ld_shlibs, $1)=yes
... ...
@@ -4879,7 +4861,7 @@ _LT_EOF
4879 4879
       fi
4880 4880
       ;;
4881 4881
 
4882
-    netbsd* | netbsdelf*-gnu)
4882
+    netbsd*)
4883 4883
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
4884 4884
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
4885 4885
 	wlarc=
... ...
@@ -5056,7 +5038,6 @@ _LT_EOF
5056 5056
 	if test "$aix_use_runtimelinking" = yes; then
5057 5057
 	  shared_flag="$shared_flag "'${wl}-G'
5058 5058
 	fi
5059
-	_LT_TAGVAR(link_all_deplibs, $1)=no
5060 5059
       else
5061 5060
 	# not using gcc
5062 5061
 	if test "$host_cpu" = ia64; then
... ...
@@ -5361,7 +5342,7 @@ _LT_EOF
5361 5361
       _LT_TAGVAR(link_all_deplibs, $1)=yes
5362 5362
       ;;
5363 5363
 
5364
-    netbsd* | netbsdelf*-gnu)
5364
+    netbsd*)
5365 5365
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
5366 5366
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
5367 5367
       else
... ...
@@ -493,7 +493,7 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
493 493
     # at 6.2 and later dlopen does load deplibs.
494 494
     lt_cv_sys_dlopen_deplibs=yes
495 495
     ;;
496
-  netbsd* | netbsdelf*-gnu)
496
+  netbsd*)
497 497
     lt_cv_sys_dlopen_deplibs=yes
498 498
     ;;
499 499
   openbsd*)