Skip to content

Commit dcdcb3c

Browse files
authored
Autotools: Replace AC_MSG_ERROR with AC_MSG_FAILURE (#15209)
This replaces the AC_MSG_ERROR with AC_MSG_FAILURE, where appropriate. The AC_MSG_ERROR outputs given message and exits the configure step. The AC_MSG_FAILURE does the same but also automatically outputs additional message "See 'config.log' for more details." which might help directing the user where to look further. The AC_MSG_ERROR is used for errors where current test step isn't logged in the config.log and wouldn't make sense, and AC_MSG_FAILURE is mostly used in cases of library checks, compilation tests, headers checked with AC_CHECK_HEADER* and similar tests that are also logged in the config.log. AC_MSG_ERROR([Sanity check failed.]) output: ``` configure: error: Sanity check failed. ``` AC_MSG_FAILURE([Sanity check failed.]) output: ``` configure: error: in '/path/to/php-src': configure: error: Sanity check failed. See 'config.log' for more details ```
1 parent cf6bbdf commit dcdcb3c

File tree

22 files changed

+57
-56
lines changed

22 files changed

+57
-56
lines changed

Zend/Zend.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ dnl as a fallback since AC_CHECK_FUNC cannot detect macros.
157157
dnl
158158
AC_CHECK_FUNC([sigsetjmp],,
159159
[AC_CHECK_DECL([sigsetjmp],,
160-
[AC_MSG_ERROR([Required sigsetjmp not found. Please, check config.log])],
160+
[AC_MSG_FAILURE([Required sigsetjmp not found.])],
161161
[#include <setjmp.h>])])
162162
163163
ZEND_CHECK_STACK_DIRECTION
@@ -381,7 +381,7 @@ int main(void)
381381
[php_cv_align_mm=failed],
382382
[php_cv_align_mm="(size_t)8 (size_t)3 0"])])
383383
AS_VAR_IF([php_cv_align_mm], [failed],
384-
[AC_MSG_ERROR([ZEND_MM alignment defines failed. Please, check config.log])],
384+
[AC_MSG_FAILURE([ZEND_MM alignment defines failed.])],
385385
[zend_mm_alignment=$(echo $php_cv_align_mm | cut -d ' ' -f 1)
386386
zend_mm_alignment_log2=$(echo $php_cv_align_mm | cut -d ' ' -f 2)
387387
zend_mm_8byte_realign=$(echo $php_cv_align_mm | cut -d ' ' -f 3)

build/php.m4

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,7 @@ int main(void) {
12751275
[ac_cv_ebcdic=no],
12761276
[ac_cv_ebcdic=no])])
12771277
AS_VAR_IF([ac_cv_ebcdic], [yes],
1278-
[AC_MSG_ERROR([PHP does not support EBCDIC targets.])])
1278+
[AC_MSG_FAILURE([PHP does not support EBCDIC targets.])])
12791279
])
12801280

