SUMMARY: Search-Path for C-Preprocessor

From: V.Sander (zdv123@zam092.zam.kfa-juelich.de)
Date: Fri Jun 05 1992 - 11:21:20 CDT


I wrote:

----- Begin Included Message -----

My question is quite simple:
Is there any possibility in Solaris 1.0.1 to tell the C-Preprocessor that it should look in other directories for include files without using the -I option?
The loader has an environment LD_LIBRARY_PATH, but for compiling X11-sources,
I always have to use the -I$OPENWINHOME/include option.

----- End Included Message -----

Thanks for everyone who has resonded.
The best way (it works fine) to implement such an environment variable is
to replace /lib/cpp through a shell schript, calling the orignial cpp.
This also works, if you are using "cc" (the execve call is able to exec binaries and Shell-Scripts!).
The solution to create symbolic links, or to use imake files isn't sufficent,
because there is other Software with include-directories than X11!
The end-user wants an easy to use system, that means typing "cc" should
work for the standard-software.
Why doesn't SUN has implemented anything like the following?

----- Begin Included Message -----

You could always hit this problem with a big hammer. Replace cpp with
a script that adds the -I that you want (searching your environment to
do it) and then calls the real cpp. Off-the-top-of-my-head code
follows to illustrate:

#!/bin/sh
if [ -z "$CPP_INCLUDE_PATH" ]; then
        exec /lib/cpp.real "$@"
else
        exec /lib/cpp.real `echo $CPP_INCLUDE_PATH | sed 's|^|:|
s|[ ][ ]*||
s|::*$||
s|::*| -I|g'` "$@"
fi
exit 0

Watch out for those tab characters in the second substitution.
If CPP_INCLUDE_PATH is not set, cpp will behave exactly as before.

                                                James Ashton
                                        James.Ashton@syseng.anu.edu.au

----- End Included Message -----

Many thanks,
Volker Sander
Central Institute for Applied Mathematics in KFA Juelich, Germany
Tel.: +49 2461 61 6586 zdv123@zam092.zam.kfa-juelich.de



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:43 CDT