Skip to content

Commit f9e375f

Browse files
author
foobar
committed
Changed the PHP_ADD_LIBRARY_DEFER() to work when building
standalone extensions. Also improved the checks for SSL and Kerberos in IMAP extension configure.
1 parent 85e15de commit f9e375f

File tree

3 files changed

+55
-24
lines changed

3 files changed

+55
-24
lines changed

acinclude.m4

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,13 +749,27 @@ ifelse($3,,[
749749
])
750750

751751
dnl
752-
dnl PHP_ADD_LIBRARY_DEFER(library[, append])
752+
dnl PHP_ADD_LIBRARY_DEFER(library[, append[, shared-libadd]])
753753
dnl
754754
dnl add a library to the link line (deferred)
755+
dnl
755756
AC_DEFUN(PHP_ADD_LIBRARY_DEFER,[
756-
ifelse($#, 1, DLIBS="-l$1 $DLIBS", DLIBS="$DLIBS -l$1")
757+
case $1 in
758+
c|c_r|pthread*) ;;
759+
*)
760+
ifelse($3,,[
761+
PHP_X_ADD_LIBRARY($1,$2,DLIBS)
762+
],[
763+
if test "$ext_shared" = "yes"; then
764+
PHP_X_ADD_LIBRARY($1,$2,$3)
765+
else
766+
PHP_ADD_LIBRARY_DEFER($1,$2)
767+
fi
757768
])
758-
769+
;;
770+
esac
771+
])
772+
759773
dnl
760774
dnl PHP_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])
761775
dnl

ext/imap/config.m4

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ AC_DEFUN(IMAP_LIB_CHK,[
2222
])
2323

