initial commit
[glibc.git] / sysdeps / powerpc / powerpc64 / le / configure.ac
1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/powerpc/powerpc64le.
3
4 dnl Require at least POWER8 on powerpc64le
5 OLD_CFLAGS="$CFLAGS"
6 CFLAGS="$CFLAGS $libc_cv_cc_submachine"
7 AC_CACHE_CHECK([if the target machine is at least POWER8],
8 libc_cv_target_power8_ok, [
9 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
10 #ifndef _ARCH_PWR8
11 #error invalid target architecture
12 #endif
13 ]])],
14 [libc_cv_target_power8_ok=yes],
15 [libc_cv_target_power8_ok=no])])
16 AS_IF([test "$libc_cv_target_power8_ok" != "yes"],
17 [critic_missing="$critic_missing POWER8 or newer is required on powerpc64le."])
18 CFLAGS="$OLD_CFLAGS"
19
20 dnl Require support for -mno-gnu-attribute
21 OLD_CFLAGS="$CFLAGS"
22 CFLAGS="$CFLAGS -mno-gnu-attribute"
23 AC_CACHE_CHECK([if the compiler supports -mno-gnu-attribute],
24 libc_cv_no_gnu_attr_ok, [
25 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
26 ]])],
27 [libc_cv_no_gnu_attr_ok=yes],
28 [libc_cv_no_gnu_attr_ok=no])])
29 AS_IF([test "$libc_cv_no_gnu_attr_ok" != "yes"],
30 [critic_missing="$critic_missing A compiler with -mno-gnu-attribute is required on powerpc64le."])
31 CFLAGS="$OLD_CFLAGS"
32
33 dnl Some old compiler versions give error for the function signbit() for
34 dnl 128-bit floating point types. This is fixed by PR83862 and backported
35 dnl to gcc6 and gcc7. This test is to check if we are using the compiler
36 dnl that has this bug (fixed in GCC 8.0, backported to 7.4).
37 AC_CACHE_CHECK([if $CC compiles signbit with 128-bit floating point type],
38 libc_cv_compiler_powerpc64le_ice, [dnl
39 save_CFLAGS="$CFLAGS"
40 CFLAGS="$CFLAGS -mabi=ieeelongdouble -Wno-psabi"
41 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
42 int sbr (long double a) { return __builtin_signbit (a); }
43 int sbm (long double *a) { return __builtin_signbit (*a); }
44 int sbo (long double *a) { return __builtin_signbit (a[4]); }
45 int sbi (long double *a, unsigned long n) { return __builtin_signbit (a[n]); }
46 void sbs (int *p, long double a) { *p = __builtin_signbit (a); }
47 ]])],
48 [libc_cv_compiler_powerpc64le_ice=yes],
49 [libc_cv_compiler_powerpc64le_ice=no])
50 CFLAGS="$save_CFLAGS"])
51 AS_IF([test "$libc_cv_compiler_powerpc64le_ice" != "yes"],
52 [critic_missing="$critic_missing __builtin_signbit is broken. GCC 7.4 or newer is required to resolve (PR83862)."])
53
54 dnl Some old compiler versions give out error messages when combining
55 dnl -mabi=% and -mlong-double-128. i.e GCC 7.5.0 (PR94200)
56 AC_CACHE_CHECK([if $CC compiles with -mabi=ieeelongdouble and -mlong-double-128],
57 libc_cv_compiler_powerpc64le_ldbl128_mabi, [dnl
58 save_CFLAGS="$CFLAGS"
59 CFLAGS="$CFLAGS -mabi=ieeelongdouble -mlong-double-128"
60 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
61 long double x;
62 ]])],
63 [libc_cv_compiler_powerpc64le_ldbl128_mabi=yes],
64 [libc_cv_compiler_powerpc64le_ldbl128_mabi=no])
65 CFLAGS="$save_CFLAGS"])
66 AS_IF([test "$libc_cv_compiler_powerpc64le_ldbl128_mabi" = "no"],
67 [critic_missing="$critic_missing The compiler must support -mabi=ieeelongdouble and -mlong-double-128 simultaneously."])
68
69 dnl objcopy (binutils) 2.26 or newer required to support the --update-section
70 dnl feature for fixing up .gnu.attribute section with IEEE ldbl.
71 AC_CHECK_PROG_VER(OBJCOPY, $OBJCOPY, --version,
72 [GNU objcopy.* \([0-9]*\.[0-9.]*\)],
73 [2.1[0-9][0-9]*|2.2[6-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
74 AS=: critic_missing="$critic_missing objcopy >= 2.26 is required on powerpc64le")
75
76 test -n "$critic_missing" && AC_MSG_ERROR([*** $critic_missing])