Working around a failing configure script

Created On:

When building cairo from source the first step is to run the ./configure script. This script is generated by GNU Autoconfig and the purpose is to probe the local system for various features and settings which are encoded in Makfiles that are used to build cairo. When using the zig toolchain to build cairo I get the following error from ./configure:

$ CC='zig cc' ./configure
checking whether float word ordering is bigendian... unknown
configure: error:

Unknown float word ordering. You need to manually preset
ax_cv_c_float_words_bigendian=no (or yes) according to your system.

Error output from running ./configure with the zig toolchain

The error message is pretty unhelpful because it doesn’t say what the check is testing for and how to determine the correct value. Fortunately it’s possible to look up every configure check in the Autoconf Archive. The ax_cv_c_float_words_bigendian check is trying to determine the endianess of floats. I don’t know what the correct answer is for x86_64 systems, but it is possible to replicate the check by looking at the source of the check. In this case it’s trying to compile the following C program and checks if noonsees or seesnoon is in the resulting binary.

int main() {
  double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
  return 0;

Compiling the above file on an x86_64 system and inspecting the resulting binary shows seesnoon is in the resulting binary.

$ zig cc test.c
$ strings a.out | grep sees

According to the source this means that the float ordering is little endian and the correct value of ax_cv_c_float_words_bigendian is no.

Calling ./configure with ax_cv_c_float_words_bigendian=no as an argument now skips the failing check and causes the ./configure script to exit successfully.

$ CC='zig cc' ./configure ax_cv_c_float_words_bigendian=no
cairo (version 1.16.0 [release]) will be compiled with:


It’s easy to work around a failing configure check. Every check is documented in the Autoconf Archive with a simple description and a link to the source code. With the documentation and source it’s possible to replicate the check and determine the correct value for the current system. The correct value can be passed into the ./configure script to skip the check.