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