diff options
author | rofl0r <retnyg@gmx.net> | 2015-10-01 16:06:14 +0300 |
---|---|---|
committer | rofl0r <retnyg@gmx.net> | 2015-10-01 16:14:23 +0300 |
commit | 1294d0a004686e390df9d65a08b9e2f90fd7b709 (patch) | |
tree | af2fccf854527853da036e16e519f81de75e847b | |
parent | e9bf9623ba849b5287823f6db768ad58e7565634 (diff) |
configure: check for availability of s6_addr16
this should fix the build of the recently added ipv6 code on MacOS X,
OpenBSD and eventually FreeBSD.
closes #83
closes #85
thanks to @cam13 and @vonnyfly for reporting/testing.
-rwxr-xr-x | configure | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -18,6 +18,20 @@ isopenbsd() { uname -s | grep OpenBSD >/dev/null } +check_compile() { + printf "checking %s ... " "$1" + local tmp=$(mktemp) + printf "$3" > "$tmp".c + local res=0 + $CC $CPPFLAGS $2 $CFLAGS -c "$tmp".c -o "$tmp".o >/dev/null 2>&1 \ + || res=1 + rm -f "$tmp".c "$tmp".o + test x$res = x0 && \ + { printf "yes\n" ; test x"$2" = x || CPPFLAGS="$CPPFLAGS $2" ; } \ + || printf "no\n" + return $res +} + usage() { echo "supported arguments" echo "--prefix=/path default: $prefix" @@ -89,6 +103,14 @@ if [ -z "$CC" ] ; then CC=cc fi +check_compile 'whether netinet/in.h defines s6_addr16' "" \ +'#include <netinet/in.h>\nint main(int a, char**c){struct in6_addr x={.s6_addr32[0]=a};return x.s6_addr16[0]; }' \ +|| { +check_compile 'whether netinet/in.h defines __u6_addr.__u6_addr16' \ +'-Ds6_addr16=__u6_addr.__u6_addr16 -Ds6_addr32=__u6_addr.__u6_addr32' \ +'#include <netinet/in.h>\nint main(int a, char**c){struct in6_addr x={.s6_addr32[0]=a};return x.s6_addr16[0]; }' +} + echo CC?=$CC>config.mak [ -z "$CPPFLAGS" ] || echo CPPFLAGS?=$CPPFLAGS>>config.mak [ -z "$CFLAGS" ] || echo USER_CFLAGS?=$CFLAGS>>config.mak |