PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/php5/ext/imap/config.m4

http://github.com/vpj/PHP-Extension-API
m4 | 278 lines | 226 code | 36 blank | 16 comment | 0 complexity | 9620d779746d7385d16f66fd61a17e3a MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-3-Clause
  1. dnl
  2. dnl $Id: config.m4,v 1.69.4.7.2.3 2009/05/05 01:22:44 jani Exp $
  3. dnl
  4. AC_DEFUN([IMAP_INC_CHK],[if test -r "$i$1/c-client.h"; then
  5. AC_DEFINE(HAVE_IMAP2000, 1, [ ])
  6. IMAP_DIR=$i
  7. IMAP_INC_DIR=$i$1
  8. break
  9. elif test -r "$i$1/rfc822.h"; then
  10. IMAP_DIR=$i;
  11. IMAP_INC_DIR=$i$1
  12. break
  13. ])
  14. AC_DEFUN([IMAP_LIB_CHK],[
  15. str="$IMAP_DIR/$1/lib$lib.*"
  16. for i in `echo $str`; do
  17. test -r $i && IMAP_LIBDIR=$IMAP_DIR/$1 && break 2
  18. done
  19. ])
  20. dnl PHP_IMAP_TEST_BUILD(function, action-if-ok, action-if-not-ok, extra-libs)
  21. AC_DEFUN([PHP_IMAP_TEST_BUILD], [
  22. PHP_TEST_BUILD([$1], [$2], [$3], [$4],
  23. [
  24. #if defined(__GNUC__) && __GNUC__ >= 4
  25. # define PHP_IMAP_EXPORT __attribute__ ((visibility("default")))
  26. #else
  27. # define PHP_IMAP_EXPORT
  28. #endif
  29. PHP_IMAP_EXPORT void mm_log(void){}
  30. PHP_IMAP_EXPORT void mm_dlog(void){}
  31. PHP_IMAP_EXPORT void mm_flags(void){}
  32. PHP_IMAP_EXPORT void mm_fatal(void){}
  33. PHP_IMAP_EXPORT void mm_critical(void){}
  34. PHP_IMAP_EXPORT void mm_nocritical(void){}
  35. PHP_IMAP_EXPORT void mm_notify(void){}
  36. PHP_IMAP_EXPORT void mm_login(void){}
  37. PHP_IMAP_EXPORT void mm_diskerror(void){}
  38. PHP_IMAP_EXPORT void mm_status(void){}
  39. PHP_IMAP_EXPORT void mm_lsub(void){}
  40. PHP_IMAP_EXPORT void mm_list(void){}
  41. PHP_IMAP_EXPORT void mm_exists(void){}
  42. PHP_IMAP_EXPORT void mm_searched(void){}
  43. PHP_IMAP_EXPORT void mm_expunged(void){}
  44. ])
  45. ])
  46. AC_DEFUN([PHP_IMAP_KRB_CHK], [
  47. if test "$PHP_KERBEROS" != "no"; then
  48. PHP_SETUP_KERBEROS(IMAP_SHARED_LIBADD,
  49. [
  50. AC_DEFINE(HAVE_IMAP_KRB,1,[ ])
  51. ], [
  52. AC_MSG_ERROR([Kerberos libraries not found.
  53. Check the path given to --with-kerberos (if no path is given, searches in /usr/kerberos, /usr/local and /usr )
  54. ])
  55. ])
  56. else
  57. AC_EGREP_HEADER(auth_gss, $IMAP_INC_DIR/linkage.h, [
  58. AC_MSG_ERROR([This c-client library is built with Kerberos support.
  59. Add --with-kerberos to your configure line. Check config.log for details.
  60. ])
  61. ])
  62. fi
  63. ])
  64. AC_DEFUN([PHP_IMAP_SSL_CHK], [
  65. if test "$PHP_IMAP_SSL" != "no"; then
  66. if test "$PHP_OPENSSL" = ""; then
  67. PHP_OPENSSL='no'
  68. fi
  69. PHP_SETUP_OPENSSL(IMAP_SHARED_LIBADD,
  70. [
  71. AC_DEFINE(HAVE_IMAP_SSL,1,[ ])
  72. ], [
  73. AC_MSG_ERROR([OpenSSL libraries not found.
  74. Check the path given to --with-openssl-dir and output in config.log)
  75. ])
  76. ])
  77. elif test -f "$IMAP_INC_DIR/linkage.c"; then
  78. AC_EGREP_HEADER(ssl_onceonlyinit, $IMAP_INC_DIR/linkage.c, [
  79. AC_MSG_ERROR([This c-client library is built with SSL support.
  80. Add --with-imap-ssl to your configure line. Check config.log for details.
  81. ])
  82. ])
  83. fi
  84. ])
  85. PHP_ARG_WITH(imap,for IMAP support,
  86. [ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix])
  87. PHP_ARG_WITH(kerberos,for IMAP Kerberos support,
  88. [ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install prefix], no, no)
  89. PHP_ARG_WITH(imap-ssl,for IMAP SSL support,
  90. [ --with-imap-ssl[=DIR] IMAP: Include SSL support. DIR is the OpenSSL install prefix], no, no)
  91. if test "$PHP_IMAP" != "no"; then
  92. PHP_SUBST(IMAP_SHARED_LIBADD)
  93. PHP_NEW_EXTENSION(imap, php_imap.c, $ext_shared)
  94. AC_DEFINE(HAVE_IMAP,1,[ ])
  95. for i in $PHP_IMAP /usr/local /usr; do
  96. IMAP_INC_CHK()
  97. el[]IMAP_INC_CHK(/include/c-client)
  98. el[]IMAP_INC_CHK(/include/imap)
  99. el[]IMAP_INC_CHK(/include)
  100. el[]IMAP_INC_CHK(/imap)
  101. el[]IMAP_INC_CHK(/c-client)
  102. fi
  103. done
  104. dnl Check for c-client version 2004
  105. AC_EGREP_HEADER(mail_fetch_overview_sequence, $IMAP_INC_DIR/mail.h, [
  106. AC_DEFINE(HAVE_IMAP2004,1,[ ])
  107. ])
  108. dnl Check for new version of the utf8_mime2text() function
  109. old_CFLAGS=$CFLAGS
  110. CFLAGS="-I$IMAP_INC_DIR"
  111. AC_CACHE_CHECK(for utf8_mime2text signature, ac_cv_utf8_mime2text,
  112. AC_TRY_COMPILE([
  113. #include <stdio.h>
  114. #include <c-client.h>
  115. ],[
  116. SIZEDTEXT *src, *dst;
  117. utf8_mime2text(src, dst);
  118. ],[
  119. ac_cv_utf8_mime2text=old
  120. ],[
  121. ac_cv_utf8_mime2text=new
  122. ])
  123. )
  124. if test "$ac_cv_utf8_mime2text" = "new"; then
  125. AC_DEFINE(HAVE_NEW_MIME2TEXT, 1, [Whether utf8_mime2text() has new signature])
  126. fi
  127. CFLAGS=$old_CFLAGS
  128. old_CFLAGS=$CFLAGS
  129. CFLAGS="-I$IMAP_INC_DIR"
  130. AC_CACHE_CHECK(for U8T_CANONICAL, ac_cv_u8t_canonical,
  131. AC_TRY_COMPILE([
  132. #include <c-client.h>
  133. ],[
  134. int i = U8T_CANONICAL;
  135. ],[
  136. ac_cv_u8t_canonical=yes
  137. ],[
  138. ac_cv_u8t_canonical=no
  139. ])
  140. )
  141. CFLAGS=$old_CFLAGS
  142. if test "$ac_cv_u8t_canonical" = "no" && test "$ac_cv_utf8_mime2text" = "new"; then
  143. AC_MSG_ERROR([utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.])
  144. fi
  145. if test "$ac_cv_u8t_canonical" = "yes" && test "$ac_cv_utf8_mime2text" = "old"; then
  146. AC_MSG_ERROR([utf8_mime2text() has old signature, but U8T_CANONICAL is present. This should not happen. Check config.log for additional information.])
  147. fi
  148. dnl Check for c-client version 2001
  149. old_CPPFLAGS=$CPPFLAGS
  150. CPPFLAGS=-I$IMAP_INC_DIR
  151. AC_EGREP_CPP(this_is_true, [
  152. #include "imap4r1.h"
  153. #if defined(IMAPSSLPORT)
  154. this_is_true
  155. #endif
  156. ],[
  157. AC_DEFINE(HAVE_IMAP2001, 1, [ ])
  158. ],[])
  159. CPPFLAGS=$old_CPPFLAGS
  160. PHP_CHECK_LIBRARY(pam, pam_start,
  161. [
  162. PHP_ADD_LIBRARY(pam,, IMAP_SHARED_LIBADD)
  163. AC_DEFINE(HAVE_LIBPAM,1,[ ])
  164. ])
  165. PHP_CHECK_LIBRARY(crypt, crypt,
  166. [
  167. PHP_ADD_LIBRARY(crypt,, IMAP_SHARED_LIBADD)
  168. AC_DEFINE(HAVE_LIBCRYPT,1,[ ])
  169. ])
  170. PHP_EXPAND_PATH($IMAP_DIR, IMAP_DIR)
  171. if test -z "$IMAP_DIR"; then
  172. AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
  173. fi
  174. if test -r "$IMAP_DIR/c-client/c-client.a"; then
  175. ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
  176. elif test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
  177. ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1
  178. fi
  179. for lib in c-client4 c-client imap; do
  180. IMAP_LIB=$lib
  181. IMAP_LIB_CHK($PHP_LIBDIR)
  182. IMAP_LIB_CHK(c-client)
  183. done
  184. if test -z "$IMAP_LIBDIR"; then
  185. AC_MSG_ERROR(Cannot find imap library (libc-client.a). Please check your c-client installation.)
  186. fi
  187. PHP_ADD_INCLUDE($IMAP_INC_DIR)
  188. PHP_ADD_LIBRARY_DEFER($IMAP_LIB,, IMAP_SHARED_LIBADD)
  189. PHP_ADD_LIBPATH($IMAP_LIBDIR, IMAP_SHARED_LIBADD)
  190. PHP_IMAP_KRB_CHK
  191. PHP_IMAP_SSL_CHK
  192. dnl Test the build in the end
  193. TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD"
  194. dnl Check if auth_gss exists
  195. PHP_IMAP_TEST_BUILD(auth_gssapi_valid, [
  196. AC_DEFINE(HAVE_IMAP_AUTH_GSS, 1, [ ])
  197. ], [], $TST_LIBS)
  198. dnl Check if utf8_to_mutf7 exists
  199. PHP_IMAP_TEST_BUILD(utf8_to_mutf7, [
  200. AC_DEFINE(HAVE_IMAP_MUTF7, 1, [ ])
  201. ], [], $TST_LIBS)
  202. AC_MSG_CHECKING(whether rfc822_output_address_list function present)
  203. PHP_TEST_BUILD(foobar, [
  204. AC_MSG_RESULT(yes)
  205. AC_DEFINE(HAVE_RFC822_OUTPUT_ADDRESS_LIST, 1, [ ])
  206. ], [
  207. AC_MSG_RESULT(no)
  208. ], [
  209. $TST_LIBS
  210. ], [
  211. #if defined(__GNUC__) && __GNUC__ >= 4
  212. # define PHP_IMAP_EXPORT __attribute__ ((visibility("default")))
  213. #else
  214. # define PHP_IMAP_EXPORT
  215. #endif
  216. PHP_IMAP_EXPORT void mm_log(void){}
  217. PHP_IMAP_EXPORT void mm_dlog(void){}
  218. PHP_IMAP_EXPORT void mm_flags(void){}
  219. PHP_IMAP_EXPORT void mm_fatal(void){}
  220. PHP_IMAP_EXPORT void mm_critical(void){}
  221. PHP_IMAP_EXPORT void mm_nocritical(void){}
  222. PHP_IMAP_EXPORT void mm_notify(void){}
  223. PHP_IMAP_EXPORT void mm_login(void){}
  224. PHP_IMAP_EXPORT void mm_diskerror(void){}
  225. PHP_IMAP_EXPORT void mm_status(void){}
  226. PHP_IMAP_EXPORT void mm_lsub(void){}
  227. PHP_IMAP_EXPORT void mm_list(void){}
  228. PHP_IMAP_EXPORT void mm_exists(void){}
  229. PHP_IMAP_EXPORT void mm_searched(void){}
  230. PHP_IMAP_EXPORT void mm_expunged(void){}
  231. void rfc822_output_address_list(void);
  232. void (*f)(void);
  233. char foobar () {f = rfc822_output_address_list;}
  234. ])
  235. AC_MSG_CHECKING(whether build with IMAP works)
  236. PHP_IMAP_TEST_BUILD(mail_newbody, [
  237. AC_MSG_RESULT(yes)
  238. ], [
  239. AC_MSG_RESULT(no)
  240. AC_MSG_ERROR([build test failed. Please check the config.log for details.])
  241. ], $TST_LIBS)
  242. fi