autotools cross build failure with lighttpd
On Debian systems, mysql_config does not work with cross compilation. For using mysql_config in a cross build, we'd have to build one mysql_config for each combination of architectures. That's more than 100 mysql_configs. Infeasible.
I propose supporting pkg-config in addition to mysql_config. If no mysql_config is given, the build would check for mysqlclient.pc and mariadb.pc before trying mysql_config. Note that the meson build system exclusively works with mariadb.pc and does not support using mysql_config, so this change moves the two build tools closer.
Updated by gstrauss about 1 month ago
- Status changed from New to Patch Pending
- Target version changed from 1.4.x to 1.4.53
helmut, thank you for the patch.
I replaced the AS_IF() for consistency with the rest of configure.ac
I chose to preserve the spelling change from MYSQL_INCLUDE to MYSQL_CONFIG, even though it adds non-required noise to the patch.
Please don't replace AS_IF! That's broken. It's broken, because PKG_CHECK_MODULES uses AC_REQUIRE and AC_REQUIRE does not work inside a shell if. Consider the following Code
if something; then
AC_REQUIRE(FOO) # boom because FOO is missing
Using PKG_CHECK_MODULES inside shell if absolutely is a fatal bug.
FYI, the change from MYSQL_INCLUDE to MYSQL_CFLAGS is not entirely non-required, because PKG_CHECK_MODULES populates MYSQL_CFLAGS and doesn't populate MYSQL_INCLUDE. If you wanted to preserve MYSQL_INCLUDE (which seems fair), you'd have to have two additional MYSQL_INCLUDE=$MYSQL_CFLAGS assignments in the positive PKG_CHECK_MODULES branches.
On line 173 of configure.ac, lighttpd has:
That should be sufficient for later use of PKG_CHECK_MODULES() inside conditionals.
See the gory explanation at https://autotools.io/pkgconfig/pkg_check_modules.html
If that were not sufficient, then there are other places in lighttpd configure.ac that would also need to be converted to AS_IF()
(To your other comment, I did accept the use of MYSQL_CFLAGS in commit commmit:4608ddec, so no further changes are needed)
Agreed. So not using AS_IF is not a bug here, but requires non-local consistency. I mainly added it because I did not load all of that context. So using AS_IF seemed safer to me. If you ensure that PKG_PROG_PKG_CONFIG is called explicitly, AS_IF is not needed.
Also available in: Atom