This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Guessing HP architecture?



The enclosed patch to config.guess generalizes the Hitachi-Unix
sysconf(_SC_CPU_VERSION) call to identify the architecture revision
for HP-UX.
uname -m on on K380 is identifying the machine as 9000/800 which both
config.guess and HP's /opt/langtool/lib/sched.models (hpux10.20) sees as
an HPPA1.0 box.
/usr/bin/model (New on hpux10.20) gives 9000/800/K380
Using sysconf(_SC_CPU_VERSION) correctly identifies it as HPPA2.0.

config.guess as patched works as expected on our other hpux10.20 and our
hpux9.04 box.

The existence of entries for Motorola 680x0 in /usr/include/sys/unistd.h
bodes well for this working on HP-UX versions prior to 9.

--- config.guess.orig   Thu Oct 22 17:26:55 1998
+++ config.guess    Sun Nov  8 09:57:18 1998
@@ -363,50 +363,62 @@
     *9??*:MPE/iX:*:*)
    echo hppa1.0-hp-mpeix
    exit 0 ;;
-    9000/[3478]??:HP-UX:*:*)
+    9000/[3478]??:HP-UX:*:* | 3050*:HI-UX:*:* )
+   HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*/-hp-hpux/'`
    case "${UNAME_MACHINE}" in
-       9000/31? )            HP_ARCH=m68000 ;;
-       9000/[34]?? )         HP_ARCH=m68k ;;
-       9000/6?? )        HP_ARCH=hppa1.0 ;;
-       9000/78? )        HP_ARCH=hppa1.1 ;; # FIXME: really hppa2.0
-       9000/7?? )        HP_ARCH=hppa1.1 ;;
-       9000/8[67]1 | 9000/80[24] | 9000/8[78]9 | 9000/893 )
-                 HP_ARCH=hppa1.1 ;; # FIXME: really hppa2.0
-       9000/8?[13679] )      HP_ARCH=hppa1.1 ;;
-       9000/8?? )            HP_ARCH=hppa1.0 ;;
+       9000/31? )  echo m68000${HPUX_REV} ; exit 0 ;;
+       9000/??? )  ;;
+       3050* ) HPUX_REV='-hitachi-hiuxwe2' ;;
    esac
-   HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-   echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-   exit 0 ;;
-    3050*:HI-UX:*:*)
    sed 's/^    //' << EOF >dummy.c
-   #include <unistd.h>
-   int
-   main ()
-   {
+#include <unistd.h>
+#include <stdio.h>
+int
+main (argc, argv)
+int argc;
+char *argv[];
+{
      long cpu = sysconf (_SC_CPU_VERSION);
-     /* The order matters, because CPU_IS_HP_MC68K erroneously returns
-        true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
-        results, however.  */
-     if (CPU_IS_PA_RISC (cpu))
-       {
-         switch (cpu)
-       {
-         case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
-         case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
-         case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
-         default: puts ("hppa-hitachi-hiuxwe2"); break;
+    int is_hitachi = 0;
+
+    if (argc != 2 || strlen(argv[1]) < 3)
+   exit(1);
+    is_hitachi = (argv[1][2] == 'i');
+    switch (cpu) {
+#ifdef CPU_PA_RISC2_0
+    case CPU_PA_RISC2_0:
+   if (is_hitachi) { fputs ("hppa2.0", stdout); break; }
+#endif
+#ifdef CPU_PA_RISC1_2
+    case CPU_PA_RISC1_2:
+#endif
+#ifdef CPU_PA_RISC1_1
+    case CPU_PA_RISC1_1: fputs ("hppa1.1", stdout); break;
+#endif
+#ifdef CPU_PA_RISC1_0
+    case CPU_PA_RISC1_0: fputs ("hppa1.0", stdout); break;
+#endif
+    default:
+   /*
+    * Should further separation of the 68k line be needed
+    * HP provides defines for CPU_HP_MC680[234]0
+    */
+   fputs (
+       (CPU_IS_PA_RISC(cpu) ? "hppa-1.0"   /* Make PA-1.0 default */
+       : (CPU_IS_HP_MC68K(cpu) ?  "m68k"
+       : "unknown")),
+       stdout);
        }
-       }
-     else if (CPU_IS_HP_MC68K (cpu))
-       puts ("m68k-hitachi-hiuxwe2");
-     else puts ("unknown-hitachi-hiuxwe2");
+    puts(argv[1]);
      exit (0);
-   }
+}
 EOF
-   ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+   ${CC-cc} dummy.c -o dummy && ./dummy $HPUX_REV && rm dummy.c dummy && exit 0
    rm -f dummy.c dummy
-   echo unknown-hitachi-hiuxwe2
+   case "${UNAME_MACHINE}" in  # Fallback position
+       9000/[34]?? )   echo m68k${HPUX_REV} ; exit 0 ;;
+       9000/??? | 3050* )  echo hppa1.0${HPUX_REV} ; exit 0 ;;
+   esac
    exit 0 ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
    echo hppa1.1-hp-bsd


