2004-12-30 15:08:39 +08:00
|
|
|
AC_DEFUN([IMAP_INC_CHK],[if test -r "$i$1/c-client.h"; then
|
2001-05-10 14:58:25 +08:00
|
|
|
AC_DEFINE(HAVE_IMAP2000, 1, [ ])
|
|
|
|
IMAP_DIR=$i
|
|
|
|
IMAP_INC_DIR=$i$1
|
2003-10-01 10:53:23 +08:00
|
|
|
break
|
2018-07-29 09:43:45 +08:00
|
|
|
elif test -r "$i$1/rfc822.h"; then
|
|
|
|
IMAP_DIR=$i;
|
2001-05-10 14:58:25 +08:00
|
|
|
IMAP_INC_DIR=$i$1
|
2018-07-29 09:43:45 +08:00
|
|
|
break
|
2001-02-26 23:17:12 +08:00
|
|
|
])
|
2000-04-29 01:13:50 +08:00
|
|
|
|
2004-12-30 15:08:39 +08:00
|
|
|
AC_DEFUN([IMAP_LIB_CHK],[
|
2001-05-10 14:58:25 +08:00
|
|
|
str="$IMAP_DIR/$1/lib$lib.*"
|
|
|
|
for i in `echo $str`; do
|
2003-10-01 10:53:23 +08:00
|
|
|
test -r $i && IMAP_LIBDIR=$IMAP_DIR/$1 && break 2
|
2001-05-10 14:58:25 +08:00
|
|
|
done
|
|
|
|
])
|
2000-10-03 06:16:53 +08:00
|
|
|
|
2015-11-10 01:08:36 +08:00
|
|
|
dnl PHP_IMAP_TEST_BUILD(function, action-if-ok, action-if-not-ok, extra-libs, extra-source)
|
2004-12-30 15:08:39 +08:00
|
|
|
AC_DEFUN([PHP_IMAP_TEST_BUILD], [
|
2015-11-10 01:08:36 +08:00
|
|
|
PHP_TEST_BUILD([$1], [$2], [$3], [$4], [$5]
|
2004-02-23 11:24:58 +08:00
|
|
|
[
|
2008-02-01 02:48:00 +08:00
|
|
|
#if defined(__GNUC__) && __GNUC__ >= 4
|
|
|
|
# define PHP_IMAP_EXPORT __attribute__ ((visibility("default")))
|
|
|
|
#else
|
|
|
|
# define PHP_IMAP_EXPORT
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PHP_IMAP_EXPORT void mm_log(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_dlog(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_flags(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_fatal(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_critical(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_nocritical(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_notify(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_login(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_diskerror(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_status(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_lsub(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_list(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_exists(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_searched(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_expunged(void){}
|
2002-07-12 20:13:45 +08:00
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2004-12-30 15:08:39 +08:00
|
|
|
AC_DEFUN([PHP_IMAP_KRB_CHK], [
|
2001-05-10 14:58:25 +08:00
|
|
|
if test "$PHP_KERBEROS" != "no"; then
|
2019-04-20 22:12:54 +08:00
|
|
|
PKG_CHECK_MODULES([KERBEROS], [krb5-gssapi krb5])
|
|
|
|
|
|
|
|
PHP_EVAL_INCLINE($KERBEROS_CFLAGS)
|
|
|
|
PHP_EVAL_LIBLINE($KERBEROS_LIBS, IMAP_SHARED_LIBADD)
|
|
|
|
|
|
|
|
AC_DEFINE(HAVE_IMAP_KRB, 1, [Whether IMAP extension has Kerberos support])
|
2001-08-03 13:17:18 +08:00
|
|
|
else
|
|
|
|
AC_EGREP_HEADER(auth_gss, $IMAP_INC_DIR/linkage.h, [
|
2018-07-29 09:43:45 +08:00
|
|
|
AC_MSG_ERROR([This c-client library is built with Kerberos support.
|
2001-08-03 13:17:18 +08:00
|
|
|
|
2003-01-28 14:56:32 +08:00
|
|
|
Add --with-kerberos to your configure line. Check config.log for details.
|
2002-07-12 20:13:45 +08:00
|
|
|
])
|
2001-08-03 13:17:18 +08:00
|
|
|
])
|
2001-05-10 14:58:25 +08:00
|
|
|
fi
|
|
|
|
])
|
2000-10-03 06:16:53 +08:00
|
|
|
|
2004-12-30 15:08:39 +08:00
|
|
|
AC_DEFUN([PHP_IMAP_SSL_CHK], [
|
2001-05-10 14:58:25 +08:00
|
|
|
if test "$PHP_IMAP_SSL" != "no"; then
|
2007-01-23 20:38:40 +08:00
|
|
|
if test "$PHP_OPENSSL" = ""; then
|
2007-01-09 02:23:23 +08:00
|
|
|
PHP_OPENSSL='no'
|
|
|
|
fi
|
2004-12-30 22:50:06 +08:00
|
|
|
PHP_SETUP_OPENSSL(IMAP_SHARED_LIBADD,
|
|
|
|
[
|
|
|
|
AC_DEFINE(HAVE_IMAP_SSL,1,[ ])
|
|
|
|
], [
|
2018-07-29 09:43:45 +08:00
|
|
|
AC_MSG_ERROR([OpenSSL libraries not found.
|
|
|
|
|
2004-12-30 22:50:06 +08:00
|
|
|
Check the path given to --with-openssl-dir and output in config.log)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
elif test -f "$IMAP_INC_DIR/linkage.c"; then
|
|
|
|
AC_EGREP_HEADER(ssl_onceonlyinit, $IMAP_INC_DIR/linkage.c, [
|
2018-07-29 09:43:45 +08:00
|
|
|
AC_MSG_ERROR([This c-client library is built with SSL support.
|
2004-12-30 22:50:06 +08:00
|
|
|
|
|
|
|
Add --with-imap-ssl to your configure line. Check config.log for details.
|
|
|
|
])
|
|
|
|
])
|
2001-05-10 14:58:25 +08:00
|
|
|
fi
|
|
|
|
])
|
2000-10-03 06:16:53 +08:00
|
|
|
|
2019-03-03 23:44:16 +08:00
|
|
|
PHP_ARG_WITH([imap],
|
|
|
|
[for IMAP support],
|
|
|
|
[AS_HELP_STRING([[--with-imap[=DIR]]],
|
|
|
|
[Include IMAP support. DIR is the c-client install prefix])])
|
|
|
|
|
|
|
|
PHP_ARG_WITH([kerberos],
|
|
|
|
[for IMAP Kerberos support],
|
2019-04-19 12:57:35 +08:00
|
|
|
[AS_HELP_STRING([--with-kerberos],
|
|
|
|
[IMAP: Include Kerberos support])],
|
2019-03-03 23:44:16 +08:00
|
|
|
[no],
|
|
|
|
[no])
|
|
|
|
|
|
|
|
PHP_ARG_WITH([imap-ssl],
|
|
|
|
[for IMAP SSL support],
|
|
|
|
[AS_HELP_STRING([[--with-imap-ssl[=DIR]]],
|
|
|
|
[IMAP: Include SSL support. DIR is the OpenSSL install prefix])],
|
|
|
|
[no],
|
|
|
|
[no])
|
2004-12-30 22:50:06 +08:00
|
|
|
|
2018-07-29 09:43:45 +08:00
|
|
|
if test "$PHP_IMAP" != "no"; then
|
2001-05-10 14:58:25 +08:00
|
|
|
PHP_SUBST(IMAP_SHARED_LIBADD)
|
2019-03-12 19:15:47 +08:00
|
|
|
PHP_NEW_EXTENSION(imap, php_imap.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
|
2001-05-10 14:58:25 +08:00
|
|
|
AC_DEFINE(HAVE_IMAP,1,[ ])
|
|
|
|
|
2003-10-01 06:36:43 +08:00
|
|
|
for i in $PHP_IMAP /usr/local /usr; do
|
2000-03-03 19:47:13 +08:00
|
|
|
IMAP_INC_CHK()
|
2000-05-01 00:10:29 +08:00
|
|
|
el[]IMAP_INC_CHK(/include/c-client)
|
2001-02-25 12:41:18 +08:00
|
|
|
el[]IMAP_INC_CHK(/include/imap)
|
|
|
|
el[]IMAP_INC_CHK(/include)
|
2000-03-03 19:47:13 +08:00
|
|
|
el[]IMAP_INC_CHK(/imap)
|
|
|
|
el[]IMAP_INC_CHK(/c-client)
|
|
|
|
fi
|
2000-02-29 21:12:48 +08:00
|
|
|
done
|
|
|
|
|
2005-01-11 12:56:06 +08:00
|
|
|
dnl Check for c-client version 2004
|
|
|
|
AC_EGREP_HEADER(mail_fetch_overview_sequence, $IMAP_INC_DIR/mail.h, [
|
|
|
|
AC_DEFINE(HAVE_IMAP2004,1,[ ])
|
|
|
|
])
|
2007-01-20 04:44:52 +08:00
|
|
|
|
2006-09-25 02:06:53 +08:00
|
|
|
dnl Check for new version of the utf8_mime2text() function
|
2007-01-18 22:05:07 +08:00
|
|
|
old_CFLAGS=$CFLAGS
|
|
|
|
CFLAGS="-I$IMAP_INC_DIR"
|
2007-01-20 04:44:52 +08:00
|
|
|
AC_CACHE_CHECK(for utf8_mime2text signature, ac_cv_utf8_mime2text,
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2007-01-20 06:33:10 +08:00
|
|
|
#include <stdio.h>
|
2007-01-18 22:05:07 +08:00
|
|
|
#include <c-client.h>
|
2018-07-30 07:50:24 +08:00
|
|
|
]],[[
|
2007-01-20 04:44:52 +08:00
|
|
|
SIZEDTEXT *src, *dst;
|
|
|
|
utf8_mime2text(src, dst);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[
|
2007-01-20 04:44:52 +08:00
|
|
|
ac_cv_utf8_mime2text=old
|
|
|
|
],[
|
|
|
|
ac_cv_utf8_mime2text=new
|
|
|
|
])
|
2007-01-18 22:05:07 +08:00
|
|
|
)
|
|
|
|
if test "$ac_cv_utf8_mime2text" = "new"; then
|
|
|
|
AC_DEFINE(HAVE_NEW_MIME2TEXT, 1, [Whether utf8_mime2text() has new signature])
|
|
|
|
fi
|
2007-02-11 17:25:25 +08:00
|
|
|
CFLAGS=$old_CFLAGS
|
2005-01-11 12:56:06 +08:00
|
|
|
|
2007-01-20 04:44:52 +08:00
|
|
|
old_CFLAGS=$CFLAGS
|
|
|
|
CFLAGS="-I$IMAP_INC_DIR"
|
2017-11-27 01:29:42 +08:00
|
|
|
AC_CACHE_CHECK(for U8T_DECOMPOSE, ac_cv_u8t_decompose,
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2007-01-20 04:44:52 +08:00
|
|
|
#include <c-client.h>
|
2018-07-30 07:50:24 +08:00
|
|
|
]],[[
|
2007-01-20 04:44:52 +08:00
|
|
|
int i = U8T_CANONICAL;
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[
|
2010-02-07 21:06:54 +08:00
|
|
|
ac_cv_u8t_decompose=yes
|
2007-01-20 04:44:52 +08:00
|
|
|
],[
|
2010-02-07 21:06:54 +08:00
|
|
|
ac_cv_u8t_decompose=no
|
2007-01-20 04:44:52 +08:00
|
|
|
])
|
|
|
|
)
|
2007-02-11 17:25:25 +08:00
|
|
|
CFLAGS=$old_CFLAGS
|
2007-01-20 04:44:52 +08:00
|
|
|
|
2010-02-07 21:06:54 +08:00
|
|
|
if test "$ac_cv_u8t_decompose" = "no" && test "$ac_cv_utf8_mime2text" = "new"; then
|
|
|
|
AC_MSG_ERROR([utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.])
|
2007-01-20 04:44:52 +08:00
|
|
|
fi
|
2010-02-07 21:06:54 +08:00
|
|
|
if test "$ac_cv_u8t_decompose" = "yes" && test "$ac_cv_utf8_mime2text" = "old"; then
|
|
|
|
AC_MSG_ERROR([utf8_mime2text() has old signature, but U8T_CANONICAL is present. This should not happen. Check config.log for additional information.])
|
2007-01-20 04:44:52 +08:00
|
|
|
fi
|
|
|
|
|
2005-01-11 12:56:06 +08:00
|
|
|
dnl Check for c-client version 2001
|
2001-08-08 00:18:05 +08:00
|
|
|
old_CPPFLAGS=$CPPFLAGS
|
|
|
|
CPPFLAGS=-I$IMAP_INC_DIR
|
|
|
|
AC_EGREP_CPP(this_is_true, [
|
2002-06-02 04:14:58 +08:00
|
|
|
#include "imap4r1.h"
|
|
|
|
#if defined(IMAPSSLPORT)
|
2001-08-08 00:18:05 +08:00
|
|
|
this_is_true
|
2002-06-02 04:14:58 +08:00
|
|
|
#endif
|
2001-08-08 00:18:05 +08:00
|
|
|
],[
|
|
|
|
AC_DEFINE(HAVE_IMAP2001, 1, [ ])
|
2001-08-21 19:02:42 +08:00
|
|
|
],[])
|
2001-08-08 00:18:05 +08:00
|
|
|
CPPFLAGS=$old_CPPFLAGS
|
|
|
|
|
2018-07-29 09:43:45 +08:00
|
|
|
PHP_CHECK_LIBRARY(pam, pam_start,
|
2004-01-17 08:00:11 +08:00
|
|
|
[
|
|
|
|
PHP_ADD_LIBRARY(pam,, IMAP_SHARED_LIBADD)
|
|
|
|
AC_DEFINE(HAVE_LIBPAM,1,[ ])
|
|
|
|
])
|
|
|
|
|
2018-07-29 09:43:45 +08:00
|
|
|
PHP_CHECK_LIBRARY(crypt, crypt,
|
2004-01-17 08:00:11 +08:00
|
|
|
[
|
|
|
|
PHP_ADD_LIBRARY(crypt,, IMAP_SHARED_LIBADD)
|
|
|
|
AC_DEFINE(HAVE_LIBCRYPT,1,[ ])
|
|
|
|
])
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_EXPAND_PATH($IMAP_DIR, IMAP_DIR)
|
2000-02-29 21:12:48 +08:00
|
|
|
|
|
|
|
if test -z "$IMAP_DIR"; then
|
2004-12-20 02:16:50 +08:00
|
|
|
AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
|
2000-02-29 21:12:48 +08:00
|
|
|
fi
|
|
|
|
|
2013-09-21 05:15:19 +08:00
|
|
|
if test ! -r "$IMAP_DIR/c-client/libc-client.a" && test -r "$IMAP_DIR/c-client/c-client.a" ; then
|
2000-02-29 21:21:51 +08:00
|
|
|
ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
|
2013-09-21 05:15:19 +08:00
|
|
|
elif test ! -r "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" && test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
|
2004-11-03 22:32:52 +08:00
|
|
|
ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1
|
2000-02-29 21:21:51 +08:00
|
|
|
fi
|
|
|
|
|
2001-08-02 19:23:01 +08:00
|
|
|
for lib in c-client4 c-client imap; do
|
2000-02-29 21:12:48 +08:00
|
|
|
IMAP_LIB=$lib
|
2004-11-03 22:32:52 +08:00
|
|
|
IMAP_LIB_CHK($PHP_LIBDIR)
|
2000-03-03 19:54:07 +08:00
|
|
|
IMAP_LIB_CHK(c-client)
|
2000-02-29 21:12:48 +08:00
|
|
|
done
|
1999-04-22 08:45:14 +08:00
|
|
|
|
2000-05-24 07:36:44 +08:00
|
|
|
if test -z "$IMAP_LIBDIR"; then
|
2004-12-20 02:16:50 +08:00
|
|
|
AC_MSG_ERROR(Cannot find imap library (libc-client.a). Please check your c-client installation.)
|
2000-02-29 21:12:48 +08:00
|
|
|
fi
|
|
|
|
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_INCLUDE($IMAP_INC_DIR)
|
2002-12-28 23:33:25 +08:00
|
|
|
PHP_ADD_LIBRARY_DEFER($IMAP_LIB,, IMAP_SHARED_LIBADD)
|
|
|
|
PHP_ADD_LIBPATH($IMAP_LIBDIR, IMAP_SHARED_LIBADD)
|
2003-03-11 10:11:57 +08:00
|
|
|
PHP_IMAP_KRB_CHK
|
|
|
|
PHP_IMAP_SSL_CHK
|
2002-07-25 19:33:21 +08:00
|
|
|
|
2002-07-12 20:13:45 +08:00
|
|
|
dnl Test the build in the end
|
2002-07-25 19:33:21 +08:00
|
|
|
TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD"
|
2003-01-18 15:00:47 +08:00
|
|
|
|
|
|
|
dnl Check if auth_gss exists
|
|
|
|
PHP_IMAP_TEST_BUILD(auth_gssapi_valid, [
|
|
|
|
AC_DEFINE(HAVE_IMAP_AUTH_GSS, 1, [ ])
|
|
|
|
], [], $TST_LIBS)
|
|
|
|
|
2015-11-10 01:08:36 +08:00
|
|
|
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, [
|
2009-05-05 09:22:31 +08:00
|
|
|
AC_DEFINE(HAVE_IMAP_MUTF7, 1, [ ])
|
2015-11-10 01:08:36 +08:00
|
|
|
], [], $TST_LIBS, [
|
|
|
|
char utf8_to_mutf7_php(){ return utf8_to_mutf7(""); }
|
|
|
|
])
|
2008-10-17 00:21:20 +08:00
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether rfc822_output_address_list function present)
|
|
|
|
PHP_TEST_BUILD(foobar, [
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_RFC822_OUTPUT_ADDRESS_LIST, 1, [ ])
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
], [
|
|
|
|
$TST_LIBS
|
|
|
|
], [
|
|
|
|
#if defined(__GNUC__) && __GNUC__ >= 4
|
|
|
|
# define PHP_IMAP_EXPORT __attribute__ ((visibility("default")))
|
|
|
|
#else
|
|
|
|
# define PHP_IMAP_EXPORT
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PHP_IMAP_EXPORT void mm_log(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_dlog(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_flags(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_fatal(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_critical(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_nocritical(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_notify(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_login(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_diskerror(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_status(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_lsub(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_list(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_exists(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_searched(void){}
|
|
|
|
PHP_IMAP_EXPORT void mm_expunged(void){}
|
|
|
|
void rfc822_output_address_list(void);
|
|
|
|
void (*f)(void);
|
|
|
|
char foobar () {f = rfc822_output_address_list;}
|
|
|
|
])
|
|
|
|
|
2009-05-05 09:22:31 +08:00
|
|
|
AC_MSG_CHECKING(whether build with IMAP works)
|
|
|
|
PHP_IMAP_TEST_BUILD(mail_newbody, [
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
AC_MSG_ERROR([build test failed. Please check the config.log for details.])
|
|
|
|
], $TST_LIBS)
|
2001-05-06 13:39:16 +08:00
|
|
|
fi
|