Hmm well I think it's nice if users can just download the tarball and run configure and it works without having to point it at dependencies, something which regularly confuses users. /usr/local is a common default location for local builds, I've occasionally been tempted to add some others too.
Still, I'm not sure there is any evidence having this particulatly helps anybody, libevent and ncurses are part of base on OpenBSD, NetBSD uses /usr/pkg, GCC on Linux mostly searches /usr/local by default. I suspect the FreeBSD compiler searches /usr/local by default as well, I'll have a look at some point.
In the meantime, if you add your own include directories, they should be searched first no matter what tmux adds.
-------- Original message --------
From: Romain Naour <***@openwide.fr>
Date:10/01/2015 23:09 (GMT+00:00)
To: Nicholas Marriott <***@gmail.com>
Cc: tmux-***@lists.sf.net
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path
Hi Nicholas,
Post by Nicholas MarriottWell, why is it unsafe? I'm not too concerned about crossbuilding TBH. Are you
sure this isn't still needed on eg FreeBSD?
Ok, let's me explain my use case.
tmux has been packaged in Buildroot [1][2] (and probably Yoto too) and the build
system use a cross-compiler to build the entire target system.
Also all headers and libraries for the target are installed in a specific
directory called STAGING_DIR. So using a path like /usr/local/include can lead
to mixing headers from host and target (that may come from different versions).
That why all paths that point to a host location (starting with /usr/include,
/usr/local/include or /lib) is considered unsafe for cross-compilation.
Recently, we added in Buildroot a tool to check if host headers or libraries
paths are used [3].
Regarding FreeBSD compatibility, I'm not sure (I'm not a FreeBSB user).
Probably yes, they still need /usr/local/include for native build.
But I think, it's the user's responsibility to ensure that their compiler
searches for headers in the appropriate location, not the tmux's Makefile.
Especially when headers paths are passed on the command line.
For example, on my Fedora host the /usr/local/include is an empty directory,
It's not needed to force to use this path in the CFLAGS even for a native build.
Or consider using pkg-config to search for headers and libraries (ncurses and
libevent).
Best regards,
Romain Naour
[1] http://buildroot.org/
[2] http://git.buildroot.net/buildroot/tree/package/tmux
[3] http://lists.busybox.net/pipermail/buildroot/2014-December/114848.html
Post by Nicholas Marriott-------- Original message --------
From: Romain Naour
Date:10/01/2015 14:12 (GMT+00:00)
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path
Hi,
Post by Romain Naour/usr/local/include is probably not needed and it's unsafe for
cross-compilation.
---
 Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a9ad5b9..0109e5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,12 +38,12 @@ else
 CFLAGS += -O2
 endif
 if IS_GCC4
-CPPFLAGS += -iquote. -I/usr/local/include
+CPPFLAGS += -iquote.
 if IS_DEBUG
 CFLAGS += -Wno-pointer-sign
 endif
 else
-CPPFLAGS += -I. -I- -I/usr/local/include
+CPPFLAGS += -I. -I-
 endif
 endif
Please, consider this patch for the next release.
Thanks.
Best regards,
Romain Naour