Article View: gnu.gcc.help
Article #53230Re: INCPATH and LIBPATH?
From: Peter Eriksson
Date: Fri, 14 Feb 1992 00:02
Date: Fri, 14 Feb 1992 00:02
66 lines
4079 bytes
4079 bytes
moss@brl.mil (Gary S. Moss <moss>) writes: >In article <1028@lysator.liu.se>, pen@lysator.liu.se (Peter Eriksson) writes: >|> There is one thing I am missing from the otherwise nice Unix world that >|> I grew accustomed to when in the PRIMOS world, and that is to be able to >|> specify a default search path for <include> files and "-lfoo" libraries. >|> >|> I know that I can use "-I" and "-L" on the command line, but I think >|> that it would be much better if there were a mechanism for handling >|> this using environment variables when I always (or most of the time) >|> have to add a directory to the search path. >|> >|> What do you folx think? I'm thinking of writing the code needed to >|> implement this (easy to do in Gcc/cccp.c, haven't looked at the code >|> for the ld linker). >I think that depending on environment variables is a bad idea. The source >code should compile correctly regardless; it is easy enough to define the >compiler and loader flags in the makefile, cakefile, Imakefile, or whatever >you use. In fact, good software distributions take care of this with a >top-level configuration file. It is unlikely that using environment >variables provides flexibility, typically you always use the same include >and lib directories to compile a given program. Also, it would be a pain >to have to change environment variables when compiling different executables, >possibly in the same source tree. Yes, it is pretty easy to define the -I and -L flags in a single Makefile. It gets boring pretty quick though when one always has to do it.... A real world example; Let's say some guys decides to create a library with common libraries and another with common include files and they don't have access to /usr/local/*. (Like to contain the X11 libs and include files) The way it is now one has to modify all Makefiles when makeing programs so that they contain explicit -Ifoo and -Lfoo arguments. Think how much easier it would have been to just say: bar% setenv INCPATH "$HOME/include:/usr/local/include:/usr/include" bar% setenv LIBPATH "$HOME/lib:/usr/local/lib:/usr/lib" bar% make (The "setenv"s would of course be done in the ".login" files or so..) >I have been bit many times by makefiles that specify "CC=cc" rather than >/bin/cc when a BSD compiler was required over the System 5 flavor and my >path had /usr/5bin ahead of /bin (forget why my PATH is that way, it gets >complicated). The worst thing is that sometimes the program compiled, >but didn't work right, the X11R5 server compiled for Sun 3s is an example >that comes vividly to mind; when compiled with /usr/5bin/cc, it would >freeze up as soon as one touched the mouse or keyboard. [Of course I used >gcc 1.40 to compile it ultimately.] >-Gary /Peter >+-----------------------------------------------+------------------------+ >| Gary Moss | Internet: moss@brl.mil | >| Computer Scientist | Phone: 410 278-2979 | >| Ballistic Research Laboratory | DSN: 298-2979 | >| Aberdeen Proving Ground, Maryland, USA | Fax: 410 278-5058 | >+-----------------------------------------------+------------------------+ -- Peter Eriksson pen@lysator.liu.se Lysator Computer Club ...!uunet!lysator.liu.se!pen University of Linkoping, Sweden "Try LysKOM!"
Technical Details
Message-ID:
<1032@lysator.liu.se>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!sunic!liuida!isy!lysator.liu.se!penReferences:
<1028@lysator.liu.se> <18147@smoke.brl.mil>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,d10ab7e54eef2618 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-02-14 00:11:00 PST Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!sunic!liuida!isy!lysator.liu.se!pen From: pen@lysator.liu.se (Peter Eriksson) Newsgroups: gnu.gcc.help Subject: Re: INCPATH and LIBPATH? Keywords: feature gcc ld cpp Message-ID: <1032@lysator.liu.se> Date: 14 Feb 92 00:02:50 GMT References: <1028@lysator.liu.se> <18147@smoke.brl.mil> Sender: news@isy.liu.se (Lord of the News) Organization: Lysator Computer Club, Linkoping University, Sweden Lines: 66