Commit Graph

2353 Commits

Author SHA1 Message Date
Christoph M. Becker
edcd6cc564
gai_strerror() is not thread-safe on Windows (GH-15568)
First we refactor to have only a single usage of `PHP_GAI_STRERROR()`
left; then we drop the macro in favor of calling the different
functions conditionally in an ad-hoc style.

This is necessary because the return value of `php_win32_error_to_msg`
needs to be freed by the caller.

The error messages are no more inline with other error messages, since
`gai_strerror()` apparently always appends a period and a space.

We also properly configure IPv4/v6 on Windows.  Since WSPiApi.h has been
created in 2000, so we can safely assume that it is available everywhere
nowadays.  Furthermore, `gai_strerror()` is available regardless of
whether there is IPv6 support.
2024-09-08 16:16:40 +02:00
Daniel Ruf
dfe6c13850
Fix typo (#15780)
* Fix typo

* Implement conditional message

* Use suggested code with ternary

* Wrap ternary

Co-authored-by: Peter Kokot <peterkokot@gmail.com>

---------

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-09-07 15:25:02 +02:00
Christoph M. Becker
6732b8892d
Support --openssl-legacy-providers on Windows, too (GH-15747)
This is not necessarily useful for Windows (few use custom builds on
that platform), but for feature parity with other platforms it seems
reasonable to support it on Windows.

We make sure, though, that the feature is not enabled for snapshot
builds by adding the option to the build exclusions.
2024-09-05 10:49:16 +02:00
Christoph M. Becker
b3d6414b87
Drop support for building with MSC_VER < 1920
`MSC_VER` 1920 refers to Visual Studio 2019 RTW 16.0[1], and this
should be the bare minimum which we support nowadays.  If users use an
older Visual Studio version, we fail gracefully during `configure`.

[1] <https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170>

Closes GH-15403.
2024-08-31 17:00:21 +02:00
Arnaud Le Blanc
58aa6fc830
Lazy objects
RFC: https://wiki.php.net/rfc/lazy-objects

Closes GH-15019
2024-08-30 17:30:03 +02:00
Christoph M. Becker
6a51062c85
Drop unused, but confusing macro definition (GH-15541)
`PHP7DLLTS_EXPORTS` is not used throughout php-src, and it's unlikely
that it is used by any extension, especially since it still refers to
PHP 7.  The symbol had been introduced in 2014[1], but is not even used
in latest PHP-7.4; probably it was just supposed to be used, or part of
phpng.

[1] <fc734cf95d>

Since CI already ran for the PR, we can now [skip ci].
2024-08-22 14:58:55 +02:00
Christoph M. Becker
e5a30274d8
Support AVX-512 builds on Windows (GH-15159)
"Since limited support for `/arch:AVX512` was added in Visual Studio
2017, and expanded in Visual Studio 2019"[1], we can safely offer this
option, since PHP 8.4 is supposed to build with Visual Studio 2022, and
it is unlikely that someone tries to build PHP 8.4 with Visual Studio,
requesting AVX-512 support.

[1] <https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170>
2024-08-22 13:06:28 +02:00
Peter Kokot
660a860f26
Fix GH-15501: Windows HAVE_<header>_H macros defined to 1 or undefined (#15508)
Previously the CHECK_HEADER_ADD_INCLUDE function defined the
`HAVE_<header>_H` preprocessor macros to value 0 or 1 whether the
`<header.h>` file was found. This syncs it with Autotools build system
where most of these macros are either undefined or defined to 1.

In possible edge cases where such macros might be intentionally used
like this without being aware that HAVE_HEADER_H can be 0 or 1 on
Windows:

| #ifdef HAVE_HEADER_H
| ...
| #endif

there is backwards incompatibility for PECL extensions in case the
header wouldn't exist on Windows such code wouldn't execute. However,
this is considered a bug if such case is present. From the Autotools
point of view, the check is correct though and should be used with
ifdef/defined() checks.

Help text is also synced to Autotools style:
`Define to 1 if you have the <header.h> header file.`
2024-08-20 21:10:50 +02:00
Peter Kokot
b86dfd76a2
Remove php_win32_init_gettimeofday declaration (#15451)
* Remove php_win32_init_gettimeofday declaration

Follow-up of GH-15400 (25afbdb09e).

* Remove unused header include

* Include php.h before win32/ioutil.h
2024-08-17 13:58:40 +02:00
Christoph M. Becker
b0ac9bf669
Explicitly drop support for old clang versions on Windows (GH-15415)
* Explicitly drop support for old clang versions on Windows

This ensures compatibility with the typedef redefinitions we use, and
makes it clear during the `configure` stage that old compiler versions
are not supported.

See <https://releases.llvm.org/> regarding the release history of clang.

We also remove support for two number versions of clang, since as of
LLVM 4.0.0 the project uses a three number versioning scheme; see
<https://blog.llvm.org/2016/12/llvms-new-versioning-scheme.html>.
2024-08-15 14:30:23 +02:00
Christoph M. Becker
ec2655f88b
Voidify getfilesystemtime() (GH-15413)
The function always returned 0, and the return values was never used,
so we declare it to return void.

While we're at it, we also fix the space indentation of the comment.
2024-08-14 21:09:26 +02:00
Christoph M. Becker
25afbdb09e
GetSystemTimePreciseAsFileTime() is now always available (GH-15400)
* GetSystemTimePreciseAsFileTime() is now always available

As of PHP 8.3.0, we require Windows Server 2012 or Windows 8 as bare
minimum.  Since GetSystemTimePreciseAsFileTime() is always available on
these Windows versions[1], there is no more need for the workaround
described in dllmain.c; we just can call the function directly.

[1] <https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>
2024-08-14 20:00:27 +02:00
Christoph M. Becker
8740fdf1f6
Support somewhat recent clang versions on Windows (GH-15324)
Prior to clang 10.0.0, `clang-cl -v` apparently always appended some
fine grained version information in parentheses[1]; this is no longer
the case, so the build fails early because the compiler version could
not be detected.  Since we never used this fine grained version info,
we no longer check for it.

As of clang 13.0.0, the `/fallback` command option has been removed[2],
so we only set the flag for older clang versions.

[1] <https://github.com/php/php-src/pull/11313#discussion_r1712097627>
[2] <https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#removed-compiler-flags>
2024-08-10 20:57:53 +02:00
Christoph M. Becker
d98c4b6ebe
Fix comments in win32/sendmail.c (GH-15326)
These use a mixed style of block and line comments, and clang warns
about this (`-Wcomment`), so we fix that.
2024-08-10 13:59:06 +02:00
Peter Kokot
a355c3572e
Update and sync PHP build preprocessor macros help texts (#15298)
[skip ci]
2024-08-08 21:31:57 +02:00
Christoph M. Becker
d5c4522547
Use new MSVC preprocessor for VS 17 builds
From the documentation[1]:

| We're updating the Microsoft C++ preprocessor to improve standards
| conformance, fix longstanding bugs, and change some behaviors that
| are officially undefined. We've also added new diagnostics to warn
| on errors in macro definitions.

Thus it appears to be sensible to switch to the new preprocessor for
all VS17 builds.  Note that although the new preprocessor is available
as of VS16.5 (i.e. `version >= 1925`), we don't want to potentially
break older builds, and as such use the new preprocessor only for VS17
builds.  Users who wish to use the new preprocessor with VS16, can
still `set CFLAGS=/Zc:preprocessor` before running `buildconf`/`phpize`.

[1] <https://learn.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview?view=msvc-170>

Closes GH-15201.
2024-08-06 17:14:34 +02:00
Peter Kokot
62f75a7812
Autotools: Refactor thread safety checks (#15214)
- The ZTS is defined on only one place
- Added help text for ZTS preprocessor macro
- The 'enable_zts' variable replaced with PHP_THREAD_SAFETY in
  configure.ac.
- Nits fixed.
2024-08-05 22:30:10 +02:00
Peter Kokot
f16ab75171
Refactor HAVE_SQLDATASOURCES check (#15222)
On Windows, this preprocessor macro is moved to odbc extension, in
Autotools check CS is synced and some basic help text is added.
2024-08-04 11:57:01 +02:00
Peter Kokot
48916cec33
Sync file permissions
Git can track executable (0755) and non-executable (0644) file modes.
This is a minor file permissions sync for the win32/build/mkico.sh
(0755).

[skip ci]
2024-08-02 02:39:52 +02:00
Christoph M. Becker
2f17f157ca
Support AVX-512 builds on Windows
"Since limited support for `/arch:AVX512` was added in Visual Studio
2017, and expanded in Visual Studio 2019"[1], we can safely offer this
option, since PHP 8.4 is supposed to build with Visual Studio 2022, and
it is unlikely that someone tries to build PHP 8.4 with Visual Studio,
requesting AVX-512 support.

[1] <https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170>
2024-07-29 21:19:10 +02:00
Peter Kokot
436baae172
[skip ci] Sync HAVE_SIGSETJMP removal
This adds notice in the UPGRADING.INTERNALS file and removes redundant
undefinition from Windows config header.

Follow-up of GH-14942.
2024-07-18 22:15:33 +02:00
Christoph M. Becker
f590b34530
Drop support for OpenSSL < 1.1.0 on Windows
PR #13498 bumped the required OpenSSL version to 1.1.1, but apparently
only for non Windows system.  We catch up somewhat by dropping support
for OpenSSL < 1.1.0 on Windows; besides completely removing detection
of old OpenSSL versions in `SETUP_OPENSSL`, we also ensure that all
bundled extension using this function do no longer accept OpenSSL <
1.1.0, to avoid to still be able to build these extensions with older
`phpize` scripts.

We do not cater to `--phar-native-ssl` yet; that might better be
addressed by #14578.

Closes GH-14973.
2024-07-17 12:22:59 +02:00
Ayesh Karunaratne
e7c16d2a6a
Build/Windows: Update the Windows icon as svg and build derivatives from it
Co-Authored-By: Nurudin Imsirovic <realnurudinimsirovic@gmail.com>

Closes GH-14964.
2024-07-16 14:47:31 +02:00
Ilija Tovilo
780a8280d2
[RFC] Property hooks (#13455)
RFC: https://wiki.php.net/rfc/property-hooks

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2024-07-14 11:55:03 +02:00
Peter Kokot
2ebef11e83
Update http links to https and sync www.php.net URLs (#14854) 2024-07-07 04:23:08 +02:00
Christoph M. Becker
ffab987fb1
Update MSVC compiler version detection (#14810)
As of Visual Studio 2015, the major version of the compiler (`cl.exe`)
is 19, and the minor version increases by steps of 10.  However, the
latest Visual Studio 2022 release has the version `19.40`, so that
Visual Studio version is not properly detected.  This is not a big deal
regarding the reported compiler version (`php -v` etc.), but the
filenames of the builds would no longer match the expectations (instead
of `vs17` there is now `19.40.33811` or another build number).  This
implies that the files would have to be renamed manually to be properly
handled by windows.php.net (or that code would have to be adapted).

Therefore we update the version detection to detect all versions < 1950
as Visual Studio 2022, assuming that "For major releases, the minor
version increases by 10."[1] still holds in the future.

[1] <https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170#visual-studio-2017-and-later>
2024-07-05 11:25:32 +02:00
Peter Kokot
f3feef8b93
Define default RE2C_FLAGS (#14615)
The --no-generation-date flag is a common re2c flag used in all re2c
invocations. This adds the 2nd optional argument to PHP_PROG_RE2C M4
macro in BC manner to set the default re2c command-line options and sets
the default RE2C_FLAGS similarly on Windows.
2024-06-24 22:09:04 +02:00
Peter Kokot
cf3b9fca8f
Sync #if/ifdef/defined (-Wundef) (#14623)
These are either define (to value 1) or undefined:
- __GNUC__
- DBA_CDB_BUILTIN
- DBA_GDBM
- HAVE_FORK
- HAVE_PUTENV
- HAVE_SETENV
- HAVE_SYS_SELECT_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_WAIT_H
- HAVE_UNSETENV
- RFC3678_API
- ZEND_ENABLE_ZVAL_LONG64
- ZTS

Follow-up of GH-5526
2024-06-24 19:37:07 +02:00
Peter Kokot
106581b1b6
Remove outdated libs_version.txt file (#14631)
This is not being synced with changes done in github.com/winlibs and
served only for documentation purposes. Since the list is outdated it is
simpler to remove it than maintain it updated.
2024-06-24 00:54:26 +02:00
Peter Kokot
6e825dfe43
Add --enable-phpdbg-debug option on Windows (#14568)
This enables outputting additional debugging messages when running
phpdbg for developing and troubleshooting phpdbg itself. Option was
already added in Autotools and this adds it also to Windows build
system.

Because additional info is printed when running tests, the
--enable-phpdbg-debug option is excluded when building with
--enable-snapshot-build if not provided explicitly.
2024-06-15 14:41:15 +02:00
Niels Dossche
26fcb5f2b2 win32: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Peter Kokot
84a0da1574
Sync #if/ifdef/defined (#14508)
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

These are either undefined or defined to 1 in Autotools and Windows.

Follow up of GH-5526 (-Wundef).
2024-06-09 14:23:41 +02:00
Peter Kokot
f109795852
Sync HAVE_GRP_H definition (#14514)
This syncs the HAVE_GRP_H definition on Windows (manually defined) and
Autotools (checked with AC_CHECK_HEADERS):
HAVE_GRP_H is is either undefined or defined to value 1.
2024-06-09 01:55:27 +02:00
Peter Kokot
cb2c5de3db
Add PHP_SBINDIR (#13363)
The PHP_SBINDIR symbol was defined on *nix systems but never used. This
adds the constant similar to PHP_BINDIR also to PHP. On Windows it is
the value of prefix configuration when PHP was built (same value as
PHP_BINDIR).
2024-05-29 07:04:05 +02:00
Peter Kokot
2f6a210755
Use memmove() unconditionally in the code (#13647)
The memmove() function is C99 standard function [1] and check was left for
the PCRE2 bundled library. It can be simplified by passing the compile
option instead of checking always available function on current systems.
External PCRE2 library on the system doesn't need this.

[1]: https://port70.net/~nsz/c/c99/n1256.html#7.21.2.2
2024-03-09 20:30:08 +01:00
Peter Kokot
713ac3440c
Remove unused config.w32.h.in symbols (#13617)
- CONFIGURATION_FILE_PATH
  Removed via 2cf1b8d345.

- DISCARD_PATH
  Used for the --enable-discard-path CGI configure option and converted
  to INI configuration. Removed via
  06f43b30c1.

- HAVE_ERRMSG_H
  Removed via fd1578c196.

- HAVE_REGCOMP
  Used for regcomp function.

- HAVE_RINT
  Used for rint function.

- NEED_ISBLANK
  Windows ctype.h once didn't have C99 isblank() function. Cannot be
  found on current Windows systems anymore, neither was used in PHP at
  least since PHP 4.0.

- PHP_URL_FOPEN
  Removed via cae27179ce.

- REGEX
  Not used in current code.

- HSREGEX
  Not used in current code.

- USE_CONFIG_FILE
  Symbol was once defined by the --with-config-file-path configure
  option.
2024-03-07 20:27:10 +01:00
Jorg Sowa
9c4beac8d3 Remove inet_aton
This removes the deprecated inet_aton and its Windows implementation.
The inet_aton can be replaced with platform agnostic inet_pton.

Closes GH-13479
2024-02-23 23:16:43 +01:00
Peter Kokot
bd365149f2
Find and link math library as needed with AC_SEARCH_LIBS (#13481)
On some systems (Haiku) the math library is part of the C library and it
doesn't need to be explicitly prepended to LIBS. The redundant HAVE_LIBM
symbol defined by the AC_CHECK_LIB has been removed.
2024-02-23 20:48:10 +01:00
Jorg Adam Sowa
e630aacf79
Remove HAVE_INET_PTON (#13410) 2024-02-21 00:43:56 +00:00
Ilija Tovilo
631bc81607
Implement stackless internal function calls
Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12461
2024-02-06 17:42:28 +01:00
Peter Kokot
b3bdc23656 Remove unused Makefile variables FIBER_ASSEMBLER and FIBER_ASM_ARCH
In Windows build system these were replaced with common PHP_ASSEMBLER
and FIBER_ASM_ABI when adjusting for the arm64.

Closes GH-13263
2024-01-30 09:50:22 +01:00
Peter Kokot
a651ae86aa
Sync Zend/Optimizer headers installation (#13201)
On *nix installation there is zend_dfg.h installed as part of the bug
fix #81136, but it wasn't synced with Windows yet. This now syncs Zend
headers on both builds.
2024-01-20 15:05:06 +01:00
Peter Kokot
c774a8d401
Add bison -Wall flag to Windows build (#13098)
Following the d7d3a1c66e, this adds bison
flag -Wall also to Windows build system.

Flag has been added via 2127a37b83.
2024-01-11 11:05:00 +01:00
Peter Kokot
bb1109d9f1 Remove unused HAVE_INET_NTOP
The inet_ntop() is always required and present via
931a8b0739.
2024-01-04 20:48:17 +01:00
Peter Kokot
84022db846
Remove unused SIZEOF_SHORT (#13034) 2023-12-30 00:58:47 +01:00
Ilija Tovilo
2efe366af6
Add zend_worklist.h to PHP_INSTALL_HEADERS (#12571)
Fixes GH-12565
2023-10-30 19:37:27 +01:00
Christian Clauss
886bf820c9
[skip ci] Fix typos discovered by codespell (#12228) 2023-09-18 11:07:17 +01:00
Peter Kokot
8df8550321
Remove unneeded zend_language_parser.h patch (#12178)
This was cleaned in 4cbffd89d9 and
patching the Zend/zend_language_parser.h file to include zend.h is not
needed anymore.

Autotools build system part has been similarly cleaned via
32cdd330f3
2023-09-14 08:04:21 +02:00
Pierrick Charron
ad2ac6f05f
Prepare for PHP 8.4 2023-08-29 15:25:46 -04:00
Peter Kokot
9911ab7142
Remove unused ZEND_STACK_GROWS_DOWNWARDS constant (#11762) 2023-07-22 19:39:42 +02:00