[R] compiling R-0.90.0 on alpha-dec-osf4.0

Albrecht Gebhardt albrecht.gebhardt@uni-klu.ac.at
Mon, 29 Nov 1999 10:20:32 +0100 (MET)


On Sun, 28 Nov 1999, Kurt Hornik wrote:

> >>>>> Prof Brian D Ripley writes:
> 
> > On Fri, 26 Nov 1999, Kurt Hornik wrote:
> >> Albrecht Gebhardt had the same bug report a few days ago.  I don't quite
> >> understand what is going on.  configure checks (via AC_C_CONST) whether
> >> `const' works fine.  If not, it defines const as empty in Rdefines.h.
> >> This in turn gets included in all of our source files.  So how can it
> >> happen that const is empty in one place and not in another?
> 
> > Look in gram.c:
> 
> > #ifndef __cplusplus
> > #ifndef __STDC__
> > #define const
> > #endif
> > #endif
> 
> > comes before the forward declaration and the definition. We have ANSI
> > compilers, so this does not happen to us.
> 
> > I don't know how to tell bison to behave!
> 
> I know :-)
> 
> In bison-xy/src/output.c, replace the unconditional
> 
>   /* Make "const" do nothing if not in ANSI C.  */
>   fprintf (ftable, "#ifndef __cplusplus\n#ifndef __STDC__\n#define const\n#endif
> \n#endif\n\n");
> 
> by something more useful :-)
> 
> But seriously, what is going on here?  Autoconf says
> 
>  - Macro: AC_C_CONST
>      If the C compiler does not fully support the keyword `const',
>      define `const' to be empty.  Some C compilers that do not define
>      `__STDC__' do support `const'; some compilers that define
>      `__STDC__' do not completely support `const'.  Programs can simply
>      use `const' as if every C compiler supported it; for those that
>      don't, the `Makefile' or configuration header file will define it
>      as empty.
> 
> so how can we deal with the situation where __STDC__ is not defined by
> the compiler but `const' still works?
> 
> One solution would be to mimic Bison's rule in addition to the autoconf
> magic, so that we define const as empty when __STDC__ is not defined,
> even if const works.
> 

Wouldn't it be better to force CPPFLAGS to contain "-std" or "-std1" for 
CC=cc on alpha? We compile most of our freeware stuff (kde,...) for Tru64
with this option ("std1") (From time to time I forget about it ;(, this
happened with R-0.65/90) 

I just compiled 0.90.0 successful with "-std1". 

"man cc" says the following about the -std options:
################### man cc /-std #######################################
-std[n]

Directs the compiler to produce warnings for language constructs that are
not standard in the language. The default is -std0. The following values
are accepted:

-std

Enforces the ANSI C standard, but allows some common programming practices
disallowed by the standard. The -std flag causes the macro __STDC__=0 to
be passed to the preprocessor.

-std0

Enforces the K&R programming style, with certain ANSI extensions in areas
where the K & R behavior is undefined or ambiguous.  In general, -std0
compiles most pre-ANSI C programs and produces expected results. The -std0
flag causes the __STDC__ macro to be undefined.

-std1 

Strictly enforces the ANSI C standard and all its prohibitions (such as
those that apply to the handling of void types, the definition of lvalues
in expressions, the mixing of integrals and pointers, and the modification
of rvalues).  This flag does not, however, restrict the name space defined
by the DIGITAL UNIX implementation to only reserved names as specified by
ANSI C. The -std1 flag causes the macro __STDC__=1 to be passed to the
preprocessor.  Note that the -std1 flag also affects linker defined
symbols.  See ld(1) for more information.

None of the -std* flags restrict or expand the name space defined by the
DIGITAL UNIX implementation (for example, items declared in system header
files).  To restrict the name space so that only ANSI C reserved names are
made visible from the system header files listed in the ANSI C standard,
use the _ANSI_C_SOURCE macro.  For details on _ANSI_C_SOURCE and other
standard macros, see standards(5).
################ end man #########################################

Albrecht

......................................................................
| Albrecht Gebhardt          Tel.: (++43 463) 2700/832               |
| Institut fuer Mathematik   Fax : (++43 463) 2700/834               |
| Universitaet Klagenfurt    mailto:albrecht.gebhardt@uni-klu.ac.at  |
| Villacher Str. 161         http://www-stat.uni-klu.ac.at/~agebhard |
| 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._