Skip to content

ext/imap/config.m4: -Werror=implicit-function-declaration compatibility. #10948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions ext/imap/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ AC_DEFUN([IMAP_LIB_CHK],[
])

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

dnl Check if utf8_to_mutf7 exists. We need to do some gymnastics because
dnl utf8_to_mutf7 takes an argument and will segfault without it. We
dnl therefore test another function utf8_to_mutf7_php() which calls
dnl the utf8_to_mutf7() function with the empty string as an argument.
PHP_IMAP_TEST_BUILD(utf8_to_mutf7_php, [
AC_DEFINE(HAVE_IMAP_MUTF7, 1, [ ])
], [], $TST_LIBS, [
char utf8_to_mutf7_php(){ return utf8_to_mutf7(""); }
])
dnl Check if utf8_to_mutf7 exists.
old_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} -I${IMAP_INC_DIR}"
AC_LANG_PUSH(C)
AC_CACHE_CHECK(for utf8_to_mutf7, ac_cv_utf8_to_mutf7,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <c-client.h>]],[[
utf8_to_mutf7("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use unsigned char *c; utf8_to_mutf7(c);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe unsigned char c; utf8_to_mutf7(&c); is better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe unsigned char c; utf8_to_mutf7(&c); is better

Yep, done. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, used as patch and it works for 8.2 and master

]])],[
AC_DEFINE(HAVE_IMAP_MUTF7, 1, [ ])
ac_cv_utf8_to_mutf7=yes
],[
ac_cv_utf8_to_mutf7=no
])
)
AC_LANG_POP


AC_MSG_CHECKING(whether rfc822_output_address_list function present)
PHP_TEST_BUILD(foobar, [
Expand Down