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