2424
AC_DEFUN(PHP_IMAP_KRB_CHK, [
25-
PHP_ARG_WITH(kerberos,for Kerberos support in IMAP,
26-
[ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install dir.])
25+
AC_ARG_WITH(kerberos,
26+
[ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install dir.],[
27+
PHP_KERBEROS=$withval
28+
],[
29+
PHP_KERBEROS=no
30+
])
2731
2832
if test "$PHP_KERBEROS" = "yes"; then
2933
test -d /usr/kerberos && PHP_KERBEROS=/usr/kerberos
@@ -36,27 +40,40 @@ AC_DEFUN(PHP_IMAP_KRB_CHK, [
3640
PHP_ADD_LIBRARY(krb5, 1, IMAP_SHARED_LIBADD)
3741
PHP_ADD_LIBRARY(k5crypto, 1, IMAP_SHARED_LIBADD)
3842
PHP_ADD_LIBRARY(com_err, 1, IMAP_SHARED_LIBADD)
43+
else
44+
AC_EGREP_HEADER(auth_gss, $IMAP_INC_DIR/linkage.h, [
45+
AC_MSG_ERROR(This c-client library is build with Kerberos support.
46+
47+
Add --with-kerberos<=DIR> to your configure line. Check config.log for details.)
48+
])
3949
fi
50+
4051
])
4152

4253
AC_DEFUN(PHP_IMAP_SSL_CHK, [
43-
PHP_ARG_WITH(imap-ssl,for SSL support in IMAP,
44-
[ --with-imap-ssl[=DIR] IMAP: Include SSL support. DIR is the OpenSSL install dir.])
54+
AC_ARG_WITH(imap-ssl,
55+
[ --with-imap-ssl[=DIR] IMAP: Include SSL support. DIR is the OpenSSL install dir.],[
56+
PHP_IMAP_SSL=$withval
57+
],[
58+
PHP_IMAP_SSL=no
59+
])
4560
4661
if test "$PHP_IMAP_SSL" = "yes"; then
4762
PHP_IMAP_SSL=/usr
4863
fi
4964
5065
if test "$PHP_IMAP_SSL" != "no"; then
66+
AC_DEFINE(HAVE_IMAP_SSL,1,[ ])
5167
PHP_ADD_LIBPATH($PHP_IMAP_SSL/lib, IMAP_SHARED_LIBADD)
52-
PHP_ADD_LIBRARY_DEFER(crypto)
53-
PHP_ADD_LIBRARY_DEFER(ssl)
54-
68+
PHP_ADD_LIBRARY_DEFER(ssl,, IMAP_SHARED_LIBADD)
69+
PHP_ADD_LIBRARY_DEFER(crypto,, IMAP_SHARED_LIBADD)
70+
else
5571
old_LIBS=$LIBS
56-
LIBS="$LIBS -lc-client -lcrypto -lssl"
72+
LIBS="$LIBS -L$IMAP_LIBDIR -lc-client"
5773
if test $PHP_KERBEROS != "no"; then
58-
LIBS="$LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
74+
LIBS="$LIBS -L$PHP_KERBEROS/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
5975
fi
76+
6077
AC_TRY_RUN([
6178
void mm_log(void){}
6279
void mm_dlog(void){}
@@ -73,24 +90,23 @@ AC_DEFUN(PHP_IMAP_SSL_CHK, [
7390
void mm_exists(void){}
7491
void mm_searched(void){}
7592
void mm_expunged(void){}
76-
char ssl_onceonlyinit();
93+
char mail_open();
7794
int main() {
78-
ssl_onceonlyinit();
95+
mail_open();
7996
return 0;
8097
}
81-
],[
82-
AC_DEFINE(HAVE_IMAP_SSL,1,[ ])
83-
], [
84-
AC_MSG_ERROR(Problem with c-client library. Please check config.log for more information.)
98+
],,[
99+
AC_MSG_ERROR(This c-client library is build with SSL support.
100+
101+
Add --with-imap-ssl<=DIR> to your configure line. Check config.log for details.)
85102
])
86103
LIBS=$old_LIBS
87104
fi
88105
])
89106

90107

91108
PHP_ARG_WITH(imap,for IMAP support,
92-
[ --with-imap[=DIR] Include IMAP support. DIR is the IMAP include
93-
and c-client.a directory.])
109+
[ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix.])
94110

95111
if test "$PHP_IMAP" != "no"; then
96112

@@ -109,7 +125,8 @@ if test "$PHP_IMAP" != "no"; then
109125
done
110126

111127
AC_CHECK_LIB(pam, pam_start)
112-
128+
AC_CHECK_LIB(crypt, crypt)
129+
113130
PHP_EXPAND_PATH($IMAP_DIR, IMAP_DIR)
114131

115132
if test -z "$IMAP_DIR"; then
@@ -134,7 +151,7 @@ if test "$PHP_IMAP" != "no"; then
134151

135152
PHP_ADD_INCLUDE($IMAP_INC_DIR)
136153
PHP_ADD_LIBPATH($IMAP_LIBDIR, IMAP_SHARED_LIBADD)
137-
PHP_ADD_LIBRARY_DEFER($IMAP_LIB)
154+
PHP_ADD_LIBRARY_DEFER($IMAP_LIB,, IMAP_SHARED_LIBADD)
138155
PHP_IMAP_KRB_CHK
139156
PHP_IMAP_SSL_CHK
140157
fi

ext/informix/config.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ if test "$PHP_INFORMIX" != "no"; then
6262
*.o)
6363
IFX_LIBOBJS="$IFX_LIBOBJS $i"
6464
PHP_ADD_LIBPATH($ext_builddir, INFORMIX_SHARED_LIBADD)
65-
PHP_ADD_LIBRARY_DEFER(phpifx, 1)
65+
PHP_ADD_LIBRARY_DEFER(phpifx, 1, INFORMIX_SHARED_LIBADD)
6666
;;
6767
-lm)
6868
;;
6969
-lc)
7070
;;
7171
-l*)
7272
lib=`echo $i | cut -c 3-`
73-
PHP_ADD_LIBRARY_DEFER($lib, 1)
73+
PHP_ADD_LIBRARY_DEFER($lib, 1, INFORMIX_SHARED_LIBADD)
7474
;;
7575
*.a)
7676
case "`uname -s 2>/dev/null`" in

0 commit comments

Comments
 (0)