Skip to content

Remove PHP_DEFINE m4 macro #4360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
11 changes: 0 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ Makefile.fragments
Makefile.objects

# Directories for shared object files and headers generated by `./configure`
include/
libs/
modules/

Expand All @@ -86,16 +85,6 @@ modules/
config.h
config.h.in
/ext/date/lib/timelib_config.h
/ext/iconv/php_have_bsd_iconv.h
/ext/iconv/php_have_glibc_iconv.h
/ext/iconv/php_have_ibm_iconv.h
/ext/iconv/php_have_iconv.h
/ext/iconv/php_have_libiconv.h
/ext/iconv/php_iconv_aliased_libiconv.h
/ext/iconv/php_iconv_broken_ignore.h
/ext/iconv/php_iconv_supports_errno.h
/ext/iconv/php_php_iconv_h_path.h
/ext/iconv/php_php_iconv_impl.h
/main/build-defs.h
/main/php_config.h.in
/main/php_config.h
Expand Down
4 changes: 1 addition & 3 deletions build/Makefile.global
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
INSTALL = $(top_srcdir)/build/shtool install -c
INSTALL_DATA = $(INSTALL) -m 644

DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
DEFS = -I$(top_builddir)/main -I$(top_srcdir)
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)

all: $(all_targets)
Expand Down Expand Up @@ -123,12 +123,10 @@ distclean: clean
rm -f ext/date/lib/timelib_config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 sapi/phpdbg/phpdbg.1 ext/phar/phar.1 ext/phar/phar.phar.1
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h
rm -f ext/phar/phar.phar ext/phar/phar.php
if test "$(srcdir)" != "$(builddir)"; then \
rm -f ext/phar/phar/phar.inc; \
fi
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f

prof-gen:
CCACHE_DISABLE=1 $(MAKE) PROF_FLAGS=-fprofile-generate all
Expand Down
36 changes: 2 additions & 34 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@ AC_DEFUN([PHP_EXPAND_PATH],[
fi
])

dnl
dnl PHP_DEFINE(WHAT [, value[, directory]])
dnl
dnl Creates builddir/include/what.h and in there #define WHAT value.
dnl
AC_DEFUN([PHP_DEFINE],[
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > ]ifelse([$3],,[include],[$3])[/php_]translit($1,A-Z,a-z)[.h]
])

dnl
dnl PHP_SUBST(varname)
dnl
Expand Down Expand Up @@ -135,12 +126,8 @@ dnl Creates build directories and Makefile placeholders.
dnl
AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
test -d include || $php_shtool mkdir include
> Makefile.objects
> Makefile.fragments
dnl We need to play tricks here to avoid matching the grep line itself.
pattern=define
$EGREP $pattern'.*include/php' $srcdir/configure|$SED 's/.*>//'|xargs touch 2>/dev/null
])

