Louis . Granboulan on Tue, 28 Apr 1998 21:00:15 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

HP UX


This is for HP-UX.
I have only two machines to test gp on HP-UX,
so this patch may break something for other machines.
These machines are :
   - an old HP9000/710 under HPUX A.09.05
   - a more recent HP9000/720 with HP-UX B.10.20

1) Nigel made a new version of the level0 asm file.
   It works only with the second machine. With HPUX A.09.05,
   the linker complains with :
     /bin/ld: Data address is out of range for short load or store
   This level0.s has to be compiled with HP as,
   because GNU as makes an "Internal error" and dies.
2) I changed Configure, so it detects much more precisely
   which cc and as are best to use. There is a problem
   with Position-Independent Code :
   When not compiled for PIC, the error message for making libpari.sl is :
      /bin/ld: DP-Relative Code in file kernel.o
             - Shared Library must be Position-Independent
   We can make PIC with the option +z for HP cc and with -fPIC for gcc,
   but the resulting code is much slower. Here are the benches
                       gp-sta gp-dyn
        cc -O -Aa      114142
        cc -O -Aa +z   126474 168306
        gcc -O2        104612
        gcc -O2 -fPIC  123054 136664
   We should avoid gcc, because it has bugs. For example, with gcc 2.8.0,
   the initialisation of static variables in the dynamic library does not
   work well.
   The following (small) patch handles one of these bugs :
	*** ./src/language/anal.c.ORIG	Sat Feb  7 17:12:11 1998
	--- ./src/language/anal.c	Tue Feb 17 19:17:12 1998
	***************
	*** 1023,1028 ****
	--- 1023,1033 ----
	      GEN *fakepGEN = NULL, fakeGEN, argvec[9];
	      void *call = ep->value;
	  
	+ #if defined(__hpux__) && defined(__GNUC__)
	+     /* This is needed for gp-dyn */
	+     if (limit==buffer) limit = buffer+TOTAL_STRING_ARG-2;
	+ #endif
	+ 
	      current_function=ep->name;
	      if (*analyseur != '(')
	      {
3) This patch includes an other change :
   ./Configure -verbhelp will give a longer help message, to help if
   you want to customize your installation of pari.
   This change is not complete.


Apply this patch :

*** pari-2.0.7.alpha/src/kernel/hppa/level0.s.orig	Sat Mar 21 04:31:50 1998
--- pari-2.0.7.alpha/src/kernel/hppa/level0.s	Tue Apr 28 18:38:06 1998
***************
*** 1,180 ****
! ; $Id: level0.s,v 2.0.0.7 1998/03/21 03:30:31 karim Exp karim $
! 	.SHORTDATA
! 	.EXPORT	hiremainder
! 	.EXPORT	overflow
! 	.WORD
! 	.ALIGN	8
! hiremainder	.WORD
! 	.ALIGN	8
! overflow	.WORD
! 
!         .CODE
! 	.EXPORT	addll,ENTRY
! 	.EXPORT	addllx,ENTRY
! 	.EXPORT	subll,ENTRY
! 	.EXPORT	subllx,ENTRY
! 	.EXPORT	shiftl,ENTRY
! 	.EXPORT	shiftlr,ENTRY
! 	.EXPORT	bfffo,ENTRY
! 	.EXPORT	mulll,ENTRY
!  	.EXPORT	addmul,ENTRY
! 	.EXPORT	divll,ENTRY
! 
! 	.PROC
! 	.CALLINFO
! addll	.ENTER
! 	ADD	%arg0,%arg1,%ret0
! 	ADDC	0,0,%t1
! 	STW	%t1,overflow-$global$(%dp)
! 	.LEAVE
! 	.PROCEND
! 
! 	.PROC
! 	.CALLINFO
! addllx	.ENTER
! 	LDW	overflow-$global$(%dp),%t1
! 	ADDB,UV	%t1,%arg0,addllx2	
! 	ADD	%arg0,%arg1,%ret0
! 	ADDC	0,0,%t1
! 	STW	%t1,overflow-$global$(%dp)
! 	.LEAVE
! addllx2	LDI	1,%t1
! 	STW	%t1,overflow-$global$(%dp)
! 	.LEAVE	
! 	.PROCEND
! 
! 	.PROC
! 	.CALLINFO
! subll	.ENTER
! 	SUB	%arg0,%arg1,%ret0
! 	ADDC	0,0,%t1
! 	SUBI	1,%t1,%t1
! 	STW	%t1,overflow-$global$(%dp)
! 	.LEAVE
! 	.PROCEND
! 
! 	.PROC
! 	.CALLINFO
! subllx	.ENTER
! 	LDW	overflow-$global$(%dp),%t1
! 	SUB,>>=	%arg0,%arg1,%ret0
! 	SUB,TR	%ret0,%t1,%ret0
! 	SUB,>>=	%ret0,%t1,%ret0
! 	ADDI,TR	1,0,%t1
! 	LDI	0,%t1
! 	STW	%t1,overflow-$global$(%dp)
! 	.LEAVE
! 	.PROCEND
! 
! 	.PROC
! 	.CALLINFO
! shiftl	.ENTER
! 	SUBI	32,%arg1,%arg1
! L$30	MFCTL	11,%t1
! 	MTCTL	%arg1,11
! 	VSHD	%arg0,0,%ret0;
! 	VSHD	0,%arg0,%t2
! 	MTCTL	%t1,11
! L$31	STW	%t2,hiremainder-$global$(%dp)
! 	.LEAVE
! 	.PROCEND
! 
! 	.PROC
! 	.CALLINFO
! shiftlr	.ENTER
! L$40	MFCTL	11,%t1
! 	MTCTL	%arg1,11
! 	VSHD	0,%arg0,%ret0;
! 	VSHD	%arg0,0,%t2
! 	MTCTL	%t1,11
! L$41	STW	%t2,hiremainder-$global$(%dp)
! 	.LEAVE
! 	.PROCEND
! 
! 	.PROC
! 	.CALLINFO
! bfffo	.ENTER
! 	COMB,=,N	%r0,%arg0,L$0
! 	LDI	31,%ret0
! 	EXTRU,<>	%arg0,15,16,%r0
! 	SHD,TR	%arg0,%r0,16,%arg0
! 	ADDI	-16,%ret0,%ret0
! 	EXTRU,<>	%arg0,7,8,%r0
! 	SHD,TR	%arg0,%r0,24,%arg0
! 	ADDI	-8,%ret0,%ret0
! 	EXTRU,<>	%arg0,3,4,%r0
! 	SHD,TR	%arg0,%r0,28,%arg0
! 	ADDI	-4,%ret0,%ret0
! 	EXTRU,<>	%arg0,1,2,%r0
! 	SHD,TR	%arg0,%r0,30,%arg0
! 	ADDI	-2,%ret0,%ret0
! 	EXTRU,=	%arg0,0,1,%r0
! 	ADDI	-1,%ret0,%ret0
! 	B,N	L$1
! L$0	LDI	32,%ret0
! L$1	.LEAVE
! 	.PROCEND
  	
