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