-
-
Notifications
You must be signed in to change notification settings - Fork 263
/
config.m4
115 lines (95 loc) · 3.3 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
dnl $Id$
dnl config.m4 for extension rdkafka
PHP_ARG_WITH(rdkafka, for rdkafka support,
[ --with-rdkafka Include rdkafka support])
if test "$PHP_RDKAFKA" != "no"; then
SEARCH_PATH="/usr/local /usr" # you might want to change this
SEARCH_FOR="/include/librdkafka/rdkafka.h" # you most likely want to change this
if test -r $PHP_RDKAFKA/$SEARCH_FOR; then # path given as parameter
RDKAFKA_DIR=$PHP_RDKAFKA
else # search default path list
AC_MSG_CHECKING([for librdkafka/rdkafka.h" in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
RDKAFKA_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi
if test -z "$RDKAFKA_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the rdkafka distribution])
fi
PHP_ADD_INCLUDE($RDKAFKA_DIR/include)
SOURCES="rdkafka.c metadata.c metadata_broker.c metadata_topic.c metadata_partition.c metadata_collection.c conf.c topic.c queue.c message.c fun.c kafka_consumer.c topic_partition.c"
LIBNAME=rdkafka
LIBSYMBOL=rd_kafka_new
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
[
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $RDKAFKA_DIR/$PHP_LIBDIR, RDKAFKA_SHARED_LIBADD)
AC_DEFINE(HAVE_RDKAFKALIB,1,[ ])
],[
AC_MSG_ERROR([wrong rdkafka lib version or lib not found])
],[
-L$RDKAFKA_DIR/$PHP_LIBDIR -lm
])
ORIG_LDFLAGS="$LDFLAGS"
ORIG_CPPFLAGS="$CPPFLAGS"
LDFLAGS="-L$RDKAFKA_DIR/$PHP_LIBDIR -lm"
CPPFLAGS="-I$RDKAFKA_DIR/include"
AC_MSG_CHECKING([for librdkafka version])
AC_EGREP_CPP(yes,[
#include <librdkafka/rdkafka.h>
#if RD_KAFKA_VERSION >= 0x000b0000
yes
#endif
],[
AC_MSG_RESULT([>= 0.11.0])
],[
AC_MSG_ERROR([librdkafka version 0.11.0 or greater required.])
])
AC_CHECK_LIB($LIBNAME,[rd_kafka_message_headers],[
AC_DEFINE(HAVE_RD_KAFKA_MESSAGE_HEADERS,1,[ ])
],[
AC_MSG_WARN([no rd_kafka_message_headers, headers support will not be available])
])
AC_CHECK_LIB($LIBNAME,[rd_kafka_purge],[
AC_DEFINE(HAS_RD_KAFKA_PURGE,1,[ ])
],[
AC_MSG_WARN([purge is not available])
])
AC_CHECK_LIB($LIBNAME,[rd_kafka_controllerid],[
#if RD_KAFKA_VERSION >= 0x010000ff
AC_DEFINE(HAS_RD_KAFKA_CONTROLLERID,1,[ ])
#else
AC_MSG_WARN([controllerid is broken on 0.11.x])
#endif
],[
AC_MSG_WARN([controllerid is not available])
])
AC_CHECK_LIB($LIBNAME,[rd_kafka_init_transactions],[
AC_DEFINE(HAS_RD_KAFKA_TRANSACTIONS,1,[ ])
SOURCES="$SOURCES kafka_error_exception.c"
],[
AC_MSG_WARN([transactions are not available])
])
AC_CHECK_LIB($LIBNAME,[rd_kafka_msg_partitioner_murmur2],[
AC_DEFINE(HAS_RD_KAFKA_PARTITIONER_MURMUR2,1,[ ])
],[
AC_MSG_WARN([murmur2 partitioner is not available])
])
AC_CHECK_LIB($LIBNAME,[rd_kafka_conf_set_oauthbearer_token_refresh_cb],[
AC_DEFINE(HAS_RD_KAFKA_OAUTHBEARER_TOKEN_REFRESH_CB,1,[ ])
],[
AC_MSG_WARN([oauthbearer token refresh cb is not available])
])
AC_CHECK_LIB($LIBNAME,[rd_kafka_incremental_assign, rd_kafka_incremental_unassign],[
AC_DEFINE(HAS_RD_KAFKA_INCREMENTAL_ASSIGN,1,[ ])
],[
AC_MSG_WARN([no rd_kafka_incremental_(un)assign, incremental rebalance support will not be available])
])
LDFLAGS="$ORIG_LDFLAGS"
CPPFLAGS="$ORIG_CPPFLAGS"
PHP_SUBST(RDKAFKA_SHARED_LIBADD)
PHP_NEW_EXTENSION(rdkafka, $SOURCES, $ext_shared)
fi