From d4382ecedce5ae6f5160c342f088313b16600fd5 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)"
Date: Mon, 24 Jun 2019 12:29:05 +0300 Subject: [PATCH] configure: allow cc tests even if cross compiling, test i386/x86-64 Adds a tool `ppif` at configure which can test preprocessor conditions even when $cc is a cross compiler to any foreign platform. Currently used only to identify i386 or x86_64 (including when cross compiling) as a mini-demonstration. Hopefully will be used in the future to test more compiler features and/or replace uname-related tests with more accurate results. --- configure | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/configure b/configure index c35686a..4a40405 100755 --- a/configure +++ b/configure @@ -150,11 +150,46 @@ for opt do esac done +cc="${cross_prefix}${cc}" +ar="${cross_prefix}${ar}" +strip="${cross_prefix}${strip}" + + +PPIF_TEMPLATE=" +int ppif(void) { +#if %s + return 0; +#else + PPIF_FALSE; +#endif +} +" + +# Succeeds when preprocessor condition `#if $1` is true. +# if $2 is not empty, prints to stderr `checking whether $2...