2 # Copyright © 2005 Scott James Remnant <scott@netsplit.com>
3 # Copyright © 2006-2023 Guillem Jover <guillem@debian.org>
5 # _DPKG_ARCHITECTURE([DEB_VAR], [sh_var])
6 # ---------------------------------------
7 # Use dpkg-architecture from the source tree to set sh_var using DEB_VAR for
8 # the target architecture, to avoid duplicating its logic.
9 AC_DEFUN([_DPKG_ARCHITECTURE], [
10 AC_REQUIRE([DPKG_PROG_PERL])dnl
11 AC_REQUIRE([AC_CANONICAL_HOST])dnl
12 $2=$(PERL=$PERL ${CONFIG_SHELL-/bin/sh} "$srcdir/build-aux/run-script" scripts/dpkg-architecture.pl -t$host -q$1 2>/dev/null)
13 ])# _DPKG_ARCHITECTURE
17 # Parse the host cpu name and check it against the cputable to determine
18 # the Debian name for it. Sets ARCHITECTURE_CPU.
19 AC_DEFUN([DPKG_CPU_TYPE], [
20 AC_MSG_CHECKING([dpkg cpu type])
21 _DPKG_ARCHITECTURE([DEB_HOST_ARCH_CPU], [cpu_type])
22 AS_IF([test "x$cpu_type" = "x"], [
24 AC_MSG_RESULT([$cpu_type])
25 AC_MSG_WARN([$host_cpu not found in cputable])
27 AC_MSG_RESULT([$cpu_type])
29 AC_DEFINE_UNQUOTED([ARCHITECTURE_CPU], ["${cpu_type}"],
30 [Set this to the canonical dpkg CPU name.])
35 # Parse the host operating system name and check it against a list of
36 # special cases to determine what type it is. Sets ARCHITECTURE_OS.
37 AC_DEFUN([DPKG_OS_TYPE], [
38 AC_MSG_CHECKING([dpkg operating system type])
39 _DPKG_ARCHITECTURE([DEB_HOST_ARCH_OS], [os_type])
40 AS_IF([test "x$os_type" = "x"], [
42 AC_MSG_RESULT([$os_type])
43 AC_MSG_WARN([$host_os not found in ostable])
45 AC_MSG_RESULT([$os_type])
47 AC_DEFINE_UNQUOTED([ARCHITECTURE_OS], ["${os_type}"],
48 [Set this to the canonical dpkg system name.])
52 # ------------------------
53 # Determine the Debian name for the host operating system,
55 AC_DEFUN([DPKG_ARCHITECTURE], [
58 AC_MSG_CHECKING([dpkg architecture name])
59 _DPKG_ARCHITECTURE([DEB_HOST_ARCH], [dpkg_arch])
60 AS_IF([test "x$dpkg_arch" = "x"], [
61 AC_MSG_ERROR([cannot determine host dpkg architecture])
63 AC_MSG_RESULT([$dpkg_arch])
65 AC_DEFINE_UNQUOTED([ARCHITECTURE], ["${dpkg_arch}"],
66 [Set this to the canonical dpkg architecture name.])
71 # Determine parts of the Debian architecture ABI for the host system,
72 # so that it can be printed during configure.
73 AC_DEFUN([DPKG_ARCH_ABI], [
74 AC_CHECK_SIZEOF([short])
75 AC_CHECK_SIZEOF([int])
76 AC_CHECK_SIZEOF([long])
77 AC_CHECK_SIZEOF([long long])
78 AC_CHECK_SIZEOF([float])
79 AC_CHECK_SIZEOF([double])
80 AC_CHECK_SIZEOF([long double])
81 AC_CHECK_SIZEOF([void *])
82 AC_CHECK_SIZEOF([off_t], [], [[
83 #undef _FILE_OFFSET_BITS
85 #include <sys/types.h>
87 AC_CHECK_SIZEOF([time_t], [], [[
92 AC_CHECK_ALIGNOF([max_align_t])
95 AS_IF([test "$ac_cv_c_char_unsigned" = yes],
96 [dpkg_char_sign=unsigned],
97 [dpkg_char_sign=signed]
101 AS_CASE([$ac_cv_c_bigendian],
102 [yes], [dpkg_arch_endian=big],
103 [no], [dpkg_arch_endian=little],
104 [dpkg_arch_endian=$ac_cv_c_bigendian]
107 AC_COMPUTE_INT([dpkg_char_bits], [CHAR_BIT], [#include <limits.h>])
108 dpkg_arch_bits=$((ac_cv_sizeof_void_p * dpkg_char_bits))