Build machinery

Charles Wilson
Fri Feb 12 22:13:00 GMT 2010

So I was trying to add some new files/subdirectories to newlib, which
meant I had to regenerate the build machinery using the autotools. Now,
the 1.18.0 README says;

  It is strongly advised that you use an adequate version of autotools.
  For this latest release, this would be: autoconf 2.59, aclocal 1.9.6,
  and automake 1.9.6.

But...that isn't right, because most of the's seem to have:
# generated by automake 1.11 from
and configure's have
# Generated by GNU Autoconf 2.63 for newlib 1.18.0. a loss as to which version should /really/ be used, I figured
following gcc's lead would be a good idea: According to, the following autotools
should be used:

   autoconf version 2.64
   automake version 1.11
      For directories that use automake, GCC requires the latest release
      in the 1.11 series...When regenerating a directory to a newer
      version, please update all the directories using an older 1.11
      to the latest released version.

So, that says ac-2.64 and (now) am-1.11.1 -- and I already had 'em
installed since that's what gcc wants developers to use.  Besides,
that's pretty close to what the current newlib is using, so I couldn't hurt, right?


I ran into two issues (plus a minor nit). The first, I'm sure about the
fix.  The second...not so much, because I don't have a cross environment
to test it. (Could someone who does give it a try?)

Now, since src/libtool* and src/ were updated more recently
(2009-12-05) than the last time Jeff regenerated newlib's build
machinery (2009-10-20), I think this first issue will impact regardless
of whether you now use am-1.11 vs am-1.11.1, or ac-2.63 vs. ac-2.64.
So, that needs to be fixed regardless.

1) libtool issues
Most significantly: The new libtool.m4 in newlib/../ IS used by all of
the newlib directories once you re-autotool, and causes breakage inside
newlib when configuring --without-libtool. Even when --without-libtool,
many of the libtool-related substitutions get put into config.status --
but those substitutions use $ECHO, which is not actually set in this
scenario, so they don't get evaluated properly, and config.status is borked.

SED='`$ECHO $SED | $SED ....`'

so, when you actually execute ./config.status, this becomes:
SED='`/usr/bin/sed | /usr/bin/sed ...`'

which is an error.

The fix is, for every that includes AM_PROG_LIBTOOL (even
though AM_PROG_LIBTOOL is 'guarded' by if ${with_libtool}), add
_LT_PROG_ECHO_BACKSLASH *outside* the 'if' statement, just like we did
earlier for _LT_DECL_SED.

2) cross-compile support breaking native, with new autoconf
After the above change and during the subsequent configure/build, I'd
get really odd errors about 'CCASFLAGS was not set in the previous run'.
Which is true -- I didn't set it. But somehow, it was getting set later
in the process, and this annoyed the subdirectory configures.  Some
googling says this is usually because 'the build machinery of the
project is broken'. Ooookay.

Well, in newlib/acinclude.m4, we have a bunch of old support for working
around cross-compile deficiencies in ac-2.12:

# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
# are probably using a cross compiler, which will not be able to fully
# link an executable.  This should really be fixed in autoconf
# itself.


and later, we invoke explicitly


Well.  The gcc source tree doesn't appear to need workarounds like this
anymore for cross compiling.  And then there was the whole rewrite for
handling --host/--build cross-compile in auto* back in the 2.5x days.
So, I *guessed* that these workarounds were no longer necessary, and
ripped them out, replacing the explicit invocations with their updated
official versions:


With one minor nit, this worked -- I can build newlib "natively" on
cygwin now.  But...I don't really know if my *guess* about whether these
workarounds can be removed in actual cross-compile scenarios is true.

3) minor nit, due to changes above:
In newlib/libc/machine/sh/, AC_NO_EXECUTABLES is called
before NEWLIB_CONFIGURE.  This is now a problem, because you can't call
the official AC_PROG_CC, which calls _AC_COMPILER_EXEEXT.  The simple
solution is to just move AC_NO_EXECUTABLES to before NEWLIB_CONFIGURE.

