Bug 103471

Summary: port gnu-automake installs old config.guess and old config.sub
Product: Ports & Packages Reporter: Reed A. Cartwright <reed>
Component: Individual Port(s)Assignee: Ade Lovett <ade>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Reed A. Cartwright 2006-09-22 02:30:21 UTC
The gnu-automake port is supposed to be an unmodified installation of automake.  However, because GNU_CONFIGURE is set in the port's Makefile, the portsystem will replace config.sub and config.guess in the work directory with FreeBSD preferred versions.  See the following section from Mk/bsd.port.mk.

==================================================
.if !target(do-configure)
do-configure:
	@if [ -f ${SCRIPTDIR}/configure ]; then \
		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
		  ${SCRIPTDIR}/configure; \
	fi
.if defined(GNU_CONFIGURE)
	@CONFIG_GUESS_DIRS=$$(${FIND} ${WRKDIR} -name config.guess -o -name config.sub \
		| ${XARGS} -n 1 ${DIRNAME}); \
	for _D in $${CONFIG_GUESS_DIRS}; do \
		${CP} -f ${TEMPLATES}/config.guess $${_D}/config.guess; \
		${CHMOD} a+rx $${_D}/config.guess; \
	    ${CP} -f ${TEMPLATES}/config.sub $${_D}/config.sub; \
		${CHMOD} a+rx $${_D}/config.sub; \
	done
.endif
====================================================

This is appropriate for installing normal ports of FreeBSD but not for gnu-automake because it replaces the config.sub and config.guess that gnu-automake installs into the /usr/local/gnu-autotools directory.  This leads to outdated config.guess and config.sub being packaged with software developed on FreeBSD.

Fix: 

The following script is a work around for installing gnu-autotools

====================================================
#!/bin/sh
cd /usr/ports/devel/gnu-automake
make clean
make install
make clean
make patch
cp work/automake-1.9.6/lib/config.guess /usr/local/gnu-autotools/share/automake-1.9/config.guess
cp work/automake-1.9.6/lib/config.sub /usr/local/gnu-autotools/share/automake-1.9/config.sub
chown root:wheel /usr/local/gnu-autotools/share/automake-1.9/config.guess
chown root:wheel /usr/local/gnu-autotools/share/automake-1.9/config.sub
chmod 555 /usr/local/gnu-autotools/share/automake-1.9/config.guess
chmod 555 /usr/local/gnu-autotools/share/automake-1.9/config.sub
make clean
======================================================

A full solution would be to create pre-configure and post-configure rules in the port's make file, that save a copy of the config.guess and config.sub before configure is run and then restores them afterwards.  That way the port's configure uses the proper freebsd config.guess and config.sub, but it installs GNU's versions into the gnu-autotools directory.
How-To-Repeat: Install gnu-autotools.

or

compare config.guess in the work directory after make patch and after make configure.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2006-09-22 13:49:04 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ade

Over to maintainer
Comment 2 Ade Lovett freebsd_committer freebsd_triage 2007-01-31 03:20:18 UTC
State Changed
From-To: open->feedback

Any chance you can provide a unified diff patch against the 
current devel/gnu-automake for what you're trying to do here. 

I can understand the basic need for this, but am wary of going in 
and changing something on a port that is supposed to be completely 
stock. 

A patch would help enormously in that it could also be provided 
upstream to the automake folks for the next release.
Comment 3 Reed A. Cartwright 2007-03-15 18:16:52 UTC
Here is a patch, which I believe will solve the problem.

--- Makefile.orig       Thu Mar 15 14:06:30 2007
+++ Makefile    Thu Mar 15 14:08:45 2007
@@ -46,4 +46,12 @@
  post-patch:
         @(cd ${WRKSRC}/doc && ${RM} -f *.info*)

+pre-configure:
+       ${CP} -f ${WRKSRC}/lib/config.guess ${WRKSRC}/lib/config.guess.orig
+       ${CP} -f ${WRKSRC}/lib/config.sub ${WRKSRC}/lib/config.sub.orig
+
+post-build:
+       ${CP} -f ${WRKSRC}/lib/config.guess.orig ${WRKSRC}/lib/config.guess
+       ${CP} -f ${WRKSRC}/lib/config.sub.orig ${WRKSRC}/lib/config.sub
+
  .include <bsd.port.post.mk>
Comment 4 Ade Lovett freebsd_committer freebsd_triage 2007-09-10 10:33:13 UTC
State Changed
From-To: feedback->closed

gnu-auto* ports have now been removed since they are superfluous with 
the autotools new world order (take 10 or so). 

Hence, this PR is no longer relevant.