]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/isa-l/configure.ac
Import ceph 15.2.8
[ceph.git] / ceph / src / isa-l / configure.ac
index b4cb0fe94d76cafcd229d2ac2b31078d605c20c0..3834d64a29719758d4f460dfac9587961c8f1dab 100644 (file)
@@ -3,7 +3,7 @@
 
 AC_PREREQ(2.69)
 AC_INIT([libisal],
-        [2.18.0],
+        [2.29.0],
         [sg.support.isal@intel.com],
         [isa-l],
         [http://01.org/storage-acceleration-library])
@@ -28,11 +28,27 @@ AS_CASE([$host_cpu],
   [x86_64], [CPU="x86_64"],
   [amd64], [CPU="x86_64"],
   [i?86], [CPU="x86_32"],
+  [aarch64], [CPU="aarch64"],
+  [arm64], [CPU="aarch64"],
+  [powerpc64le], [CPU="ppc64le"],
+  [ppc64le], [CPU="ppc64le"],
 )
 AM_CONDITIONAL([CPU_X86_64], [test "$CPU" = "x86_64"])
 AM_CONDITIONAL([CPU_X86_32], [test "$CPU" = "x86_32"])
+AM_CONDITIONAL([CPU_AARCH64], [test "$CPU" = "aarch64"])
+AM_CONDITIONAL([CPU_PPC64LE], [test "$CPU" = "ppc64le"])
 AM_CONDITIONAL([CPU_UNDEFINED], [test "x$CPU" = "x"])
 
+if test "$CPU" = "x86_64"; then
+   is_x86=yes
+else
+   if test "$CPU" = "x86_32"; then
+      is_x86=yes
+   else
+      is_x86=no
+   fi
+fi
+
 # Check for programs
 AC_PROG_CC_STDC
 AC_USE_SYSTEM_EXTENSIONS
@@ -50,90 +66,189 @@ AS_IF([test "x$enable_debug" = "xyes"], [
         AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
 ])
 
-# Check for yasm and yasm features
-AC_CHECK_PROG(HAVE_YASM, yasm, yes, no)
-if test "$HAVE_YASM" = "no"; then
-  AC_MSG_RESULT([no yasm])
-else
-  AC_MSG_CHECKING([for modern yasm])
-  AC_LANG_CONFTEST([AC_LANG_SOURCE([[vmovdqa %xmm0, %xmm1;]])])
-  if yasm -f elf64 -p gas conftest.c ; then
-    with_modern_yasm=yes
-    AC_MSG_RESULT([yes])
-    AC_MSG_CHECKING([for optional yasm AVX512 support])
-    AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb %zmm0, %zmm1, %zmm2;]])])
-    if yasm -f elf64 -p gas conftest.c 2> /dev/null; then
-      yasm_knows_avx512=yes
-      AC_MSG_RESULT([yes])
+# If this build is for x86, look for yasm and nasm
+if test x"$is_x86" = x"yes"; then
+  # Pick an assembler yasm or nasm
+  if test x"$AS" = x""; then
+    # Check for yasm and yasm features
+    yasm_feature_level=0
+    AC_CHECK_PROG(HAVE_YASM, yasm, yes, no)
+    if test "$HAVE_YASM" = "yes"; then
+       yasm_feature_level=1
     else
-      AC_MSG_RESULT([no])
+       AC_MSG_RESULT([no yasm])
+    fi
+    if test x"$yasm_feature_level" = x"1"; then
+       AC_MSG_CHECKING([for modern yasm])
+       AC_LANG_CONFTEST([AC_LANG_SOURCE([[vmovdqa %xmm0, %xmm1;]])])
+       if yasm -f elf64 -p gas conftest.c ; then
+         AC_MSG_RESULT([yes])
+         yasm_feature_level=4
+       else
+         AC_MSG_RESULT([no])
+       fi
+    fi
+    if test x"$yasm_feature_level" = x"4"; then
+       AC_MSG_CHECKING([for optional yasm AVX512 support])
+       AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb %zmm0, %zmm1, %zmm2;]])])
+       if yasm -f elf64 -p gas conftest.c 2> /dev/null; then
+         AC_MSG_RESULT([yes])
+         yasm_feature_level=6
+       else
+         AC_MSG_RESULT([no])
+       fi
+    fi
+    if test x"$yasm_feature_level" = x"6"; then
+      AC_MSG_CHECKING([for additional yasm AVX512 support])
+      AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpcompressb zmm0, k1, zmm1;]])])
+      sed -i -e '/vpcompressb/!d' conftest.c
+      if yasm -f elf64  conftest.c 2> /dev/null; then
+        AC_MSG_RESULT([yes])
+        yasm_feature_level=10
+      else
+        AC_MSG_RESULT([no])
+      fi
     fi
-  else
-    AC_MSG_FAILURE([no])
-  fi
-fi
 