At the beginning of the message, I mentioned some additions to newlib I
was planning. The attached patch does not have any of those changes; I
pulled them out and re-regenerated all of the auto*-generated files for
the purposes of the attached patch.

I've also separated the changes into two patches: one for "primary"
modifications, and the other containing all of the autotool-generated
changes (with the exception of newlib.hin, since that has to be hand
edited).  This second patch is available here:
because it's over 100k even lzma compressed (1.1M bzip2!) and the
mailing list doesn't like that.

Also, this would allow Jeff to apply the first patch only, and
regenerate everything else manually using am-1.11 and ac-2.63, if he's
not ready to update to the gcc-preferred autotool versions yet.


First patch:
2010-02-12  Charles Wilson  <...>

	Work around issues with new libtool files in ..
	* acinclude.m4 (LIB_AC_PROG_CC_GNU): Remove.
	(LIB_AM_PROG_AS): Ditto.
	(LIB_AC_PROG_CC): Ditto.
	and AM_PROG_AS instead.
	* newlib.hin: Regenerate, and re-edit.
	* Unconditionally call
	* iconvdata/ Ditto.
	* libc/ Ditto.
	* libc/machine/ Ditto.
	* libc/machine/i386/ Ditto.
	* libc/sys/ Ditto.
	* libc/sys/linux/ Ditto.
	* libc/sys/linux/linuxthreads/ Ditto.
	* libc/sys/linux/linuxthreads/machine/ Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/ Ditto.
	* libc/sys/linux/machine/ Ditto.
	* libc/sys/linux/machine/i386/ Ditto.
	* libm/ Ditto.
	* libm/machine/ Ditto.
	* libm/machine/i386/ Ditto.
	* libc/machine/sh/ Ditto. Also, call

Second patch:

