new NXSL class "Event" attributes "source" and "sourceId"
[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
fecf6a2b
VK
110#--------------------------------------------------------------------
111# Common compilation flags
112#--------------------------------------------------------------------
113
842c22f4 114CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DTRE_WCHAR=1"
fecf6a2b
VK
115
116
ef0c727b
VK
117#--------------------------------------------------------------------
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
ef0c727b
VK
158AC_ARG_WITH(agent,
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
12313882
VK
587#--------------------------------------------------------------------
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
ef0c727b
VK
599#--------------------------------------------------------------------
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
ef0c727b
VK
900#--------------------------------------------------------------------
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
a4c97619 1493 LIBS="$LIBS -l$OPENSSL_LIBSSL -l$OPENSSL_LIBCRYPTO"
e0a77f08 1494 else
a4c97619 1495 LIBS="$LIBS -l$OPENSSL_LIBSSL -l$OPENSSL_LIBCRYPTO"
e0a77f08
VK
1496 fi
1497 else
096e561b 1498 AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO does not provide any suitable encryption algorithm)
e0a77f08 1499 fi
ef0c727b
VK
1500 ],
1501 [
096e561b 1502 AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO is required for encryption support)
ef0c727b
VK
1503 ])
1504fi
1505
1506
0322eed7
VK
1507#--------------------------------------------------------------------
1508# Checks for header files
1509#--------------------------------------------------------------------
1510
8d4bb054 1511AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h])
2e98cdb4 1512AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
e9c8eb1d 1513AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h net/nh.h sys/socket.h])
0322eed7
VK
1514AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1515AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
c1099678 1516AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h locale.h])
df9812a9 1517AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
5962498b 1518AC_CHECK_HEADERS([grp.h pwd.h malloc.h])
f09c2d05 1519AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1520[[#ifdef HAVE_SYS_TYPES_H
1521# include <sys/types.h>
1522#endif
1523#ifdef HAVE_SYS_TIME_H
1524# include <sys/time.h>
1525#endif
1526#ifdef HAVE_SYS_SOCKET_H
1527# include <sys/socket.h>
1528#endif
1529]])
1530
1531
8d4bb054
VK
1532#--------------------------------------------------------------------
1533# Checks for alloca
1534#--------------------------------------------------------------------
1535
1536AC_CHECK_HEADERS([alloca.h])
1537AC_MSG_CHECKING(for alloca)
1538AC_LANG_PUSH([C++])
1539AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1540#if HAVE_STDLIB_H
1541#include <stdlib.h>
1542#endif
1543#if HAVE_MALLOC_H
1544#include <malloc.h>
1545#endif
1546#if HAVE_ALLOCA_H
1547#include <alloca.h>
1548#endif
1549]],[[
1550 char *p = (char *)alloca(256);
1551 return (p != NULL) ? 0 : 1;
1552]])
1553],[
1554 AC_MSG_RESULT(yes)
1555 AC_DEFINE(HAVE_ALLOCA,1,Define to 1 if alloca function is available)
1556],[
1557 AC_MSG_RESULT(no)
1558 AC_DEFINE(HAVE_ALLOCA,0,Define to 1 if alloca function is available)
1559])
1560AC_LANG_POP([C++])
1561
1562
b8adb0f2
VK
1563#--------------------------------------------------------------------
1564# Checks for IPv6 support
1565#--------------------------------------------------------------------
1566
1567if test "x$DISABLE_IPV6" != "xyes"; then
1568 AC_CHECK_DECL(AF_INET6,,,[
1569#if HAVE_NETINET_IN_H
1570#include <netinet/in.h>
1571#endif
1572 ])
1573 if test "x$ac_cv_have_decl_AF_INET6" = "xyes"; then
1574 AC_CHECK_TYPE(struct sockaddr_in6, [
1575 AC_DEFINE(WITH_IPV6, 1, Define to have IPv6 support)
1576 IPV6_SUPPORT="yes"
1577 ],,[
1578#if HAVE_NETINET_IN_H
1579#include <netinet/in.h>
1580#endif
1581 ])
1582 fi
1583fi
1584
ef0c727b
VK
1585#--------------------------------------------------------------------
1586# Checks for other libs.
1587#--------------------------------------------------------------------
d16cf8a5 1588
e0760102 1589if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa 1590 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
1591 if test "x$DISABLE_READLINE" = "xno"; then
1592 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
7c48e2aa 1593
0a70c186
VK
1594 SAVED_LIBS="$LIBS"
1595 LIBS="$LIBS $SERVER_LIBS"
0322eed7 1596
0a70c186 1597 AC_CHECK_FUNCS([readline])
0322eed7 1598
0a70c186
VK
1599 # Check if passing rl_insert to rl_bind_key needs cast
1600 if test "$ac_cv_func_readline" = "yes"; then
1601 AC_LANG_PUSH([C++])
1602
1603 AC_MSG_CHECKING(for rl_insert cast)
0322eed7 1604
afd0c386 1605 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1606 [
1607#include <stdio.h>
1608#include <readline/readline.h>
0a70c186 1609 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7 1610 [
0a70c186
VK
1611 AC_MSG_RESULT((Function *))
1612 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1613 ],[
1614 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1615 [
1616#include <stdio.h>
1617#include <readline/readline.h>
1618 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ])],
1619 [
1620 AC_MSG_RESULT((rl_command_func_t *))
1621 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1622 ],[
1623 AC_MSG_RESULT(not needed)
1624 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1625 ]
1626 )
0322eed7
VK
1627 ]
1628 )
0322eed7 1629
0a70c186
VK
1630 AC_LANG_POP([C++])
1631 fi
1632 LIBS="$SAVED_LIBS"
0322eed7 1633 fi
e0760102
VK
1634fi
1635
3d2bc3ae
VK
1636check_substr "$COMPONENTS" "sqlite"
1637if test $? = 0; then
1638 if test "x$FORCE_INTERNAL_SQLITE" = "xyes"; then
1639 HAVE_SQLITE=no
1640 else
1641 OLD_LIBS="$LIBS"
1642 HAVE_SQLITE=yes
1643 AC_CHECK_HEADER(sqlite3.h,,HAVE_SQLITE=no)
1644 if test "x$HAVE_SQLITE" = "xyes"; then
1645 AC_CHECK_LIB(sqlite3, sqlite3_initialize, [], [ HAVE_SQLITE=no ])
1646 fi
1647 if test "x$HAVE_SQLITE" = "xyes"; then
b536ca1b
VK
1648 if test "x$cross_compiling" = "xyes"; then
1649 AC_MSG_WARN([Cross-compiling mode is active, assuming libsqlite3 is thread-safe])
1650 else
1651 AC_MSG_CHECKING(if libsqlite3 is thread-safe)
1652 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1653#include <sqlite3.h>
1654 ]],[[
1655 return sqlite3_threadsafe() ? 0 : 1;
1656 ]])
1657 ],[
1658 AC_MSG_RESULT(yes)
1659 ],[
1660 AC_MSG_RESULT(no)
1661 HAVE_SQLITE=no
1662 ])
1663 fi
3d2bc3ae
VK
1664 fi
1665 LIBS="$OLD_LIBS"
1666 fi
1667 if test "x$HAVE_SQLITE" = "xno"; then
1668 MODULES="sqlite $MODULES"
1669 fi
1670fi
1671
ef0c727b 1672if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1673 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1674 HAVE_ZLIB=no
1675 else
1676 HAVE_ZLIB=yes
1677 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1678 if test "x$HAVE_ZLIB" = "xyes"; then
1679 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1680 fi
1681 fi
1682 if test "x$HAVE_ZLIB" = "xno"; then
1683 MODULES="zlib $MODULES"
1684 fi
ef0c727b
VK
1685fi
1686
467c489f
VK
1687if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1688 HAVE_LIBEXPAT=no
1689else
1690 HAVE_LIBEXPAT=yes
1691 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1692 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1693fi
80ce37ac
VK
1694if test "x$HAVE_LIBEXPAT" = "xno"; then
1695 MODULES="libexpat $MODULES"
1bb6b449 1696fi
ef0c727b 1697
17b35ccc
VK
1698if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1699 HAVE_LIBTRE=no
1700else
1701 HAVE_LIBTRE=yes
1702 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1703 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1704fi
1705if test "x$HAVE_LIBTRE" = "xno"; then
1706 MODULES="libtre $MODULES"
1707 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1708
720c23d0
VK
1709 tre_version_1='0'
1710 tre_version_2='8'
1711 tre_version_3='0'
a67fa146
VK
1712 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1713 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1714 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1715 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1716 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1717 AC_SUBST(TRE_VERSION, $tre_version)
1718
1719 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])
1720 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1721fi
ef0c727b 1722
f5393033
VK
1723if test "x$FORCE_INTERNAL_JANSSON" = "xyes"; then
1724 HAVE_JANSSON=no
1725else
1726 HAVE_JANSSON=yes
1727 AC_CHECK_HEADER(jansson.h,,HAVE_JANSSON=no)
1728 AC_CHECK_LIB(jansson, json_object, [ HAVE_JANSSON=yes ], [ HAVE_JANSSON=no ])
1729fi
1730if test "x$HAVE_JANSSON" = "xno"; then
1731 MODULES="jansson $MODULES"
1732fi
1733
4050bafb
VK
1734if test "x$DISABLE_LMSENSORS" = "xno"; then
1735 HAVE_LMSENSORS=yes
1736 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1737 if test "x$HAVE_LMSENSORS" = "xyes"; then
1738 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1739 fi
1740 if test "x$HAVE_LMSENSORS" = "xyes"; then
1741 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1742 fi
38bfa5da
AK
1743fi
1744
0a4194c2
AK
1745AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
1746if test "x$HAVE_LIBCURL" = "xyes"; then
2368dc85
VK
1747 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
1748 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
1749#ifdef HAVE_CURL_CURL_H
1750#include <curl/curl.h>
1751#endif
1752])
0a4194c2 1753fi
d9177dd1 1754
0a4194c2 1755if test "x$HAVE_LIBCURL" = "xyes"; then
c80c69bd 1756 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
50638b08 1757 SMSDRV_DIRS="$SMSDRV_DIRS kannel slack text2reach websms"
6fad8870 1758 HDLINK_DIRS="$HDLINK_DIRS jira"
3bc41d67 1759 AC_DEFINE(HAVE_LIBCURL, 1, Define to 1 if libcurl is available)
0a4194c2
AK
1760fi
1761
2cfe4482
VK
1762if test "x$LDAP_SUPPORT" = "xyes"; then
1763 AC_CHECK_HEADER(ldap.h,HAVE_LDAP=yes,HAVE_LDAP=no)
1764 if test "x$HAVE_LDAP" = "xyes"; then
1765 AC_CHECK_LIB(ldap, ldap_init, [ HAVE_LDAP=yes ], [ HAVE_LDAP=no ])
e8ef7fe1 1766 if test "x$HAVE_LDAP" = "xyes"; then
a0008bce 1767 AC_CHECK_LIB(lber, ber_init, [ SERVER_LIBS="-llber $SERVER_LIBS" ])
e8ef7fe1 1768 fi
2cfe4482 1769 fi
d9177dd1 1770 if test "x$HAVE_LDAP" = "xyes"; then
1771 SERVER_LIBS="-lldap $SERVER_LIBS"
2cfe4482 1772 AC_DEFINE(WITH_LDAP, 1, Define to 1 if you have LDAP libraries and headers)
d95c3dad
A
1773 AC_CHECK_HEADERS([ldap_ssl.h],,,
1774 [
1775#include <ldap.h>
a164b767 1776 ])
d95c3dad
A
1777 AC_CHECK_TYPES([ber_int_t],,,
1778 [
1779#include <ldap.h>
1780#if HAVE_LDAP_SSL_H
1781#include <ldap_ssl.h>
1782#endif
daa828ee 1783 ])
d95c3dad
A
1784
1785 OLD_LIBS="$LIBS"
1786 LIBS="$LIBS -lldap"
1787 AC_CHECK_FUNCS([ldap_initialize ldapssl_init])
1788 AC_CHECK_FUNCS([ldap_control_create ldap_create_control nsldapi_build_control])
1789 AC_CHECK_FUNCS([ldap_create_page_control ldap_parse_page_control])
1790 LIBS="$OLD_LIBS"
1791
1792 AC_CHECK_DECLS([nsldapi_build_control],,,
1793 [
1794#include <ldap.h>
1795#if HAVE_LDAP_SSL_H
1796#include <ldap_ssl.h>
1797#endif
b00236dd 1798 ])
d9177dd1 1799 fi
2cfe4482 1800 LDAP_SUPPORT="$HAVE_LDAP"
d9177dd1 1801fi
1802
ef0c727b
VK
1803#--------------------------------------------------------------------
1804# Checks for data types
1805#--------------------------------------------------------------------
1806
d16cf8a5
AK
1807AC_CHECK_SIZEOF(short)
1808AC_CHECK_SIZEOF(int)
1809AC_CHECK_SIZEOF(long)
1810AC_CHECK_SIZEOF(long long)
1811
1812AC_TYPE_PID_T
d16cf8a5
AK
1813AC_TYPE_SIZE_T
1814AC_STRUCT_TIMEZONE
1815
3071f10a 1816AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1817AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1818#if HAVE_SYS_TYPES_H
1819#include <sys/types.h>
1820#endif
1821#if HAVE_SYS_SOCKET_H
1822#include <sys/socket.h>
1823#endif
1824])
e0293f7f
VK
1825AC_CHECK_TYPES([struct stat64],,,[
1826#if HAVE_SYS_STAT_H
1827#include <sys/stat.h>
1828#endif
1829])
521d90e7 1830
e25cadc9 1831
ef0c727b
VK
1832#--------------------------------------------------------------------
1833# Checks for functions
1834#--------------------------------------------------------------------
d16cf8a5
AK
1835
1836AC_FUNC_ERROR_AT_LINE
d16cf8a5 1837AC_FUNC_MEMCMP
d16cf8a5
AK
1838AC_FUNC_SELECT_ARGTYPES
1839AC_FUNC_STRFTIME
1840AC_FUNC_STRTOD
1841AC_FUNC_VPRINTF
1842
80ce37ac 1843AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
fdb710a7 1844AC_CHECK_FUNCS([strrchr strlwr strtok_r strtol strtoul strtoll strtoull setlocale])
467e30e1 1845AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1846AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
ecdf8898 1847AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r getaddrinfo])
5962498b 1848AC_CHECK_FUNCS([itoa _itoa isatty getgrnam getpwnam malloc_info malloc_trim])
aa24418a 1849
9757ca46 1850AC_CHECK_DECLS([nanosleep, daemon, strerror])
be6467e9 1851
6f95ef89
VK
1852# Do not use inet_pton on Solaris as it has binary compatibility problems
1853if test "$PLATFORM" != "SunOS"; then
1854 AC_CHECK_FUNCS([inet_pton])
1855fi
1856
b0823d06
VK
1857# Check if strerror_r is POSIX-compliant
1858if test "$ac_cv_func_strerror_r" = "yes"; then
1859 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1860 AC_LANG_PUSH([C++])
1861 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1862#if HAVE_STRING_H
1863#include <string.h>
1864#endif
1865#if HAVE_ERRNO_H
1866#include <errno.h>
1867#endif
b0823d06 1868 ]],[[
7f9423af
VK
1869 int e;
1870 char buffer[256];
1871 e = strerror_r(1, buffer, 256);
1872 return e;
b0823d06
VK
1873 ]])
1874 ],[
1875 AC_MSG_RESULT(yes)
1876 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1877 ],[
1878 AC_MSG_RESULT(no)
1879 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1880 ])
1881 AC_LANG_POP([C++])
1882fi
1883
be6467e9
VK
1884# Check if struct tm has tm_gmtoff member
1885AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1886AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1887#if HAVE_TIME_H
1888#include <time.h>
1889#endif
1890#if HAVE_SYS_TIME_H
1891#include <sys/time.h>
1892#endif
1893]],[[
be6467e9
VK
1894 struct tm t;
1895 return t.tm_gmtoff;
be6467e9
VK
1896]])
1897],[
1898AC_MSG_RESULT(yes)
1899AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1900],[
1901AC_MSG_RESULT(no)
1902])
d16cf8a5 1903
f91feddc 1904AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1905AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1906
c6491611
VK
1907# asprintf, scprintf, etc.
1908AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1909AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
342a701d 1910AC_CHECK_FUNCS([snprintf vsnprintf])
c6491611
VK
1911
1912AC_MSG_CHECKING(whether snprintf returns required buffer size)
1913AC_RUN_IFELSE(
1914 [AC_LANG_PROGRAM([
1915#include <stdio.h>
1916#include <string.h>
1917 ], [
1918 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1919 ])
1920 ],
1921 [ AC_MSG_RESULT(yes)
1922 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1923 ],
1924 [ AC_MSG_RESULT(no) ],
1925 [ AC_MSG_RESULT(no) ]
1926)
1927
2f64a076
VK
1928AC_MSG_CHECKING(whether free correctly handles NULL pointer)
1929AC_RUN_IFELSE(
1930 [AC_LANG_PROGRAM([
1931#include <stdlib.h>
1932 ], [
1933 free(NULL);
1934 return 0;
1935 ])
1936 ],
1937 [ AC_MSG_RESULT(yes)
1938 AC_DEFINE(FREE_IS_NULL_SAFE, 1, Define to 1 if free corectly handles NULL pointer)
1939 ],
1940 [ AC_MSG_RESULT(no) ],
1941 [ AC_MSG_RESULT(no) ]
1942)
1943
c6491611 1944
ef0c727b
VK
1945#--------------------------------------------------------------------
1946# Checks for macros and definitions
1947#--------------------------------------------------------------------
dff54fed 1948
ef0c727b
VK
1949AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1950#ifdef HAVE_SYS_TYPES_H
99e50bb7 1951#include <sys/types.h>
ef0c727b
VK
1952#endif
1953#if HAVE_BYTESWAP_H
1954#include <byteswap.h>
1955#endif
1956#if HAVE_NETINET_IN_H
1957#include <netinet/in.h>
1958#endif
1959#if HAVE_NET_NH_H
1960#include <net/nh.h>
1961#endif
1962])
aa24418a
VK
1963AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1964#ifdef HAVE_UNISTD_H
1965#include <unistd.h>
1966#endif
1967#ifdef HAVE_DLFCN_H
1968#include <dlfcn.h>
1969#endif
1970])
ce7565e7
VK
1971AC_CHECK_DECLS([va_copy, __va_copy],,,[
1972#ifdef HAVE_UNISTD_H
1973#include <unistd.h>
1974#endif
1975#ifdef HAVE_STDARG_H
1976#include <stdarg.h>
1977#endif
1978#ifdef HAVE_STDLIB_H
1979#include <stdlib.h>
1980#endif
1981])
dff54fed 1982
dff54fed 1983
df9812a9
VK
1984#--------------------------------------------------------------------
1985# getopt
1986#--------------------------------------------------------------------
1987
1988if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1989 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1990else
1991 AC_CHECK_HEADERS([getopt.h])
1992 AC_CHECK_LIB(gnugetopt, getopt_long)
1993 AC_CHECK_DECLS([getopt_long],,,[
1994#if HAVE_GETOPT_H
1995#include <getopt.h>
1996#endif
1997 ])
1998fi
1999
2000
671651a1
VK
2001#--------------------------------------------------------------------
2002# Linux specific checks
2003#--------------------------------------------------------------------
2004
2005if test "x$PLATFORM" = "xLinux"; then
2006 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
2007 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
2008#if HAVE_SYS_REBOOT_H
2009#include <sys/reboot.h>
2010#endif
2011 ])
2012 AC_CHECK_FUNCS([reboot],,,[
2013#if HAVE_SYS_REBOOT_H
2014#include <sys/reboot.h>
2015#endif
2016 ])
f92a016a
VK
2017
2018 AC_CHECK_HEADERS([jemalloc/jemalloc.h],
2019 [
2020 AC_CHECK_LIB(jemalloc, malloc,
2021 [
2022 WITH_JEMALLOC="yes"
2023 AC_DEFINE(WITH_JEMALLOC,1,Define to 1 if libjemalloc is used)
2024 ])
2025 ])
671651a1
VK
2026fi
2027
2028
ef0c727b
VK
2029#--------------------------------------------------------------------
2030# AIX specific checks
2031#--------------------------------------------------------------------
d16cf8a5 2032
ef0c727b
VK
2033if test "x$PLATFORM" = "xAIX"; then
2034 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 2035 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
2036#if HAVE_PROCINFO_H
2037#include <procinfo.h>
2038#endif
2039 ])
ef0c727b
VK
2040 AC_CHECK_FUNCS([getprocs64],,,[
2041#if HAVE_PROCINFO_H
2042#include <procinfo.h>
6cd41ceb 2043#endif
ef0c727b 2044 ])
7e56bf2e
VK
2045fi
2046
cd4c8ca3 2047
f47bd4ca
VK
2048#--------------------------------------------------------------------
2049# Solaris specific checks
2050#--------------------------------------------------------------------
2051
2052if test "x$PLATFORM" = "xSunOS"; then
2053 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
2054#include <sys/atomic.h>
2055 ])
2056fi
2057
2058
ba8db57b
VK
2059#--------------------------------------------------------------------
2060# HP-UX specific checks
2061#--------------------------------------------------------------------
2062
2063if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 2064 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
2065 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
2066#if HAVE_NET_IF_H
2067#include <net/if.h>
2068#endif
2069 ])
2070 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
2071#if HAVE_SYS_MIB_H
2072#include <sys/mib.h>
2073#endif
2074 ])
cfd95c74
VK
2075
2076 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
2077 AC_LANG_PUSH([C++])
2078 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2079#include <sys/pstat.h>
2080 ]], [[
2081pst_diskinfo d;
2082int x;
2083x = (int)d.psd_dkread;
2084x = (int)d.psd_dkwrite;
2085 ]])],
2086 [
2087 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
2088 AC_MSG_RESULT(yes)
2089 ],
2090 [
2091 AC_MSG_RESULT(no)
2092 ])
2093 AC_LANG_POP([C++])
ba8db57b
VK
2094fi
2095
2096
aa24418a
VK
2097#--------------------------------------------------------------------
2098# *BSD specific checks
2099#--------------------------------------------------------------------
2100
2101AC_CHECK_LIB(kvm, kvm_open)
2102AC_CHECK_FUNCS([kvm_getswapinfo])
2103AC_CHECK_TYPES([struct kinfo_proc2],,,[
2104#if HAVE_SYS_SYSCTL_H
2105#include <sys/sysctl.h>
2106#endif
2107])
2108
2109
28ba6824
VK
2110#--------------------------------------------------------------------
2111# FreeBSD specific checks
2112#--------------------------------------------------------------------
2113
2114if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
2115 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
2116#if HAVE_SYS_TYPES_H
2117#include <sys/types.h>
2118#endif
2119#if HAVE_SYS_SOCKET_H
2120#include <sys/socket.h>
2121#endif
2122#include <net/route.h>
2123 ])
28ba6824
VK
2124fi
2125
2126
ea6615cf
VK
2127#--------------------------------------------------------------------
2128# OpenBSD specific checks
2129#--------------------------------------------------------------------
2130
2131if test "x$PLATFORM" = "xOpenBSD"; then
2132 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
2133 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2134#include <sys/param.h>
2135#include <sys/proc.h>
2136#include <kvm.h>
2137#include <sys/user.h>
2138 ]],[[
2139 int count;
2140 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
2141 return 0;
2142 ]])
2143 ],[
2144 AC_MSG_RESULT(yes)
2145 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2146 ],[
2147 AC_MSG_RESULT(no)
2148 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2149 ])
2150
2151 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
2152 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2153#include <sys/param.h>
2154#include <sys/proc.h>
2155#include <kvm.h>
2156#include <sys/user.h>
2157 ]],[[
2158 struct kinfo_proc p;
2159 return p.kp_proc.p_pid;
2160 ]])
2161 ],[
2162 AC_MSG_RESULT(yes)
2163 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
2164 ],[
2165 AC_MSG_RESULT(no)
2166 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
2167 ])
2168fi
2169
2170
ef8a3c32
VK
2171#--------------------------------------------------------------------
2172# Minix specific checks
2173#--------------------------------------------------------------------
2174
2175if test "x$PLATFORM" = "xMinix"; then
2176 AC_CHECK_HEADERS([minix/minlib.h])
2177fi
2178
2179
ef0c727b
VK
2180#--------------------------------------------------------------------
2181# Check for UNICODE stuff
2182#--------------------------------------------------------------------
3e39fcde 2183
5a82ecc7 2184AC_CHECK_HEADERS([wchar.h wctype.h iconv.h widec.h])
aa24418a 2185AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
2186#if HAVE_WCHAR_H
2187#include <wchar.h>
2188#endif
2189])
f172d7b7
VK
2190AC_CHECK_SIZEOF(wchar_t,,[
2191#if HAVE_WCHAR_H
2192#include <wchar.h>
2193#endif
2194])
fdf1ed50
VK
2195AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper towlower])
2196AC_CHECK_FUNCS([wcslwr wcserror wcserror_r wfopen wfopen64 fputws putws])
2197AC_CHECK_FUNCS([wopen wstat waccess wgetenv wrename wunlink wremove wchdir])
2198AC_CHECK_FUNCS([wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod vwscanf])
2199AC_CHECK_FUNCS([vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
fdb710a7 2200AC_CHECK_FUNCS([mbstowcs mbsrtowcs itow _itow wcsftime wcstok])
dff54fed 2201
465bd4ff
VK
2202AC_CHECK_DECLS([putws],,,[
2203#if HAVE_WCHAR_H
2204#include <wchar.h>
2205#endif
2206])
2207
75b4d48e
VK
2208if test "x$ac_cv_func_wcsftime" = "xyes"; then
2209 AC_MSG_CHECKING(whether wcsftime is working correctly)
2210 AC_RUN_IFELSE(
2211 [AC_LANG_PROGRAM([
2212#include <stdio.h>
2213#ifdef HAVE_UNISTD_H
2214#include <unistd.h>
2215#endif
2216#ifdef HAVE_TIME_H
2217#include <time.h>
2218#endif
2219#ifdef HAVE_SYS_TIME_H
2220#include <sys/time.h>
2221#endif
2222#if HAVE_WCHAR_H
2223#include <wchar.h>
2224#endif
2225 ], [[
2226 wchar_t buffer[64];
2227 struct tm *ltm;
2228 time_t t;
2229
2230 t = time(NULL);
2231 ltm = localtime(&t);
2232 wcsftime(buffer, 64, L"%Y", ltm);
2233 return wcstol(buffer, NULL, 10) == ltm->tm_year + 1900 ? 0 : 1;
2234 ]])
2235 ],
2236 [ AC_MSG_RESULT(yes)
2237 AC_DEFINE(WORKING_WCSFTIME, 1, Define to 1 if wcsftime is working correctly)
2238 ],
2239 [ AC_MSG_RESULT(no) ],
2240 [ AC_MSG_RESULT(no) ]
2241 )
2242fi
2243
3265ba38 2244if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 2245 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 2246 [ ac_found_iconv=yes
8d131dda 2247 LIBS="$LIBS -liconv"
75c30ed4
VK
2248 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
2249 ],
2250 [
2251 AC_CHECK_LIB(iconv, iconv,
2252 [ ac_found_iconv=yes
8d131dda 2253 LIBS="$LIBS -liconv"
75c30ed4
VK
2254 ])
2255 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
2256 ])
dff54fed
VK
2257else
2258 ac_found_iconv=no
ef0c727b 2259 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 2260fi
93571e7f 2261
3bf0df9f
VK
2262AC_MSG_CHECKING(whether fgetws can be used with popen)
2263AC_RUN_IFELSE(
2264 [AC_LANG_PROGRAM([
2265#include <stdio.h>
2266#ifdef HAVE_UNISTD_H
2267#include <unistd.h>
2268#endif
2269#if HAVE_WCHAR_H
2270#include <wchar.h>
2271#endif
2272 ], [[
2273 int rc = 1;
2274 wchar_t line[4096];
2275 FILE *f = popen("echo test", "r");
2276 if(f!=NULL)
2277 {
2278 fgetws(line, 4096, f);
2279 pclose(f);
2280 rc = 0;
2281 }
2282 return rc;
2283 ]])
2284 ],
2285 [ AC_MSG_RESULT(yes)
2286 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
2287 ],
2288 [ AC_MSG_RESULT(no) ],
2289 [ AC_MSG_RESULT(no) ]
2290)
2291
93571e7f
VK
2292AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
2293AC_RUN_IFELSE(
2294 [AC_LANG_PROGRAM([
2295#if HAVE_ICONV_H
2296#include <iconv.h>
2297#endif
2298 ], [
2299 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
2300 ])
2301 ],
2302 [ AC_MSG_RESULT(yes)
2303 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
2304 valid_ucs2_code="UCS-2-INTERNAL"
2305 ],
2306 [ AC_MSG_RESULT(no) ],
2307 [ AC_MSG_RESULT(no) ]
2308)
2309
2310AC_MSG_CHECKING(whether iconv supports UCS-2)
2311AC_RUN_IFELSE(
2312 [AC_LANG_PROGRAM([
2313#if HAVE_ICONV_H
2314#include <iconv.h>
2315#endif
2316 ], [
2317 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
2318 ])
2319 ],
2320 [ AC_MSG_RESULT(yes)
2321 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
2322 valid_ucs2_code="UCS-2"
2323 ],
2324 [ AC_MSG_RESULT(no) ],
8b86c5dc 2325 [ AC_MSG_RESULT(no) ]
93571e7f
VK
2326)
2327
2328AC_MSG_CHECKING(whether iconv supports UCS2)
2329AC_RUN_IFELSE(
2330 [AC_LANG_PROGRAM([
2331#if HAVE_ICONV_H
2332#include <iconv.h>
2333#endif
2334 ], [
2335 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
2336 ])
2337 ],
2338 [ AC_MSG_RESULT(yes)
2339 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
2340 valid_ucs2_code="UCS2"
2341 ],
2342 [ AC_MSG_RESULT(no) ],
2343 [ AC_MSG_RESULT(no) ]
2344)
2345
44bccbbc
VK
2346AC_MSG_CHECKING(whether iconv supports UCS-2BE)
2347AC_RUN_IFELSE(
2348 [AC_LANG_PROGRAM([
2349#if HAVE_ICONV_H
2350#include <iconv.h>
2351#endif
2352 ], [
2353 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
2354 ])
2355 ],
2356 [ AC_MSG_RESULT(yes)
2357 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
2358 valid_ucs2_code="UCS-2BE"
2359 ],
2360 [ AC_MSG_RESULT(no) ],
2361 [ AC_MSG_RESULT(no) ]
2362)
2363
6e17f325
VK
2364AC_MSG_CHECKING(whether iconv supports UCS-2LE)
2365AC_RUN_IFELSE(
2366 [AC_LANG_PROGRAM([
2367#if HAVE_ICONV_H
2368#include <iconv.h>
2369#endif
2370 ], [
2371 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
2372 ])
2373 ],
2374 [ AC_MSG_RESULT(yes)
2375 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
2376 valid_ucs2_code="UCS-2LE"
2377 ],
2378 [ AC_MSG_RESULT(no) ],
2379 [ AC_MSG_RESULT(no) ]
2380)
2381
4a4e1feb
VK
2382AC_MSG_CHECKING(whether iconv supports UTF-16)
2383AC_RUN_IFELSE(
2384 [AC_LANG_PROGRAM([
2385#if HAVE_ICONV_H
2386#include <iconv.h>
2387#endif
2388 ], [
2389 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
2390 ])
2391 ],
2392 [ AC_MSG_RESULT(yes)
2393 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
2394 valid_ucs2_code="UTF-16"
2395 ],
2396 [ AC_MSG_RESULT(no) ],
2397 [ AC_MSG_RESULT(no) ]
2398)
2399
8b86c5dc
VK
2400AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
2401AC_RUN_IFELSE(
2402 [AC_LANG_PROGRAM([
2403#if HAVE_ICONV_H
2404#include <iconv.h>
2405#endif
2406 ], [
2407 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
2408 ])
2409 ],
2410 [ AC_MSG_RESULT(yes)
2411 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
2412 valid_ucs4_code="UCS-4-INTERNAL"
2413 ],
2414 [ AC_MSG_RESULT(no) ],
2415 [ AC_MSG_RESULT(no) ]
2416)
2417
2418AC_MSG_CHECKING(whether iconv supports UCS-4)
2419AC_RUN_IFELSE(
2420 [AC_LANG_PROGRAM([
2421#if HAVE_ICONV_H
2422#include <iconv.h>
2423#endif
2424 ], [
2425 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
2426 ])
2427 ],
2428 [ AC_MSG_RESULT(yes)
2429 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
2430 valid_ucs4_code="UCS-4"
2431 ],
2432 [ AC_MSG_RESULT(no) ],
2433 [ AC_MSG_RESULT(no) ]
2434)
2435
2436AC_MSG_CHECKING(whether iconv supports UCS4)
2437AC_RUN_IFELSE(
2438 [AC_LANG_PROGRAM([
2439#if HAVE_ICONV_H
2440#include <iconv.h>
2441#endif
2442 ], [
2443 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
2444 ])
2445 ],
2446 [ AC_MSG_RESULT(yes)
2447 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2448 valid_ucs4_code="UCS4"
2449 ],
2450 [ AC_MSG_RESULT(no) ],
2451 [ AC_MSG_RESULT(no) ]
2452)
2453
2454AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2455AC_RUN_IFELSE(
2456 [AC_LANG_PROGRAM([
2457#if HAVE_ICONV_H
2458#include <iconv.h>
2459#endif
2460 ], [
2461 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2462 ])
2463 ],
2464 [ AC_MSG_RESULT(yes)
2465 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2466 valid_ucs4_code="UCS-4BE"
2467 ],
2468 [ AC_MSG_RESULT(no) ],
2469 [ AC_MSG_RESULT(no) ]
2470)
2471
6e17f325
VK
2472AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2473AC_RUN_IFELSE(
2474 [AC_LANG_PROGRAM([
2475#if HAVE_ICONV_H
2476#include <iconv.h>
2477#endif
2478 ], [
2479 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2480 ])
2481 ],
2482 [ AC_MSG_RESULT(yes)
2483 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2484 valid_ucs4_code="UCS-4LE"
2485 ],
2486 [ AC_MSG_RESULT(no) ],
2487 [ AC_MSG_RESULT(no) ]
2488)
2489
4a4e1feb
VK
2490AC_MSG_CHECKING(whether iconv supports UTF-32)
2491AC_RUN_IFELSE(
2492 [AC_LANG_PROGRAM([
2493#if HAVE_ICONV_H
2494#include <iconv.h>
2495#endif
2496 ], [
2497 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2498 ])
2499 ],
2500 [ AC_MSG_RESULT(yes)
2501 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2502 valid_ucs4_code="UTF-32"
2503 ],
2504 [ AC_MSG_RESULT(no) ],
2505 [ AC_MSG_RESULT(no) ]
2506)
2507
93571e7f
VK
2508AC_MSG_CHECKING(whether iconv supports //IGNORE)
2509AC_RUN_IFELSE(
2510 [AC_LANG_PROGRAM([
2511#if HAVE_ICONV_H
2512#include <iconv.h>
2513#endif
2514 ], [
2515 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2516 ])
2517 ],
2518 [ AC_MSG_RESULT(yes)
2519 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2520 ],
2521 [ AC_MSG_RESULT(no) ],
2522 [ AC_MSG_RESULT(no) ]
2523)
3e39fcde 2524
bd96aa53
VK
2525AC_MSG_CHECKING(whether iconv supports state reset)
2526AC_RUN_IFELSE(
2527 [AC_LANG_PROGRAM([
2528#include <stdio.h>
2529#if HAVE_ICONV_H
2530#include <iconv.h>
2531#endif
2532 ], [
2533 iconv_t cd = iconv_open("UTF-8","$valid_ucs2_code");
2534 if (cd == (iconv_t)(-1)) return 1;
2535 return iconv(cd, NULL, NULL, NULL, NULL) != 0;
2536 ])
2537 ],
2538 [ AC_MSG_RESULT(yes)
2539 AC_DEFINE(HAVE_ICONV_STATE_RESET, 1, Define to 1 if iconv supports state reset)
2540 ],
2541 [ AC_MSG_RESULT(no) ],
2542 [ AC_MSG_RESULT(no) ]
2543)
2544
2545AC_MSG_CHECKING(whether iconv descriptor cache is needed)
2546case $enable_iconv_cache in
2547 auto)
2548 case $PLATFORM in
2549 SunOS|HP-UX|AIX)
2550 enable_iconv_cache=yes
2551 ;;
2552 *)
2553 enable_iconv_cache=no
2554 ;;
2555 esac
2556 ;;
2557 yes|no)
2558 ;;
2559 *)
2560 AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
2561 ;;
2562esac
2563if test "x$enable_iconv_cache" = "xyes"; then
2564 AC_DEFINE(WITH_ICONV_CACHE, 1, Define to 1 to enable iconv descriptor cache)
2565fi
2566AC_MSG_RESULT($enable_iconv_cache)
2567
19619a35
AK
2568# taken from ZSH's configure
2569# Check if iconv uses const in prototype declaration
24b1570c 2570if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 2571 AC_LANG_PUSH([C++])
19619a35 2572 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
2573 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2574#include <stdlib.h>
f6a2136d 2575#if HAVE_ICONV_H
7f9423af 2576#include <iconv.h>
7f9423af 2577#endif
f6a2136d
VK
2578 ]],
2579 [[
3e51d371
VK
2580 char **p = NULL;
2581 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 2582 ]])],
3e51d371
VK
2583 [ac_cv_iconv_const=const],
2584 [ac_cv_iconv_const=])])
53c96e2d 2585 AC_LANG_POP([C++])
19619a35
AK
2586 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2587 [Define as const if the declaration of iconv() needs const.])
2588fi
2589
a67fa146
VK
2590if test "x$ac_cv_type_wchar_t" = "xyes"; then
2591 if test $ac_cv_sizeof_wchar_t -eq 2; then
2592 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2593 fi
8b86c5dc 2594
a67fa146
VK
2595 if test $ac_cv_sizeof_wchar_t -eq 4; then
2596 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2597 fi
2598
2599 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2600 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2601 fi
2602else
2603 if test "x$BUILD_UNICODE" = "xyes"; then
2604 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2605 fi
8b86c5dc
VK
2606fi
2607
c29360a9 2608
ca0f4ea3
VK
2609#--------------------------------------------------------------------
2610# MySQL
2611#--------------------------------------------------------------------
2612
2613check_substr "$COMPONENTS" "mysql"
2614if test $? = 0; then
9f1ea006
VK
2615 OLD_CPPFLAGS="$CPPFLAGS"
2616 OLD_LDFLAGS="$LDFLAGS"
2617 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2618
2619 CPPFLAGS="$CPPFLAGS $MYSQL_CPPFLAGS"
2620 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
2621 if test "x$MYSQL_LD_RUN_PATH" != "x"; then
2622 LD_RUN_PATH="${MYSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2623 fi
2624
b93fd1c1 2625 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MySQL client installation]))
9f1ea006 2626
6fce76d8 2627 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2628 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2629
8d131dda
VK
2630 OLD_LIBS="$LIBS"
2631 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2632
ca0f4ea3 2633 AC_CHECK_FUNCS(mysql_real_escape_string)
9f1ea006
VK
2634
2635 CPPFLAGS="$OLD_CPPFLAGS"
2636 LDFLAGS="$OLD_LDFLAGS"
2637 LD_RUN_PATH="$OLD_LD_RUN_PATH"
8d131dda 2638 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2639fi
2640
2641
58ed4897
VK
2642#--------------------------------------------------------------------
2643# PostgreSQL
2644#--------------------------------------------------------------------
2645
203458b7 2646check_substr "$COMPONENTS" "pgsql"
58ed4897 2647if test $? = 0; then
b535eed6
VK
2648 OLD_CPPFLAGS="$CPPFLAGS"
2649 OLD_LDFLAGS="$LDFLAGS"
2650 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2651
2652 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
2653 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
2654 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2655 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2656 fi
2657
9f1ea006
VK
2658 AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([Cannot find libpq-fe.h - check your PostgreSQL client installation]))
2659
7e19eef6
VK
2660 AC_CHECK_DECLS([PGRES_SINGLE_TUPLE],,,[
2661#include <libpq-fe.h>
2662 ])
2663
58ed4897 2664 AC_CHECK_LIB(m, floor)
b535eed6
VK
2665 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2666 if test "x$PLATFORM" = "xSunOS"; then
2667 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
2668 LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
2669 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2670 PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
2671 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${OLD_LD_RUN_PATH:+:}${OLD_LD_RUN_PATH}"
2672 fi
2673 unset ac_cv_lib_pq_PQconnectdb
2674 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2675 AC_MSG_ERROR(libpq is required for PostgreSQL support)])
2676 else
2677 AC_MSG_ERROR(libpq is required for PostgreSQL support)
2678 fi
2679 ])
6fce76d8 2680
b535eed6
VK
2681 CPPFLAGS="$OLD_CPPFLAGS"
2682 LDFLAGS="$OLD_LDFLAGS"
2683 LD_RUN_PATH="$OLD_LD_RUN_PATH"
58ed4897
VK
2684fi
2685
2686
9c29f76e
VK
2687#--------------------------------------------------------------------
2688# ODBC
2689#--------------------------------------------------------------------
2690
2691check_substr "$COMPONENTS" "odbc"
2692if test $? = 0; then
2cfe4482
VK
2693 OLD_CPPFLAGS="$CPPFLAGS"
2694 OLD_LDFLAGS="$LDFLAGS"
2695 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2696
2697 CPPFLAGS="$CPPFLAGS $ODBC_CPPFLAGS"
b535eed6 2698 LDFLAGS="$LDFLAGS $ODBC_LDFLAGS"
2cfe4482
VK
2699 if test "x$ODBC_LD_RUN_PATH" != "x"; then
2700 LD_RUN_PATH="${ODBC_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2701 fi
2702
6fce76d8 2703 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2704 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2705 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2706 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2707 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2708 fi
2cfe4482
VK
2709
2710 CPPFLAGS="$OLD_CPPFLAGS"
2711 LDFLAGS="$OLD_LDFLAGS"
2712 LD_RUN_PATH="$OLD_LD_RUN_PATH"
9c29f76e
VK
2713fi
2714
2715
41b4790d
VK
2716#--------------------------------------------------------------------
2717# Oracle
2718#--------------------------------------------------------------------
2719
2720check_substr "$COMPONENTS" "oracle"
2721if test $? = 0; then
2cfe4482
VK
2722 OLD_CPPFLAGS="$CPPFLAGS"
2723 OLD_LDFLAGS="$LDFLAGS"
2724 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2725
2726 CPPFLAGS="$CPPFLAGS $ORACLE_CPPFLAGS"
b535eed6 2727 LDFLAGS="$LDFLAGS $ORACLE_LDFLAGS"
2cfe4482
VK
2728 if test "x$ORACLE_LD_RUN_PATH" != "x"; then
2729 LD_RUN_PATH="${ORACLE_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2730 fi
2731
41b4790d 2732 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
e5cceced 2733 AC_CHECK_LIB(nnz12, nzstrcpy, [NNZ_LIB=-lnnz12],
7d8c91ef 2734 [
e5cceced
VK
2735 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2736 [
2737 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2738 ], [-lclntsh])
7d8c91ef
VK
2739 ], [-lclntsh])
2740 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2741 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2742 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2743 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2744 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2745 fi
2cfe4482
VK
2746
2747 CPPFLAGS="$OLD_CPPFLAGS"
2748 LDFLAGS="$OLD_LDFLAGS"
2749 LD_RUN_PATH="$OLD_LD_RUN_PATH"
41b4790d
VK
2750fi
2751
84277a0f
AK
2752#--------------------------------------------------------------------
2753# DB2
2754#--------------------------------------------------------------------
2755
2756check_substr "$COMPONENTS" "db2"
2757if test $? = 0; then
2758 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2759 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2760 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2761 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2762 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2763 fi
84277a0f 2764fi
41b4790d 2765
37861c72
VK
2766#--------------------------------------------------------------------
2767# Informix
2768#--------------------------------------------------------------------
2769
2770check_substr "$COMPONENTS" "informix"
2771if test $? = 0; then
2772 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2773 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2774 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2775 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2776 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2777 fi
37861c72
VK
2778fi
2779
c3cfc039 2780
50e4bc8c
VK
2781#--------------------------------------------------------------------
2782# Java
2783#--------------------------------------------------------------------
2784
2785check_substr "$COMPONENTS" "java"
2786if test $? = 0; then
2787 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
50e4bc8c
VK
2788fi
2789
2790
b14c3f22
VK
2791#--------------------------------------------------------------------
2792# Tuxedo
2793#--------------------------------------------------------------------
2794
2795check_substr "$COMPONENTS" "tuxedo"
2796if test $? = 0; then
2797 OLD_CPPFLAGS="$CPPFLAGS"
2798 OLD_LDFLAGS="$LDFLAGS"
2799 OLD_LIBS="$LIBS"
2800
2801 if test "x$TUXEDO_BASE" != "x"; then
2802 TUXEDO_CPPFLAGS="-I$TUXEDO_BASE/include"
2803 TUXEDO_LDFLAGS="-L$TUXEDO_BASE/lib"
2804 CPPFLAGS="$CPPFLAGS $TUXEDO_CPPFLAGS"
2805 LDFLAGS="$LDFLAGS $TUXEDO_LDFLAGS"
2806 fi
2807
2808 AC_CHECK_HEADER(atmi.h,,AC_MSG_ERROR([*** Cannot find atmi.h - check your Tuxedo installation ***]))
2809
2810 # https://community.oracle.com/thread/2346582
2811 if test "x$PLATFORM" = "xLinux"; then
2812 TUXEDO_LDFLAGS="$TUXEDO_LDFLAGS -Xlinker --no-as-needed"
2813 LDFLAGS="$LDFLAGS -Xlinker --no-as-needed"
2814 fi
6d14d0b0
VK
2815
2816 if test "$PLATFORM" = "SunOS"; then
2817 AC_CHECK_LIB(rt, nanosleep, [ TUXEDO_LIBS="$TUXEDO_LIBS -lrt" ])
2818 fi
2819
73517e51
VK
2820 if test "$PLATFORM" = "AIX"; then
2821 AC_MSG_CHECKING(for xa_switchp in libengine)
2822 OLD_LIBS_LIBENGINE="$LIBS"
2823 LIBS="$LIBS -lengine"
2824 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ extern char *xa_switchp; ]], [[ *xa_switchp = 0; ]])],
2825 [
2826 AC_MSG_RESULT(yes)
2827 TUXEDO_LIBS="$TUXEDO_LIBS -lengine"
2828 ],
2829 [ AC_MSG_RESULT(no) ])
2830 LIBS="$OLD_LIBS_LIBENGINE"
2831 fi
2832
6d14d0b0 2833 LIBS="$LIBS $TUXEDO_LIBS"
73517e51 2834 AC_CHECK_LIB(tux, tpcall, [], [AC_MSG_ERROR(libtux is required for Tuxedo support)])
b14c3f22
VK
2835
2836 CPPFLAGS="$OLD_CPPFLAGS"
2837 LDFLAGS="$OLD_LDFLAGS"
2838 LIBS="$OLD_LIBS"
73517e51
VK
2839
2840 if test "x$PLATFORM" = "xAIX"; then
2841 if test -e $TUXEDO_BASE/lib/tpinit.o; then
2842 TUXEDO_LIBS="$TUXEDO_BASE/lib/tpinit.o $TUXEDO_LIBS"
2843 fi
2844 fi
b14c3f22
VK
2845fi
2846
cac05a70 2847#--------------------------------------------------------------------
2848# ZeroMQ
2849#--------------------------------------------------------------------
2850
2851check_substr "$COMPONENTS" "zeromq"
2852if test $? = 0; then
2853 OLD_CPPFLAGS="$CPPFLAGS"
2854 OLD_LDFLAGS="$LDFLAGS"
2855 OLD_LIBS="$LIBS"
2856
2857 if test "x$ZEROMQ_BASE" != "x"; then
2858 ZEROMQ_CPPFLAGS="-I$ZEROMQ_BASE/include"
2859 ZEROMQ_LDFLAGS="-L$ZEROMQ_BASE/lib"
2860 CPPFLAGS="$CPPFLAGS $ZEROMQ_CPPFLAGS"
2861 LDFLAGS="$LDFLAGS $ZEROMQ_LDFLAGS"
7fcdcb0c 2862 fi
cac05a70 2863
ca026ade
VK
2864 AC_CHECK_HEADER(zmq.h,,[
2865 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
2866 AC_MSG_ERROR([*** Cannot find zmq.h - check your ZeroMQ installation ***])
2867 else
2868 ZEROMQ_SUPPORT="no"
2869 fi
2870 ])
2871 AC_CHECK_LIB(zmq, zmq_ctx_new, [ SERVER_LIBS="$SERVER_LIBS -lzmq" ], [
2872 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
2873 AC_MSG_ERROR([*** libzmq is missing or too old - check your ZeroMQ installation ***])
2874 else
2875 ZEROMQ_SUPPORT="no"
2876 fi
2877 ])
cac05a70 2878
ca026ade
VK
2879 if test "x$ZEROMQ_SUPPORT" = "xyes"; then
2880 AC_DEFINE(WITH_ZMQ, 1, Define to 1 if ZeroMQ is supported)
2881 fi
cac05a70 2882
2883 CPPFLAGS="$OLD_CPPFLAGS"
2884 LDFLAGS="$OLD_LDFLAGS"
2885 LIBS="$OLD_LIBS"
2886fi
2887
d6235717 2888#--------------------------------------------------------------------
2889# MongoDB
2890#--------------------------------------------------------------------
2891
2892check_substr "$COMPONENTS" "mongodb"
2893if test $? = 0; then
2894 OLD_CPPFLAGS="$CPPFLAGS"
2895 OLD_LDFLAGS="$LDFLAGS"
2896 OLD_LIBS="$LIBS"
2897
2898 if test "x$MONGODB_BASE" != "x"; then
2899 MONGODB_CPPFLAGS="-I$MONGODB_BASE/include/libmongoc-1.0/ -I$MONGODB_BASE/include/libbson-1.0/"
2900 MONGODB_LDFLAGS="-L$MONGODB_BASE/lib"
2901 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2902 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
2903 else
2904 MONGODB_CPPFLAGS="-I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/"
2905 MONGODB_LDFLAGS="-L/usr/local/lib"
2906 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2907 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
2908 fi
2909
2910 AC_CHECK_HEADER(mongoc.h,,AC_MSG_ERROR([*** Cannot find mongoc.h - check your MongoDB installation ***]))
2911 AC_CHECK_LIB(mongoc-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
2912 AC_CHECK_LIB(bson-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lbson-1.0" ])
2913
2914 LIBS="$LIBS $MONGODB_LIBS"
2915
2916 CPPFLAGS="$OLD_CPPFLAGS"
2917 LDFLAGS="$OLD_LDFLAGS"
2918 LIBS="$OLD_LIBS"
2919fi
b14c3f22 2920
ca0f4ea3
VK
2921#--------------------------------------------------------------------
2922# Other settings
2923#--------------------------------------------------------------------
2924
a5a95ac8
VK
2925if test "x$RUNTIME_PREFIX" = "x"; then
2926 if test "x${BUILD_UNICODE}" = "xyes"; then
f434ab60 2927 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\" -DSTATEDIR=L\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2928 else
f434ab60 2929 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\" -DSTATEDIR=\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2930 fi
b07c50cc 2931else
a5a95ac8 2932 if test "x${BUILD_UNICODE}" = "xyes"; then
54df06e2 2933 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 2934 else
54df06e2 2935 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 2936 fi
1fd3eaa2 2937 LDFLAGS_SUFFIX="$LDFLAGS_SUFFIX -R $RUNTIME_PREFIX/lib"
b07c50cc 2938fi
545bda2d 2939LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2940
25ae8377
VK
2941if test "x${ENABLE_WERROR}" = "xyes"; then
2942 CPPFLAGS="$CPPFLAGS -Werror"
2943fi
2944
cbc4d191
VK
2945if test "x$PLATFORM" = "xDarwin"; then
2946 SHLIB_SUFFIX=".so"
2947else
2948 if test "x$shrext_cmds" != "x"; then
2949 SHLIB_SUFFIX="$shrext_cmds"
2950 else
2951 SHLIB_SUFFIX=".so"
2952 fi
2b479c92 2953fi
cbc4d191 2954AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
2b479c92 2955
8c9993b4
VK
2956if test "x$ENABLE_DEBUG" = "xno"; then
2957 CPPFLAGS="$CPPFLAGS -DNDEBUG"
2958fi
2959
f92a016a
VK
2960if test "x$WITH_JEMALLOC" = "xyes"; then
2961 LIBS="$LIBS -ljemalloc"
2962fi
2963
551ec9ca 2964AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2965AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
f5393033 2966AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
3d2bc3ae 2967AM_CONDITIONAL([USE_INTERNAL_SQLITE], [test "x$HAVE_SQLITE" = "xno"])
1fd41bcd 2968AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2969AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2970AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
c54e483e 2971AM_CONDITIONAL([USE_ENCRYPTION], [test "x${HAVE_LIBCRYPTO}" = "xyes"])
6dde8627 2972AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
058bf6fc 2973AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
7fcdcb0c 2974AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
8b86c5dc 2975
ca0f4ea3 2976
8a96930f
AK
2977#--------------------------------------------------------------------
2978# Cleanup variables
2979#--------------------------------------------------------------------
2980
2981AS_IF([test "x$with_dist" = "xyes"],
2982[
2983 SUBAGENT_DIRS=`echo $SUBAGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2984 MODULES=`echo $MODULES|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2985 SMSDRV_DIRS=`echo $SMSDRV_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2986 HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2987])
2988
ef0c727b
VK
2989#--------------------------------------------------------------------
2990# Substitute variables
2991#--------------------------------------------------------------------
82fa7c5d 2992
ef0c727b
VK
2993AC_SUBST(DB_DRIVERS)
2994AC_SUBST(MODULES)
2995AC_SUBST(SUBAGENT_DIRS)
7dda4453 2996AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2997AC_SUBST(SERVER_LIBS)
ef0c727b 2998AC_SUBST(SERVER_TOOLS)
c20f8eb7 2999AC_SUBST(SMSDRV_DIRS)
6fad8870 3000AC_SUBST(HDLINK_DIRS)
52a2232c 3001AC_SUBST(PDSDRV_DIRS)
ef0c727b
VK
3002AC_SUBST(TOP_LEVEL_MODULES)
3003AC_SUBST(CONTRIB_MODULES)
c2612d83 3004AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
3005AC_SUBST(STATIC_SUBAGENT_LIST)
3006AC_SUBST(SUBAGENT_LIBS)
3007AC_SUBST(BUILD_SERVER)
447350a9 3008AC_SUBST(BUILD_SDK)
2cfe4482
VK
3009AC_SUBST(MYSQL_CPPFLAGS)
3010AC_SUBST(MYSQL_LDFLAGS)
6fce76d8 3011AC_SUBST(MYSQL_LIBS)
2cfe4482
VK
3012AC_SUBST(PGSQL_CPPFLAGS)
3013AC_SUBST(PGSQL_LDFLAGS)
6fce76d8 3014AC_SUBST(PGSQL_LIBS)
2cfe4482
VK
3015AC_SUBST(ORACLE_CPPFLAGS)
3016AC_SUBST(ORACLE_LDFLAGS)
7d8c91ef 3017AC_SUBST(ORACLE_LIBS)
2cfe4482
VK
3018AC_SUBST(ODBC_CPPFLAGS)
3019AC_SUBST(ODBC_LDFLAGS)
6fce76d8 3020AC_SUBST(ODBC_LIBS)
2cfe4482
VK
3021AC_SUBST(DB2_CPPFLAGS)
3022AC_SUBST(DB2_LDFLAGS)
84277a0f 3023AC_SUBST(DB2_LIBS)
2cfe4482
VK
3024AC_SUBST(INFORMIX_CPPFLAGS)
3025AC_SUBST(INFORMIX_LDFLAGS)
87f1fff0 3026AC_SUBST(INFORMIX_LIBS)
11ce9a66 3027AC_SUBST(OBJECT_MODE)
9113e749 3028AC_SUBST(SQLFLAGS)
cbc4d191 3029AC_SUBST(SHLIB_SUFFIX)
b14c3f22
VK
3030AC_SUBST(TUXEDO_CPPFLAGS)
3031AC_SUBST(TUXEDO_LDFLAGS)
6d14d0b0 3032AC_SUBST(TUXEDO_LIBS)
d6235717 3033AC_SUBST(MONGODB_CPPFLAGS)
3034AC_SUBST(MONGODB_LDFLAGS)
3035AC_SUBST(MONGODB_LIBS)
b5e5849b 3036AC_SUBST(INSTALL_LIBPATH)
7fcdcb0c
VK
3037AC_SUBST(ZEROMQ_CPPFLAGS)
3038AC_SUBST(ZEROMQ_LDFLAGS)
d16cf8a5 3039
ef0c727b
VK
3040#--------------------------------------------------------------------
3041# Shared libs versions
d16cf8a5
AK
3042#
3043# versioning scheme: current:revision:age
3044#
3045# current
3046# The number of the current interface exported by the library. A current
3047# value of `0', means that you are calling the interface exported by this
3048# library interface 0.
3049#
3050# revision
3051# The implementation number of the most recent interface exported by this
3052# library. In this case, a revision value of `0' means that this is the
3053# first implementation of the interface.
3054# If the next release of this library exports the same interface, but has a
3055# different implementation (perhaps some bugs have been fixed), the revision
3056# number will be higher, but current number will be the same. In that case,
3057# when given a choice, the library with the highest revision will always
3058# be used by the runtime loader.
3059#
3060# age
3061# The number of previous additional interfaces supported by this library.
3062# If age were `2', then this library can be linked into executables which
3063# were built with a release of this library that exported the current
3064# interface number, current, or any of the previous two interfaces.
3065# By definition age must be less than or equal to current. At the outset,
3066# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 3067#--------------------------------------------------------------------
d16cf8a5 3068
359784de 3069NETXMS_LIBRARY_VERSION=2:0:0
c7d14846 3070AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 3071
ef0c727b
VK
3072#--------------------------------------------------------------------
3073# Generate output files
3074#--------------------------------------------------------------------
d16cf8a5
AK
3075
3076AC_CONFIG_FILES([
0c3c0c39
AK
3077 Makefile
3078 contrib/Makefile
36874eca
VK
3079 contrib/backgrounds/Makefile
3080 contrib/integration/Makefile
3081 contrib/integration/HP_EVA/Makefile
bad6cc0c 3082 contrib/integration/HP_P2000/Makefile
36874eca 3083 contrib/mibs/Makefile
19e3290a 3084 contrib/music/Makefile
0c3c0c39 3085 contrib/startup/Makefile
fa66d60c 3086 contrib/startup/debian/Makefile
daaefaaf 3087 contrib/startup/gentoo/Makefile
7483d0bf 3088 contrib/startup/hp-ux/Makefile
0c3c0c39 3089 contrib/startup/redhat/Makefile
5de3893d 3090 contrib/startup/suse/Makefile
9993edf4 3091 contrib/startup/ubuntu/Makefile
6adf3219 3092 contrib/startup/solaris/Makefile
03b96461 3093 contrib/templates/Makefile
0c3c0c39 3094 doc/Makefile
a48203d2
VK
3095 doc/internal/Makefile
3096 doc/manuals/Makefile
3097 doc/misc/Makefile
0c3c0c39
AK
3098 images/Makefile
3099 include/Makefile
3100 m4/Makefile
0c3c0c39 3101 src/Makefile
9191f6ad
VK
3102 src/agent/Makefile
3103 src/agent/core/Makefile
3104 src/agent/install/Makefile
359784de 3105 src/agent/libnxagent/Makefile
52275230 3106 src/agent/libnxappc/Makefile
a2a24e9d 3107 src/agent/libnxsd/Makefile
9191f6ad 3108 src/agent/subagents/Makefile
9191f6ad 3109 src/agent/subagents/aix/Makefile
df8b3df7 3110 src/agent/subagents/darwin/Makefile
52f5ee00
VK
3111 src/agent/subagents/db2/Makefile
3112 src/agent/subagents/dbquery/Makefile
ab1e80fd 3113 src/agent/subagents/devemu/Makefile
e58b0f75 3114 src/agent/subagents/ds18x20/Makefile
80e96a82 3115 src/agent/subagents/ecs/Makefile
ab1e80fd 3116 src/agent/subagents/filemgr/Makefile
9191f6ad 3117 src/agent/subagents/freebsd/Makefile
478ee38b 3118 src/agent/subagents/gps/Makefile
80e96a82
VK
3119 src/agent/subagents/hpux/Makefile
3120 src/agent/subagents/informix/Makefile
9191f6ad 3121 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
3122 src/agent/subagents/java/Makefile
3123 src/agent/subagents/java/java/Makefile
3124 src/agent/subagents/java/java/src/Makefile
3125 src/agent/subagents/java/java/src/main/Makefile
3126 src/agent/subagents/java/java/src/main/java/Makefile
3127 src/agent/subagents/java/java/src/main/java/org/Makefile
3128 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
3129 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
3118008e 3130 src/agent/subagents/java/java/src/main/java/org/netxms/agent/adapters/Makefile
d2f78ba0 3131 src/agent/subagents/java/sample/Makefile
688dad5a
VK
3132 src/agent/subagents/java/sample/src/Makefile
3133 src/agent/subagents/java/sample/src/main/Makefile
3134 src/agent/subagents/java/sample/src/main/java/Makefile
3135 src/agent/subagents/java/sample/src/main/java/org/Makefile
3136 src/agent/subagents/java/sample/src/main/java/org/netxms/Makefile
3137 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/Makefile
3138 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/demo/Makefile
80e96a82 3139 src/agent/subagents/linux/Makefile
df8b3df7 3140 src/agent/subagents/lmsensors/Makefile
80e96a82 3141 src/agent/subagents/logwatch/Makefile
cfcfdd2b 3142 src/agent/subagents/minix/Makefile
80e96a82 3143 src/agent/subagents/netbsd/Makefile
df8b3df7 3144 src/agent/subagents/netsvc/Makefile
80e96a82
VK
3145 src/agent/subagents/odbcquery/Makefile
3146 src/agent/subagents/openbsd/Makefile
4d1753cd 3147 src/agent/subagents/oracle/Makefile
9191f6ad 3148 src/agent/subagents/ping/Makefile
80e96a82 3149 src/agent/subagents/portCheck/Makefile
df8b3df7 3150 src/agent/subagents/rpi/Makefile
9191f6ad 3151 src/agent/subagents/sms/Makefile
80e96a82 3152 src/agent/subagents/sunos/Makefile
b14c3f22 3153 src/agent/subagents/tuxedo/Makefile
d6235717 3154 src/agent/subagents/mongodb/Makefile
de1205d5 3155 src/agent/subagents/ubntlw/Makefile
9191f6ad 3156 src/agent/subagents/ups/Makefile
80e96a82
VK
3157 src/agent/subagents/winnt/Makefile
3158 src/agent/subagents/winperf/Makefile
52f5ee00 3159 src/agent/subagents/wmi/Makefile
0bd64860 3160 src/agent/tools/Makefile
6ac698ed 3161 src/agent/tools/nxappget/Makefile
0bd64860 3162 src/agent/tools/nxapush/Makefile
d8637bab 3163 src/appagent/Makefile
c2612d83 3164 src/client/Makefile
551592f4 3165 src/client/install/Makefile
be03fec6 3166 src/client/libnxclient/Makefile
c94fa5c2 3167 src/client/nxalarm/Makefile
e84701c5
VK
3168 src/client/nxevent/Makefile
3169 src/client/nxpush/Makefile
59ffa5b7 3170 src/client/nxsms/Makefile
d1834406
VK
3171 src/db/Makefile
3172 src/db/dbdrv/Makefile
87f1fff0
VK
3173 src/db/dbdrv/db2/Makefile
3174 src/db/dbdrv/informix/Makefile
d1834406
VK
3175 src/db/dbdrv/odbc/Makefile
3176 src/db/dbdrv/mssql/Makefile
3177 src/db/dbdrv/mysql/Makefile
87f1fff0 3178 src/db/dbdrv/oracle/Makefile
d1834406
VK
3179 src/db/dbdrv/pgsql/Makefile
3180 src/db/dbdrv/sqlite/Makefile
d1834406 3181 src/db/libnxdb/Makefile
9191f6ad
VK
3182 src/install/Makefile
3183 src/install/windows/Makefile
f5393033 3184 src/jansson/Makefile
9191f6ad
VK
3185 src/libexpat/Makefile
3186 src/libexpat/libexpat/Makefile
3187 src/libnetxms/Makefile
a7a4c1e9 3188 src/libnxcc/Makefile
9191f6ad
VK
3189 src/libnxlp/Makefile
3190 src/libnxmap/Makefile
0d956dd9 3191 src/libnxmb/Makefile
10d5b2b2 3192 src/libnxsl/Makefile
058bf6fc 3193 src/libstrophe/Makefile
a67fa146
VK
3194 src/libtre/Makefile
3195 src/libtre/win32/Makefile
a7a03ffd 3196 src/nxcproxy/Makefile
8dca469f 3197 src/nxlptest/Makefile
9191f6ad 3198 src/nxscript/Makefile
0c3c0c39
AK
3199 src/server/Makefile
3200 src/server/core/Makefile
644f97f5 3201 src/server/drivers/Makefile
386f88e3 3202 src/server/drivers/airespace/Makefile
0239cfea 3203 src/server/drivers/at/Makefile
644f97f5 3204 src/server/drivers/baystack/Makefile
b1bd1fb2 3205 src/server/drivers/cat2900xl/Makefile
910846cc 3206 src/server/drivers/catalyst/Makefile
fce03ab9 3207 src/server/drivers/cisco-esw/Makefile
ae8ea5a6 3208 src/server/drivers/cisco-sb/Makefile
8bdfaed8 3209 src/server/drivers/dell-pwc/Makefile
a548def4 3210 src/server/drivers/dlink/Makefile
644f97f5 3211 src/server/drivers/ers8000/Makefile
d7e23292 3212 src/server/drivers/h3c/Makefile
d594d378 3213 src/server/drivers/hpsw/Makefile
4e592faf
VK
3214 src/server/drivers/lib/Makefile
3215 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 3216 src/server/drivers/lib/cisco/Makefile
a73592db 3217 src/server/drivers/mikrotik/Makefile
81ecaf38 3218 src/server/drivers/netscreen/Makefile
e10e890e 3219 src/server/drivers/ntws/Makefile
c183a9f9 3220 src/server/drivers/ping3/Makefile
9b13553b 3221 src/server/drivers/procurve/Makefile
ac7e4032 3222 src/server/drivers/qtech-olt/Makefile
217e4d6a 3223 src/server/drivers/symbol-ws/Makefile
e5f4e3ac 3224 src/server/drivers/tb/Makefile
8cf94ffe 3225 src/server/drivers/ubnt/Makefile
6fad8870
VK
3226 src/server/hdlink/Makefile
3227 src/server/hdlink/jira/Makefile
d770a97c
VK
3228 src/server/include/Makefile
3229 src/server/libnxsrv/Makefile
3230 src/server/netxmsd/Makefile
52a2232c
VK
3231 src/server/pdsdrv/Makefile
3232 src/server/pdsdrv/rrdtool/Makefile
0c3c0c39 3233 src/server/tools/Makefile
0c3c0c39
AK
3234 src/server/tools/nxaction/Makefile
3235 src/server/tools/nxadm/Makefile
9191f6ad 3236 src/server/tools/nxap/Makefile
5b0c7d0d
VK
3237 src/server/tools/nxconfig/Makefile
3238 src/server/tools/nxconfig/res/Makefile
f90d7fc5 3239 src/server/tools/nxdbmgr/Makefile
9191f6ad 3240 src/server/tools/nxget/Makefile
d24fdaf4 3241 src/server/tools/nxupload/Makefile
623e2f0e
VK
3242 src/smsdrv/Makefile
3243 src/smsdrv/dummy/Makefile
3244 src/smsdrv/generic/Makefile
3245 src/smsdrv/kannel/Makefile
3246 src/smsdrv/nxagent/Makefile
3247 src/smsdrv/portech/Makefile
3248 src/smsdrv/slack/Makefile
3249 src/smsdrv/text2reach/Makefile
3250 src/smsdrv/websms/Makefile
c5c0f362
VK
3251 src/snmp/Makefile
3252 src/snmp/libnxsnmp/Makefile
3253 src/snmp/nxmibc/Makefile
3254 src/snmp/nxsnmpget/Makefile
3255 src/snmp/nxsnmpset/Makefile
3256 src/snmp/nxsnmpwalk/Makefile
9191f6ad 3257 src/sqlite/Makefile
f65df2b1 3258 src/tools/Makefile
f65df2b1 3259 src/tools/nxdevcfg/Makefile
56e13b13 3260 src/tools/nxencpasswd/Makefile
271e3971 3261 src/tools/nxgenguid/Makefile
1fd41bcd 3262 src/zlib/Makefile
9191f6ad 3263 sql/Makefile
33a10d92
VK
3264 tests/Makefile
3265 tests/include/Makefile
3266 tests/test-libnetxms/Makefile
a7a4c1e9 3267 tests/test-libnxcc/Makefile
66c11d49 3268 tests/test-libnxdb/Makefile
9ceab287 3269 tests/test-libnxsnmp/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 3332fi
c54e483e 3333if test "x${HAVE_LIBCRYPTO}" = "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