5.0 from trustcommerce
[tclink.git] / config.m4
CommitLineData
d667da5b
IK
1dnl $Id: config.m4,v 2.00 2001/07/26
2AC_DEFUN(SSL_LIB_CHK,[if ((test -r $i$1/libssl.so) || (test -r $i$1/libssl.dylib) || test -n "`ls $i$1/libssl.so* 2>/dev/null`"); then SSL_DIR=$i;])
3
4PHP_ARG_WITH(tclink,for TCLink support,
5[ --with-tclink[=DIR] Include TCLink support. DIR is the TCLink
6 base install directory, defaults to ../C.
7 Set DIR to "shared" to build as a dl, or "shared,DIR"
8 to build as a dl and still specify DIR.])
9
10PHP_ARG_WITH(ssl,for TCLink SSL support,
11[ --with-ssl[=DIR] Include TCLink SSL support. DIR is the SSL
12 library directory, which defaults to /usr/lib.])
13
14PHP_ARG_WITH(ca-path,for CA path,
15[ --with-ca-path[=DIR] ca-bundle file or CA directory])
16
17if test "$PHP_TCLINK" != "no"; then
18 AC_DEFINE(HAVE_TCLINK,1,[ ])
19 PHP_EXTENSION(tclink,$ext_shared)
20fi
21
22dnl Need to have a way to sepcify the include dir as well
23if test "$PHP_SSL" != "no"; then
24 for i in /lib /usr/local/lib /usr/lib $PHP_SSL; do
25 SSL_LIB_CHK(/)
26 fi
27 done
28 if test -z "$SSL_DIR"; then
29 AC_MSG_ERROR(Cannot find libssl.so. Please specify the installation path for SSL)
30 fi
31
32 AC_DEFINE(HAVE_SSL,1,[ ])
33
34fi
35
36if test "$PHP_CA_PATH" != "no"; then
37 if test "$PHP_CA_PATH" != "yes"; then
38 AC_MSG_NOTICE([User specified CA path: $PHP_CA_PATH])
39 TCLINK_CA_PATH="$PHP_CA_PATH"
40 fi
41fi
42if test -z "$TCLINK_CA_PATH"; then
43 OPENSSL_CA_PATH=`openssl version -d | sed 's/[[^"]]*"\(.*\)"/\1/'` # grab whatever between the double quotes
44 if test -n "$OPENSSL_CA_PATH"; then
45 OPENSSL_CA_PATH="$OPENSSL_CA_PATH/certs"
46 AC_MSG_NOTICE([Openssl CA path: $OPENSSL_CA_PATH])
47
48 for item in \
49 "$OPENSSL_CA_PATH/ca-bundle.crt" \
50 "$OPENSSL_CA_PATH/ca-certificates.crt" \
51 "$OPENSSL_CA_PATH/ca-bundle.trust.crt" \
52 "$OPENSSL_CA_PATH/tls-ca-bundle.pem" \
53 "$OPENSSL_CA_PATH"
54 do
55 AC_MSG_NOTICE([Checking '$item'])
56 if test -f $item || test -d $item; then
57 AC_MSG_NOTICE([Found '$item'])
58 TCLINK_CA_PATH=$item
59 break
60 fi
61 done
62 fi
63fi
64if test -z "$TCLINK_CA_PATH"; then
65 AC_MSG_NOTICE([Search from known locations])
66 for item in \
67 "/etc/pki/tls/certs/ca-bundle.crt" \
68 "/etc/ssl/certs/ca-certificates.crt" \
69 "/etc/pki/tls/certs/ca-bundle.trust.crt" \
70 "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" \
71 "/etc/ssl/certs"
72 do
73 AC_MSG_NOTICE([Checking '$item'])
74 if test -f $item || test -d $item; then
75 AC_MSG_NOTICE([Found '$item'])
76 TCLINK_CA_PATH=$item
77 break
78 fi
79 done
80fi
81if test -z "$TCLINK_CA_PATH"; then
82 AC_MSG_ERROR([Cannot determine CA path. Please use --with-ca-path=<path> to specify ca-bundle file or CA directory.])
83fi
84
85TCLINK_SHARED_LIBADD="-lssl -lcrypto -L$SSL_DIR";
86CFLAGS="-I$SSL_DIR/../include"
c235c6ac 87TCLINK_VERSION="4.5.0-PHP-`uname -sm | tr ' ' -`"
d667da5b
IK
88AC_DEFINE_UNQUOTED([TCLINK_VERSION], "$TCLINK_VERSION", [TCLink version string.])
89
90AC_MSG_NOTICE([CA path: $TCLINK_CA_PATH])
91AC_DEFINE_UNQUOTED([TCLINK_CA_PATH], "$TCLINK_CA_PATH", [CA path])
92
93PHP_SUBST(TCLINK_INCLUDE)
94PHP_SUBST(TCLINK_SHARED_LIBADD)
95