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