"Gabor Z. Papp" <[EMAIL PROTECTED]> writes:
> Mark Gray <[EMAIL PROTECTED]> wrote:
[snip]
> | I have not tried this (since I do not need to) but I would add the
> | -I/usr/local/include near the beginning of the *cpp: section.
> 
> I have this:
> 
> *cpp:
> %(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} 
>%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}

[snip]

> So, after %(cpp_cpu)?

That will work (I tried it using a dummy include directory).  

One thing may have to watch out for is the order that directories are
searched --- people are rather unimaginative when they name things and
you can often find include files with the same name (X is a real bad
offender at this, and I swear it includes files it did not intend to.)
The -I directive will put /usr/local/include at the beginning of the
search path, and since it is the first -I it will be searched before
any directories the makefiles try to insert using their own -I
commands.  If this turns out to be a problem, you will need to get
fancier -- see info gcc and the node "Preprocessor Options" and info
cpp for the gory details.  You might just be safer rebuilding gcc
using the (Linux) "standard" include path order if you have a lot of
programs that use /usr/local/include and require the normal search
pattern.  (Assuming /usr/local/include is in ones include search path
is probably heresy to someone somewhere :-)

The search path according to redhat-6.0 appears to be:

[snip]
~ $ su -l
~ # mkdir /usr/local/include
~ # exit
exit
~ $ strace -o duh /lib/cpp
#include <duh.h>
:1: duh.h: No such file or directory
# 1 ""

~ $ grep 'open.*/duh\.h' duh
open("/usr/local/include/duh.h", O_RDONLY) = -1 ENOENT (No such file
or directory)
open("/usr/i386-redhat-linux/include/duh.h", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/duh.h",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/include/duh.h", O_RDONLY)    = -1 ENOENT (No such file or
directory)
[snip]

Hope this helps.

Reply via email to