nullmailer icon indicating copy to clipboard operation
nullmailer copied to clipboard

Use `AM_PROG_AR` to find ar

Open lopsided98 opened this issue 3 years ago • 1 comments

This is needed to support prefixed compilers when cross-compiling. Currently, attempting to cross-compile results in the following error:

ar cru libcli++.a main.o messages.o only_long.o
/nix/store/26a78ync552m8j4sbjavhvkmnqir8c9y-bash-4.4-p23/bin/bash: ar: command not found
make[3]: *** [Makefile:321: libcli++.a] Error 127
make[3]: Leaving directory '/build/nullmailer-2.2/lib/cli++'
make[2]: *** [Makefile:449: all-recursive] Error 1
make[2]: Leaving directory '/build/nullmailer-2.2/lib'
make[1]: *** [Makefile:364: all-recursive] Error 1
make[1]: Leaving directory '/build/nullmailer-2.2'
make: *** [Makefile:305: all] Error 2

lopsided98 avatar Jul 02 '21 23:07 lopsided98

I still rely on this patch to cross-compile nullmailer, and it would be great to get it merged.

Note that when I refer to prefixed compilers, I mean that the binary names are prefixed with a target description, like armv7l-unknown-linux-gnueabihf-. Therefore, ar in my environment is named armv7l-unknown-linux-gnueabihf-ar. This is a standard convention when working with cross-toolchains, and is supported other macros like AC_PROG_CC. See also: https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html

AM_PROG_AR was added in automake 1.11.2 (released Dec. 2011, see release notes). I believe older versions will still work, but they may produce a warning about an undefined macro.

lopsided98 avatar Dec 07 '22 19:12 lopsided98