dnl Copyright (C) 1993-2019 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ([2.69]) dnl Usage: dnl CL_LINK_CHECK(ECHO-TEXT, CACHE-ID, INCLUDES, FUNCTION-BODY, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) AC_DEFUN([CL_LINK_CHECK], [AC_MSG_CHECKING(for $1) AC_CACHE_VAL($2,[ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]], [[$4]])], [$2=yes], [$2=no]) ]) AC_MSG_RESULT([$]$2) if test [$]$2 = yes; then ifelse([$5], , :, [$5]) ifelse([$6], , , [else $6 ])dnl fi ]) dnl Expands to the "extern ..." prefix used for system declarations. dnl AC_LANG_EXTERN() AC_DEFUN([AC_LANG_EXTERN], [extern #ifdef __cplusplus "C" #endif ]) AC_DEFUN([CL_CANONICAL_HOST], [AC_REQUIRE([AC_PROG_CC]) AC_CANONICAL_HOST ]) AC_DEFUN([CL_CANONICAL_HOST_CPU], [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC]) case "$host_cpu" in changequote(,)dnl i[4567]86 ) host_cpu=i386 ;; alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) host_cpu=alpha ;; hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) host_cpu=hppa ;; powerpc ) host_cpu=rs6000 ;; c1 | c2 | c32 | c34 | c38 | c4 ) host_cpu=convex ;; arm* ) host_cpu=arm ;; changequote([,])dnl mips* ) AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [ AC_EGREP_CPP(yes, [#if defined(_MIPS_SZLONG) #if (_MIPS_SZLONG == 64) /* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */ yes #endif #endif ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no) ]) if test $cl_cv_host_mips64 = yes; then host_cpu=mips64 fi ;; dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler dnl still generates 32-bit code. sparc | sparc64 ) AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [ AC_EGREP_CPP(yes, [#if defined(__sparcv9) || defined(__arch64__) yes #endif ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no) ]) if test $cl_cv_host_sparc64 = yes; then host_cpu=sparc64 else host_cpu=sparc fi ;; dnl MacOS X 10.5 machines on x86_64 platforms have 'uname -m' = "i386" even dnl if 64-bit programs are fully supported. dnl AMD64 running Linux have 'uname -m' = "x86_64" even if userland is purely dnl 32-bit. i386 | x86_64 ) AC_CACHE_CHECK([for 64-bit userland on x86-64], cl_cv_host_x86_64, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#if !defined __x86_64__ # error __x86_64__ not defined #endif ]]) ], [cl_cv_host_x86_64=yes], [cl_cv_host_x86_64=no]) ]) if test $cl_cv_host_x86_64 = yes; then host_cpu=x86_64 else host_cpu=i386 fi ;; dnl PowerPC64 is another case where 'uname -m' and userland may disagree. powerpc64 ) AC_CACHE_CHECK([for 64-bit userland on PowerPC64], cl_cv_host_powerpc64, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#if !defined __powerpc64__ # error __powerpc64__ not defined #endif ]]) ], [cl_cv_host_powerpc64=yes], [cl_cv_host_powerpc64=no]) ]) if test $cl_cv_host_powerpc64 = yes; then host_cpu=powerpc64 else host_cpu=rs6000 fi ;; esac dnl was AC_DEFINE_UNQUOTED(__${host_cpu}__) but KAI C++ 3.2d doesn't like this cat >> confdefs.h <= 3 yes #endif ], cl_cv_host_mipsn32=yes, cl_cv_host_mipsn32=no) ]) if test $cl_cv_host_mipsn32 = yes; then host_cpu=mipsn32 fi fi ;; dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler dnl still generates 32-bit code. sparc | sparc64 ) AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [ AC_EGREP_CPP(yes, [#if defined(__sparcv9) || defined(__arch64__) yes #endif ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no) ]) if test $cl_cv_host_sparc64 = yes; then host_cpu=sparc64 else host_cpu=sparc fi ;; esac dnl was AC_DEFINE_UNQUOTED(__${host_cpu}__) but KAI C++ 3.2d doesn't like this cat >> confdefs.h <