In an autotools based project, I currently have the following line in Makefile.am :
AUTOMAKE_OPTIONS = serial-tests
I would like this option to apply if and only if my version of automake is 1.12 or more. The reason is that it is necessary to maintain a consistent test harness using both the 1.11 and 1.13 machines. What is the best way to do this?
I already tried this:
AM_VER = $(shell $(AUTOMAKE) --version | head -n1 | sed -e 's|[^0-9.]||g') AM_VER_MAJOR = $(shell echo $(AM_VER) | cut -d. -f1) AM_VER_MINOR = $(shell echo $(AM_VER) | cut -d. -f2) AM_VER_PATCH = $(shell echo $(AM_VER) | cut -d. -f3) $(info $(AM_VER_MAJOR) $(AM_VER_MINOR) $(AM_VER_PATCH)) supports_serial_tests_opt = $(shell if [ "$(AM_VER_MAJOR)" -gt 1 ] || { [ "$(AM_VER_MAJOR)" -eq 1 ] && [ "$(AM_VER_MINOR)" -ge 12 ]; }; then echo true; fi) $(info $(supports_serial_tests_opt)) $(if $(supports_serial_tests_opt), $(eval AUTOMAKE_OPTIONS=serial-opts)) $(info $(AUTOMAKE_OPTIONS))
and this will not work, because AUTOMAKE_OPTIONS must be set to automake runtime, and conditional conditional conditions are met at make time. Even if it worked, I would find it ridiculously verbose and bloated; Is there a better way? My gut tells me that I have to use my configure.ac to set a variable, which I will then just expand in Makefile.am , for example:
AUTOMAKE_OPTIONS = $(SERIAL_TESTS)
The philosophy of autoconfiguration is to test functions - can I somehow skip version checking and check for serial test options and use them if specified?
source share