This is a follow up of 7edb9a07d7 that
provides passing compilation options to PHP_NEW_EXTENSION,
PHP_ADD_SOURCES, PHP_ADD_SOURCES_X, and PHP_SELECT_SAPI as a
blank-or-newline-separated argument.
The m4_normalize(m4_expand([$1])) expands the given argument if it
contains M4 macros, and then trims the items together into a space
separated string in an intuitive way.
This replaces the AC_MSG_ERROR with AC_MSG_FAILURE, where appropriate.
The AC_MSG_ERROR outputs given message and exits the configure step. The
AC_MSG_FAILURE does the same but also automatically outputs additional
message "See 'config.log' for more details." which might help directing
the user where to look further.
The AC_MSG_ERROR is used for errors where current test step isn't logged
in the config.log and wouldn't make sense, and AC_MSG_FAILURE is mostly
used in cases of library checks, compilation tests, headers checked with
AC_CHECK_HEADER* and similar tests that are also logged in the
config.log.
AC_MSG_ERROR([Sanity check failed.]) output:
```
configure: error: Sanity check failed.
```
AC_MSG_FAILURE([Sanity check failed.]) output:
```
configure: error: in '/path/to/php-src':
configure: error: Sanity check failed.
See 'config.log' for more details
```
This is a follow-up of GH-15177
(c96f08aa70)
and GH-15185
(9467ffb43c)
The PHP_OUTPUT macro was introduced in the very early phase of the build
system due to AC_OUTPUT handling issues in the old Autoconf versions
before the AC_CONFIG_FILES, AC_CONFIG_COMMANDS etc were introduced with
the AC_OUTPUT signature without arguments. The PHP_OUTPUT was also
helping Makefile.in back then being properly generated based on whether
all files were generated or only some (when using the obsolete
CONFIG_FILES=... ./config.status invocation instead of the new
./config.status --file=...). Another issue is that PHP_OUTPUT can't be
used by extensions when using phpize.
This replaces the PHP_OUTPUT invocations with default AC_CONFIG_FILES.
The obsolete "REDO_ALL" feature at the config.status invocation is also
removed with a simpler unconditional generation.
In phar extension the "ext/phar" is replaced with $ext_dir variable to
be able to use phpize.
The m4_normalize([$1]) normalizes items into a single-space-separated
list of files to append them to the global PHP_OUTPUT_FILES variable
that is processed by AC_CONFIG_FILES. Redundant newlines are also
removed in the generated configure script.
PHP extensions using phpize can't use this macro so it's safe to change
this.
This macro once had also the 5th argument (the build target), which was
removed via 2a6da0f24c. This quotes all
PHP_SELECT_SAPI arguments and removes the redundant ones. The basic
macro usage help text is moved to the macros section from the obsolete
docs file.
This appends the possible rt library as needed on Solaris <= 10 to
FPM_EXTRA_LIBS instead of the global LIBS variable for all SAPIs to have
cleaner build. The possible required rt library for other SAPIs is also
checked in the configure.ac.
Instead of appending -lselinux to global LIBS variable, this adds it as
needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM
invocation.
Follow-up of GH-14881
Instead of appending -lapparmor to global LIBS variable, this adds it as
needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM
invocation.
Follow-up of GH-14881
Instead of appending -lsystemd to global LIBS variable, this adds it as
needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM
invocation. Move php_fpm_systemd substitution after its check.
Follow-up of GH-14881
- This syncs CS and wraps ptrace function check in a single
AC_CACHE_CHECK for optional edge case cross-compiling adjustments
- Overquoted arguments are reduced (first the compilation check if
ptrace in proper form is available on the system and then the run
check if ptrace works as expected)
- The cache variable php_cv_have_mach_vm_read is renamed to
php_cv_func_mach_vm_read.
- ACL user/group check wrapped in AC_CACHE_CHECK
- instead of appending -lacl to global LIBS variable, this adds it as
needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM
invocation
- Arguments quoted
- Redundant comments removed (some basic help info is in the
build/php.m4)
- APXS variable as such isn't used in the generated Makefile, the path
to the apxs tool is inserted during the configure step directly
- This simplifies over-quoted arguments to AC_COMPILE_IFELSE
- Indentation and other CS fixes
- php_cv_* cache variables
- AC_DEFINE help texts syncs to make it more clear
- Fix -Wunused-but-set-variable warnings
This reduces -Wunused-variable and -Wunused-but-set-variable warnings
generated in the Autoconf's config.log to comply with possible stricter
default compiler configuration on the system to avoid having false
results.
The PHP_SUBST_OLD adds variables to generated Makefile and creates
output shell variables to replace the @variable_name@ placeholders in
templates. These changed variables are not used in the generated
Makefile so the AC_SUBST is sufficient.
- ext/odbc
- sapi/embed
- sapi/fpm
- only substituted in scripts/php-config.in:
- PHP_INSTALLED_SAPIS
- SAPI_LIBNAME_SHARED
- SAPI_LIBNAME_STATIC
The SELinux library has had pkg-config/pkgconf integration since ~2009.
To ease this change, the check without pkgconf is executed in case the
libselinux.pc file is not found on the system.
A sanity check also covers cases where the library path is overriden:
/configure --enable-fpm --with-fpm-selinux \
SELINUX_CFLAGS=-I/path/to/libselinux \
SELINUX_LIBS="-L/path/to/libselinux -lselinux"
This also removes the redundant symbol HAVE_SELINUX_SELINUX_H since the
selinux/selinux.h header is considered a required part of the SELinux
library package.
The AppArmor library has had pkg-config/pkgconf integration since its
early versions (2012), when it was integrated from the libaalogparse
into the AppArmor project. To ease this change, the check without
pkgconf is executed in case the libapparmor.pc file is not found on the
system.
A sanity check also covers cases where the library path is overriden:
/configure --enable-fpm --with-fpm-apparmor \
APPARMOR_CFLAGS=-I/path/to/libapparmor \
APPARMOR_LIBS="-L/path/to/libapparmor -lapparmor"
This also removes the redundant symbol HAVE_SYS_APPARMOR_H since the
sys/apparmor.h header is considered a required part of the AppArmor
library package.
Instead of running the user/group permissions check (unknown when
cross-compiling), check with linking (AC_LINK_IFELSE) can be sufficient
to test if ACL_USER and ACL_GROUP are available (missing on macOS). The
AC_SEARCH_LIBS is used to test the ACL availability in c or acl library.
This removes the unused HAVE_SYSTEMD_SD_DAEMON_H symbol defined by the
Autoconf AC_CHECK_HEADERS macro.
The systemd/sd-daemon.h sanity check now also works when systemd library
is overriden by pkgconf variables for custom or development places:
./configure --enable-fpm --with-fpm-systemd \
SYSTEMD_CFLAGS=-I/path/to/systemd/src \
SYSTEMD_LIBS="-L/path/to/systemd/build -lsystemd"
The clock_gettime() is found in libc on modern systems, except on
Solaris <= 10 and possible similar systems, it is in the rt library.
This checks if clock_gettime() exists in the libc, then it checks if rt
library has clock_gettime, prepends it to LIBS and defines the
HAVE_CLOCK_GETTIME symbol with the template from the AC_CHECK_FUNCS.
The ac_cv_func_clock_gettime is a cache variable set by AC_CHECK_FUNCS.
This now defines the HAVE_LQ_SO_LISTENQ as the fallback check when all
previous have failed in case of FPM LQ. This seemed to be a typo in the
build system.
Global --tag=CC defined in configure.ac is not correct in all cases. For example
linking objects that were compiled from C++ sources needs to be done with C++
compiler, however for link mode libtool will prefer compiler indicated with
--tag.
Fixes GH-12349