Yes, I suppose you can do this with autotools. I've never seen autotools as necessary or sufficient. Not necessary, because I use far more complex projects (see swtch.com/plan9ports, which is a complete Plan 9 operating system including graphics; or the Go language from Google) that somehow manage to get along without all the overhead that comes with autotools. Not sufficient, because I've lost track of the number of times autotools have failed me on one system or another.
I think this #ifdef might be done a bit better but its existence is not a strong case for autotools.
ron