delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/12/26/13:29:10

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: "specs" related problems
26 Dec 1998 13:29:10 -0800 :
Message-ID: <199812262055.OAA24872.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <368312A3 DOT 2B39B015 AT cityweb DOT de>
To: Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>
Cc: Serguei DACHIAN <Serguei DOT Dachian AT univ-lemans DOT fr>, gnu-win32 AT cygnus DOT com

Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de> writes:
> If you wish to set the default include paths, you may change
> the *cpp line, e.g, to add /usr/local/include in case of cygwin,
> but not for mingw:
> 
> original:
> ---------
> *cpp:
> -remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{!mno-cygwin:-D__CYGWIN32__ -D__C
> YGWIN__} %{mno-cygwin:-iwithprefixbefore include/mingw32 -D__MINGW32__=0.2}
> 
> /usr/local/include added:
> -------------------------
> *cpp:
> -remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{!mno-cygwin:-D__CYGWIN32__ -D__C
> YGWIN__ -I/usr/local/include} %{mno-cygwin:-iwithprefixbefore include/mingw32
>  -D__MINGW32__=0.2}

I recommend not using `-I <path>' in specs file since that makes it hard
to override include paths from command line (which should always take
precendence). 

GNU CPP has the concept of "main" and "second" include paths, and more
often than not, you want to add a path to the beginning of the *second*
include path (eg., /usr/local etc). There is also the concept of "system"
include path.

Here're some of the useful ones from CPP info pages (there are web sites
out there with CPP info pages in html format):

  `-include FILE'
       Process FILE as input, and include all the resulting output,
       before processing the regular input file.

  `-idirafter DIR'
       Add the directory DIR to the second include path.  The directories
       on the second include path are searched when a header file is not
       found in any of the directories in the main include path (the one
       that `-I' adds to).

  `-iprefix PREFIX'
       Specify PREFIX as the prefix for subsequent `-iwithprefix' options.

  `-iwithprefix DIR'
       Add a directory to the second include path.  The directory's name
       is made by concatenating PREFIX and DIR, where PREFIX was
       specified previously with `-iprefix'.

  `-isystem DIR'
       Add a directory to the beginning of the second include path,
     marking it as a system directory, so that it gets the same special
     treatment as is applied to the standard system directories.

 
You probably want `-idirafter', so that you can override that from the
command line. Unfortunately, these options are rather obtuse and confusing
(I've used these for years, and still get confused).

Unfortunately, there are no such convenient ways to handle library paths,
and you might have to do what Corinna suggests (by adding a -L<path> to
the specs file). I however find it much more convenient to do these via
Makefiles to avoid confusion as to what paths get searched before what.

To add to the confusion, there's also the -B<prefix> option that can be
used to control both the library and system-include search paths. Argh.

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019