···2121 # Fix warnings from preprocessor instructions.
2222 # https://github.com/NixOS/nixpkgs/issues/59929
2323 ./preprocessor-warnings.patch
2424+ # `configure` defines a test `main` with an implicit `int` return, which clang 16 disallows.
2525+ ./fix-configure-main.patch
2426 ];
25272628 enableParallelBuilding = true;
···5557 # cross-compiling, but `autoreconfHook` brings in `makeWrapper` which
5658 # doesn't work with the bootstrapTools bash, so can only do this for
5759 # cross builds when `stdenv.shell` is a newer bash.
5858- ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) autoreconfHook;
6060+ ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform
6161+ # The provided `configure` script fails on clang 16 because some tests have a `main`
6262+ # returning an implicit `int`, which clang 16 treats as an error. Running `autoreconf` fixes
6363+ # the test and allows `configure` to detect clang properly.
6464+ # This is done only for clang on Darwin because the Darwin stdenv bootstrap does not use
6565+ # libelf, so should be safe because it will always be run with a compatible version of bash.
6666+ || (stdenv.cc.isClang && stdenv.isDarwin)) autoreconfHook;
59676068 meta = {
6169 description = "ELF object file access library";