Tue Aug 6 21:47:01 2013 UTC ()
Add the "-g -D__gnu__" flags when invoking M4 via CONFIGURE_ARGS
in tools/Makefile.gnuhost.  This makes the tools version of m4
behave like GNU m4.

Remove similar code from tools/autoconf/Makefile, where it didn't
work because Makefile.gnuhost would previously have overridden it.

This fixes a problem in which the tools version of autoconf complained
"M4sugar requires GNU M4.
Install it before installing M4sugar or set the M4 environment variable to its path name."


(apb)
diff -r1.39 -r1.40 src/tools/Makefile.gnuhost
diff -r1.4 -r1.5 src/tools/autoconf/Makefile

cvs diff -r1.39 -r1.40 src/tools/Makefile.gnuhost (switch to unified diff)

--- src/tools/Makefile.gnuhost 2012/06/19 21:48:33 1.39
+++ src/tools/Makefile.gnuhost 2013/08/06 21:47:01 1.40
@@ -1,139 +1,139 @@ @@ -1,139 +1,139 @@
1# $NetBSD: Makefile.gnuhost,v 1.39 2012/06/19 21:48:33 hans Exp $ 1# $NetBSD: Makefile.gnuhost,v 1.40 2013/08/06 21:47:01 apb Exp $
2# 2#
3# Rules used when building a GNU host package. Expects MODULE to be set. 3# Rules used when building a GNU host package. Expects MODULE to be set.
4# 4#
5# There's not a lot we can do to build reliably in the face of many 5# There's not a lot we can do to build reliably in the face of many
6# available configuration options. To be as low-overhead as possible, 6# available configuration options. To be as low-overhead as possible,
7# we follow the following scheme: 7# we follow the following scheme:
8# 8#
9# * Configuration is only re-run when an autoconf source file (such as 9# * Configuration is only re-run when an autoconf source file (such as
10# "configure" or "config.sub") is changed. 10# "configure" or "config.sub") is changed.
11# 11#
12# * "config.status" is run to rebuild Makefiles and .h files if an 12# * "config.status" is run to rebuild Makefiles and .h files if an
13# autoconf-parsed file (such as Makefile.in) is changed. 13# autoconf-parsed file (such as Makefile.in) is changed.
14# 14#
15# * If MKUPDATE != "no", "make install" is only run if a build has happened 15# * If MKUPDATE != "no", "make install" is only run if a build has happened
16# since the last install in the current directory. 16# since the last install in the current directory.
17 17
18.include <bsd.own.mk> 18.include <bsd.own.mk>
19 19
20# Disable use of pre-compiled headers on Darwin. 20# Disable use of pre-compiled headers on Darwin.
21BUILD_OSTYPE!= uname -s 21BUILD_OSTYPE!= uname -s
22.if ${BUILD_OSTYPE} == "Darwin" 22.if ${BUILD_OSTYPE} == "Darwin"
23HOST_CFLAGS+=-O2 -no-cpp-precomp 23HOST_CFLAGS+=-O2 -no-cpp-precomp
24.endif 24.endif
25MAKE_PROGRAM?= ${MAKE} 25MAKE_PROGRAM?= ${MAKE}
26 26
27GNUHOSTDIST?= ${.CURDIR}/../../gnu/dist/${MODULE} 27GNUHOSTDIST?= ${.CURDIR}/../../gnu/dist/${MODULE}
28 28
29FIND_ARGS+= \! \( -type d \( \ 29FIND_ARGS+= \! \( -type d \( \
30 -name 'CVS' -o \ 30 -name 'CVS' -o \
31 -name 'config' -o \ 31 -name 'config' -o \
32 -name 'doc' -o \ 32 -name 'doc' -o \
33 -name 'po' -o \ 33 -name 'po' -o \
34 -name 'nbsd.mt' -o \ 34 -name 'nbsd.mt' -o \
35 -name 'tests*' \ 35 -name 'tests*' \
36 \) -prune \) 36 \) -prune \)
37 37
38# Do this "find" only if actually building something. 38# Do this "find" only if actually building something.
39.if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \ 39.if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \
40 (make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \ 40 (make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \
41 !defined(_GNU_CFGSRC) 41 !defined(_GNU_CFGSRC)
42 42
43_GNU_CFGSRC!= find ${GNUHOSTDIST} ${FIND_ARGS} \ 43_GNU_CFGSRC!= find ${GNUHOSTDIST} ${FIND_ARGS} \
44 -type f \( -name 'config*' -o -name '*.in' \) -print 44 -type f \( -name 'config*' -o -name '*.in' \) -print
45.MAKEOVERRIDES+= _GNU_CFGSRC 45.MAKEOVERRIDES+= _GNU_CFGSRC
46.endif 46.endif
47 47
48CONFIGURE_ENV+= \ 48CONFIGURE_ENV+= \
49 AR=${HOST_AR:Q} \ 49 AR=${HOST_AR:Q} \
50 AWK=${TOOL_AWK:Q} \ 50 AWK=${TOOL_AWK:Q} \
51 CC=${HOST_CC:Q} \ 51 CC=${HOST_CC:Q} \
52 CFLAGS=${HOST_CFLAGS:Q} \ 52 CFLAGS=${HOST_CFLAGS:Q} \
53 CPPFLAGS=${HOST_CPPFLAGS:Q} \ 53 CPPFLAGS=${HOST_CPPFLAGS:Q} \
54 CXX=${HOST_CXX:Q} \ 54 CXX=${HOST_CXX:Q} \
55 CXXFLAGS=${HOST_CXXFLAGS:Q} \ 55 CXXFLAGS=${HOST_CXXFLAGS:Q} \
56 INSTALL=${HOST_INSTALL_FILE:Q} \ 56 INSTALL=${HOST_INSTALL_FILE:Q} \
57 LDFLAGS=${HOST_LDFLAGS:Q} \ 57 LDFLAGS=${HOST_LDFLAGS:Q} \
58 LEX=${LEX:Q} \ 58 LEX=${LEX:Q} \
59 M4=${TOOL_M4:Q} \ 59 M4=${TOOL_M4:Q}" -g -D__gnu__" \
60 MAKE=${MAKE_PROGRAM:Q} \ 60 MAKE=${MAKE_PROGRAM:Q} \
61 PATH="${TOOLDIR}/bin:$$PATH" \ 61 PATH="${TOOLDIR}/bin:$$PATH" \
62 RANLIB=${HOST_RANLIB:Q} \ 62 RANLIB=${HOST_RANLIB:Q} \
63 YACC=${YACC:Q} 63 YACC=${YACC:Q}
64 64
65BUILD_ENV+= ${CONFIGURE_ENV} 65BUILD_ENV+= ${CONFIGURE_ENV}
66 66
67CONFIGURE_ARGS+=--prefix=${TOOLDIR} 67CONFIGURE_ARGS+=--prefix=${TOOLDIR}
68.if ${MKPIC} == "no" 68.if ${MKPIC} == "no"
69CONFIGURE_ARGS+=--disable-shared 69CONFIGURE_ARGS+=--disable-shared
70.endif 70.endif
71 71
72.if ${MAKE_PROGRAM} == ${MAKE} 72.if ${MAKE_PROGRAM} == ${MAKE}
73.ifndef _NOWRAPPER 73.ifndef _NOWRAPPER
74# Some systems have a small ARG_MAX. On such systems, prevent Make 74# Some systems have a small ARG_MAX. On such systems, prevent Make
75# variables set on the command line from being exported in the 75# variables set on the command line from being exported in the
76# environment (they will still be set in MAKEOVERRIDES). 76# environment (they will still be set in MAKEOVERRIDES).
77.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD" 77.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD"
78__noenvexport= -X 78__noenvexport= -X
79.endif 79.endif
80MAKE_ARGS:= ${__noenvexport} -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS} 80MAKE_ARGS:= ${__noenvexport} -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS}
81.else 81.else
82MAKE_ARGS+= _NOWRAPPER=1 82MAKE_ARGS+= _NOWRAPPER=1
83.endif 83.endif
84BUILD_COMMAND= ${BUILD_ENV} ${MAKE} ${MAKE_ARGS} 84BUILD_COMMAND= ${BUILD_ENV} ${MAKE} ${MAKE_ARGS}
85.else 85.else
86 86
87# gmake version of this puts MAKE_ARGS in the environment to be sure that 87# gmake version of this puts MAKE_ARGS in the environment to be sure that
88# sub-gmake's get them, otherwise tools/gcc tries to build libgcc and 88# sub-gmake's get them, otherwise tools/gcc tries to build libgcc and
89# fails. it also uses "env -i" to entirely clear out MAKEFLAGS. 89# fails. it also uses "env -i" to entirely clear out MAKEFLAGS.
90GMAKE_J_ARGS?= ${MAKEFLAGS:[*]:M*-j*:C/.*(-j ?[0-9]*).*/\1/W} 90GMAKE_J_ARGS?= ${MAKEFLAGS:[*]:M*-j*:C/.*(-j ?[0-9]*).*/\1/W}
91BUILD_COMMAND= /usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e ${MAKE_ARGS} 91BUILD_COMMAND= /usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e ${MAKE_ARGS}
92 92
93.endif 93.endif
94 94
95MAKE_ARGS+= BISON=true DESTDIR= INSTALL=${HOST_INSTALL_FILE:Q} 95MAKE_ARGS+= BISON=true DESTDIR= INSTALL=${HOST_INSTALL_FILE:Q}
96 96
97ALL_TARGET?= all 97ALL_TARGET?= all
98INSTALL_TARGET?=install 98INSTALL_TARGET?=install
99 99
100BUILD_PLATFORM!= uname -srm | tr ' ()' '-' 100BUILD_PLATFORM!= uname -srm | tr ' ()' '-'
101CONFIGURE_PLATFORM!= if [ -s .configure_done ]; then cat .configure_done; else echo none; fi 101CONFIGURE_PLATFORM!= if [ -s .configure_done ]; then cat .configure_done; else echo none; fi
102.if "${BUILD_PLATFORM}" != "${CONFIGURE_PLATFORM}" 102.if "${BUILD_PLATFORM}" != "${CONFIGURE_PLATFORM}"
103configure_cleanup: 103configure_cleanup:
104 @mkdir build 2>/dev/null || true 104 @mkdir build 2>/dev/null || true
105 @(echo "Cleaning stale cache files ${BUILD_PLATFORM} != ${CONFIGURE_PLATFORM}") 105 @(echo "Cleaning stale cache files ${BUILD_PLATFORM} != ${CONFIGURE_PLATFORM}")
106 @(cd build && find . -name config.cache | xargs rm -f) 106 @(cd build && find . -name config.cache | xargs rm -f)
107configure_cleanup=configure_cleanup 107configure_cleanup=configure_cleanup
108.endif 108.endif
109 109
110.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile ${configure_cleanup} 110.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile ${configure_cleanup}
111 @mkdir build 2>/dev/null || true 111 @mkdir build 2>/dev/null || true
112 @(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS}) 112 @(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS})
113 @echo ${BUILD_PLATFORM} > $@ 113 @echo ${BUILD_PLATFORM} > $@
114 114
115# The .build_done timestamp is only updated if a file actually changes 115# The .build_done timestamp is only updated if a file actually changes
116# in the build tree during "make all". This way, if nothing has changed, 116# in the build tree during "make all". This way, if nothing has changed,
117# a "make install MKUPDATE=yes" will do nothing. 117# a "make install MKUPDATE=yes" will do nothing.
118 118
119.build_done: .configure_done 119.build_done: .configure_done
120 @(cd build && ${BUILD_COMMAND} ${ALL_TARGET}) 120 @(cd build && ${BUILD_COMMAND} ${ALL_TARGET})
121 @if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \ 121 @if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \
122 then touch $@; fi 122 then touch $@; fi
123 123
124.install_done! ${BUILD:D.build_done} 124.install_done! ${BUILD:D.build_done}
125 @(cd ${.OBJDIR}/build && ${BUILD_COMMAND} ${INSTALL_TARGET}) 125 @(cd ${.OBJDIR}/build && ${BUILD_COMMAND} ${INSTALL_TARGET})
126 @touch $@ 126 @touch $@
127 127
128# Mapping to standard targets. 128# Mapping to standard targets.
129 129
130.if ${USETOOLS} == "yes" 130.if ${USETOOLS} == "yes"
131realall: .build_done 131realall: .build_done
132realinstall: .install_done 132realinstall: .install_done
133.endif 133.endif
134 134
135clean: clean.gnu 135clean: clean.gnu
136clean.gnu: 136clean.gnu:
137 -rm -r -f .*_done build 137 -rm -r -f .*_done build
138 138
139.include <bsd.hostprog.mk> 139.include <bsd.hostprog.mk>

cvs diff -r1.4 -r1.5 src/tools/autoconf/Makefile (switch to unified diff)

--- src/tools/autoconf/Makefile 2002/12/08 20:19:57 1.4
+++ src/tools/autoconf/Makefile 2013/08/06 21:47:01 1.5
@@ -1,8 +1,7 @@ @@ -1,8 +1,7 @@
1# $NetBSD: Makefile,v 1.4 2002/12/08 20:19:57 thorpej Exp $ 1# $NetBSD: Makefile,v 1.5 2013/08/06 21:47:01 apb Exp $
2 2
3MODULE= autoconf 3MODULE= autoconf
4 4
5CONFIGURE_ARGS= --program-prefix=${_TOOL_PREFIX} 5CONFIGURE_ARGS= --program-prefix=${_TOOL_PREFIX}
6CONFIGURE_ENV= M4="${TOOLDIR}/bin/${_TOOL_PREFIX}m4 -g -D__gnu__" 
7 6
8.include "${.CURDIR}/../Makefile.gnuhost" 7.include "${.CURDIR}/../Makefile.gnuhost"