autoconf (configure) clobbers conftest.py - fix?

Dima Pasechnik <[email protected]> Tue, 21 Jan 2025 15:53:00 -0600
Newsgroups gmane.comp.sysutils.autoconf.general
Message-ID <Z5AXPFdg_JVq2z-Q@hilbert>
Hello,

pytest, a popular Python testing tool/framework, uses files named
conftest.py for its configuration. OTOH many autoconf macros run
"rm -f conftest*", clobbering conftest.py in the directory where
./configure lives. In our case at least, it's the topmost directory.

I tried naive things such as setting up a trap to restore conftest.py
from a backup copy on EXIT (and other signals) in configure.ac, using AC_CONFIG_FILES to
restore it from a backup copy, but apparently there are more "rm -f conftest*"
which still succeed to delete it.

How this be helped, short of running ./configure in a wrapper which
would restore the file after ./configure is run?

Thanks,
Dima
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEJVdDnfI7raAa4RJxoksLHjfJBTEFAmeQFzkACgkQoksLHjfJ
BTHR0gf/chgQEZLPXpSEgE6rCMeblmREKtpXzfENUocSIZNDqNVmI/zBWXGEOPQM
eDn3aQT410y5ZajcmwbLjvAGpXfhKYnJDgrt0zjft/UaBRPq7TGMexdbK6n5xeXX
sq6AqS7GyEG9ACBCORliWcV9D1saMzcAB2cxNML+VS2noP6qEjzYA+4YtqWy18H3
XXRNklms/UkYKCfC34cUrcVqJNaWtb3sc5YVw2th7zWO+5Og8fpKemj/hYdaRe0V
qHYl3xwTrL1l55vOgcJUSoIEueayYZc8lTTWa6uF5iphgsMn3D1L3LgYa70ScDoB
KsOU5+UjSW170ZsrqTc44KHLwlw0cA==
=EHqD
-----END PGP SIGNATURE-----