@@ -95,6 +95,7 @@ memory=0
9595undefined=0
9696insecure=0
9797unknown=0
98+ enable_crcvx=1
9899old_cc=" $CC "
99100old_cflags=" $CFLAGS "
100101OBJC=' $(OBJZ) $(OBJG)'
@@ -122,6 +123,7 @@ case "$1" in
122123 echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
123124 echo ' [--insecure] [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
124125 echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
126+ echo ' [--disable-crcvx]' | tee -a configure.log
125127 exit 0 ;;
126128 -p* =* | --prefix=* ) prefix=` echo $1 | sed ' s/.*=//' ` ; shift ;;
127129 -e* =* | --eprefix=* ) exec_prefix=` echo $1 | sed ' s/.*=//' ` ; shift ;;
@@ -150,6 +152,7 @@ case "$1" in
150152 --memory) memory=1; shift ;;
151153 --undefined) undefined=1; shift ;;
152154 --insecure) insecure=1; shift ;;
155+ --disable-crcvx) enable_crcvx=0; shift ;;
153156 * ) unknown=1; echo " unknown option ignored: $1 " | tee -a configure.log; shift ;;
154157 esac
155158done
888891 fi
889892fi
890893
894+ # check for ibm s390x build
895+ HAVE_S390X=0
896+ cat > $test .c << EOF
897+ #ifndef __s390x__
898+ #error
899+ #endif
900+ EOF
901+ if try $CC -c $CFLAGS $test .c; then
902+ echo " Checking for s390x build ... Yes." | tee -a configure.log
903+ HAVE_S390X=1
904+ else
905+ echo " Checking for s390x build ... No." | tee -a configure.log
906+ fi
907+
908+ # check for ibm s390x vx vector extensions
909+ HAVE_S390X_VX=0
910+ if test $HAVE_S390X -eq 1 && test $enable_crcvx -eq 1 ; then
911+ # preset the compiler specific flags
912+ if test $clang -eq 1; then
913+ VGFMAFLAG=-fzvector
914+ else
915+ VGFMAFLAG=-mzarch
916+ fi
917+
918+ cat > $test .c << EOF
919+ #ifndef __s390x__
920+ #error
921+ #endif
922+ #include <vecintrin.h>
923+ int main(void) {
924+ unsigned long long a __attribute__((vector_size(16))) = { 0 };
925+ unsigned long long b __attribute__((vector_size(16))) = { 0 };
926+ unsigned char c __attribute__((vector_size(16))) = { 0 };
927+ c = vec_gfmsum_accum_128(a, b, c);
928+ return c[0];
929+ }
930+ EOF
931+
932+ # cflags already contains a valid march
933+ if try $CC -c $CFLAGS $VGFMAFLAG $test .c; then
934+ echo " Checking for s390x vx vector extension ... Yes." | tee -a configure.log
935+ HAVE_S390X_VX=1
936+ # or set march for our compile units
937+ elif try $CC -c $CFLAGS $VGFMAFLAG -march=z13 $test .c; then
938+ echo " Checking for s390x vx vector extension (march=z13) ... Yes." | tee -a configure.log
939+ HAVE_S390X_VX=1
940+ VGFMAFLAG=" $VGFMAFLAG -march=z13"
941+ # else we are not on s390x
942+ else
943+ echo " Checking for s390x vx vector extension ... No." | tee -a configure.log
944+ fi
945+
946+ # prepare compiling for s390x
947+ if test $HAVE_S390X_VX -eq 1; then
948+ CFLAGS=" $CFLAGS -DHAVE_S390X_VX"
949+ SFLAGS=" $SFLAGS -DHAVE_S390X_VX"
950+ OBJC=" $OBJC crc32_vx.o"
951+ PIC_OBJC=" $PIC_OBJC crc32_vx.lo"
952+ else
953+ # target has no vx extension
954+ VGFMAFLAG=" "
955+ fi
956+ fi
957+
891958# show the results in the log
892959echo >> configure.log
893960echo ALL = $ALL >> configure.log
@@ -919,6 +986,9 @@ echo mandir = $mandir >> configure.log
919986echo prefix = $prefix >> configure.log
920987echo sharedlibdir = $sharedlibdir >> configure.log
921988echo uname = $uname >> configure.log
989+ echo HAVE_S390X = $HAVE_S390X >> configure.log
990+ echo HAVE_S390X_VX = $HAVE_S390X_VX >> configure.log
991+ echo VGFMAFLAG = $VGFMAFLAG >> configure.log
922992
923993# update Makefile with the configure results
924994sed < ${SRCDIR} Makefile.in "
0 commit comments