This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] classpath build machinery nits


Hello,

Two nits related to Autoconf and Automake in classpath build machinery:

1) Autoconf cache variables have to match *_cv_* in order to be saved in
the cache file (Autoconf 2.62 will warn about this).

2) Automake 1.9.6 (and current) has a somewhat peculiar bug in that

-- configure.ac --
if $condition; then
  AC_CONFIG_FILES([prog])
fi

-- Makefile.am
if COND
bin_SCRIPTS = prog
else
bin_PROGRAMS = prog
prog_SOURCES = ...
endif


will not cause the rules for the prog$(EXEEXT) binary nor those for the
prog script to be disabled if respective condition is not met.  (The
first is a bug, the second a limitation: automake cannot understand
shell conditionals in configure.ac).

This leads to these well-known warnings:
| Makefile:643: warning: overriding commands for target `gappletviewer'
| Makefile:575: warning: ignoring old commands for target `gappletviewer'

In the default configuration (shell wrappers used), it also leads to a
bug: if I happen to update, say, tools/gappletviewer.in after
config.status has run, then
  cd tools && make gappletviewer

tries to link a binary from zero objects, and fails.

I am still looking into a proper fix for the bug inside Automake.
Meanwhile, here's a simple workaround that fixes the rebuild rules.
It's somewhat of a hack as it relies on an Automake limitation and
another Automake bug: adding stub dependencies, automake thinks that
these are rules, and will thus hide the prog$(EXEEXT) link rules under
the conditional.  It still won't hide its own-supplied config.status
rules for the prog scripts, however.

In the case where we want the scripts, this results in a Makefile that
does exactly the right thing (and causes no make warnings), in the
--enable-tool-wrappers case, there are still 2 sets of conflicting
rules (thus also warnings), but here we at least now may depend on the
fact that the desirable rules are listed last, thus make does the right
thing again.

OK for trunk?  If yes, can someone push this upstream in classpath for
me?

Thanks,
Ralf

libjava/classpath/ChangeLog:
2008-03-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* m4/gcc_attribute.m4 (GCC_ATTRIBUTE): Fix cache variable name.
	* tools/Makefile.am (gappletviewer, gjarsigner, gkeytool, gjar)
	(gnative2ascii, gserialver, gjavah, grmiregistry, gtnameserv)
	(gorbd, grmid, grmic) [!CREATE_WRAPPERS]: Add stub dependencies
	for these scripts, to trick automake into hiding the respective
	rules for the programs below the CREATE_WRAPPERS conditional.

diff --git a/libjava/classpath/m4/gcc_attribute.m4 b/libjava/classpath/m4/gcc_attribute.m4
index f0c2572..f332d21 100644
--- a/libjava/classpath/m4/gcc_attribute.m4
+++ b/libjava/classpath/m4/gcc_attribute.m4
@@ -15,7 +15,7 @@ AC_DEFUN([CACHED_TRY_COMPILE],[
 
 dnl GCC_ATTRIBUTE(<short-label>,<cachevar>,<func-params>,<attribute>,<HAVE>,<desc>,[<true-cmds>],[<false-cmds>])
 AC_DEFUN([GCC_ATTRIBUTE],[
-  CACHED_TRY_COMPILE(__attribute__(($1)),cv_c_gcc_attribute_$2,,
+  CACHED_TRY_COMPILE(__attribute__(($1)),gcc_cv_c_gcc_attribute_$2,,
    [extern int testfunction($3) __attribute__(($4))],
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_GNUC25_$5,,$6)
diff --git a/libjava/classpath/tools/Makefile.am b/libjava/classpath/tools/Makefile.am
index de54eed..773157d 100755
--- a/libjava/classpath/tools/Makefile.am
+++ b/libjava/classpath/tools/Makefile.am
@@ -100,6 +100,19 @@ noinst_SCRIPTS = gappletviewer gjarsigner gkeytool \
 	gjar gnative2ascii gserialver gjavah grmiregistry \
 	gtnameserv gorbd grmid grmic
 bin_PROGRAMS =
+## FIXME: revisit this with a newer automake.
+gappletviewer: gappletviewer.in
+gjarsigner: gjarsigner.in
+gkeytool: gkeytool.in
+gjar: gjar.in
+gnative2ascii: gnative2ascii.in
+gserialver: gserialver.in
+gjavah: gjavah.in
+grmiregistry: grmiregistry.in
+gtnameserv: gtnameserv.in
+gorbd: gorbd.in
+grmid: grmid.in
+grmic: grmic.in
 endif
 EXTRA_DIST = toolwrapper.c gappletviewer.in gjarsigner.in gkeytool.in \
 	gjar.in gnative2ascii.in gserialver.in gjavah.in grmiregistry.in \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]