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