nuttx-apps/interpreters/python/config.site.in
raiden00pl fa4a430080 interpreters/python: fix build for x86_64 targets built with the host gcc
NuttX x86_64 (qemu-intel64) builds with the native host gcc, which
exposed several host-environment leaks in the CPython cross build:

- Pass the -D/-U macro flags from CFLAGS as CPPFLAGS so
  preprocessor-only configure probes (Misc/platform_triplet.c) do not
  see the host's __linux__ and misdetect the platform as
  x86_64-linux-gnu, enabling Linux-only code such as the perf
  trampoline.

- Force linux/random.h and sys/xattr.h probes to no in config.site:
  NuttX provides neither, but a native toolchain resolves them against
  the host /usr/include.  The former drags host ioctl macros into
  posixmodule, the latter enables os xattr support with no xattr
  syscalls to link against.

- Disable _curses, _curses_panel, _dbm, _gdbm, _hashlib and _tkinter:
  their host libraries are discovered via pkg-config when the target
  compiler can compile host headers.  hashlib keeps working through
  the built-in HACL implementations.

- Only build _posixsubprocess when the arch has a real fork(): its
  vfork() support is only an optimization and the fork() fallback path
  (PyOS_BeforeFork/PyOS_AfterFork_*) is compiled unconditionally but
  declared only under HAVE_FORK.  This also fixes rv-virt:python,
  which became vfork-only after the fork/vfork split.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
2026-08-18 15:23:54 -03:00

43 lines
1.5 KiB
Text

export MODULE_BUILDTYPE="static"
export ac_cv_file__dev_ptmx="no"
export ac_cv_file__dev_ptc="no"
export ac_cv_buggy_getaddrinfo="no"
export ac_cv_func_getaddrinfo="yes"
export ac_cv_pthread_is_default="yes"
export ac_cv_func_acosh="yes"
export ac_cv_func_asinh="yes"
export ac_cv_func_atanh="yes"
export ac_cv_func_erf="yes"
export ac_cv_func_erfc="yes"
export ac_cv_func_expm1="yes"
export ac_cv_func_log1p="yes"
export ac_cv_func_log2="yes"
export ac_cv_func_clock_gettime="yes"
export ac_cv_header_sys_syscall_h="no"
export ac_cv_func_timegm="yes"
export ac_cv_func_clock="yes"
export ac_cv_func_waitpid="yes"
export ac_cv_func_pipe="yes"
export ac_cv_enable_strict_prototypes_warning="no"
export ac_cv_func_getnameinfo="yes"
export ac_cv_func_poll="yes"
export ac_cv_func_gethostname="yes"
export ac_cv_func_lstat="yes"
export ac_cv_func_readlink="yes"
export ac_cv_func_realpath="yes"
export ac_cv_func_getpid="yes"
export ac_cv_func_utime="yes"
export ac_cv_func_utimes="yes"
export ac_cv_func_getuid="yes"
export ac_cv_func_sysconf="yes"
export ac_cv_func_umask="yes"
export ac_cv_func_ffi_prep_cif_var="yes"
export ac_cv_func_ffi_prep_closure_loc="yes"
export ac_cv_func_ffi_closure_alloc="yes"
export ac_cv_func_utimes="no"
# NuttX provides neither header; without the overrides a native toolchain
# (x86_64) resolves them against the host /usr/include, dragging host
# ioctl macros into posixmodule and enabling xattr support that cannot
# link.
export ac_cv_header_linux_random_h="no"
export ac_cv_header_sys_xattr_h="no"