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