And again as a mime attachment
 


--- config.guess.orig	Thu Oct 22 17:26:55 1998
+++ config.guess	Sun Nov  8 09:57:18 1998
@@ -363,50 +363,62 @@
     *9??*:MPE/iX:*:*)
 	echo hppa1.0-hp-mpeix
 	exit 0 ;;
-    9000/[3478]??:HP-UX:*:*)
+    9000/[3478]??:HP-UX:*:* | 3050*:HI-UX:*:* )
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*/-hp-hpux/'`
 	case "${UNAME_MACHINE}" in
-	    9000/31? )            HP_ARCH=m68000 ;;
-	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/6?? )		  HP_ARCH=hppa1.0 ;;
-	    9000/78? )		  HP_ARCH=hppa1.1 ;; # FIXME: really hppa2.0
-	    9000/7?? )		  HP_ARCH=hppa1.1 ;;
-	    9000/8[67]1 | 9000/80[24] | 9000/8[78]9 | 9000/893 )
-				  HP_ARCH=hppa1.1 ;; # FIXME: really hppa2.0
-	    9000/8?[13679] )	  HP_ARCH=hppa1.1 ;;
-	    9000/8?? )            HP_ARCH=hppa1.0 ;;
+	    9000/31? )	echo m68000${HPUX_REV} ; exit 0 ;;
+	    9000/??? )  ;;
+	    3050* )	HPUX_REV='-hitachi-hiuxwe2' ;;
 	esac
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-	exit 0 ;;
-    3050*:HI-UX:*:*)
 	sed 's/^	//' << EOF >dummy.c
-	#include <unistd.h>
-	int
-	main ()
-	{
+#include <unistd.h>
+#include <stdio.h>
+int
+main (argc, argv)
+int argc;
+char *argv[];
+{
 	  long cpu = sysconf (_SC_CPU_VERSION);
-	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
-	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
-	     results, however.  */
-	  if (CPU_IS_PA_RISC (cpu))
-	    {
-	      switch (cpu)
-		{
-		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
-		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+    int is_hitachi = 0;
+
+    if (argc != 2 || strlen(argv[1]) < 3)
+	exit(1);
+    is_hitachi = (argv[1][2] == 'i');
+    switch (cpu) {
+#ifdef CPU_PA_RISC2_0
+    case CPU_PA_RISC2_0:
+	if (is_hitachi) { fputs ("hppa2.0", stdout); break; }
+#endif
+#ifdef CPU_PA_RISC1_2
+    case CPU_PA_RISC1_2:
+#endif
+#ifdef CPU_PA_RISC1_1
+    case CPU_PA_RISC1_1: fputs ("hppa1.1", stdout); break;
+#endif
+#ifdef CPU_PA_RISC1_0
+    case CPU_PA_RISC1_0: fputs ("hppa1.0", stdout); break;
+#endif
+    default:
+	/*
+	 * Should further separation of the 68k line be needed
+	 * HP provides defines for CPU_HP_MC680[234]0
+	 */
+	fputs (
+	    (CPU_IS_PA_RISC(cpu) ? "hppa-1.0"	/* Make PA-1.0 default */
+	    : (CPU_IS_HP_MC68K(cpu) ?  "m68k"
+	    : "unknown")),
+	    stdout);
 		}
-	    }
-	  else if (CPU_IS_HP_MC68K (cpu))
-	    puts ("m68k-hitachi-hiuxwe2");
-	  else puts ("unknown-hitachi-hiuxwe2");
+    puts(argv[1]);
 	  exit (0);
-	}
+}
 EOF
-	${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+	${CC-cc} dummy.c -o dummy && ./dummy $HPUX_REV && rm dummy.c dummy && exit 0
 	rm -f dummy.c dummy
-	echo unknown-hitachi-hiuxwe2
+	case "${UNAME_MACHINE}" in	# Fallback position
+	    9000/[34]?? )	echo m68k${HPUX_REV} ; exit 0 ;;
+	    9000/??? | 3050* )  echo hppa1.0${HPUX_REV} ; exit 0 ;;
+	esac
 	exit 0 ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
 	echo hppa1.1-hp-bsd


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]