For a C library, I need to check whether the current compiler is for x86_64 due to memory issues. The command I found that exactly meets my requirement:
CXXARCH:=$(${CXX} -dumpmachine | grep -i 'x86_64')
where ${CXX} is either gcc or clang. For an x86_64 machine, this will return a non-empty string. For a 32-bit machine, say Raspberry Pi, this will be empty.
how can I distinguish between the two cases?
I did this:
ifneq (${CXXARCH},)
MAGICVAR:=-DMY_DEFINE
endif
With an $(info) print, I ensured that in a Raspberry Pi, this condition is not being fulfilled, which it should, because the command clang-6.0 -dumpmachine returns: armv7l-unknown-linux-gnueabihf. So why is this condition not being executed? What am I doing wrong?