forked from yahoojapan/k2hash_phpext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
178 lines (157 loc) · 5.67 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#
# K2HASH PHP Extension library
#
# Copyright 2015 Yahoo Japan Corporation.
#
# K2HASH is key-valuew store base libraries.
# K2HASH is made for the purpose of the construction of
# original KVS system and the offer of the library.
# The characteristic is this KVS library which Key can
# layer. And can support multi-processing and multi-thread,
# and is provided safely as available KVS.
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
#
# AUTHOR: Hirotaka Wakabayashi
# CREATE: Tue, Feb 22 2022
# REVISION:
#
#
# Set k2hash php extension name
#
AC_SUBST([PHP_SO_NAME], "k2hash")
AC_SUBST([PHP_PECL_BASE_NAME], "pecl-k2hash")
#
# Load customizable variables
#
AC_CHECK_FILE([configure.custom],
[
configure_custom_file="configure.custom"
custom_git_domain="$(grep '^\s*GIT_DOMAIN\s*=' configure.custom | sed -e 's|^\s*GIT_DOMAIN\s*=\s*||g' -e 's|^\s*||g' -e 's|\s*$||g')"
custom_git_org="$(grep '^\s*GIT_ORG\s*=' configure.custom | sed -e 's|^\s*GIT_ORG\s*=\s*||g' -e 's|^\s*||g' -e 's|\s*$||g')"
custom_git_repo="$(grep '^\s*GIT_REPO\s*=' configure.custom | sed -e 's|^\s*GIT_REPO\s*=\s*||g' -e 's|^\s*||g' -e 's|\s*$||g')"
custom_dev_email="$(grep '^\s*DEV_EMAIL\s*=' configure.custom | sed -e 's|^\s*DEV_EMAIL\s*=\s*||g' -e 's|^\s*||g' -e 's|\s*$||g')"
custom_dev_name="$(grep '^\s*DEB_NAME\s*=' configure.custom | sed -e 's|^\s*DEB_NAME\s*=\s*||g' -e 's|^\s*||g' -e 's|\s*$||g')"
],
[
configure_custom_file=""
custom_git_domain="github.com"
custom_git_org="yahoojapan"
custom_git_repo="k2hash_phpext"
custom_dev_email="[email protected]"
custom_dev_name="K2HASH_DEVELOPER"
]
)
#
# Common variables
#
AC_SUBST([CONFIGURECUSTOM], "${configure_custom_file}")
AC_SUBST([GIT_DOMAIN], "${custom_git_domain}")
AC_SUBST([GIT_ORG], "${custom_git_org}")
AC_SUBST([GIT_REPO], "${custom_git_repo}")
AC_SUBST([DEV_EMAIL], "$(echo ${DEBEMAIL:-"${custom_dev_email}"})")
AC_SUBST([DEV_NAME], "$(echo ${DEBFULLNAME:-"${custom_dev_name}"})")
AC_SUBST([HOME_PAGE], "https://php.k2hash.antpick.ax/")
AC_SUBST([PKGLICENSE], [$(grep License LICENSE | sed -e 's/ License//g')])
AC_SUBST([DEBLICENSER],[$(grep Copyright LICENSE | sed -e 's/ *(c)//g')])
AC_SUBST([DEBCOPYING], [$(sed -e 's/^$/./g' -e 's/^/ /g' LICENSE)])
#
# Enable for this extension
#
PHP_ARG_ENABLE([k2hash], [whether to enable k2hash support], [AS_HELP_STRING([--enable-k2hash], [Enable k2hash support])], [no])
#
# For PHP Extension
#
if test "$PHP_K2HASH" != "no"; then
PHP_EVAL_INCLINE($LIBK2HASH_CFLAGS)
PHP_EVAL_LIBLINE($LIBK2HASH_LIBS, K2HASH_SHARED_LIBADD)
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for libk2hash)
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libk2hash; then
K2HASH_INCDIR=`$PKG_CONFIG libk2hash --variable=includedir`
K2HASH_LIBDIR=`$PKG_CONFIG libk2hash --variable=libdir`
K2HASH_VERSION=`$PKG_CONFIG libk2hash --modversion`
AC_MSG_RESULT(from pkgconfig: version $K2HASH_VERSION found in $K2HASH_LIBDIR)
fi
if test -z "$K2HASH_LIBDIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please install the libk2hash distribution])
fi
PHP_ADD_INCLUDE($K2HASH_INCDIR/k2hash)
PHP_ADD_LIBRARY_WITH_PATH(k2hash, $K2HASH_LIBDIR, K2HASH_SHARED_LIBADD)
PHP_SUBST(K2HASH_SHARED_LIBADD)
AC_DEFINE(HAVE_K2HASH, 1, [ Have k2hash support ])
#
# Source codes
#
PHP_NEW_EXTENSION(k2hash, k2hash_func.c K2hash.c K2hQueue.c K2hKeyQueue.c K2hIterator.c k2hash_stream.c, $ext_shared)
fi
AC_CHECK_PROG(K2H_HAVE_PHP_BINARY, [php --version], [yes], [no])
#
# Make PHP version variables
#
if test "${K2H_HAVE_PHP_BINARY}" = "yes"; then
AC_SUBST([K2H_PHP_VERSION], [$(php -r 'echo "".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')])
AC_SUBST([K2H_PHP_RAW_VERSION], [$(php -r 'echo "".PHP_MAJOR_VERSION."".PHP_MINOR_VERSION;')])
AC_SUBST([K2H_PHP_MAJOR_VERSION], [$(php -r 'echo "".PHP_MAJOR_VERSION."";')])
AC_SUBST([K2H_PHP_MINOR_VERSION], [$(php -r 'echo "".PHP_MINOR_VERSION."";')])
AC_SUBST([K2H_EXT_PKGNAME], [$(head -n 1 $(pwd)/ChangeLog | awk '{print $1}')])
AC_SUBST([K2H_EXT_VERSION], [$(head -n 1 $(pwd)/ChangeLog | sed -e 's/[(]//g' -e 's/[)]//g' | awk '{print $2}' | sed -e 's/-.*$//g')])
AC_DEFINE_UNQUOTED(PHP_K2HASH_VERSION, ["$(head -n 1 $(pwd)/ChangeLog | sed -e 's/[(]//g' -e 's/[)]//g' | awk '{print $2}' | sed -e 's/-.*$//g')"], [ PHP Extension version ])
else
AC_SUBST([K2H_PHP_VERSION], "0.0")
AC_SUBST([K2H_PHP_RAW_VERSION], "00")
AC_SUBST([K2H_PHP_MAJOR_VERSION], "0")
AC_SUBST([K2H_PHP_MINOR_VERSION], "0")
AC_SUBST([K2H_EXT_PKGNAME], "php-pecl-k2hash")
AC_SUBST([K2H_EXT_VERSION], "0.0.0")
AC_DEFINE(PHP_K2HASH_VERSION, "0.0.0", [ PHP Extension version ])
fi
#
# AC Macros for checking dependencies, etc
#
# [NOTE]
# The macros below are the macros that were output when I ran autoscan manually.
#
AC_CHECK_FUNCS([strncasecmp])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_FUNC_MALLOC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
#
# Make changelog strings for rpm
#
if test -f $(pwd)/buildutils/make_rpm_changelog.sh; then
AC_SUBST([K2H_RPMCHANGELOG], [$($(pwd)/buildutils/make_rpm_changelog.sh $(pwd)/ChangeLog)])
fi
#
# Set input files
#
if test -d buildutils; then
AC_CONFIG_FILES([
$(pwd)/buildutils/php-pecl-k2hash.spec
$(pwd)/buildutils/k2hash.ini
$(pwd)/buildutils/rules
$(pwd)/buildutils/control.in
$(pwd)/buildutils/copyright
$(pwd)/buildutils/watch
$(pwd)/buildutils/upstream/metadata
$(pwd)/buildutils/APKBUILD.templ
])
fi
#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#