forked from CUBRID/cubrid-pdo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
120 lines (102 loc) · 3.75 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
dnl $Id: config.m4,v 2.3 2006/10/17 08:36:36 cgkang Exp $
dnl config.m4 for extension cubrid
dnl don't forget to call PHP_EXTENSION(cubrid)
dnl If your extension references something external, use with:
PHP_ARG_WITH(pdo-cubrid, for CUBRID support for PDO,
[ --with-pdo-cubrid PDO: CUBRID support.])
dnl Check PHP version:
AC_MSG_CHECKING(PHP version)
PHP_MAJOR_VERSION=`grep 'PHP_MAJOR_VERSION' $phpincludedir/main/php_version.h | grep -oP '\d+'`
if test "$PHP_PDO_CUBRID" != "no"; then
cubrid_dir=`dirname $0`
COMPAT_INCDIR=""
CUBRID_INCDIR=""
CUBRID_LIBDIR=""
BROKER_INCDIR=""
case $host in
*-linux-*) os=linux ;;
esac
case $host in
*-apple-*) os=mac ;
esac
if test "$os" = "linux"; then
COMPAT_INCDIR="$cubrid_dir/cci-src/src/compat"
CUBRID_INCDIR="$cubrid_dir/cci-src/src/cci"
BROKER_INCDIR="$cubrid_dir/cci-src/src/broker"
CUBRID_LIBDIR="$cubrid_dir/cci-src/cci/.libs"
CCISRC_DIR="$cubrid_dir/cci-src"
AC_CHECK_SIZEOF([int *])
if test "$ac_cv_sizeof_int_p" = "8"; then
AC_MSG_NOTICE([Build static cci lib 64 bits])
pushd $CCISRC_DIR
chmod +x configure
./configure --enable-64bit
make
popd
else
AC_MSG_NOTICE([Build static cci lib])
pushd $CCISRC_DIR
chmod +x configure
./configure
make
popd
fi
elif test "$os" = "mac"; then
COMPAT_INCDIR="$cubrid_dir/cci-src/src/compat"
CUBRID_INCDIR="$cubrid_dir/cci-src/src/cci"
BROKER_INCDIR="$cubrid_dir/cci-src/src/broker"
CUBRID_LIBDIR="$cubrid_dir/cci-src/cci/.libs"
CCISRC_DIR="$cubrid_dir/cci-src"
AC_CHECK_SIZEOF([int *])
if test "$ac_cv_sizeof_int_p" = "8"; then
AC_MSG_NOTICE([Build static cci lib 64 bits])
pushd $CCISRC_DIR
chmod +x configure
./configure--enable-64bit
make
popd
else
AC_MSG_NOTICE([Build static cci lib])
pushd $CCISRC_DIR
chmod +x configure
./configure
make
popd
fi
else
AC_MSG_ERROR([Your OS not supported. Exit.])
fi
if ! test -r "$CUBRID_INCDIR/cas_cci.h"; then
AC_MSG_ERROR([$cubrid_dir/$CUBRID_INCDIR/cas_cci.h not found. This package must be broken. Please report a bug.])
fi
if test -r "$CUBRID_LIBDIR/libcascci.a"; then
#
# libcascci.a depends on pthread and stdc++.
#
PHP_CHECK_LIBRARY("pthread", pthread_create, [], [
AC_MSG_ERROR([pthread library not found! Please install it at first.])
], [])
PHP_CHECK_LIBRARY("stdc++", main, [], [
AC_MSG_ERROR([stdc++ library not found! Please install it at before.])
], [])
else
AC_MSG_ERROR([libcascci.a not found. Failed to build cci lib. Exit.])
fi
dnl Action..
PHP_ADD_INCLUDE("$COMPAT_INCDIR")
PHP_ADD_INCLUDE("$CUBRID_INCDIR")
PHP_ADD_INCLUDE("$BROKER_INCDIR")
PHP_ADD_LIBRARY(stdc++, , PDO_CUBRID_SHARED_LIBADD)
PHP_ADD_LIBRARY(pthread, , PDO_CUBRID_SHARED_LIBADD)
LDFLAGS="$LDFLAGS $CUBRID_LIBDIR/libcascci.a -lpthread $cubrid_dir/cci-src/external/openssl/lib/libssl.a $cubrid_dir/cci-src/external/openssl/lib/libcrypto.a"
PHP_SUBST(PDO_CUBRID_SHARED_LIBADD)
if test "$PHP_MAJOR_VERSION" = "7"; then
PHP_NEW_EXTENSION(pdo_cubrid, pdo_cubrid.c cubrid_driver7.c cubrid_statement7.c, $ext_shared,,-I$pdo_inc_path -I)
else
PHP_NEW_EXTENSION(pdo_cubrid, pdo_cubrid.c cubrid_driver.c cubrid_statement.c, $ext_shared,,-I$pdo_inc_path -I)
fi
ifdef([PHP_ADD_EXTENSION_DEP],
[
PHP_ADD_EXTENSION_DEP(pdo_cubrid, pdo)
])
fi