[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple --with-foo possible?
From: |
Thomas Schwinge |
Subject: |
Re: Multiple --with-foo possible? |
Date: |
Sun, 6 Apr 2008 12:50:13 +0200 |
User-agent: |
Mutt/1.5.11 |
Hello!
On Sat, Apr 05, 2008 at 02:23:22PM +0200, Ralf Wildenhues wrote:
> OK. There are a couple of issues you have to deal with then:
Ralf, thanks for your help!
> Second, you have to actually get at the switches that were used. I
> think you can proceed similarly to the algorithm used by _AC_CACHE_DUMP
> to enumerate all variables, then work from that; see the respective
> macros in autoconf/lib/autoconf/general.m4. Beware, this is tricky
> code, and full of portability pitfalls, too, if you have to cater to
> different shells.
Such portability is not our main concern at the moment, so I implemented
this rather sloppily. Also there is a lot of error handling missing.
Nevertheless, here is what I've come up with, in case someone should be
searching mail archives in the future. Also there are two questions
about AS_HELP_STRING, see the inlined comments.
AC_ARG_WITH([module],
dnl TODO. Want to use commas instead of exclamation marks, but aclocal doesn't
dnl like that. TODO. Squared brackets are not being shown in help output.
AS_HELP_STRING([--with-module-ID=PATH!PRIORITY!SHARE[!COMMAND
LINE]],
[add a module]))
[rm -f modules.h modules-1.h modules.S modules-files &&
for m in $(
set |
grep ^with_module_ |
{ IFS== &&
while read m r; do
echo $m
done
}
)
do
eval v=\$$m &&
m=$(expr $m : with_module_\\\(.\*\\\)) &&
echo $m,"$v" |
{ IFS=, &&
read m f p s c &&
cat >> modules.h <<EOS &&
extern char ${m}_start, ${m}_end;
EOS
cat >> modules-1.h <<EOS &&
{ "$m", $p, $s, "$c", &${m}_start, &${m}_end },
EOS
cat >> modules.S <<EOS &&
.data
/* Include the binary. Make it page aligned. */
.global ${m}_start, ${m}_end
${m}_start:
.incbin "$f"
${m}_end:
EOS
echo "$f" >> modules-files
}
done &&
cat >> modules.h <<EOS &&
struct module modules[] = {
EOS
cat >> modules.h < modules-1.h &&
rm -f modules-1.h &&
cat >> modules.h <<EOS &&
};
EOS
MODULES_FILES=$(echo $(cat modules-files)) &&
rm -f modules-files]
AC_SUBST([MODULES_FILES])
Regards,
Thomas
signature.asc
Description: Digital signature