12811281
dnl
@@ -2018,13 +2018,11 @@ AS_VAR_IF([found_pgsql], [yes], [dnl
20182018
PHP_EVAL_INCLINE([$PGSQL_CFLAGS])
20192019
PHP_EVAL_LIBLINE([$PGSQL_LIBS], [$1])
20202020
dnl PostgreSQL minimum version sanity check.
2021-
PHP_CHECK_LIBRARY([pq], [PQencryptPasswordConn],, [AC_MSG_ERROR(m4_normalize([
2022-
PostgreSQL check failed: libpq 10.0 or later is required, please see
2023-
config.log for details.
2024-
]))],
2021+
PHP_CHECK_LIBRARY([pq], [PQencryptPasswordConn],,
2022+
[AC_MSG_FAILURE([PostgreSQL check failed: libpq 10.0 or later is required.])],
20252023
[$PGSQL_LIBS])
20262024
$2],
2027-
[m4_default([$3], [AC_MSG_ERROR(m4_normalize([
2025+
[m4_default([$3], [AC_MSG_FAILURE(m4_normalize([
20282026
Cannot find libpq-fe.h or pq library (libpq). Please specify the correct
20292027
PostgreSQL installation path with environment variables PGSQL_CFLAGS and
20302028
PGSQL_LIBS or provide the PostgreSQL installation directory.
@@ -2253,7 +2251,7 @@ AS_VAR_IF([php_cv_crypt_r_style], [struct_crypt_data_gnu_source],
22532251
[Define to 1 if struct crypt_data requires _GNU_SOURCE.])])
22542252
22552253
AS_VAR_IF([php_cv_crypt_r_style], [none],
2256-
[AC_MSG_ERROR([Unable to detect data struct used by crypt_r.])])
2254+
[AC_MSG_FAILURE([Unable to detect data struct used by crypt_r.])])
22572255
])
22582256

22592257
dnl
@@ -2295,7 +2293,7 @@ dnl extensions.
22952293
dnl
22962294
AC_DEFUN([PHP_INIT_DTRACE],
22972295
[AC_CHECK_HEADER([sys/sdt.h],,
2298-
[AC_MSG_ERROR([Cannot find sys/sdt.h which is required for DTrace support.])])
2296+
[AC_MSG_FAILURE([Cannot find required <sys/sdt.h> to enable DTrace support.])])
22992297
23002298
dnl Set paths properly when called from extension.
23012299
case "$4" in

configure.ac

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,8 @@ AC_CHECK_FUNCS(m4_normalize([
602602
vasprintf
603603
]))
604604

605-
AC_CHECK_FUNC([inet_ntop],,[AC_MSG_ERROR([Required inet_ntop not found.])])
606-
AC_CHECK_FUNC([inet_pton],,[AC_MSG_ERROR([Required inet_pton not found.])])
605+
AC_CHECK_FUNC([inet_ntop],, [AC_MSG_FAILURE([Required inet_ntop not found.])])
606+
AC_CHECK_FUNC([inet_pton],, [AC_MSG_FAILURE([Required inet_pton not found.])])
607607

608608
dnl Check for strerror_r, and if its a POSIX-compatible or a GNU specific version.
609609
AC_FUNC_STRERROR_R
@@ -856,7 +856,7 @@ fi
856856

857857
AS_VAR_IF([PHP_THREAD_SAFETY], [yes], [
858858
AS_VAR_IF([pthreads_working], [yes], [],
859-
[AC_MSG_ERROR(m4_normalize([
859+
[AC_MSG_FAILURE(m4_normalize([
860860
Unable to verify system support for POSIX Threads, which are required for
861861
PHP thread safety (ZTS) build.
862862
]))])
@@ -978,7 +978,7 @@ AS_VAR_IF([PHP_DMALLOC], [yes],
978978
[PHP_ADD_LIBRARY([dmalloc])
979979
AC_DEFINE([HAVE_DMALLOC], [1], [Define to 1 if you have dmalloc.])
980980
AS_VAR_APPEND([CPPFLAGS], [" -DDMALLOC_FUNC_CHECK"])],
981-
[AC_MSG_ERROR([Problem with enabling dmalloc. Please, check config.log for details.])])])
981+
[AC_MSG_FAILURE([The dmalloc check failed. Cannot enable dmalloc.])])])
982982

983983
PHP_ARG_ENABLE([ipv6],
984984
[whether to enable IPv6 support],
@@ -1312,7 +1312,7 @@ else
13121312
AC_CHECK_HEADER([ucontext.h],
13131313
[AC_DEFINE([ZEND_FIBER_UCONTEXT], [1],
13141314
[Define to 1 if Zend fiber uses ucontext instead of boost context.])],
1315-
[AC_MSG_ERROR([fibers not available on this platform])])
1315+
[AC_MSG_FAILURE([fibers not available on this platform])])
13161316
fi
13171317

13181318
ZEND_INIT

ext/bz2/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if test "$PHP_BZ2" != "no"; then
2424
AC_DEFINE([HAVE_BZ2], [1],
2525
[Define to 1 if the PHP extension 'bz2' is available.])
2626
],
27-
[AC_MSG_ERROR([bz2 module requires libbz2 >= 1.0.0])],
27+
[AC_MSG_FAILURE([The bz2 extension requires libbz2 >= 1.0.0])],
2828
[-L$BZIP_DIR/$PHP_LIBDIR])
2929

3030
PHP_NEW_EXTENSION([bz2], [bz2.c bz2_filter.c], [$ext_shared])

ext/curl/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if test "$PHP_CURL" != "no"; then
7575
[curl_easy_perform],
7676
[AC_DEFINE([HAVE_CURL], [1],
7777
[Define to 1 if the PHP extension 'curl' is available.])],
78-
[AC_MSG_ERROR([The libcurl check failed. Please, check config.log for details.])],
78+
[AC_MSG_FAILURE([The libcurl check failed.])],
7979
[$CURL_LIBS])
8080

8181
PHP_NEW_EXTENSION([curl],

ext/gd/config.m4

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,11 @@ dnl Various checks for GD features
274274

275275
PHP_INSTALL_HEADERS([ext/gd], [php_gd.h libgd/])
276276

277-
PHP_TEST_BUILD(foobar, [], [
278-
AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
279-
], [ $GD_SHARED_LIBADD ], [char foobar(void) { return '\0'; }])
280-
277+
PHP_TEST_BUILD([foobar],
278+
[],
279+
[AC_MSG_FAILURE([GD library build test failed.])],
280+
[$GD_SHARED_LIBADD],
281+
[char foobar(void) { return '\0'; }])
281282
else
282283
extra_sources="gd_compat.c"
283284
PKG_CHECK_MODULES([GDLIB], [gdlib >= 2.1.0])
@@ -290,7 +291,7 @@ dnl Various checks for GD features
290291
PHP_INSTALL_HEADERS([ext/gd], [php_gd.h])
291292
PHP_CHECK_LIBRARY([gd], [gdImageCreate],
292293
[],
293-
[AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])],
294+
[AC_MSG_FAILURE([GD library build test failed.])],
294295
[$GD_SHARED_LIBADD])
295296
fi
296297

ext/gettext/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if test "$PHP_GETTEXT" != "no"; then
2525
GETTEXT_LIBS=
2626
GETTEXT_CHECK_IN_LIB=c
2727
],
28-
[AC_MSG_ERROR([Unable to find required gettext library])])])
28+
[AC_MSG_FAILURE([Unable to find required intl library for gettext.])])])
2929

