diff options
author | Josh Triplett <josh@freedesktop.org> | 2008-06-01 17:56:01 -0700 |
---|---|---|
committer | Josh Triplett <josh@freedesktop.org> | 2008-06-01 17:56:01 -0700 |
commit | fb640ed2c980dcd20edd98a7da2b7a3bc411a888 (patch) | |
tree | a992e936c53dbc0c15400ea65c9619697571c610 | |
parent | d91f2b4e9041538400e2703a2a6fbeecdb8ee27d (diff) |
Add a doltlibtool script to substitute for $(LIBTOOL)
When automake encounters a target with target-specific CFLAGS, it
generates a Makefile rule that calls $(LIBTOOL) directly rather than
using $(LTCOMPILE) or $(LTCXXCOMPILE). To handle this case, write out
a doltlibtool script and substitute it for $(LIBTOOL). doltlibtool
invokes doltcompile if given --mode=compile and --tag={CC,CXX}, and
falls back to libtool for any other invocation.
Thanks to Alp Toker for testing.
-rw-r--r-- | dolt.m4 | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -130,6 +130,37 @@ dnl Done writing out doltcompile; substitute it for libtool compilation. chmod +x doltcompile LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)' LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)' + +dnl automake ignores LTCOMPILE and LTCXXCOMPILE when it has separate CFLAGS for +dnl a target, so write out a libtool wrapper to handle that case. +dnl Note that doltlibtool does not handle inferred tags or option arguments +dnl without '=', because automake does not use them. + cat <<__DOLTLIBTOOL__EOF__ > doltlibtool +#!$DOLT_BASH +__DOLTLIBTOOL__EOF__ + cat <<'__DOLTLIBTOOL__EOF__' >>doltlibtool +top_builddir_slash="${0%%doltlibtool}" +: ${top_builddir_slash:=./} +args=() +modeok=false +tagok=false +for arg in "$[]@"; do + case "$arg" in + --mode=compile) modeok=true ;; + --tag=CC|--tag=CXX) tagok=true ;; + *) args+=("$arg") + esac +done +if $modeok && $tagok ; then + . ${top_builddir_slash}doltcompile "${args@<:@@@:>@}" +else + exec ${top_builddir_slash}libtool "$[]@" +fi +__DOLTLIBTOOL__EOF__ + +dnl Done writing out doltlibtool; substitute it for libtool. + chmod +x doltlibtool + LIBTOOL='$(top_builddir)/doltlibtool' fi AC_SUBST(LTCOMPILE) AC_SUBST(LTCXXCOMPILE) |