How to determine multiarch tuple in autoconf

232 views Asked by At

Suppose the Debian development package of libfoo installs headers in /usr/include/$multiarch-tuple/foo, where $multiarch-tuple is something like x86_64-linux-gnu (this is using Debian's multiarch specification, see [1]).

I would like my configure script to add -I/usr/include/$multiarch-tuple/foo to CPPFLAGS. Is there any way to do this using autoconf?

Thanks!

[1] https://wiki.debian.org/Multiarch

1

There are 1 answers

0
rocky On

The shortest and simplest simple answer would be to set CPPFLAGS in the environment before running configure. For example:

CPPFLAGS=-I/usr/include/$multiarch-tuple/foo ./configure 

However if Multiarch uses pkg-config then it might slicker might be to have configure.ac pick out the flags from the installation. To see if Multiarch uses pkg-config, try:

pkg-config --cflags-only-I Multiarch

And of course you can combine that with the first solution:

CPPFLAGS=$(pkg-config --cflags-only-I Multiarch) ./configure 

Convention changes on how to do this when automake is used, but thankfully, you didn't mention that.