dnl
Expand Down Expand Up @@ -1940,19 +1927,6 @@ AC_DEFUN([PHP_SETUP_ICONV], [
found_iconv=no
unset ICONV_DIR

dnl Create the directories for a VPATH build.
$php_shtool mkdir -p ext/iconv

echo > ext/iconv/php_have_bsd_iconv.h
echo > ext/iconv/php_have_ibm_iconv.h
echo > ext/iconv/php_have_glibc_iconv.h
echo > ext/iconv/php_have_libiconv.h
echo > ext/iconv/php_have_iconv.h
echo > ext/iconv/php_php_iconv_impl.h
echo > ext/iconv/php_iconv_aliased_libiconv.h
echo > ext/iconv/php_php_iconv_h_path.h
echo > ext/iconv/php_iconv_supports_errno.h

dnl Check libc first if no path is provided in --with-iconv.
if test "$PHP_ICONV" = "yes"; then
dnl Reset LIBS temporarily as it may have already been included -liconv in.
Expand All @@ -1962,8 +1936,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [
found_iconv=yes
],[
AC_CHECK_FUNC(libiconv,[
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
AC_DEFINE(HAVE_LIBICONV, 1, [ ])
AC_DEFINE(HAVE_LIBICONV, 1, [Define to 1 if you have the libiconv])
found_iconv=yes
])
])
Expand Down Expand Up @@ -1996,9 +1969,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [
then
PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
found_iconv=yes
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
AC_DEFINE(HAVE_LIBICONV,1,[ ])
PHP_DEFINE([ICONV_ALIASED_LIBICONV],1,[ext/iconv])
AC_DEFINE([ICONV_ALIASED_LIBICONV],1,[iconv() is aliased to libiconv() in -liconv])
], [
PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [
Expand All @@ -2013,7 +1984,6 @@ AC_DEFUN([PHP_SETUP_ICONV], [
fi

if test "$found_iconv" = "yes"; then
PHP_DEFINE(HAVE_ICONV,1,[ext/iconv])
AC_DEFINE(HAVE_ICONV,1,[ ])
if test -n "$ICONV_DIR"; then
PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/$PHP_LIBDIR, $1)
Expand Down Expand Up @@ -2162,9 +2132,7 @@ dnl PHP_CHECK_PDO_INCLUDES([found [, not-found]])
dnl
AC_DEFUN([PHP_CHECK_PDO_INCLUDES],[
AC_CACHE_CHECK([for PDO includes], pdo_cv_inc_path, [
if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
pdo_cv_inc_path=$abs_srcdir/ext
elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
if test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
pdo_cv_inc_path=$abs_srcdir/ext
elif test -f $phpincludedir/ext/pdo/php_pdo_driver.h; then
pdo_cv_inc_path=$phpincludedir/ext
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,7 @@ PHP_SUBST(all_targets)
PHP_SUBST(install_targets)
PHP_SUBST(install_binary_targets)

PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/])
PHP_INSTALL_HEADERS([Zend/ TSRM/ main/ main/streams/])

PHP_ADD_SOURCES(TSRM, TSRM.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)

Expand Down
2 changes: 0 additions & 2 deletions docs/unix-build-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
especially noticeable on slower systems
* slow recursive make replaced with one global Makefile
* eases integration of proper dependencies
* adds PHP_DEFINE(what[, value]) which creates a single include-file per what.
This will allow more fine-grained dependencies.
* abandoning the "one library per directory" concept
* improved integration of the CLI
* several new targets:
Expand Down
22 changes: 1 addition & 21 deletions ext/iconv/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -89,36 +89,23 @@ int main() {
])
fi

echo > ext/iconv/php_have_bsd_iconv.h
echo > ext/iconv/php_have_glibc_iconv.h
echo > ext/iconv/php_have_libiconv.h
echo > ext/iconv/php_have_ibm_iconv.h

case "$iconv_impl_name" in
gnu_libiconv [)]
PHP_DEFINE([PHP_ICONV_IMPL],[\"libiconv\"],[ext/iconv])
AC_DEFINE([PHP_ICONV_IMPL],["libiconv"],[Which iconv implementation to use])
PHP_DEFINE([HAVE_LIBICONV],1,[ext/iconv])
AC_DEFINE(HAVE_LIBICONV, 1, [Define to 1 if you have the libiconv])
PHP_ADD_LIBRARY_WITH_PATH(iconv, "$PHP_ICONV_PREFIX/$PHP_LIBDIR", ICONV_SHARED_LIBADD)
;;

bsd [)]
PHP_DEFINE([HAVE_BSD_ICONV],1,[ext/iconv])
AC_DEFINE([HAVE_BSD_ICONV],1,[Konstantin Chuguev's iconv implementation])
PHP_DEFINE([PHP_ICONV_IMPL],[\"BSD iconv\"],[ext/iconv])
AC_DEFINE([PHP_ICONV_IMPL],["BSD iconv"],[Which iconv implementation to use])
;;

glibc [)]
PHP_DEFINE([HAVE_GLIBC_ICONV],1,[ext/iconv])
AC_DEFINE([HAVE_GLIBC_ICONV],1,[glibc's iconv implementation])
PHP_DEFINE([PHP_ICONV_IMPL],[\"glibc\"],[ext/iconv])
AC_DEFINE([PHP_ICONV_IMPL],["glibc"],[Which iconv implementation to use])
;;
ibm [)]
PHP_DEFINE([HAVE_IBM_ICONV],1,[ext/iconv])
AC_DEFINE([HAVE_IBM_ICONV],1,[IBM iconv implementation])
PHP_DEFINE([PHP_ICONV_IMPL],[\"IBM iconv\"],[ext/iconv])
AC_DEFINE([PHP_ICONV_IMPL],["IBM iconv"],[Which iconv implementation to use])
;;
esac
Expand All @@ -143,15 +130,12 @@ int main() {
}
]])],[
AC_MSG_RESULT(yes)
PHP_DEFINE([ICONV_SUPPORTS_ERRNO],1,[ext/iconv])
AC_DEFINE([ICONV_SUPPORTS_ERRNO],1,[Whether iconv supports error no or not])
],[
AC_MSG_RESULT(no)
PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0,[ext/iconv])
AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports error no or not])
],[
AC_MSG_RESULT(no, cross-compiling)
PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0,[ext/iconv])
AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports error no or not])
])

Expand All @@ -174,15 +158,12 @@ int main() {
}
]])],[
AC_MSG_RESULT(yes)
PHP_DEFINE([ICONV_BROKEN_IGNORE],0,[ext/iconv])
AC_DEFINE([ICONV_BROKEN_IGNORE],0,[Whether iconv supports IGNORE])
],[
AC_MSG_RESULT(no)
PHP_DEFINE([ICONV_BROKEN_IGNORE],1,[ext/iconv])
AC_DEFINE([ICONV_BROKEN_IGNORE],1,[Whether iconv supports IGNORE])
],[
AC_MSG_RESULT(no, cross-compiling)
PHP_DEFINE([ICONV_BROKEN_IGNORE],0,[ext/iconv])
AC_DEFINE([ICONV_BROKEN_IGNORE],0,[Whether iconv supports IGNORE])
])

Expand All @@ -192,7 +173,6 @@ int main() {
#include FOO
]], [])], [
AC_MSG_RESULT([yes])
PHP_DEFINE([PHP_ICONV_H_PATH], [<$PHP_ICONV_H_PATH>],[ext/iconv])
AC_DEFINE_UNQUOTED([PHP_ICONV_H_PATH], [<$PHP_ICONV_H_PATH>], [Path to iconv.h])
], [
AC_MSG_RESULT([no])
Expand Down
12 changes: 0 additions & 12 deletions ext/iconv/php_iconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@
#include "php_version.h"
#define PHP_ICONV_VERSION PHP_VERSION

#ifdef PHP_ATOM_INC
#include "ext/iconv/php_have_iconv.h"
#include "ext/iconv/php_have_libiconv.h"
#include "ext/iconv/php_iconv_aliased_libiconv.h"
#include "ext/iconv/php_have_glibc_iconv.h"
#include "ext/iconv/php_have_bsd_iconv.h"
#include "ext/iconv/php_have_ibm_iconv.h"
#include "ext/iconv/php_iconv_supports_errno.h"
#include "ext/iconv/php_php_iconv_impl.h"
#include "ext/iconv/php_php_iconv_h_path.h"
#endif

#ifdef HAVE_ICONV
extern zend_module_entry iconv_module_entry;
#define iconv_module_ptr &iconv_module_entry
Expand Down