Initial commit
[authen-passphrase-scrypt.git] / scrypt-1.2.1 / libcperciva / cpusupport / Build / cpusupport.sh
1 # Should be sourced by `command -p sh path/to/cpusupport.sh "$PATH"` from
2 # within a Makefile.
3 if ! [ ${PATH} = "$1" ]; then
4 echo "WARNING: POSIX violation: $SHELL's command -p resets \$PATH" 1>&2
5 PATH=$1
6 fi
7 # Standard output should be written to cpusupport-config.h, which is both a
8 # C header file defining CPUSUPPORT_ARCH_FEATURE macros and sourceable sh
9 # code which sets CFLAGS_ARCH_FEATURE environment variables.
10 SRCDIR=`command -p dirname "$0"`
11
12 feature() {
13 ARCH=$1
14 FEATURE=$2
15 shift 2;
16 if ! [ -f ${SRCDIR}/cpusupport-$ARCH-$FEATURE.c ]; then
17 return
18 fi
19 printf "Checking if compiler supports $ARCH $FEATURE feature..." 1>&2
20 for CFLAG in "$@"; do
21 if ${CC} ${CFLAGS} -D_POSIX_C_SOURCE=200809L ${CFLAG} \
22 ${SRCDIR}/cpusupport-$ARCH-$FEATURE.c 2>/dev/null; then
23 rm -f a.out
24 break;
25 fi
26 CFLAG=NOTSUPPORTED;
27 done
28 case $CFLAG in
29 NOTSUPPORTED)
30 echo " no" 1>&2
31 ;;
32 "")
33 echo " yes" 1>&2
34 echo "#define CPUSUPPORT_${ARCH}_${FEATURE} 1"
35 ;;
36 *)
37 echo " yes, via $CFLAG" 1>&2
38 echo "#define CPUSUPPORT_${ARCH}_${FEATURE} 1"
39 echo "#ifdef cpusupport_dummy"
40 echo "export CFLAGS_${ARCH}_${FEATURE}=\"${CFLAG}\""
41 echo "#endif"
42 ;;
43 esac
44 }
45
46 feature X86 CPUID ""
47 feature X86 SSE2 "" "-msse2" "-msse2 -Wno-cast-align"
48 feature X86 AESNI "" "-maes" "-maes -Wno-cast-align" "-maes -Wno-missing-prototypes -Wno-cast-qual"
This page took 0.023564 seconds and 4 git commands to generate.