configure
does not decide this: make
does. If the configure
script is older than configure.ac
or any of the files it includes (starting with aclocal.m4
), then make
runs autoconf
to rebuild configure
.
Similar rules exist to rebuild aclocal.m4
using aclocal
, and the various Makefile.in
using automake
.
These rebuild rules should never be triggered after you unpack a tarball on a target machine, because the timestamp of all these files in the tarball should be correct (configure
newer than configure.ac
, etc.). So if this happens, either something is bogus in your tarball (like you did not use make dist
or preferably make distcheck
to generate it), or the user compiling the source code did something wrong (like copying the entire directory without preserving the timestamps), or there is something bogus in the target system (e.g. make
usually fail to work properly on a NFS-mounted directory if the clock of the NFS-server is not synchronized with that of the client).
Another frequent source of unwelcome rebuilt is observed by people who keep the generated files in version-control system. See https://www.gnu.org/software/automake/manual/html_node/CVS.html for a discussion about this if that is your case.
AM_MAINTAINER_MODE
is not a solution. It just adds another point where breakage can occur. Don't keep generated files in source control and usemake distcheck
to build tarballs and you should be fine. – Experimentalism