Hi,

Enabling optional ./configure features/packages using --enable-* / --with-*
will and should cause fatal errors aborting the configure process
if some dependencies are missing, letting the user install such packages,
before proceeding and resuming ./configure.

However, ./configure currently only saves config.cache at the very end upon 
success.

This means the manual loop below can take quite a few iterations,
until the user have encountered all errors for their distribution,
and installed all required packages:

loop
   ./configure --with-... --enable-...
   if error occured then
       figure out which distro package should be installed using apt-file or 
google
       install the package
    else
         break
    end
end loop

To speed-up the resuming of ./configure, I propose adding AC_CACHE_SAVE entires
at a few positions *before* possibly executing some fatal checks (AC_MSG_ERROR).

It's important not to run AC_CACHE_SAVE in between the actual check and 
AC_MSG_ERROR,
as that would cache the "no" value, causing the package later installed by the 
user to go undetected.

Attached is a patch adding AC_CACHE_SAVE at places where I think it makes most 
sense.
Since it's a macro that expanded causes configure to grow quite a bit,
I only added it at the 10 places where we get most bang for the bucks, in terms 
of speed-up.

Just for fun, I also created a little helper-tool, magicmake [1], to automate 
the pseudo-code loop above,
to verify all packages could be found, after installation, so that no undesired 
"no" values were cached.
The gif animation [2] shows the building of PostgreSQL with these configure 
flags:

magicmake ./configure --config-cache --prefix="$HOME/pg-head" --enable-nls 
--with-perl --with-python --with-tcl --with-icu --with-llvm --with-ssl=openssl 
--with-gssapi --with-ldap --with-pam --with-systemd --with-libxml 
--with-libxslt --with-lz4 --with-pgport=54321 --enable-debug --enable-cassert 
--enable-tap-tests --enable-depend --enable-coverage --enable-profiling 
--enable-dtrace

The following packages were detected and installed by magicmake to make it 
possible to build PostgreSQL with all those options:

liblog-agent-perl lcov systemtap-sdt-dev llvm clang pkg-config libicu-dev 
libxml2-dev liblz4-dev libreadline-dev bison flex python-is-python3 zlib1g-dev 
libkrb5-dev libssl-dev libgss-dev libpam0g-dev libxslt1-dev libldap2-dev 
libsystemd-dev gettext tcl tcl-dev libperl-dev libpython3.8-dev libipc-run-perl 
dbtoepub fop libxml2-utils xsltproc libterm-table-perl libterm-readkey-perl 
libterm-size-any-perl

(I only attached the patch for configure.ac, you have to run autoconf to also 
update configure.)

Thoughts?

/Joel

[1] https://github.com/truthly/magicmake
[2] https://github.com/truthly/magicmake/raw/master/magicmake.gif


Attachment: add-configure-cache-checkpoints.patch
Description: Binary data

Reply via email to