This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH for using gcc_version reliably (was: Re: WORKAROUND for the new gcc_version problem)
- To: law at cygnus dot com, Franz dot Sirl-kernel at lauterbach dot com
- Subject: PATCH for using gcc_version reliably (was: Re: WORKAROUND for the new gcc_version problem)
- From: Manfred Hollstein <manfred at s-direktnet dot de>
- Date: Thu, 25 Jun 1998 13:51:22 +0200 (MET DST)
- Cc: egcs-patches at cygnus dot com
- References: <13713.59639.635878.750449@slsvhmt> <27114.898758182@hurl.cygnus.com> <13714.2661.739780.738043@slsvhmt>
- Reply-To: manfred at s-direktnet dot de, Manfred dot Hollstein at ks dot sel dot alcatel dot de
On Thu, 25 June 1998, 10:32:53, manfred@s-direktnet.de wrote:
> On Thu, 25 June 1998, 01:03:02, law@hurl.cygnus.com wrote:
>
> >
> > In message <13713.59639.635878.750449@slsvhmt>you write:
> > > > The trailing ".." is wrong. The net result is we do not find
> > > > gcc/version.c and cc1, cc1plus, etc end up installed into the
> > > > "UNKNOWN" directory because we didn't find gcc/version.c
> > >
> > > Yes, Franz Sirl already pointed this out; I'm working on it.
> > OK. Good.
>
> The whole thing is more difficult than I had thought :-( In the
> meantime everybody should use this patch for the toplevel configure:
>
> *** configure.orig Wed Jun 24 08:25:49 1998
> --- configure Thu Jun 25 10:28:29 1998
> *************** fi
> *** 458,463 ****
> --- 458,464 ----
>
> configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
> moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
> + topsrcdir=`cd \`dirname ${progname}\`; pwd`
>
> # this is a hack. sun4 must always be a valid host alias or this will fail.
> if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
[snip]
OK, this is the "ultimate" patch for handling all this:
1. toplevel configure defines "$gcc_version" and a new variable
"$gcc_version_trigger" which is the absolute pathname of gcc's
version.c file. Only the latter is passed down to subdir
configures.
2. Cygnus based configures (e.g. libio, libstdc++) don't need to do
anything.
3. autoconf based configures (e.g. gcc, libf2c) need to add code for
using this new option to dynamically evalutate gcc's actual
version number; in addition they need to AC_SUBST both variables
- see gcc/configure.in or libf2c/configure.in as an example.
4. Whenever gcc/version.c is touched (its content isn't actually
checked, though), calling "make ..." in whatever directory will
re-start the configuration process, since Makefile depends on
config.status which in turn now depends on $(gcc_version_trigger).
I tested this in various configurations (using absolute pathnames,
relative names - incl. ../srcdir and ../../src/srcdir -, building in
srcdir, with and without multilibs), hence I'm pretty certain, that it
won't break your building rules again, which I honestly apologize for.
Please note, the above WORKAROUND isn't necessary with this new patch.
manfred
egcs-19980625/ChangeLog:
1998-06-25 Manfred Hollstein <manfred@s-direktnet.de>
* Makefile.in (BASE_FLAGS_TO_PASS): Add gcc_version_trigger.
(Makefile): Depend on $(gcc_version_trigger).
* configure (gcc_version): Change default initializer to empty
string.
(gcc_version_trigger): New variable; pass this variable down
to subdir configures to enable them checking gcc's version
themselves. Emit make macros for both gcc_version vars.
(topsrcdir): Initialize reliably.
(recursion line): Remove --with-gcc-version=${gcc_version}.
egcs-19980625/gcc/ChangeLog:
1998-06-25 Manfred Hollstein <manfred@s-direktnet.de>
* Makefile.in (gcc_version, gcc_version_trigger): New macros.
(version): Initialize from $(gcc_version).
* configure.in (version): Rename to gcc_version.
(gcc_version_trigger): New variable; call AC_SUBST for it and
emit it into the generated config.status.
# configure: Regenerate.
egcs-19980625/libf2c/ChangeLog.egcs:
1998-06-25 Manfred Hollstein <manfred@s-direktnet.de>
* Makefile.in (gcc_version_trigger): Add new macro.
(config.status): Add dependency upon $(gcc_version_trigger).
* configure.in (gcc_version_trigger): New variable; initialize
using value from toplevel configure; add AC_SUBST for it.
(gcc_version): Change initialization to use this new variable.
egcs-19980625/libio/ChangeLog:
1998-06-25 Manfred Hollstein <manfred@s-direktnet.de>
* config.shared (FLAGS_TO_PASS): Add gcc_version_trigger.
(Makefile): Add dependency upon $(gcc_version_trigger).
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980625.orig/Makefile.in egcs-19980625/Makefile.in
--- egcs-19980625.orig/Makefile.in Fri Jun 19 14:35:15 1998
+++ egcs-19980625/Makefile.in Thu Jun 25 11:40:28 1998
@@ -359,6 +359,7 @@ BASE_FLAGS_TO_PASS = \
"tooldir=$(tooldir)" \
"gxx_include_dir=$(gxx_include_dir)" \
"gcc_version=$(gcc_version)" \
+ "gcc_version_trigger=$(gcc_version_trigger)" \
"target_alias=$(target_alias)" \
"libsubdir=$(libsubdir)"
@@ -1532,7 +1533,7 @@ TAGS: do-TAGS
# with the gnu make, this is done automatically.
-Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag)
+Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag) $(gcc_version_trigger)
$(SHELL) ./config.status
#
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980625.orig/configure egcs-19980625/configure
--- egcs-19980625.orig/configure Wed Jun 24 08:25:49 1998
+++ egcs-19980625/configure Thu Jun 25 11:42:19 1998
@@ -56,7 +56,8 @@ exec_prefixoption=
fatal=
floating_point=default
gas=default
-gcc_version=UNKNOWN
+gcc_version=
+gcc_version_trigger=
host_alias=NOHOST
host_makefile_frag=
moveifchange=
@@ -458,6 +459,7 @@ fi
configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
+topsrcdir=`cd \`dirname ${progname}\`; pwd`
# this is a hack. sun4 must always be a valid host alias or this will fail.
if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
@@ -520,6 +522,31 @@ case "${exec_prefixoption}" in
*) ;;
esac
+# Define the trigger file to make sure configure will re-run whenever
+# the gcc version number changes.
+set -x
+pwd
+if [ "${with_gcc_version_trigger+set}" = set ]; then
+ gcc_version_trigger="$with_gcc_version_trigger"
+ gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${with_gcc_version_trigger}`
+else
+ # If gcc's sources are available, define the trigger file.
+ if [ -f ${topsrcdir}/gcc/version.c ] ; then
+ gcc_version_trigger=${topsrcdir}/gcc/version.c
+ gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${gcc_version_trigger}`
+ case "$arguments" in
+ *--with-gcc-version-trigger=$gcc_version_trigger* )
+ ;;
+ * )
+ # Make sure configure.in knows about this.
+ arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
+ ;;
+ esac
+ withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
+ fi
+fi
+set +x
+
### break up ${srcdir}/configure.in.
case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
"")
@@ -701,33 +728,6 @@ if [ "${program_prefix}" != "" ] ; then
program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
fi
-# Check whether --with-gcc-version was given.
-if [ "${with_gcc_version+set}" = set ]; then
- gcc_version="$with_gcc_version"
-else
- if [ "${srcdir}" = "." ] ; then
- if [ "${with_target_subdir}" != "." ] ; then
- topsrcdir=${with_multisrctop}../..
- else
- topsrcdir=${with_multisrctop}..
- fi
- else
- case ${srcdir} in
- */*/* ) # Need to do this only in subdirectories.
- topsrcdir=${srcdir}/..
- ;;
- * ) # We are already in the topsrcdir.
- topsrcdir=${srcdir}
- ;;
- esac
- fi
- # If gcc's sources are available, extract its version number which is used by
- # $libsubdir.
- if [ -f ${topsrcdir}/gcc/version.c ] ; then
- gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${topsrcdir}/gcc/version.c`
- fi
-fi
-
# If CC and CXX are not set in the environment, and the Makefile
# exists, try to extract them from it. This is to handle running
# ./config.status by hand.
@@ -1266,10 +1266,10 @@ EOF
echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
fi
- # Emit a macro which is used to build the libsubdir macro where
- # compiler specific stuff can be found/installed.
- # FIXME: This works only if gcc's sources are available in a gcc
- # subdirectory!
+ # Emit a macro which describes the file containing gcc's
+ # version number.
+ echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
+ # And emit a macro defining gcc's version number.
echo gcc_version = ${gcc_version} >> ${Makefile}
# reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
@@ -1478,7 +1478,7 @@ if [ -z "${norecursion}" -a -n "${config
if [ ! -z "${recprog}" ] ; then
if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
- ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} --with-gcc-version=${gcc_version} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
+ ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
true
else
echo Configure in `pwd` failed, exiting. 1>&2
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980625.orig/gcc/Makefile.in egcs-19980625/gcc/Makefile.in
--- egcs-19980625.orig/gcc/Makefile.in Tue Jun 23 16:04:30 1998
+++ egcs-19980625/gcc/Makefile.in Thu Jun 25 11:51:51 1998
@@ -245,7 +245,10 @@ lang_specs_files=@lang_specs_files@
lang_options_files=@lang_options_files@
GCC_THREAD_FILE=@thread_file@
GTHREAD_FLAGS=@gthread_flags@
-version=@version@
+# Be prepared for gcc2 merges.
+gcc_version=@gcc_version@
+gcc_version_trigger=@gcc_version_trigger@
+version=$(gcc_version)
mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
# Common prefix for installation directories.
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980625.orig/gcc/configure.in egcs-19980625/gcc/configure.in
--- egcs-19980625.orig/gcc/configure.in Wed Jun 24 15:21:05 1998
+++ egcs-19980625/gcc/configure.in Thu Jun 25 11:50:15 1998
@@ -3125,8 +3125,13 @@ if [[ x$host_truncate_target != x ]]; th
target=`echo $target | sed -e 's/\(..............\).*/\1/'`
fi
-# Get the version number from the toplevel
-version=`sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/' < ${srcdir}/version.c`
+# Get the version trigger filename from the toplevel
+if [[ "${with_gcc_version_trigger+set}" = set ]]; then
+ gcc_version_trigger=$with_gcc_version_trigger
+else
+ gcc_version_trigger=${srcdir}/version.c
+fi
+gcc_version=`sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/' < ${gcc_version_trigger}`
# Get an absolute path to the GCC top-level source directory
holddir=`pwd`
@@ -3551,7 +3556,8 @@ AC_SUBST(host_xm_file_list)
AC_SUBST(lang_specs_files)
AC_SUBST(lang_options_files)
AC_SUBST(thread_file)
-AC_SUBST(version)
+AC_SUBST(gcc_version)
+AC_SUBST(gcc_version_trigger)
AC_SUBST(local_prefix)
AC_SUBST(gxx_include_dir)
AC_SUBST(fixincludes)
@@ -3654,7 +3660,8 @@ host_xmake_file='${host_xmake_file}'
dep_tmake_file='${dep_tmake_file}'
tmake_file='${tmake_file}'
thread_file='${thread_file}'
-version='${version}'
+gcc_version='${gcc_version}'
+gcc_version_trigger='${gcc_version_trigger}'
local_prefix='${local_prefix}'
build_install_headers_dir='${build_install_headers_dir}'
build_exeext='${build_exeext}'
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980625.orig/libf2c/Makefile.in egcs-19980625/libf2c/Makefile.in
--- egcs-19980625.orig/libf2c/Makefile.in Wed Jun 24 15:11:36 1998
+++ egcs-19980625/libf2c/Makefile.in Thu Jun 25 11:56:00 1998
@@ -28,6 +28,7 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
target_alias = @target_alias@
gcc_version = @gcc_version@
+gcc_version_trigger = @gcc_version_trigger@
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
@@ -193,7 +194,7 @@ ${srcdir}/libU77/configure: ${srcdir}/li
cd $(srcdir)/libU77 && autoconf && rm -f config.cache
g2c.h Makefile: $(srcdir)/g2c.h.in $(srcdir)/Makefile.in config.status
$(SHELL) config.status
-config.status: $(srcdir)/configure
+config.status: $(srcdir)/configure $(gcc_version_trigger)
$(SHELL) config.status --recheck
info install-info clean-info dvi:
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980625.orig/libf2c/configure.in egcs-19980625/libf2c/configure.in
--- egcs-19980625.orig/libf2c/configure.in Wed Jun 24 15:11:36 1998
+++ egcs-19980625/libf2c/configure.in Thu Jun 25 11:54:05 1998
@@ -343,18 +343,17 @@ test -f libF77/makefile && mv libF77/mak
test -f libI77/makefile && mv libI77/makefile libI77/makefile.ori
test -f libU77/makefile && mv libU77/makefile libU77/makefile.ori
-# Get the version number from the toplevel
-if test x${with_gcc_version} = x; then
- # Try to get the version number from a hopefully existing gcc directory.
- if test -d ${srcdir}/../gcc; then
- gcc_version=`sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/' < ${srcdir}/../gcc/version.c`
- else
- gcc_version=UNKNOWN
- fi
+# Get the version trigger filename from the toplevel
+if [[ "${with_gcc_version_trigger+set}" = set ]]; then
+ gcc_version_trigger=$with_gcc_version_trigger
+ gcc_version=`sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/' < ${gcc_version_trigger}`
else
- gcc_version=${with_gcc_version}
+ gcc_version_trigger=
+ gcc_version=UNKNOWN
fi
+
AC_SUBST(gcc_version)
+AC_SUBST(gcc_version_trigger)
AC_CANONICAL_SYSTEM
AC_SUBST(target_alias)
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980625.orig/libio/config.shared egcs-19980625/libio/config.shared
--- egcs-19980625.orig/libio/config.shared Wed Jun 24 15:11:36 1998
+++ egcs-19980625/libio/config.shared Thu Jun 25 11:57:26 1998
@@ -221,6 +221,7 @@ if [ "${SUBDIRS}" != "" ] ; then
echo >&2 ' "gxx_include_dir=$(gxx_include_dir)" \'
echo >&2 ' "libsubdir=$(libsubdir)" \'
echo >&2 ' "gcc_version=$(gcc_version)" \'
+ echo >&2 ' "gcc_version_trigger=$(gcc_version_trigger)" \'
echo >&2 ' "AR=$(AR)" \'
echo >&2 ' "AR_FLAGS=$(AR_FLAGS)" \'
echo >&2 ' "CC=$(CC)" \'
@@ -449,7 +450,7 @@ echo >&2 'force:'
echo >&2 ''
echo >&2 '# with the gnu make, this is done automatically.'
echo >&2 ''
-echo >&2 'Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)'
+echo >&2 'Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) $(gcc_version_trigger)'
echo >&2 ' $(SHELL) ./config.status'
echo >&2 ''
echo >&2 '.NOEXPORT:'