! 	.PROC
! 	.CALLINFO
! mulll	.ENTER
! 	LDO	hiremainder-$global$(%dp),%r1
! 	STW	%arg0,0(%r1)
! 	FLDWS	0(%r1),%fr4
! 	STW	%arg1,0(%r1)
! 	FLDWS	0(%r1),%fr5
! 	XMPYU	4,5,6
! 	FSTDS	6,0(%r1)
! 	LDWS	4(%r1),%ret0
! 	.LEAVE
! 	.PROCEND
! 
! 	.PROC
! 	.CALLINFO
! addmul	.ENTER
! 	LDO	hiremainder-$global$(%dp),%r1
! 	LDW	0(%r1),%t1
! 	STW	%arg0,0(%r1)
! 	FLDWS	0(%r1),%fr4
! 	STW	%arg1,0(%r1)
! 	FLDWS	0(%r1),%fr5
! 	XMPYU	4,5,6
! 	FSTDS	6,0(%r1)
! 	LDWS	4(%r1),%ret0
! 	ADD,NUV	%t1,%ret0,%ret0
! 	B,N	suite
! 	.LEAVE
! suite	LDW	0(%r1),%ret1
! 	ADDI	1,%ret1,%ret1
! 	STW	%ret1,0(%r1)
! 	.LEAVE
! 	.PROCEND
! 
! hirem	.REG	%t1
! loquo	.REG	%ret0
! div	.REG	%arg1
! 
! nibble	.MACRO
! 	DS	hirem,div,hirem
! 	ADDC	loquo,loquo,loquo
! 	DS	hirem,div,hirem
! 	ADDC	loquo,loquo,loquo
! 	DS	hirem,div,hirem
! 	ADDC	loquo,loquo,loquo
! 	DS	hirem,div,hirem
! 	ADDC	loquo,loquo,loquo
! 	.ENDM
  			
! divll	.PROC
! 	.CALLINFO
! 	.ENTER
! 	LDW	hiremainder-$global$(%dp),hirem
  
! 	COMB,<	div,0,L$50
! 	COPY	%arg0,loquo
! 	SUB	0,div,%t2
! 	DS	0,%t2,0
! 	ADDC	loquo,loquo,loquo
  	nibble
  	nibble
  	nibble
