1 | dnl RTEMS_BSPOPTS_* - some autoconf voodoo to handle default values and |
---|
2 | dnl help-strings for per-BSP-environment variables. |
---|
3 | |
---|
4 | dnl To be used in bsp-configure scripts |
---|
5 | |
---|
6 | |
---|
7 | dnl Example: |
---|
8 | dnl |
---|
9 | dnl RTEMS_BSPOPTS_SET([foo],[bar],[0]) |
---|
10 | dnl RTEMS_BSPOPTS_SET([foo],[baz*],[hello]) |
---|
11 | dnl RTEMS_BSPOPTS_SET([foo],[*],[]) |
---|
12 | dnl RTEMS_BSPOPTS_HELP([foo],[env. variable foo]) |
---|
13 | dnl -> Add "0" as default value of variable "foo" for BSP "bar" |
---|
14 | dnl -> Add "hello" as default value of variable "foo" for all BSPs starting |
---|
15 | dnl with "baz" in their name. |
---|
16 | dnl -> Undefine foo as default clause for all BSP's. |
---|
17 | dnl |
---|
18 | dnl All this basically expands to a /bin/shell "case"-statement with |
---|
19 | dnl accompanying autoconf magic to propagate VAR to bspopts.h. |
---|
20 | |
---|
21 | |
---|
22 | dnl RTEMS_BSPOPTS_HELP(VAR,HELP-STRING) |
---|
23 | dnl Set up printing the HELP-STRING for bspopts.h's variable VAR and add |
---|
24 | dnl appropriate /bin/sh-magic to "configure" to have VAR set up. |
---|
25 | |
---|
26 | AC_DEFUN([RTEMS_BSPOPTS_HELP],[ |
---|
27 | RTEMS_ARG_VAR([$1],[$2]) |
---|
28 | m4_ifdef([_$1],[ |
---|
29 | case "${RTEMS_BSP}" in |
---|
30 | _$1[]dnl |
---|
31 | esac],[]) |
---|
32 | if test -n "[$]{$1}"; then[]dnl |
---|
33 | AC_DEFINE_UNQUOTED([$1], |
---|
34 | [[$]$1], |
---|
35 | [$2])dnl |
---|
36 | fi |
---|
37 | ]) |
---|
38 | |
---|
39 | dnl RTEMS_BSPOPTS_SET(VAR,BSP,DEFAULT) |
---|
40 | dnl Set up a value DEFAULT to be used as default value for variable VAR for |
---|
41 | dnl BSP in RTEMS_BSPOPTS_HELP. |
---|
42 | |
---|
43 | dnl MUST be used in front of exactly _one_ corresponding RTEMS_BSPOPTS_HELP |
---|
44 | |
---|
45 | AC_DEFUN([RTEMS_BSPOPTS_SET],[dnl |
---|
46 | m4_append([_$1], |
---|
47 | [$2 ) |
---|
48 | $1=[$]{$1-$3} ;; |
---|
49 | ]) |
---|
50 | ]) |
---|
51 | |
---|
52 | |
---|
53 | dnl RTEMS_ARG_VAR(VAR,HELP-STRING) |
---|
54 | dnl An internal macros to have RTEMS_BSPOPTS_HELP's help string pretty |
---|
55 | dnl printed with configure --help. |
---|
56 | dnl Stripped down version of autoconf-2.52's AC_ARG_VAR. |
---|
57 | |
---|
58 | AC_DEFUN([RTEMS_ARG_VAR], |
---|
59 | [ |
---|
60 | m4_expand_once([m4_divert_once([HELP_VAR], |
---|
61 | [AS_HELP_STRING([$1],[$2], )])], |
---|
62 | [$0($1)])dnl |
---|
63 | ]) |
---|
64 | |
---|
65 | AC_DEFUN( |
---|
66 | [RTEMS_BSPOPTS_SET_DATA_CACHE_ENABLED], |
---|
67 | [RTEMS_BSPOPTS_SET([BSP_DATA_CACHE_ENABLED],[$1],[$2])]) |
---|
68 | |
---|
69 | AC_DEFUN( |
---|
70 | [RTEMS_BSPOPTS_HELP_DATA_CACHE_ENABLED], |
---|
71 | [RTEMS_BSPOPTS_HELP([BSP_DATA_CACHE_ENABLED], |
---|
72 | [enables the data cache, if defined to a value other than zero])]) |
---|
73 | |
---|
74 | AC_DEFUN( |
---|
75 | [RTEMS_BSPOPTS_SET_INSTRUCTION_CACHE_ENABLED], |
---|
76 | [RTEMS_BSPOPTS_SET([BSP_INSTRUCTION_CACHE_ENABLED],[$1],[$2])]) |
---|
77 | |
---|
78 | AC_DEFUN( |
---|
79 | [RTEMS_BSPOPTS_HELP_INSTRUCTION_CACHE_ENABLED], |
---|
80 | [RTEMS_BSPOPTS_HELP([BSP_INSTRUCTION_CACHE_ENABLED], |
---|
81 | [enables the instruction cache, if defined to a value other than zero])]) |
---|