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