Skip to content

Commit dfae7f9

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: ext/imap/config.m4: -Werror=implicit-function-declaration compatibility.
2 parents 180f785 + 0ff059c commit dfae7f9

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

ext/imap/config.m4

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ AC_DEFUN([IMAP_LIB_CHK],[
1717
])
1818

1919
dnl PHP_IMAP_TEST_BUILD(function, action-if-ok, action-if-not-ok, extra-libs, extra-source)
20+
dnl
21+
dnl The UW-IMAP c-client library was not originally designed to be a
22+
dnl shared library. The mm_foo functions are callbacks, and are required
23+
dnl to be implemented by the program that is linking to c-client. This
24+
dnl macro does the work of defining them all to no-ops for you. Note
25+
dnl that PHP_TEST_BUILD is a link test; the undefined symbols will only
26+
dnl cause problems if you actually try to link with c-client. For
27+
dnl example, if your test is trivial enough to be optimized out, and if
28+
dnl you link with --as-needed, the test/library may be omitted entirely
29+
dnl from the final executable. In that case linking will of course
30+
dnl succeed, but your luck won't necessarily apply at lower optimization
31+
dnl levels or systems where --as-needed is not used.
2032
AC_DEFUN([PHP_IMAP_TEST_BUILD], [
2133
PHP_TEST_BUILD([$1], [$2], [$3], [$4], [$5]
2234
[
@@ -229,15 +241,23 @@ if test "$PHP_IMAP" != "no"; then
229241
AC_DEFINE(HAVE_IMAP_AUTH_GSS, 1, [ ])
230242
], [], $TST_LIBS)
231243

232-
dnl Check if utf8_to_mutf7 exists. We need to do some gymnastics because
233-
dnl utf8_to_mutf7 takes an argument and will segfault without it. We
234-
dnl therefore test another function utf8_to_mutf7_php() which calls
235-
dnl the utf8_to_mutf7() function with the empty string as an argument.
236-
PHP_IMAP_TEST_BUILD(utf8_to_mutf7_php, [
237-
AC_DEFINE(HAVE_IMAP_MUTF7, 1, [ ])
238-
], [], $TST_LIBS, [
239-
char utf8_to_mutf7_php(){ return utf8_to_mutf7(""); }
240-
])
244+
dnl Check if utf8_to_mutf7 exists.
245+
old_CPPFLAGS="${CPPFLAGS}"
246+
CPPFLAGS="${CPPFLAGS} -I${IMAP_INC_DIR}"
247+
AC_LANG_PUSH(C)
248+
AC_CACHE_CHECK(for utf8_to_mutf7, ac_cv_utf8_to_mutf7,
249+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <c-client.h>]],[[
250+
unsigned char c = '\0';
251+
utf8_to_mutf7(&c);
252+
]])],[
253+
AC_DEFINE(HAVE_IMAP_MUTF7, 1, [ ])
254+
ac_cv_utf8_to_mutf7=yes
255+
],[
256+
ac_cv_utf8_to_mutf7=no
257+
])
258+
)
259+
AC_LANG_POP
260+
241261

242262
AC_MSG_CHECKING(whether rfc822_output_address_list function present)
243263
PHP_TEST_BUILD(foobar, [

0 commit comments

Comments
 (0)