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