diff options
| author | Roy Marples <roy@marples.name> | 2015-01-31 01:02:07 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2015-01-31 01:02:07 +0000 |
| commit | f94b4eab068a6c0c1a9cdf61113e8a508632cc51 (patch) | |
| tree | e15cab3e59f6314b0477c41febc1b658f876291f /configure | |
| parent | 505d71953c5fb9a9d072f0338eb1c01a154b7cd8 (diff) | |
| download | dhcpcd-f94b4eab068a6c0c1a9cdf61113e8a508632cc51.tar.xz | |
Use strtoi(3) and strtou(3) from NetBSD-8 instead of the harder to use
strtol(3) calls.
Add shims around strtoimax(3) and strtoumax(3) when these functions
are not available.
Diffstat (limited to 'configure')
| -rwxr-xr-x | configure | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -636,6 +636,30 @@ if [ "$STRLCPY" = no ]; then echo "#include \"compat/strlcpy.h\"" >>$CONFIG_H fi +if [ -z "$STRTOI" ]; then + printf "Testing for strtoi ... " + cat <<EOF >_strtoi.c +#include <stdlib.h> +#include <limits.h> +#include <inttypes.h> +int main(void) { + int e; + return strtoi("1234", NULL, 0, 0, INT32_MAX, &e); +} +EOF + if $XCC _strtoi.c -o _strtoi 2>&3; then + STRTOI=yes + else + STRTOI=no + fi + echo "$STRTOI" + rm -f _strtoi.c _strtoi +fi +if [ "$STRTOI" = no ]; then + echo "COMPAT_SRCS+= compat/strtoi.c" >>$CONFIG_MK + echo "#include \"compat/strtoi.h\"" >>$CONFIG_H +fi + if [ -z "$DPRINTF" ]; then printf "Testing for dprintf ... " cat <<EOF >_dprintf.c |
