Search code examples
buildcrashgnuautoconf

Autotools naming bug


I have following configure.ac:

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_PROG_CXX
AC_OUTPUT

And it generates configure, that contains following lines:(grep core configure )

1572:  rm -f core *.core core.conftest.* &&
2143:rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2210:rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2212:rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2214:rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

Fun begins with the fact, that I have folder, named core. So ./configure yield

checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... rm: cannot remove 'core': Is a directory
yes
checking whether g++ accepts -g... rm: cannot remove 'core': Is a directory
yes
configure: creating ./config.status
rm: cannot remove 'core': Is a directory

I found in google, that it is done in case of compiler crash. But is it any nice way to disable this check(I really do not care about compilers that can core dump on autoconf tests). Renaming folder is not what I want to do.


Solution

  • But is it any nice way to disable this check

    No, there isn't.

    Renaming folder is not what I want to do.

    In that case, I suggest patching 'configure' after somewhere in an autoconf 'bootstrap.sh' script or after whatever runs autoreconf:

    #!/bin/sh
    autoreconf -fvi # or whatever autoreconf needs
    sed -i 's/rm -f core/rm -f/g' configure
    

    Note that sed -i is not a universal solution, as it relies on GNU sed, but it's not too hard to come up with a portable solution.