--- 1,183 ----
! ; $id: level0.s,v 2.0.0.6 1998/02/21 17:30:11 karim exp karim $
! ; This file has been written by Nigel.
! ; Hp's as is needed, with +DA1.1
! 	.shortdata
!         .import $global$        ; The value in the %dp register
! 	.export	hiremainder
! 	.export	overflow
! 	.word
! 	.align	8
! hiremainder	.word
! 	.align	8
! overflow	.word
! 
!         .code
! 	.export	addll,entry
! 	.export	addllx,entry
! 	.export	subll,entry
! 	.export	subllx,entry
! 	.export	shiftl,entry
! 	.export	shiftlr,entry
! 	.export	bfffo,entry
! 	.export	mulll,entry
!  	.export	addmul,entry
! 	.export	divll,entry
! 
! 	.proc
! 	.callinfo
! addll	.enter
! 	add	%arg0,%arg1,%ret0
! 	addc	0,0,%t1
! 	stw	%t1,overflow-$global$(%dp)
! 	.leave
! 	.procend
! 
! 	.proc
! 	.callinfo
! addllx	.enter
! 	ldw	overflow-$global$(%dp),%t1
! 	addb,uv	%t1,%arg0,addllx2	
! 	add	%arg0,%arg1,%ret0
! 	addc	0,0,%t1
! 	stw	%t1,overflow-$global$(%dp)
! 	.leave
! addllx2	ldi	1,%t1
! 	stw	%t1,overflow-$global$(%dp)
! 	.leave	
! 	.procend
! 
! 	.proc
! 	.callinfo
! subll	.enter
! 	sub	%arg0,%arg1,%ret0
! 	addc	0,0,%t1
! 	subi	1,%t1,%t1
! 	stw	%t1,overflow-$global$(%dp)
! 	.leave
! 	.procend
! 
! 	.proc
! 	.callinfo
! subllx	.enter
! 	ldw	overflow-$global$(%dp),%t1
! 	sub,>>=	%arg0,%arg1,%ret0
! 	sub,tr	%ret0,%t1,%ret0
! 	sub,>>=	%ret0,%t1,%ret0
! 	addi,tr	1,0,%t1
! 	ldi	0,%t1
! 	stw	%t1,overflow-$global$(%dp)
! 	.leave
! 	.procend
! 
! 	.proc
! 	.callinfo
! shiftl	.enter
! 	subi	32,%arg1,%arg1
! l$30	mfctl	%cr11,%t1
! 	mtctl	%arg1,%cr11
! 	vshd	%arg0,0,%ret0;
! 	vshd	0,%arg0,%t2
! 	mtctl	%t1,%cr11
! l$31	stw	%t2,hiremainder-$global$(%dp)
! 	.leave
! 	.procend
! 
! 	.proc
! 	.callinfo
! shiftlr	.enter
! l$40	mfctl	%cr11,%t1
! 	mtctl	%arg1,%cr11
! 	vshd	0,%arg0,%ret0;
! 	vshd	%arg0,0,%t2
! 	mtctl	%t1,%cr11
! l$41	stw	%t2,hiremainder-$global$(%dp)
! 	.leave
! 	.procend
! 
! 	.proc
! 	.callinfo
! bfffo	.enter
! 	comb,=,n	%r0,%arg0,l$0
! 	ldi	31,%ret0
! 	extru,<>	%arg0,15,16,%r0
! 	shd,tr	%arg0,%r0,16,%arg0
! 	addi	-16,%ret0,%ret0
! 	extru,<>	%arg0,7,8,%r0
! 	shd,tr	%arg0,%r0,24,%arg0
! 	addi	-8,%ret0,%ret0
! 	extru,<>	%arg0,3,4,%r0
! 	shd,tr	%arg0,%r0,28,%arg0
! 	addi	-4,%ret0,%ret0
! 	extru,<>	%arg0,1,2,%r0
! 	shd,tr	%arg0,%r0,30,%arg0
! 	addi	-2,%ret0,%ret0
! 	extru,=	%arg0,0,1,%r0
! 	addi	-1,%ret0,%ret0
! 	b,n	l$1
! l$0	ldi	32,%ret0
! l$1	.leave
! 	.procend
  	
! 	.proc
! 	.callinfo
! mulll	.enter
! 	ldo	hiremainder-$global$(%dp),%r1
! 	stw	%arg0,0(%r1)
! 	fldws	0(%r1),%fr4
! 	stw	%arg1,0(%r1)
! 	fldws	0(%r1),%fr5
! 	xmpyu	%fr4,%fr5,%fr6
! 	fstds	%fr6,0(%r1)
! 	ldws	4(%r1),%ret0
! 	.leave
! 	.procend
! 
! 	.proc
! 	.callinfo
! addmul	.enter
! 	ldo	hiremainder-$global$(%dp),%r1
! 	ldw	0(%r1),%t1
! 	stw	%arg0,0(%r1)
! 	fldws	0(%r1),%fr4
! 	stw	%arg1,0(%r1)
! 	fldws	0(%r1),%fr5
! 	xmpyu	%fr4,%fr5,%fr6
! 	fstds	%fr6,0(%r1)
! 	ldws	4(%r1),%ret0
! 	add,nuv	%t1,%ret0,%ret0
! 	b,n	suite
! 	.leave
! suite	ldw	0(%r1),%ret1
! 	addi	1,%ret1,%ret1
! 	stw	%ret1,0(%r1)
! 	.leave
! 	.procend
! 
! hirem	.reg	%t1
! loquo	.reg	%ret0
! div	.reg	%arg1
! 
! nibble	.macro
! 	ds	hirem,div,hirem
! 	addc	loquo,loquo,loquo
! 	ds	hirem,div,hirem
! 	addc	loquo,loquo,loquo
! 	ds	hirem,div,hirem
! 	addc	loquo,loquo,loquo
! 	ds	hirem,div,hirem
! 	addc	loquo,loquo,loquo
! 	.endm
  			
! divll	.proc
! 	.callinfo
! 	.enter
! 	ldw	hiremainder-$global$(%dp),hirem
  
! 	comb,<	div,0,l$50
! 	copy	%arg0,loquo
! 	sub	0,div,%t2
! 	ds	0,%t2,0
! 	addc	loquo,loquo,loquo
  	nibble
  	nibble
  	nibble
***************
*** 183,209 ****
  	nibble
  	nibble
  	nibble
! 	ADD,>=	0,hirem,0
! 	ADD	hirem,div,hirem
! 	STW	hirem,hiremainder-$global$(%dp)
! 	.LEAVE
  	
