Subject: bin/2437: compilation system ignores local includes and libs by default
To: None <gnats-bugs@NetBSD.ORG>
From: James E. Bernard <jbernard@tater.Mines.EDU>
List: netbsd-bugs
Date: 05/19/1996 07:16:56
>Number:         2437
>Category:       bin
>Synopsis:       cpp ignores /usr/local/include and ld et al. ignore /usr/local/lib
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun May 19 09:35:01 1996
>Last-Modified:
>Originator:     Jim Bernard
>Organization:
	Speaking for myself
>Release:        1.1B
>Environment:
System: NetBSD zoo 1.1 NetBSD 1.1 (ZOO) #0: Fri Mar 15 17:45:32 MST 1996 local@zoo:/home/local/netbsd-1.1/usr/src/sys/arch/i386/compile/ZOO i386


>Description:
	The default search paths for /usr/libexec/cpp and /usr/bin/ld and
	friends include only the OS-supplied include and library directories.
	This is in contrast to the original gnu versions of these programs,
	which also search the local directories /usr/local/include and
	/usr/local/lib.  It seems that since NetBSD is a fairly lean system,
	it ought to be more friendly toward local additions, instead of
	requiring special action such as setting of environment variables or
	modification of Makefiles in order to set search paths.  What's more,
	the OS as distributed contains a skeletal /usr/local tree, yet the
	compilation system provides no automatic support for using things
	that are installed there.
>How-To-Repeat:
	Try to compile a piece of software that depends on includes and/or
	libraries that are not present in NetBSD but are installed under
	/usr/local.  An example is ssh (ftp://cs.hut.fi/...) compiled with
	support for logging and other features from Wietse Venema's tcp
	wrappers package (ftp://ftp.win.tue.nl/...).
>Fix:
	  Each of the patches below has some associated comments preceding it.
	I haven't actually tested them, but they are sufficiently trivial
	that there should be no problems with them.

	  This patch adds /usr/local/lib to the standard search path for ld,
	ldconfig, and ld.so.
--- gnu/usr.bin/ld/shlib.c-dist	Fri Oct 13 18:33:01 1995
+++ gnu/usr.bin/ld/shlib.c	Fri May 17 21:50:21 1996
@@ -55,7 +55,7 @@
  * Standard directories to search for files specified by -l.
  */
 #ifndef STANDARD_SEARCH_DIRS
-#define	STANDARD_SEARCH_DIRS	"/usr/lib"
+#define	STANDARD_SEARCH_DIRS	"/usr/lib", "/usr/local/lib"
 #endif
 
 /*

	  This one adds /usr/local/include to the search path for includes
	in cpp.  Since this file in its original form in NetBSD-current
	is taken over from the GNU gcc-2.7.2 distribution, if the change
	is accepted (representing a policy change on the part of NetBSD),
	it should be forwarded to the gcc maintainers.
	  Note that the third entry in the added array row is documented
	in gnu/usr.bin/gcc/cpp/cccp.c as:
  int cxx_aware;		/* Includes in this directory don't need to
				   be wrapped in extern "C" when compiling
				   C++.  */
	It's not clear to me that this flag really ought to be set, but
	I've simply used the value that would be used in cccp.c if netbsd.h
	didn't override the default initialization given there.
--- gnu/usr.bin/gcc/arch/netbsd.h-dist	Sat Apr 27 05:14:49 1996
+++ gnu/usr.bin/gcc/arch/netbsd.h	Sat May 18 07:11:47 1996
@@ -9,6 +9,9 @@
 #undef GPLUSPLUS_INCLUDE_DIR
 #define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
 
+#undef LOCAL_INCLUDE_DIR
+#define LOCAL_INCLUDE_DIR "/usr/local/include"
+
 #undef GCC_INCLUDE_DIR
 #define GCC_INCLUDE_DIR "/usr/include"
 
@@ -16,6 +19,7 @@
 #define INCLUDE_DEFAULTS		\
   {					\
     { GPLUSPLUS_INCLUDE_DIR, 1, 1 },	\
+    { LOCAL_INCLUDE_DIR, 0, 1 },	\
     { GCC_INCLUDE_DIR, 0, 0 },		\
     { 0, 0, 0 }				\
   }

	  This one adds /usr/local/include to /usr/bin/cpp.  This file doesn't
	appear to be part of the GNU gcc distribution.  In most cases, there
	shouldn't really be a need to have /usr/local/include in here, but
	for consistency with the change above, it seems like it ought to
	be added.
--- gnu/usr.bin/gcc/cpp/usr.bin.cpp.sh-dist	Mon Dec 11 13:19:28 1995
+++ gnu/usr.bin/gcc/cpp/usr.bin.cpp.sh	Sat May 18 06:26:53 1996
@@ -77,7 +77,7 @@
 		FOUNDFILES=yes
 		if [ $NSI = "no" ]
 		then
-			INCS="$INCS -I/usr/include"
+			INCS="$INCS -I/usr/include -I/usr/local/include"
 			NSI=skip
 		fi
 		eval $CPP $ALST $INCS $OPTS $A || exit $?
@@ -90,7 +90,7 @@
 	# read standard input
 	if [ $NSI = "no" ]
 	then
-		INCS="$INCS -I/usr/include"
+		INCS="$INCS -I/usr/include -I/usr/local/include"
 	fi
 	eval exec $CPP $ALST $INCS $OPTS
 fi
>Audit-Trail:
>Unformatted: