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