from ...
(handle_languages): ... here.
(handle_languages, define_compiler_variable, define_link_variable):
Honore LIBTOOLFLAGS.
(handle_single_transform): Check _LIBTOOLFLAGS in
addition to other per-target flags for Libtool objects.
(handle_libtool): Warn if LIBTOOLFLAGS is defined.
* doc/automake.texi (Libtool Flags, Program and Library Variables,
Flag Variables Ordering): Document LIBTOOLFLAGS.
* tests/libtool7.test: Check basic support for LIBTOOLFLAGS.
* tests/libtool8.test: Make sure Automake warns about LIBTOOLFLAGS
definitions.
* tests/subobj9.test: Adjust.
+2004-12-12 Alexandre Duret-Lutz <adl@gnu.org>
+
+ * automake.in (check_user_variables): New function, extracted
+ from ...
+ (handle_languages): ... here.
+ (handle_languages, define_compiler_variable, define_link_variable):
+ Honore LIBTOOLFLAGS.
+ (handle_single_transform): Check _LIBTOOLFLAGS in
+ addition to other per-target flags for Libtool objects.
+ (handle_libtool): Warn if LIBTOOLFLAGS is defined.
+ * doc/automake.texi (Libtool Flags, Program and Library Variables,
+ Flag Variables Ordering): Document LIBTOOLFLAGS.
+ * tests/libtool7.test: Check basic support for LIBTOOLFLAGS.
+ * tests/libtool8.test: Make sure Automake warns about LIBTOOLFLAGS
+ definitions.
+ * tests/subobj9.test: Adjust.
+
2004-12-11 Alexandre Duret-Lutz <adl@gnu.org>
* doc/automake.texi (Per-Object Flags): New node.
AM_CPPFLAGS and per-target _CPPFLAGS, and supports dependency
tracking, unlike non-preprocessed assembler (*.s).
+ - Libtool generic flags (those that go before the --mode=MODE option)
+ can be specified using AM_LIBTOOLFLAGS and target_LIBTOOLFLAGS.
+
- aclocal now also supports -Wmumble and -Wno-mumble options.
\f
New in 1.9:
return $extension;
}
+# check_user_variables (@LIST)
+# ----------------------------
+# Make sure each variable VAR in @LIST do not exist, suggest using AM_VAR
+# otherwise.
+sub check_user_variables (@)
+{
+ my @dont_override = @_;
+ foreach my $flag (@dont_override)
+ {
+ my $var = var $flag;
+ if ($var)
+ {
+ for my $cond ($var->conditions->conds)
+ {
+ if ($var->rdef ($cond)->owner == VAR_MAKEFILE)
+ {
+ msg_cond_var ('gnu', $cond, $flag,
+ "`$flag' is a user variable, "
+ . "you should not override it;\n"
+ . "use `AM_$flag' instead.");
+ }
+ }
+ }
+ }
+}
# Call finish function for each language that was used.
sub handle_languages
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
}
+ my $ptltflags = "${derived}_LIBTOOLFLAGS";
+ $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags;
+
my $obj_ltcompile =
- "\$(LIBTOOL) $libtool_tag--mode=compile $obj_compile";
+ "\$(LIBTOOL) $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) "
+ . "--mode=compile $obj_compile";
# We _need_ `-o' for per object rules.
my $output_flag = $lang->output_flag || '-o';
# ... and so is LDFLAGS.
push @dont_override, 'LDFLAGS' if $lang->link;
- foreach my $flag (@dont_override)
- {
- my $var = var $flag;
- if ($var)
- {
- for my $cond ($var->conditions->conds)
- {
- if ($var->rdef ($cond)->owner == VAR_MAKEFILE)
- {
- msg_cond_var ('gnu', $cond, $flag,
- "`$flag' is a user variable, "
- . "you should not override it;\n"
- . "use `AM_$flag' instead.");
- }
- }
- }
- }
+ check_user_variables @dont_override;
}
# If the project is entirely C++ or entirely Fortran 77 (i.e., 1
# Do we have per-executable flags for this executable?
my $have_per_exec_flags = 0;
- foreach my $flag (@{$lang->flags})
+ my @peflags = @{$lang->flags};
+ push @peflags, 'LIBTOOLFLAGS' if $nonansi_obj eq '.lo';
+ foreach my $flag (@peflags)
{
if (set_seen ("${derived}_$flag"))
{
push (@libtool_rms, "\t-rm -rf ${dir}.libs ${dir}_libs");
}
+ check_user_variables 'LIBTOOLFLAGS';
+
# Output the libtool compilation rules.
$output_rules .= &file_contents ('libtool',
new Automake::Location,
# define_variable ($VAR, $VALUE, $WHERE)
# --------------------------------------
-# Define a new user variable VAR to VALUE, but only if not already defined.
+# Define a new Automake Makefile variable VAR to VALUE, but only if
+# not already defined.
sub define_variable ($$$)
{
my ($var, $value, $where) = @_;
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
&define_variable ($var, $value, INTERNAL);
&define_variable ("LT$var",
- "\$(LIBTOOL) $libtool_tag--mode=compile $value",
+ "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) "
+ . "\$(LIBTOOLFLAGS) --mode=compile $value",
INTERNAL)
if var ('LIBTOOL');
}
# CCLINK = $(CCLD) blah blah...
&define_variable ($lang->linker,
((var ('LIBTOOL') ?
- "\$(LIBTOOL) $libtool_tag--mode=link " : '')
+ "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) "
+ . "\$(LIBTOOLFLAGS) --mode=link " : '')
. $lang->link),
INTERNAL);
}
* Conditional Libtool Sources:: Choosing Library Sources Conditionally
* Libtool Convenience Libraries:: Building Convenience Libtool Libraries
* Libtool Modules:: Building Libtool Modules
-* Libtool Flags:: Using _LIBADD and _LDFLAGS
+* Libtool Flags:: Using _LIBADD, _LDFLAGS, and _LIBTOOLFLAGS
* LTLIBOBJS:: Using $(LTLIBOBJS) and $(LTALLOCA)
* Libtool Issues:: Common Issues Related to Libtool's Use
@end menu
the single file @file{mymodule.c} (@pxref{Default _SOURCES}).
@node Libtool Flags
-@subsection _LIBADD and _LDFLAGS
+@subsection @code{_LIBADD}, @code{_LDFLAGS}, and @code{_LIBTOOLFLAGS}
@cindex @code{_LIBADD}, libtool
@cindex @code{_LDFLAGS}, libtool
+@cindex @code{_LIBTOOLFLAGS}, libtool
+@vindex AM_LIBTOOLFLAGS
+@vindex LIBTOOLFLAGS
+@vindex maude_LIBTOOLFLAGS
As shown in previous sections, the @samp{@var{library}_LIBADD}
variable should be used to list extra libtool objects (@file{.lo}
files) or libtool libraries (@file{.la}) to add to @var{library}.
The @samp{@var{library}_LDFLAGS} variable is the place to list
-additional libtool flags, such as @samp{-version-info},
-@samp{-static}, and a lot more. See @xref{Link mode, , Using libltdl,
+additional libtool linking flags, such as @samp{-version-info},
+@samp{-static}, and a lot more. See @xref{Link mode, , Link mode,
libtool, The Libtool Manual}.
+The @command{libtool} command has two kinds of options: mode-specific
+options and generic options. Mode-specific options such as the
+aforementioned linking flags should be lumped with the other flags
+passed to the tool invoked by @command{libtool} (hence the use of
+@samp{@var{library}_LDFLAGS} for libtool linking flags). Generic
+options include @samp{--tag=@var{TAG}} and @samp{--silent}
+(@pxref{Invoking libtool, , Invoking @command{libtool}, libtool, The
+Libtool Manual} for more options) should appear before the mode
+selection on the command line; in @file{Makefile.am}s they should
+be listed in the @samp{@var{library}_LIBTOOLFLAGS} variable.
+
+If @samp{@var{library}_LIBTOOLFLAGS} is not defined, the global
+@samp{AM_LIBTOOLFLAGS} variable is used instead.
+
+These flags are passed to libtool after the @samp{--tag=@var{TAG}}
+option computed by Automake (if any), so
+@samp{@var{library}_LIBTOOLFLAGS} (or @samp{AM_LIBTOOLFLAGS}) is the
+good place to override or supplement the @samp{--tag=@var{TAG}}
+setting.
+
+The libtool rules also use a @code{LIBTOOLFLAGS} variable that should
+not be set in @file{Makefile.am}: this is a user variable (@pxref{Flag
+Variables Ordering}. It allows users to run @samp{make
+LIBTOOLFLAGS=--silent}, for instance.
+
+
@node LTLIBOBJS, Libtool Issues, Libtool Flags, A Shared Library
@subsection @code{LTLIBOBJS} and @code{LTALLOCA}
@cindex @code{LTLIBOBJS}, special handling
This variable is used to pass extra flags to the link step of a program
or a shared library.
+@item maude_LIBTOOLFLAGS
+This variable is used to pass extra options to @command{libtool}.
+These options are output before @command{libtool}'s @code{--mode=MODE}
+option, so they should not be mode-specific options (those belong to
+the compiler or linker flags). @xref{Libtool Flags}.
+
@item maude_DEPENDENCIES
It is also occasionally useful to have a program depend on some other
target which is not actually part of that program. This can be done
@cindex @code{AM_GCJFLAGS} and @code{GCJFLAGS}
@cindex @code{AM_LDFLAGS} and @code{LDFLAGS}
@cindex @code{AM_LFLAGS} and @code{LFLAGS}
+@cindex @code{AM_LIBTOOLFLAGS} and @code{LIBTOOLFLAGS}
@cindex @code{AM_OBJCFLAGS} and @code{OBJCFLAGS}
@cindex @code{AM_RFLAGS} and @code{RFLAGS}
@cindex @code{AM_YFLAGS} and @code{YFLAGS}
@cindex @code{GCJFLAGS} and @code{AM_GCJFLAGS}
@cindex @code{LDFLAGS} and @code{AM_LDFLAGS}
@cindex @code{LFLAGS} and @code{AM_LFLAGS}
+@cindex @code{LIBTOOLFLAGS} and @code{AM_LIBTOOLFLAGS}
@cindex @code{OBJCFLAGS} and @code{AM_OBJCFLAGS}
@cindex @code{RFLAGS} and @code{AM_RFLAGS}
@cindex @code{YFLAGS} and @code{AM_YFLAGS}
answer holds for all the compile flags used in Automake:
@code{CCASFLAGS}, @code{CFLAGS}, @code{CPPFLAGS}, @code{CXXFLAGS},
@code{FCFLAGS}, @code{FFLAGS}, @code{GCJFLAGS}, @code{LDFLAGS},
-@code{LFLAGS}, @code{OBJCFLAGS}, @code{RFLAGS}, and @code{YFLAGS}.
+@code{LFLAGS}, @code{LIBTOOLFLAGS}, @code{OBJCFLAGS}, @code{RFLAGS},
+and @code{YFLAGS}.
@code{CPPFLAGS}, @code{AM_CPPFLAGS}, and @code{mumble_CPPFLAGS} are
three variables that can be used to pass flags to the C preprocessor
@c LocalWords: syscalls perlhist acl pm multitable headitem fdl appendixsec
@c LocalWords: LTALLOCA MALLOC malloc memcmp strdup alloca libcompat xyz DFOO
@c LocalWords: unprefixed buildable preprocessed DBAZ DDATADIR WARNINGCFLAGS
-@c LocalWords: LIBFOOCFLAGS LIBFOOLDFLAGS ftable testSubDir obj
+@c LocalWords: LIBFOOCFLAGS LIBFOOLDFLAGS ftable testSubDir obj LIBTOOLFLAGS
@c LocalWords: barexec Pinard's
-@set UPDATED 10 December 2004
+@set UPDATED 12 December 2004
@set UPDATED-MONTH December 2004
@set EDITION 1.9a
@set VERSION 1.9a
-@set UPDATED 10 December 2004
+@set UPDATED 12 December 2004
@set UPDATED-MONTH December 2004
@set EDITION 1.9a
@set VERSION 1.9a
# Boston, MA 02111-1307, USA.
# Make sure we allow Libtool's -dlopen/-dlpreopen
+# Also check basic support for AM_LIBTOOLFLAGS/LIBTOOLFLAGS
required='libtoolize gcc'
. ./defs || exit 1
cat > Makefile.am << 'END'
AUTOMAKE_OPTIONS = subdir-objects
+AM_LIBTOOLFLAGS = --silent
lib_LTLIBRARIES = libmod1.la mod2.la
libmod1_la_SOURCES = sub/mod1.c
libmod1_la_LDFLAGS = -module
libmod1_la_LIBADD = -dlopen mod2.la
mod2_la_SOURCES = mod2.c
mod2_la_LDFLAGS = -module
+mod2_la_LIBTOOLFLAGS =
bin_PROGRAMS = prg
prg_SOURCES = prg.c
print:
@echo 1BEG: $(prg_DEPENDENCIES) :END1
@echo 2BEG: $(libmod1_la_DEPENDENCIES) :END2
-
+ @echo 3BEG: $(LTCOMPILE) :END3
END
mkdir sub liba
$AUTOMAKE --add-missing --copy
./configure
-$MAKE print >output 2>&1
+env LIBTOOLFLAGS=--silent $MAKE print >output 2>&1
cat output
grep '1BEG: libmod1.la mod2.la :END1' output
grep '2BEG: mod2.la :END2' output
+grep '3BEG: .*silent.*silent.* :END3' output
+test 2 -le `grep mod2_la_LIBTOOLFLAGS Makefile | wc -l`
$MAKE
if COND1
pkglib_LTLIBRARIES = liba.la
endif
+LIBTOOLFLAGS = ouch
endif
END
grep 'Makefile.am:3:.*libc.la.*multiply defined' stderr
grep 'Makefile.am:9:.*`pkglib' stderr
grep 'Makefile.am:2:.*`lib' stderr
+grep 'Makefile.am:11:.*AM_LIBTOOLFLAGS' stderr
cat > Makefile.am << 'END'
noinst_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = src/foo.cc
+
+print:
+ @echo BEG1: "$(LTCXXCOMPILE)" :1END
+ @echo BEG2: "$(CXXLINK)" :2END
END
mkdir src
# opportunistically check that --tag=CXX is used when supported
if test -n "`./libtool --help | grep tag=TAG`"; then
- grep 'LTCXXCOMPILE.*--tag=CXX --mode=compile' Makefile.in
- grep 'CXXLINK.*--tag=CXX --mode=link' Makefile.in
+ $MAKE print >stdout
+ cat stdout
+ grep 'BEG1: .*--tag=CXX.*--mode=compile.* :1END' stdout
+ grep 'BEG2: .*--tag=CXX.*--mode=link.* :2END' stdout
fi
$MAKE