2010-02-12  Charles Wilson  <...>

        Regenerate using ac-2.64 and am-1.11.1
	* Regenerate.
	* aclocal.m4: Ditto.
	* configure: Ditto.
	* doc/ Ditto.
	* doc/aclocal.m4: Ditto.
	* doc/configure: Ditto.
	* iconvdata/ Ditto.
	* iconvdata/aclocal.m4: Ditto.
	* iconvdata/configure: Ditto.
	* libc/ Ditto.
	* libc/aclocal.m4: Ditto.
	* libc/argz/ Ditto.
	* libc/configure: Ditto.
	* libc/ctype/ Ditto.
	* libc/errno/ Ditto.
	* libc/iconv/ Ditto.
	* libc/iconv/ccs/ Ditto.
	* libc/iconv/ccs/binary/ Ditto.
	* libc/iconv/ces/ Ditto.
	* libc/iconv/lib/ Ditto.
	* libc/locale/ Ditto.
	* libc/machine/ Ditto.
	* libc/machine/a29k/ Ditto.
	* libc/machine/a29k/aclocal.m4: Ditto.
	* libc/machine/a29k/configure: Ditto.
	* libc/machine/aclocal.m4: Ditto.
	* libc/machine/arm/ Ditto.
	* libc/machine/arm/aclocal.m4: Ditto.
	* libc/machine/arm/configure: Ditto.
	* libc/machine/bfin/ Ditto.
	* libc/machine/bfin/aclocal.m4: Ditto.
	* libc/machine/bfin/configure: Ditto.
	* libc/machine/configure: Ditto.
	* libc/machine/cris/ Ditto.
	* libc/machine/cris/aclocal.m4: Ditto.
	* libc/machine/cris/configure: Ditto.
	* libc/machine/crx/ Ditto.
	* libc/machine/crx/aclocal.m4: Ditto.
	* libc/machine/crx/configure: Ditto.
	* libc/machine/d10v/ Ditto.
	* libc/machine/d10v/aclocal.m4: Ditto.
	* libc/machine/d10v/configure: Ditto.
	* libc/machine/d30v/ Ditto.
	* libc/machine/d30v/aclocal.m4: Ditto.
	* libc/machine/d30v/configure: Ditto.
	* libc/machine/fr30/ Ditto.
	* libc/machine/fr30/aclocal.m4: Ditto.
	* libc/machine/fr30/configure: Ditto.
	* libc/machine/frv/ Ditto.
	* libc/machine/frv/aclocal.m4: Ditto.
	* libc/machine/frv/configure: Ditto.
	* libc/machine/h8300/ Ditto.
	* libc/machine/h8300/aclocal.m4: Ditto.
	* libc/machine/h8300/configure: Ditto.
	* libc/machine/h8500/ Ditto.
	* libc/machine/h8500/aclocal.m4: Ditto.
	* libc/machine/h8500/configure: Ditto.
	* libc/machine/hppa/ Ditto.
	* libc/machine/hppa/aclocal.m4: Ditto.
	* libc/machine/hppa/configure: Ditto.
	* libc/machine/i386/ Ditto.
	* libc/machine/i386/aclocal.m4: Ditto.
	* libc/machine/i386/configure: Ditto.
	* libc/machine/i960/ Ditto.
	* libc/machine/i960/aclocal.m4: Ditto.
	* libc/machine/i960/configure: Ditto.
	* libc/machine/iq2000/ Ditto.
	* libc/machine/iq2000/aclocal.m4: Ditto.
	* libc/machine/iq2000/configure: Ditto.
	* libc/machine/m32c/ Ditto.
	* libc/machine/m32c/aclocal.m4: Ditto.
	* libc/machine/m32c/configure: Ditto.
	* libc/machine/m32r/ Ditto.
	* libc/machine/m32r/aclocal.m4: Ditto.
	* libc/machine/m32r/configure: Ditto.
	* libc/machine/m68hc11/ Ditto.
	* libc/machine/m68hc11/aclocal.m4: Ditto.
	* libc/machine/m68hc11/configure: Ditto.
	* libc/machine/m68k/ Ditto.
	* libc/machine/m68k/aclocal.m4: Ditto.
	* libc/machine/m68k/configure: Ditto.
	* libc/machine/m88k/ Ditto.
	* libc/machine/m88k/aclocal.m4: Ditto.
	* libc/machine/m88k/configure: Ditto.
	* libc/machine/mep/ Ditto.
	* libc/machine/mep/aclocal.m4: Ditto.
	* libc/machine/mep/configure: Ditto.
	* libc/machine/mips/ Ditto.
	* libc/machine/mips/aclocal.m4: Ditto.
	* libc/machine/mips/configure: Ditto.
	* libc/machine/mn10200/ Ditto.
	* libc/machine/mn10200/aclocal.m4: Ditto.
	* libc/machine/mn10200/configure: Ditto.
	* libc/machine/mn10300/ Ditto.
	* libc/machine/mn10300/aclocal.m4: Ditto.
	* libc/machine/mn10300/configure: Ditto.
	* libc/machine/mt/ Ditto.
	* libc/machine/mt/aclocal.m4: Ditto.
	* libc/machine/mt/configure: Ditto.
	* libc/machine/necv70/ Ditto.
	* libc/machine/necv70/aclocal.m4: Ditto.
	* libc/machine/necv70/configure: Ditto.
	* libc/machine/powerpc/ Ditto.
	* libc/machine/powerpc/aclocal.m4: Ditto.
	* libc/machine/powerpc/configure: Ditto.
	* libc/machine/sh/ Ditto.
	* libc/machine/sh/aclocal.m4: Ditto.
	* libc/machine/sh/configure: Ditto.
	* libc/machine/sparc/ Ditto.
	* libc/machine/sparc/aclocal.m4: Ditto.
	* libc/machine/sparc/configure: Ditto.
	* libc/machine/spu/ Ditto.
	* libc/machine/spu/aclocal.m4: Ditto.
	* libc/machine/spu/configure: Ditto.
	* libc/machine/tic4x/ Ditto.
	* libc/machine/tic4x/aclocal.m4: Ditto.
	* libc/machine/tic4x/configure: Ditto.
	* libc/machine/tic80/ Ditto.
	* libc/machine/tic80/aclocal.m4: Ditto.
	* libc/machine/tic80/configure: Ditto.
	* libc/machine/v850/ Ditto.
	* libc/machine/v850/aclocal.m4: Ditto.
	* libc/machine/v850/configure: Ditto.
	* libc/machine/w65/ Ditto.
	* libc/machine/w65/aclocal.m4: Ditto.
	* libc/machine/w65/configure: Ditto.
	* libc/machine/x86_64/ Ditto.
	* libc/machine/x86_64/aclocal.m4: Ditto.
	* libc/machine/x86_64/configure: Ditto.
	* libc/machine/xscale/ Ditto.
	* libc/machine/xscale/aclocal.m4: Ditto.
	* libc/machine/xscale/configure: Ditto.
	* libc/machine/xstormy16/ Ditto.
	* libc/machine/xstormy16/aclocal.m4: Ditto.
	* libc/machine/xstormy16/configure: Ditto.
	* libc/machine/z8k/ Ditto.
	* libc/machine/z8k/aclocal.m4: Ditto.
	* libc/machine/z8k/configure: Ditto.
	* libc/misc/ Ditto.
	* libc/posix/ Ditto.
	* libc/reent/ Ditto.
	* libc/search/ Ditto.
	* libc/signal/ Ditto.
	* libc/stdio/ Ditto.
	* libc/stdio64/ Ditto.
	* libc/stdlib/ Ditto.
	* libc/string/ Ditto.
	* libc/sys/ Ditto.
	* libc/sys/a29khif/ Ditto.
	* libc/sys/a29khif/aclocal.m4: Ditto.
	* libc/sys/a29khif/configure: Ditto.
	* libc/sys/aclocal.m4: Ditto.
	* libc/sys/arc/ Ditto.
	* libc/sys/arc/aclocal.m4: Ditto.
	* libc/sys/arc/configure: Ditto.
	* libc/sys/arm/ Ditto.
	* libc/sys/arm/aclocal.m4: Ditto.
	* libc/sys/arm/configure: Ditto.
	* libc/sys/configure: Ditto.
	* libc/sys/d10v/ Ditto.
	* libc/sys/d10v/aclocal.m4: Ditto.
	* libc/sys/d10v/configure: Ditto.
	* libc/sys/decstation/ Ditto.
	* libc/sys/decstation/aclocal.m4: Ditto.
	* libc/sys/decstation/configure: Ditto.
	* libc/sys/h8300hms/ Ditto.
	* libc/sys/h8300hms/aclocal.m4: Ditto.
	* libc/sys/h8300hms/configure: Ditto.
	* libc/sys/h8500hms/ Ditto.
	* libc/sys/h8500hms/aclocal.m4: Ditto.
	* libc/sys/h8500hms/configure: Ditto.
	* libc/sys/linux/ Ditto.
	* libc/sys/linux/aclocal.m4: Ditto.
	* libc/sys/linux/argp/ Ditto.
	* libc/sys/linux/cmath/ Ditto.
	* libc/sys/linux/configure: Ditto.
	* libc/sys/linux/dl/ Ditto.
	* libc/sys/linux/iconv/ Ditto.
	* libc/sys/linux/intl/ Ditto.
	* libc/sys/linux/linuxthreads/ Ditto.
	* libc/sys/linux/linuxthreads/aclocal.m4: Ditto.
	* libc/sys/linux/linuxthreads/configure: Ditto.
	* libc/sys/linux/linuxthreads/machine/ Ditto.
	* libc/sys/linux/linuxthreads/machine/aclocal.m4: Ditto.
	* libc/sys/linux/linuxthreads/machine/configure: Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/ Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/aclocal.m4: Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/configure: Ditto.
	* libc/sys/linux/machine/ Ditto.
	* libc/sys/linux/machine/aclocal.m4: Ditto.
	* libc/sys/linux/machine/configure: Ditto.
	* libc/sys/linux/machine/i386/ Ditto.
	* libc/sys/linux/machine/i386/aclocal.m4: Ditto.
	* libc/sys/linux/machine/i386/configure: Ditto.
	* libc/sys/linux/net/ Ditto.
	* libc/sys/m88kbug/ Ditto.
	* libc/sys/m88kbug/aclocal.m4: Ditto.
	* libc/sys/m88kbug/configure: Ditto.
	* libc/sys/mmixware/ Ditto.
	* libc/sys/mmixware/aclocal.m4: Ditto.
	* libc/sys/mmixware/configure: Ditto.
	* libc/sys/netware/ Ditto.
	* libc/sys/netware/aclocal.m4: Ditto.
	* libc/sys/netware/configure: Ditto.
	* libc/sys/rdos/ Ditto.
	* libc/sys/rdos/aclocal.m4: Ditto.
	* libc/sys/rdos/configure: Ditto.
	* libc/sys/rtems/ Ditto.
	* libc/sys/rtems/aclocal.m4: Ditto.
	* libc/sys/rtems/configure: Ditto.
	* libc/sys/sh/ Ditto.
	* libc/sys/sh/aclocal.m4: Ditto.
	* libc/sys/sh/configure: Ditto.
	* libc/sys/sparc64/ Ditto.
	* libc/sys/sparc64/aclocal.m4: Ditto.
	* libc/sys/sparc64/configure: Ditto.
	* libc/sys/sun4/ Ditto.
	* libc/sys/sun4/aclocal.m4: Ditto.
	* libc/sys/sun4/configure: Ditto.
	* libc/sys/sysmec/ Ditto.
	* libc/sys/sysmec/aclocal.m4: Ditto.
	* libc/sys/sysmec/configure: Ditto.
	* libc/sys/sysnec810/ Ditto.
	* libc/sys/sysnec810/aclocal.m4: Ditto.
	* libc/sys/sysnec810/configure: Ditto.
	* libc/sys/sysnecv850/ Ditto.
	* libc/sys/sysnecv850/aclocal.m4: Ditto.
	* libc/sys/sysnecv850/configure: Ditto.
	* libc/sys/sysvi386/ Ditto.
	* libc/sys/sysvi386/aclocal.m4: Ditto.
	* libc/sys/sysvi386/configure: Ditto.
	* libc/sys/sysvnecv70/ Ditto.
	* libc/sys/sysvnecv70/aclocal.m4: Ditto.
	* libc/sys/sysvnecv70/configure: Ditto.
	* libc/sys/tic80/ Ditto.
	* libc/sys/tic80/aclocal.m4: Ditto.
	* libc/sys/tic80/configure: Ditto.
	* libc/sys/w65/ Ditto.
	* libc/sys/w65/aclocal.m4: Ditto.
	* libc/sys/w65/configure: Ditto.
	* libc/sys/z8ksim/ Ditto.
	* libc/sys/z8ksim/aclocal.m4: Ditto.
	* libc/sys/z8ksim/configure: Ditto.
	* libc/syscalls/ Ditto.
	* libc/time/ Ditto.
	* libc/unix/ Ditto.
	* libm/ Ditto.
	* libm/aclocal.m4: Ditto.
	* libm/common/ Ditto.
	* libm/configure: Ditto.
	* libm/machine/ Ditto.
	* libm/machine/aclocal.m4: Ditto.
	* libm/machine/configure: Ditto.
	* libm/machine/i386/ Ditto.
	* libm/machine/i386/aclocal.m4: Ditto.
	* libm/machine/i386/configure: Ditto.
	* libm/machine/spu/ Ditto.
	* libm/machine/spu/aclocal.m4: Ditto.
	* libm/machine/spu/configure: Ditto.
	* libm/math/ Ditto.
	* libm/mathfp/ Ditto.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: work-around-libtool-changes-primary.patch
Type: text/x-patch
Size: 15014 bytes
Desc: not available
URL: <>

More information about the Newlib mailing list