-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
319 lines (257 loc) · 7.59 KB
/
configure.in
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT(dispatcher, [1.1.1], [email protected])
AC_CONFIG_SRCDIR([dispatcher.c])
AC_CONFIG_HEADER([config.h])
AC_PREFIX_DEFAULT(/nexopia)
# order of directories to check for dependencies
deps_prefix_DIRS="/nexopia /usr"
environment_CFLAGS="$CFLAGS"
environment_LDFLAGS="$LDFLAGS"
# Checks for programs
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC_C99
AC_PROG_INSTALL
AC_PROG_MKDIR_P
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([signal.h syslog.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_INT32_T
AC_C_VOLATILE
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memset nanosleep])
AC_ARG_ENABLE(release,
AC_HELP_STRING([--enable-release],
[compile in release mode (default=yes)]),
[enable_RELEASE=$enableval],
[enable_RELEASE=yes])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[compile in release mode (default=no)]),
[enable_DEBUG=$enableval],
[enable_DEBUG=no])
# validate c99 support
if test x$ac_cv_prog_cc_c99 = xno; then
AC_MSG_ERROR([Require c99 mode to compile])
fi
# enable/release build
if test x$enable_DEBUG = xyes; then
CFLAGS="-g -O0 -pedantic -Wall -Wextra $environment_CFLAGS"
LDFLAGS="$environment_LDFLAGS"
elif test x$enable_RELEASE = xyes; then
CFLAGS="-Os -pedantic -Wall -Wextra $environment_CFLAGS"
LDFLAGS="$environment_LDFLAGS"
else
AC_MSG_ERROR([No build type selected])
fi
# custom flags
AC_ARG_WITH([mysql],
AS_HELP_STRING([--with-mysql=PATH],
[provide base directory for libmysql]),
[with_MYSQL_DIR=$withval],
[])
AC_ARG_WITH([gearman],
AS_HELP_STRING([--with-gearman=PATH],
[provide base directory for gearman]),
[with_GEARMAN_DIR=$withval],
[])
AC_ARG_WITH([yaml],
AS_HELP_STRING([--with-yaml=PATH],
[provide base directory for libyaml]),
[with_YAML_DIR=$withval],
[])
AC_ARG_WITH([rpath],
AS_HELP_STRING([--with-rpath],
[build with rpath if supported (default=yes)]),
[with_RPATH=$withval],
[with_RPATH=yes])
# Check for RPATH
if test $with_RPATH = yes; then
AC_CACHE_CHECK([for rpath], [ac_cv_HAVE_RPATH], [
saved_LDFLAGS="$LDFLAGS"
RPATH=""
# setup link flags
case $(uname -s) in
Linux)
rpath_PREFIX="-Wl,-rpath="
LDFLAGS=$rpath_PREFIX"/" ;;
Darwin|*)
rpath_PREFIX=""
LDFLAGS="" ;;
esac
# try compile
if test ! -z $LDFLAGS; then
AC_LINK_IFELSE(AC_LANG_PROGRAM([],[]),
[ac_cv_HAVE_RPATH=yes],
[ac_cv_HAVE_RPATH=no]
)
else
ac_cv_HAVE_RPATH=no
fi
if test x$ac_cv_HAVE_RPATH = xyes; then
RPATH=$rpath_PREFIX
fi
LDFLAGS="$saved_LDFLAGS"
])
fi
# check for MYSQL
AC_CACHE_CHECK([for mysql prefix directory], [ac_cv_MYSQL_DIR], [
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
saved_CFLAGS="$CFLAGS"
LIBS="-lmysqlclient_r"
ac_cv_MYSQL_DIR=""
for mysqldir in $with_MYSQL_DIR $deps_prefix_DIRS; do
# Skip the directory if it isn't there.
if test ! -d "$mysqldir"; then
continue
fi
if test -d "$mysqldir/lib/mysql" ; then
LDDIR="$mysqldir/lib/mysql"
else
LDDIR="$mysqldir/lib"
fi
INCDIR="$mysqldir/include"
LDFLAGS="-L$LDDIR"
CFLAGS="-I$INCDIR"
# Can I compile and link it?
AC_TRY_LINK([#include <mysql/mysql.h>], [ my_init(); ],
[ libmysql_linked=yes ],
[ libmysql_linked=no ])
if test x$libmysql_linked = xyes; then
ac_cv_MYSQL_DIR=$mysqldir
break
fi
done
if test ! -z $ac_cv_MYSQL_DIR; then
MYSQL_LIBS="$LIBS"
MYSQL_LDFLAGS="-L$LDDIR"
MYSQL_CFLAGS="-I$INCDIR"
MYSQL_RPATH=""
if test x$ac_cv_HAVE_RPATH = xyes; then
MYSQL_RPATH="$RPATH$LDDIR"
fi
else
ac_cv_MYSQL_DIR="(missing)"
fi
unset LDDIR
unset INCDIR
LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
CFLAGS="$saved_CFLAGS"
])
if test x$ac_cv_MYSQL_DIR = "x(missing)"; then
AC_MSG_ERROR([Could not find a linkable libmysqlclient. You can specify an explicit path using --with-mysql])
fi
AC_SUBST([MYSQL_LIBS])
AC_SUBST([MYSQL_LDFLAGS])
AC_SUBST([MYSQL_CFLAGS])
AC_SUBST([MYSQL_RPATH])
# check for MYSQL
AC_CACHE_CHECK([for gearman prefix directory], [ac_cv_GEARMAN_DIR], [
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
saved_CFLAGS="$CFLAGS"
LIBS="-lgearman"
ac_cv_GEARMAN_DIR=""
for gearmandir in $with_GEARMAN_DIR $deps_prefix_DIRS; do
# Skip the directory if it isn't there.
if test ! -d "$gearmandir"; then
continue
fi
LDDIR="$gearmandir/lib"
INCDIR="$gearmandir/include"
LDFLAGS="-L$LDDIR"
CFLAGS="-I$INCDIR"
# Can I compile and link it?
AC_TRY_LINK([#include <libgearman/gearman.h>], [ gearman_client_create(0); ],
[ libgearman_linked=yes ],
[ libgearman_linked=no ])
if test x$libgearman_linked = xyes; then
ac_cv_GEARMAN_DIR=$gearmandir
break
fi
done
if test ! -z $ac_cv_GEARMAN_DIR; then
GEARMAN_LIBS="$LIBS"
GEARMAN_LDFLAGS="-L$LDDIR"
GEARMAN_CFLAGS="-I$INCDIR"
GEARMAN_RPATH=""
if test x$ac_cv_HAVE_RPATH = xyes; then
GEARMAN_RPATH="$RPATH$LDDIR"
fi
else
ac_cv_GEARMAN_DIR="(missing)"
fi
unset LDDIR
unset INCDIR
LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
CFLAGS="$saved_CFLAGS"
])
if test x$ac_cv_GEARMAN_DIR = "x(missing)"; then
AC_MSG_ERROR([Could not find a linkable libgearman. You can specify an explicit path using --with-gearman])
fi
AC_SUBST([GEARMAN_LIBS])
AC_SUBST([GEARMAN_LDFLAGS])
AC_SUBST([GEARMAN_CFLAGS])
AC_SUBST([GEARMAN_RPATH])
# check for yaml
AC_CACHE_CHECK([for yaml prefix directory], [ac_cv_YAML_DIR], [
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
saved_CFLAGS="$CFLAGS"
LIBS="-lyaml"
ac_cv_YAML_DIR=""
for yamldir in $with_YAML_DIR $deps_prefix_DIRS; do
# Skip the directory if it isn't there.
if test ! -d "$yamldir"; then
continue
fi
LDDIR="$yamldir/lib"
INCDIR="$yamldir/include"
LDFLAGS="-L$LDDIR"
CFLAGS="-I$INCDIR"
# Can I compile and link it?
AC_TRY_LINK([#include <yaml.h>], [ yaml_parser_initialize(0); ],
[ libyaml_linked=yes ],
[ libyaml_linked=no ])
if test x$libyaml_linked = xyes; then
ac_cv_YAML_DIR=$yamldir
break
fi
done
if test ! -z $ac_cv_YAML_DIR; then
YAML_LIBS="$LIBS"
YAML_LDFLAGS="-L$LDDIR"
YAML_CFLAGS="-I$INCDIR"
YAML_RPATH=""
if test x$ac_cv_HAVE_RPATH = xyes; then
YAML_RPATH="$RPATH$LDDIR"
fi
else
ac_cv_YAML_DIR="(missing)"
fi
unset LDDIR
unset INCDIR
LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
CFLAGS="$saved_CFLAGS"
])
if test x$ac_cv_YAML_DIR = "x(missing)"; then
AC_MSG_ERROR([Could not find a linkable libyaml. You can specify an explicit path using --with-yaml])
fi
AC_SUBST([YAML_LIBS])
AC_SUBST([YAML_LDFLAGS])
AC_SUBST([YAML_CFLAGS])
AC_SUBST([YAML_RPATH])
AC_OUTPUT(Makefile)