-# Check for nasm and nasm features
-AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
-if test "$HAVE_NASM" = "no"; then
-  AC_MSG_RESULT([no nasm])
-else
-  AC_MSG_CHECKING([for modern nasm])
-  AC_LANG_CONFTEST([AC_LANG_SOURCE([[pblendvb xmm2, xmm1;]])])
-  sed -i -e '/pblendvb/!d' conftest.c
-  if nasm -f elf64 conftest.c 2> /dev/null; then
-    with_modern_nasm=yes
-    AC_MSG_RESULT([yes])
-    AC_MSG_CHECKING([for optional nasm AVX512 support])
-    AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb zmm0, zmm1, zmm2;]])])
-    sed -i -e '/vpshufb/!d' conftest.c
-    if nasm -f elf64  conftest.c 2> /dev/null; then
-      nasm_knows_avx512=yes
-      AC_MSG_RESULT([yes])
+    # Check for nasm and nasm features
+    nasm_feature_level=0
+    AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
+    if test "$HAVE_NASM" = "yes"; then
+       nasm_feature_level=1
+    else
+       AC_MSG_RESULT([no nasm])
+    fi
+
+    if test x"$nasm_feature_level" = x"1"; then
+      AC_MSG_CHECKING([for modern nasm])
+      AC_LANG_CONFTEST([AC_LANG_SOURCE([[pblendvb xmm2, xmm1;]])])
+      sed -i -e '/pblendvb/!d' conftest.c
+      if nasm -f elf64 conftest.c 2> /dev/null; then
+        AC_MSG_RESULT([yes])
+        nasm_feature_level=4
+      else
+        AC_MSG_RESULT([no])
+      fi
+    fi
+    if test x"$nasm_feature_level" = x"4"; then
+      AC_MSG_CHECKING([for optional nasm AVX512 support])
+      AC_LANG_CONFTEST([AC_LANG_SOURCE([[vinserti32x8 zmm0, ymm1, 1;]])])
+      sed -i -e '/vinsert/!d' conftest.c
+      if nasm -f elf64  conftest.c 2> /dev/null; then
+        AC_MSG_RESULT([yes])
+        nasm_feature_level=6
+      else
+        AC_MSG_RESULT([no])
+      fi
+    fi
+    if test x"$nasm_feature_level" = x"6"; then
+      AC_MSG_CHECKING([for additional nasm AVX512 support])
+      AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpcompressb zmm0 {k1}, zmm1;]])])
+      sed -i -e '/vpcompressb/!d' conftest.c
+      if nasm -f elf64  conftest.c 2> /dev/null; then
+        AC_MSG_RESULT([yes])
+        nasm_feature_level=10
+      else
+        AC_MSG_RESULT([no])
+      fi
+    fi
+
+    if test $nasm_feature_level -ge $yasm_feature_level ; then
+      AS=nasm
+      as_feature_level=$nasm_feature_level
     else
-      AC_MSG_RESULT([no])
+      AS=yasm
+      as_feature_level=$yasm_feature_level
     fi
+
   else
-    AC_MSG_RESULT([no])
+    # Check for $AS supported features
+    as_feature_level=0
+    AC_CHECK_PROG(HAVE_AS, $AS, yes, no)
+    if test "$HAVE_AS" = "yes"; then
+       as_feature_level=1
+    else
+       AC_MSG_ERROR([no $AS])
+    fi
+
+    if test x"$as_feature_level" = x"1"; then
+      AC_MSG_CHECKING([for modern $AS])
+      AC_LANG_CONFTEST([AC_LANG_SOURCE([[pblendvb xmm2, xmm1;]])])
+      sed -i -e '/pblendvb/!d' conftest.c
+      if $AS -f elf64 conftest.c 2> /dev/null; then
+        AC_MSG_RESULT([yes])
+        as_feature_level=4
+      else
+        AC_MSG_RESULT([no])
+      fi
+    fi
+    if test x"$as_feature_level" = x"4"; then
+      AC_MSG_CHECKING([for optional as AVX512 support])
+      AC_LANG_CONFTEST([AC_LANG_SOURCE([[vinserti32x8 zmm0, ymm1, 1;]])])
+      sed -i -e '/vinsert/!d' conftest.c
+      if $AS -f elf64  conftest.c 2> /dev/null; then
+        AC_MSG_RESULT([yes])
+        as_feature_level=6
+      else
+        AC_MSG_RESULT([no])
+      fi
+    fi
+    if test x"$as_feature_level" = x"6"; then
+      AC_MSG_CHECKING([for additional as AVX512 support])
+      AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpcompressb zmm0, k1, zmm1;]])])
+      sed -i -e '/vpcompressb/!d' conftest.c
+      if $AS -f elf64  conftest.c 2> /dev/null; then
+        AC_MSG_RESULT([yes])
+        as_feature_level=10
+      else
+        AC_MSG_RESULT([no])
+      fi
+    fi
   fi
