Fix (?) discrimination between hppa1.1 and 1.0.
[binutils-gdb.git] / guess-systype
1 #!/bin/sh
2
3 # This script attempts to guess a canonical system name
4 # similar to the output of config.sub.
5 # If it succeeds, it prints the system name on stdout, and exits with 0.
6 # Otherwise, it prints an error message on stderr, and exits with 1.
7
8 # The plan is that this can be called by configure scripts if you don't
9 # specify an explicit system type (host/target name).
10 #
11 # Only a few systems have been added to this list;
12 # please add others (but try to keep the structure clean).
13
14 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
15 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
16 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
17 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
18
19 # Note: order is significant - the case branches are not exclusive.
20
21 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
22 sun4*:SunOS:[5-9].*:*)
23 echo sparc-sun-solaris2
24 exit 0 ;;
25 sun4*:SunOS:*:*)
26 echo sparc-sun-sunos${UNAME_RELEASE}
27 exit 0 ;;
28 sun3*:SunOS:*:*)
29 echo m68k-sun-sunos${UNAME_RELEASE}
30 exit 0 ;;
31 RISC*:ULTRIX:*:*)
32 echo mips-dec-ultrix${UNAME_RELEASE}
33 exit 0 ;;
34 *:IRIX:*:*)
35 echo mips-sgi-irix${UNAME_RELEASE}
36 exit 0 ;;
37 *:AIX:*:*)
38 echo rs6000-ibm-aix
39 exit 0 ;;
40 9000/31?:HP-UX:*:*)
41 echo m68000-hp-hpux
42 exit 0 ;;
43 9000/3??:HP-UX:*:*)
44 echo m68k-hp-hpux
45 exit 0 ;;
46 9000/7??:HP-UX:*:* | 9000/8?7:HP-UX:*:* )
47 echo hppa1.1-hp-hpux
48 exit 0 ;;
49 9000/8??:HP-UX:*:*)
50 echo hppa1.0-hp-hpux
51 exit 0 ;;
52 i[34]86:*:3.2:[2-9]*)
53 echo ${UNAME_MACHINE}-unknown-sco3.2v${UNAME_VERSION}
54 exit 0 ;;
55 esac
56
57 echo '(No uname command or uname output not recognized.)' 1>&2
58 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
59
60 cat >dummy.c <<EOF
61 main()
62 {
63 #if defined (sony)
64 #if defined (MIPSEB)
65 #else
66 printf("m68k-sony-newsos\n"); exit(0);
67 #endif
68 #endif
69 exit (1);
70 }
71 EOF
72
73 ${CC-cc} dummy.c -o dummy && dummy && rm dummy.c dummy && exit 0
74 rm -f dummy.c dummy
75
76 echo '(Unable to guess system type)' 1>&2
77
78 exit 1