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