Subject: pkg/16408: editors/ted - header file redefines PKGDIR
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 04/19/2002 14:05:09
>Number:         16408
>Category:       pkg
>Synopsis:       editors/ted - header file redefines PKGDIR
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 19 00:05:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Robert Elz
>Release:        NetBSD 1.5ZC - 2002-04-18 (pkgsrc of same date)
>Organization:
	Prince of Songkla University
>Environment:
	<The following information is extracted from your kernel. Please>
	<append output of "ldd", "ident" where relevant (multiple lines).>
System: NetBSD fuchsia.cs.mu.OZ.AU 1.5ZC NetBSD 1.5ZC (FUCHSIA) #10: Sat Apr 6 11:36:35 ICT 2002 kre@fuchsia.cs.mu.OZ.AU:/usr/obj/sys/FUCHSIA i386
Architecture: i386
Machine: i386
>Description:

>How-To-Repeat:
	When compiling editors/ted, ie:

		cd pkgsrc/editors/ted
		make

	notice ...

gcc -I/usr/obj/pkg/editors/ted/work.i386/.buildlink/include -O2  -I/usr/X11R6/include    -I/usr/pkg/include              -I../appFrame   -I../appUtil    -I../bitmap     -I../ind        -I../include    -DPKGDIR=\"/usr/pkg\"   -DAFMDIR=\"/usr/pkg/share/Ted/afm\"     -DINDDIR=\"/usr/pkg/share/Ted/ind\" -I/usr/obj/pkg/editors/ted/work.i386/.buildlink/include  -c appMailDialog.c
In file included from appMailDialog.c:7:
appFrameConfig.h:36: warning: `PKGDIR' redefined
*Initialization*:1: warning: this is the location of the previous definition

	warnings fly past for almost every file compiled.

	Wonder...

	Investigate, and observe ...

#   define      PREFIX "/usr/local"

#   ifdef       PREFIX
#       define  PKGDIR  PREFIX
#   endif

#   ifndef      PKGDIR
#       define  PKGDIR  "/usr/local"
#   endif

	which has to be one of the weirdest sets of definitions and
	conditionals I've ever seen ... the first #define guarantees
	that the #ifdef is true (wasting cpp effort), the second
	define (the one that overridesthe PKGDIR carefully passed in by
	the NetBSD pkgsrc build system) guarantees that the ifndef is
	false (more wasted effort).

	All this is how the files are extracted, no pkgsrc patch-xx file
	alters this.

	I didn't bother to determine whether this actually affects
	operation in any way, the whole thing was so absurd that I
	simply aborted the compilation (if it has insanities this
	blatant in it, I don't want to imagine what more subtle problems
	exist).   That's why the non-critical/low prioritiy of this PR.

>Fix:
	Check whether PREFIX is actually used anywhere in the code, if not
	delete (via a patch) the whole segment of preprocessor statements
	I included above.  If it is, instead of deleting them, replace them
	with #define PREFIX PKGDIR (or delete them and -DPREFIX on the cc
	line).
>Release-Note:
>Audit-Trail:
>Unformatted:
 	<Please check that the above is correct for the bug being reported,>
 	<and append source date of snapshot, if applicable (one line).>