Skip to content

Commit 1b757c8

Browse files
authored
Autotools: Replace backticks command substitutions with $(...) (#15639)
This is a follow-up of previous backticks replacement commits. This replaces backticks command substitutions in remaining ext config M4 files, phpize, and configure.ac with the recommended $(...). Note that $(...) still does not work on some obsolete shells that ship with Solaris 10, for example. Elsewhere they should work. However, for these obsolete shells Autoconf also re-executes the shell script under the supported shell so it can make them work regardless. Additionally, few comments CS are also adjusted to not cause confusion when searching for backticks usages and one indentation sync done. As of Autoconf 2.72 the backticks in macro help texts are also replaced with single quotes.
1 parent 307565d commit 1b757c8

File tree

4 files changed

+43
-46
lines changed

4 files changed

+43
-46
lines changed

build/config-stubs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
dir=$1; shift
44
for stubfile in $dir/*/config0.m4 $dir/*/config.m4 $dir/*/config9.m4; do
5-
echo "dnl Define where extension directories are located in the configure context
6-
AC_DEFUN([PHP_EXT_BUILDDIR], [`dirname $stubfile`])
7-
AC_DEFUN([PHP_EXT_DIR], [`dirname $stubfile`])
8-
AC_DEFUN([PHP_EXT_SRCDIR], [\$abs_srcdir/`dirname $stubfile`])
5+
echo "dnl Define where extension directories are located in the configure context
6+
AC_DEFUN([PHP_EXT_BUILDDIR], [$(dirname $stubfile)])
7+
AC_DEFUN([PHP_EXT_DIR], [$(dirname $stubfile)])
8+
AC_DEFUN([PHP_EXT_SRCDIR], [\$abs_srcdir/$(dirname $stubfile)])
99
sinclude($stubfile)"
1010
done

configure.ac

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ dnl Allow overriding PHP_EXTRA_VERSION through the homonymous env var
6868
AC_ARG_VAR([PHP_EXTRA_VERSION],[Extra PHP version label suffix, e.g. '-dev', 'rc1', '-acme'])dnl
6969
AS_IF([test -z "$PHP_EXTRA_VERSION"],[PHP_EXTRA_VERSION=[$]4])
7070
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
71-
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
71+
PHP_VERSION_ID=$(expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION)
7272

7373
dnl Allow version values to be used in Makefile.
7474
PHP_SUBST([PHP_MAJOR_VERSION])
@@ -100,7 +100,7 @@ dnl ----------------------------------------------------------------------------
100100

101101
PHP_INIT_BUILD_SYSTEM
102102

103-
dnl Because `make install` is often performed by the superuser, we create the
103+
dnl Because 'make install' is often performed by the superuser, we create the
104104
dnl libs subdirectory as the user who configures PHP. Otherwise, the current
105105
dnl user will not be able to delete libs or the contents of libs.
106106

@@ -499,7 +499,7 @@ dnl Check for structure members.
499499
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
500500
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
501501
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist.
502-
if test "`uname -s 2>/dev/null`" != "QNX"; then
502+
if test "$(uname -s 2>/dev/null)" != "QNX"; then
503503
AC_STRUCT_ST_BLOCKS
504504
fi
505505

@@ -516,7 +516,7 @@ dnl
516516
dnl At least some versions of FreeBSD seem to have buggy ifunc support, see
517517
dnl bug #77284. Conservatively don't use ifuncs on FreeBSD prior to version 12.
518518
AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*openbsd*], [true], [
519-
if test "`uname -s 2>/dev/null`" != "FreeBSD" || test "`uname -U 2>/dev/null`" -ge 1200000; then
519+
if test "$(uname -s 2>/dev/null)" != "FreeBSD" || test "$(uname -U 2>/dev/null)" -ge 1200000; then
520520
AX_GCC_FUNC_ATTRIBUTE([ifunc])
521521
AX_GCC_FUNC_ATTRIBUTE([target])
522522
fi
@@ -769,10 +769,9 @@ if test "$PHP_GCOV" = "yes"; then
769769
[AC_MSG_ERROR([GNU C compatible compiler is required for --enable-gcov])])
770770

771771
dnl Check if ccache is being used.
772-
case `$php_shtool path $CC` in
773-
*ccache*[)] gcc_ccache=yes;;
774-
*[)] gcc_ccache=no;;
775-
esac
772+
AS_CASE([$($php_shtool path $CC)],
773+
[*ccache*], [gcc_ccache=yes],
774+
[gcc_ccache=no])
776775

777776
if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
778777
AC_MSG_ERROR(m4_text_wrap([
@@ -787,8 +786,8 @@ if test "$PHP_GCOV" = "yes"; then
787786
dnl Remove all optimization flags from CFLAGS.
788787
changequote({,})
789788
dnl Discard known '-O...' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
790-
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g'`
791-
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g'`
789+
CFLAGS=$(echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
790+
CXXFLAGS=$(echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
792791
changequote([,])
793792

794793
dnl Add the special gcc flags.
@@ -808,8 +807,8 @@ AS_VAR_IF([PHP_DEBUG], [yes], [
808807
ZEND_DEBUG=yes
809808
changequote({,})
810809
dnl Discard known '-O...' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
811-
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g'`
812-
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g'`
810+
CFLAGS=$(echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
811+
CXXFLAGS=$(echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
813812
changequote([,])
814813
dnl Add -O0 only if GCC or ICC is used.
815814
if test "$GCC" = "yes" || test "$ICC" = "yes"; then
@@ -1323,23 +1322,21 @@ case $libdir in
13231322
libdir=$libdir/php
13241323
;;
13251324
esac
1326-
case `eval echo $datadir` in
1327-
'${prefix}/share')
1328-
datadir=$datadir/php
1329-
;;
1330-
esac
13311325

1332-
phptempdir=`pwd`/libs
1326+
AS_CASE([$(eval echo $datadir)],
1327+
['${prefix}/share'], [datadir=$datadir/php])
1328+
1329+
phptempdir=$(pwd)/libs
13331330

13341331
old_exec_prefix=$exec_prefix
13351332
old_libdir=$libdir
13361333
old_datadir=$datadir
1337-
exec_prefix=`eval echo $exec_prefix`
1338-
libdir=`eval echo $libdir`
1339-
datadir=`eval eval echo $datadir`
1334+
exec_prefix=$(eval echo $exec_prefix)
1335+
libdir=$(eval echo $libdir)
1336+
datadir=$(eval eval echo $datadir)
13401337

13411338
dnl Build extension directory path.
1342-
ZEND_MODULE_API_NO=`$EGREP '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|"${SED}" 's/#define ZEND_MODULE_API_NO //'`
1339+
ZEND_MODULE_API_NO=$($EGREP '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|"${SED}" 's/#define ZEND_MODULE_API_NO //')
13431340

13441341
AS_VAR_IF([EXTENSION_DIR],, [
13451342
extbasedir=$ZEND_MODULE_API_NO
@@ -1360,17 +1357,17 @@ AS_CASE([$PHP_LAYOUT],
13601357
[datarootdir=$prefix/php])
13611358

13621359
dnl Expand all directory names for use in macros/constants.
1363-
EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
1364-
EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
1365-
EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
1366-
EXPANDED_BINDIR=`eval echo $bindir`
1367-
EXPANDED_SBINDIR=`eval echo $sbindir`
1368-
EXPANDED_MANDIR=`eval echo $mandir`
1360+
EXPANDED_PEAR_INSTALLDIR=$(eval echo $PEAR_INSTALLDIR)
1361+
EXPANDED_EXTENSION_DIR=$(eval echo $EXTENSION_DIR)
1362+
EXPANDED_LOCALSTATEDIR=$(eval echo $localstatedir)
1363+
EXPANDED_BINDIR=$(eval echo $bindir)
1364+
EXPANDED_SBINDIR=$(eval echo $sbindir)
1365+
EXPANDED_MANDIR=$(eval echo $mandir)
13691366
EXPANDED_LIBDIR=$libdir
1370-
EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
1367+
EXPANDED_SYSCONFDIR=$(eval echo $sysconfdir)
13711368
EXPANDED_DATADIR=$datadir
1372-
EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
1373-
EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
1369+
EXPANDED_PHP_CONFIG_FILE_PATH=$(eval echo "$PHP_CONFIG_FILE_PATH")
1370+
EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=$(eval echo "$PHP_CONFIG_FILE_SCAN_DIR")
13741371
INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
13751372

13761373
exec_prefix=$old_exec_prefix
@@ -1404,10 +1401,10 @@ PHP_REMOVE_USR_LIB([LDFLAGS])
14041401
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
14051402
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
14061403

1407-
UNAME=`uname -a | xargs`
1404+
UNAME=$(uname -a | xargs)
14081405
PHP_UNAME=${PHP_UNAME:-$UNAME}
14091406
AC_DEFINE_UNQUOTED([PHP_UNAME], ["$PHP_UNAME"], [The 'uname -a' output.])
1410-
PHP_OS=`uname | xargs`
1407+
PHP_OS=$(uname | xargs)
14111408
AC_DEFINE_UNQUOTED([PHP_OS], ["$PHP_OS"], [The 'uname' output.])
14121409
PHP_BUILD_SYSTEM=${PHP_BUILD_SYSTEM:-$PHP_UNAME}
14131410
AC_DEFINE_UNQUOTED([PHP_BUILD_SYSTEM], ["$PHP_BUILD_SYSTEM"],
@@ -1562,7 +1559,7 @@ dnl
15621559
PHP_HELP_SEPARATOR([Libtool:])
15631560
PHP_CONFIGURE_PART([Configuring libtool])
15641561

1565-
dnl Silence warning: `ar: 'u' modifier ignored since 'D' is the default`
1562+
dnl Silence warning: "ar: 'u' modifier ignored since 'D' is the default".
15661563
dnl See https://github.com/php/php-src/pull/3017
15671564
AC_SUBST([AR_FLAGS], [cr])
15681565

ext/ldap/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ AC_DEFUN([PHP_LDAP_CHECKS], [
2424
PHP_OCI8_IC_LIBDIR_SUFFIX=64
2525
])
2626
27-
OCISDKRPMINC=`echo "$1" | $SED -e 's!^/usr/lib/oracle/\(.*\)/client\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'`
27+
OCISDKRPMINC=$(echo "$1" | $SED -e 's!^/usr/lib/oracle/\(.*\)/client\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!')
2828
2929
dnl Check for Oracle Instant Client RPM install
3030
if test -f $OCISDKRPMINC/ldap.h; then

scripts/phpize.m4

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ PHP_ARG_WITH([php-config],,
5353

5454
dnl For BC.
5555
PHP_CONFIG=$PHP_PHP_CONFIG
56-
prefix=`$PHP_CONFIG --prefix 2>/dev/null`
57-
phpincludedir=`$PHP_CONFIG --include-dir 2>/dev/null`
58-
INCLUDES=`$PHP_CONFIG --includes 2>/dev/null`
59-
EXTENSION_DIR=`$PHP_CONFIG --extension-dir 2>/dev/null`
60-
PHP_EXECUTABLE=`$PHP_CONFIG --php-binary 2>/dev/null`
56+
prefix=$($PHP_CONFIG --prefix 2>/dev/null)
57+
phpincludedir=$($PHP_CONFIG --include-dir 2>/dev/null)
58+
INCLUDES=$($PHP_CONFIG --includes 2>/dev/null)
59+
EXTENSION_DIR=$($PHP_CONFIG --extension-dir 2>/dev/null)
60+
PHP_EXECUTABLE=$($PHP_CONFIG --php-binary 2>/dev/null)
6161

6262
AS_VAR_IF([prefix],,
6363
[AC_MSG_ERROR([Cannot find php-config. Please use --with-php-config=PATH])])
@@ -106,8 +106,8 @@ AS_VAR_IF([PHP_DEBUG], [yes], [
106106
ZEND_DEBUG=yes
107107
changequote({,})
108108
dnl Discard known '-O...' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
109-
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g'`
110-
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g'`
109+
CFLAGS=$(echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
110+
CXXFLAGS=$(echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
111111
changequote([,])
112112
dnl Add -O0 only if GCC or ICC is used.
113113
if test "$GCC" = "yes" || test "$ICC" = "yes"; then

0 commit comments

Comments
 (0)