Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 20c77a2

Browse files
committed
[m4] Don't use bash arrays in m4 macros
Fixes #41. Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
1 parent fe312b6 commit 20c77a2

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

m4/log.m4

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,21 @@ dnl
2323
AC_DEFUN([_DLEYNA_LOG_LEVEL_CHECK_VALUE],
2424
[
2525
AS_CASE($1,
26-
[[[1-6]]], [AS_IF([test ${log_array[[${log_level}]]} -ne 0],
26+
[[[1-6]]], [AS_IF([test "x${log_unique}" = xyes],
2727
[
28-
AC_MSG_ERROR(["$1 should be set once"], 1)
29-
],
30-
[test "x${log_single}" = xyes],
31-
[
32-
AC_MSG_ERROR(["Unique value element already set"], 1)
28+
AC_MSG_ERROR(["Log levels 0, 7 and 8 cannot be combined with other values"], 1)
3329
])
30+
let log_level_count++
3431
],
3532
3633
[0|7|8], [AS_IF([test ${log_level_count} -ne 0],
3734
[
38-
AC_MSG_ERROR(["$1 should be a unique value element"], 1)
35+
AC_MSG_ERROR(["Log level $1 cannot be combined with other values"], 1)
3936
])
40-
log_single=yes
37+
log_unique=yes
4138
],
42-
4339
[AC_MSG_ERROR(["$1 is not a valid value"], 1)]
4440
)
45-
46-
log_name=LOG_LEVEL_${log_level}
47-
eval log_value=\$${log_name}
48-
let "LOG_LEVEL |= ${log_value}"
4941
]
5042
)
5143

@@ -57,19 +49,18 @@ AC_DEFUN([DLEYNA_LOG_LEVEL_CHECK],
5749
IFS=","
5850
5951
log_ok=yes
60-
log_single=no
52+
log_unique=no
6153
log_level_count=0
6254
LOG_LEVEL=0
63-
log_array=(0 0 0 0 0 0 0 0 0)
6455
6556
for log_level in $1
6657
do
6758
IFS=${old_IFS}
6859
_DLEYNA_LOG_LEVEL_CHECK_VALUE([$log_level])
6960
IFS=","
70-
71-
let log_level_count++
72-
let log_array[[${log_level}]]++
61+
log_name=LOG_LEVEL_${log_level}
62+
eval log_value=\$${log_name}
63+
let "LOG_LEVEL |= ${log_value}"
7364
done
7465
7566
IFS=${old_IFS}

0 commit comments

Comments
 (0)