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