Cannot build 3.1.6
TL;DR: I tried to build mailparse-3.1.6 however it fails with #error The mailparse extension requires the mbstring extension!
system: Debian GNU/Linux 12 (bookworm) php: PHP 8.2.7 (cli) (built: Jun 9 2023 19:37:27) (NTS)
- extraction: ok
- phpize: ok
Configuring for:
PHP Api Version: 20220829
Zend Module Api No: 20220829
Zend Extension Api No: 420220829
configure.ac:165: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:165: You should run autoupdate.
build/libtool.m4:100: AC_PROG_LIBTOOL is expanded from...
configure.ac:165: the top level
- configure: ok
checking libmbfl headers... found in /usr/include/php/20220829/ext/mbstring
- make: error
I think the issue is because "HAVE_MBSTRING" is not set.
Adding #define HAVE_MBSTRING 1 into the generated config.h file makes everything compile correctly.
This is not something we can solve (except may add appropriate info to README.md). I suppose that happens because the mbstring extension on your system has also been built with phpize, so config.h.in (I think it's called so on non Windows systems) doesn't know about that. I think you can workaround with CFLAGS=-DHAVE_MBSTRING=1 phpize (or something like that).
But may @oerdnj knows a better way.
I had another look at it, and it seems a very easy fix like I did it. It does compile properly now with the proposed change.
This is not something we can solve (except may add appropriate info to README.md). I suppose that happens because the mbstring extension on your system has also been built with phpize, so config.h.in (I think it's called so on non Windows systems) doesn't know about that. I think you can workaround with
CFLAGS=-DHAVE_MBSTRING=1 phpize(or something like that).But may @oerdnj knows a better way.
It’s might be possible to detect the runtime presence of mbstring, but that’s kind of moot.
I would suggest to remove the check for the mbstring completely instead. Or turn it into the warning (unless you need it at the compile time) and just document that mbstring needs to be loaded before mailparse.
The compilation of externally loadable shared libraries is a mess everywhere as you can’t resolve the symbols properly.
The problem is that mailparse actually requires mbstring during compilation. But you are right that this can't be solved with code; as such I'm changing to documentation issue; the installation docs need to be updated, and linked from this repo.