diff options
Diffstat (limited to 'gnulib-m4/host-cpu-c-abi.m4')
-rw-r--r-- | gnulib-m4/host-cpu-c-abi.m4 | 245 |
1 files changed, 47 insertions, 198 deletions
diff --git a/gnulib-m4/host-cpu-c-abi.m4 b/gnulib-m4/host-cpu-c-abi.m4 index b9223241..e860a19e 100644 --- a/gnulib-m4/host-cpu-c-abi.m4 +++ b/gnulib-m4/host-cpu-c-abi.m4 @@ -1,5 +1,5 @@ -# host-cpu-c-abi.m4 serial 15 -dnl Copyright (C) 2002-2022 Free Software Foundation, Inc. +# host-cpu-c-abi.m4 serial 17 +dnl Copyright (C) 2002-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -461,217 +461,66 @@ EOF dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit -dnl one, or to 'unknown' if unknown. +dnl one. dnl This is a simplified variant of gl_HOST_CPU_C_ABI. AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit], - [if test -n "$gl_cv_host_cpu_c_abi"; then - case "$gl_cv_host_cpu_c_abi" in - i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) - gl_cv_host_cpu_c_abi_32bit=yes ;; - x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) - gl_cv_host_cpu_c_abi_32bit=no ;; - *) - gl_cv_host_cpu_c_abi_32bit=unknown ;; - esac - else - case "$host_cpu" in - - # CPUs that only support a 32-bit ABI. - arc \ - | bfin \ - | cris* \ - | csky \ - | epiphany \ - | ft32 \ - | h8300 \ - | m68k \ - | microblaze | microblazeel \ - | nds32 | nds32le | nds32be \ - | nios2 | nios2eb | nios2el \ - | or1k* \ - | or32 \ - | sh | sh[1234] | sh[1234]e[lb] \ - | tic6x \ - | xtensa* ) - gl_cv_host_cpu_c_abi_32bit=yes - ;; + [case "$host_cpu" in - # CPUs that only support a 64-bit ABI. -changequote(,)dnl - alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ - | mmix ) -changequote([,])dnl - gl_cv_host_cpu_c_abi_32bit=no - ;; + # CPUs that only support a 32-bit ABI. + arc \ + | bfin \ + | cris* \ + | csky \ + | epiphany \ + | ft32 \ + | h8300 \ + | m68k \ + | microblaze | microblazeel \ + | nds32 | nds32le | nds32be \ + | nios2 | nios2eb | nios2el \ + | or1k* \ + | or32 \ + | sh | sh[1234] | sh[1234]e[lb] \ + | tic6x \ + | xtensa* ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + # CPUs that only support a 64-bit ABI. changequote(,)dnl - i[34567]86 ) + alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ + | mmix ) changequote([,])dnl - gl_cv_host_cpu_c_abi_32bit=yes - ;; - - x86_64 ) - # On x86_64 systems, the C compiler may be generating code in one of - # these ABIs: - # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. - # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 - # with native Windows (mingw, MSVC). - # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. - # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if (defined __x86_64__ || defined __amd64__ \ - || defined _M_X64 || defined _M_AMD64) \ - && !(defined __ILP32__ || defined _ILP32) - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi_32bit=no], - [gl_cv_host_cpu_c_abi_32bit=yes]) - ;; - - arm* | aarch64 ) - # Assume arm with EABI. - # On arm64 systems, the C compiler may be generating code in one of - # these ABIs: - # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. - # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. - # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi_32bit=no], - [gl_cv_host_cpu_c_abi_32bit=yes]) - ;; - - hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) - # On hppa, the C compiler may be generating 32-bit code or 64-bit - # code. In the latter case, it defines _LP64 and __LP64__. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifdef __LP64__ - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi_32bit=no], - [gl_cv_host_cpu_c_abi_32bit=yes]) - ;; - - ia64* ) - # On ia64 on HP-UX, the C compiler may be generating 64-bit code or - # 32-bit code. In the latter case, it defines _ILP32. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifdef _ILP32 - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi_32bit=yes], - [gl_cv_host_cpu_c_abi_32bit=no]) - ;; - - mips* ) - # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this - # at 32. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi_32bit=no], - [gl_cv_host_cpu_c_abi_32bit=yes]) - ;; - - powerpc* ) - # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. - # No need to distinguish them here; the caller may distinguish - # them based on the OS. - # On powerpc64 systems, the C compiler may still be generating - # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may - # be generating 64-bit code. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined __LP64__ - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi_32bit=no], - [gl_cv_host_cpu_c_abi_32bit=yes]) - ;; - - rs6000 ) - gl_cv_host_cpu_c_abi_32bit=yes - ;; - - riscv32 | riscv64 ) - # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. - # Size of 'long' and 'void *': - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __LP64__ - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi_32bit=no], - [gl_cv_host_cpu_c_abi_32bit=yes]) - ;; - - s390* ) - # On s390x, the C compiler may be generating 64-bit (= s390x) code - # or 31-bit (= s390) code. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __LP64__ || defined __s390x__ - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi_32bit=no], - [gl_cv_host_cpu_c_abi_32bit=yes]) - ;; + gl_cv_host_cpu_c_abi_32bit=no + ;; - sparc | sparc64 ) - # UltraSPARCs running Linux have `uname -m` = "sparc64", but the - # C compiler still generates 32-bit code. + *) + if test -n "$gl_cv_host_cpu_c_abi"; then + dnl gl_HOST_CPU_C_ABI has already been run. Use its result. + case "$gl_cv_host_cpu_c_abi" in + i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) + gl_cv_host_cpu_c_abi_32bit=yes ;; + x86_64 | alpha | arm64 | aarch64c | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) + gl_cv_host_cpu_c_abi_32bit=no ;; + *) + gl_cv_host_cpu_c_abi_32bit=unknown ;; + esac + else + gl_cv_host_cpu_c_abi_32bit=unknown + fi + if test $gl_cv_host_cpu_c_abi_32bit = unknown; then AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [[#if defined __sparcv9 || defined __arch64__ - int ok; - #else - error fail - #endif + [[int test_pointer_size[sizeof (void *) - 5]; ]])], [gl_cv_host_cpu_c_abi_32bit=no], [gl_cv_host_cpu_c_abi_32bit=yes]) - ;; - - *) - gl_cv_host_cpu_c_abi_32bit=unknown - ;; - esac - fi + fi + ;; + esac ]) HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" |