diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-20 08:43:10 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-20 08:43:10 +0000 |
commit | 078323010b5d88485748d05e512d451b876992b5 (patch) | |
tree | e7111140dd305eeedee2c4a3cfb0c0f45fc29a34 /miscutils | |
parent | b730474bda4a964930e8013301ace7b49a0c5726 (diff) | |
download | busybox-w32-078323010b5d88485748d05e512d451b876992b5.tar.gz busybox-w32-078323010b5d88485748d05e512d451b876992b5.tar.bz2 busybox-w32-078323010b5d88485748d05e512d451b876992b5.zip |
dc: conditionalize parts which require libm
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/Config.in | 8 | ||||
-rw-r--r-- | miscutils/dc.c | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/miscutils/Config.in b/miscutils/Config.in index 0c80ae6e9..15f677a73 100644 --- a/miscutils/Config.in +++ b/miscutils/Config.in | |||
@@ -138,6 +138,14 @@ config DC | |||
138 | Dc is a reverse-polish desk calculator which supports unlimited | 138 | Dc is a reverse-polish desk calculator which supports unlimited |
139 | precision arithmetic. | 139 | precision arithmetic. |
140 | 140 | ||
141 | config FEATURE_DC_LIBM | ||
142 | bool "Enable power and exp functions (requires libm)" | ||
143 | default n | ||
144 | depends on DC | ||
145 | help | ||
146 | Enable power and exp functions. | ||
147 | NOTE: This will require libm to be present for linking. | ||
148 | |||
141 | config DEVFSD | 149 | config DEVFSD |
142 | bool "devfsd (obsolete)" | 150 | bool "devfsd (obsolete)" |
143 | default n | 151 | default n |
diff --git a/miscutils/dc.c b/miscutils/dc.c index 47ec060c8..7d5886eb2 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c | |||
@@ -53,12 +53,14 @@ static void mul(void) | |||
53 | push(pop() * pop()); | 53 | push(pop() * pop()); |
54 | } | 54 | } |
55 | 55 | ||
56 | #if ENABLE_FEATURE_DC_LIBM | ||
56 | static void power(void) | 57 | static void power(void) |
57 | { | 58 | { |
58 | double topower = pop(); | 59 | double topower = pop(); |
59 | 60 | ||
60 | push(pow(pop(), topower)); | 61 | push(pow(pop(), topower)); |
61 | } | 62 | } |
63 | #endif | ||
62 | 64 | ||
63 | static void divide(void) | 65 | static void divide(void) |
64 | { | 66 | { |
@@ -137,9 +139,11 @@ static const struct op operators[] = { | |||
137 | {"mul", mul}, | 139 | {"mul", mul}, |
138 | {"/", divide}, | 140 | {"/", divide}, |
139 | {"div", divide}, | 141 | {"div", divide}, |
142 | #if ENABLE_FEATURE_DC_LIBM | ||
140 | {"**", power}, | 143 | {"**", power}, |
141 | {"exp", power}, | 144 | {"exp", power}, |
142 | {"pow", power}, | 145 | {"pow", power}, |
146 | #endif | ||
143 | {"%", mod}, | 147 | {"%", mod}, |
144 | {"mod", mod}, | 148 | {"mod", mod}, |
145 | {"and", and}, | 149 | {"and", and}, |