! L$50	COPY	div,%arg0
! 	EXTRU,<>	div,31,1,%t3
! 	B	L$51
! 	EXTRU	div,30,31,div
! 	ADDB,NSV	%t3,div,L$51
! 	COPY	hirem,%t4
! 	COPY	loquo,hirem
! 	B	L$52
! 	COPY	%t4,loquo
  	
! L$51	EXTRU	loquo,31,1,%t4
! 	SHD	hirem,loquo,1,loquo
! 	EXTRU	hirem,30,31,hirem
! 	SUB	0,div,%t2
! 	DS	0,%t2,0
! 	ADDC	loquo,loquo,loquo
  	nibble
  	nibble
  	nibble
--- 186,212 ----
  	nibble
  	nibble
  	nibble
! 	add,>=	0,hirem,0
! 	add	hirem,div,hirem
! 	stw	hirem,hiremainder-$global$(%dp)
! 	.leave
  	
! l$50	copy	div,%arg0
! 	extru,<>	div,31,1,%t3
! 	b	l$51
! 	extru	div,30,31,div
! 	addb,nsv	%t3,div,l$51
! 	copy	hirem,%t4
! 	copy	loquo,hirem
! 	b	l$52
! 	copy	%t4,loquo
  	
! l$51	extru	loquo,31,1,%t4
! 	shd	hirem,loquo,1,loquo
! 	extru	hirem,30,31,hirem
! 	sub	0,div,%t2
! 	ds	0,%t2,0
! 	addc	loquo,loquo,loquo
  	nibble
  	nibble
  	nibble
***************
*** 212,231 ****
  	nibble
  	nibble
  	nibble
! 	ADD,>=	0,hirem,0
! 	ADD	hirem,div,hirem
! 	COMB,=	0,%t3,L$53
! 	SH1ADD	hirem,%t4,hirem
! L$52	COPY	%arg0,div
! 	ADDB,NUV,N	loquo,hirem,L$54
! 	SUB	hirem,div,hirem
! 	ADDI	1,loquo,loquo
! L$54	COMB,<<,N	hirem,div,L$53
! 	SUB	hirem,div,hirem
! 	ADDI	1,loquo,loquo
  	
! L$53	STW	hirem,hiremainder-$global$(%dp)
! 	.LEAVE	
! 	.PROCEND
  
! 	.END
--- 215,234 ----
  	nibble
  	nibble
  	nibble
! 	add,>=	0,hirem,0
! 	add	hirem,div,hirem
! 	comb,=	0,%t3,l$53
! 	sh1add	hirem,%t4,hirem
! l$52	copy	%arg0,div
! 	addb,nuv,n	loquo,hirem,l$54
! 	sub	hirem,div,hirem
! 	addi	1,loquo,loquo
! l$54	comb,<<,n	hirem,div,l$53
! 	sub	hirem,div,hirem
! 	addi	1,loquo,loquo
  	
! l$53	stw	hirem,hiremainder-$global$(%dp)
! 	.leave	
! 	.procend
  
! 	.end
*** pari-2.0.7.alpha/config/Makefile.SH.orig	Thu Mar 19 20:41:29 1998
--- pari-2.0.7.alpha/config/Makefile.SH	Mon Apr  6 20:33:18 1998
***************
*** 49,55 ****
  done
  OINLINE=''
  for f in $inline; do
!   if test "$__gnuc__" = yes -a "$optimization" != debugging; then
      OINLINE="$OINLINE $f.o"
    else
      OBJS="$OBJS $f.o"
--- 49,55 ----
  done
  OINLINE=''
  for f in $inline; do
!   if test -n "$__gnuc__" -a "$optimization" != debugging; then
      OINLINE="$OINLINE $f.o"
    else
      OBJS="$OBJS $f.o"
*** pari-2.0.7.alpha/Configure.orig	Wed Mar 18 19:32:43 1998
--- pari-2.0.7.alpha/Configure	Tue Apr 28 20:10:11 1998
***************
*** 58,64 ****
    -a|-ask)     fastread=no;;
    -g)          optimization=debugging;;
    -pg)         optimization=profiling;;
!   -h|-help|-?) error=true;;
    *) echo "*** Unrecognized option $1." >&2; error=true;;
    esac
    shift
--- 58,65 ----
    -a|-ask)     fastread=no;;
    -g)          optimization=debugging;;
    -pg)         optimization=profiling;;
!   -h|-help|-\?)error=true;;
!   -v|-verbhelp)error=verb;;
    *) echo "*** Unrecognized option $1." >&2; error=true;;
    esac
    shift
***************
*** 68,81 ****
  true) cat >&2 <<EOT
  Usage: Configure [-ask|-help|-g|-pg] [ -load <filename> ] [ -prefix <dir> ]
  Options: names can be abbreviated to one character (e.g -h = -help)
!  -ask    interactively ask for answers (defaults are still computed)
!  -help   this message
!  -load   specify a default config file ($dflt_conf_file if none is given)
!  -prefix install files in <dir> (default $prefix)
  
  Additional developer options:
!  -g      creates debugging version
!  -pg     creates profiling version
  EOT
  exit 1
  ;;
--- 69,99 ----
  true) cat >&2 <<EOT
  Usage: Configure [-ask|-help|-g|-pg] [ -load <filename> ] [ -prefix <dir> ]
  Options: names can be abbreviated to one character (e.g -h = -help)
