Skip to content

Commit dfdec2d

Browse files
authored
Autotools: Refactor PHP_TEST_BUILD checks (#15798)
- The libgd sanity check is there only to check whether all current linked libraries for the bundled libgd work together, otherwise it is probably even redundant a bit; this refactors it to a simpler AC_LINK_IFELSE check with default empty C program by Autoconf - The IBM DB2 sanity check is simplified with AC_CHECK_FUNC instead
1 parent b97a60c commit dfdec2d

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

ext/gd/config.m4

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,17 @@ dnl Various checks for GD features
287287

288288
PHP_INSTALL_HEADERS([ext/gd], [php_gd.h libgd/])
289289

290-
PHP_TEST_BUILD([foobar],
291-
[],
292-
[AC_MSG_FAILURE([GD library build test failed.])],
293-
[$GD_SHARED_LIBADD],
294-
[char foobar(void) { return '\0'; }])
290+
dnl Sanity check.
291+
AC_CACHE_CHECK([whether build works], [php_cv_lib_gd_works], [
292+
LIBS_SAVED=$LIBS
293+
LIBS="$GD_SHARED_LIBADD $LIBS"
294+
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
295+
[php_cv_lib_gd_works=yes],
296+
[php_cv_lib_gd_works=no])
297+
LIBS=$LIBS_SAVED
298+
])
299+
AS_VAR_IF([php_cv_lib_gd_works], [yes],,
300+
[AC_MSG_FAILURE([GD library build test failed.])])
295301
else
296302
extra_sources="gd_compat.c"
297303
PKG_CHECK_MODULES([GDLIB], [gdlib >= 2.1.0])

ext/odbc/config.m4

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,18 @@ PHP_ARG_WITH([ibm-db2],
202202
ODBC_TYPE=ibm-db2
203203
ODBC_LIBS=-ldb2
204204
205-
PHP_TEST_BUILD([SQLExecute],
205+
dnl Sanity check.
206+
old_LIBS=$LIBS
207+
LIBS="$ODBC_LFLAGS $ODBC_LIBS $LIBS"
208+
AC_CHECK_FUNC([SQLExecute],
206209
[AC_DEFINE([HAVE_IBMDB2], [1],
207210
[Define to 1 if the odbc extension uses the IBM DB2.])],
208211
[AC_MSG_FAILURE([
209212
ODBC build test failed. You need to source your DB2 environment before running
210213
PHP configure:
211214
# . \$IBM_DB2/db2profile
212-
])],
213-
[$ODBC_LFLAGS $ODBC_LIBS])
215+
])])
216+
LIBS=$old_LIBS
214217
])
215218
])
216219

0 commit comments

Comments
 (0)