3030
AC_DEFINE([HAVE_LIBINTL], [1], [Define to 1 if you have the 'intl' library.])
3131
PHP_NEW_EXTENSION([gettext], [gettext.c], [$ext_shared])

ext/gmp/config.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if test "$PHP_GMP" != "no"; then
77
if test "$PHP_GMP" = "yes"; then
88
PHP_CHECK_LIBRARY([gmp], [__gmpz_rootrem],
99
[],
10-
[AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])])
10+
[AC_MSG_FAILURE([GNU MP Library version 4.2 or greater required.])])
1111

1212
PHP_ADD_LIBRARY([gmp],, [GMP_SHARED_LIBADD])
1313
else
@@ -17,7 +17,7 @@ if test "$PHP_GMP" != "no"; then
1717

1818
PHP_CHECK_LIBRARY([gmp], [__gmpz_rootrem],
1919
[],
20-
[AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])],
20+
[AC_MSG_FAILURE([GNU MP Library version 4.2 or greater required.])],
2121
[-L$PHP_GMP/$PHP_LIBDIR])
2222

2323
PHP_ADD_LIBRARY_WITH_PATH([gmp],

ext/iconv/config.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PHP_ARG_WITH([iconv],
66

77
if test "$PHP_ICONV" != "no"; then
88
PHP_SETUP_ICONV([ICONV_SHARED_LIBADD],,
9-
[AC_MSG_ERROR([The iconv not found. Please, check config.log for details.])])
9+
[AC_MSG_FAILURE([The iconv not found.])])
1010

1111
save_LDFLAGS="$LDFLAGS"
1212
save_CFLAGS="$CFLAGS"
@@ -93,7 +93,7 @@ int main(void) {
9393
[php_cv_iconv_errno=no],
9494
[php_cv_iconv_errno=yes])])
9595
AS_VAR_IF([php_cv_iconv_errno], [yes],,
96-
[AC_MSG_ERROR([iconv does not support errno])])
96+
[AC_MSG_FAILURE([The iconv check failed, 'errno' is missing.])])
9797

9898
AC_CACHE_CHECK([if iconv supports //IGNORE], [php_cv_iconv_ignore],
9999
[AC_RUN_IFELSE([AC_LANG_SOURCE([[

ext/ldap/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ if test "$PHP_LDAP" != "no"; then
144144
dnl Sanity check
145145
AC_CHECK_FUNC([ldap_sasl_bind_s],,
146146
[AC_CHECK_FUNC([ldap_simple_bind_s],,
147-
[AC_MSG_ERROR([LDAP build check failed. Please check config.log for details.])])])
147+
[AC_MSG_ERROR([LDAP library build check failed.])])])
148148

149149
dnl Restore original values
150150
CPPFLAGS=$_SAVE_CPPFLAGS

0 commit comments

Comments
 (0)