#!/bin/sh # -*- sh -*- check_feature() { local feature="$1" local test="$2" if "$CHICKEN_CSC" -C "$CFLAGS" -L "$LDFLAGS" "feature-tests/$test.c" >/dev/null 2>/dev/null; then feature_flags="$feature_flags -D$feature" fi rm -f feature-tests/$feature.o feature-tests/$feature } feature_flags="" check_feature madvise madvise check_feature mmap mmap check_feature posix-fadvise posix-fadvise # Avoid false positives by only compiling when CHICKEN agrees that the # platform matches. if $CHICKEN_CSI -e "(cond-expand ((or netbsd freebsd openbsd) (exit 0)) (else (exit 1)))"; then check_feature sendfile sendfile-bsd fi if $CHICKEN_CSI -e "(cond-expand (linux (exit 0)) (else (exit 1)))"; then check_feature sendfile sendfile-linux fi if $CHICKEN_CSI -e "(cond-expand (macosx (exit 0)) (else (exit 1)))"; then check_feature sendfile sendfile-macos fi if $CHICKEN_CSI -e "(cond-expand (sun (exit 0)) (else (exit 1)))"; then check_feature sendfile sendfile-sun fi "$CHICKEN_CSC" $feature_flags -C "$CFLAGS" -L "$LDFLAGS" "$@"