-fi
 
-# Pick an assembler yasm or nasm
-if test x"$AS" = x""; then
-  if test x"$yasm_knows_avx512" = x"yes"; then
-    AS=yasm
-  elif test x"$nasm_knows_avx512" = x"yes"; then
-    AS=nasm
-  elif test x"$with_modern_yasm" = x"yes"; then
+  if test $as_feature_level -lt 2 ; then
+    AC_MSG_ERROR([No modern nasm or yasm found as required. Nasm should be v2.11.01 or later (v2.13 for AVX512) and yasm should be 1.2.0 or later.])
+  fi
+
+  case $host_os in
+       *linux*)  arch=linux   yasm_args="-f elf64";;
+       *darwin*) arch=darwin  yasm_args="-f macho64 --prefix=_ ";;
+       *netbsd*) arch=netbsd  yasm_args="-f elf64";;
+       *mingw*)  arch=mingw   yasm_args="-f win64";;
+       *)        arch=unknown yasm_args="-f elf64";;
+  esac
+
+  # Fix for nasm missing windows features
+  if test x"$arch" = x"mingw"; then
     AS=yasm
-  elif test x"$with_modern_nasm" = x"yes"; then
-    AS=nasm
+    as_feature_level=$yasm_feature_level
+    if test $as_feature_level -lt 2 ; then
+      AC_MSG_ERROR([Mingw build requires Yasm 1.2.0 or later.])
+    fi
+  fi
+
+  AC_DEFINE_UNQUOTED(AS_FEATURE_LEVEL, [$as_feature_level], [Assembler feature level.])
+  if test $as_feature_level -ge 6 ; then
+    AC_DEFINE(HAVE_AS_KNOWS_AVX512, [1], [Assembler can do AVX512.])
+    have_as_knows_avx512=yes
   else
-    AC_MSG_ERROR([No modern yasm or nasm found as required. Yasm should be 1.2.0 or later, and nasm should be v2.11.01 or later.])
+    AC_MSG_RESULT([Assembler does not understand AVX512 opcodes.  Consider upgrading for best performance.])
   fi
-fi
-echo "Using assembler $AS"
 
-if test \( x"$AS" = x"yasm" -a x"$yasm_knows_avx512" = x"yes" \) -o \( x"$AS" = x"nasm" -a x"$nasm_knows_avx512" = x"yes" \); then
-  AC_DEFINE(HAVE_AS_KNOWS_AVX512, [1], [Assembler can do AVX512.])
-  have_as_knows_avx512=yes
+  AM_CONDITIONAL(USE_YASM, test x"$AS" = x"yasm")
+  AM_CONDITIONAL(USE_NASM, test x"$AS" = x"nasm")
+  AM_CONDITIONAL(WITH_AVX512, test x"$have_as_knows_avx512" = x"yes")
+  AC_SUBST([yasm_args])
+  AM_CONDITIONAL(DARWIN, test x"$arch" = x"darwin")
+  AC_MSG_RESULT([Using $AS args target "$arch" "$yasm_args"])
 else
-  AC_MSG_RESULT([Assembler does not understand AVX512 opcodes.  Consider upgrading for best performance.])
+  # Disable below conditionals if not x86
+  AM_CONDITIONAL(USE_YASM, test "x" = "y")
+  AM_CONDITIONAL(USE_NASM, test "x" = "y")
+  AM_CONDITIONAL(WITH_AVX512, test "x" = "y")
+  AM_CONDITIONAL(DARWIN, test "x" = "y")
 fi
-AM_CONDITIONAL(USE_YASM, test x"$AS" = x"yasm")
-AM_CONDITIONAL(USE_NASM, test x"$AS" = x"nasm")
-AM_CONDITIONAL(WITH_AVX512, test x"$have_as_knows_avx512" = x"yes")
-
 
-case $host_os in
-     *linux*)  arch=linux   yasm_args="-f elf64";;
-     *darwin*) arch=darwin  yasm_args="-f macho64 --prefix=_ ";;
-     *netbsd*) arch=netbsd  yasm_args="-f elf64";;
-     *)                arch=unknown yasm_args="-f elf64";;
-esac
-AC_SUBST([yasm_args])
-AM_CONDITIONAL(DARWIN, test x"$arch" = x"darwin")
-AC_MSG_RESULT([Using yasm args target "$arch" "$yasm_args"])
 
 # Check for header files
 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
@@ -148,7 +263,7 @@ AC_TYPE_UINT8_T
 
 # Checks for library functions.
 AC_FUNC_MALLOC  # Used only in tests
-AC_CHECK_FUNCS([memmove memset])
+AC_CHECK_FUNCS([memmove memset getopt])
 
 my_CFLAGS="\
 -Wall \