@@ -93,6 +93,7 @@ debug=0
9393address=0
9494memory=0
9595unknown=0
96+ enable_crcvx=1
9697old_cc=" $CC "
9798old_cflags=" $CFLAGS "
9899OBJC=' $(OBJZ) $(OBJG)'
@@ -120,6 +121,7 @@ case "$1" in
120121 echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
121122 echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
122123 echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
124+ echo ' [--disable-crcvx]' | tee -a configure.log
123125 exit 0 ;;
124126 -p* =* | --prefix=* ) prefix=` echo $1 | sed ' s/.*=//' ` ; shift ;;
125127 -e* =* | --eprefix=* ) exec_prefix=` echo $1 | sed ' s/.*=//' ` ; shift ;;
@@ -146,6 +148,7 @@ case "$1" in
146148 --sanitize) address=1; shift ;;
147149 --address) address=1; shift ;;
148150 --memory) memory=1; shift ;;
151+ --disable-crcvx) enable_crcvx=0; shift ;;
149152 * ) unknown=1; echo " unknown option ignored: $1 " | tee -a configure.log; shift ;;
150153 esac
151154done
870873 fi
871874fi
872875
876+ # check for ibm s390x build
877+ HAVE_S390X=0
878+ cat > $test .c << EOF
879+ #ifndef __s390x__
880+ #error
881+ #endif
882+ EOF
883+ if try $CC -c $CFLAGS $test .c; then
884+ echo " Checking for s390x build ... Yes." | tee -a configure.log
885+ HAVE_S390X=1
886+ else
887+ echo " Checking for s390x build ... No." | tee -a configure.log
888+ fi
889+
890+ # check for ibm s390x vx vector extensions
891+ HAVE_S390X_VX=0
892+ if test $HAVE_S390X -eq 1 && test $enable_crcvx -eq 1 ; then
893+ # preset the compiler specific flags
894+ if test $clang -eq 1; then
895+ VGFMAFLAG=-fzvector
896+ else
897+ VGFMAFLAG=-mzarch
898+ fi
899+
900+ cat > $test .c << EOF
901+ #ifndef __s390x__
902+ #error
903+ #endif
904+ #include <vecintrin.h>
905+ int main(void) {
906+ unsigned long long a __attribute__((vector_size(16))) = { 0 };
907+ unsigned long long b __attribute__((vector_size(16))) = { 0 };
908+ unsigned char c __attribute__((vector_size(16))) = { 0 };
909+ c = vec_gfmsum_accum_128(a, b, c);
910+ return c[0];
911+ }
912+ EOF
913+
914+ # cflags already contains a valid march
915+ if try $CC -c $CFLAGS $VGFMAFLAG $test .c; then
916+ echo " Checking for s390x vx vector extension ... Yes." | tee -a configure.log
917+ HAVE_S390X_VX=1
918+ # or set march for our compile units
919+ elif try $CC -c $CFLAGS $VGFMAFLAG -march=z13 $test .c; then
920+ echo " Checking for s390x vx vector extension (march=z13) ... Yes." | tee -a configure.log
921+ HAVE_S390X_VX=1
922+ VGFMAFLAG=" $VGFMAFLAG -march=z13"
923+ # else we are not on s390x
924+ else
925+ echo " Checking for s390x vx vector extension ... No." | tee -a configure.log
926+ fi
927+
928+ # prepare compiling for s390x
929+ if test $HAVE_S390X_VX -eq 1; then
930+ CFLAGS=" $CFLAGS -DHAVE_S390X_VX"
931+ SFLAGS=" $SFLAGS -DHAVE_S390X_VX"
932+ OBJC=" $OBJC crc32_vx.o"
933+ PIC_OBJC=" $PIC_OBJC crc32_vx.lo"
934+ else
935+ # target has no vx extension
936+ VGFMAFLAG=" "
937+ fi
938+ fi
939+
873940# show the results in the log
874941echo >> configure.log
875942echo ALL = $ALL >> configure.log
@@ -901,6 +968,9 @@ echo mandir = $mandir >> configure.log
901968echo prefix = $prefix >> configure.log
902969echo sharedlibdir = $sharedlibdir >> configure.log
903970echo uname = $uname >> configure.log
971+ echo HAVE_S390X = $HAVE_S390X >> configure.log
972+ echo HAVE_S390X_VX = $HAVE_S390X_VX >> configure.log
973+ echo VGFMAFLAG = $VGFMAFLAG >> configure.log
904974
905975# update Makefile with the configure results
906976sed < ${SRCDIR} Makefile.in "
0 commit comments