From albrecht.gebhardt@uni-klu.ac.at  Sat Nov 13 21:20:19 1999
From: albrecht.gebhardt@uni-klu.ac.at (Albrecht Gebhardt)
Date: Sat, 13 Nov 1999 22:20:19 +0100 (MET)
Subject: patches for alpha
Message-ID: <Pine.OSF.4.10.9911132108130.27388-100000@zidsrv.sci.uni-klu.ac.at>


Recently I reviewed my RPM spec files for DU 4.0, and noticed that I
forgot to post some problems + patches:

1. ./configure fails to choose a PIC flag, I simply removed the
AC_MSG_ERROR and it works. There is actually no PIC flag for DEC cc (with
DU 4.0E)
--- ./configure.in.alpha-patch  Mon Aug 23 06:36:28 1999
+++ ./configure.in      Sun Sep 12 17:38:27 1999
@@ -541,7 +541,9 @@
       -bI:\$(R_HOME)/etc/R.exp -lc -lm"
     ;;
   alpha*osf*)
+    ldcmd="f77 -g -nofor_main -fpe3 "
     cpicflags=
+    shlibld=f77
     shlibldflags=-shared
     ;;
   alpha*linux)
@@ -612,7 +614,7 @@
 : ${CPICFLAGS=${cpicflags}}
 if test -z "${CPICFLAGS}"; then
   AC_MSG_WARN([Could not determine CPICFLAGS.])
-  AC_MSG_ERROR([See the file INSTALL for more information.])
+#  AC_MSG_ERROR([See the file INSTALL for more information.])
 fi
 : ${FPICFLAGS=${fpicflags}}
 : ${SHLIBLD=${shlibld}}

May be some autoconf expert could provide an solution like
if arch!=alpha then AC_MSG_ERROR ?

1.a depending does not work, I added some lines to Makeconf.in:
My automake is automake-1.4
--- ./Makeconf.in.alpha-patch   Thu Aug 19 00:24:49 1999
+++ ./Makeconf.in       Sun Sep 12 17:38:27 1999
@@ -56,7 +56,10 @@
 .SUFFIXES:
 .SUFFIXES: .c .f .d .o

-@depend_rules_frag@
+# added for alpha (autoconf broken?):
+.c.d:
+       @echo "making $@ from $<"
+       @$(CC) -M $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< >$@
 .c.o:
        $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
 @f77_rules_frag@


2. aclocal.m4 has many wrong C preprocessor directives "#define"s and
"#include"s with "#" not in column 1 (DEC cc wants it there) 

That means
 
       #define SOMETHING

does not work, but 

#define SOMETHING 

or (for indenting together with neighbour lines)

#       define SOMETHING

works.

Here is the patch:
--- ./aclocal.m4.alpha-ac-patch	Tue Oct 26 13:32:08 1999
+++ ./aclocal.m4	Tue Oct 26 13:33:46 1999
@@ -388,13 +388,13 @@
       ${FC} -c ${FFLAGS} conftestf.f 1>&AC_FD_CC 2>&AC_FD_CC
       changequote(, )
       cat > conftest.c <<EOF
-        #include <math.h>
-	#include "confdefs.h"
-	#ifdef HAVE_F77_UNDERSCORE
-	# define F77_SYMBOL(x)   x ## _
-	#else
-	# define F77_SYMBOL(x)   x
-	#endif
+#      include <math.h>
+#      include "confdefs.h"
+#      ifdef HAVE_F77_UNDERSCORE
+#        define F77_SYMBOL(x)   x ## _
+#      else
+#        define F77_SYMBOL(x)   x
+#      endif
 
 	extern void F77_SYMBOL(cftest)(int *a, int *b,
 	  double *x, double *y);
@@ -502,10 +502,10 @@
 	  changequote(<<, >>)dnl
 	  <<
 	  int main () {
-	  #include <fpu_control.h>
-	  #if defined(_FPU_DEFAULT) && defined(_FPU_IEEE)
+#        include <fpu_control.h>
+#        if defined(_FPU_DEFAULT) && defined(_FPU_IEEE)
 	    return(_FPU_DEFAULT != _FPU_IEEE);
-	  #endif
+#        endif
 	    return(0);
 	  }
 	  >>,
