This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Patch to update libtool in GCC and Src trees
Alexandre Oliva wrote:
One likely possibility is that the macro that first AC_REQUIREs the
code that assigns to Xsed is inside a shell conditional statement.
Well, that seems /very/ likely: there are 15 configure.in's within
newlib that have some variation of this:
if test "${use_libtool}" = "yes"; then
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
fi
So, I ran an experiment. I changed all of those to unconditionally call
LT_INIT([shared static win32-dll])
which is the official New Libtool Way (although AC_LIBTOOL_WIN32_DLL and
AM_PROG_LIBTOOL still work, I figured while I was there...)
Because all of the relevant Makefile.am's do a little dance like this:
if USE_LIBTOOL
some_LTLIBRARIES = ...
else
some_LIBRARIES = ...
endif
it seemed that on those platforms where libtool shouldn't be used, it
won't be. However, with this change, even /those/ platforms will
generate a libtool script and run the various configury tests required
by libtool. That may be a problem: newlib/configure.host has the
following comment:
# We don't want to use libtool for platforms that we are not going to
# support shared libraries. This is because it adds executable tests which
# we don't want for most embedded platforms.
But, I just wanted to run the experiment and provide a data point for
consideration -- and, I'm not sure if that comment still applies, with
the new libtool. Which "executable tests" were problematic?
Perhaps someone knowledgeable about building newlib for embedded targets
could try my recipe, below -- just for another data point?
=========================================
What I did:
(1) checkout newlib (or, on cygwin, the whole winsup+newlib)
(2) in toplevel:
rm ltcf-*
rm ltconfig
rm libtool.m4
rm ltmain.sh
unpack Steve's libtool.tar.gz, available here:
http://sourceware.org/ml/binutils/2007-05/msg00109.html
(3) copy 'compile' from automake-1.9 into toplevel
(4) from the newlib/ directory:
applied the attached patch, which modifies the 15 affected
configure.in files
(5) from the newlib/ directory:
rm -f ./libtool.m4
(6) from the newlib/ directory:
ran the attached 'fixup-Makefile-am.sh' script, which
changes the ACLOCAL_AMFLAGS in all 75 Makefile.am's at the
top of each separately-configured subproject within newlib:
before, each ACLOCAL_AMFLAGS contained the relative path
to <toplevel>/newlib/. The script modifies each of those
to also include '-I <rel-path-to-toplevel>' so it can find
the new libtool.m4 and friends.
(7) from the newlib/ directory:
ran the attached 'run-aclocal.sh' script, which invokes
aclocal with the correct -I flags for all 75 subprojects
in newlib. The -I flags are discovered by parsing the
Makefile.am's as modified in step 6. The effect of this
script is invariably something really simple, like:
+m4_include([../../../../libtool.m4])
+m4_include([../../../../ltoptions.m4])
+m4_include([../../../../ltsugar.m4])
+m4_include([../../../../ltversion.m4])
m4_include([../../../acinclude.m4])
-m4_include([../../../libtool.m4])
or no change at all.
(8) from the newlib/ directory:
ran the attached 'run-automake.sh' script, which simply
executes 'automake --cygnus' in all 75 subprojects.
(9) from the newlib/ directory:
ran the attached 'run-autoconf.sh' script...
(10)finally, in <toplevel>
ran 'autoconf'
Steps 6 thru 9 were done with scripts because (a) they are just that
mechanical, and (b) otherwise, I'd have to post a 4.5MB patch thanks to
all the modified configure scripts.
On cygwin-native, using the src/ tree thus modified, I successfully
built a new cygwin kernel with its internal newlib. The build process
did create about 8 libtool scripts -- which were never used; all objects
were created by directly invoking the compiler.
On linux-native, using the src/ tree modified this way, I successfully
built a shared newlib library, using (the new) libtool:
$ cd $BUILDDIR && find i686-pc-linux-gnu -name "*.so"
i686-pc-linux-gnu/newlib/.libs/libc.so
i686-pc-linux-gnu/newlib/.libs/libm.so
i686-pc-linux-gnu/newlib/iconvdata/.libs/EUC-JP.so
i686-pc-linux-gnu/newlib/libc/sys/linux/linuxthreads/.libs/libpthread.so
i686-pc-linux-gnu/newlib/libc/sys/linux/linuxthreads/.libs/libthread_db.so
=========================================
So, what does this tell us?
(1) the new libtool, with proper care, can be used to build a shared
newlib on linux-native
(2) with the new libtool in place, it is possible to build newlib "sans
libtool" on at least one other platform
=========================================
So, the problem boils down to two issues:
(1) Is it necessary to conditionally invoke LT_INIT or AM_PROG_LIBTOOL
-- or can embedded targets deal with unconditionally invoking those
macros? IOW, does the configure.host warning:
# We don't want to use libtool for platforms that we are not going to
# support shared libraries. This is because it adds executable tests which
# we don't want for most embedded platforms.
still apply?
If it is not necessary, and embedded targets can deal with it, and the
configure.host warning no longer applies, then Steve can use the
procedure outlined above and regenerate/extend his patch, and we're good
to go.
(2) Otherwise: how can the auto* machinery be manipulated to
conditionally invoke LT_INIT or AM_PROG_LIBTOOL, without experiencing
the problems I described earlier:
http://www.cygwin.com/ml/newlib/2007/msg00523.html
--
Chuck
P.S. No changelog, because we're still just experimenting, here...
Index: configure.in
===================================================================
RCS file: /cvs/src/src/newlib/configure.in,v
retrieving revision 1.36
diff -u -r1.36 configure.in
--- configure.in 11 May 2007 20:09:00 -0000 1.36
+++ configure.in 15 May 2007 04:21:38 -0000
@@ -120,11 +120,8 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
AC_PROG_AWK
-fi
+LT_INIT([shared static win32-dll])
AC_ARG_ENABLE(newlib_hw_fp,
[ --enable-newlib-hw-fp Turn on hardware floating point math],
Index: iconvdata/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/iconvdata/configure.in,v
retrieving revision 1.2
diff -u -r1.2 configure.in
--- iconvdata/configure.in 13 Apr 2006 19:56:23 -0000 1.2
+++ iconvdata/configure.in 15 May 2007 04:21:39 -0000
@@ -13,11 +13,7 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+LT_INIT([shared static win32-dll])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Index: libc/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/configure.in,v
retrieving revision 1.14
diff -u -r1.14 configure.in
--- libc/configure.in 31 Jan 2007 19:34:36 -0000 1.14
+++ libc/configure.in 15 May 2007 04:21:40 -0000
@@ -22,11 +22,7 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+LT_INIT([shared static win32-dll])
AC_CONFIG_SUBDIRS(machine sys)
Index: libc/machine/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/configure.in,v
retrieving revision 1.6
diff -u -r1.6 configure.in
--- libc/machine/configure.in 8 Nov 2006 19:26:43 -0000 1.6
+++ libc/machine/configure.in 15 May 2007 04:21:41 -0000
@@ -12,13 +12,9 @@
dnl We have to add the following lines because automake detects the
dnl references to libtool libraries from aclocal and tries to verify that
-dnl AM_PROG_LIBTOOL is being used. This must be added after
-dnl the call to NEWLIB_CONFIGURE.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+dnl the libtool initialization macro(s) are being used. This code must
+dnl occur after NEWLIB_CONFIGURE.
+LT_INIT([shared static win32-dll])
if test -n "${machine_dir}"; then
case ${machine_dir} in
Index: libc/machine/i386/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/i386/configure.in,v
retrieving revision 1.3
diff -u -r1.3 configure.in
--- libc/machine/i386/configure.in 13 Apr 2006 19:56:25 -0000 1.3
+++ libc/machine/i386/configure.in 15 May 2007 04:21:42 -0000
@@ -12,13 +12,9 @@
dnl We have to add the following lines because automake detects the
dnl references to libtool libraries from aclocal and tries to verify that
-dnl AM_PROG_LIBTOOL is being used. This code must occur after
-dnl NEWLIB_CONFIGURE.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+dnl the libtool initialization macro(s) are being used. This code must
+dnl occur after NEWLIB_CONFIGURE.
+LT_INIT([shared static win32-dll])
AM_CONDITIONAL(MACH_ADD_SETJMP, test "x$mach_add_setjmp" = 'xtrue')
Index: libc/sys/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/configure.in,v
retrieving revision 1.7
diff -u -r1.7 configure.in
--- libc/sys/configure.in 13 Apr 2006 19:56:27 -0000 1.7
+++ libc/sys/configure.in 15 May 2007 04:21:43 -0000
@@ -13,10 +13,7 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+LT_INIT([shared static win32-dll])
if test -n "${sys_dir}"; then
case ${sys_dir} in
Index: libc/sys/linux/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/linux/configure.in,v
retrieving revision 1.11
diff -u -r1.11 configure.in
--- libc/sys/linux/configure.in 13 Apr 2006 19:56:30 -0000 1.11
+++ libc/sys/linux/configure.in 15 May 2007 04:21:44 -0000
@@ -13,12 +13,8 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
AC_PROG_AWK
-fi
+LT_INIT([shared static win32-dll])
LINUX_MACH_LIB=
if test -n "${machine_dir}"; then
Index: libc/sys/linux/linuxthreads/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/linux/linuxthreads/configure.in,v
retrieving revision 1.2
diff -u -r1.2 configure.in
--- libc/sys/linux/linuxthreads/configure.in 13 Apr 2006 19:56:30 -0000 1.2
+++ libc/sys/linux/linuxthreads/configure.in 15 May 2007 04:21:45 -0000
@@ -13,12 +13,8 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
AC_PROG_AWK
-fi
+LT_INIT([shared static win32-dll])
if test -n "${machine_dir}"; then
MACHINE_OBJLIST=machine/${machine_dir}/objectlist.awk.in
Index: libc/sys/linux/linuxthreads/machine/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/linux/linuxthreads/machine/configure.in,v
retrieving revision 1.3
diff -u -r1.3 configure.in
--- libc/sys/linux/linuxthreads/machine/configure.in 13 Apr 2006 19:56:30 -0000 1.3
+++ libc/sys/linux/linuxthreads/machine/configure.in 15 May 2007 04:21:46 -0000
@@ -13,10 +13,7 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+LT_INIT([shared static win32-dll])
if test -n "${machine_dir}"; then
case ${machine_dir} in
Index: libc/sys/linux/linuxthreads/machine/i386/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/linux/linuxthreads/machine/i386/configure.in,v
retrieving revision 1.2
diff -u -r1.2 configure.in
--- libc/sys/linux/linuxthreads/machine/i386/configure.in 13 Apr 2006 19:56:30 -0000 1.2
+++ libc/sys/linux/linuxthreads/machine/i386/configure.in 15 May 2007 04:21:48 -0000
@@ -13,12 +13,8 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
AC_PROG_AWK
-fi
+LT_INIT([shared static win32-dll])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Index: libc/sys/linux/machine/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/linux/machine/configure.in,v
retrieving revision 1.3
diff -u -r1.3 configure.in
--- libc/sys/linux/machine/configure.in 13 Apr 2006 19:56:30 -0000 1.3
+++ libc/sys/linux/machine/configure.in 15 May 2007 04:21:51 -0000
@@ -13,10 +13,7 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+LT_INIT([shared static win32-dll])
if test -n "${machine_dir}"; then
case ${machine_dir} in
Index: libc/sys/linux/machine/i386/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/linux/machine/i386/configure.in,v
retrieving revision 1.2
diff -u -r1.2 configure.in
--- libc/sys/linux/machine/i386/configure.in 13 Apr 2006 19:56:30 -0000 1.2
+++ libc/sys/linux/machine/i386/configure.in 15 May 2007 04:21:52 -0000
@@ -13,12 +13,8 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
AC_PROG_AWK
-fi
+LT_INIT([shared static win32-dll])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Index: libm/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libm/configure.in,v
retrieving revision 1.6
diff -u -r1.6 configure.in
--- libm/configure.in 11 Jan 2007 20:57:51 -0000 1.6
+++ libm/configure.in 15 May 2007 04:21:52 -0000
@@ -22,11 +22,7 @@
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
dnl line of the macro which fail because appropriate LDFLAGS are not set.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+LT_INIT([shared static win32-dll])
AC_CONFIG_SUBDIRS(machine)
Index: libm/machine/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libm/machine/configure.in,v
retrieving revision 1.5
diff -u -r1.5 configure.in
--- libm/machine/configure.in 14 Feb 2007 23:18:25 -0000 1.5
+++ libm/machine/configure.in 15 May 2007 04:21:53 -0000
@@ -12,13 +12,9 @@
dnl We have to add the following lines because automake detects the
dnl references to libtool libraries from aclocal and tries to verify that
-dnl AM_PROG_LIBTOOL is being used. This must be added after
-dnl the call to NEWLIB_CONFIGURE.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+dnl the libtool initialization macro(s) are being used. This code must
+dnl occur after NEWLIB_CONFIGURE.
+LT_INIT([shared static win32-dll])
machlib=
Index: libm/machine/i386/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libm/machine/i386/configure.in,v
retrieving revision 1.2
diff -u -r1.2 configure.in
--- libm/machine/i386/configure.in 13 Apr 2006 19:56:32 -0000 1.2
+++ libm/machine/i386/configure.in 15 May 2007 04:21:55 -0000
@@ -12,13 +12,9 @@
dnl We have to add the following lines because automake detects the
dnl references to libtool libraries from aclocal and tries to verify that
-dnl AM_PROG_LIBTOOL is being used. This code must occur after
-dnl NEWLIB_CONFIGURE.
-
-if test "${use_libtool}" = "yes"; then
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-fi
+dnl the libtool initialization macro(s) are being used. This code must
+dnl occur after NEWLIB_CONFIGURE.
+LT_INIT([shared static win32-dll])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
#!/bin/sh
find . -name "Makefile.am" |\
xargs grep ACLOCAL_AMFLAGS |\
awk -F: '{print $1}' | sort -r | while read FN ; do
dn=`dirname ${FN}`
nfn=${FN}.new
if [ "x$dn" = "x." ] ; then
cat ${FN} | sed -e 's,ACLOCAL_AMFLAGS = -I.*,ACLOCAL_AMFLAGS = -I . -I ..,' > $nfn
else
cat ${FN} | sed -e 's,ACLOCAL_AMFLAGS = -I \([^ ]*\),ACLOCAL_AMFLAGS = -I \1 -I ../\1,' > $nfn
fi
mv ${nfn} ${FN}
done
#!/bin/bash -e
find . -name "Makefile.am" |\
xargs grep ACLOCAL_AMFLAGS |\
awk -F: '{print $1}' | sort -r | while read FN ; do
dn=`dirname $FN`
pushd $dn >/dev/null 2>&1
fg=`grep ACLOCAL_AMFLAGS Makefile.am | sed -e 's/ACLOCAL_AMFLAGS = //'`
echo "----------------- $dn --------------"
echo aclocal $fg
aclocal $fg
popd >/dev/null 2>&1
done
#!/bin/bash -e
find . -name "Makefile.am" |\
xargs grep ACLOCAL_AMFLAGS |\
awk -F: '{print $1}' | sort -r | while read FN ; do
dn=`dirname $FN`
pushd $dn >/dev/null 2>&1
echo "----------------- $dn --------------"
automake --cygnus
popd >/dev/null 2>&1
done
#!/bin/bash -e
find . -name "Makefile.am" |\
xargs grep ACLOCAL_AMFLAGS |\
awk -F: '{print $1}' | sort -r | while read FN ; do
dn=`dirname $FN`
pushd $dn >/dev/null 2>&1
echo "----------------- $dn --------------"
autoconf
popd >/dev/null 2>&1
done