!  -ask      interactively ask for answers (defaults are still computed)
!  -help     this message
!  -verbhelp a longer help message
!  -load     specify a default config file ($dflt_conf_file if none is given)
!  -prefix   install files in <dir> (default $prefix)
  
  Additional developer options:
!  -g        creates debugging version
!  -pg       creates profiling version
! EOT
! exit 1
! ;;
! verb) cat >&2 <<EOT
! Architecture, operating system and asm kernel.
!   Configure tries to detect what is the architecture of the
!   machine (the type of CPU) and what operating system it is
!   running. Then, it decide if a specific asm kernel exists
!   and should be used.
!   You can override this with Configure -ask.
! Which compiler will be used ?
!   Depending on the machine (architecture and operating system)
!   and on what is found in the path, a compiler is automatically
!   chosen.
!   If you set the environment variable CC before typing Configure,
!   this will be used instead.
  EOT
  exit 1
  ;;
***************
*** 127,132 ****
--- 145,151 ----
    /bsd4.3/usr/bin   \
    /usr/bsd          \
    /bsd43/bin        \
+   /opt/ansic/bin    \
    /usr/ccs/bin      \
    /usr/lib          \
    /usr/ucblib       \
***************
*** 164,178 ****
  #  We might need the following :
  #
  echo Looking for some tools first ...
! list='as ld cc acc gcc g++ zcat gunzip gzip ranlib perl ctags emacs'
! pth=`echo $PATH | sed -e "s/$dir_sep/ /g" | sed -e 's/\\\\/\//g'`
  
  for file in $list; do
