Commit Graph

138 Commits

Author SHA1 Message Date
Peter Kokot
1a126c540a
Autotools: Normalize flags arguments (#15671)
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.
2024-09-01 01:02:40 +02:00
Peter Kokot
fbacc0f936
Autotools: Normalize PHP_ADD_BUILD_DIR 1st argument (#15612)
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.
2024-08-29 00:44:29 +02:00
Peter Kokot
4f4794b12d
Autotools: Sync CS in fpm SAPI (#15412)
- AS_* macros used
- obsolete backticks replaced with $(...)
- redundant double quotes removed
2024-08-15 11:39:09 +02:00
Peter Kokot
53d6ed8a6b
Autotools: Fix typo in FPM TCP_CONNECTION_INFO check (#15411)
Otherwise, the check even works with such typo, but this fixes the
TCP_CONNECTION_INFO check on macOS machines for FPM.
2024-08-14 20:05:18 +02:00
Peter Kokot
dcdcb3cbfe
Autotools: Replace AC_MSG_ERROR with AC_MSG_FAILURE (#15209)
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
```
2024-08-04 07:36:37 +02:00
Peter Kokot
4f07cdc584
Replace PHP_OUTPUT with AC_CONFIG_FILES (#15186)
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.
2024-08-03 21:52:14 +02:00
Peter Kokot
c96f08aa70
Autotools: Normalize PHP_OUTPUT arguments (#15177)
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.
2024-08-01 00:14:56 +02:00
Peter Kokot
003e238436
Autotools: Quote and fix PHP_SELECT_SAPI arguments (#15118)
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.
2024-07-27 22:46:36 +02:00
Peter Kokot
a7f0fe1f33
Autotools: Quote macro arguments
- PHP_EXPAND_PATH
- PHP_LIBGCC_LIBPATH
- PHP_OUTPUT
- PHP_REMOVE_USR_LIB
2024-07-27 05:26:32 +02:00
Peter Kokot
2f0bb9293c
Autotools: Append rt library to FPM_EXTRA_LIBS (#15059)
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.
2024-07-22 17:19:55 +02:00
Peter Kokot
90e63d8a94
[skip ci] Remove GH-14685 artefact 2024-07-22 00:57:34 +02:00
David Carlier
3713c02803
sapi/fpm: retiring solaris /dev/poll support proposal.
Since Solaris 10, the port API is supported, is more modern, less bug
prone and offers, on average, better performances.

Close GH-14685
2024-07-21 17:03:41 +01:00
Peter Kokot
0051b73a3e
Autotools: Refactor PHP-FPM /proc/pid filename check (#14949)
- Check wrapped in AC_CACHE_CHECK using php_cv_file_proc_mem variable
- CS synced
2024-07-14 17:20:41 +02:00
Peter Kokot
0e2e8e0f13
Autotools: Quote all PHP_ADD_BUILD_DIR arguments (#14947)
- All arguments quoted for consistency
- m4_normalize used where list of directories becomes a bit simpler to
  read and see the diff
2024-07-14 16:58:43 +02:00
Peter Kokot
fb5d64c300
Autotools: Use FPM_EXTRA_LIBS for SELinux library (#14885)
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
2024-07-13 01:20:44 +02:00
Peter Kokot
2ea79c024c
Autotools: Use FPM_EXTRA_LIBS for apparmor library (#14884)
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
2024-07-13 01:20:05 +02:00
Peter Kokot
3dd0c11cc3
Autotools: Use FPM_EXTRA_LIBS for systemd library (#14883)
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
2024-07-13 01:19:16 +02:00
Peter Kokot
5586d0c7de
Autotools: Refactor ptrace check for PHP-FPM (#14907)
- 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.
2024-07-11 00:09:08 +02:00
Peter Kokot
9185f613e0
Autotools: Use FPM_EXTRA_LIBS for ACL library (#14881)
- 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
2024-07-09 18:42:31 +02:00
Peter Kokot
83cd1c241e
Autotools: Refactor mach_vm_read check in FPM (#14830)
- Check wrapped in AC_CACHE_CHECK
- Synced CS
2024-07-05 15:19:14 +02:00
Peter Kokot
cc7cfcef08
Autotools: Refactor PHP_FPM_BUILTIN_ATOMIC (#14825)
- Check wrapped in AC_CACHE_CHECK
- Synced CS
- Since this can be also compiler agnostic check, "gcc" text replaced
  with "compiler"
2024-07-05 09:42:44 +02:00
Peter Kokot
17a53470d7
Autotools: Refactor PHP_FPM_LQ checks (#14828)
- CS synced
- checks wrapped in AC_CACHE_CHECH
- HAVE_LQ_SO_LISTENQ defined unconditionally for simplifications
2024-07-05 09:41:50 +02:00
Peter Kokot
5e27a2a994
Autotools: Simplify SAPI configure log check messages (#14764)
The PHP_ARG_ENABLE and PHP_ARG_WITH 2nd argument is the check message in
the configure log output.
2024-07-02 08:11:10 +02:00
Peter Kokot
dc1cc503db
Autotools: Sync PHP_SUBST in sapi (#14753)
- 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
2024-07-01 21:04:09 +02:00
Peter Kokot
bf139e9b1f
Remove unused defined CPP macros in fpm SAPI (#14740)
* Remove unused defined CPP macros in fpm SAPI

- PHP_FPM_SYSTEMD
- PHP_FPM_USER
- PHP_FPM_GROUP

* [skip ci] Update UPGRADING.INTERNALS
2024-07-01 14:06:45 +02:00
Peter Kokot
212b2834e9
Autotools: Sync indentation style in build system files (#14725) 2024-06-29 23:25:17 +02:00
Peter Kokot
c705dd8884
Wrap FPM checks in AC_CACHE_CHECK and fix CS (#14681)
- 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
2024-06-27 21:30:35 +02:00
Peter Kokot
8946099b73
Rename AC_FPM_* M4 macros to PHP_FPM_* (#14670)
This syncs the FPM SAPI M4 macro names with the current naming
conventions prefixed with PHP_.
2024-06-26 15:39:52 +02:00
Peter Kokot
028cfda994
Wrap clock_get_time check in AC_CACHE_CHECK (#14434)
The php_cv_func_clock_get_time cache variable enables cross-compiling
edge cases to manually override the AC_RUN_IFELSE check.
2024-06-02 19:02:12 +02:00
Peter Kokot
52767343b2
Reduce unused variable warnings in config.log (#14264)
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.
2024-05-18 18:28:20 +02:00
Peter Kokot
6fed6d85db
Use AC_SUBST instead of PHP_SUBST_OLD where possible (#13993)
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
2024-04-18 22:17:27 +02:00
Peter Kokot
586a0dd369
Find SELinux library with pkgconf (#13645)
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.
2024-03-10 21:31:56 +01:00
Peter Kokot
816f6a53d0
Find AppArmor library with pkgconf (#13644)
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.
2024-03-10 11:12:54 +01:00
Peter Kokot
1dfba4273f
Simplify FPM ACL check (#13604)
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.
2024-03-08 20:38:31 +01:00
Peter Kokot
9e001631e0
Refactor systemd library check for FPM (#13595)
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"
2024-03-06 06:22:07 +01:00
Peter Kokot
ffc6f192a8
Simplify port_create Autoconf check (#13529)
Similar simplification as e72f0c887b.
2024-03-02 00:16:19 +01:00
Peter Kokot
42a4e50513
Sync logical operators in shell scripting code (#13560)
This updates the obsolescent `-a` and `-o` binary primaries to `&&` and
`||`.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
2024-03-01 20:40:16 +01:00
Peter Kokot
98bd66f99e
Simplify clock_gettime Autoconf check (#13537)
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.
2024-02-28 08:17:37 +01:00
Peter Kokot
1feeadd0e2
Simplify times Autoconf check (#13464)
Similar simplification as e72f0c887b.
2024-02-23 21:27:18 +01:00
Peter Kokot
171e3986b0
Remove nsl library check in sapi/fpm (#13478)
In sapi/fpm the inet_ntop is used instead of the deprecated inet_addr
and the required library, if needed, is linked from the configure.ac.
2024-02-22 23:50:03 +01:00
Peter Kokot
9603199547
Remove HAVE_SYSCONF check (#13474)
The sysconf can be assumed to be present on current systems, when
checking for the _SC_CLK_TCK symbol.
2024-02-22 18:09:50 +01:00
Peter Kokot
7b2c67ca98
Simplify setpflags Autoconf check (#13458)
Similar simplification as e72f0c887b.
2024-02-21 21:01:47 +01:00
Peter Kokot
880ff82fc4
Fix the SO_LISTENQLEN check in FPM (#13089)
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.
2024-01-15 08:10:38 +01:00
Peter Kokot
8d7364f0bb Align configure check message results together 2024-01-11 00:02:28 +01:00
Peter Kokot
64751a0df0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Set libtool tag per command instead of global one
2024-01-10 09:17:48 +01:00
Peter Kokot
04954f6b2c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Set libtool tag per command instead of global one
2024-01-10 09:13:39 +01:00
Jan Palus
d57a7767a2 Set libtool tag per command instead of global one
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
2024-01-10 09:09:45 +01:00
Peter Kokot
fd7342f62f Fix _GNU_SOURCE redefined warnings in config.log
_GNU_SOURCE is already defined when doing these checks and warnings are
emitted otherwise in the configuration step.
2024-01-10 08:39:29 +01:00
Peter Kokot
dc1fbe4027
Remove duplicated socket check (#12839)
Check is already done in configure.ac.
2023-12-01 11:57:38 +00:00
Peter Kokot
186a07f044
Fix too many arguments in FPM ACL compile check (#12242)
The AC_COMPILE_IFELSE takes 3 arguments unlike AC_RUN_IFELSE which needs
the 4th argument for cross-compilation.
2023-09-19 18:52:34 +01:00