@@ -527,7 +527,7 @@
       AC_TRY_RUN(
 	changequote(<<, >>)dnl
 	<<
-	#include <stdlib.h>
+#      include <stdlib.h>
 	int main () {
 	  int *p = calloc(0, sizeof(int));
 	  return(p == 0);
@@ -550,14 +550,14 @@
       AC_TRY_RUN(
 	changequote(<<, >>)dnl
 	<<
-	#include <math.h>
-	#include "confdefs.h"
+#      include <math.h>
+#      include "confdefs.h"
 	int main () {
-	#ifdef HAVE_FINITE
+#      ifdef HAVE_FINITE
 	  return(finite(1./0.) | finite(0./0.) | finite(-1./0.));
-	#else
+#      else
 	  return(0);
-	#endif
+#      endif
 	}
 	>>,
 	changequote([, ])dnl
@@ -577,14 +577,14 @@
       AC_TRY_RUN(
 	changequote(<<, >>)dnl
 	<<
-	#include <math.h>
-	#include "confdefs.h"
+#      include <math.h>
+#      include "confdefs.h"
 	int main () {
-	#ifdef HAVE_ISNAN
+#      ifdef HAVE_ISNAN
 	  return(!(log(0.) == -1. / 0. && isnan(log(-1.))));
-	#else
+#      else
 	  return(log(0.) != -1. / 0);
-	#endif
+#      endif
 	}
 	>>,
 	changequote([, ])dnl
@@ -622,8 +622,8 @@
       AC_TRY_RUN(
 	changequote(<<, >>)dnl
 	<<
-	#include <math.h>
-	#include <ieeefp.h>
+#      include <math.h>
+#      include <ieeefp.h>
 	int main () {
 	  double x = 0;
 	  fpsetmask(0); x = x / x; return (x != x);

3. multiple declaration of mkString, const char* did not work:
cc: Error: ../../../R/src/main/gram.y, line 1365: In this declaration,
parameter 1 has a different type than specified in an earlier declaration
of this function. (mismatparam)
SEXP mkString(const char *s)

Also another "#" not in column 1.

One solution is the following, but I'm not sure if the move from const
char* to char* breaks something. I also don't know why const char* did not
work.

My bison is 
root@delta[src]# bison -V
GNU Bison version 1.25

--- ./src/include/Rinternals.h.alpha-patch	Sun Sep 12 17:41:57 1999
+++ ./src/include/Rinternals.h	Sun Sep 12 17:43:37 1999
@@ -361,7 +361,7 @@
 SEXP matchArgs(SEXP, SEXP);
 SEXP matchPar(char*, SEXP*);
 SEXP mkChar(const char*);
-SEXP mkString(const char*);
+SEXP mkString(char*);
 SEXP namesgets(SEXP, SEXP);
 int ncols(SEXP);
 int nrows(SEXP);
--- ./src/main/gram.y.alpha-patch	Tue Aug 10 10:56:17 1999
+++ ./src/main/gram.y	Sun Sep 12 17:38:27 1999
@@ -56,7 +56,10 @@
 SEXP		mkFloat(char *);
 SEXP		mkInteger(char *);
 SEXP		mkNA(void);
-SEXP		mkString(const char *);
+/* problems with multiple declarations of mkString in DEC cc ?:*/
+#ifndef _R_INTERNALS_H_
+SEXP		mkString(char *);
+#endif
 SEXP		mkTrue(void);
 
 /* Internal lexer / parser state variables */
@@ -1362,7 +1365,7 @@
 }
 
 
-SEXP mkString(const char *s)
+SEXP mkString(char *s)
 {
     SEXP t;
 
@@ -1623,9 +1628,9 @@
 		SourcePtr = FunctionSource + 8;
 	    }
 	    FunctionStart[FunctionLevel] = SourcePtr - 8;
-	    #if 0
+#          if 0
 	    printf("%d,%d\n",SourcePtr - FunctionSource, FunctionLevel);
-	    #endif
+#          endif
 	}
 	return kw;
     }



ALbrecht
 
-------------------------------------------------------------------------------
Albrecht Gebhardt                   email   : albrecht.gebhardt@uni-klu.ac.at
Institut fuer Mathematik            Tel.    : (++43 463) 2700/832
Universitaet Klagenfurt             Fax     : (++43 463) 2700/834
Villacher Str. 161
A-9020 Klagenfurt, Austria
-------------------------------------------------------------------------------


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


patches for alpha
Albrecht Gebhardt