!   x=`./locate $file '' $pth`
!   case "$file" in
!     g++) gplusplus=$x ;;
!       *) eval $file=$x ;;
!   esac
    case $x in
  # support also DOS filesystems (hard drive prepended)
     ?:/*|/*) echo ..."$file is $x";;
--- 183,194 ----
  #  We might need the following :
  #
  echo Looking for some tools first ...
! list='ld zcat gunzip gzip ranlib perl ctags emacs'
! pathspace=`echo $PATH | sed -e "s/$dir_sep/ /g" | sed -e 's/\\\\/\//g'`
  
  for file in $list; do
!   x=`./locate $file '' $pathspace`
!   eval $file=$x
    case $x in
  # support also DOS filesystems (hard drive prepended)
     ?:/*|/*) echo ..."$file is $x";;
***************
*** 182,188 ****
  
  if test -z "$zcat" -a -n "$gzip" ; then zcat="$gzip -dc" ; fi
  if test -z "$gunzip" -a -n "$gzip" ; then gunzip="$gzip -d" ; fi
- if test -z "$gplusplus" -a -n "$gcc" ; then gplusplus="$gcc -x c++" ; fi
  
  ####################### CONFIGURE - ARCHITECTURE ############################
  #
--- 198,203 ----
***************
*** 201,207 ****
    irix*)    osname=irix;;
    fx2800)   arch=fx2800; osname=concentrix;;
    hp*)      arch=hppa; osname=hpux;;
!   freebsd|os2)  arch=i386;;
    ultrix)   arch=mips;;
    nextstep) arch=`file /bin/sh | sed 's/.*(for architecture \(.*\))/\1/'`;;
    osf1)     case "$5" in
--- 216,222 ----
    irix*)    osname=irix;;
    fx2800)   arch=fx2800; osname=concentrix;;
    hp*)      arch=hppa; osname=hpux;;
!   freebsd|os2)  arch=ix86;;
    ultrix)   arch=mips;;
    nextstep) arch=`file /bin/sh | sed 's/.*(for architecture \(.*\))/\1/'`;;
    osf1)     case "$5" in
***************
*** 209,218 ****
  	    esac;;
    linux)    arch=`uname -m`
  	    case "`cat /proc/cpuinfo`" in
! 	    *TMS390Z5[05]*) arch=sparcv8_super;;
! 	    *TMS390S10*)    arch=sparcv8_micro;;
! 	    *MB8690[47]*)   arch=sparcv8_micro;;
! 	    *RT625*)        arch=sparcv8_hyper;;
  	    *CY605*)        arch=sparcv8_super;;
  	    esac;;
    sunos)    case "$3" in
--- 224,235 ----
  	    esac;;
    linux)    arch=`uname -m`
  	    case "`cat /proc/cpuinfo`" in
! 	    *TMS390Z5[05]*) arch=sparcv8_super;;    # SuperSparc I or II
! 	    *TMS390S1[05]*) arch=sparcv8_micro;;    # MicroSparc I
! 	    *MB86904*)      arch=sparcv8_micro;;    # MicroSparc II
! 	    *MB86907*)      arch=sparcv8_micro;;    # TurboSparc
! 	    *MB86934*)      arch=sparcv8_super;;    # SparcLite
! 	    *RT625*)        arch=sparcv8_super;;    # HyperSparc
  	    *CY605*)        arch=sparcv8_super;;
  	    esac;;
    sunos)    case "$3" in
***************
*** 223,232 ****
  	    sun4[ce]) arch=sparcv7;;
  	    sun4[dm]) cpu="TI,|FMI,|Cypress,|Ross,"
  	      case "`(prtconf||devinfo)2>&- |egrep $cpu`" in
! 	      *TI,TMS390Z5[05]*) arch=sparcv8_super;;
! 	      *TI,TMS390S10*)    arch=sparcv8_micro;;
! 	      *FMI,MB8690[47]*)  arch=sparcv8_micro;;
! 	      *Ross,RT625*)      arch=sparcv8_hyper;;
  	      *Cypress,CY605*)   arch=sparcv8_super;;
  	      *)                 arch=sparcv8;;
  	      esac;;
--- 240,251 ----
  	    sun4[ce]) arch=sparcv7;;
  	    sun4[dm]) cpu="TI,|FMI,|Cypress,|Ross,"
  	      case "`(prtconf||devinfo)2>&- |egrep $cpu`" in
! 	      *TI,TMS390Z5[05]*) arch=sparcv8_super;; # SuperSparc I or II
! 	      *TI,TMS390S1[05]*) arch=sparcv8_micro;; # MicroSparc I
! 	      *FMI,MB86904*)     arch=sparcv8_micro;; # MicroSparc II
! 	      *FMI,MB86907*)     arch=sparcv8_micro;; # TurboSparc
! 	      *FMI,MB86934*)     arch=sparcv8_super;; # SparcLite
! 	      *Ross,RT625*)      arch=sparcv8_super;; # HyperSparc
  	      *Cypress,CY605*)   arch=sparcv8_super;;
  	      *)                 arch=sparcv8;;
  	      esac;;
***************
*** 241,248 ****
  ==========================================================================
  Currently supported architectures:
  EOM
!   rep='sparcv7 sparcv8_micro sparcv8_super sparcv8_hyper sparcv9
!        m68k i386 i486 i586 i686 hppa alpha mips fx2800'
    . ./display
    echo $n ..."Which of these apply, if any ? $c"
    dflt=$arch; . ./myread; arch=$ans
--- 260,267 ----
  ==========================================================================
  Currently supported architectures:
  EOM
!   rep='sparcv7 sparcv8_super sparcv8_micro sparcv9
!        m68k ix86 i386 i486 i586 i686 hppa alpha mips fx2800'
    . ./display
    echo $n ..."Which of these apply, if any ? $c"
    dflt=$arch; . ./myread; arch=$ans
***************
*** 268,307 ****
  #   The asm file used (if any)
  #
  case "$arch" in
!   sparc)         asmarch=none;  pretty=Sparc ;;
!   sparcv7)       asmarch=$arch; pretty=SparcV7 ;;
!   sparcv8_micro) asmarch=$arch; pretty=MicroSparc ;;
!   sparcv8_super) asmarch=$arch; pretty=SuperSparc ;;
!   sparcv8_hyper) asmarch=$arch; pretty=HyperSparc ;;
!   sparcv9)       asmarch=$arch; pretty=UltraSparc ;;
!   m68k)          asmarch=$arch; pretty="MC680x0, x>=2" ;;
!   i?86)          asmarch=ix86 ; pretty=$arch ;;
!   hppa)          asmarch=none ; pretty=HP ;;
!   alpha)         asmarch=$arch; pretty=Alpha ;;
!   mips)          asmarch=none ; pretty=Mips ;;
!   fx2800)        asmarch=none ; pretty="Alliant FX/2800" ;;
!   none)          asmarch=none;  pretty="unknown" ;;
  # NB: Not reached
!   *)             asmarch=none;  pretty=$arch
!                  echo "        Warning ! architecture $arch not tested";;
  esac
  
  #
  #   Modifications for pretty name and asm file
  #
  case "$osname" in
-   nextstep) pretty="$pretty running $osname";
-             case "$arch" in
-               m68k)  asmarch=none;;
-               i?86)  asmarch=ix86;;
-               hppa)  asmarch=none;;
-             esac;;
    linux|freebsd|os2) pretty="$pretty running $osname";;
! esac
! case "$asmarch" in
!   sparcv8_hyper) asmarch=sparcv8_super ;;
!   sparcv9)       asmarch=sparcv8_micro ;;
!   sparc)         asmarch=sparcv8_micro ;;
  esac
  
  if test "$fastread" != yes; then
--- 287,319 ----
  #   The asm file used (if any)
  #
  case "$arch" in
!   sparc)         asmarch=sparcv8_micro; pretty=Sparc ;;
!   sparcv7)       asmarch=$arch;         pretty=SparcV7 ;;
!   sparcv8_micro) asmarch=$arch;         pretty=MicroSparc ;;
!   sparcv8_super) asmarch=$arch;         pretty=SuperSparc ;;
!   sparcv9)       asmarch=sparcv8_micro; pretty=UltraSparc ;;
!   m68k)          asmarch=$arch;         pretty="MC680x0, x>=2" ;;
!   i?86)          asmarch=ix86 ;         pretty=$arch ;;
!   alpha)         asmarch=$arch;         pretty=Alpha ;;
!   hppa) case "`uname -r`" in
!         ?.09.*)  asmarch=none ;         pretty=HP ;;
!         ?.10.*)  asmarch=$arch;         pretty=HP ;;
!         esac ;;
!   mips)          asmarch=none ;         pretty=Mips ;;
!   fx2800)        asmarch=none ;         pretty="Alliant FX/2800" ;;
!   none)          asmarch=none;          pretty="unknown" ;;
  # NB: Not reached
!   *)        asmarch=none;     pretty=$arch
!             echo "        Warning ! architecture $arch not tested";;
  esac
  
  #
  #   Modifications for pretty name and asm file
  #
  case "$osname" in
    linux|freebsd|os2) pretty="$pretty running $osname";;
!   nextstep)          pretty="$pretty running $osname"
!                      if test "$arch" = m68k; then asmarch=none; fi ;;
  esac
  
  if test "$fastread" != yes; then
***************
*** 310,316 ****
  An optimized Pari kernel is available for these architectures
  ("none" means that will use the portable C version of GP/PARI)
  EOM
!   rep='none sparcv7 sparcv8_micro sparcv8_super m68k ix86 alpha'
    . ./display
    echo $n ..."Which of these apply, if any ? $c"
    dflt=$asmarch; . ./myread; asmarch=$ans
--- 322,328 ----
  An optimized Pari kernel is available for these architectures
  ("none" means that will use the portable C version of GP/PARI)
  EOM
!   rep='none sparcv7 sparcv8_super sparcv8_micro m68k ix86 alpha hppa'
    . ./display
    echo $n ..."Which of these apply, if any ? $c"
    dflt=$asmarch; . ./myread; asmarch=$ans
***************
*** 322,329 ****
  if test "$arch" != "$asmarch"; then case "$asmarch" in
    none)          pretty="$pretty (C portable kernel)" ;;
    sparcv7)       pretty="$pretty (SparcV7 kernel)" ;;
-   sparcv8_micro) pretty="$pretty (MicroSparc kernel)" ;;
    sparcv8_super) pretty="$pretty (SuperSparc kernel)" ;;
    m68k)          pretty="$pretty (MC680x0, x>=2 kernel)" ;;
    ix86)          pretty="$pretty (ix86 kernel)" ;;
    hppa)          pretty="$pretty (HPPA kernel)" ;;
--- 334,341 ----
  if test "$arch" != "$asmarch"; then case "$asmarch" in
    none)          pretty="$pretty (C portable kernel)" ;;
    sparcv7)       pretty="$pretty (SparcV7 kernel)" ;;
    sparcv8_super) pretty="$pretty (SuperSparc kernel)" ;;
+   sparcv8_micro) pretty="$pretty (MicroSparc kernel)" ;;
    m68k)          pretty="$pretty (MC680x0, x>=2 kernel)" ;;
    ix86)          pretty="$pretty (ix86 kernel)" ;;
    hppa)          pretty="$pretty (HPPA kernel)" ;;
***************
*** 575,581 ****
  #
  # Which Assembler ?
  #
! AS=$as
  if (echo | $AS -v 2>&1 | grep GNU > /dev/null); then
    echo "...Hum, this looks like GNU as"
  else
--- 587,601 ----
  #
  # Which Assembler ?
  #
! if test -z "$AS"; then
!   echo Looking for an assembler ...
!   if test "$osname" = hpux
!   then AS=`./locate as '' /usr/ccs/bin /bin`   # We don't want GNU as
!   else AS=`./locate as '' $pathspace`
!   fi
!   case "$AS" in ?:/*|/*) echo ..."as is $AS";;
!       *) echo ..."I could not find as." ;; esac
! fi
  if (echo | $AS -v 2>&1 | grep GNU > /dev/null); then
    echo "...Hum, this looks like GNU as"
  else
***************
*** 584,589 ****
--- 604,610 ----
      osf1-alpha)     ASFLAGS="-O1";;
      sunos-sparc*)   ASFLAGS="-P -I.";;
      solaris-sparc*) ASFLAGS="-P -T -I.";;
+     hpux-hppa)      ASFLAGS="+DA1.1";;
      *)              ASFLAGS=;;
    esac
  fi
***************
*** 592,611 ****
  #
  # Which Compiler ?
  #
- # If CC is already defined, keep it.
- # Else, use gcc, else g++, else acc, else cc
- # Except for some architectures : use cc
  if test -z "$CC"; then
!   if test -n "$cc"; then CC=$cc; else CC=cc; fi
!   case "$osname-$arch" in
!     hpux-*);; # Pour avoir du PIC code, pour la lib dynamique
!     osf1-alpha|aix-*);;
!     concentrix-*) CC=/bin/cc ;; # i.e. /bin/scc ou /bin/fxc
!     *)            if test -n "$acc";       then CC=$acc; fi
!                   if test -n "$gplusplus"; then CC=$gplusplus; fi
!                   if test -n "$gcc";       then CC=$gcc; fi
!                   ;;
    esac
  fi
  
  if test "$fastread" != yes; then
--- 613,651 ----
  #
  # Which Compiler ?
  #
  if test -z "$CC"; then
!   echo Looking for the compilers ...
!   # Native Compilers
!   cc=`./locate cc '' $pathspace`
!   case "$osname" in
!     hpux)       if test "$cc" = /usr/ccs/bin/cc -a -f /opt/ansic/bin/cc; then
!                 cc=/opt/ansic/bin/cc; fi ;;  # This is a better compiler
    esac
+   case "$cc" in ?:/*|/*) echo ..."cc is $cc";;
+       *) echo ..."I could not find cc.";; esac
+   # GNU Compilers
+   gcc=`./locate gcc '' $pathspace`
+   if test -z "$gcc"; then
+     case "$osname" in os2) $cc -Zexe -o gnu gnu.c ;; *) $cc -o gnu gnu.c ;; esac
+     if gnu; then gcc=$cc; fi; rm -f gnu
+   fi
+   case "$gcc" in ?:/*|/*) echo ..."gcc is $gcc";;
+       *) echo ..."I could not find gcc."; gcc=;; esac
+   if test -n "$gcc"; then
+     __gnuc__=`$gcc -v 2>&1 | sed -n 's/.*version //p'`
+     if test -z "$__gnuc__"; then __gnuc__=unknown; fi
+     echo GNU compiler version $__gnuc__
+   fi
+   case "$osname" in
+     osf1|aix)   __gnuc__='' ;; # Native compilers are faster
+     hpux)       __gnuc__='' ;; # versions older than 2.7 cannot build PIC code
+                                # gp built with recent versions has bugs
+     concentrix) __gnuc__='' ;; # cedre.polytechnique.fr has only gcc 2.1
+     concentrix) case "$__gnuc__" in 2.[78].*) ;; *)
+                 __gnuc__='' ;; esac ;;
+   esac
+   # Choosing the compiler
+   if test -n "$__gnuc__"; then CC=$gcc; else CC=$cc; fi
  fi
  
  if test "$fastread" != yes; then
***************
*** 626,656 ****
  #
  # Which Flags for Compiler ?
  #
! case "$osname-$arch" in
!   os2-*) $CC -Zexe -o gnu gnu.c ;;
!   *) $CC -o gnu gnu.c ;;
! esac
! 
! if gnu; then
!   __gnuc__=yes
!   case "$ASFLAGS" in *-P*) ASFLAGS="$ASFLAGS -D__GNUC__";;esac
    case "$osname-$arch" in
!     linux-i?86) OPTFLAGS="-O3 -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2";;
!     *)          OPTFLAGS="-O2" ;;
    esac
    DBGFLAGS="-g -Wall -Wno-implicit"
    PRFFLAGS="-pg -static"
    case "$osname-$asmarch" in *-sparcv8*) CFLAGS="$CFLAGS -mv8" ;; esac
  else
    CFLAGS=
    DBGFLAGS="-g"
    PRFFLAGS="-pg -static"
    case "$osname-$arch" in
!     hpux-*)       OPTFLAGS='-O'; CFLAGS='-Aa'; DLCFLAGS='+z';;
!     aix-*)        OPTFLAGS='-O2'; CFLAGS='-qlanglvl=ansi';;
!     linux-*)      OPTFLAGS='-O2'; CFLAGS='-m486';;
!     freebsd-*)    OPTFLAGS='-O2'; CFLAGS='-m486';;
!     osf1-alpha)   OPTFLAGS='-O4 -migrate -ifo -Olimit 9999';;
      sunos-*)      OPTFLAGS='-fast'; PRFFLAGS='-pg -Bstatic';;
      solaris-*)    OPTFLAGS='-fast'; PRFFLAGS='-xpg';;
      concentrix-*) OPTFLAGS='-Ogi' ;;
--- 666,705 ----
  #
  # Which Flags for Compiler ?
  #
! if test "$CC" != "$gcc"; then __gnuc__=; fi
! if test -z "$__gnuc__"; then
    case "$osname-$arch" in
!     os2-*) $CC -Zexe -o gnu gnu.c ;;
!     *) $CC -o gnu gnu.c ;;
    esac
+   if gnu; then __gnuc__=yes; fi
+   rm -f gnu
+ fi
+ 
+ if test -n "$__gnuc__"; then
+   OPTFLAGS="-O2"
    DBGFLAGS="-g -Wall -Wno-implicit"
    PRFFLAGS="-pg -static"
+   # Some architectures need -fPIC for building dynamic lib
+   case "$osname-$arch" in hpux-*) DLCFLAGS='-fPIC';; esac
+   # Specific optimisations for some architectures
+   case "$osname-$arch" in linux-i?86) OPTFLAGS="-O3 -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2";; esac
    case "$osname-$asmarch" in *-sparcv8*) CFLAGS="$CFLAGS -mv8" ;; esac
+   # What for ???
+   case "$ASFLAGS" in *-P*) ASFLAGS="$ASFLAGS -D__GNUC__";;esac
  else
    CFLAGS=
    DBGFLAGS="-g"
    PRFFLAGS="-pg -static"
    case "$osname-$arch" in
!     hpux-*) # The flag -Aa is for ANSI C, the flag +z for PIC code
!             # Those flags work only with non-free HPUX compilers
!                   OPTFLAGS='-O'; CFLAGS='-Aa'; DLCFLAGS='+z';;
!     aix-*)        OPTFLAGS='-O2'; CFLAGS='-qlanglvl=ansi -qtune=601';;
!             # This is the best tuning option, even for PPC604
!     linux-i?86)   OPTFLAGS='-O2'; CFLAGS='-m486';;
!     freebsd-i?86) OPTFLAGS='-O2'; CFLAGS='-m486';;
!     osf1-*)       OPTFLAGS='-O4 -migrate -ifo -Olimit 9999';;
      sunos-*)      OPTFLAGS='-fast'; PRFFLAGS='-pg -Bstatic';;
      solaris-*)    OPTFLAGS='-fast'; PRFFLAGS='-xpg';;
      concentrix-*) OPTFLAGS='-Ogi' ;;
***************
*** 658,664 ****
    esac
  fi
  CFLAGS="$CFLAGS $DLCFLAGS"
- rm -f gnu
  
  case "$osname" in
    nextstep)  CFLAGS="-traditional-cpp $CFLAGS";;
--- 707,712 ----