870
870
fi
871
871
fi
872
872
873
+ # check for ibm s390x build
874
+ HAVE_S390X=0
875
+
876
+ # preset the compiler specific flags
877
+ if test $clang -eq 1; then
878
+ VGFMAFLAG=-fzvector
879
+ else
880
+ VGFMAFLAG=-mzarch
881
+ fi
882
+
883
+ cat > $test .c << EOF
884
+ #ifndef __s390x__
885
+ #error
886
+ #endif
887
+ #include <vecintrin.h>
888
+ int main(void) {
889
+ unsigned long long a __attribute__((vector_size(16))) = { 0 };
890
+ unsigned long long b __attribute__((vector_size(16))) = { 0 };
891
+ unsigned char c __attribute__((vector_size(16))) = { 0 };
892
+ c = vec_gfmsum_accum_128(a, b, c);
893
+ return c[0];
894
+ }
895
+ EOF
896
+
897
+ # cflags already contains a valid march
898
+ if try $CC -c $CFLAGS $VGFMAFLAG $test .c; then
899
+ echo " Checking for s390x build ... Yes." | tee -a configure.log
900
+ HAVE_S390X=1
901
+ # or set march for our compile units
902
+ elif try $CC -c $CFLAGS $VGFMAFLAG -march=z13 $test .c; then
903
+ echo " Checking for s390x build (march=z13) ... Yes." | tee -a configure.log
904
+ HAVE_S390X=1
905
+ VGFMAFLAG=" $VGFMAFLAG -march=z13"
906
+ # else we are not on s390x
907
+ else
908
+ echo " Checking for s390x build ... No." | tee -a configure.log
909
+ fi
910
+
911
+ # prepare compiling for s390x
912
+ if test $HAVE_S390X -eq 1; then
913
+ CFLAGS=" $CFLAGS -DHAVE_S390X_VX"
914
+ SFLAGS=" $SFLAGS -DHAVE_S390X_VX"
915
+ OBJC=" $OBJC crc32-vx.o s390x-functable.o"
916
+ PIC_OBJC=" $PIC_OBJC crc32-vx.lo s390x-functable.lo"
917
+ else
918
+ # this is not a s390x build
919
+ VGFMAFLAG=" "
920
+ fi
921
+
873
922
# show the results in the log
874
923
echo >> configure.log
875
924
echo ALL = $ALL >> configure.log
@@ -901,6 +950,8 @@ echo mandir = $mandir >> configure.log
901
950
echo prefix = $prefix >> configure.log
902
951
echo sharedlibdir = $sharedlibdir >> configure.log
903
952
echo uname = $uname >> configure.log
953
+ echo HAVE_S390X = $HAVE_S390X >> configure.log
954
+ echo VGFMAFLAG = $VGFMAFLAG >> configure.log
904
955
905
956
# update Makefile with the configure results
906
957
sed < ${SRCDIR} Makefile.in "
@@ -912,6 +963,7 @@ sed < ${SRCDIR}Makefile.in "
912
963
/^LDFLAGS *=/s#=.*#=$LDFLAGS #
913
964
/^LDSHARED *=/s#=.*#=$LDSHARED #
914
965
/^CPP *=/s#=.*#=$CPP #
966
+ /^VGFMAFLAG *=/s#=.*#=$VGFMAFLAG #
915
967
/^STATICLIB *=/s#=.*#=$STATICLIB #
916
968
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB #
917
969
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV #
0 commit comments