source: rtems/aclocal/bspopts.m4 @ d0d73ec

4.104.114.84.95
Last change on this file since d0d73ec was 7ee86ba7, checked in by Joel Sherrill <joel.sherrill@…>, on 11/14/01 at 18:57:26

2001-11-14 Ralf Corsepius <corsepiu@…>

  • aclocal/bspopts.m4: New file.
  • Property mode set to 100644
File size: 1.7 KB
Line 
1dnl $Id$
2dnl
3
4dnl RTEMS_BSPOPTS_* - some autoconf voodoo to handle default values and
5dnl help-strings for per-BSP-environment variables.
6
7dnl To be used in bsp-configure scripts
8
9
10dnl Example:
11dnl
12dnl RTEMS_BSPOPTS_SET([foo],[bar],[0])
13dnl RTEMS_BSPOPTS_SET([foo],[baz*],[hello])
14dnl RTEMS_BSPOPTS_SET([foo],[*],[])
15dnl RTEMS_BSPOPTS_HELP([foo],[env. variable foo])
16dnl -> Add "0" as default value of variable "foo" for BSP "bar"
17dnl -> Add "hello" as default value of variable "foo" for all BSPs starting
18dnl with "baz" in their name.
19dnl -> Undefine foo as default clause for all BSP's.
20dnl
21dnl All this basically expands to a /bin/shell "case"-statement with
22dnl accompanying autoconf magic to propagate VAR to bspopts.h.
23
24
25dnl RTEMS_BSPOPTS_HELP(VAR,HELP-STRING)
26dnl Set up printing the HELP-STRING for bspopts.h's variable VAR and add
27dnl appropriate /bin/sh-magic to "configure" to have VAR set up.
28
29AC_DEFUN([RTEMS_BSPOPTS_HELP],[
30RTEMS_ARG_VAR([$1],[$2])
31m4_ifdef([_$1],[
32case ${RTEMS_BSP} in
33_$1[]dnl
34esac],[])
35if test -n "[$]{$1}"; then[]dnl
36AC_DEFINE_UNQUOTED([$1],
37  [[$]$1],
38  [$2])dnl
39fi
40])
41
42dnl RTEMS_BSPOPTS_SET(VAR,BSP,DEFAULT)
43dnl Set up a value DEFAULT to be used as default value for variable VAR for
44dnl BSP in RTEMS_BSPOPTS_HELP.
45
46dnl MUST be use in front of exactly _one_ corresponding RTEMS_BSPOPTS_HELP
47
48AC_DEFUN([RTEMS_BSPOPTS_SET],[dnl
49m4_append([_$1],
50[$2 )
51  $1=[$]{$1-$3} ;;
52])
53])
54
55
56dnl RTEMS_ARG_VAR(VAR,HELP-STRING)
57dnl An internal macros to have RTEMS_BSPOPTS_HELP's help string pretty
58dnl printed with configure --help.
59dnl Stripped down version of autoconf-2.52's AC_ARG_VAR.
60
61AC_DEFUN([RTEMS_ARG_VAR],
62[
63m4_expand_once([m4_divert_once([HELP_VAR],
64[AC_HELP_STRING([$1], [$2], [              ])])],
65      [$0($1)])dnl
66])
Note: See TracBrowser for help on using the repository browser.