Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,11 @@ AS_VAR_IF([PHP_BUILD_ARCH],,,
[AC_DEFINE_UNQUOTED([PHP_BUILD_ARCH], ["$PHP_BUILD_ARCH"],
[The build architecture.])])

AC_ARG_VAR([PHP_BUILD_OS], [The build OS])
AS_VAR_IF([PHP_BUILD_OS],,,
[AC_DEFINE_UNQUOTED([PHP_BUILD_OS], ["$PHP_BUILD_OS"],
[The build OS.])])

PHP_SUBST([PHP_FASTCGI_OBJS])
PHP_SUBST([PHP_SAPI_OBJS])
PHP_SUBST([PHP_BINARY_OBJS])
Expand Down
15 changes: 9 additions & 6 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,20 @@ PHPAPI char *php_get_version(sapi_module_struct *sapi_module)
#else
"NTS"
#endif
#ifdef PHP_BUILD_COMPILER
" " PHP_BUILD_COMPILER
#endif
#ifdef PHP_BUILD_ARCH
" " PHP_BUILD_ARCH
#endif
#if ZEND_DEBUG
" DEBUG"
#endif
#ifdef HAVE_GCOV
" GCOV"
#endif
#ifdef PHP_BUILD_ARCH
" " PHP_BUILD_ARCH
#endif
#ifdef PHP_BUILD_OS
" " PHP_BUILD_OS
#endif
#ifdef PHP_BUILD_COMPILER
" " PHP_BUILD_COMPILER
#endif
);
smart_string_appends(&version_info, "Copyright (c) The PHP Group\n");
Expand Down
39 changes: 39 additions & 0 deletions main/php_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,45 @@ PHPAPI bool php_tsrm_startup(void);
#define PHP_OS_STR PHP_OS
#endif

#define _PHP_STRINGIFY(s) #s
#define PHP_STRINGIFY(s) _PHP_STRINGIFY(s)

#ifndef PHP_BUILD_COMPILER
# if defined(__clang__)
# define PHP_BUILD_COMPILER "Clang " PHP_STRINGIFY(__clang_major__)
# elif defined(__GNUC__)
# define PHP_BUILD_COMPILER "GCC " PHP_STRINGIFY(__GNUC__)
# endif
#endif

#ifndef PHP_BUILD_ARCH
# if defined(__x86_64__)
# define PHP_BUILD_ARCH "x64"
# elif defined(__i386__)
# define PHP_BUILD_ARCH "x86"
# elif defined(__aarch64__)
# define PHP_BUILD_ARCH "aarch64"
# endif
#endif

#ifndef PHP_BUILD_OS
# if defined(PHP_WIN32)
# define PHP_BUILD_OS "WINNT"
# elif defined(__APPLE__)
# define PHP_BUILD_OS "Darwin"
# elif defined(__linux__)
# define PHP_BUILD_OS "Linux"
# elif defined(__FreeBSD__)
# define PHP_BUILD_OS "FreeBSD"
# elif defined(__NetBSD__)
# define PHP_BUILD_OS "NetBSD"
# elif defined(__OpenBSD__)
# define PHP_BUILD_OS "OpenBSD"
#elif defined(__sun__)
# define PHP_BUILD_OS "Solaris"
# endif
#endif

END_EXTERN_C()

#endif