1 dnl Copyright (C) 1993-2019 Free Software Foundation, Inc.
2 dnl This file is free software, distributed under the terms of the GNU
3 dnl General Public License. As a special exception to the GNU General
4 dnl Public License, this file may be distributed as part of a program
5 dnl that contains a configuration script generated by Autoconf, under
6 dnl the same distribution terms as the rest of that program.
8 dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
13 dnl CL_LINK_CHECK(ECHO-TEXT, CACHE-ID, INCLUDES, FUNCTION-BODY, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
14 AC_DEFUN([CL_LINK_CHECK],
15 [AC_MSG_CHECKING(for $1)
17 AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]], [[$4]])], [$2=yes], [$2=no])
20 if test [$]$2 = yes; then
21 ifelse([$5], , :, [$5])
22 ifelse([$6], , , [else
28 dnl Expands to the "extern ..." prefix used for system declarations.
30 AC_DEFUN([AC_LANG_EXTERN],
37 AC_DEFUN([CL_CANONICAL_HOST],
38 [AC_REQUIRE([AC_PROG_CC])
42 AC_DEFUN([CL_CANONICAL_HOST_CPU],
43 [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
49 alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
52 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
58 c1 | c2 | c32 | c34 | c38 | c4 )
66 AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
68 [#if defined(_MIPS_SZLONG)
69 #if (_MIPS_SZLONG == 64)
70 /* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */
74 ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
76 if test $cl_cv_host_mips64 = yes; then
80 dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler
81 dnl still generates 32-bit code.
83 AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
85 [#if defined(__sparcv9) || defined(__arch64__)
88 ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
90 if test $cl_cv_host_sparc64 = yes; then
96 dnl MacOS X 10.5 machines on x86_64 platforms have 'uname -m' = "i386" even
97 dnl if 64-bit programs are fully supported.
98 dnl AMD64 running Linux have 'uname -m' = "x86_64" even if userland is purely
101 AC_CACHE_CHECK([for 64-bit userland on x86-64], cl_cv_host_x86_64, [
102 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
103 [[#if !defined __x86_64__
104 # error __x86_64__ not defined
107 ], [cl_cv_host_x86_64=yes], [cl_cv_host_x86_64=no])
109 if test $cl_cv_host_x86_64 = yes; then
115 dnl PowerPC64 is another case where 'uname -m' and userland may disagree.
117 AC_CACHE_CHECK([for 64-bit userland on PowerPC64], cl_cv_host_powerpc64, [
118 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
119 [[#if !defined __powerpc64__
120 # error __powerpc64__ not defined
123 ], [cl_cv_host_powerpc64=yes], [cl_cv_host_powerpc64=no])
125 if test $cl_cv_host_powerpc64 = yes; then
132 dnl was AC_DEFINE_UNQUOTED(__${host_cpu}__) but KAI C++ 3.2d doesn't like this
133 cat >> confdefs.h <<EOF
134 #ifndef __${host_cpu}__
135 #define __${host_cpu}__ 1
140 AC_DEFUN([CL_CANONICAL_HOST_CPU_FOR_FFCALL],
141 [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
147 alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
150 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
156 c1 | c2 | c32 | c34 | c38 | c4 )
164 AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
166 [#if defined(_MIPS_SZLONG)
167 #if (_MIPS_SZLONG == 64)
168 /* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */
172 ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
174 if test $cl_cv_host_mips64 = yes; then
177 AC_CACHE_CHECK([for MIPS with n32 ABI], cl_cv_host_mipsn32, [
178 dnl Strictly speaking, the MIPS ABI (-32 or -n32) is independent from the CPU
179 dnl identification (-mips[12] or -mips[34]). But -n32 is commonly used together
180 dnl with -mips3, and it's easier to test the CPU identification.
185 ], cl_cv_host_mipsn32=yes, cl_cv_host_mipsn32=no)
187 if test $cl_cv_host_mipsn32 = yes; then
192 dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler
193 dnl still generates 32-bit code.
195 AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
197 [#if defined(__sparcv9) || defined(__arch64__)
200 ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
202 if test $cl_cv_host_sparc64 = yes; then
209 dnl was AC_DEFINE_UNQUOTED(__${host_cpu}__) but KAI C++ 3.2d doesn't like this
210 cat >> confdefs.h <<EOF
211 #ifndef __${host_cpu}__
212 #define __${host_cpu}__ 1