Commit Graph

52 Commits

Author SHA1 Message Date
Peter Kokot
bb35da336d
Autotools: Sync CS in extensions (#15343)
- Redundant double quotes removed
- AS_* macros used
- Few nits adjusted here and there
2024-08-11 17:42:26 +02:00
Peter Kokot
f66feaec0f
Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
1ceadaed52
Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Peter Kokot
23844538d1
Use preprocessor to check for AI_V4MAPPED, AI_ALL and AI_IDN (#13513)
The preprocessor macros defined in some header can be checked, using
Autoconf's AC_COMPILE_IFELSE, or with simpler AC_CHECK_DECL(S), or even
better and simpler directly in the C code.
2024-02-26 16:38:00 +01:00
Peter Kokot
7d295cbefb Check socket extension functions in a single Autoconf macro 2024-02-26 12:32:43 +01:00
Peter Kokot
0039446fee
Check for struct ucred with AC_CHECK_TYPES (#13510)
The AC_CHECK_TYPES can be used to check for the struct ucred. By
default it defines the symbol HAVE_STRUCT_UCRED instead of
ANC_CREDS_UCRED.
2024-02-25 23:02:17 +01:00
Peter Kokot
c1d6cf37e9
Check for struct cmsgcred with AC_CHECK_TYPES (#13507)
The AC_CHECK_TYPES can be used to check for the struct cmsgcred. By
default it defines the symbol HAVE_STRUCT_CMSGCRED instead of
ANC_CREDS_CMSGCRED.
2024-02-25 22:33:44 +01:00
Peter Kokot
b5c3cbf94b
Check sockaddr_storage.ss_family with AC_CHECK_MEMBERS (#13407)
This simplifies the check. On AIX 6 and newer, the ss_family is
available, if compiled without defining COMPAT_43 (BSD 4.3
compatibility).
2024-02-16 14:24:55 +01:00
Peter Kokot
52dba99d47 Sync headers installation
This syncs the installed sapi and extension headers on *nix and Windows
systems by installing only what is intended outside of php-src.

- ext/gd: without gd_arginfo.h and gd_compat.h
- ext/hash: php_hash_joaat.h and php_hash_fnv.h added also on Windows
  installation; xxhash/xxhash.h added on both installations as it is
  included in php_hash_xxhash.h; Include path for xxhash.h changed to
  relative so the php_hash_xxhash.h can be included outside of php-src;
  Redundant include flags removed
- ext/iconv: without iconv_arginfo.h
- ext/mysqli: mysqli_mysqlnd.h was missing on Windows
- ext/phar: php_phar.h was missing on Windows
- ext/sodium: php_libsodium.h was missing on *nix
- ext/xml: without xml_arginfo.h
- sapi/cli: cli.h was missing on Windows

Closes GH-13210
Closes GH-13213
2024-01-28 19:50:55 +01:00
Peter Kokot
7d485aa628
ext/sockets: Clean header checks (#12607)
- Unused header checks removed:
  HAVE_NETINET_TCP_H and HAVE_SYS_UN_H are not used in the code.
- Duplicate linux/filter.h check removed:
  HAVE_LINUX_FILTER_H is already defined in ext/sockets.
2023-11-04 15:12:16 +00:00
David CARLIER
4c4e72f149 socket add socket_atmark support.
checks whether the socket belongs to the out-of-band mark, thus allows to be
 processed accordingly (using the MSG_OOB flag on send/recv).

Closes #9846.
2022-10-31 16:38:18 +00:00
David Carlier
615b8006c4 socket module add SO_ATTACH_REUSEPORT_CPBF for Linux.
to be used in conjunction with SO_REUSPORT, giving a greater control
over how we bind a socket instead of the round robin workflow, we do
 instead attach to the processor id as :
- we assign the processor_id to A in the BPF filter.
- then returns A.

in other words, a more modern version of SO_INCOMING_CPU (ie can have a per
 worker notion we do not use here).
Closes #8062
2022-09-29 23:32:39 +01:00
David Carlier
07aaa34cd4
Fix GH-7978: sockets extension compilation errors
We fix the `ucred` detection when custom `CFLAGS` are in use.

Closes GH-7981.
2022-01-21 23:56:56 +01:00
David Carlier
51647eb23e
socket: ancillary credentials build fix for non linux systems.
for systems using SO_PASSCRED sockopt flag but not using ucred struct.
2021-12-21 07:25:43 +01:00
Peter Kokot
53299d610a Remove unused MISSING_MSGHDR_MSGFLAGS
Closes GH-4426
2019-07-18 02:17:14 +02:00
Peter Kokot
c70d9cdb11 Remove unused check for struct cmsghdr
The result of this check is to whether to define the HAVE_CMSGHDR symbol
or not. The HAVE_CMSGHDR is never used in the code and it has been
removed via 90289924c0.

Closes GH-4337
2019-07-01 13:13:51 +02:00
Peter Kokot
9a3c8e51e3 Sync functions checks
Removed unused checks:
- mbsinit check removed, HAVE_MBSINIT removed (not used in php-src)
- mempcpy check removed, HAVE_MEMPCPY removed (not used in php-src anymore since
  560ed89bfb which uses PHP's own implementation)
- strpncpy check removed, added via a8c9e893b6 and
  not used.
- setpgid check removed since HAVE_SETPGID is not used

Moved to a central configure.ac:
- fpclass
- mbrlen moved to configure.ac (since the HAVE_MBRLEN is used accross the php-src)
- sigprocmask
- getcwd
- getwd
- glob
- strfmon
- nice

Duplicated checks removed:
- gethostname
- getlogin
- getpwuid_r
- socketpair

- mprotect check simplified
2019-06-30 23:57:54 +02:00
Peter Kokot
2079b09854 Clean headers checks
Some headers were checked multiple times in the main configure.ac file
and in the bundled extensions or SAPIs themselves. Also many of these
checks are then used accross other extensions or SAPIs so a central
configure.ac makes most sense for these checks.
2019-06-27 02:45:09 +02:00
Peter Kokot
75fb74860d Normalize comments in *nix build system m4 files
Normalization include:
- Use dnl for everything that can be ommitted when configure is built in
  favor of the shell comment character # which is visible in the output.
- Line length normalized to 80 columns
- Dots for most of the one line sentences
- Macro definitions include similar pattern header comments now
2019-05-12 18:43:03 +02:00
Peter Kokot
9df6a1e4dd Add AS_HELP_STRING to *nix build configure options
The Autoconf's default AS_HELP_STRING macro can properly format help
strings [1] so watching out if columns are aligned manually is not
anymore.

[1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Pretty-Help-Strings
2019-03-07 20:36:59 +01:00
Nikita Popov
ef8fbd6fc9 Merge branch 'PHP-7.3' 2018-11-20 21:16:36 +01:00
Nikita Popov
7a0d3406f6 Merge branch 'PHP-7.2' into PHP-7.3 2018-11-20 21:16:28 +01:00
Mizunashi Mana
e672cd4385 Define __APPLE_USE_RFC_3542 for new ipv6 constants 2018-11-20 21:16:03 +01:00
Peter Kokot
50b9ef8d94 Remove not needed checking for <errno.h>
Header `<errno.h>` is part of the standard C89 headers [1] and on
current systems checking is not need anymore since PHP requires at
least C89. This is noted also by Autoconf itself in the docs and
code [2].

The Autoconf check defined the `HAVE_ERRNO_H` symbol when building PHP
with sockets extension or fpm sapi. This symbol is not utilized across
the PHP source code except in the current version of bundled GD library
which has worked ok so far also with sockets extension or fpm sapi
disabled anyway.

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
2018-09-09 10:19:04 +02:00
Peter Kokot
4371945b8b Replace obsolete AC_TRY_FOO with AC_FOO_IFELSE
Autoconf 2.50 released in 2001 made several macros obsolete including
the AC_TRY_RUN, AC_TRY_COMPILE and AC_TRY_LINK:
http://git.savannah.gnu.org/cgit/autoconf.git/tree/ChangeLog.2

These macros should be replaced with the current AC_FOO_IFELSE instead:
- AC_TRY_RUN with AC_RUN_IFELSE and AC_LANG_SOURCE
- AC_TRY_LINK with AC_LINK_IFELSE and AC_LANG_PROGRAM
- AC_TRY_COMPILE with AC_COMPILE_IFELSE and AC_LANG_PROGRAM

PHP 5.4 to 7.1 require Autoconf 2.59+ version, PHP 7.2 and above require
2.64+ version, and the PHP 7.2 phpize script requires 2.59+ version which
are all greater than above mentioned 2.50 version therefore systems
should be well supported by now.

This patch was created with the help of autoupdate script:
autoupdate <file>

Reference docs:
- https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html
- https://www.gnu.org/software/autoconf/manual/autoconf-2.59/autoconf.pdf
2018-07-30 02:36:38 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Thomas Petazzoni
8489ecefd3 ext/sockets: make AI_IDN usage optional
AI_IDN is not supported by all C libraries (uClibc, musl), so make it
optional, like AI_ALL.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-03-11 16:35:17 +01:00
David Carlier
93d7cf375e Fix openbsd build: AI_V4MAPPED, AI_ALL not defined 2017-03-27 18:55:34 +02:00
Anatol Belski
08b2638275 convert ext/sockets to work with the static tsrm cache pointer 2014-10-05 20:48:32 +02:00
Felipe Pena
78f69a2b4f - Fixed bug #65923 (ext/socket assumes AI_V4MAPPED is defined) 2013-11-30 11:39:57 -02:00
Gustavo Lopes
4414b33abd Refactoring: move stuff to new conversions.c 2013-02-02 16:38:08 +01:00
Gustavo Lopes
5e51c85143 Wrap recvmsg() and sendmsg()
This introduces two new functions:

int socket_recvmsg(resource $socket, array &$msghdr, int $flags)
int socket_sendmsg(resource $socket, array $msghdr, int $flags)

The arrays representing struct msghdr follow the native counterpart
closely: structs are mapped to arrays, fields to array elements whose
key is the name of the field without the prefix (e.g. "name" instead
of "msg_name") and array are mapped to sequential numeric PHP arrays.

Right now the only type of ancillary data supported is fot the
level/type pair IPPROTO_IPV6/IPV6_PKTINFO.

I also refactored out the name resolution functions and made
sockets_strerror() a global function.
2013-02-02 16:38:05 +01:00
Felipe Pena
ffe8303f24 - Fixed bug #62025 (__ss_family was changed on AIX 5.3) 2012-05-20 19:37:20 -03:00
Gustavo André dos Santos Lopes
c2d392e934 - Fixed build on Solaris. 2011-04-30 15:56:07 +00:00
Gustavo André dos Santos Lopes
e4298bf0fb - Added multicast support to the sockets extension (bug #40510). 2011-03-14 00:08:29 +00:00
Mikko Koppanen
4000617c8b Share the php_sockets.h header
Share php_sockets_le_socket_name
2009-12-27 01:00:50 +00:00
Jani Taskinen
4e921b7ea6 MFB: sockepair is not always available 2007-07-22 22:17:51 +00:00
Sara Golemon
010f5a12c7 Make php_set_inet6_addr happy with any environment. Use getaddrinfo() if available, gethostbyname2() if not, and simply fail if neither is present. 2003-07-08 03:38:00 +00:00
Derick Rethans
05db82333d - Correct stray commit 2003-06-19 08:41:51 +00:00
Sterling Hughes
651854a6dd enable sockets by default. 2003-06-19 04:39:42 +00:00
foobar
392f3c2d7c - Checks specific to some extension belong in the extension's config.m4 2003-04-04 15:42:54 +00:00
foobar
f05db43a68 Fix bug: #19212 2002-09-04 14:30:36 +00:00
Sascha Schumann
226e1ed246 As far as I can tell, the AC_CHECK_MEMBER could not succeed,
because it does not include <sys/socket.h> which is necessary
for the definition of struct msghdr.  This include file is not
part of ac_includes_default.

Regardless, AC_CHECK_MEMBER is a autoconf-2.5x macro and thus we
expand it here for 2.13 compatibility.
2002-05-12 17:28:12 +00:00
Jason Greene
969d7e5a82 Fix build on IRIX for both mips and gcc 2002-05-12 07:22:47 +00:00
Sascha Schumann
5cba3a99c2 extension converted automatically to PHP_NEW_EXTENSION. Manually confirmed 2002-03-12 16:44:00 +00:00
foobar
f1397d5339 Unified the configure messages. 2001-11-30 19:00:13 +00:00
foobar
9ddd6300de Fix the compile problem on some systems that do not have hstrerror() 2001-06-12 04:42:01 +00:00
foobar
679b914dc0 Cleaned up a bit. Removed some checks for header files that are
already checked in configure.in
2001-04-04 00:06:49 +00:00
Chris Vandomelen
0646a49386 Corrected some bugs dealing with compile failures (should now compile
on most varieties of Linux, and should hopefully fix at least 3 of the
compile errors that were discovered). Also modified read() slightly
to take an optional parameter as to whether the data was binary or
text so it wouldn't stop reading on a newline or null byte received.
@- Made read() binary-safe in sockets.c (Chris Vandomelen)
@- Attempted fixing some compile failures (Chris Vandomelen)
# Hopefully someone will attempt to compile this on other systems, I
# have no access to other platforms to compile it on ....
2000-10-22 06:45:03 +00:00
Rasmus Lerdorf
b189759bcd Clean up the alignment of configure --help output 2000-10-02 17:36:01 +00:00