[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compiling ncurses on Darwin / Mac OS X
From: |
Thomas Dickey |
Subject: |
Re: compiling ncurses on Darwin / Mac OS X |
Date: |
Mon, 18 Jun 2001 10:58:06 -0400 |
User-agent: |
Mutt/1.2.5i |
On Mon, Jun 18, 2001 at 07:36:53AM -0700, Eugene Lee wrote:
> On Mon, Jun 18, 2001 at 09:42:49AM -0400, Thomas Dickey wrote:
> : On Mon, Jun 18, 2001 at 06:19:40AM -0700, Eugene Lee wrote:
> : >
> : > CFLAGS=-traditional-cpp ./configure
>
> : > Could this be added to INSTALL, or maybe add this to the configure script?
> :
> : I think I need more information (why Darwin has stuff in their header files
> : which is about 12-years obsolete).
>
> >From what I understand, Apple's compiler uses a special cpp to handle
> it's Objective C syntax and precompiled headers, which unfortunately
> doesn't support GNU extensions. Apple's cpp is on by default but can be
> switched to GNU's standard cpp via the -traditional-cpp flag. So it's
> not really any kind of ncurses bug or a problem with Darwin's header
> files as much as it is with Apple's compiler.
I check for GNU extensions, but don't use (or rely) on them if they're
not present. About all I know about Object C is that it uses a different
verb for including files - but iirc, it's supposed to accept #include
as well. Perhaps Apple's compiler happens to have an option by the
same name, but this is what gcc's info says:
`-traditional-cpp'
Attempt to support some aspects of traditional C preprocessors.
Specifically:
* Comments convert to nothing at all, rather than to a space.
This allows traditional token concatenation.
* In a preprocessing directive, the `#' symbol must appear as
the first character of a line.
* Macro arguments are recognized within string constants in a
macro definition (and their values are stringified, though
without additional quote marks, when they appear in such a
context). The preprocessor always considers a string
constant to end at a newline.
* The predefined macro `__STDC__' is not defined when you use
`-traditional', but `__GNUC__' is (since the GNU extensions
which `__GNUC__' indicates are not affected by
`-traditional'). If you need to write header files that work
differently depending on whether `-traditional' is in use, by
testing both of these predefined macros you can distinguish
four situations: GNU C, traditional GNU C, other ANSI C
compilers, and other old C compilers. The predefined macro
`__STDC_VERSION__' is also not defined when you use
`-traditional'. *Note Standard Predefined Macros:
(cpp.info)Standard Predefined, for more discussion of these
and other predefined macros.
* The preprocessor considers a string constant to end at a
newline (unless the newline is escaped with `\'). (Without
`-traditional', string constants can contain the newline
character as typed.)
(While I've made an attempt to work around broken cpp's such as on AIX 3.x,
which implement a mix of K&R/ANSI, it's not certain that ncurses would
work properly if you set the cpp to "-traditional-cpp" even if it compiled).
> I ran into similar problems with compiling Vim pre-5.8, which required a
> similar fix. A quick search turned up tons of similar fixes from people
> porting to Darwin.
Vim's not written in ANSI C (it's extended C, which is a bit different).
--
Thomas E. Dickey <address@hidden>
http://dickey.his.com
ftp://dickey.his.com