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