1. 18
  1. 2

    The best way to speed up autoconf is to remove it when it’s not needed, which is most often the case.

    1. 1

      To expand on that slightly: most people ‘write’ autoconf scripts by copying and pasting from another existing script. Most of the checks are either:

      • Is a necessary thing there? If not, there’s no need to check, just fail at build time.
      • Is it a thing that is present everywhere? If so, don’t bother to check, just assume it’s there until you need to support a platform where it doesn’t exist.
      • Is it a thing that is present everywhere except Windows? Do you support Windows? Either just detect Windows, or give up.
      • Is it something that’s present on all BSDs (e.g. kqueue)? Just detect whether you’re on a BSD.
      • Is it just checking that a header exists? Use __has_include in the C/C++ file.

      This set of rules is a large part of the reason that CMake is usually orders of magnitude faster than autoconf. People don’t copy CMakeLists.txt files with loads of checks that they don’t need. Another big part of the reason is that CMake runs a lot more in the interpreter, without spawning additional processes (e.g. checking files exist, reading configurations for other packages).

      1. 1

        Thanks for elaborating! musl libc is also a great example, as it uses a simple Make that is supported by a very thin custom shell-configure script.