You can run autoconf with genrule, that's not a problem. autoconf is
relocatable so you can just run configure within the GENDIR so the
generated headers will just live inside gendir, a cmd may look like
this(I haven't verified it so it might need some change):
cmd = "TOPDIR=$$PWD; cd $(@D); $$TOPDIR/$(location :configure)"
But I strongly suggest you not doing that because of the following issues:
1. It introduces significant amount of overhead into the build process
because usually configure is slow, and it's on the critical path.
2. You start losing the "reproducible" attribute of bazel. bazel
defined a very high bar for "reproducible", it means for a given state
of the source tree and bazel options(-c dbg, etc), it should always
produce the same output. But that does come for free. It means bazel
has to be able to track all the inputs that may affect the outputs, it
also means for the command run by bazel, it should produce the same
output if the arguments remain the same.
So in the case of using autoconf, the assumption is the configure
results that will affect bazel build process should be stable no
matter where it runs, so that it can be checked into the source tree.
The generated header might vary depends on targeted cpu, in that case,
multiple headers should be generated and selected using select
function.
In our company's use case, all the sources(and precompiled libraries,
only .a not .so) are checked into the source tree, and we ensure all
the devlopers use the same version of compiler, that guarantees each
developer's workstation can be used the produce the same binary. The
benefit of doing that is the final binary produced only depends
dynamic libraries from glibc and libstdc++, which makes the server
side deployment very convenient because you don't have to worry about
dynamic libraries dependency(simply because you don't use any).
> To view this discussion on the web visit
https://groups.google.com/d/msgid/bazel-discuss/3e99be6a-4341-4302-a211-490e59191027%40googlegroups.com.