fixed JDK 8 detection on Linux
[public/netxms.git] / configure.ac
<
CommitLineData
8e76f8aa 1# $Id$
d16cf8a5 2#
ef0c727b
VK
3# NetXMS - Network Management System
4# Configure script
d16cf8a5
AK
5#
6
bd681586 7AC_INIT([NetXMS], [2.1-M1], [bugs@netxms.org])
ba1d810c 8AC_CONFIG_AUX_DIR(config)
8e7f84bf 9AC_CONFIG_HEADERS(config.h)
d16cf8a5 10AM_INIT_AUTOMAKE
09867021 11m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
d16cf8a5 12
aa24418a 13AC_CONFIG_MACRO_DIR([m4])
5387ff75 14
ef0c727b
VK
15#--------------------------------------------------------------------
16# Functions
17#--------------------------------------------------------------------
5387ff75 18
ef0c727b
VK
19check_substr()
20{
1010cff7 21 for w in $1; do
ef0c727b
VK
22 if test "x$w" = "x$2"; then
23 return 0;
24 fi
25 done
26 return 1
27}
16dff090 28
b535eed6
VK
29find_existing_dir()
30{
31 for d in "$@"; do
32 if test -d "$d"; then
33 __dir="$d"
34 return 0;
35 fi
36 done
37 return 1
38}
39
d3c8926d 40
ef0c727b
VK
41#--------------------------------------------------------------------
42# Initialize variables
43#--------------------------------------------------------------------
d3c8926d 44
ef0c727b 45PLATFORM=`uname -s`
c3900dbb 46CPUTYPE=`uname -p`
ef0c727b
VK
47COMPONENTS=""
48DISABLE_ICONV="no"
49DISABLE_ENCRYPTION="no"
4050bafb 50DISABLE_LMSENSORS="no"
f974a50a 51ENABLE_DEBUG="no"
25ae8377 52ENABLE_WERROR="no"
ef0c727b 53STATIC_BUILD="no"
c1165d33 54ALL_STATIC="no"
ef0c727b
VK
55DBDRIVER_SELECTED="no"
56USE_PTH="no"
57BUILD_SERVER="no"
58BUILD_AGENT="no"
59BUILD_CLIENT="no"
ef0c727b 60BUILD_STATIC_AGENT="no"
447350a9 61BUILD_SDK="no"
f65df2b1 62MODULES="libnetxms tools install"
ef0c727b 63STATIC_SUBAGENT_LIST=""
c1165d33 64PROPOSED_STATIC_SUBAGENTS="default"
ef0c727b
VK
65SUBAGENT_DIRS=""
66SUBAGENT_LIBS=""
c7c6ce77 67AGENT_DIRS=""
7c48e2aa 68SERVER_LIBS=""
ef0c727b 69SERVER_TOOLS=""
7dda4453 70SERVER_INCLUDE=""
31b0f68b 71SMSDRV_DIRS=""
6fad8870 72HDLINK_DIRS=""
52a2232c 73PDSDRV_DIRS=""
ef0c727b
VK
74TOP_LEVEL_MODULES=""
75CONTRIB_MODULES=""
c2612d83 76CLIENT_COMPONENTS=""
8b86c5dc 77BUILD_UNICODE="no"
467c489f 78FORCE_INTERNAL_EXPAT="no"
17b35ccc
VK
79USE_INTERNAL_LIBTRE="no"
80FORCE_INTERNAL_LIBTRE="no"
f5393033 81FORCE_INTERNAL_JANSSON="no"
1fd41bcd 82FORCE_INTERNAL_ZLIB="no"
3d2bc3ae 83FORCE_INTERNAL_SQLITE="no"
cc297a70 84FORCE_32BIT_BUILD="no"
df9812a9 85FORCE_INTERNAL_GETOPT="no"
545bda2d
VK
86LDFLAGS_PREFIX=""
87LDFLAGS_SUFFIX=""
1ef5e57a
VK
88LTINIT_CC=""
89LTINIT_CXX=""
9113e749 90SQLFLAGS=""
a5a95ac8 91RUNTIME_PREFIX=""
6ecea6ef 92RUNTIME_STATE_DIR=""
6dde8627 93HPUX_HPPA="no"
058bf6fc 94XMPP_SUPPORT="yes"
ca026ade
VK
95ZEROMQ_SUPPORT="yes"
96ZEROMQ_REQUIRED="no"
7fcdcb0c
VK
97ZEROMQ_CPPFLAGS=""
98ZEROMQ_LDFLAGS=""
2cfe4482 99LDAP_SUPPORT="yes"
65834be3 100DISABLE_READLINE="no"
6d14d0b0 101TUXEDO_LIBS=""
c7c6ce77 102TUXEDO_TPINIT=""
d6235717 103MONGODB_LIBS=""
b7c8729b 104VMGR_LIBS=""
b8adb0f2
VK
105DISABLE_IPV6="no"
106IPV6_SUPPORT="no"
b5e5849b 107INSTALL_LIBPATH=""
096e561b
VK
108OPENSSL_LIBSSL="ssl"
109OPENSSL_LIBCRYPTO="crypto"
d3c8926d 110
16dff090 111
fecf6a2b
VK
112#--------------------------------------------------------------------
113# Common compilation flags
114#--------------------------------------------------------------------
115
842c22f4 116CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DTRE_WCHAR=1"
fecf6a2b
VK
117
118
ef0c727b
VK
119#--------------------------------------------------------------------
120# Parse command line parameters
121#--------------------------------------------------------------------
7c9c94a7 122
a5a95ac8 123AC_ARG_WITH(runtime-prefix,
125543aa 124[AS_HELP_STRING(--with-runtime-prefix=prefix,installation prefix to be used at run time)],
a5a95ac8
VK
125[
126 RUNTIME_PREFIX="$withval"
54df06e2 127 RUNTIME_STATE_DIR="$RUNTIME_PREFIX/var"
6ecea6ef
VK
128])
129
130AC_ARG_WITH(runtime-state-dir,
131[AS_HELP_STRING(--with-runtime-state-dir=path,state directory to be used at run time)],
132[
133 RUNTIME_STATE_DIR="$withval"
a5a95ac8
VK
134])
135
ef0c727b
VK
136AC_ARG_WITH(server,
137[AS_HELP_STRING(--with-server,build server)],
138[
231b0aad 139 COMPONENTS="$COMPONENTS sqlite snmp server agent sqlite_drv"
c5c0f362
VK
140])
141
142AC_ARG_WITH(snmp,
143[AS_HELP_STRING(--with-snmp,build SNMP library and tools)],
144[
145 COMPONENTS="$COMPONENTS snmp"
ef0c727b 146])
7c9c94a7 147
ef0c727b
VK
148AC_ARG_WITH(client,
149[AS_HELP_STRING(--with-client,build client library and tools)],
150[
151 COMPONENTS="$COMPONENTS client"
152])
d16cf8a5 153
a7a03ffd
VK
154AC_ARG_WITH(client-proxy,
155[AS_HELP_STRING(--with-client-proxy,build client proxy)],
156[
157 COMPONENTS="$COMPONENTS client-proxy"
158])
159
ef0c727b
VK
160AC_ARG_WITH(agent,
161[AS_HELP_STRING(--with-agent,build agent)],
162[
231b0aad 163 COMPONENTS="$COMPONENTS sqlite snmp agent sqlite_drv"
ef0c727b 164])
d16cf8a5 165
ef0c727b
VK
166AC_ARG_WITH(static-agent,
167[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
168[
231b0aad 169 COMPONENTS="$COMPONENTS sqlite snmp static-agent sqlite_drv"
fb12fd54 170 FORCE_INTERNAL_EXPAT="yes"
fb12fd54 171 FORCE_INTERNAL_JANSSON="yes"
3d2bc3ae
VK
172 FORCE_INTERNAL_LIBTRE="yes"
173 FORCE_INTERNAL_SQLITE="yes"
fb12fd54 174 FORCE_INTERNAL_ZLIB="yes"
ef0c727b 175])
d16cf8a5 176
ef0c727b
VK
177AC_ARG_WITH(ipso-agent,
178[AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
179[
971abf4f 180 COMPONENTS="$COMPONENTS ipso-agent"
ef0c727b 181])
521d90e7 182
7dda4453
VK
183AC_ARG_WITH(sdk,
184[AS_HELP_STRING(--with-sdk,build and install files necessary for extension development)],
185[
b550188f 186 COMPONENTS="$COMPONENTS sqlite sdk"
7dda4453
VK
187 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES include"
188 SERVER_INCLUDE="include"
447350a9 189 BUILD_SDK="yes"
4671448c
VK
190])
191
192AC_ARG_WITH(static-sdk,
193[AS_HELP_STRING(--with-static-sdk,build and install files necessary for extension development (static libs only))],
194[
b550188f 195 COMPONENTS="$COMPONENTS sqlite sdk"
4671448c
VK
196 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES include"
197 SERVER_INCLUDE="include"
198 BUILD_SDK="yes"
199 STATIC_BUILD="yes"
7dda4453
VK
200])
201
ef0c727b
VK
202AC_ARG_WITH(mdebug,
203[AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
204[
205 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
206])
d16cf8a5 207
b82ad936
AK
208AC_ARG_WITH(profiler,
209[AS_HELP_STRING(--with-profiler,link with libprofiler from gperftools)],
210[
211 LDFLAGS="$LDFLAGS -lprofiler"
212])
213
467c489f
VK
214AC_ARG_WITH(internal-libexpat,
215[AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
216[
217 FORCE_INTERNAL_EXPAT="yes"
218])
219
17b35ccc
VK
220AC_ARG_WITH(internal-libtre,
221[AS_HELP_STRING(--with-internal-libtre,force use of bundled libtre)],
222[
223 FORCE_INTERNAL_LIBTRE="yes"
224])
225
f5393033
VK
226AC_ARG_WITH(internal-libjansson,
227[AS_HELP_STRING(--with-internal-libjansson,force use of bundled libjansson)],
228[
229 FORCE_INTERNAL_JANSSON="yes"
230])
231
1fd41bcd
VK
232AC_ARG_WITH(internal-zlib,
233[AS_HELP_STRING(--with-internal-zlib,force use of bundled zlib)],
234[
235 FORCE_INTERNAL_ZLIB="yes"
236])
237
3d2bc3ae
VK
238AC_ARG_WITH(internal-sqlite,
239[AS_HELP_STRING(--with-internal-sqlite,force use of bundled sqlite)],
240[
241 FORCE_INTERNAL_SQLITE="yes"
242])
243
df9812a9
VK
244AC_ARG_WITH(internal-getopt,
245[AS_HELP_STRING(--with-internal-getopt,force use of bundled getopt)],
246[
247 FORCE_INTERNAL_GETOPT="yes"
248])
249
c1165d33
VK
250AC_ARG_WITH(all-static,
251[AS_HELP_STRING(--with-all-static,use -all-static flag for linking executables)],
252[
253 ALL_STATIC="yes"
254])
255
256AC_ARG_WITH(static-subagents,
919e2dce 257[AS_HELP_STRING(--with-static-subagents-list,define list of static subagents (separated by spaces))],
c1165d33
VK
258[
259 PROPOSED_STATIC_SUBAGENTS="$withval"
260])
261
50e4bc8c
VK
262AC_ARG_WITH(jdk,
263[AS_HELP_STRING(--with-jdk,build Java-dependent components)],
264[ if test "x$withval" != "xno" ; then
265 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
266 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
267 LDFLAGS="$LDFLAGS -L${withval}/lib"
268 CPPFLAGS="$CPPFLAGS -I${withval}/include"
a041dc13
VK
269 if test -d "${withval}/include/linux"; then
270 CPPFLAGS="$CPPFLAGS -I${withval}/include/linux"
271 fi
e2e3ce85
VK
272 if test -d "${withval}/include/solaris"; then
273 CPPFLAGS="$CPPFLAGS -I${withval}/include/solaris"
274 fi
50e4bc8c
VK
275 fi
276 COMPONENTS="$COMPONENTS java"
277fi ])
278
b14c3f22
VK
279AC_ARG_WITH(tuxedo,
280[AS_HELP_STRING(--with-tuxedo,build Tuxedo-dependent components)],
281[ if test "x$withval" != "xno" ; then
282 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
283 TUXEDO_BASE="$withval"
284 fi
285 COMPONENTS="$COMPONENTS tuxedo"
286fi ])
287
cac05a70 288AC_ARG_WITH(zeromq,
289[AS_HELP_STRING(--with-zeromq,build with ZeroMQ)],
290[ if test "x$withval" != "xno" ; then
291 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
292 ZEROMQ_BASE="$withval"
ca026ade 293 ZEROMQ_REQUIRED=yes
cac05a70 294 fi
295 COMPONENTS="$COMPONENTS zeromq"
ca026ade
VK
296 ZEROMQ_SUPPORT=yes
297else
298 ZEROMQ_SUPPORT=no
cac05a70 299fi ])
300
d6235717 301AC_ARG_WITH(mongodb,
302[AS_HELP_STRING(--with-mongodb,build MongoDB-dependent components)],
303[ if test "x$withval" != "xno" ; then
304 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
305 MONGODB_BASE="$withval"
306 fi
307 COMPONENTS="$COMPONENTS mongodb"
308fi ])
309
b7c8729b 310AC_ARG_WITH(vmgr,
311[AS_HELP_STRING(--with-vmgr,build VirtualHost managmet subagent)],
312[ if test "x$withval" != "xno" ; then
313 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
314 VMGR_BASE="$withval"
315 fi
316 COMPONENTS="$COMPONENTS vmgr"
317fi ])
318
9486b324
VK
319AC_ARG_WITH(sqlite,
320[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
321[ if test "x$withval" != "xno" ; then
8817f620 322 COMPONENTS="$COMPONENTS sqlite_drv"
ef0c727b 323 DBDRIVER_SELECTED="yes"
9486b324
VK
324fi ])
325
c4b88c3d
VK
326AC_ARG_WITH(odbc,
327[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
328[ if test "x$withval" != "xno" ; then
329 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
2cfe4482
VK
330 ODBC_LD_RUN_PATH="${withval}/lib"
331 ODBC_LDFLAGS="-L${withval}/lib"
332 ODBC_CPPFLAGS="-I${withval}/include"
ef0c727b
VK
333 fi
334 COMPONENTS="$COMPONENTS odbc"
335 DBDRIVER_SELECTED="yes"
c4b88c3d
VK
336fi ])
337
ed77e726 338AC_ARG_WITH(oracle,
41b4790d
VK
339[AS_HELP_STRING(--with-oracle,build Oracle database driver)],
340[ if test "x$withval" != "xno" ; then
df5afcf1 341 ORABASE="$ORACLE_HOME"
41b4790d 342 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
df5afcf1
VK
343 ORABASE="$withval"
344 fi
345 if test "x$ORABASE" != "x"; then
06d9dfbc 346 if test -x "$ORABASE/lib" ; then
df5afcf1
VK
347 ORACLE_LD_RUN_PATH="${ORABASE}/lib"
348 ORACLE_LDFLAGS="-L${ORABASE}/lib"
7d8c91ef 349 else
df5afcf1
VK
350 ORACLE_LD_RUN_PATH="${ORABASE}"
351 ORACLE_LDFLAGS="-L${ORABASE}"
7d8c91ef 352 fi
06d9dfbc 353 if test -x "$ORABASE/include" ; then
df5afcf1 354 ORACLE_CPPFLAGS="-I${ORABASE}/include"
7d8c91ef 355 fi
06d9dfbc 356 if test -x "$ORABASE/sdk/include" ; then
df5afcf1 357 ORACLE_CPPFLAGS="-I${ORABASE}/sdk/include"
7d8c91ef 358 fi
06d9dfbc 359 if test -x "$ORABASE/rdbms/public" ; then
df5afcf1 360 ORACLE_CPPFLAGS="-I${ORABASE}/rdbms/public"
2f6e6064 361 fi
41b4790d
VK
362 fi
363 COMPONENTS="$COMPONENTS oracle"
364 DBDRIVER_SELECTED="yes"
365fi ])
366
d16cf8a5 367AC_ARG_WITH(mysql,
c4b88c3d 368[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
369[ if test "x$withval" != "xno" ; then
370 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
9f1ea006
VK
371 if find_existing_dir "${withval}/lib" "${withval}/lib/mysql" "${withval}/mysql/lib"; then
372 MYSQL_LD_RUN_PATH="$__dir$"
373 MYSQL_LDFLAGS="-L$__dir"
374 fi
375 if find_existing_dir "${withval}/include" "${withval}/include/mysql" "${withval}/mysql/include"; then
376 MYSQL_CPPFLAGS="-I$__dir"
377 fi
d16cf8a5 378 else
9f1ea006
VK
379 if find_existing_dir "/usr/local/mysql/lib" "/usr/local/mysql/lib/mysql" "/usr/lib64/mysql" "/usr/lib/mysql" "/usr/mysql/lib" "/usr/mysql/lib/mysql" "/usr/local/lib/mysql"; then
380 MYSQL_LD_RUN_PATH="$__dir$"
381 MYSQL_LDFLAGS="-L$__dir"
382 fi
383 if find_existing_dir "/usr/local/mysql/include" "/usr/include/mysql" "/usr/mysql/include" "/usr/local/include/mysql" "/usr/local/mysql/include/mysql" "/usr/mysql/include/mysql"; then
384 MYSQL_CPPFLAGS="-I$__dir"
385 fi
d16cf8a5 386 fi
ef0c727b
VK
387 COMPONENTS="$COMPONENTS mysql"
388 DBDRIVER_SELECTED="yes"
6693a1d0 389fi ])
d16cf8a5
AK
390
391AC_ARG_WITH(pgsql,
c4b88c3d 392[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 393[ if test "x$withval" != "xno" ; then
6693a1d0 394 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
b535eed6
VK
395 if find_existing_dir "${withval}/lib" "${withval}/lib/pgsql" "${withval}/lib/postgresql" "${withval}/pgsql/lib" "${withval}/postgresql/lib"; then
396 PGSQL_LD_RUN_PATH="$__dir$"
397 PGSQL_LDFLAGS="-L$__dir"
398 fi
399 if find_existing_dir "${withval}/include" "${withval}/include/pgsql" "${withval}/include/postgresql" "${withval}/pgsql/include" "${withval}/postgresql/include"; then
400 PGSQL_CPPFLAGS="-I$__dir"
401 fi
6693a1d0 402 else
b535eed6
VK
403 if find_existing_dir "/usr/local/pgsql/lib" "/usr/local/pgsql/lib/pgsql" "/usr/lib64/pgsql" "/usr/lib/pgsql" "/usr/pgsql/lib" "/usr/pgsql/lib/pgsql" "/usr/local/lib/pgsql" "/usr/local/postgresql/lib" "/usr/local/postgresql/lib/postgresql" "/usr/lib/postgresql" "/usr/postgresql/lib" "/usr/postgresql/lib/postgresql" "/usr/local/lib/postgresql"; then
404 PGSQL_LD_RUN_PATH="$__dir$"
405 PGSQL_LDFLAGS="-L$__dir"
406 fi
407 if find_existing_dir "/usr/local/pgsql/include" "/usr/include/pgsql" "/usr/pgsql/include" "/usr/local/include/pgsql" "/usr/local/pgsql/include/pgsql" "/usr/pgsql/include/pgsql" "/usr/local/postgresql/include" "/usr/include/postgresql" "/usr/postgresql/include" "/usr/local/include/postgresql" "/usr/local/postgresql/include/postgresql" "/usr/postgresql/include/postgresql"; then
408 PGSQL_CPPFLAGS="-I$__dir"
409 fi
6693a1d0 410 fi
ef0c727b
VK
411 COMPONENTS="$COMPONENTS pgsql"
412 DBDRIVER_SELECTED="yes"
6693a1d0 413fi ])
d16cf8a5 414
84277a0f
AK
415AC_ARG_WITH(db2,
416[AS_HELP_STRING(--with-db2,build DB2 database driver)],
417[ if test "x$withval" != "xno" ; then
418 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
419 if test `uname -m` = 'i386' || test `uname -m` = 'i686'; then
420 DB2_LIB_DIR=lib32
421 else
422 DB2_LIB_DIR=lib64
423 fi
424 if test -x "$withval/${DB2_LIB_DIR}" ; then
425 LD_RUN_PATH="${withval}/${DB2_LIB_DIR}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
426 LDFLAGS="$LDFLAGS -L${withval}/${DB2_LIB_DIR}"
427 else
428 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
429 LDFLAGS="$LDFLAGS -L${withval}"
430 fi
431 if test -x "$withval/include" ; then
432 CPPFLAGS="$CPPFLAGS -I${withval}/include"
433 fi
434
435 unset DB2_LIB_DIR
436 fi
437 COMPONENTS="$COMPONENTS db2"
438 DBDRIVER_SELECTED="yes"
439fi ])
440
37861c72
VK
441AC_ARG_WITH(informix,
442[AS_HELP_STRING(--with-informix,build Informix database driver)],
443[ if test "x$withval" != "xno" ; then
444 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
445 if test -x "$withval/lib/cli" ; then
446 LD_RUN_PATH="${withval}/lib/cli${LD_RUN_PATH:+:}${LD_RUN_PATH}"
447 LDFLAGS="$LDFLAGS -L${withval}/lib/cli"
448 if test -x "$withval/lib/esql" ; then
449 LD_RUN_PATH="${withval}/lib/esql${LD_RUN_PATH:+:}${LD_RUN_PATH}"
450 LDFLAGS="$LDFLAGS -L${withval}/lib/esql"
451 fi
452 else
453 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
454 LDFLAGS="$LDFLAGS -L${withval}"
455 fi
456 if test -x "$withval/incl/cli" ; then
457 CPPFLAGS="$CPPFLAGS -I${withval}/incl/cli"
458 fi
459 fi
460 COMPONENTS="$COMPONENTS informix"
461 DBDRIVER_SELECTED="yes"
462fi ])
463
ef0c727b 464AC_ARG_WITH(openssl,
1010cff7
VK
465[AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
466[
467 if test "x$withval" != "xno" ; then
468 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
469 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
470 LDFLAGS="$LDFLAGS -L${withval}/lib"
471 CPPFLAGS="$CPPFLAGS -I${withval}/include"
472 else
473 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
474 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
4d37b0c5 475 CPPFLAGS="$CPPFLAGS -I/opt/openssl/include"
ef0c727b 476 fi
1010cff7 477 fi
1010cff7 478])
ef0c727b 479
096e561b
VK
480AC_ARG_WITH(bundled-openssl,
481[AS_HELP_STRING(--with-bundled-openssl,use bundled OpenSSL libraries with product-specific prefix)],
482[
483 OPENSSL_LIBSSL="nxssl"
484 OPENSSL_LIBCRYPTO="nxcrypto"
485])
486
b5e5849b
VK
487AC_ARG_WITH(jemalloc,
488[AS_HELP_STRING(--with-jemalloc,specify libjemalloc location)],
489[
490 if test "x$withval" != "xno" ; then
491 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
492 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
493 LDFLAGS="$LDFLAGS -L${withval}/lib"
494 CPPFLAGS="$CPPFLAGS -I${withval}/include"
495 INSTALL_LIBPATH="${withval}/lib${INSTALL_LIBPATH:+:}${INSTALL_LIBPATH}"
496 fi
497 fi
498])
499
ef0c727b
VK
500AC_ARG_ENABLE(iconv,
501[AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
3a7ce527 502[
ef0c727b 503 DISABLE_ICONV="yes"
3a7ce527 504])
3a7ce527 505
b8adb0f2
VK
506AC_ARG_ENABLE(ipv6,
507[AS_HELP_STRING(--disable-ipv6,disable IPv6 support)],
508[
509 DISABLE_IPV6="yes"
510])
511
bd96aa53
VK
512AC_ARG_ENABLE(iconv-cache,
513[AS_HELP_STRING([--enable-iconv-cache=@<:@yes/no/auto@:>@],
514[cache iconv descriptors [default=auto]])],,
515[enable_iconv_cache=auto])
516
65834be3
VK
517AC_ARG_ENABLE(readline,
518[AS_HELP_STRING(--disable-readline,do not use libreadline)],
519[
520 DISABLE_READLINE="yes"
521])
522
ef0c727b
VK
523AC_ARG_ENABLE(encryption,
524[AS_HELP_STRING(--disable-encryption,disable encryption support)],
e0760102 525[
ef0c727b 526 DISABLE_ENCRYPTION="yes"
058bf6fc 527 XMPP_SUPPORT="no"
e0760102
VK
528])
529
4050bafb
VK
530AC_ARG_ENABLE(lmsensors,
531[AS_HELP_STRING(--disable-lmsensors,disable lmsensors support)],
532[
533 DISABLE_LMSENSORS="yes"
534])
535
058bf6fc
VK
536AC_ARG_ENABLE(xmpp,
537[AS_HELP_STRING(--disable-xmpp,disable XMPP support)],
538[
539 XMPP_SUPPORT="no"
540])
541
2cfe4482
VK
542AC_ARG_ENABLE(ldap,
543[AS_HELP_STRING(--disable-ldap,disable LDAP support)],
544[
545 LDAP_SUPPORT="no"
546])
547
a67fa146
VK
548AC_ARG_ENABLE(unicode,
549[AS_HELP_STRING(--enable-unicode,enable UNICODE build)],
550[
551 BUILD_UNICODE="yes"
842c22f4 552 CPPFLAGS="$CPPFLAGS -DUNICODE"
76b1d3d8 553 FORCE_INTERNAL_LIBTRE="yes"
ccfe2ba0 554 DISABLE_READLINE="yes"
a67fa146
VK
555])
556
f974a50a
VK
557AC_ARG_ENABLE(debug,
558[AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
559[
560 ENABLE_DEBUG="yes"
561])
562
25ae8377
VK
563AC_ARG_ENABLE(werror,
564[AS_HELP_STRING(--enable-werror,threat all warnings as errors)],
565[
566 ENABLE_WERROR="yes"
567])
568
cc297a70 569AC_ARG_ENABLE(64bit,
e5be5b83 570[AS_HELP_STRING(--disable-64bit,disable 64bit build (force 32bit build on 64bit machine))],
cc297a70
VK
571[
572 FORCE_32BIT_BUILD="yes"
573])
574
ef0c727b
VK
575AC_ARG_WITH(dist,
576[AS_HELP_STRING(--with-dist,for maintainers only)],
87f1fff0 577 DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle db2 informix"
623e2f0e 578 MODULES="appagent jansson libexpat libstrophe libtre zlib libnetxms install sqlite snmp libnxsl libnxmb libnxlp libnxcc db server smsdrv agent libnxmap client nxscript nxcproxy nxlptest tools"
929dd4ff 579 SUBAGENT_DIRS="linux ds18x20 freebsd openbsd minix netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin rpi java ubntlw netsvc db2 tuxedo mongodb ssh vmgr"
c7c6ce77 580 AGENT_DIRS="libnxtux"
623e2f0e 581 SMSDRV_DIRS="kannel nxagent slack text2reach websms"
6fad8870 582 HDLINK_DIRS="jira"
52a2232c 583 PDSDRV_DIRS="rrdtool"
ef0c727b 584 NXCONFIG="nxconfig"
33a10d92 585 TOP_LEVEL_MODULES="include sql images tests"
7dda4453 586 SERVER_INCLUDE="include"
03b96461 587 CONTRIB_MODULES="mibs backgrounds music templates"
d6a7a843 588 CLIENT_COMPONENTS="nxalarm nxevent nxpush nxsms"
ef0c727b
VK
589 SERVER_TOOLS="nxconfig"
590)
591
247f8a6c
AK
592AC_ARG_WITH(rpi-agent,
593[AS_HELP_STRING(--with-rpi-agent,build Raspberry Pi agent)],
594[
595 COMPONENTS="$COMPONENTS raspberrypi"
596])
597
33a10d92
VK
598AC_ARG_WITH(tests,
599[AS_HELP_STRING(--with-tests,build tests)],
600[
601 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES tests"
602])
603
d8ca9c03 604
12313882
VK
605#--------------------------------------------------------------------
606# Set LD_LIBRARY_PATH from LD_RUN_PATH because on some systems
607# LD_RUN_PATH ignored by linker and some tests may fail
608#--------------------------------------------------------------------
609
e5cceced 610export LD_RUN_PATH
12313882
VK
611if test "x$LD_RUN_PATH" != "x"; then
612 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}${LD_RUN_PATH}"
613 export LD_LIBRARY_PATH
614fi
615
616
ef0c727b
VK
617#--------------------------------------------------------------------
618# Validate command line parameters and set various checking options
619#--------------------------------------------------------------------
620
bc9361fd
VK
621check_substr "$COMPONENTS" "snmp"
622if test $? = 0; then
bc9361fd
VK
623 MODULES="$MODULES snmp"
624fi
625
ef0c727b 626check_substr "$COMPONENTS" "static-agent"
1010cff7 627if test $? = 0; then
e528af2b 628 if test "x$COMPONENTS" != "x sqlite snmp static-agent sqlite_drv"; then
971abf4f 629 AC_MSG_ERROR(Static agent and other components are mutually exclusive.)
ef0c727b
VK
630 fi
631 STATIC_BUILD="yes"
632 BUILD_STATIC_AGENT="yes"
d8637bab 633 MODULES="$MODULES appagent libnxlp db agent"
3a6979cf 634 DISABLE_ICONV="yes"
ef0c727b 635 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
c1165d33 636 if test "x$PROPOSED_STATIC_SUBAGENTS" = "xdefault"; then
52056835 637 STATIC_SUBAGENT_LIST="ecs filemgr logwatch ping portcheck ups"
c1165d33
VK
638 else
639 STATIC_SUBAGENT_LIST="$PROPOSED_STATIC_SUBAGENTS"
640 fi
60a1159a 641
52056835 642 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/filemgr/filemgr.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
e8636669 643
60a1159a
VK
644 check_substr "$STATIC_SUBAGENT_LIST" "odbcquery"
645 if test $? = 0; then
646 COMPONENTS="$COMPONENTS odbc"
647 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/odbcquery/odbcquery.la"
648 fi
649
650 check_substr "$STATIC_SUBAGENT_LIST" "oracle"
651 if test $? = 0; then
652 COMPONENTS="$COMPONENTS oracle"
653 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/oracle/oracle.la"
654 fi
655
6afe141e 656 check_substr "$STATIC_SUBAGENT_LIST" "informix"
657 if test $? = 0; then
658 COMPONENTS="$COMPONENTS informix"
659 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/informix/informix.la"
660 fi
661
662 check_substr "$STATIC_SUBAGENT_LIST" "db2"
60a1159a 663 if test $? = 0; then
6afe141e 664 COMPONENTS="$COMPONENTS db2"
665 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/db2/db2.la"
60a1159a
VK
666 fi
667
ef0c727b 668 case "$PLATFORM" in
e8636669 669 Linux)
e58b0f75
VK
670 SUBAGENT_DIRS="linux ds18x20"
671 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/linux/linux.la ../subagents/ds18x20/ds18x20.la"
672 STATIC_SUBAGENT_LIST="linux ds18x20 $STATIC_SUBAGENT_LIST"
e8636669
VK
673 ;;
674 FreeBSD)
675 SUBAGENT_DIRS="freebsd"
c1165d33 676 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/freebsd/freebsd.la"
d0b5a098 677 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669 678 ;;
992ba479
AK
679 OpenBSD)
680 SUBAGENT_DIRS="openbsd"
c1165d33 681 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/openbsd/openbsd.la"
992ba479
AK
682 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
683 ;;
ad0f1ada
VK
684 NetBSD)
685 SUBAGENT_DIRS="netbsd"
c1165d33 686 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/netbsd/netbsd.la"
ad0f1ada
VK
687 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
688 ;;
e8636669
VK
689 SunOS)
690 SUBAGENT_DIRS="sunos"
c1165d33 691 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/sunos/sunos.la"
d0b5a098
VK
692 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
693 ;;
694 AIX)
695 SUBAGENT_DIRS="aix"
c1165d33 696 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/aix/aix.la"
d0b5a098 697 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669 698 ;;
c29360a9
VK
699 HP-UX)
700 SUBAGENT_DIRS="hpux"
c1165d33 701 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/hpux/hpux.la"
c29360a9
VK
702 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
703 ;;
cf52e714
AK
704 Darwin)
705 SUBAGENT_DIRS="darwin"
706 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/darwin/darwin.la"
707 STATIC_SUBAGENT_LIST="darwin $STATIC_SUBAGENT_LIST"
708 ;;
cfcfdd2b
VK
709 Minix)
710 SUBAGENT_DIRS="minix"
711 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/minix/minix.la"
712 STATIC_SUBAGENT_LIST="minix $STATIC_SUBAGENT_LIST"
713 ;;
e8636669
VK
714 *)
715 # unknown
716 ;;
717 esac
ef0c727b 718fi
2b23dc1e 719
ef0c727b 720check_substr "$COMPONENTS" "ipso-agent"
1010cff7 721if test $? = 0; then
fd5a401b 722 if test "x$COMPONENTS" != "x ipso-agent"; then
971abf4f 723 AC_MSG_ERROR(IPSO agent and other components are mutually exclusive.)
ef0c727b
VK
724 fi
725 STATIC_BUILD="yes"
726 BUILD_STATIC_AGENT="yes"
3a6979cf 727 DISABLE_ICONV="yes"
ef0c727b 728 USE_PTH="yes"
d8637bab 729 MODULES="$MODULES appagent libnxlp db agent"
ef8a3c32 730 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -DSQLITE_THREADSAFE=0 -I/usr/local/include"
ef0c727b 731 LDFLAGS="$LDFLAGS -all-static"
971abf4f 732 STATIC_SUBAGENT_LIST="ecs ipso logwatch ping portcheck ups"
ef0c727b 733 SUBAGENT_DIRS="ipso"
c1165d33 734 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/ipso/ipso.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
ef0c727b 735fi
c688d2a7 736
ef0c727b 737check_substr "$COMPONENTS" "agent"
1010cff7 738if test $? = 0; then
ef0c727b 739 BUILD_AGENT="yes"
d8637bab 740 MODULES="$MODULES appagent libnxlp db agent"
1010cff7
VK
741
742 case "$PLATFORM" in
743 Linux)
e58b0f75 744 SUBAGENT_DIRS="linux ds18x20"
1010cff7
VK
745 ;;
746 FreeBSD)
747 SUBAGENT_DIRS="freebsd"
748 ;;
749 OpenBSD)
750 SUBAGENT_DIRS="openbsd"
751 ;;
ad0f1ada
VK
752 NetBSD)
753 SUBAGENT_DIRS="netbsd"
754 ;;
1010cff7
VK
755 SunOS)
756 SUBAGENT_DIRS="sunos"
757 ;;
758 AIX)
759 SUBAGENT_DIRS="aix"
760 ;;
761 HP-UX)
762 SUBAGENT_DIRS="hpux"
cf52e714
AK
763 ;;
764 Darwin)
765 SUBAGENT_DIRS="darwin"
1010cff7 766 ;;
cfcfdd2b
VK
767 Minix)
768 SUBAGENT_DIRS="minix"
769 ;;
1010cff7
VK
770 *)
771 # unknown
772 ;;
773 esac
ef0c727b 774fi
b97191d2 775
94a7996a
VK
776check_substr "$COMPONENTS" "server"
777if test $? = 0; then
778 if test "x$DBDRIVER_SELECTED" != "xyes"; then
779 AC_MSG_ERROR(You must select at least one database driver when building server.)
780 fi
781 BUILD_SERVER="yes"
623e2f0e 782 MODULES="$MODULES libnxmap libnxsl libnxcc server smsdrv nxscript"
94a7996a 783 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
03b96461 784 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds music templates"
623e2f0e 785 SMSDRV_DIRS="$SMSDRV_DIRS nxagent"
94a7996a
VK
786 if test "x$XMPP_SUPPORT" = "xyes"; then
787 MODULES="libstrophe $MODULES"
788 AC_DEFINE(XMPP_SUPPORTED, 1, Define to 1 if XMPP is supported)
789 fi
790fi
791
792check_substr "$COMPONENTS" "client"
793if test $? = 0; then
794 BUILD_CLIENT="yes"
94a7996a
VK
795 MODULES="$MODULES client"
796 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
797fi
798
799check_substr "$COMPONENTS" "client-proxy"
800if test $? = 0; then
801 MODULES="$MODULES nxcproxy"
802fi
803
ef0c727b 804check_substr "$COMPONENTS" "mysql"
1010cff7 805if test $? = 0; then
ef0c727b 806 DB_DRIVERS="$DB_DRIVERS mysql"
b67a9e12 807fi
6619a6b0 808
ef0c727b 809check_substr "$COMPONENTS" "pgsql"
1010cff7 810if test $? = 0; then
ef0c727b
VK
811 DB_DRIVERS="$DB_DRIVERS pgsql"
812fi
e8636669 813
8817f620 814check_substr "$COMPONENTS" "sqlite_drv"
1010cff7 815if test $? = 0; then
ef0c727b 816 DB_DRIVERS="$DB_DRIVERS sqlite"
e8636669
VK
817fi
818
ef0c727b 819check_substr "$COMPONENTS" "odbc"
1010cff7 820if test $? = 0; then
ef0c727b
VK
821 DB_DRIVERS="$DB_DRIVERS odbc"
822fi
823
41b4790d
VK
824check_substr "$COMPONENTS" "oracle"
825if test $? = 0; then
826 DB_DRIVERS="$DB_DRIVERS oracle"
4d1753cd 827 SUBAGENT_DIRS="$SUBAGENT_DIRS oracle"
41b4790d
VK
828fi
829
84277a0f
AK
830check_substr "$COMPONENTS" "db2"
831if test $? = 0; then
832 DB_DRIVERS="$DB_DRIVERS db2"
6afe141e 833 SUBAGENT_DIRS="$SUBAGENT_DIRS db2"
84277a0f
AK
834fi
835
87f1fff0
VK
836check_substr "$COMPONENTS" "informix"
837if test $? = 0; then
838 DB_DRIVERS="$DB_DRIVERS informix"
80e96a82 839 SUBAGENT_DIRS="$SUBAGENT_DIRS informix"
87f1fff0
VK
840fi
841
247f8a6c
AK
842check_substr "$COMPONENTS" "raspberrypi"
843if test $? = 0; then
247f8a6c
AK
844 SUBAGENT_DIRS="$SUBAGENT_DIRS rpi"
845fi
ef0c727b 846
50e4bc8c
VK
847check_substr "$COMPONENTS" "java"
848if test $? = 0; then
ab2c09bb 849 SUBAGENT_DIRS="$SUBAGENT_DIRS java ubntlw"
50e4bc8c
VK
850fi
851
b14c3f22
VK
852check_substr "$COMPONENTS" "tuxedo"
853if test $? = 0; then
c7c6ce77 854 AGENT_DIRS="$AGENT_DIRS libnxtux"
b14c3f22
VK
855 SUBAGENT_DIRS="$SUBAGENT_DIRS tuxedo"
856fi
857
d6235717 858check_substr "$COMPONENTS" "mongodb"
859if test $? = 0; then
860 SUBAGENT_DIRS="$SUBAGENT_DIRS mongodb"
861fi
862
b7c8729b 863check_substr "$COMPONENTS" "vmgr"
864if test $? = 0; then
865 SUBAGENT_DIRS="$SUBAGENT_DIRS vmgr"
866fi
867
b550188f
VK
868check_substr "$COMPONENTS" "sdk"
869if test $? = 0; then
f6f9c0b6
VK
870 if test "x$STATIC_BUILD" = "xyes"; then
871 MODULES="$MODULES appagent libnxmap client libnxmb"
872 else
873 MODULES="$MODULES appagent libnxmap client libnxsl libnxmb libnxlp libnxcc db nxscript smsdrv"
874 fi
b550188f
VK
875fi
876
877
ef0c727b
VK
878#--------------------------------------------------------------------
879# Check for programs
880#--------------------------------------------------------------------
881
882if test "x$PLATFORM" = "xHP-UX"; then
f172d7b7 883 AC_CHECK_PROG([CC], [aCC], [aCC])
e7d9c4ae 884 AC_CHECK_PROG([CCC], [aCC], [aCC])
ef0c727b 885fi
df9812a9 886if test "x$PLATFORM" = "xAIX"; then
f172d7b7 887 AC_CHECK_PROG([CC], [xlc_r], [xlc_r])
df9812a9
VK
888 AC_CHECK_PROG([CCC], [xlC_r], [xlC_r])
889fi
9113e749 890if test "x$PLATFORM" = "xSunOS"; then
f172d7b7 891 AC_CHECK_PROG([CC], [cc], [cc])
9113e749
VK
892 AC_CHECK_PROG([CCC], [CC], [CC])
893fi
ef8a3c32
VK
894if test "x$PLATFORM" = "xMinix"; then
895 AC_CHECK_PROG([CC], [clang], [clang])
896 AC_CHECK_PROG([CCC], [clang++], [clang++])
897fi
f172d7b7 898AC_PROG_CC
ef0c727b
VK
899AC_PROG_CPP
900AC_PROG_CXX
c3cfc039 901if test "x$CXX" = "xg++"; then
753206b5
AK
902 AC_CHECK_PROG([GPLUSPLUS], [g++], [yes], [no])
903 if test "x$GPLUSPLUS" = "xno"; then
c3cfc039
VK
904 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
905 fi
906fi
ef8a3c32
VK
907if test "x$CXX" = "xclang++"; then
908 LIBS="$LIBS -lc++"
909fi
fdf7ec40 910AM_PROG_AS
ef0c727b
VK
911AC_PROG_INSTALL
912AC_PROG_LEX
76154a95 913AC_CHECK_PROGS(YACC,bison byacc,yacc)
ef0c727b
VK
914AC_PROG_LN_S
915
916AC_ARG_VAR(PERL,local path to the perl interpreter)
917perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
918AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
919
920
ef0c727b
VK
921#--------------------------------------------------------------------
922# C/C++ capabilities
923#--------------------------------------------------------------------
924
925AC_C_CONST
926AC_PROG_GCC_TRADITIONAL
1d9cc60e 927AC_C_BIGENDIAN
ef0c727b
VK
928
929
930#--------------------------------------------------------------------
931# Platform-dependent settings
932#--------------------------------------------------------------------
933
934case "$PLATFORM" in
935 AIX)
545bda2d 936 LDFLAGS_PREFIX="-no-undefined -Wl,-brtl $LDFLAGS"
ef0c727b
VK
937 ;;
938 HP-UX)
f0c1ad9c 939 CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_REENTRANT -D_INCLUDE_LONGLONG -D_LARGEFILE64_SOURCE"
ef0c727b 940 if test "x$CXX" = "xaCC"; then
5a64ab96 941 CPPFLAGS="$CPPFLAGS -D_HP_ATOMIC_INLINE"
53c96e2d 942 CFLAGS="$CFLAGS -AC99"
6e872345 943 CXXFLAGS="-mt $CXXFLAGS +W749 +W829 +W4232"
ef0c727b
VK
944 LDFLAGS="$LDFLAGS -mt"
945 fi
6dde8627
VK
946 if test `uname -m` != 'ia64'; then
947 HPUX_HPPA="yes"
948 fi
ef0c727b 949 ;;
75c30ed4 950 SunOS)
b92efe0e 951 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__"
44ca59aa
VK
952 AC_MSG_CHECKING(whether C compiler accepts -O2)
953 OLD_CPPFLAGS="$CPPFLAGS"
954 CPPFLAGS="$CPPFLAGS -O2"
12313882 955 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
44ca59aa
VK
956 [ AC_MSG_RESULT(yes) ],
957 [
958 CPPFLAGS="$OLD_CPPFLAGS"
959 AC_MSG_RESULT(no)
960 ])
75c30ed4 961 ;;
56b2f755 962 Linux)
f47bd4ca 963 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -O2"
56b2f755 964 ;;
d1056954 965 Darwin)
f47bd4ca 966 CPPFLAGS="$CPPFLAGS -Wno-deprecated-declarations -O2"
d1056954 967 ;;
ef8a3c32
VK
968 Minix)
969 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
970 LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
971 USE_PTH="yes"
972 ;;
ef0c727b
VK
973 *)
974 ;;
975esac
976
977
978#--------------------------------------------------------------------
c90d3610 979# C++ compiler tuning:
cc297a70 980# * Disable C++ exceptions and RTTI
779ce551 981# * Turn on 64bit mode on HP-UX/Itanium
cc297a70 982# * Turn on 64bit mode on AIX
d358c73f 983# * Turn on 64bit mode on Solaris
3bc41d67 984# * Disable inconsistent C/C++ linkage warnings for Solaris Studio
ef0c727b
VK
985#--------------------------------------------------------------------
986
5482ef16 987if test "x$ac_compiler_gnu" = "xyes" ; then
9113e749 988 SQLFLAGS="-x c -Wundef"
6e383343 989 CPPFLAGS="$CPPFLAGS -Wformat"
ef0c727b 990
94a82f76
VK
991 AC_MSG_CHECKING(whether C compiler accepts -Wno-unused-result)
992 OLD_CPPFLAGS="$CPPFLAGS"
993 CPPFLAGS="$CPPFLAGS -Wno-unused-result"
994 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
995 [ AC_MSG_RESULT(yes) ],
996 [
997 CPPFLAGS="$OLD_CPPFLAGS"
998 AC_MSG_RESULT(no)
999 ])
1000
5bcda3c0
VK
1001 AC_MSG_CHECKING(whether C compiler accepts -Werror=return-type)
1002 OLD_CPPFLAGS="$CPPFLAGS"
1003 CPPFLAGS="$CPPFLAGS -Werror=return-type"
1004 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1005 [ AC_MSG_RESULT(yes) ],
1006 [
1007 CPPFLAGS="$OLD_CPPFLAGS"
1008 AC_MSG_RESULT(no)
1009 ])
1010
ef0c727b
VK
1011 AC_LANG_PUSH([C++])
1012
1013 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
e6b112bc 1014 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
1015 CXXFLAGS="$CXXFLAGS -fno-rtti"
1016 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1017 [ AC_MSG_RESULT(yes) ],
1018 [
1019 CXXFLAGS="$OLD_CXXFLAGS"
1020 AC_MSG_RESULT(no)
1021 ])
1022
3118008e
VK
1023 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
1024 OLD_CXXFLAGS="$CXXFLAGS"
1025 CXXFLAGS="$CXXFLAGS -fno-exceptions"
1026 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1027 [ AC_MSG_RESULT(yes) ],
1028 [
1029 CXXFLAGS="$OLD_CXXFLAGS"
1030 AC_MSG_RESULT(no)
1031 ])
ef0c727b
VK
1032
1033 AC_LANG_POP([C++])
1034
9b318048
VK
1035 MACHINE=`uname -m`
1036 if test "x$MACHINE" = "xi686" -o "x$MACHINE" = "xi586"; then
1037 AC_MSG_CHECKING(whether C compiler accepts -march=$MACHINE)
1038 OLD_CPPFLAGS="$CPPFLAGS"
1039 CPPFLAGS="$CPPFLAGS -march=$MACHINE"
1040 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1041 [
1042 AC_MSG_RESULT(yes)
1043 ],
1044 [
1045 CPPFLAGS="$OLD_CPPFLAGS"
1046 AC_MSG_RESULT(no)
1047 ])
1048 fi
1049
779ce551 1050 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
1051 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1052 AC_MSG_CHECKING(whether C compiler accepts -milp32)
1053 OLD_CPPFLAGS="$CPPFLAGS"
1054 CPPFLAGS="$CPPFLAGS -milp32"
1055 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1056 [
1057 LDFLAGS="-milp32 $LDFLAGS"
1058 AC_MSG_RESULT(yes)
1059 ],
1060 [
1061 CPPFLAGS="$OLD_CPPFLAGS"
1062 AC_MSG_RESULT(no)
1063 ])
1064 else
1065 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
1066 OLD_CPPFLAGS="$CPPFLAGS"
1067 CPPFLAGS="$CPPFLAGS -mlp64"
1068 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1069 [
1070 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
1071 AC_MSG_RESULT(yes)
1072 ],
1073 [
1074 CPPFLAGS="$OLD_CPPFLAGS"
1075 AC_MSG_RESULT(no)
1076 ])
1077 fi
1078 fi
1079
1080 if test "x$PLATFORM" = "xAIX"; then
1081 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1082 AC_MSG_CHECKING(whether C compiler accepts -maix32)
1083 OLD_CPPFLAGS="$CPPFLAGS"
1084 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 1085 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
1086 [
1087 LDFLAGS="-maix32 $LDFLAGS"
5482ef16
VK
1088 LTINIT_CC="$CC -maix32"
1089 LTINIT_CXX="$CXX -maix32"
1c45282c 1090 OBJECT_MODE=32
cc297a70
VK
1091 AC_MSG_RESULT(yes)
1092 ],
1093 [
1094 CPPFLAGS="$OLD_CPPFLAGS"
1095 AC_MSG_RESULT(no)
1096 ])
1097 else
1098 AC_MSG_CHECKING(whether C compiler accepts -maix64)
1099 OLD_CPPFLAGS="$CPPFLAGS"
1100 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 1101 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
1102 [
1103 LDFLAGS="-maix64 $LDFLAGS"
5482ef16
VK
1104 LTINIT_CC="$CC -maix64"
1105 LTINIT_CXX="$CXX -maix64"
1c45282c 1106 OBJECT_MODE=64
cc297a70
VK
1107 AC_MSG_RESULT(yes)
1108 ],
1109 [
1110 CPPFLAGS="$OLD_CPPFLAGS"
1111 AC_MSG_RESULT(no)
1112 ])
1113 fi
779ce551 1114 fi
d358c73f
VK
1115
1116 if test "x$PLATFORM" = "xSunOS"; then
1117 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1118 AC_MSG_CHECKING(whether C compiler accepts -m32)
1119 OLD_CPPFLAGS="$CPPFLAGS"
1120 CPPFLAGS="$CPPFLAGS -m32"
1121 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1122 [
1123 LDFLAGS="-m32 $LDFLAGS"
e2e3ce85
VK
1124 LTINIT_CC="$CC -m32"
1125 LTINIT_CXX="$CXX -m32"
d358c73f
VK
1126 AC_MSG_RESULT(yes)
1127 ],
1128 [
1129 CPPFLAGS="$OLD_CPPFLAGS"
1130 AC_MSG_RESULT(no)
1131 ])
1132 else
1133 AC_MSG_CHECKING(whether C compiler accepts -m64)
1134 OLD_CPPFLAGS="$CPPFLAGS"
1135 CPPFLAGS="$CPPFLAGS -m64"
1136 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1137 [
1138 LDFLAGS="-m64 $LDFLAGS"
e2e3ce85
VK
1139 LTINIT_CC="$CC -m64"
1140 LTINIT_CXX="$CXX -m64"
d358c73f
VK
1141 AC_MSG_RESULT(yes)
1142 ],
1143 [
1144 CPPFLAGS="$OLD_CPPFLAGS"
1145 AC_MSG_RESULT(no)
1146 ])
1147 fi
1148 fi
779ce551 1149
3ac3594a
VK
1150
1151 if test "x$PLATFORM" = "xLinux"; then
1152 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1153 AC_MSG_CHECKING(whether C compiler accepts -m32)
1154 OLD_CPPFLAGS="$CPPFLAGS"
1155 CPPFLAGS="$CPPFLAGS -m32"
1156 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1157 [
1158 LDFLAGS="-m32 $LDFLAGS"
e2e3ce85
VK
1159 LTINIT_CC="$CC -m32"
1160 LTINIT_CXX="$CXX -m32"
3ac3594a
VK
1161 AC_MSG_RESULT(yes)
1162 ],
1163 [
1164 CPPFLAGS="$OLD_CPPFLAGS"
1165 AC_MSG_RESULT(no)
1166 ])
1167 fi
1168 fi
1169
ce5592b2
VK
1170 if test "x$ENABLE_DEBUG" = "xyes"; then
1171 CPPFLAGS="$CPPFLAGS -ggdb3"
1172 fi
ef0c727b
VK
1173fi
1174
cfd95c74
VK
1175if test "x$CXX" = "xaCC" ; then
1176 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
451b735a
VK
1177 if test "x$HPUX_HPPA" = "xyes"; then
1178 ARCHFLAG="+DA1.1"
1179 else
1180 ARCHFLAG="+DD32"
1181 fi
1182 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
4d37b0c5 1183 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1184 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1185 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1186 [
451b735a
VK
1187 LDFLAGS="$ARCHFLAG $LDFLAGS"
1188 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1189 AC_MSG_RESULT(yes)
1190 ],
1191 [
4d37b0c5
VK
1192 CPPFLAGS="$OLD_CPPFLAGS"
1193 AC_MSG_RESULT(no)
cfd95c74 1194 ])
4d37b0c5 1195 else
451b735a
VK
1196 if test "x$HPUX_HPPA" = "xyes"; then
1197 ARCHFLAG="+DA2.0W"
1198 else
1199 ARCHFLAG="+DD64"
1200 fi
1201 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
cfd95c74 1202 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1203 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1204 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1205 [
451b735a
VK
1206 LDFLAGS="$ARCHFLAG $LDFLAGS"
1207 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1208 AC_MSG_RESULT(yes)
1209 ],
1210 [
1211 CPPFLAGS="$OLD_CPPFLAGS"
1212 AC_MSG_RESULT(no)
1213 ])
4d37b0c5 1214 fi
ef0c727b
VK
1215fi
1216
df9812a9 1217if test "x$CXX" = "xxlC_r" ; then
d1cb61cf 1218 SQLFLAGS="-qnoppline"
9b99f1c0
VK
1219 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1220 AC_MSG_CHECKING(whether C compiler accepts -q32)
1221 OLD_CPPFLAGS="$CPPFLAGS"
1222 CPPFLAGS="-q32 $CPPFLAGS"
1223 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1224 [
1225 LDFLAGS="-q32 $LDFLAGS"
df9812a9 1226 OBJECT_MODE=32
9b99f1c0
VK
1227 AC_MSG_RESULT(yes)
1228 ],
1229 [
1230 CPPFLAGS="$OLD_CPPFLAGS"
1231 AC_MSG_RESULT(no)
1232 ])
1233 else
1234 AC_MSG_CHECKING(whether C compiler accepts -q64)
1235 OLD_CPPFLAGS="$CPPFLAGS"
1236 CPPFLAGS="-q64 $CPPFLAGS"
1237 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1238 [
1239 LDFLAGS="-q64 $LDFLAGS"
df9812a9 1240 OBJECT_MODE=64
9b99f1c0
VK
1241 AC_MSG_RESULT(yes)
1242 ],
1243 [
1244 CPPFLAGS="$OLD_CPPFLAGS"
1245 AC_MSG_RESULT(no)
1246 ])
1247 fi
1248fi
1249
9113e749
VK
1250if test "x$CXX" = "xCC" ; then
1251 SQLFLAGS="-Qn"
1252 CPPFLAGS="$CPPFLAGS -mt"
3bc41d67 1253 CXXFLAGS="$CXXFLAGS -erroff=badargtype2w,wbadinit"
9113e749
VK
1254
1255 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1256 AC_MSG_CHECKING(whether C compiler accepts -m32)
f5e5296e
VK
1257 count=`$CC -flags | grep '^\-m32 ' | wc -l`
1258 if test $count -eq 1; then
1259 AC_MSG_RESULT(yes)
1260 CPPFLAGS="$CPPFLAGS -m32"
1261 LDFLAGS="-m32 $LDFLAGS"
1262 else
1263 AC_MSG_RESULT(no)
1264 fi
9113e749 1265 else
c3900dbb 1266 TEST_XARCH="no"
9113e749 1267 AC_MSG_CHECKING(whether C compiler accepts -m64)
f5e5296e
VK
1268 count=`$CC -flags | grep '^\-m64 ' | wc -l`
1269 if test $count -eq 1; then
1270 AC_MSG_RESULT(yes)
1271 CPPFLAGS="$CPPFLAGS -m64"
1272 LDFLAGS="-m64 $LDFLAGS"
1273 else
1274 AC_MSG_RESULT(no)
1275 TEST_XARCH="yes"
1276 fi
c3900dbb
VK
1277 if test "x$TEST_XARCH" = "xyes"; then
1278 if test "x$CPUTYPE" = "xsparc"; then
1279 ARCH="-xarch=v9"
1280 else
1281 ARCH="-xarch=amd64"
1282 fi
1283 AC_MSG_CHECKING(whether C compiler accepts $ARCH)
1284 OLD_CPPFLAGS="$CPPFLAGS"
1285 CPPFLAGS="$CPPFLAGS $ARCH"
1286 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1287 [
1288 LDFLAGS="$ARCH $LDFLAGS"
1289 AC_MSG_RESULT(yes)
1290 ],
1291 [
1292 CPPFLAGS="$OLD_CPPFLAGS"
1293 AC_MSG_RESULT(no)
1294 ])
1295 fi
9113e749
VK
1296 fi
1297fi
1298
edb018d7
VK
1299
1300#--------------------------------------------------------------------
1301# Initialize libtool
1302#--------------------------------------------------------------------
1303
1304if test "x$STATIC_BUILD" = "xyes"; then
1305 enable_shared=no
1306 enable_static=yes
1307else
1308 enable_shared=yes
e99eba92
VK
1309 if test "x$BUILD_SDK" = "xyes"; then
1310 enable_static=yes
1311 else
1312 enable_static=no
1313 fi
edb018d7 1314fi
1ef5e57a
VK
1315
1316if test "x$LTINIT_CC" != "x"; then
1317 SAVED_CC="$CC"
1318 CC="$LTINIT_CC"
1319fi
1320if test "x$LTINIT_CXX" != "x"; then
1321 SAVED_CXX="$CXX"
1322 CXX="$LTINIT_CXX"
1323fi
1324
ff12e2f1 1325LT_PREREQ([2.2])
1ef5e57a
VK
1326LT_INIT([dlopen])
1327
1328if test "x$SAVED_CC" != "x"; then
1329 CC="$SAVED_CC"
1330fi
1331if test "x$SAVED_CXX" != "x"; then
1332 CXX="$SAVED_CXX"
1333fi
edb018d7
VK
1334
1335
cfd95c74
VK
1336#--------------------------------------------------------------------
1337# Additional include and library directories
1338#--------------------------------------------------------------------
ef0c727b 1339
cfd95c74
VK
1340if test "x$CXX" != "xaCC"; then
1341 if test -d /usr/local/include; then
5482ef16 1342 if test "x$ac_compiler_gnu" = "xyes"; then
cfd95c74
VK
1343 AC_MSG_CHECKING(whether -I/usr/local/include needed)
1344 OLD_CPPFLAGS="$CPPFLAGS"
1345 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
2adc2d49 1346 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
cfd95c74
VK
1347 [
1348 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
1349 AC_MSG_RESULT(yes)
1350 ],
1351 [
1352 CPPFLAGS="$OLD_CPPFLAGS"
1353 AC_MSG_RESULT(no)
1354 ]
1355 )
1356 else
1357 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1358 fi
1359 fi
1360
1361 if test -d /usr/kerberos/include; then
1362 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1363 fi
ef0c727b 1364
cfd95c74
VK
1365 if test -d /usr/local/lib; then
1366 LDFLAGS="$LDFLAGS -L/usr/local/lib"
1367 fi
1368fi
ef0c727b 1369
de4c0511
VK
1370
1371#--------------------------------------------------------------------
1372# Check for additional system libraries
1373#--------------------------------------------------------------------
1374
1375AC_CHECK_LIB(xnet, accept)
1376AC_CHECK_LIB(socket, if_nameindex)
1377AC_CHECK_LIB(dl, dlopen)
1378AC_CHECK_LIB(kstat, kstat_open)
1379
1380# sockets/resolver
1381if test "$BUILD_SERVER-$XMPP_SUPPORT" = "yes-yes"; then
1382 AC_CHECK_HEADERS([arpa/nameser_compat.h])
1383 AC_CHECK_FUNC(res_query, , [AC_CHECK_LIB(resolv, res_query, [], [AC_CHECK_LIB(resolv, __res_query)])])
1384fi
1385AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1386AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1387AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1388
1389if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1390 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1391fi
1392
1393if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1394 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1395 LIBS="-lnsl -lsocket $LIBS"
1396 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1397 if test "$my_ac_link_result" = "no" ; then
1398 AC_MSG_RESULT([failure])
1399 AC_MSG_ERROR([unable to use gethostbyname()])
1400 else
1401 AC_MSG_RESULT([success])
1402 fi
1403fi
1404
1405
ef0c727b
VK
1406#--------------------------------------------------------------------
1407# Check for threads library - either POSIX or GNU
1408#--------------------------------------------------------------------
1409
1410if test "x$USE_PTH" = "xyes"; then
1411 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
ef8a3c32
VK
1412 CPPFLAGS="$CPPFLAGS -D_USE_GNU_PTH"
1413 LIBS="$LIBS -lpth"
ef0c727b
VK
1414else
1415 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
1416
1417 if test "x$CXX" = "xaCC"; then
1418 PTHREAD_LIBS=""
1419 else
1420 PTHREAD_LIBS="error"
1421 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
1422 AC_EGREP_CPP(yes,
1423 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
1424 yes
1425 #endif
1426 ], AC_MSG_RESULT(yes)
fecf6a2b 1427 PTHREAD_LIBS="-pthread",
ef0c727b
VK
1428 AC_MSG_RESULT(no))
1429 if test "x$PTHREAD_LIBS" = "xerror"; then
1430 AC_CHECK_LIB(pthread, pthread_attr_init,
1431 PTHREAD_LIBS="-lpthread")
1432 fi
f725c1b7 1433 # On HP-UX (at least 11.00) pthread library contains
b041c587 1434 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 1435 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 1436 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
1437 PTHREAD_LIBS="-lpthread")
1438 fi
ef0c727b
VK
1439 if test "x$PTHREAD_LIBS" = "xerror"; then
1440 AC_CHECK_LIB(pthreads, pthread_attr_init,
1441 PTHREAD_LIBS="-lpthreads")
1442 fi
1443 if test "x$PTHREAD_LIBS" = "xerror"; then
1444 AC_CHECK_FUNC(pthread_attr_init,
1445 PTHREAD_LIBS="")
1446 fi
1447 fi
1448
1449 if test "x$PTHREAD_LIBS" = "xerror"; then
1450 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
1451 fi
8d131dda 1452 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
1453
1454 # Extensions to posix threads
1455 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 1456#include <pthread.h>
ef0c727b
VK
1457 ])
1458 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
1459
1460 # Check for recursive mutexes
39086394
VK
1461 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
1462 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
1463#include <pthread.h>
1464#if HAVE_PTHREAD_NP_H
1465#include <pthread_np.h>
1466#endif
ef0c727b
VK
1467 ])
1468
1469 # Check for read/write locks
1470 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
1471 # additional defines
1472 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
1473 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
1474 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
afd0c386
VK
1475 [AC_COMPILE_IFELSE([
1476 AC_LANG_PROGRAM([
9c29f76e
VK
1477#include <sys/types.h>
1478#include <pthread.h>
afd0c386
VK
1479 ],
1480 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b 1481 ac_cv_struct_pthread_rw=yes, [
afd0c386
VK
1482 AC_COMPILE_IFELSE([
1483 AC_LANG_PROGRAM([
9c29f76e
VK
1484#define _XOPEN_SOURCE 500
1485#include <sys/types.h>
1486#include <pthread.h>
afd0c386
VK
1487 ],
1488 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b
VK
1489 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
1490 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1491 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
1492 fi
1493 ])])
1494 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1495 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
1496 fi
1497 fi
1498
1499fi
1500
1501
1502#--------------------------------------------------------------------
1503# Checks for OpenSSL
1504#--------------------------------------------------------------------
1505
1506if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
096e561b 1507 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, RSA_new,
ef0c727b 1508 [
2cfe4482 1509 AC_DEFINE(WITH_OPENSSL, 1, Define to 1 if you have OpenSSL library and headers)
096e561b 1510 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_aes_256_cbc,
e0a77f08 1511 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
096e561b 1512 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_bf_cbc,
e0a77f08 1513 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
096e561b 1514 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_idea_cbc,
e0a77f08 1515 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
096e561b 1516 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_des_ede3_cbc,
e0a77f08 1517 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
e0a77f08
VK
1518 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1519 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
a4c97619 1520 LIBS="$LIBS -l$OPENSSL_LIBSSL -l$OPENSSL_LIBCRYPTO"
e0a77f08 1521 else
a4c97619 1522 LIBS="$LIBS -l$OPENSSL_LIBSSL -l$OPENSSL_LIBCRYPTO"
e0a77f08
VK
1523 fi
1524 else
096e561b 1525 AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO does not provide any suitable encryption algorithm)
e0a77f08 1526 fi
ef0c727b
VK
1527 ],
1528 [
096e561b 1529 AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO is required for encryption support)
ef0c727b
VK
1530 ])
1531fi
1532
1533
0322eed7
VK
1534#--------------------------------------------------------------------
1535# Checks for header files
1536#--------------------------------------------------------------------
1537
8d4bb054 1538AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h])
2e98cdb4 1539AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
e9c8eb1d 1540AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h net/nh.h sys/socket.h])
0322eed7
VK
1541AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1542AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
c1099678 1543AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h locale.h])
df9812a9 1544AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
5962498b 1545AC_CHECK_HEADERS([grp.h pwd.h malloc.h])
f09c2d05 1546AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1547[[#ifdef HAVE_SYS_TYPES_H
1548# include <sys/types.h>
1549#endif
1550#ifdef HAVE_SYS_TIME_H
1551# include <sys/time.h>
1552#endif
1553#ifdef HAVE_SYS_SOCKET_H
1554# include <sys/socket.h>
1555#endif
1556]])
1557
1558
8d4bb054
VK
1559#--------------------------------------------------------------------
1560# Checks for alloca
1561#--------------------------------------------------------------------
1562
1563AC_CHECK_HEADERS([alloca.h])
1564AC_MSG_CHECKING(for alloca)
1565AC_LANG_PUSH([C++])
1566AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1567#if HAVE_STDLIB_H
1568#include <stdlib.h>
1569#endif
1570#if HAVE_MALLOC_H
1571#include <malloc.h>
1572#endif
1573#if HAVE_ALLOCA_H
1574#include <alloca.h>
1575#endif
1576]],[[
1577 char *p = (char *)alloca(256);
1578 return (p != NULL) ? 0 : 1;
1579]])
1580],[
1581 AC_MSG_RESULT(yes)
1582 AC_DEFINE(HAVE_ALLOCA,1,Define to 1 if alloca function is available)
1583],[
1584 AC_MSG_RESULT(no)
1585 AC_DEFINE(HAVE_ALLOCA,0,Define to 1 if alloca function is available)
1586])
1587AC_LANG_POP([C++])
1588
1589
b8adb0f2
VK
1590#--------------------------------------------------------------------
1591# Checks for IPv6 support
1592#--------------------------------------------------------------------
1593
1594if test "x$DISABLE_IPV6" != "xyes"; then
1595 AC_CHECK_DECL(AF_INET6,,,[
1596#if HAVE_NETINET_IN_H
1597#include <netinet/in.h>
1598#endif
1599 ])
1600 if test "x$ac_cv_have_decl_AF_INET6" = "xyes"; then
1601 AC_CHECK_TYPE(struct sockaddr_in6, [
1602 AC_DEFINE(WITH_IPV6, 1, Define to have IPv6 support)
1603 IPV6_SUPPORT="yes"
1604 ],,[
1605#if HAVE_NETINET_IN_H
1606#include <netinet/in.h>
1607#endif
1608 ])
1609 fi
1610fi
1611
ef0c727b
VK
1612#--------------------------------------------------------------------
1613# Checks for other libs.
1614#--------------------------------------------------------------------
d16cf8a5 1615
e0760102 1616if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa 1617 AC_CHECK_LIB(termcap, tgetstr, [SERVER_LIBS="$SERVER_LIBS -ltermcap"], [AC_CHECK_LIB(ncurses, tgetstr, [SERVER_LIBS="$SERVER_LIBS -lncurses"], AC_CHECK_LIB(curses, tgetstr, [SERVER_LIBS="$SERVER_LIBS -lcurses"]))])
65834be3
VK
1618 if test "x$DISABLE_READLINE" = "xno"; then
1619 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
7c48e2aa 1620
0a70c186
VK
1621 SAVED_LIBS="$LIBS"
1622 LIBS="$LIBS $SERVER_LIBS"
0322eed7 1623
0a70c186 1624 AC_CHECK_FUNCS([readline])
0322eed7 1625
0a70c186
VK
1626 # Check if passing rl_insert to rl_bind_key needs cast
1627 if test "$ac_cv_func_readline" = "yes"; then
1628 AC_LANG_PUSH([C++])
1629
1630 AC_MSG_CHECKING(for rl_insert cast)
0322eed7 1631
afd0c386 1632 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1633 [
1634#include <stdio.h>
1635#include <readline/readline.h>
0a70c186 1636 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7 1637 [
0a70c186
VK
1638 AC_MSG_RESULT((Function *))
1639 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1640 ],[
1641 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1642 [
1643#include <stdio.h>
1644#include <readline/readline.h>
1645 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ])],
1646 [
1647 AC_MSG_RESULT((rl_command_func_t *))
1648 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1649 ],[
1650 AC_MSG_RESULT(not needed)
1651 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1652 ]
1653 )
0322eed7
VK
1654 ]
1655 )
0322eed7 1656
0a70c186
VK
1657 AC_LANG_POP([C++])
1658 fi
1659 LIBS="$SAVED_LIBS"
0322eed7 1660 fi
e0760102
VK
1661fi
1662
3d2bc3ae
VK
1663check_substr "$COMPONENTS" "sqlite"
1664if test $? = 0; then
1665 if test "x$FORCE_INTERNAL_SQLITE" = "xyes"; then
1666 HAVE_SQLITE=no
1667 else
1668 OLD_LIBS="$LIBS"
1669 HAVE_SQLITE=yes
1670 AC_CHECK_HEADER(sqlite3.h,,HAVE_SQLITE=no)
1671 if test "x$HAVE_SQLITE" = "xyes"; then
1672 AC_CHECK_LIB(sqlite3, sqlite3_initialize, [], [ HAVE_SQLITE=no ])
1673 fi
1674 if test "x$HAVE_SQLITE" = "xyes"; then
b536ca1b
VK
1675 if test "x$cross_compiling" = "xyes"; then
1676 AC_MSG_WARN([Cross-compiling mode is active, assuming libsqlite3 is thread-safe])
1677 else
1678 AC_MSG_CHECKING(if libsqlite3 is thread-safe)
1679 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1680#include <sqlite3.h>
1681 ]],[[
1682 return sqlite3_threadsafe() ? 0 : 1;
1683 ]])
1684 ],[
1685 AC_MSG_RESULT(yes)
1686 ],[
1687 AC_MSG_RESULT(no)
1688 HAVE_SQLITE=no
1689 ])
1690 fi
3d2bc3ae
VK
1691 fi
1692 LIBS="$OLD_LIBS"
1693 fi
1694 if test "x$HAVE_SQLITE" = "xno"; then
1695 MODULES="sqlite $MODULES"
1696 fi
1697fi
1698
f1b8f11c
VK
1699if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1700 HAVE_ZLIB=no
1701else
1702 HAVE_ZLIB=yes
1703 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1704 if test "x$HAVE_ZLIB" = "xyes"; then
1705 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1fd41bcd 1706 fi
ef0c727b 1707fi
f1b8f11c
VK
1708if test "x$HAVE_ZLIB" = "xno"; then
1709 MODULES="zlib $MODULES"
1710fi
ef0c727b 1711
467c489f
VK
1712if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1713 HAVE_LIBEXPAT=no
1714else
1715 HAVE_LIBEXPAT=yes
1716 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1717 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1718fi
80ce37ac
VK
1719if test "x$HAVE_LIBEXPAT" = "xno"; then
1720 MODULES="libexpat $MODULES"
1bb6b449 1721fi
ef0c727b 1722
17b35ccc
VK
1723if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1724 HAVE_LIBTRE=no
1725else
1726 HAVE_LIBTRE=yes
1727 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1728 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1729fi
1730if test "x$HAVE_LIBTRE" = "xno"; then
1731 MODULES="libtre $MODULES"
1732 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1733
720c23d0
VK
1734 tre_version_1='0'
1735 tre_version_2='8'
1736 tre_version_3='0'
a67fa146
VK
1737 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1738 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1739 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1740 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1741 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1742 AC_SUBST(TRE_VERSION, $tre_version)
1743
1744 AC_DEFINE(TRE_REGEX_T_FIELD,value,[Define to a field in the regex_t struct where TRE should store a pointer to the internal tre_tnfa_t structure])
1745 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1746fi
ef0c727b 1747
f5393033
VK
1748if test "x$FORCE_INTERNAL_JANSSON" = "xyes"; then
1749 HAVE_JANSSON=no
1750else
1751 HAVE_JANSSON=yes
1752 AC_CHECK_HEADER(jansson.h,,HAVE_JANSSON=no)
1753 AC_CHECK_LIB(jansson, json_object, [ HAVE_JANSSON=yes ], [ HAVE_JANSSON=no ])
1754fi
1755if test "x$HAVE_JANSSON" = "xno"; then
1756 MODULES="jansson $MODULES"
1757fi
1758
4050bafb
VK
1759if test "x$DISABLE_LMSENSORS" = "xno"; then
1760 HAVE_LMSENSORS=yes
1761 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1762 if test "x$HAVE_LMSENSORS" = "xyes"; then
1763 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1764 fi
1765 if test "x$HAVE_LMSENSORS" = "xyes"; then
1766 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1767 fi
38bfa5da
AK
1768fi
1769
0a4194c2
AK
1770AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
1771if test "x$HAVE_LIBCURL" = "xyes"; then
2368dc85
VK
1772 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
1773 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
1774#ifdef HAVE_CURL_CURL_H
1775#include <curl/curl.h>
1776#endif
1777])
0a4194c2 1778fi
d9177dd1 1779
0a4194c2 1780if test "x$HAVE_LIBCURL" = "xyes"; then
c80c69bd 1781 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
50638b08 1782 SMSDRV_DIRS="$SMSDRV_DIRS kannel slack text2reach websms"
6fad8870 1783 HDLINK_DIRS="$HDLINK_DIRS jira"
3bc41d67 1784 AC_DEFINE(HAVE_LIBCURL, 1, Define to 1 if libcurl is available)
0a4194c2
AK
1785fi
1786
12acf3d3
VK
1787AC_CHECK_HEADER(libssh/libssh.h,HAVE_LIBSSH=yes,HAVE_LIBSSH=no)
1788if test "x$HAVE_LIBSSH" = "xyes"; then
1789 AC_CHECK_LIB(ssh, ssh_version, [ HAVE_LIBSSH=yes ], [ HAVE_LIBSSH=no ])
1790fi
1791
1792if test "x$HAVE_LIBSSH" = "xyes"; then
1793 SUBAGENT_DIRS="$SUBAGENT_DIRS ssh"
1794 AC_DEFINE(HAVE_LIBSSH, 1, Define to 1 if libssh is available)
1795fi
1796
2cfe4482
VK
1797if test "x$LDAP_SUPPORT" = "xyes"; then
1798 AC_CHECK_HEADER(ldap.h,HAVE_LDAP=yes,HAVE_LDAP=no)
1799 if test "x$HAVE_LDAP" = "xyes"; then
1800 AC_CHECK_LIB(ldap, ldap_init, [ HAVE_LDAP=yes ], [ HAVE_LDAP=no ])
e8ef7fe1 1801 if test "x$HAVE_LDAP" = "xyes"; then
a0008bce 1802 AC_CHECK_LIB(lber, ber_init, [ SERVER_LIBS="-llber $SERVER_LIBS" ])
e8ef7fe1 1803 fi
2cfe4482 1804 fi
d9177dd1 1805 if test "x$HAVE_LDAP" = "xyes"; then
1806 SERVER_LIBS="-lldap $SERVER_LIBS"
2cfe4482 1807 AC_DEFINE(WITH_LDAP, 1, Define to 1 if you have LDAP libraries and headers)
d95c3dad
A
1808 AC_CHECK_HEADERS([ldap_ssl.h],,,
1809 [
1810#include <ldap.h>
a164b767 1811 ])
d95c3dad
A
1812 AC_CHECK_TYPES([ber_int_t],,,
1813 [
1814#include <ldap.h>
1815#if HAVE_LDAP_SSL_H
1816#include <ldap_ssl.h>
1817#endif
daa828ee 1818 ])
d95c3dad
A
1819
1820 OLD_LIBS="$LIBS"
1821 LIBS="$LIBS -lldap"
1822 AC_CHECK_FUNCS([ldap_initialize ldapssl_init])
1823 AC_CHECK_FUNCS([ldap_control_create ldap_create_control nsldapi_build_control])
1824 AC_CHECK_FUNCS([ldap_create_page_control ldap_parse_page_control])
1825 LIBS="$OLD_LIBS"
1826
1827 AC_CHECK_DECLS([nsldapi_build_control],,,
1828 [
1829#include <ldap.h>
1830#if HAVE_LDAP_SSL_H
1831#include <ldap_ssl.h>
1832#endif
b00236dd 1833 ])
d9177dd1 1834 fi
2cfe4482 1835 LDAP_SUPPORT="$HAVE_LDAP"
d9177dd1 1836fi
1837
ef0c727b
VK
1838#--------------------------------------------------------------------
1839# Checks for data types
1840#--------------------------------------------------------------------
1841
d16cf8a5
AK
1842AC_CHECK_SIZEOF(short)
1843AC_CHECK_SIZEOF(int)
1844AC_CHECK_SIZEOF(long)
1845AC_CHECK_SIZEOF(long long)
1846
1847AC_TYPE_PID_T
d16cf8a5
AK
1848AC_TYPE_SIZE_T
1849AC_STRUCT_TIMEZONE
1850
3071f10a 1851AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1852AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1853#if HAVE_SYS_TYPES_H
1854#include <sys/types.h>
1855#endif
1856#if HAVE_SYS_SOCKET_H
1857#include <sys/socket.h>
1858#endif
1859])
e0293f7f
VK
1860AC_CHECK_TYPES([struct stat64],,,[
1861#if HAVE_SYS_STAT_H
1862#include <sys/stat.h>
1863#endif
1864])
521d90e7 1865
e25cadc9 1866
ef0c727b
VK
1867#--------------------------------------------------------------------
1868# Checks for functions
1869#--------------------------------------------------------------------
d16cf8a5
AK
1870
1871AC_FUNC_ERROR_AT_LINE
d16cf8a5 1872AC_FUNC_MEMCMP
d16cf8a5
AK
1873AC_FUNC_SELECT_ARGTYPES
1874AC_FUNC_STRFTIME
1875AC_FUNC_STRTOD
1876AC_FUNC_VPRINTF
1877
80ce37ac 1878AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
fdb710a7 1879AC_CHECK_FUNCS([strrchr strlwr strtok_r strtol strtoul strtoll strtoull setlocale])
467e30e1 1880AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1881AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
ecdf8898 1882AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r getaddrinfo])
5962498b 1883AC_CHECK_FUNCS([itoa _itoa isatty getgrnam getpwnam malloc_info malloc_trim])
aa24418a 1884
9757ca46 1885AC_CHECK_DECLS([nanosleep, daemon, strerror])
be6467e9 1886
6f95ef89
VK
1887# Do not use inet_pton on Solaris as it has binary compatibility problems
1888if test "$PLATFORM" != "SunOS"; then
1889 AC_CHECK_FUNCS([inet_pton])
1890fi
1891
b0823d06
VK
1892# Check if strerror_r is POSIX-compliant
1893if test "$ac_cv_func_strerror_r" = "yes"; then
1894 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1895 AC_LANG_PUSH([C++])
1896 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1897#if HAVE_STRING_H
1898#include <string.h>
1899#endif
1900#if HAVE_ERRNO_H
1901#include <errno.h>
1902#endif
b0823d06 1903 ]],[[
7f9423af
VK
1904 int e;
1905 char buffer[256];
1906 e = strerror_r(1, buffer, 256);
1907 return e;
b0823d06
VK
1908 ]])
1909 ],[
1910 AC_MSG_RESULT(yes)
1911 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1912 ],[
1913 AC_MSG_RESULT(no)
1914 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1915 ])
1916 AC_LANG_POP([C++])
1917fi
1918
be6467e9
VK
1919# Check if struct tm has tm_gmtoff member
1920AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1921AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1922#if HAVE_TIME_H
1923#include <time.h>
1924#endif
1925#if HAVE_SYS_TIME_H
1926#include <sys/time.h>
1927#endif
1928]],[[
be6467e9
VK
1929 struct tm t;
1930 return t.tm_gmtoff;
be6467e9
VK
1931]])
1932],[
1933AC_MSG_RESULT(yes)
1934AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1935],[
1936AC_MSG_RESULT(no)
1937])
d16cf8a5 1938
f91feddc 1939AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1940AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1941
c6491611
VK
1942# asprintf, scprintf, etc.
1943AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1944AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
342a701d 1945AC_CHECK_FUNCS([snprintf vsnprintf])
c6491611
VK
1946
1947AC_MSG_CHECKING(whether snprintf returns required buffer size)
1948AC_RUN_IFELSE(
1949 [AC_LANG_PROGRAM([
1950#include <stdio.h>
1951#include <string.h>
1952 ], [
1953 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1954 ])
1955 ],
1956 [ AC_MSG_RESULT(yes)
1957 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1958 ],
1959 [ AC_MSG_RESULT(no) ],
1960 [ AC_MSG_RESULT(no) ]
1961)
1962
2f64a076
VK
1963AC_MSG_CHECKING(whether free correctly handles NULL pointer)
1964AC_RUN_IFELSE(
1965 [AC_LANG_PROGRAM([
1966#include <stdlib.h>
1967 ], [
1968 free(NULL);
1969 return 0;
1970 ])
1971 ],
1972 [ AC_MSG_RESULT(yes)
1973 AC_DEFINE(FREE_IS_NULL_SAFE, 1, Define to 1 if free corectly handles NULL pointer)
1974 ],
1975 [ AC_MSG_RESULT(no) ],
1976 [ AC_MSG_RESULT(no) ]
1977)
1978
c6491611 1979
ef0c727b
VK
1980#--------------------------------------------------------------------
1981# Checks for macros and definitions
1982#--------------------------------------------------------------------
dff54fed 1983
ef0c727b
VK
1984AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1985#ifdef HAVE_SYS_TYPES_H
99e50bb7 1986#include <sys/types.h>
ef0c727b
VK
1987#endif
1988#if HAVE_BYTESWAP_H
1989#include <byteswap.h>
1990#endif
1991#if HAVE_NETINET_IN_H
1992#include <netinet/in.h>
1993#endif
1994#if HAVE_NET_NH_H
1995#include <net/nh.h>
1996#endif
1997])
aa24418a
VK
1998AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1999#ifdef HAVE_UNISTD_H
2000#include <unistd.h>
2001#endif
2002#ifdef HAVE_DLFCN_H
2003#include <dlfcn.h>
2004#endif
2005])
ce7565e7
VK
2006AC_CHECK_DECLS([va_copy, __va_copy],,,[
2007#ifdef HAVE_UNISTD_H
2008#include <unistd.h>
2009#endif
2010#ifdef HAVE_STDARG_H
2011#include <stdarg.h>
2012#endif
2013#ifdef HAVE_STDLIB_H
2014#include <stdlib.h>
2015#endif
2016])
dff54fed 2017
dff54fed 2018
df9812a9
VK
2019#--------------------------------------------------------------------
2020# getopt
2021#--------------------------------------------------------------------
2022
2023if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
2024 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
2025else
2026 AC_CHECK_HEADERS([getopt.h])
2027 AC_CHECK_LIB(gnugetopt, getopt_long)
2028 AC_CHECK_DECLS([getopt_long],,,[
2029#if HAVE_GETOPT_H
2030#include <getopt.h>
2031#endif
2032 ])
2033fi
2034
2035
671651a1
VK
2036#--------------------------------------------------------------------
2037# Linux specific checks
2038#--------------------------------------------------------------------
2039
2040if test "x$PLATFORM" = "xLinux"; then
2041 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
2042 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
2043#if HAVE_SYS_REBOOT_H
2044#include <sys/reboot.h>
2045#endif
2046 ])
2047 AC_CHECK_FUNCS([reboot],,,[
2048#if HAVE_SYS_REBOOT_H
2049#include <sys/reboot.h>
2050#endif
2051 ])
f92a016a
VK
2052
2053 AC_CHECK_HEADERS([jemalloc/jemalloc.h],
2054 [
2055 AC_CHECK_LIB(jemalloc, malloc,
2056 [
2057 WITH_JEMALLOC="yes"
2058 AC_DEFINE(WITH_JEMALLOC,1,Define to 1 if libjemalloc is used)
2059 ])
2060 ])
671651a1
VK
2061fi
2062
2063
ef0c727b
VK
2064#--------------------------------------------------------------------
2065# AIX specific checks
2066#--------------------------------------------------------------------
d16cf8a5 2067
ef0c727b
VK
2068if test "x$PLATFORM" = "xAIX"; then
2069 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 2070 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
2071#if HAVE_PROCINFO_H
2072#include <procinfo.h>
2073#endif
2074 ])
ef0c727b
VK
2075 AC_CHECK_FUNCS([getprocs64],,,[
2076#if HAVE_PROCINFO_H
2077#include <procinfo.h>
6cd41ceb 2078#endif
ef0c727b 2079 ])
7e56bf2e
VK
2080fi
2081
cd4c8ca3 2082
f47bd4ca
VK
2083#--------------------------------------------------------------------
2084# Solaris specific checks
2085#--------------------------------------------------------------------
2086
2087if test "x$PLATFORM" = "xSunOS"; then
2088 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
2089#include <sys/atomic.h>
2090 ])
2091fi
2092
2093
ba8db57b
VK
2094#--------------------------------------------------------------------
2095# HP-UX specific checks
2096#--------------------------------------------------------------------
2097
2098if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 2099 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
2100 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
2101#if HAVE_NET_IF_H
2102#include <net/if.h>
2103#endif
2104 ])
2105 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
2106#if HAVE_SYS_MIB_H
2107#include <sys/mib.h>
2108#endif
2109 ])
cfd95c74
VK
2110
2111 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
2112 AC_LANG_PUSH([C++])
2113 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2114#include <sys/pstat.h>
2115 ]], [[
2116pst_diskinfo d;
2117int x;
2118x = (int)d.psd_dkread;
2119x = (int)d.psd_dkwrite;
2120 ]])],
2121 [
2122 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
2123 AC_MSG_RESULT(yes)
2124 ],
2125 [
2126 AC_MSG_RESULT(no)
2127 ])
2128 AC_LANG_POP([C++])
ba8db57b
VK
2129fi
2130
2131
aa24418a
VK
2132#--------------------------------------------------------------------
2133# *BSD specific checks
2134#--------------------------------------------------------------------
2135
2136AC_CHECK_LIB(kvm, kvm_open)
2137AC_CHECK_FUNCS([kvm_getswapinfo])
2138AC_CHECK_TYPES([struct kinfo_proc2],,,[
2139#if HAVE_SYS_SYSCTL_H
2140#include <sys/sysctl.h>
2141#endif
2142])
2143
2144
28ba6824
VK
2145#--------------------------------------------------------------------
2146# FreeBSD specific checks
2147#--------------------------------------------------------------------
2148
2149if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
2150 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
2151#if HAVE_SYS_TYPES_H
2152#include <sys/types.h>
2153#endif
2154#if HAVE_SYS_SOCKET_H
2155#include <sys/socket.h>
2156#endif
2157#include <net/route.h>
2158 ])
28ba6824
VK
2159fi
2160
2161
ea6615cf
VK
2162#--------------------------------------------------------------------
2163# OpenBSD specific checks
2164#--------------------------------------------------------------------
2165
2166if test "x$PLATFORM" = "xOpenBSD"; then
2167 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
2168 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2169#include <sys/param.h>
2170#include <sys/proc.h>
2171#include <kvm.h>
2172#include <sys/user.h>
2173 ]],[[
2174 int count;
2175 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
2176 return 0;
2177 ]])
2178 ],[
2179 AC_MSG_RESULT(yes)
2180 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2181 ],[
2182 AC_MSG_RESULT(no)
2183 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2184 ])
2185
2186 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
2187 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2188#include <sys/param.h>
2189#include <sys/proc.h>
2190#include <kvm.h>
2191#include <sys/user.h>
2192 ]],[[
2193 struct kinfo_proc p;
2194 return p.kp_proc.p_pid;
2195 ]])
2196 ],[
2197 AC_MSG_RESULT(yes)
2198 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
2199 ],[
2200 AC_MSG_RESULT(no)
2201 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
2202 ])
2203fi
2204
2205
ef8a3c32
VK
2206#--------------------------------------------------------------------
2207# Minix specific checks
2208#--------------------------------------------------------------------
2209
2210if test "x$PLATFORM" = "xMinix"; then
2211 AC_CHECK_HEADERS([minix/minlib.h])
2212fi
2213
2214
ef0c727b
VK
2215#--------------------------------------------------------------------
2216# Check for UNICODE stuff
2217#--------------------------------------------------------------------
3e39fcde 2218
5a82ecc7 2219AC_CHECK_HEADERS([wchar.h wctype.h iconv.h widec.h])
aa24418a 2220AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
2221#if HAVE_WCHAR_H
2222#include <wchar.h>
2223#endif
2224])
f172d7b7
VK
2225AC_CHECK_SIZEOF(wchar_t,,[
2226#if HAVE_WCHAR_H
2227#include <wchar.h>
2228#endif
2229])
fdf1ed50
VK
2230AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper towlower])
2231AC_CHECK_FUNCS([wcslwr wcserror wcserror_r wfopen wfopen64 fputws putws])
2232AC_CHECK_FUNCS([wopen wstat waccess wgetenv wrename wunlink wremove wchdir])
2233AC_CHECK_FUNCS([wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod vwscanf])
2234AC_CHECK_FUNCS([vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
fdb710a7 2235AC_CHECK_FUNCS([mbstowcs mbsrtowcs itow _itow wcsftime wcstok])
dff54fed 2236
465bd4ff
VK
2237AC_CHECK_DECLS([putws],,,[
2238#if HAVE_WCHAR_H
2239#include <wchar.h>
2240#endif
2241])
2242
75b4d48e
VK
2243if test "x$ac_cv_func_wcsftime" = "xyes"; then
2244 AC_MSG_CHECKING(whether wcsftime is working correctly)
2245 AC_RUN_IFELSE(
2246 [AC_LANG_PROGRAM([
2247#include <stdio.h>
2248#ifdef HAVE_UNISTD_H
2249#include <unistd.h>
2250#endif
2251#ifdef HAVE_TIME_H
2252#include <time.h>
2253#endif
2254#ifdef HAVE_SYS_TIME_H
2255#include <sys/time.h>
2256#endif
2257#if HAVE_WCHAR_H
2258#include <wchar.h>
2259#endif
2260 ], [[
2261 wchar_t buffer[64];
2262 struct tm *ltm;
2263 time_t t;
2264
2265 t = time(NULL);
2266 ltm = localtime(&t);
2267 wcsftime(buffer, 64, L"%Y", ltm);
2268 return wcstol(buffer, NULL, 10) == ltm->tm_year + 1900 ? 0 : 1;
2269 ]])
2270 ],
2271 [ AC_MSG_RESULT(yes)
2272 AC_DEFINE(WORKING_WCSFTIME, 1, Define to 1 if wcsftime is working correctly)
2273 ],
2274 [ AC_MSG_RESULT(no) ],
2275 [ AC_MSG_RESULT(no) ]
2276 )
2277fi
2278
3265ba38 2279if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 2280 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 2281 [ ac_found_iconv=yes
8d131dda 2282 LIBS="$LIBS -liconv"
75c30ed4
VK
2283 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
2284 ],
2285 [
2286 AC_CHECK_LIB(iconv, iconv,
2287 [ ac_found_iconv=yes
8d131dda 2288 LIBS="$LIBS -liconv"
75c30ed4
VK
2289 ])
2290 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
2291 ])
dff54fed
VK
2292else
2293 ac_found_iconv=no
ef0c727b 2294 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 2295fi
93571e7f 2296
3bf0df9f
VK
2297AC_MSG_CHECKING(whether fgetws can be used with popen)
2298AC_RUN_IFELSE(
2299 [AC_LANG_PROGRAM([
2300#include <stdio.h>
2301#ifdef HAVE_UNISTD_H
2302#include <unistd.h>
2303#endif
2304#if HAVE_WCHAR_H
2305#include <wchar.h>
2306#endif
2307 ], [[
2308 int rc = 1;
2309 wchar_t line[4096];
2310 FILE *f = popen("echo test", "r");
2311 if(f!=NULL)
2312 {
2313 fgetws(line, 4096, f);
2314 pclose(f);
2315 rc = 0;
2316 }
2317 return rc;
2318 ]])
2319 ],
2320 [ AC_MSG_RESULT(yes)
2321 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
2322 ],
2323 [ AC_MSG_RESULT(no) ],
2324 [ AC_MSG_RESULT(no) ]
2325)
2326
93571e7f
VK
2327AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
2328AC_RUN_IFELSE(
2329 [AC_LANG_PROGRAM([
2330#if HAVE_ICONV_H
2331#include <iconv.h>
2332#endif
2333 ], [
2334 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
2335 ])
2336 ],
2337 [ AC_MSG_RESULT(yes)
2338 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
2339 valid_ucs2_code="UCS-2-INTERNAL"
2340 ],
2341 [ AC_MSG_RESULT(no) ],
2342 [ AC_MSG_RESULT(no) ]
2343)
2344
2345AC_MSG_CHECKING(whether iconv supports UCS-2)
2346AC_RUN_IFELSE(
2347 [AC_LANG_PROGRAM([
2348#if HAVE_ICONV_H
2349#include <iconv.h>
2350#endif
2351 ], [
2352 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
2353 ])
2354 ],
2355 [ AC_MSG_RESULT(yes)
2356 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
2357 valid_ucs2_code="UCS-2"
2358 ],
2359 [ AC_MSG_RESULT(no) ],
8b86c5dc 2360 [ AC_MSG_RESULT(no) ]
93571e7f
VK
2361)
2362
2363AC_MSG_CHECKING(whether iconv supports UCS2)
2364AC_RUN_IFELSE(
2365 [AC_LANG_PROGRAM([
2366#if HAVE_ICONV_H
2367#include <iconv.h>
2368#endif
2369 ], [
2370 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
2371 ])
2372 ],
2373 [ AC_MSG_RESULT(yes)
2374 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
2375 valid_ucs2_code="UCS2"
2376 ],
2377 [ AC_MSG_RESULT(no) ],
2378 [ AC_MSG_RESULT(no) ]
2379)
2380
44bccbbc
VK
2381AC_MSG_CHECKING(whether iconv supports UCS-2BE)
2382AC_RUN_IFELSE(
2383 [AC_LANG_PROGRAM([
2384#if HAVE_ICONV_H
2385#include <iconv.h>
2386#endif
2387 ], [
2388 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
2389 ])
2390 ],
2391 [ AC_MSG_RESULT(yes)
2392 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
2393 valid_ucs2_code="UCS-2BE"
2394 ],
2395 [ AC_MSG_RESULT(no) ],
2396 [ AC_MSG_RESULT(no) ]
2397)
2398
6e17f325
VK
2399AC_MSG_CHECKING(whether iconv supports UCS-2LE)
2400AC_RUN_IFELSE(
2401 [AC_LANG_PROGRAM([
2402#if HAVE_ICONV_H
2403#include <iconv.h>
2404#endif
2405 ], [
2406 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
2407 ])
2408 ],
2409 [ AC_MSG_RESULT(yes)
2410 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
2411 valid_ucs2_code="UCS-2LE"
2412 ],
2413 [ AC_MSG_RESULT(no) ],
2414 [ AC_MSG_RESULT(no) ]
2415)
2416
4a4e1feb
VK
2417AC_MSG_CHECKING(whether iconv supports UTF-16)
2418AC_RUN_IFELSE(
2419 [AC_LANG_PROGRAM([
2420#if HAVE_ICONV_H
2421#include <iconv.h>
2422#endif
2423 ], [
2424 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
2425 ])
2426 ],
2427 [ AC_MSG_RESULT(yes)
2428 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
2429 valid_ucs2_code="UTF-16"
2430 ],
2431 [ AC_MSG_RESULT(no) ],
2432 [ AC_MSG_RESULT(no) ]
2433)
2434
8b86c5dc
VK
2435AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
2436AC_RUN_IFELSE(
2437 [AC_LANG_PROGRAM([
2438#if HAVE_ICONV_H
2439#include <iconv.h>
2440#endif
2441 ], [
2442 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
2443 ])
2444 ],
2445 [ AC_MSG_RESULT(yes)
2446 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
2447 valid_ucs4_code="UCS-4-INTERNAL"
2448 ],
2449 [ AC_MSG_RESULT(no) ],
2450 [ AC_MSG_RESULT(no) ]
2451)
2452
2453AC_MSG_CHECKING(whether iconv supports UCS-4)
2454AC_RUN_IFELSE(
2455 [AC_LANG_PROGRAM([
2456#if HAVE_ICONV_H
2457#include <iconv.h>
2458#endif
2459 ], [
2460 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
2461 ])
2462 ],
2463 [ AC_MSG_RESULT(yes)
2464 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
2465 valid_ucs4_code="UCS-4"
2466 ],
2467 [ AC_MSG_RESULT(no) ],
2468 [ AC_MSG_RESULT(no) ]
2469)
2470
2471AC_MSG_CHECKING(whether iconv supports UCS4)
2472AC_RUN_IFELSE(
2473 [AC_LANG_PROGRAM([
2474#if HAVE_ICONV_H
2475#include <iconv.h>
2476#endif
2477 ], [
2478 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
2479 ])
2480 ],
2481 [ AC_MSG_RESULT(yes)
2482 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2483 valid_ucs4_code="UCS4"
2484 ],
2485 [ AC_MSG_RESULT(no) ],
2486 [ AC_MSG_RESULT(no) ]
2487)
2488
2489AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2490AC_RUN_IFELSE(
2491 [AC_LANG_PROGRAM([
2492#if HAVE_ICONV_H
2493#include <iconv.h>
2494#endif
2495 ], [
2496 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2497 ])
2498 ],
2499 [ AC_MSG_RESULT(yes)
2500 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2501 valid_ucs4_code="UCS-4BE"
2502 ],
2503 [ AC_MSG_RESULT(no) ],
2504 [ AC_MSG_RESULT(no) ]
2505)
2506
6e17f325
VK
2507AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2508AC_RUN_IFELSE(
2509 [AC_LANG_PROGRAM([
2510#if HAVE_ICONV_H
2511#include <iconv.h>
2512#endif
2513 ], [
2514 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2515 ])
2516 ],
2517 [ AC_MSG_RESULT(yes)
2518 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2519 valid_ucs4_code="UCS-4LE"
2520 ],
2521 [ AC_MSG_RESULT(no) ],
2522 [ AC_MSG_RESULT(no) ]
2523)
2524
4a4e1feb
VK
2525AC_MSG_CHECKING(whether iconv supports UTF-32)
2526AC_RUN_IFELSE(
2527 [AC_LANG_PROGRAM([
2528#if HAVE_ICONV_H
2529#include <iconv.h>
2530#endif
2531 ], [
2532 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2533 ])
2534 ],
2535 [ AC_MSG_RESULT(yes)
2536 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2537 valid_ucs4_code="UTF-32"
2538 ],
2539 [ AC_MSG_RESULT(no) ],
2540 [ AC_MSG_RESULT(no) ]
2541)
2542
93571e7f
VK
2543AC_MSG_CHECKING(whether iconv supports //IGNORE)
2544AC_RUN_IFELSE(
2545 [AC_LANG_PROGRAM([
2546#if HAVE_ICONV_H
2547#include <iconv.h>
2548#endif
2549 ], [
2550 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2551 ])
2552 ],
2553 [ AC_MSG_RESULT(yes)
2554 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2555 ],
2556 [ AC_MSG_RESULT(no) ],
2557 [ AC_MSG_RESULT(no) ]
2558)
3e39fcde 2559
bd96aa53
VK
2560AC_MSG_CHECKING(whether iconv supports state reset)
2561AC_RUN_IFELSE(
2562 [AC_LANG_PROGRAM([
2563#include <stdio.h>
2564#if HAVE_ICONV_H
2565#include <iconv.h>
2566#endif
2567 ], [
2568 iconv_t cd = iconv_open("UTF-8","$valid_ucs2_code");
2569 if (cd == (iconv_t)(-1)) return 1;
2570 return iconv(cd, NULL, NULL, NULL, NULL) != 0;
2571 ])
2572 ],
2573 [ AC_MSG_RESULT(yes)
2574 AC_DEFINE(HAVE_ICONV_STATE_RESET, 1, Define to 1 if iconv supports state reset)
2575 ],
2576 [ AC_MSG_RESULT(no) ],
2577 [ AC_MSG_RESULT(no) ]
2578)
2579
2580AC_MSG_CHECKING(whether iconv descriptor cache is needed)
2581case $enable_iconv_cache in
2582 auto)
2583 case $PLATFORM in
2584 SunOS|HP-UX|AIX)
2585 enable_iconv_cache=yes
2586 ;;
2587 *)
2588 enable_iconv_cache=no
2589 ;;
2590 esac
2591 ;;
2592 yes|no)
2593 ;;
2594 *)
2595 AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
2596 ;;
2597esac
2598if test "x$enable_iconv_cache" = "xyes"; then
2599 AC_DEFINE(WITH_ICONV_CACHE, 1, Define to 1 to enable iconv descriptor cache)
2600fi
2601AC_MSG_RESULT($enable_iconv_cache)
2602
19619a35
AK
2603# taken from ZSH's configure
2604# Check if iconv uses const in prototype declaration
24b1570c 2605if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 2606 AC_LANG_PUSH([C++])
19619a35 2607 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
2608 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2609#include <stdlib.h>
f6a2136d 2610#if HAVE_ICONV_H
7f9423af 2611#include <iconv.h>
7f9423af 2612#endif
f6a2136d
VK
2613 ]],
2614 [[
3e51d371
VK
2615 char **p = NULL;
2616 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 2617 ]])],
3e51d371
VK
2618 [ac_cv_iconv_const=const],
2619 [ac_cv_iconv_const=])])
53c96e2d 2620 AC_LANG_POP([C++])
19619a35
AK
2621 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2622 [Define as const if the declaration of iconv() needs const.])
2623fi
2624
a67fa146
VK
2625if test "x$ac_cv_type_wchar_t" = "xyes"; then
2626 if test $ac_cv_sizeof_wchar_t -eq 2; then
2627 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2628 fi
8b86c5dc 2629
a67fa146
VK
2630 if test $ac_cv_sizeof_wchar_t -eq 4; then
2631 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2632 fi
2633
2634 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2635 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2636 fi
2637else
2638 if test "x$BUILD_UNICODE" = "xyes"; then
2639 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2640 fi
8b86c5dc
VK
2641fi
2642
c29360a9 2643
ca0f4ea3
VK
2644#--------------------------------------------------------------------
2645# MySQL
2646#--------------------------------------------------------------------
2647
2648check_substr "$COMPONENTS" "mysql"
2649if test $? = 0; then
9f1ea006
VK
2650 OLD_CPPFLAGS="$CPPFLAGS"
2651 OLD_LDFLAGS="$LDFLAGS"
2652 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2653
2654 CPPFLAGS="$CPPFLAGS $MYSQL_CPPFLAGS"
2655 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
2656 if test "x$MYSQL_LD_RUN_PATH" != "x"; then
2657 LD_RUN_PATH="${MYSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2658 fi
2659
b93fd1c1 2660 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MySQL client installation]))
9f1ea006 2661
6fce76d8 2662 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2663 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2664
8d131dda
VK
2665 OLD_LIBS="$LIBS"
2666 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2667
ca0f4ea3 2668 AC_CHECK_FUNCS(mysql_real_escape_string)
9f1ea006
VK
2669
2670 CPPFLAGS="$OLD_CPPFLAGS"
2671 LDFLAGS="$OLD_LDFLAGS"
2672 LD_RUN_PATH="$OLD_LD_RUN_PATH"
8d131dda 2673 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2674fi
2675
2676
58ed4897
VK
2677#--------------------------------------------------------------------
2678# PostgreSQL
2679#--------------------------------------------------------------------
2680
203458b7 2681check_substr "$COMPONENTS" "pgsql"
58ed4897 2682if test $? = 0; then
b535eed6
VK
2683 OLD_CPPFLAGS="$CPPFLAGS"
2684 OLD_LDFLAGS="$LDFLAGS"
2685 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2686
2687 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
2688 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
2689 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2690 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2691 fi
2692
9f1ea006
VK
2693 AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([Cannot find libpq-fe.h - check your PostgreSQL client installation]))
2694
7e19eef6
VK
2695 AC_CHECK_DECLS([PGRES_SINGLE_TUPLE],,,[
2696#include <libpq-fe.h>
2697 ])
2698
58ed4897 2699 AC_CHECK_LIB(m, floor)
b535eed6
VK
2700 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2701 if test "x$PLATFORM" = "xSunOS"; then
2702 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
2703 LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
2704 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2705 PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
2706 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${OLD_LD_RUN_PATH:+:}${OLD_LD_RUN_PATH}"
2707 fi
2708 unset ac_cv_lib_pq_PQconnectdb
2709 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2710 AC_MSG_ERROR(libpq is required for PostgreSQL support)])
2711 else
2712 AC_MSG_ERROR(libpq is required for PostgreSQL support)
2713 fi
2714 ])
6fce76d8 2715
b535eed6
VK
2716 CPPFLAGS="$OLD_CPPFLAGS"
2717 LDFLAGS="$OLD_LDFLAGS"
2718 LD_RUN_PATH="$OLD_LD_RUN_PATH"
58ed4897
VK
2719fi
2720
2721
9c29f76e
VK
2722#--------------------------------------------------------------------
2723# ODBC
2724#--------------------------------------------------------------------
2725
2726check_substr "$COMPONENTS" "odbc"
2727if test $? = 0; then
2cfe4482
VK
2728 OLD_CPPFLAGS="$CPPFLAGS"
2729 OLD_LDFLAGS="$LDFLAGS"
2730 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2731
2732 CPPFLAGS="$CPPFLAGS $ODBC_CPPFLAGS"
b535eed6 2733 LDFLAGS="$LDFLAGS $ODBC_LDFLAGS"
2cfe4482
VK
2734 if test "x$ODBC_LD_RUN_PATH" != "x"; then
2735 LD_RUN_PATH="${ODBC_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2736 fi
2737
6fce76d8 2738 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2739 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2740 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2741 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2742 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2743 fi
2cfe4482
VK
2744
2745 CPPFLAGS="$OLD_CPPFLAGS"
2746 LDFLAGS="$OLD_LDFLAGS"
2747 LD_RUN_PATH="$OLD_LD_RUN_PATH"
9c29f76e
VK
2748fi
2749
2750
41b4790d
VK
2751#--------------------------------------------------------------------
2752# Oracle
2753#--------------------------------------------------------------------
2754
2755check_substr "$COMPONENTS" "oracle"
2756if test $? = 0; then
2cfe4482
VK
2757 OLD_CPPFLAGS="$CPPFLAGS"
2758 OLD_LDFLAGS="$LDFLAGS"
2759 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2760
2761 CPPFLAGS="$CPPFLAGS $ORACLE_CPPFLAGS"
b535eed6 2762 LDFLAGS="$LDFLAGS $ORACLE_LDFLAGS"
2cfe4482
VK
2763 if test "x$ORACLE_LD_RUN_PATH" != "x"; then
2764 LD_RUN_PATH="${ORACLE_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2765 fi
2766
41b4790d 2767 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
e5cceced 2768 AC_CHECK_LIB(nnz12, nzstrcpy, [NNZ_LIB=-lnnz12],
7d8c91ef 2769 [
e5cceced
VK
2770 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2771 [
2772 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2773 ], [-lclntsh])
7d8c91ef
VK
2774 ], [-lclntsh])
2775 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2776 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2777 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2778 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2779 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2780 fi
2cfe4482
VK
2781
2782 CPPFLAGS="$OLD_CPPFLAGS"
2783 LDFLAGS="$OLD_LDFLAGS"
2784 LD_RUN_PATH="$OLD_LD_RUN_PATH"
41b4790d
VK
2785fi
2786
84277a0f
AK
2787#--------------------------------------------------------------------
2788# DB2
2789#--------------------------------------------------------------------
2790
2791check_substr "$COMPONENTS" "db2"
2792if test $? = 0; then
2793 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2794 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2795 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2796 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2797 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2798 fi
84277a0f 2799fi
41b4790d 2800
37861c72
VK
2801#--------------------------------------------------------------------
2802# Informix
2803#--------------------------------------------------------------------
2804
2805check_substr "$COMPONENTS" "informix"
2806if test $? = 0; then
2807 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2808 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2809 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2810 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2811 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2812 fi
37861c72
VK
2813fi
2814
c3cfc039 2815
50e4bc8c
VK
2816#--------------------------------------------------------------------
2817# Java
2818#--------------------------------------------------------------------
2819
2820check_substr "$COMPONENTS" "java"
2821if test $? = 0; then
2822 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
50e4bc8c
VK
2823fi
2824
2825
b14c3f22
VK
2826#--------------------------------------------------------------------
2827# Tuxedo
2828#--------------------------------------------------------------------
2829
2830check_substr "$COMPONENTS" "tuxedo"
2831if test $? = 0; then
2832 OLD_CPPFLAGS="$CPPFLAGS"
2833 OLD_LDFLAGS="$LDFLAGS"
2834 OLD_LIBS="$LIBS"
2835
2836 if test "x$TUXEDO_BASE" != "x"; then
2837 TUXEDO_CPPFLAGS="-I$TUXEDO_BASE/include"
2838 TUXEDO_LDFLAGS="-L$TUXEDO_BASE/lib"
2839 CPPFLAGS="$CPPFLAGS $TUXEDO_CPPFLAGS"
2840 LDFLAGS="$LDFLAGS $TUXEDO_LDFLAGS"
2841 fi
2842
2843 AC_CHECK_HEADER(atmi.h,,AC_MSG_ERROR([*** Cannot find atmi.h - check your Tuxedo installation ***]))
2844
2845 # https://community.oracle.com/thread/2346582
2846 if test "x$PLATFORM" = "xLinux"; then
2847 TUXEDO_LDFLAGS="$TUXEDO_LDFLAGS -Xlinker --no-as-needed"
2848 LDFLAGS="$LDFLAGS -Xlinker --no-as-needed"
2849 fi
6d14d0b0
VK
2850
2851 if test "$PLATFORM" = "SunOS"; then
2852 AC_CHECK_LIB(rt, nanosleep, [ TUXEDO_LIBS="$TUXEDO_LIBS -lrt" ])
2853 fi
2854
73517e51
VK
2855 if test "$PLATFORM" = "AIX"; then
2856 AC_MSG_CHECKING(for xa_switchp in libengine)
2857 OLD_LIBS_LIBENGINE="$LIBS"
2858 LIBS="$LIBS -lengine"
2859 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ extern char *xa_switchp; ]], [[ *xa_switchp = 0; ]])],
2860 [
2861 AC_MSG_RESULT(yes)
2862 TUXEDO_LIBS="$TUXEDO_LIBS -lengine"
2863 ],
2864 [ AC_MSG_RESULT(no) ])
2865 LIBS="$OLD_LIBS_LIBENGINE"
2866 fi
2867
6d14d0b0 2868 LIBS="$LIBS $TUXEDO_LIBS"
73517e51 2869 AC_CHECK_LIB(tux, tpcall, [], [AC_MSG_ERROR(libtux is required for Tuxedo support)])
b14c3f22
VK
2870
2871 CPPFLAGS="$OLD_CPPFLAGS"
2872 LDFLAGS="$OLD_LDFLAGS"
2873 LIBS="$OLD_LIBS"
73517e51
VK
2874
2875 if test "x$PLATFORM" = "xAIX"; then
2876 if test -e $TUXEDO_BASE/lib/tpinit.o; then
c7c6ce77 2877 TUXEDO_TPINIT="$TUXEDO_BASE/lib/tpinit.o"
73517e51
VK
2878 fi
2879 fi
b14c3f22
VK
2880fi
2881
cac05a70 2882#--------------------------------------------------------------------
2883# ZeroMQ
2884#--------------------------------------------------------------------
2885
2886check_substr "$COMPONENTS" "zeromq"
2887if test $? = 0; then
2888 OLD_CPPFLAGS="$CPPFLAGS"
2889 OLD_LDFLAGS="$LDFLAGS"
2890 OLD_LIBS="$LIBS"
2891
2892 if test "x$ZEROMQ_BASE" != "x"; then
2893 ZEROMQ_CPPFLAGS="-I$ZEROMQ_BASE/include"
2894 ZEROMQ_LDFLAGS="-L$ZEROMQ_BASE/lib"
2895 CPPFLAGS="$CPPFLAGS $ZEROMQ_CPPFLAGS"
2896 LDFLAGS="$LDFLAGS $ZEROMQ_LDFLAGS"
7fcdcb0c 2897 fi
cac05a70 2898
ca026ade
VK
2899 AC_CHECK_HEADER(zmq.h,,[
2900 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
2901 AC_MSG_ERROR([*** Cannot find zmq.h - check your ZeroMQ installation ***])
2902 else
2903 ZEROMQ_SUPPORT="no"
2904 fi
2905 ])
2906 AC_CHECK_LIB(zmq, zmq_ctx_new, [ SERVER_LIBS="$SERVER_LIBS -lzmq" ], [
2907 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
2908 AC_MSG_ERROR([*** libzmq is missing or too old - check your ZeroMQ installation ***])
2909 else
2910 ZEROMQ_SUPPORT="no"
2911 fi
2912 ])
cac05a70 2913
ca026ade
VK
2914 if test "x$ZEROMQ_SUPPORT" = "xyes"; then
2915 AC_DEFINE(WITH_ZMQ, 1, Define to 1 if ZeroMQ is supported)
2916 fi
cac05a70 2917
2918 CPPFLAGS="$OLD_CPPFLAGS"
2919 LDFLAGS="$OLD_LDFLAGS"
2920 LIBS="$OLD_LIBS"
2921fi
2922
d6235717 2923#--------------------------------------------------------------------
2924# MongoDB
2925#--------------------------------------------------------------------
2926
2927check_substr "$COMPONENTS" "mongodb"
2928if test $? = 0; then
2929 OLD_CPPFLAGS="$CPPFLAGS"
2930 OLD_LDFLAGS="$LDFLAGS"
2931 OLD_LIBS="$LIBS"
2932
2933 if test "x$MONGODB_BASE" != "x"; then
2934 MONGODB_CPPFLAGS="-I$MONGODB_BASE/include/libmongoc-1.0/ -I$MONGODB_BASE/include/libbson-1.0/"
2935 MONGODB_LDFLAGS="-L$MONGODB_BASE/lib"
2936 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2937 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
2938 else
2939 MONGODB_CPPFLAGS="-I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/"
2940 MONGODB_LDFLAGS="-L/usr/local/lib"
2941 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2942 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
b7c8729b 2943 fi
d6235717 2944
2945 AC_CHECK_HEADER(mongoc.h,,AC_MSG_ERROR([*** Cannot find mongoc.h - check your MongoDB installation ***]))
4bed256b 2946 AC_CHECK_LIB(mongoc-1.0, mongoc_client_get_database, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
d6235717 2947 AC_CHECK_LIB(bson-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lbson-1.0" ])
2948
2949 LIBS="$LIBS $MONGODB_LIBS"
2950
2951 CPPFLAGS="$OLD_CPPFLAGS"
2952 LDFLAGS="$OLD_LDFLAGS"
2953 LIBS="$OLD_LIBS"
2954fi
b14c3f22 2955
b7c8729b 2956#--------------------------------------------------------------------
2957# VMGR
2958#--------------------------------------------------------------------
2959
2960check_substr "$COMPONENTS" "vmgr"
2961if test $? = 0; then
2962 OLD_CPPFLAGS="$CPPFLAGS"
2963 OLD_LDFLAGS="$LDFLAGS"
2964 OLD_LIBS="$LIBS"
2965
2966 if test "x$VMGR_BASE" != "x"; then
2967 VMGR_CPPFLAGS="-I$VMGR_BASE/include/libvirt/"
2968 VMGR_LDFLAGS="-L$VMGR_BASE/lib"
2969 CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
2970 LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
2971 else
2972 VMGR_CPPFLAGS="-I/usr/include/libvirt/"
2973 VMGR_LDFLAGS="-L/usr/lib"
2974 CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
2975 LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
2976 fi
2977
2978 AC_CHECK_HEADER(libvirt.h,,AC_MSG_ERROR([*** Cannot find libvirt.h - check your libvirt installation ***]))
4bed256b 2979 AC_CHECK_LIB(virt, virConnectGetLibVersion, [ VMGR_LIBS="$VMGR_LIBS -lvirt" ])
b7c8729b 2980 LIBS="$LIBS $VMGR_LIBS"
2981
2982 CPPFLAGS="$OLD_CPPFLAGS"
2983 LDFLAGS="$OLD_LDFLAGS"
2984 LIBS="$OLD_LIBS"
2985fi
2986
ca0f4ea3
VK
2987#--------------------------------------------------------------------
2988# Other settings
2989#--------------------------------------------------------------------
2990
a5a95ac8
VK
2991if test "x$RUNTIME_PREFIX" = "x"; then
2992 if test "x${BUILD_UNICODE}" = "xyes"; then
f434ab60 2993 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\" -DSTATEDIR=L\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2994 else
f434ab60 2995 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\" -DSTATEDIR=\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2996 fi
b07c50cc 2997else
a5a95ac8 2998 if test "x${BUILD_UNICODE}" = "xyes"; then
54df06e2 2999 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"$RUNTIME_PREFIX\\\" -DDATADIR=L\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=L\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=L\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=L\\\"$RUNTIME_PREFIX/lib/netxms\\\" -DSTATEDIR=L\\\"$RUNTIME_STATE_DIR/lib/netxms\\\""
a5a95ac8 3000 else
54df06e2 3001 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\" -DSTATEDIR=\\\"$RUNTIME_STATE_DIR/lib/netxms\\\""
a5a95ac8 3002 fi
1fd3eaa2 3003 LDFLAGS_SUFFIX="$LDFLAGS_SUFFIX -R $RUNTIME_PREFIX/lib"
b07c50cc 3004fi
545bda2d 3005LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 3006
25ae8377
VK
3007if test "x${ENABLE_WERROR}" = "xyes"; then
3008 CPPFLAGS="$CPPFLAGS -Werror"
3009fi
3010
cbc4d191
VK
3011if test "x$PLATFORM" = "xDarwin"; then
3012 SHLIB_SUFFIX=".so"
3013else
3014 if test "x$shrext_cmds" != "x"; then
3015 SHLIB_SUFFIX="$shrext_cmds"
3016 else
3017 SHLIB_SUFFIX=".so"
3018 fi
2b479c92 3019fi
cbc4d191 3020AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
2b479c92 3021
8c9993b4
VK
3022if test "x$ENABLE_DEBUG" = "xno"; then
3023 CPPFLAGS="$CPPFLAGS -DNDEBUG"
3024fi
3025
f92a016a
VK
3026if test "x$WITH_JEMALLOC" = "xyes"; then
3027 LIBS="$LIBS -ljemalloc"
3028fi
3029
551ec9ca 3030AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 3031AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
f5393033 3032AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
3d2bc3ae 3033AM_CONDITIONAL([USE_INTERNAL_SQLITE], [test "x$HAVE_SQLITE" = "xno"])
f1b8f11c 3034AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$HAVE_ZLIB" = "no"])
c1165d33
VK
3035AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
3036AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
c54e483e 3037AM_CONDITIONAL([USE_ENCRYPTION], [test "x${HAVE_LIBCRYPTO}" = "xyes"])
6dde8627 3038AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
058bf6fc 3039AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
7fcdcb0c 3040AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
8b86c5dc 3041
ca0f4ea3 3042
8a96930f
AK
3043#--------------------------------------------------------------------
3044# Cleanup variables
3045#--------------------------------------------------------------------
3046
3047AS_IF([test "x$with_dist" = "xyes"],
3048[
c7c6ce77 3049 AGENT_DIRS=`echo $AGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
8a96930f
AK
3050 SUBAGENT_DIRS=`echo $SUBAGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3051 MODULES=`echo $MODULES|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3052 SMSDRV_DIRS=`echo $SMSDRV_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3053 HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3054])
3055
ef0c727b
VK
3056#--------------------------------------------------------------------
3057# Substitute variables
3058#--------------------------------------------------------------------
82fa7c5d 3059
ef0c727b
VK
3060AC_SUBST(DB_DRIVERS)
3061AC_SUBST(MODULES)
c7c6ce77 3062AC_SUBST(AGENT_DIRS)
ef0c727b 3063AC_SUBST(SUBAGENT_DIRS)
7dda4453 3064AC_SUBST(SERVER_INCLUDE)
7c48e2aa 3065AC_SUBST(SERVER_LIBS)
ef0c727b 3066AC_SUBST(SERVER_TOOLS)
c20f8eb7 3067AC_SUBST(SMSDRV_DIRS)
6fad8870 3068AC_SUBST(HDLINK_DIRS)
52a2232c 3069AC_SUBST(PDSDRV_DIRS)
ef0c727b
VK
3070AC_SUBST(TOP_LEVEL_MODULES)
3071AC_SUBST(CONTRIB_MODULES)
c2612d83 3072AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
3073AC_SUBST(STATIC_SUBAGENT_LIST)
3074AC_SUBST(SUBAGENT_LIBS)
3075AC_SUBST(BUILD_SERVER)
447350a9 3076AC_SUBST(BUILD_SDK)
2cfe4482
VK
3077AC_SUBST(MYSQL_CPPFLAGS)
3078AC_SUBST(MYSQL_LDFLAGS)
6fce76d8 3079AC_SUBST(MYSQL_LIBS)
2cfe4482
VK
3080AC_SUBST(PGSQL_CPPFLAGS)
3081AC_SUBST(PGSQL_LDFLAGS)
6fce76d8 3082AC_SUBST(PGSQL_LIBS)
2cfe4482
VK
3083AC_SUBST(ORACLE_CPPFLAGS)
3084AC_SUBST(ORACLE_LDFLAGS)
7d8c91ef 3085AC_SUBST(ORACLE_LIBS)
2cfe4482
VK
3086AC_SUBST(ODBC_CPPFLAGS)
3087AC_SUBST(ODBC_LDFLAGS)
6fce76d8 3088AC_SUBST(ODBC_LIBS)
2cfe4482
VK
3089AC_SUBST(DB2_CPPFLAGS)
3090AC_SUBST(DB2_LDFLAGS)
84277a0f 3091AC_SUBST(DB2_LIBS)
2cfe4482
VK
3092AC_SUBST(INFORMIX_CPPFLAGS)
3093AC_SUBST(INFORMIX_LDFLAGS)
87f1fff0 3094AC_SUBST(INFORMIX_LIBS)
11ce9a66 3095AC_SUBST(OBJECT_MODE)
9113e749 3096AC_SUBST(SQLFLAGS)
cbc4d191 3097AC_SUBST(SHLIB_SUFFIX)
b14c3f22
VK
3098AC_SUBST(TUXEDO_CPPFLAGS)
3099AC_SUBST(TUXEDO_LDFLAGS)
6d14d0b0 3100AC_SUBST(TUXEDO_LIBS)
c7c6ce77 3101AC_SUBST(TUXEDO_TPINIT)
d6235717 3102AC_SUBST(MONGODB_CPPFLAGS)
3103AC_SUBST(MONGODB_LDFLAGS)
3104AC_SUBST(MONGODB_LIBS)
b7c8729b 3105AC_SUBST(VMGR_CPPFLAGS)
3106AC_SUBST(VMGR_LDFLAGS)
3107AC_SUBST(VMGR_LIBS)
b5e5849b 3108AC_SUBST(INSTALL_LIBPATH)
7fcdcb0c
VK
3109AC_SUBST(ZEROMQ_CPPFLAGS)
3110AC_SUBST(ZEROMQ_LDFLAGS)
d16cf8a5 3111
ef0c727b
VK
3112#--------------------------------------------------------------------
3113# Shared libs versions
d16cf8a5
AK
3114#
3115# versioning scheme: current:revision:age
3116#
3117# current
3118# The number of the current interface exported by the library. A current
3119# value of `0', means that you are calling the interface exported by this
3120# library interface 0.
3121#
3122# revision
3123# The implementation number of the most recent interface exported by this
3124# library. In this case, a revision value of `0' means that this is the
3125# first implementation of the interface.
3126# If the next release of this library exports the same interface, but has a
3127# different implementation (perhaps some bugs have been fixed), the revision
3128# number will be higher, but current number will be the same. In that case,
3129# when given a choice, the library with the highest revision will always
3130# be used by the runtime loader.
3131#
3132# age
3133# The number of previous additional interfaces supported by this library.
3134# If age were `2', then this library can be linked into executables which
3135# were built with a release of this library that exported the current
3136# interface number, current, or any of the previous two interfaces.
3137# By definition age must be less than or equal to current. At the outset,
3138# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 3139#--------------------------------------------------------------------
d16cf8a5 3140
359784de 3141NETXMS_LIBRARY_VERSION=2:0:0
c7d14846 3142AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 3143
ef0c727b
VK
3144#--------------------------------------------------------------------
3145# Generate output files
3146#--------------------------------------------------------------------
d16cf8a5
AK
3147
3148AC_CONFIG_FILES([
0c3c0c39
AK
3149 Makefile
3150 contrib/Makefile
36874eca
VK
3151 contrib/backgrounds/Makefile
3152 contrib/integration/Makefile
3153 contrib/integration/HP_EVA/Makefile
bad6cc0c 3154 contrib/integration/HP_P2000/Makefile
36874eca 3155 contrib/mibs/Makefile
19e3290a 3156 contrib/music/Makefile
0c3c0c39 3157 contrib/startup/Makefile
fa66d60c 3158 contrib/startup/debian/Makefile
daaefaaf 3159 contrib/startup/gentoo/Makefile
7483d0bf 3160 contrib/startup/hp-ux/Makefile
0c3c0c39 3161 contrib/startup/redhat/Makefile
5de3893d 3162 contrib/startup/suse/Makefile
9993edf4 3163 contrib/startup/ubuntu/Makefile
6adf3219 3164 contrib/startup/solaris/Makefile
03b96461 3165 contrib/templates/Makefile
0c3c0c39 3166 doc/Makefile
a48203d2
VK
3167 doc/internal/Makefile
3168 doc/manuals/Makefile
3169 doc/misc/Makefile
0c3c0c39
AK
3170 images/Makefile
3171 include/Makefile
3172 m4/Makefile
0c3c0c39 3173 src/Makefile
9191f6ad
VK
3174 src/agent/Makefile
3175 src/agent/core/Makefile
3176 src/agent/install/Makefile
359784de 3177 src/agent/libnxagent/Makefile
52275230 3178 src/agent/libnxappc/Makefile
a2a24e9d 3179 src/agent/libnxsd/Makefile
c7c6ce77 3180 src/agent/libnxtux/Makefile
9191f6ad 3181 src/agent/subagents/Makefile
9191f6ad 3182 src/agent/subagents/aix/Makefile
df8b3df7 3183 src/agent/subagents/darwin/Makefile
52f5ee00
VK
3184 src/agent/subagents/db2/Makefile
3185 src/agent/subagents/dbquery/Makefile
ab1e80fd 3186 src/agent/subagents/devemu/Makefile
e58b0f75 3187 src/agent/subagents/ds18x20/Makefile
80e96a82 3188 src/agent/subagents/ecs/Makefile
ab1e80fd 3189 src/agent/subagents/filemgr/Makefile
9191f6ad 3190 src/agent/subagents/freebsd/Makefile
478ee38b 3191 src/agent/subagents/gps/Makefile
80e96a82
VK
3192 src/agent/subagents/hpux/Makefile
3193 src/agent/subagents/informix/Makefile
9191f6ad 3194 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
3195 src/agent/subagents/java/Makefile
3196 src/agent/subagents/java/java/Makefile
3197 src/agent/subagents/java/java/src/Makefile
3198 src/agent/subagents/java/java/src/main/Makefile
3199 src/agent/subagents/java/java/src/main/java/Makefile
3200 src/agent/subagents/java/java/src/main/java/org/Makefile
3201 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
3202 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
3118008e 3203 src/agent/subagents/java/java/src/main/java/org/netxms/agent/adapters/Makefile
d2f78ba0 3204 src/agent/subagents/java/sample/Makefile
688dad5a
VK
3205 src/agent/subagents/java/sample/src/Makefile
3206 src/agent/subagents/java/sample/src/main/Makefile
3207 src/agent/subagents/java/sample/src/main/java/Makefile
3208 src/agent/subagents/java/sample/src/main/java/org/Makefile
3209 src/agent/subagents/java/sample/src/main/java/org/netxms/Makefile
3210 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/Makefile
3211 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/demo/Makefile
80e96a82 3212 src/agent/subagents/linux/Makefile
df8b3df7 3213 src/agent/subagents/lmsensors/Makefile
80e96a82 3214 src/agent/subagents/logwatch/Makefile
cfcfdd2b 3215 src/agent/subagents/minix/Makefile
80e96a82 3216 src/agent/subagents/netbsd/Makefile
df8b3df7 3217 src/agent/subagents/netsvc/Makefile
80e96a82
VK
3218 src/agent/subagents/odbcquery/Makefile
3219 src/agent/subagents/openbsd/Makefile
4d1753cd 3220 src/agent/subagents/oracle/Makefile
9191f6ad 3221 src/agent/subagents/ping/Makefile
80e96a82 3222 src/agent/subagents/portCheck/Makefile
df8b3df7 3223 src/agent/subagents/rpi/Makefile
9191f6ad 3224 src/agent/subagents/sms/Makefile
12acf3d3 3225 src/agent/subagents/ssh/Makefile
80e96a82 3226 src/agent/subagents/sunos/Makefile
b14c3f22 3227 src/agent/subagents/tuxedo/Makefile
d6235717 3228 src/agent/subagents/mongodb/Makefile
de1205d5 3229 src/agent/subagents/ubntlw/Makefile
9191f6ad 3230 src/agent/subagents/ups/Makefile
b7c8729b 3231 src/agent/subagents/vmgr/Makefile
80e96a82
VK
3232 src/agent/subagents/winnt/Makefile
3233 src/agent/subagents/winperf/Makefile
52f5ee00 3234 src/agent/subagents/wmi/Makefile
0bd64860 3235 src/agent/tools/Makefile
6ac698ed 3236 src/agent/tools/nxappget/Makefile
0bd64860 3237 src/agent/tools/nxapush/Makefile
d8637bab 3238 src/appagent/Makefile
c2612d83 3239 src/client/Makefile
551592f4 3240 src/client/install/Makefile
be03fec6 3241 src/client/libnxclient/Makefile
c94fa5c2 3242 src/client/nxalarm/Makefile
e84701c5
VK
3243 src/client/nxevent/Makefile
3244 src/client/nxpush/Makefile
59ffa5b7 3245 src/client/nxsms/Makefile
d1834406
VK
3246 src/db/Makefile
3247 src/db/dbdrv/Makefile
87f1fff0
VK
3248 src/db/dbdrv/db2/Makefile
3249 src/db/dbdrv/informix/Makefile
d1834406
VK
3250 src/db/dbdrv/odbc/Makefile
3251 src/db/dbdrv/mssql/Makefile
3252 src/db/dbdrv/mysql/Makefile
87f1fff0 3253 src/db/dbdrv/oracle/Makefile
d1834406
VK
3254 src/db/dbdrv/pgsql/Makefile
3255 src/db/dbdrv/sqlite/Makefile
d1834406 3256 src/db/libnxdb/Makefile
9191f6ad
VK
3257 src/install/Makefile
3258 src/install/windows/Makefile
f5393033 3259 src/jansson/Makefile
9191f6ad
VK
3260 src/libexpat/Makefile
3261 src/libexpat/libexpat/Makefile
3262 src/libnetxms/Makefile
a7a4c1e9 3263 src/libnxcc/Makefile
9191f6ad
VK
3264 src/libnxlp/Makefile
3265 src/libnxmap/Makefile
0d956dd9 3266 src/libnxmb/Makefile
10d5b2b2 3267 src/libnxsl/Makefile
058bf6fc 3268 src/libstrophe/Makefile
a67fa146
VK
3269 src/libtre/Makefile
3270 src/libtre/win32/Makefile
a7a03ffd 3271 src/nxcproxy/Makefile
8dca469f 3272 src/nxlptest/Makefile
9191f6ad 3273 src/nxscript/Makefile
0c3c0c39
AK
3274 src/server/Makefile
3275 src/server/core/Makefile
644f97f5 3276 src/server/drivers/Makefile
386f88e3 3277 src/server/drivers/airespace/Makefile
0239cfea 3278 src/server/drivers/at/Makefile
644f97f5 3279 src/server/drivers/baystack/Makefile
b1bd1fb2 3280 src/server/drivers/cat2900xl/Makefile
910846cc 3281 src/server/drivers/catalyst/Makefile
fce03ab9 3282 src/server/drivers/cisco-esw/Makefile
ae8ea5a6 3283 src/server/drivers/cisco-sb/Makefile
8bdfaed8 3284 src/server/drivers/dell-pwc/Makefile
a548def4 3285 src/server/drivers/dlink/Makefile
644f97f5 3286 src/server/drivers/ers8000/Makefile
d7e23292 3287 src/server/drivers/h3c/Makefile
d594d378 3288 src/server/drivers/hpsw/Makefile
4e592faf
VK
3289 src/server/drivers/lib/Makefile
3290 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 3291 src/server/drivers/lib/cisco/Makefile
a73592db 3292 src/server/drivers/mikrotik/Makefile
81ecaf38 3293 src/server/drivers/netscreen/Makefile
e10e890e 3294 src/server/drivers/ntws/Makefile
c183a9f9 3295 src/server/drivers/ping3/Makefile
9b13553b 3296 src/server/drivers/procurve/Makefile
ac7e4032 3297 src/server/drivers/qtech-olt/Makefile
217e4d6a 3298 src/server/drivers/symbol-ws/Makefile
e5f4e3ac 3299 src/server/drivers/tb/Makefile
8cf94ffe 3300 src/server/drivers/ubnt/Makefile
6fad8870
VK
3301 src/server/hdlink/Makefile
3302 src/server/hdlink/jira/Makefile
d770a97c
VK
3303 src/server/include/Makefile
3304 src/server/libnxsrv/Makefile
3305 src/server/netxmsd/Makefile
52a2232c
VK
3306 src/server/pdsdrv/Makefile
3307 src/server/pdsdrv/rrdtool/Makefile
0c3c0c39 3308 src/server/tools/Makefile
0c3c0c39
AK
3309 src/server/tools/nxaction/Makefile
3310 src/server/tools/nxadm/Makefile
9191f6ad 3311 src/server/tools/nxap/Makefile
5b0c7d0d
VK
3312 src/server/tools/nxconfig/Makefile
3313 src/server/tools/nxconfig/res/Makefile
f90d7fc5 3314 src/server/tools/nxdbmgr/Makefile
9191f6ad 3315 src/server/tools/nxget/Makefile
d24fdaf4 3316 src/server/tools/nxupload/Makefile
623e2f0e
VK
3317 src/smsdrv/Makefile
3318 src/smsdrv/dummy/Makefile
3319 src/smsdrv/generic/Makefile
3320 src/smsdrv/kannel/Makefile
3321 src/smsdrv/nxagent/Makefile
3322 src/smsdrv/portech/Makefile
3323 src/smsdrv/slack/Makefile
3324 src/smsdrv/text2reach/Makefile
3325 src/smsdrv/websms/Makefile
c5c0f362
VK
3326 src/snmp/Makefile
3327 src/snmp/libnxsnmp/Makefile
3328 src/snmp/nxmibc/Makefile
3329 src/snmp/nxsnmpget/Makefile
3330 src/snmp/nxsnmpset/Makefile
3331 src/snmp/nxsnmpwalk/Makefile
9191f6ad 3332 src/sqlite/Makefile
f65df2b1 3333 src/tools/Makefile
f65df2b1 3334 src/tools/nxdevcfg/Makefile
56e13b13 3335 src/tools/nxencpasswd/Makefile
271e3971 3336 src/tools/nxgenguid/Makefile
1fd41bcd 3337 src/zlib/Makefile
9191f6ad 3338 sql/Makefile
33a10d92
VK
3339 tests/Makefile
3340 tests/include/Makefile
3341 tests/test-libnetxms/Makefile
a7a4c1e9 3342 tests/test-libnxcc/Makefile
66c11d49 3343 tests/test-libnxdb/Makefile
9ceab287 3344 tests/test-libnxsnmp/Makefile
0c3c0c39 3345 tools/Makefile
d16cf8a5
AK
3346])
3347
12249937
VK
3348AC_OUTPUT
3349
ef0c727b 3350echo "Updating libtool"
5cecf50e
AK
3351sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3352
779ce551 3353# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
5482ef16 3354if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
779ce551
VK
3355 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3356fi
3357
b677ef59
VK
3358# On AIX, correct OBJECT_MODE must be set before linking
3359# To avoid manual setting by user, we add this to libtool script
3360if test "x$PLATFORM" = "xAIX"; then
3361 head -n 1 ./libtool > ./libtool.new
3362 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
3363 tail -n +2 ./libtool >> ./libtool.new
3364 mv libtool.new libtool
3365 chmod +x ./libtool
3366fi
3367
ef0c727b
VK
3368#--------------------------------------------------------------------
3369# Print summary
3370#--------------------------------------------------------------------
a7442678 3371
a7442678
AK
3372echo
3373echo
3374echo
3375echo '---------------------------------------------------------------------'
3376echo ' Configure results'
3377echo '---------------------------------------------------------------------'
3378echo
8b86c5dc 3379 echo "Prefix : ${prefix}"
cbc4d191
VK
3380 echo "Platform : ${PLATFORM}"
3381 echo "Shared library suffix : ${SHLIB_SUFFIX}"
b8adb0f2
VK
3382if test "x$IPV6_SUPPORT" = "xyes"; then
3383 echo "IPv6 support : YES"
3384else
3385 echo "IPv6 support : NO"
3386fi
a7442678 3387if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 3388 echo "Build Server : YES"
7c48e2aa 3389 echo "Server libs : ${SERVER_LIBS}"
2cfe4482
VK
3390 if test "x${LDAP_SUPPORT}" = "xyes"; then
3391 echo "LDAP support : YES"
3392 else
3393 echo "LDAP support : NO"
3394 fi
058bf6fc
VK
3395 if test "x${XMPP_SUPPORT}" = "xyes"; then
3396 echo "XMPP support : YES"
3397 else
3398 echo "XMPP support : NO"
3399 fi
7fcdcb0c 3400 if test "x${ZEROMQ_SUPPORT}" = "xyes"; then
9df36f62
AK
3401 echo "ZeroMQ support : YES"
3402 else
3403 echo "ZeroMQ support : NO"
3404 fi
a7442678 3405else
8b86c5dc 3406 echo "Build Server : NO"
a7442678 3407fi
c54e483e 3408if test "x${HAVE_LIBCRYPTO}" = "xyes"; then
8b86c5dc 3409 echo "Encryption enabled : YES"
a7442678 3410else
8b86c5dc 3411 echo "Encryption enabled : NO"
a7442678 3412fi
12acf3d3
VK
3413if test "x${HAVE_LIBSSH}" = "xyes"; then
3414 echo "SSH support enabled : YES"
3415else
3416 echo "SSH support enabled : NO"
3417fi
a7442678 3418if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 3419 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 3420else
8b86c5dc 3421 echo "Build DB-Drivers : NO"
a7442678
AK
3422fi
3423if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 3424 echo "Build Clients : YES"
a7442678 3425else
8b86c5dc 3426 echo "Build Clients : NO"
a7442678
AK
3427fi
3428if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc 3429 echo "Build Agent : YES"
c7c6ce77 3430 echo "Agent extra components : ${AGENT_DIRS}"
8b86c5dc 3431 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 3432else
8b86c5dc 3433 echo "Build Agent : NO"
a7442678 3434fi
e8636669 3435if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
3436 echo "Build Static Agent : YES"
3437 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 3438else
8b86c5dc 3439 echo "Build Static Agent : NO"
e8636669 3440fi
8b86c5dc 3441if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 3442 echo "UNICODE build : YES"
8b86c5dc 3443else
a67fa146 3444 echo "UNICODE build : NO"
8b86c5dc 3445fi
551ec9ca
VK
3446if test "x${HAVE_LIBEXPAT}" = "xno"; then
3447 echo "Use internal libexpat : YES"
1bb6b449 3448else
551ec9ca 3449 echo "Use internal libexpat : NO"
1bb6b449 3450fi
17b35ccc
VK
3451if test "x${HAVE_LIBTRE}" = "xno"; then
3452 echo "Use internal libtre : YES"
3453else
3454 echo "Use internal libtre : NO"
3455fi
f5393033
VK
3456if test "x${HAVE_JANSSON}" = "xno"; then
3457 echo "Use internal libjansson : YES"
3458else
3459 echo "Use internal libjansson : NO"
3460fi
3d2bc3ae
VK
3461check_substr "$COMPONENTS" "sqlite"
3462if test $? = 0; then
3463 if test "x${HAVE_SQLITE}" = "xno"; then
3464 echo "Use internal sqlite : YES"
3465 else
3466 echo "Use internal sqlite : NO"
3467 fi
3468fi
f1b8f11c
VK
3469if test "x${HAVE_ZLIB}" = "xno"; then
3470 echo "Use internal zlib : YES"
3471else
3472 echo "Use internal zlib : NO"
1fd41bcd 3473fi
cc297a70
VK
3474if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
3475 echo "Force 32bit build : YES"
3476else
3477 echo "Force 32bit build : NO"
3478fi
7d8c91ef 3479
9113e749
VK
3480echo "C compiler : ${CC}"
3481echo "C++ compiler : ${CXX}"
7d8c91ef
VK
3482echo "CPPFLAGS : ${CPPFLAGS}"
3483echo "CXXFLAGS : ${CXXFLAGS}"
3484echo "CFLAGS : ${CFLAGS}"
3485echo "LDFLAGS : ${LDFLAGS}"
8d131dda 3486echo "LIBS : ${LIBS}"
7d8c91ef 3487
2cfe4482
VK
3488if test "x${MYSQL_CPPFLAGS}" != "x"; then
3489 echo "MySQL CPPFLAGS : ${MYSQL_CPPFLAGS}"
3490fi
3491if test "x${MYSQL_LDFLAGS}" != "x"; then
3492 echo "MySQL LDFLAGS : ${MYSQL_LDFLAGS}"
3493fi
6fce76d8 3494if test "x${MYSQL_LIBS}" != "x"; then
2cfe4482
VK
3495 echo "MySQL LIBS : ${MYSQL_LIBS}"
3496fi
3497
3498if test "x${PGSQL_CPPFLAGS}" != "x"; then
3499 echo "PostgreSQL CPPFLAGS : ${PGSQL_CPPFLAGS}"
3500fi
3501if test "x${PGSQL_LDFLAGS}" != "x"; then
3502 echo "PostgreSQL LDFLAGS : ${PGSQL_LDFLAGS}"
6fce76d8
VK
3503fi
3504if test "x${PGSQL_LIBS}" != "x"; then
2cfe4482
VK
3505 echo "PostgreSQL LIBS : ${PGSQL_LIBS}"
3506fi
3507
3508if test "x${ORACLE_CPPFLAGS}" != "x"; then
3509 echo "Oracle CPPFLAGS : ${ORACLE_CPPFLAGS}"
3510fi
3511if test "x${ORACLE_LDFLAGS}" != "x"; then
3512 echo "Oracle LDFLAGS : ${ORACLE_LDFLAGS}"
6fce76d8 3513fi
7d8c91ef 3514if test "x${ORACLE_LIBS}" != "x"; then
2cfe4482
VK
3515 echo "Oracle LIBS : ${ORACLE_LIBS}"
3516fi
3517
3518if test "x${ODBC_CPPFLAGS}" != "x"; then
3519 echo "ODBC CPPFLAGS : ${ODBC_CPPFLAGS}"
3520fi
3521if test "x${ODBC_LDFLAGS}" != "x"; then
3522 echo "ODBC LDFLAGS : ${ODBC_LDFLAGS}"
7d8c91ef 3523fi
6fce76d8 3524if test "x${ODBC_LIBS}" != "x"; then
2cfe4482
VK
3525 echo "ODBC LIBS : ${ODBC_LIBS}"
3526fi
3527
3528if test "x${DB2_CPPFLAGS}" != "x"; then
3529 echo "DB2 CPPFLAGS : ${DB2_CPPFLAGS}"
3530fi
3531if test "x${DB2_LDFLAGS}" != "x"; then
3532 echo "DB2 LDFLAGS : ${DB2_LDFLAGS}"
6fce76d8 3533fi
84277a0f 3534if test "x${DB2_LIBS}" != "x"; then
2cfe4482
VK
3535 echo "DB2 LIBS : ${DB2_LIBS}"
3536fi
3537
3538if test "x${INFORMIX_CPPFLAGS}" != "x"; then
3539 echo "Informix CPPFLAGS : ${INFORMIX_CPPFLAGS}"
3540fi
3541if test "x${INFORMIX_LDFLAGS}" != "x"; then
3542 echo "Informix LDFLAGS : ${INFORMIX_LDFLAGS}"
84277a0f 3543fi
37861c72 3544if test "x${INFORMIX_LIBS}" != "x"; then
2cfe4482 3545 echo "Informix LIBS : ${INFORMIX_LIBS}"
37861c72 3546fi
ecbed20c 3547
b14c3f22
VK
3548if test "x${TUXEDO_CPPFLAGS}" != "x"; then
3549 echo "Tuxedo CPPFLAGS : ${TUXEDO_CPPFLAGS}"
3550fi
3551if test "x${TUXEDO_LDFLAGS}" != "x"; then
3552 echo "Tuxedo LDFLAGS : ${TUXEDO_LDFLAGS}"
3553fi
73517e51
VK
3554if test "x${TUXEDO_LIBS}" != "x"; then
3555 echo "Tuxedo LIBS : ${TUXEDO_LIBS}"
3556fi
b14c3f22 3557
9df36f62
AK
3558if test "x${MONGODB_CPPFLAGS}" != "x"; then
3559 echo "MongoDB CPPFLAGS : ${MONGODB_CPPFLAGS}"
3560fi
3561if test "x${MONGODB_LDFLAGS}" != "x"; then
3562 echo "MongoDB LDFLAGS : ${MONGODB_LDFLAGS}"