Skip to content

Commit 1ceadae

Browse files
authored
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.
1 parent f0788da commit 1ceadae

File tree

53 files changed

+346
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+346
-213
lines changed

docs-old/self-contained-extensions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ PHP_ARG_ENABLE([foobar],
8484
[Enable foobar])])
8585
8686
if test "$PHP_FOOBAR" != "no"; then
87-
PHP_NEW_EXTENSION(foobar, foo.c bar.c, $ext_shared)
87+
PHP_NEW_EXTENSION([foobar], [foo.c bar.c], [$ext_shared])
8888
fi
8989
```
9090

@@ -145,7 +145,7 @@ an existing module called `foo`.
145145
automatically be able to use `--with-foo=shared[,..]` or
146146
`--enable-foo=shared[,..]`.
147147

148-
2. In `config.m4`, use `PHP_NEW_EXTENSION(foo,.., $ext_shared)` to enable
148+
2. In `config.m4`, use `PHP_NEW_EXTENSION([foo],.., [$ext_shared])` to enable
149149
building the extension.
150150

151151
3. Add the following lines to your C source file:

docs-old/unix-build-system.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Makefile.ins are abandoned. The files which are to be compiled are specified in
3838
the `config.m4` now using the following macro:
3939

4040
```m4
41-
PHP_NEW_EXTENSION(foo, foo.c bar.c baz.cpp, $ext_shared)
41+
PHP_NEW_EXTENSION([foo], [foo.c bar.c baz.cpp], [$ext_shared])
4242
```
4343

4444
E.g. this enables the extension foo which consists of three source-code modules,
@@ -61,7 +61,7 @@ here as well. If you need to specify separate include directories, do it this
6161
way:
6262

6363
```m4
64-
PHP_NEW_EXTENSION(foo, foo.c mylib/bar.c mylib/gregor.c,,,-I@ext_srcdir@/lib)
64+
PHP_NEW_EXTENSION([foo], [foo.c mylib/bar.c mylib/gregor.c],,, [-I@ext_srcdir@/lib])
6565
```
6666

6767
E.g. this builds the three files which are located relative to the extension

ext/bcmath/config.m4

+26-26
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@ PHP_ARG_ENABLE([bcmath],
55

66
if test "$PHP_BCMATH" != "no"; then
77
PHP_NEW_EXTENSION([bcmath], m4_normalize([
8-
bcmath.c
9-
libbcmath/src/add.c
10-
libbcmath/src/compare.c
11-
libbcmath/src/convert.c
12-
libbcmath/src/div.c
13-
libbcmath/src/divmod.c
14-
libbcmath/src/doaddsub.c
15-
libbcmath/src/floor_or_ceil.c
16-
libbcmath/src/init.c
17-
libbcmath/src/int2num.c
18-
libbcmath/src/nearzero.c
19-
libbcmath/src/neg.c
20-
libbcmath/src/num2long.c
21-
libbcmath/src/num2str.c
22-
libbcmath/src/raise.c
23-
libbcmath/src/raisemod.c
24-
libbcmath/src/recmul.c
25-
libbcmath/src/rmzero.c
26-
libbcmath/src/round.c
27-
libbcmath/src/sqrt.c
28-
libbcmath/src/str2num.c
29-
libbcmath/src/sub.c
30-
libbcmath/src/zero.c
31-
]),
32-
[$ext_shared],,
33-
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
8+
bcmath.c
9+
libbcmath/src/add.c
10+
libbcmath/src/compare.c
11+
libbcmath/src/convert.c
12+
libbcmath/src/div.c
13+
libbcmath/src/divmod.c
14+
libbcmath/src/doaddsub.c
15+
libbcmath/src/floor_or_ceil.c
16+
libbcmath/src/init.c
17+
libbcmath/src/int2num.c
18+
libbcmath/src/nearzero.c
19+
libbcmath/src/neg.c
20+
libbcmath/src/num2long.c
21+
libbcmath/src/num2str.c
22+
libbcmath/src/raise.c
23+
libbcmath/src/raisemod.c
24+
libbcmath/src/recmul.c
25+
libbcmath/src/rmzero.c
26+
libbcmath/src/round.c
27+
libbcmath/src/sqrt.c
28+
libbcmath/src/str2num.c
29+
libbcmath/src/sub.c
30+
libbcmath/src/zero.c
31+
]),
32+
[$ext_shared],,
33+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
3434
PHP_ADD_BUILD_DIR([$ext_builddir/libbcmath/src])
3535
AC_DEFINE(HAVE_BCMATH, 1, [Whether you have bcmath])
3636
fi

ext/bz2/config.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ if test "$PHP_BZ2" != "no"; then
3232
[AC_MSG_ERROR([bz2 module requires libbz2 >= 1.0.0])],
3333
[-L$BZIP_DIR/$PHP_LIBDIR])
3434

35-
PHP_NEW_EXTENSION(bz2, bz2.c bz2_filter.c, $ext_shared)
35+
PHP_NEW_EXTENSION([bz2], [bz2.c bz2_filter.c], [$ext_shared])
3636
PHP_SUBST([BZ2_SHARED_LIBADD])
3737
fi

ext/calendar/config.m4

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ PHP_ARG_ENABLE([calendar],
55

66
if test "$PHP_CALENDAR" = "yes"; then
77
AC_DEFINE(HAVE_CALENDAR,1,[ ])
8-
PHP_NEW_EXTENSION(calendar, calendar.c dow.c french.c gregor.c jewish.c julian.c easter.c cal_unix.c, $ext_shared)
8+
PHP_NEW_EXTENSION([calendar],
9+
[calendar.c dow.c french.c gregor.c jewish.c julian.c easter.c cal_unix.c],
10+
[$ext_shared])
911
fi

ext/ctype/config.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ PHP_ARG_ENABLE([ctype],
66

77
if test "$PHP_CTYPE" != "no"; then
88
AC_DEFINE(HAVE_CTYPE, 1, [ ])
9-
PHP_NEW_EXTENSION(ctype, ctype.c, $ext_shared)
9+
PHP_NEW_EXTENSION([ctype], [ctype.c], [$ext_shared])
1010
fi

ext/date/config0.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ PHP_DATE_CFLAGS="$PHP_DATE_CFLAGS -I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRM
1212
timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c lib/parse_posix.c
1313
lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c"
1414

15-
PHP_NEW_EXTENSION(date, php_date.c $timelib_sources, no,, $PHP_DATE_CFLAGS)
15+
PHP_NEW_EXTENSION([date],
16+
[php_date.c $timelib_sources],
17+
[no],,
18+
[$PHP_DATE_CFLAGS])
1619

1720
PHP_ADD_BUILD_DIR([$ext_builddir/lib], [1])
1821
PHP_ADD_INCLUDE([$ext_builddir/lib])

ext/dba/config.m4

+21-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,27 @@ if test "$HAVE_DBA" = "1"; then
701701
AC_MSG_RESULT([yes])
702702
fi
703703
AC_DEFINE(HAVE_DBA, 1, [ ])
704-
PHP_NEW_EXTENSION(dba, dba.c dba_cdb.c dba_dbm.c dba_gdbm.c dba_ndbm.c dba_db1.c dba_db2.c dba_db3.c dba_db4.c dba_flatfile.c dba_inifile.c dba_qdbm.c dba_tcadb.c dba_lmdb.c $cdb_sources $flat_sources $ini_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
704+
PHP_NEW_EXTENSION([dba], m4_normalize([
705+
dba_cdb.c
706+
dba_db1.c
707+
dba_db2.c
708+
dba_db3.c
709+
dba_db4.c
710+
dba_dbm.c
711+
dba_flatfile.c
712+
dba_gdbm.c
713+
dba_inifile.c
714+
dba_lmdb.c
715+
dba_ndbm.c
716+
dba_qdbm.c
717+
dba_tcadb.c
718+
dba.c
719+
$cdb_sources
720+
$flat_sources
721+
$ini_sources
722+
]),
723+
[$ext_shared],,
724+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
705725
PHP_ADD_BUILD_DIR([$ext_builddir/libcdb])
706726
PHP_ADD_BUILD_DIR([$ext_builddir/libflatfile])
707727
PHP_ADD_BUILD_DIR([$ext_builddir/libinifile])

ext/dl_test/config.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ PHP_ARG_ENABLE([dl-test],
44
[Enable dl_test extension])])
55

66
if test "$PHP_DL_TEST" != "no"; then
7-
PHP_NEW_EXTENSION(dl_test, dl_test.c, [shared],, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
7+
PHP_NEW_EXTENSION([dl_test],
8+
[dl_test.c],
9+
[shared],,
10+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
811
fi

ext/enchant/config.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ if test "$PHP_ENCHANT" != "no"; then
3535

3636
AC_DEFINE(HAVE_ENCHANT, 1, [ ])
3737

38-
PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
38+
PHP_NEW_EXTENSION([enchant], [enchant.c], [$ext_shared])
3939
PHP_SUBST([ENCHANT_SHARED_LIBADD])
4040
fi

ext/exif/config.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ PHP_ARG_ENABLE([exif],
55

66
if test "$PHP_EXIF" != "no"; then
77
AC_DEFINE(HAVE_EXIF, 1, [Whether you want EXIF (metadata from images) support])
8-
PHP_NEW_EXTENSION(exif, exif.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
8+
PHP_NEW_EXTENSION([exif],
9+
[exif.c],
10+
[$ext_shared],,
11+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
912
fi

ext/ffi/config.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ if test "$PHP_FFI" != "no"; then
2727
PHP_FFI_CHECK_DECL([FFI_MS_CDECL])
2828
PHP_FFI_CHECK_DECL([FFI_SYSV])
2929

30-
PHP_NEW_EXTENSION(ffi, ffi.c ffi_parser.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
30+
PHP_NEW_EXTENSION([ffi],
31+
[ffi.c ffi_parser.c],
32+
[$ext_shared],,
33+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
3134
PHP_SUBST([FFI_SHARED_LIBADD])
3235
fi

ext/filter/config.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ PHP_ARG_ENABLE([filter],
55
[yes])
66

77
if test "$PHP_FILTER" != "no"; then
8-
PHP_NEW_EXTENSION(filter, filter.c sanitizing_filters.c logical_filters.c callback_filter.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
8+
PHP_NEW_EXTENSION([filter],
9+
[filter.c sanitizing_filters.c logical_filters.c callback_filter.c],
10+
[$ext_shared],,
11+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
912

1013
PHP_INSTALL_HEADERS([ext/filter], [php_filter.h])
1114
PHP_ADD_EXTENSION_DEP(filter, pcre)

ext/ftp/config.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PHP_ARG_WITH([ftp-ssl],
1414

1515
if test "$PHP_FTP" = "yes"; then
1616
AC_DEFINE(HAVE_FTP,1,[Whether you want FTP support])
17-
PHP_NEW_EXTENSION(ftp, php_ftp.c ftp.c, $ext_shared)
17+
PHP_NEW_EXTENSION([ftp], [php_ftp.c ftp.c], [$ext_shared])
1818

1919
dnl Empty variable means 'no' (for phpize builds).
2020
test -z "$PHP_OPENSSL" && PHP_OPENSSL=no

ext/gettext/config.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if test "$PHP_GETTEXT" != "no"; then
2828
[AC_MSG_ERROR([Unable to find required gettext library])])])
2929

3030
AC_DEFINE([HAVE_LIBINTL], [1], [Define to 1 if you have the 'intl' library.])
31-
PHP_NEW_EXTENSION(gettext, gettext.c, $ext_shared)
31+
PHP_NEW_EXTENSION([gettext], [gettext.c], [$ext_shared])
3232
PHP_SUBST([GETTEXT_SHARED_LIBADD])
3333

3434
PHP_ADD_INCLUDE([$GETTEXT_INCDIR])

ext/gmp/config.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ if test "$PHP_GMP" != "no"; then
2828

2929
PHP_INSTALL_HEADERS([ext/gmp], [php_gmp_int.h])
3030

31-
PHP_NEW_EXTENSION(gmp, gmp.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
31+
PHP_NEW_EXTENSION([gmp],
32+
[gmp.c],
33+
[$ext_shared],,
34+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
3235
PHP_SUBST([GMP_SHARED_LIBADD])
3336
AC_DEFINE(HAVE_GMP, 1, [ ])
3437
fi

ext/iconv/config.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ int main(void) {
127127
LDFLAGS="$save_LDFLAGS"
128128
CFLAGS="$save_CFLAGS"
129129

130-
PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared,, [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
130+
PHP_NEW_EXTENSION([iconv],
131+
[iconv.c],
132+
[$ext_shared],,
133+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
131134
PHP_SUBST([ICONV_SHARED_LIBADD])
132135
PHP_INSTALL_HEADERS([ext/iconv], [php_iconv.h])
133136
fi

ext/intl/config.m4

+54-49
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,60 @@ if test "$PHP_INTL" != "no"; then
77
PHP_SETUP_ICU([INTL_SHARED_LIBADD])
88
PHP_SUBST([INTL_SHARED_LIBADD])
99
INTL_COMMON_FLAGS="$ICU_CFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
10-
PHP_NEW_EXTENSION(intl, php_intl.c \
11-
intl_error.c \
12-
intl_convert.c \
13-
collator/collator_class.c \
14-
collator/collator_sort.c \
15-
collator/collator_convert.c \
16-
collator/collator_locale.c \
17-
collator/collator_compare.c \
18-
collator/collator_attr.c \
19-
collator/collator_create.c \
20-
collator/collator_is_numeric.c \
21-
collator/collator_error.c \
22-
common/common_error.c \
23-
converter/converter.c \
24-
formatter/formatter_main.c \
25-
formatter/formatter_class.c \
26-
formatter/formatter_attr.c \
27-
formatter/formatter_data.c \
28-
formatter/formatter_format.c \
29-
formatter/formatter_parse.c \
30-
normalizer/normalizer_class.c \
31-
normalizer/normalizer_normalize.c \
32-
locale/locale.c \
33-
locale/locale_class.c \
34-
locale/locale_methods.c \
35-
dateformat/dateformat.c \
36-
dateformat/dateformat_class.c \
37-
dateformat/dateformat_attr.c \
38-
dateformat/dateformat_data.c \
39-
dateformat/dateformat_format.c \
40-
dateformat/dateformat_parse.c \
41-
msgformat/msgformat.c \
42-
msgformat/msgformat_attr.c \
43-
msgformat/msgformat_class.c \
44-
msgformat/msgformat_data.c \
45-
msgformat/msgformat_format.c \
46-
msgformat/msgformat_parse.c \
47-
grapheme/grapheme_string.c \
48-
grapheme/grapheme_util.c \
49-
resourcebundle/resourcebundle.c \
50-
resourcebundle/resourcebundle_class.c \
51-
resourcebundle/resourcebundle_iterator.c \
52-
transliterator/transliterator_class.c \
53-
transliterator/transliterator_methods.c \
54-
uchar/uchar.c \
55-
idn/idn.c \
56-
spoofchecker/spoofchecker_class.c \
57-
spoofchecker/spoofchecker_create.c\
58-
spoofchecker/spoofchecker_main.c, $ext_shared,,$INTL_COMMON_FLAGS,cxx)
10+
PHP_NEW_EXTENSION([intl], m4_normalize([
11+
collator/collator_attr.c
12+
collator/collator_class.c
13+
collator/collator_compare.c
14+
collator/collator_convert.c
15+
collator/collator_create.c
16+
collator/collator_error.c
17+
collator/collator_is_numeric.c
18+
collator/collator_locale.c
19+
collator/collator_sort.c
20+
common/common_error.c
21+
converter/converter.c
22+
dateformat/dateformat_attr.c
23+
dateformat/dateformat_class.c
24+
dateformat/dateformat_data.c
25+
dateformat/dateformat_format.c
26+
dateformat/dateformat_parse.c
27+
dateformat/dateformat.c
28+
formatter/formatter_attr.c
29+
formatter/formatter_class.c
30+
formatter/formatter_data.c
31+
formatter/formatter_format.c
32+
formatter/formatter_main.c
33+
formatter/formatter_parse.c
34+
grapheme/grapheme_string.c
35+
grapheme/grapheme_util.c
36+
idn/idn.c
37+
intl_convert.c
38+
intl_error.c
39+
locale/locale_class.c
40+
locale/locale_methods.c
41+
locale/locale.c
42+
msgformat/msgformat_attr.c
43+
msgformat/msgformat_class.c
44+
msgformat/msgformat_data.c
45+
msgformat/msgformat_format.c
46+
msgformat/msgformat_parse.c
47+
msgformat/msgformat.c
48+
normalizer/normalizer_class.c
49+
normalizer/normalizer_normalize.c
50+
php_intl.c
51+
resourcebundle/resourcebundle_class.c
52+
resourcebundle/resourcebundle_iterator.c
53+
resourcebundle/resourcebundle.c
54+
spoofchecker/spoofchecker_class.c
55+
spoofchecker/spoofchecker_create.c
56+
spoofchecker/spoofchecker_main.c
57+
transliterator/transliterator_class.c
58+
transliterator/transliterator_methods.c
59+
uchar/uchar.c
60+
]),
61+
[$ext_shared],,
62+
[$INTL_COMMON_FLAGS],
63+
[cxx])
5964

6065
PHP_INTL_CXX_SOURCES="intl_convertcpp.cpp \
6166
common/common_enum.cpp \

ext/json/config.m4

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
PHP_NEW_EXTENSION(json,
2-
json.c \
3-
json_encoder.c \
4-
json_parser.tab.c \
5-
json_scanner.c,
6-
no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1+
PHP_NEW_EXTENSION([json], m4_normalize([
2+
json_encoder.c
3+
json_parser.tab.c
4+
json_scanner.c
5+
json.c
6+
]),
7+
[no],,
8+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
79
PHP_INSTALL_HEADERS([ext/json], [php_json.h php_json_parser.h php_json_scanner.h])
810
PHP_ADD_MAKEFILE_FRAGMENT

ext/ldap/config.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ PHP_ARG_WITH([ldap-sasl],
5151

5252
if test "$PHP_LDAP" != "no"; then
5353

54-
PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
54+
PHP_NEW_EXTENSION([ldap],
55+
[ldap.c],
56+
[$ext_shared],,
57+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
5558

5659
if test "$PHP_LDAP" = "yes"; then
5760
for i in /usr/local /usr; do

0 commit comments

Comments
 (0)