Build machinery

Charles Wilson cygwin@cwilson.fastmail.fm
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 Makefile.in's seem to have:
# Makefile.in generated by automake 1.11 from Makefile.am.
and configure's have
# Generated by GNU Autoconf 2.63 for newlib 1.18.0.

So...at a loss as to which version should /really/ be used, I figured
following gcc's lead would be a good idea: According to
http://gcc.gnu.org/install/prerequisites.html, 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
figured...it couldn't hurt, right?

Wrong.

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/ltmain.sh 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 configure.in 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.

AC_DEFUN([LIB_AC_PROG_CC_GNU]
AC_DEFUN([LIB_AM_PROG_AS]
AC_DEFUN([LIB_AC_PROG_CC]

and later, we invoke explicitly

LIB_AC_PROG_CC
and
LIB_AM_PROG_AS


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:

AC_PROG_CC
AM_PROG_AS

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/configure.in, AC_NO_EXECUTABLES is called
before NEWLIB_CONFIGURE.  This is now a problem, because you can't call
AC_NO_EXECUTABLES after _AC_COMPILER_EXEEXT, but NEWLIB_CONFIGURE calls
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:
http://cygwin.cwilson.fastmail.fm/ITP/work-around-libtool-changes-auto.patch.lzma
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.

--
Chuck


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.
	(NEWLIB_CONFIGURE): Call standard AC_PROG_CC
	and AM_PROG_AS instead.
	* newlib.hin: Regenerate, and re-edit.
	* configure.in: Unconditionally call
	_LT_PROG_ECHO_BACKSLASH.
	* iconvdata/configure.in: Ditto.
	* libc/configure.in: Ditto.
	* libc/machine/configure.in: Ditto.
	* libc/machine/i386/configure.in: Ditto.
	* libc/sys/configure.in: Ditto.
	* libc/sys/linux/configure.in: Ditto.
	* libc/sys/linux/linuxthreads/configure.in: Ditto.
	* libc/sys/linux/linuxthreads/machine/configure.in: Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/configure.in: Ditto.
	* libc/sys/linux/machine/configure.in: Ditto.
	* libc/sys/linux/machine/i386/configure.in: Ditto.
	* libm/configure.in: Ditto.
	* libm/machine/configure.in: Ditto.
	* libm/machine/i386/configure.in: Ditto.
	* libc/machine/sh/configure.in: Ditto. Also, call
	AC_NO_EXECUTABLES before NEWLIB_CONFIGURE.


Second patch:
http://cygwin.cwilson.fastmail.fm/ITP/work-around-libtool-changes-auto.patch.lzma

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

        Regenerate using ac-2.64 and am-1.11.1
	* Makefile.in: Regenerate.
	* aclocal.m4: Ditto.
	* configure: Ditto.
	* doc/Makefile.in: Ditto.
	* doc/aclocal.m4: Ditto.
	* doc/configure: Ditto.
	* iconvdata/Makefile.in: Ditto.
	* iconvdata/aclocal.m4: Ditto.
	* iconvdata/configure: Ditto.
	* libc/Makefile.in: Ditto.
	* libc/aclocal.m4: Ditto.
	* libc/argz/Makefile.in: Ditto.
	* libc/configure: Ditto.
	* libc/ctype/Makefile.in: Ditto.
	* libc/errno/Makefile.in: Ditto.
	* libc/iconv/Makefile.in: Ditto.
	* libc/iconv/ccs/Makefile.in: Ditto.
	* libc/iconv/ccs/binary/Makefile.in: Ditto.
	* libc/iconv/ces/Makefile.in: Ditto.
	* libc/iconv/lib/Makefile.in: Ditto.
	* libc/locale/Makefile.in: Ditto.
	* libc/machine/Makefile.in: Ditto.
	* libc/machine/a29k/Makefile.in: Ditto.
	* libc/machine/a29k/aclocal.m4: Ditto.
	* libc/machine/a29k/configure: Ditto.
	* libc/machine/aclocal.m4: Ditto.
	* libc/machine/arm/Makefile.in: Ditto.
	* libc/machine/arm/aclocal.m4: Ditto.
	* libc/machine/arm/configure: Ditto.
	* libc/machine/bfin/Makefile.in: Ditto.
	* libc/machine/bfin/aclocal.m4: Ditto.
	* libc/machine/bfin/configure: Ditto.
	* libc/machine/configure: Ditto.
	* libc/machine/cris/Makefile.in: Ditto.
	* libc/machine/cris/aclocal.m4: Ditto.
	* libc/machine/cris/configure: Ditto.
	* libc/machine/crx/Makefile.in: Ditto.
	* libc/machine/crx/aclocal.m4: Ditto.
	* libc/machine/crx/configure: Ditto.
	* libc/machine/d10v/Makefile.in: Ditto.
	* libc/machine/d10v/aclocal.m4: Ditto.
	* libc/machine/d10v/configure: Ditto.
	* libc/machine/d30v/Makefile.in: Ditto.
	* libc/machine/d30v/aclocal.m4: Ditto.
	* libc/machine/d30v/configure: Ditto.
	* libc/machine/fr30/Makefile.in: Ditto.
	* libc/machine/fr30/aclocal.m4: Ditto.
	* libc/machine/fr30/configure: Ditto.
	* libc/machine/frv/Makefile.in: Ditto.
	* libc/machine/frv/aclocal.m4: Ditto.
	* libc/machine/frv/configure: Ditto.
	* libc/machine/h8300/Makefile.in: Ditto.
	* libc/machine/h8300/aclocal.m4: Ditto.
	* libc/machine/h8300/configure: Ditto.
	* libc/machine/h8500/Makefile.in: Ditto.
	* libc/machine/h8500/aclocal.m4: Ditto.
	* libc/machine/h8500/configure: Ditto.
	* libc/machine/hppa/Makefile.in: Ditto.
	* libc/machine/hppa/aclocal.m4: Ditto.
	* libc/machine/hppa/configure: Ditto.
	* libc/machine/i386/Makefile.in: Ditto.
	* libc/machine/i386/aclocal.m4: Ditto.
	* libc/machine/i386/configure: Ditto.
	* libc/machine/i960/Makefile.in: Ditto.
	* libc/machine/i960/aclocal.m4: Ditto.
	* libc/machine/i960/configure: Ditto.
	* libc/machine/iq2000/Makefile.in: Ditto.
	* libc/machine/iq2000/aclocal.m4: Ditto.
	* libc/machine/iq2000/configure: Ditto.
	* libc/machine/m32c/Makefile.in: Ditto.
	* libc/machine/m32c/aclocal.m4: Ditto.
	* libc/machine/m32c/configure: Ditto.
	* libc/machine/m32r/Makefile.in: Ditto.
	* libc/machine/m32r/aclocal.m4: Ditto.
	* libc/machine/m32r/configure: Ditto.
	* libc/machine/m68hc11/Makefile.in: Ditto.
	* libc/machine/m68hc11/aclocal.m4: Ditto.
	* libc/machine/m68hc11/configure: Ditto.
	* libc/machine/m68k/Makefile.in: Ditto.
	* libc/machine/m68k/aclocal.m4: Ditto.
	* libc/machine/m68k/configure: Ditto.
	* libc/machine/m88k/Makefile.in: Ditto.
	* libc/machine/m88k/aclocal.m4: Ditto.
	* libc/machine/m88k/configure: Ditto.
	* libc/machine/mep/Makefile.in: Ditto.
	* libc/machine/mep/aclocal.m4: Ditto.
	* libc/machine/mep/configure: Ditto.
	* libc/machine/mips/Makefile.in: Ditto.
	* libc/machine/mips/aclocal.m4: Ditto.
	* libc/machine/mips/configure: Ditto.
	* libc/machine/mn10200/Makefile.in: Ditto.
	* libc/machine/mn10200/aclocal.m4: Ditto.
	* libc/machine/mn10200/configure: Ditto.
	* libc/machine/mn10300/Makefile.in: Ditto.
	* libc/machine/mn10300/aclocal.m4: Ditto.
	* libc/machine/mn10300/configure: Ditto.
	* libc/machine/mt/Makefile.in: Ditto.
	* libc/machine/mt/aclocal.m4: Ditto.
	* libc/machine/mt/configure: Ditto.
	* libc/machine/necv70/Makefile.in: Ditto.
	* libc/machine/necv70/aclocal.m4: Ditto.
	* libc/machine/necv70/configure: Ditto.
	* libc/machine/powerpc/Makefile.in: Ditto.
	* libc/machine/powerpc/aclocal.m4: Ditto.
	* libc/machine/powerpc/configure: Ditto.
	* libc/machine/sh/Makefile.in: Ditto.
	* libc/machine/sh/aclocal.m4: Ditto.
	* libc/machine/sh/configure: Ditto.
	* libc/machine/sparc/Makefile.in: Ditto.
	* libc/machine/sparc/aclocal.m4: Ditto.
	* libc/machine/sparc/configure: Ditto.
	* libc/machine/spu/Makefile.in: Ditto.
	* libc/machine/spu/aclocal.m4: Ditto.
	* libc/machine/spu/configure: Ditto.
	* libc/machine/tic4x/Makefile.in: Ditto.
	* libc/machine/tic4x/aclocal.m4: Ditto.
	* libc/machine/tic4x/configure: Ditto.
	* libc/machine/tic80/Makefile.in: Ditto.
	* libc/machine/tic80/aclocal.m4: Ditto.
	* libc/machine/tic80/configure: Ditto.
	* libc/machine/v850/Makefile.in: Ditto.
	* libc/machine/v850/aclocal.m4: Ditto.
	* libc/machine/v850/configure: Ditto.
	* libc/machine/w65/Makefile.in: Ditto.
	* libc/machine/w65/aclocal.m4: Ditto.
	* libc/machine/w65/configure: Ditto.
	* libc/machine/x86_64/Makefile.in: Ditto.
	* libc/machine/x86_64/aclocal.m4: Ditto.
	* libc/machine/x86_64/configure: Ditto.
	* libc/machine/xscale/Makefile.in: Ditto.
	* libc/machine/xscale/aclocal.m4: Ditto.
	* libc/machine/xscale/configure: Ditto.
	* libc/machine/xstormy16/Makefile.in: Ditto.
	* libc/machine/xstormy16/aclocal.m4: Ditto.
	* libc/machine/xstormy16/configure: Ditto.
	* libc/machine/z8k/Makefile.in: Ditto.
	* libc/machine/z8k/aclocal.m4: Ditto.
	* libc/machine/z8k/configure: Ditto.
	* libc/misc/Makefile.in: Ditto.
	* libc/posix/Makefile.in: Ditto.
	* libc/reent/Makefile.in: Ditto.
	* libc/search/Makefile.in: Ditto.
	* libc/signal/Makefile.in: Ditto.
	* libc/stdio/Makefile.in: Ditto.
	* libc/stdio64/Makefile.in: Ditto.
	* libc/stdlib/Makefile.in: Ditto.
	* libc/string/Makefile.in: Ditto.
	* libc/sys/Makefile.in: Ditto.
	* libc/sys/a29khif/Makefile.in: Ditto.
	* libc/sys/a29khif/aclocal.m4: Ditto.
	* libc/sys/a29khif/configure: Ditto.
	* libc/sys/aclocal.m4: Ditto.
	* libc/sys/arc/Makefile.in: Ditto.
	* libc/sys/arc/aclocal.m4: Ditto.
	* libc/sys/arc/configure: Ditto.
	* libc/sys/arm/Makefile.in: Ditto.
	* libc/sys/arm/aclocal.m4: Ditto.
	* libc/sys/arm/configure: Ditto.
	* libc/sys/configure: Ditto.
	* libc/sys/d10v/Makefile.in: Ditto.
	* libc/sys/d10v/aclocal.m4: Ditto.
	* libc/sys/d10v/configure: Ditto.
	* libc/sys/decstation/Makefile.in: Ditto.
	* libc/sys/decstation/aclocal.m4: Ditto.
	* libc/sys/decstation/configure: Ditto.
	* libc/sys/h8300hms/Makefile.in: Ditto.
	* libc/sys/h8300hms/aclocal.m4: Ditto.
	* libc/sys/h8300hms/configure: Ditto.
	* libc/sys/h8500hms/Makefile.in: Ditto.
	* libc/sys/h8500hms/aclocal.m4: Ditto.
	* libc/sys/h8500hms/configure: Ditto.
	* libc/sys/linux/Makefile.in: Ditto.
	* libc/sys/linux/aclocal.m4: Ditto.
	* libc/sys/linux/argp/Makefile.in: Ditto.
	* libc/sys/linux/cmath/Makefile.in: Ditto.
	* libc/sys/linux/configure: Ditto.
	* libc/sys/linux/dl/Makefile.in: Ditto.
	* libc/sys/linux/iconv/Makefile.in: Ditto.
	* libc/sys/linux/intl/Makefile.in: Ditto.
	* libc/sys/linux/linuxthreads/Makefile.in: Ditto.
	* libc/sys/linux/linuxthreads/aclocal.m4: Ditto.
	* libc/sys/linux/linuxthreads/configure: Ditto.
	* libc/sys/linux/linuxthreads/machine/Makefile.in: Ditto.
	* libc/sys/linux/linuxthreads/machine/aclocal.m4: Ditto.
	* libc/sys/linux/linuxthreads/machine/configure: Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/Makefile.in: Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/aclocal.m4: Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/configure: Ditto.
	* libc/sys/linux/machine/Makefile.in: Ditto.
	* libc/sys/linux/machine/aclocal.m4: Ditto.
	* libc/sys/linux/machine/configure: Ditto.
	* libc/sys/linux/machine/i386/Makefile.in: Ditto.
	* libc/sys/linux/machine/i386/aclocal.m4: Ditto.
	* libc/sys/linux/machine/i386/configure: Ditto.
	* libc/sys/linux/net/Makefile.in: Ditto.
	* libc/sys/m88kbug/Makefile.in: Ditto.
	* libc/sys/m88kbug/aclocal.m4: Ditto.
	* libc/sys/m88kbug/configure: Ditto.
	* libc/sys/mmixware/Makefile.in: Ditto.
	* libc/sys/mmixware/aclocal.m4: Ditto.
	* libc/sys/mmixware/configure: Ditto.
	* libc/sys/netware/Makefile.in: Ditto.
	* libc/sys/netware/aclocal.m4: Ditto.
	* libc/sys/netware/configure: Ditto.
	* libc/sys/rdos/Makefile.in: Ditto.
	* libc/sys/rdos/aclocal.m4: Ditto.
	* libc/sys/rdos/configure: Ditto.
	* libc/sys/rtems/Makefile.in: Ditto.
	* libc/sys/rtems/aclocal.m4: Ditto.
	* libc/sys/rtems/configure: Ditto.
	* libc/sys/sh/Makefile.in: Ditto.
	* libc/sys/sh/aclocal.m4: Ditto.
	* libc/sys/sh/configure: Ditto.
	* libc/sys/sparc64/Makefile.in: Ditto.
	* libc/sys/sparc64/aclocal.m4: Ditto.
	* libc/sys/sparc64/configure: Ditto.
	* libc/sys/sun4/Makefile.in: Ditto.
	* libc/sys/sun4/aclocal.m4: Ditto.
	* libc/sys/sun4/configure: Ditto.
	* libc/sys/sysmec/Makefile.in: Ditto.
	* libc/sys/sysmec/aclocal.m4: Ditto.
	* libc/sys/sysmec/configure: Ditto.
	* libc/sys/sysnec810/Makefile.in: Ditto.
	* libc/sys/sysnec810/aclocal.m4: Ditto.
	* libc/sys/sysnec810/configure: Ditto.
	* libc/sys/sysnecv850/Makefile.in: Ditto.
	* libc/sys/sysnecv850/aclocal.m4: Ditto.
	* libc/sys/sysnecv850/configure: Ditto.
	* libc/sys/sysvi386/Makefile.in: Ditto.
	* libc/sys/sysvi386/aclocal.m4: Ditto.
	* libc/sys/sysvi386/configure: Ditto.
	* libc/sys/sysvnecv70/Makefile.in: Ditto.
	* libc/sys/sysvnecv70/aclocal.m4: Ditto.
	* libc/sys/sysvnecv70/configure: Ditto.
	* libc/sys/tic80/Makefile.in: Ditto.
	* libc/sys/tic80/aclocal.m4: Ditto.
	* libc/sys/tic80/configure: Ditto.
	* libc/sys/w65/Makefile.in: Ditto.
	* libc/sys/w65/aclocal.m4: Ditto.
	* libc/sys/w65/configure: Ditto.
	* libc/sys/z8ksim/Makefile.in: Ditto.
	* libc/sys/z8ksim/aclocal.m4: Ditto.
	* libc/sys/z8ksim/configure: Ditto.
	* libc/syscalls/Makefile.in: Ditto.
	* libc/time/Makefile.in: Ditto.
	* libc/unix/Makefile.in: Ditto.
	* libm/Makefile.in: Ditto.
	* libm/aclocal.m4: Ditto.
	* libm/common/Makefile.in: Ditto.
	* libm/configure: Ditto.
	* libm/machine/Makefile.in: Ditto.
	* libm/machine/aclocal.m4: Ditto.
	* libm/machine/configure: Ditto.
	* libm/machine/i386/Makefile.in: Ditto.
	* libm/machine/i386/aclocal.m4: Ditto.
	* libm/machine/i386/configure: Ditto.
	* libm/machine/spu/Makefile.in: Ditto.
	* libm/machine/spu/aclocal.m4: Ditto.
	* libm/machine/spu/configure: Ditto.
	* libm/math/Makefile.in: Ditto.
	* libm/mathfp/Makefile.in: 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: <http://sourceware.org/pipermail/newlib/attachments/20100212/a8106b59/attachment.bin>


More information about the Newlib mailing list